allthingssecurity opened a new pull request, #31013: URL: https://github.com/apache/camel/pull/31013
# Description [CAMEL-27627](https://issues.apache.org/jira/browse/CAMEL-27627) The ticket lists four problems of camel-asterisk that came up while the option descriptions were written for CAMEL-23832 (#30959). I checked each one against main. All four are fixed here. Fixed: 1. **The producer subscribed to all AMI events and dropped them.** `AsteriskConnection.login()` always logged in with the event mask `on`, and the producer has no event listener. The producer now logs in with the event mask `off`. `AsteriskConnection` gets `login(String eventMask)`, and `login()` keeps `on`, which the consumer still uses. I checked asterisk-java 3.42.2 with javap: the mask only goes into the `LoginAction` (and is kept for a reconnect), and the `ConnectEvent` after the login is made by asterisk-java itself. The events of `QUEUE_STATUS` and `SIP_PEERS` answer the action (they carry its ActionID), and as far as I know Asterisk writes those to the session whatever its event mask; I could not check that against a real Asterisk server here, only against the fake AMI server of the tests. 2. **The AMI port could not be configured.** The new `port` option (default 5038) is passed to the `ManagerConnectionFactory(host, port, username, password)` constructor. `AsteriskConnection` gets a constructor with the port; the old one keeps 5038, the port that the factory constructor without a port sets (checked with javap), so nothing changes for existing endpoints. 3. **The name path was never set.** `AsteriskComponent.createEndpoint()` now calls `endpoint.setName(remaining)`, so `getName()` returns it instead of null. The component still does not use it to connect. 4. **username and password had no security label.** Both now have `label = "security"`. The endpoint DSL keeps the `username(...)` and `password(...)` methods on the same builders; only their group changes. The behaviour change of 1 and the new option are in the 4.24 upgrade guide, after the camel-asterisk entry that is already there. #30959 (CAMEL-23832, the new descriptions of camel-asterisk) is merged, and this branch is rebased on main after it. The conflicts were in `AsteriskEndpoint` (the `username` and `password` annotations, and the setters whose javadoc #30959 removed) and in the generated files. I kept the texts of #30959, with two changes that this PR needs: - `hostname`: its last sentence said that the consumer and the producer connect "on port 5038, which cannot be changed". That is no longer true, so it now says "on the port of the port option". - `username` and `password` keep their #30959 descriptions and get `label = "security"`. The new `port` option has its description in the `@UriParam` annotation, as #30959 does for the other options, instead of a setter javadoc: "The port of the Asterisk Manager Interface (AMI) of the Asterisk server, as set in the manager.conf file of the server." The description of the `name` path ("The component does not use it to connect.") stays true. The JSON, its catalog copy, the configurer, the URI factory and the endpoint DSL are regenerated from the merged sources. Tests: - `AsteriskProducerFakeServerTest` (existing, extended): the fake AMI server records the `Events` header of each login. New tests: the producer logs in with `off`; an endpoint with the `port` option of the fake server answers `EXTENSION_STATE`, and its name is set; a consumer of that endpoint logs in with `on`. Against the main sources the 3 new tests fail (the producer logs in with `on`, and the two endpoints with `port` fail with an unknown parameter); the 3 existing tests pass. - `AsteriskConfigTest` (existing): also checks that `getName()` is the name of the URI. It fails against the main sources (null). Results after the rebase (offline, module build of camel-asterisk, test phase, unit tests only): 10 tests run, 0 failures, 0 errors, 3 skipped (the tests that need a real Asterisk server, `@Disabled` on main). The two test classes passed 5 runs in a row, and against the main sources the same 4 tests still fail. Generated files: `asterisk.json` of the component and its catalog copy, `AsteriskEndpointConfigurer`, `AsteriskEndpointUriFactory`, and `AsteriskEndpointBuilderFactory` of the endpoint DSL. # Target - [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch) # Tracking - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it): [CAMEL-27627](https://issues.apache.org/jira/browse/CAMEL-27627). # Apache Camel coding standards and style - [x] I checked that each commit in the pull request has a meaningful subject line and body. - [ ] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes. (I built camel-asterisk and ran its unit tests, and committed the regenerated component JSON, configurer and URI factory. The catalog copy is a copy of it (the two were identical on main), and the endpoint DSL was regenerated from it with the generate-endpoint-dsl goal of camel-package-maven-plugin, as an offline build of those modules was not possible here. I did not run the full root build.) # AI-assisted contributions - [x] If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR description identifies the AI tool used. This PR was prepared with Claude Code (Claude Opus 5.5). The commit carries a `Co-Authored-By` trailer. _Claude Code on behalf of allthingssecurity_ 🤖 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]
