davsclaus opened a new pull request, #29009: URL: https://github.com/apache/camel/pull/29009
Fixes [CAMEL-26185](https://issues.apache.org/jira/browse/CAMEL-26185). ## QUEUE_STATUS and SIP_PEERS lost their result events **What was wrong.** `QueueStatusAction` and `SipPeersAction` are event generating actions. Asterisk answers with a "Queue status will follow" / "Peer status list will follow" response, then sends the data as `QueueParamsEvent`/`QueueMemberEvent` and `PeerEntryEvent` events, ending with a complete event. `AsteriskProducer` sent every action with `ManagerConnection.sendAction`, which returns the first response only. So the body after the producer was only the "will follow" response, and the queue and peer data was lost. **What changed.** - `AsteriskProducer` sends an `EventGeneratingAction` with `sendEventGeneratingAction` and sets the `org.asteriskjava.manager.ResponseEvents` as the body: `getResponse()` is the response, `getEvents()` the events of the list (including the complete event). On a `ManagerError` asterisk-java completes the list at once, so the body is the `ResponseEvents` with the error as its response and no events. - `EXTENSION_STATE` is not event generating and still sets the `ManagerResponse` as the body. - `AsteriskConnection.sendEventGeneratingAction` added, plus package-private constructors on `AsteriskConnection` (taking a `ManagerConnection`) and `AsteriskProducer` (taking an `AsteriskConnection`) so a test can point the producer at a server on a random port. The AMI port is not configurable on the endpoint (the factory uses 5038). **Tests.** New `AsteriskProducerFakeServerTest` runs the producer against a small fake AMI server on a random loopback port (login handshake, `CoreSettings`, and the three actions). The `QUEUE_STATUS` and `SIP_PEERS` tests failed before the fix (body was a `ManagerResponse`, not `ResponseEvents`); the `EXTENSION_STATE` test passes before and after. Module: 7 tests, 0 failures, 3 skipped (the existing `@Disabled` tests that need a real Asterisk). **Docs and generated files.** - `@BodyTypes` `producerOut` now says the body per `action` (`ResponseEvents` for `QUEUE_STATUS` and `SIP_PEERS`, `ManagerResponse` for `EXTENSION_STATE`); the old text "give only the first response, not the events of the list" described the bug. Regenerated `asterisk.json` and copied it and the component doc into `camel-catalog`. - Component doc: the Action section says what the body is per action and how to split on `${body.events}`. - Upgrade guide 4.24: new `camel-asterisk` section, since the body type of `QUEUE_STATUS` and `SIP_PEERS` changes (a route that read the response from the body now finds it in `${body.response}`). **Not changed.** No new option for the event timeout: asterisk-java's default event timeout is used. The consumer is unchanged. _Claude Code on behalf of Claus Ibsen (davsclaus)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
