This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new ed4b6349d71b CAMEL-27670: camel-asterisk - Add ssl option for the AMI
connection (#31023)
ed4b6349d71b is described below
commit ed4b6349d71b28da6440f265392e64d919f3986d
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri Nov 27 20:29:20 2026 +0100
CAMEL-27670: camel-asterisk - Add ssl option for the AMI connection (#31023)
The AMI connection was always plain TCP, so the AMI username and secret
were sent in clear text. The new ssl endpoint option (default false) makes
the consumer and the producer create the connection with
createSecureManagerConnection() of asterisk-java, which uses the default
SSLSocketFactory and trust store of the JVM.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Claus Ibsen <[email protected]>
---
.../apache/camel/catalog/components/asterisk.json | 3 +-
.../camel/catalog/docs/asterisk-component.adoc | 22 ++++
.../asterisk/AsteriskEndpointConfigurer.java | 3 +
.../asterisk/AsteriskEndpointUriFactory.java | 3 +-
.../apache/camel/component/asterisk/asterisk.json | 3 +-
.../src/main/docs/asterisk-component.adoc | 22 ++++
.../component/asterisk/AsteriskConnection.java | 26 +++-
.../camel/component/asterisk/AsteriskConsumer.java | 7 +-
.../camel/component/asterisk/AsteriskEndpoint.java | 19 +++
.../camel/component/asterisk/AsteriskProducer.java | 7 +-
.../camel/component/asterisk/AsteriskSslTest.java | 72 +++++++++++
.../dsl/AsteriskEndpointBuilderFactory.java | 144 +++++++++++++++++++++
12 files changed, 323 insertions(+), 8 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/asterisk.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/asterisk.json
index d8d5c4068b53..03279a4143ed 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/asterisk.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/asterisk.json
@@ -49,6 +49,7 @@
"action": { "index": 6, "kind": "parameter", "displayName": "Action",
"group": "producer", "label": "producer", "required": false, "type": "enum",
"javaType": "org.apache.camel.component.asterisk.AsteriskAction", "enum": [
"QUEUE_STATUS", "SIP_PEERS", "EXTENSION_STATE" ], "deprecated": false,
"autowired": false, "secret": false, "description": "The AMI action that the
producer sends for each message: QUEUE_STATUS for the status of the queues and
their members, SIP_PEERS for the list [...]
"lazyStartProducer": { "index": 7, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produc [...]
"password": { "index": 8, "kind": "parameter", "displayName": "Password",
"group": "security", "label": "security", "required": true, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "description": "The secret of the AMI
user, as defined in the manager.conf file of the Asterisk server." },
- "username": { "index": 9, "kind": "parameter", "displayName": "Username",
"group": "security", "label": "security", "required": true, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "description": "The name of the AMI user,
as defined in the manager.conf file of the Asterisk server. The consumer and
the producer each log in with it when they start." }
+ "ssl": { "index": 9, "kind": "parameter", "displayName": "Ssl", "group":
"security", "label": "security", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "autowired": false, "secret":
false, "defaultValue": false, "description": "Whether to connect to the
Asterisk Manager Interface (AMI) over TLS instead of plain TCP, so that the
username, the password, the actions and the events are not sent in clear text.
The Asterisk server must accept AMI over TL [...]
+ "username": { "index": 10, "kind": "parameter", "displayName": "Username",
"group": "security", "label": "security", "required": true, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "description": "The name of the AMI user,
as defined in the manager.conf file of the Asterisk server. The consumer and
the producer each log in with it when they start." }
}
}
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/asterisk-component.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/asterisk-component.adoc
index 2fe45861000a..01e319ec1f4e 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/asterisk-component.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/asterisk-component.adoc
@@ -58,6 +58,28 @@ and `getEvents()` the events of the list, such as
`QueueParamsEvent` and `QueueM
EXTENSION_STATE sets the `ManagerResponse` (an `ExtensionStateResponse`) as
the message body.
When Asterisk answers with an error, the response is a `ManagerError`.
+== TLS
+
+By default the consumer and the producer connect to the Asterisk Manager
Interface (AMI) over plain TCP, so the
+username, the password, the actions and the events are sent in clear text. Set
`ssl=true` to connect over TLS, and
+set `port` to the TLS port of the AMI, usually 5039 (the default port 5038 is
the one of plain TCP):
+
+[source,java]
+----
+from("asterisk:myVoIP?hostname=hostname&port=5039&username=username&password=password&ssl=true")
+ .log("Received a message - ${body}");
+----
+
+The Asterisk server must accept AMI over TLS on that port: set `tlsenable=yes`
and the `tlsbindaddr` address
+(`0.0.0.0:5039` for example) in the `[general]` section of `manager.conf`,
together with the certificate of the server
+(`tlscertfile` and `tlsprivatekey`).
+
+asterisk-java opens the TLS socket with the default `SSLSocketFactory` of the
JVM, so the certificate of the server
+is checked with the default trust store of the JVM. When the certificate is
not signed by a certificate authority that
+the JVM trusts, add it to a trust store and point the JVM to it with the
`javax.net.ssl.trustStore` and
+`javax.net.ssl.trustStorePassword` system properties. A custom
`SSLContextParameters` is not supported, and the host
+name of the server is not checked against the certificate: asterisk-java
offers neither.
+
== Examples
=== Producer Example
diff --git
a/components/camel-asterisk/src/generated/java/org/apache/camel/component/asterisk/AsteriskEndpointConfigurer.java
b/components/camel-asterisk/src/generated/java/org/apache/camel/component/asterisk/AsteriskEndpointConfigurer.java
index 13d4a15ce4d2..a11c93f854ce 100644
---
a/components/camel-asterisk/src/generated/java/org/apache/camel/component/asterisk/AsteriskEndpointConfigurer.java
+++
b/components/camel-asterisk/src/generated/java/org/apache/camel/component/asterisk/AsteriskEndpointConfigurer.java
@@ -36,6 +36,7 @@ public class AsteriskEndpointConfigurer extends
PropertyConfigurerSupport implem
case "lazyStartProducer":
target.setLazyStartProducer(property(camelContext, boolean.class, value));
return true;
case "password": target.setPassword(property(camelContext,
java.lang.String.class, value)); return true;
case "port": target.setPort(property(camelContext, int.class, value));
return true;
+ case "ssl": target.setSsl(property(camelContext, boolean.class,
value)); return true;
case "username": target.setUsername(property(camelContext,
java.lang.String.class, value)); return true;
default: return false;
}
@@ -56,6 +57,7 @@ public class AsteriskEndpointConfigurer extends
PropertyConfigurerSupport implem
case "lazyStartProducer": return boolean.class;
case "password": return java.lang.String.class;
case "port": return int.class;
+ case "ssl": return boolean.class;
case "username": return java.lang.String.class;
default: return null;
}
@@ -77,6 +79,7 @@ public class AsteriskEndpointConfigurer extends
PropertyConfigurerSupport implem
case "lazyStartProducer": return target.isLazyStartProducer();
case "password": return target.getPassword();
case "port": return target.getPort();
+ case "ssl": return target.isSsl();
case "username": return target.getUsername();
default: return null;
}
diff --git
a/components/camel-asterisk/src/generated/java/org/apache/camel/component/asterisk/AsteriskEndpointUriFactory.java
b/components/camel-asterisk/src/generated/java/org/apache/camel/component/asterisk/AsteriskEndpointUriFactory.java
index 3e6678286832..1e466688a246 100644
---
a/components/camel-asterisk/src/generated/java/org/apache/camel/component/asterisk/AsteriskEndpointUriFactory.java
+++
b/components/camel-asterisk/src/generated/java/org/apache/camel/component/asterisk/AsteriskEndpointUriFactory.java
@@ -24,7 +24,7 @@ public class AsteriskEndpointUriFactory extends
org.apache.camel.support.compone
private static final Set<String> ENDPOINT_IDENTITY_PROPERTY_NAMES;
private static final Map<String, String> MULTI_VALUE_PREFIXES;
static {
- Set<String> props = new HashSet<>(10);
+ Set<String> props = new HashSet<>(11);
props.add("action");
props.add("bridgeErrorHandler");
props.add("exceptionHandler");
@@ -34,6 +34,7 @@ public class AsteriskEndpointUriFactory extends
org.apache.camel.support.compone
props.add("name");
props.add("password");
props.add("port");
+ props.add("ssl");
props.add("username");
PROPERTY_NAMES = Collections.unmodifiableSet(props);
Set<String> secretProps = new HashSet<>(2);
diff --git
a/components/camel-asterisk/src/generated/resources/META-INF/org/apache/camel/component/asterisk/asterisk.json
b/components/camel-asterisk/src/generated/resources/META-INF/org/apache/camel/component/asterisk/asterisk.json
index d8d5c4068b53..03279a4143ed 100644
---
a/components/camel-asterisk/src/generated/resources/META-INF/org/apache/camel/component/asterisk/asterisk.json
+++
b/components/camel-asterisk/src/generated/resources/META-INF/org/apache/camel/component/asterisk/asterisk.json
@@ -49,6 +49,7 @@
"action": { "index": 6, "kind": "parameter", "displayName": "Action",
"group": "producer", "label": "producer", "required": false, "type": "enum",
"javaType": "org.apache.camel.component.asterisk.AsteriskAction", "enum": [
"QUEUE_STATUS", "SIP_PEERS", "EXTENSION_STATE" ], "deprecated": false,
"autowired": false, "secret": false, "description": "The AMI action that the
producer sends for each message: QUEUE_STATUS for the status of the queues and
their members, SIP_PEERS for the list [...]
"lazyStartProducer": { "index": 7, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produc [...]
"password": { "index": 8, "kind": "parameter", "displayName": "Password",
"group": "security", "label": "security", "required": true, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "description": "The secret of the AMI
user, as defined in the manager.conf file of the Asterisk server." },
- "username": { "index": 9, "kind": "parameter", "displayName": "Username",
"group": "security", "label": "security", "required": true, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "description": "The name of the AMI user,
as defined in the manager.conf file of the Asterisk server. The consumer and
the producer each log in with it when they start." }
+ "ssl": { "index": 9, "kind": "parameter", "displayName": "Ssl", "group":
"security", "label": "security", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "autowired": false, "secret":
false, "defaultValue": false, "description": "Whether to connect to the
Asterisk Manager Interface (AMI) over TLS instead of plain TCP, so that the
username, the password, the actions and the events are not sent in clear text.
The Asterisk server must accept AMI over TL [...]
+ "username": { "index": 10, "kind": "parameter", "displayName": "Username",
"group": "security", "label": "security", "required": true, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "description": "The name of the AMI user,
as defined in the manager.conf file of the Asterisk server. The consumer and
the producer each log in with it when they start." }
}
}
diff --git a/components/camel-asterisk/src/main/docs/asterisk-component.adoc
b/components/camel-asterisk/src/main/docs/asterisk-component.adoc
index 2fe45861000a..01e319ec1f4e 100644
--- a/components/camel-asterisk/src/main/docs/asterisk-component.adoc
+++ b/components/camel-asterisk/src/main/docs/asterisk-component.adoc
@@ -58,6 +58,28 @@ and `getEvents()` the events of the list, such as
`QueueParamsEvent` and `QueueM
EXTENSION_STATE sets the `ManagerResponse` (an `ExtensionStateResponse`) as
the message body.
When Asterisk answers with an error, the response is a `ManagerError`.
+== TLS
+
+By default the consumer and the producer connect to the Asterisk Manager
Interface (AMI) over plain TCP, so the
+username, the password, the actions and the events are sent in clear text. Set
`ssl=true` to connect over TLS, and
+set `port` to the TLS port of the AMI, usually 5039 (the default port 5038 is
the one of plain TCP):
+
+[source,java]
+----
+from("asterisk:myVoIP?hostname=hostname&port=5039&username=username&password=password&ssl=true")
+ .log("Received a message - ${body}");
+----
+
+The Asterisk server must accept AMI over TLS on that port: set `tlsenable=yes`
and the `tlsbindaddr` address
+(`0.0.0.0:5039` for example) in the `[general]` section of `manager.conf`,
together with the certificate of the server
+(`tlscertfile` and `tlsprivatekey`).
+
+asterisk-java opens the TLS socket with the default `SSLSocketFactory` of the
JVM, so the certificate of the server
+is checked with the default trust store of the JVM. When the certificate is
not signed by a certificate authority that
+the JVM trusts, add it to a trust store and point the JVM to it with the
`javax.net.ssl.trustStore` and
+`javax.net.ssl.trustStorePassword` system properties. A custom
`SSLContextParameters` is not supported, and the host
+name of the server is not checked against the certificate: asterisk-java
offers neither.
+
== Examples
=== Producer Example
diff --git
a/components/camel-asterisk/src/main/java/org/apache/camel/component/asterisk/AsteriskConnection.java
b/components/camel-asterisk/src/main/java/org/apache/camel/component/asterisk/AsteriskConnection.java
index d9bfdd5cd090..2acc51fcb117 100644
---
a/components/camel-asterisk/src/main/java/org/apache/camel/component/asterisk/AsteriskConnection.java
+++
b/components/camel-asterisk/src/main/java/org/apache/camel/component/asterisk/AsteriskConnection.java
@@ -44,17 +44,32 @@ public final class AsteriskConnection {
private final int port;
private final String username;
private final String password;
+ private final boolean ssl;
private ManagerConnection managerConnection;
public AsteriskConnection(String host, String username, String password) {
- this(host, DEFAULT_PORT, username, password);
+ this(host, DEFAULT_PORT, username, password, false);
}
public AsteriskConnection(String host, int port, String username, String
password) {
+ this(host, port, username, password, false);
+ }
+
+ /**
+ * Creates the connection.
+ *
+ * @param host the host name of the Asterisk server
+ * @param port the port of the AMI on the Asterisk server
+ * @param username the name of the AMI user
+ * @param password the secret of the AMI user
+ * @param ssl whether to connect to the AMI over TLS instead of plain
TCP
+ */
+ public AsteriskConnection(String host, int port, String username, String
password, boolean ssl) {
this.host = host;
this.port = port;
this.username = username;
this.password = password;
+ this.ssl = ssl;
}
AsteriskConnection(ManagerConnection managerConnection) {
@@ -62,15 +77,16 @@ public final class AsteriskConnection {
this.port = managerConnection.getPort();
this.username = managerConnection.getUsername();
this.password = managerConnection.getPassword();
+ this.ssl = managerConnection.isSsl();
this.managerConnection = managerConnection;
}
public void connect() {
if (managerConnection == null) {
- LOG.debug("asterisk connection attempt to {}:{} username: {}",
host, port, username);
+ LOG.debug("asterisk connection attempt to {}:{} username: {} ssl:
{}", host, port, username, ssl);
ManagerConnectionFactory factory = new
ManagerConnectionFactory(host, port, username, password);
- managerConnection = factory.createManagerConnection();
+ managerConnection = ssl ? factory.createSecureManagerConnection()
: factory.createManagerConnection();
LOG.debug("asterisk connection established!");
}
@@ -138,6 +154,10 @@ public final class AsteriskConnection {
return managerConnection.sendAction(action);
}
+ ManagerConnection getManagerConnection() {
+ return managerConnection;
+ }
+
public ResponseEvents sendEventGeneratingAction(EventGeneratingAction
action)
throws IllegalArgumentException, IllegalStateException,
IOException, EventTimeoutException {
diff --git
a/components/camel-asterisk/src/main/java/org/apache/camel/component/asterisk/AsteriskConsumer.java
b/components/camel-asterisk/src/main/java/org/apache/camel/component/asterisk/AsteriskConsumer.java
index 2b5ff2a97d9b..edfc05f97ad5 100644
---
a/components/camel-asterisk/src/main/java/org/apache/camel/component/asterisk/AsteriskConsumer.java
+++
b/components/camel-asterisk/src/main/java/org/apache/camel/component/asterisk/AsteriskConsumer.java
@@ -33,10 +33,15 @@ public class AsteriskConsumer extends DefaultConsumer {
super(endpoint, processor);
this.connection = new AsteriskConnection(
- endpoint.getHostname(), endpoint.getPort(),
endpoint.getUsername(), endpoint.getPassword());
+ endpoint.getHostname(), endpoint.getPort(),
endpoint.getUsername(), endpoint.getPassword(),
+ endpoint.isSsl());
this.listener = new EventListener();
}
+ AsteriskConnection getConnection() {
+ return connection;
+ }
+
@Override
protected void doStart() throws Exception {
connection.connect();
diff --git
a/components/camel-asterisk/src/main/java/org/apache/camel/component/asterisk/AsteriskEndpoint.java
b/components/camel-asterisk/src/main/java/org/apache/camel/component/asterisk/AsteriskEndpoint.java
index f2be7072ca46..18e8d9f77a7f 100644
---
a/components/camel-asterisk/src/main/java/org/apache/camel/component/asterisk/AsteriskEndpoint.java
+++
b/components/camel-asterisk/src/main/java/org/apache/camel/component/asterisk/AsteriskEndpoint.java
@@ -97,6 +97,17 @@ public class AsteriskEndpoint extends DefaultEndpoint
implements EndpointService
@Metadata(required = true)
private String password;
+ @UriParam(label = "security", defaultValue = "false",
+ description = "Whether to connect to the Asterisk Manager
Interface (AMI) over TLS instead of plain TCP, so that"
+ + " the username, the password, the actions and
the events are not sent in clear text. The"
+ + " Asterisk server must accept AMI over TLS
(tlsenable and tlsbindaddr in the manager.conf"
+ + " file), and the port option must be set to its
TLS port, usually 5039, as the default port"
+ + " 5038 is the one of plain TCP. The certificate
of the server is"
+ + " checked with the default SSL socket factory
and trust store of the JVM"
+ + " (javax.net.ssl.trustStore). The host name of
the server is not checked against the"
+ + " certificate, and a custom SSLContext is not
supported, as asterisk-java does not offer it.")
+ private boolean ssl;
+
public AsteriskEndpoint(String uri, AsteriskComponent component) {
super(uri, component);
}
@@ -162,6 +173,14 @@ public class AsteriskEndpoint extends DefaultEndpoint
implements EndpointService
this.action = action;
}
+ public boolean isSsl() {
+ return ssl;
+ }
+
+ public void setSsl(boolean ssl) {
+ this.ssl = ssl;
+ }
+
public String getHostname() {
return hostname;
}
diff --git
a/components/camel-asterisk/src/main/java/org/apache/camel/component/asterisk/AsteriskProducer.java
b/components/camel-asterisk/src/main/java/org/apache/camel/component/asterisk/AsteriskProducer.java
index f883a9ae01d5..4233389ddba0 100644
---
a/components/camel-asterisk/src/main/java/org/apache/camel/component/asterisk/AsteriskProducer.java
+++
b/components/camel-asterisk/src/main/java/org/apache/camel/component/asterisk/AsteriskProducer.java
@@ -38,7 +38,8 @@ public class AsteriskProducer extends DefaultProducer {
public AsteriskProducer(AsteriskEndpoint endpoint) {
this(endpoint, new AsteriskConnection(
- endpoint.getHostname(), endpoint.getPort(),
endpoint.getUsername(), endpoint.getPassword()));
+ endpoint.getHostname(), endpoint.getPort(),
endpoint.getUsername(), endpoint.getPassword(),
+ endpoint.isSsl()));
}
AsteriskProducer(AsteriskEndpoint endpoint, AsteriskConnection connection)
{
@@ -48,6 +49,10 @@ public class AsteriskProducer extends DefaultProducer {
this.connection = connection;
}
+ AsteriskConnection getConnection() {
+ return connection;
+ }
+
@Override
protected void doStart() throws Exception {
// the producer has no event listener, so Asterisk does not need to
send it the events of the PBX. The events
diff --git
a/components/camel-asterisk/src/test/java/org/apache/camel/component/asterisk/AsteriskSslTest.java
b/components/camel-asterisk/src/test/java/org/apache/camel/component/asterisk/AsteriskSslTest.java
new file mode 100644
index 000000000000..8cdd18efa917
--- /dev/null
+++
b/components/camel-asterisk/src/test/java/org/apache/camel/component/asterisk/AsteriskSslTest.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.asterisk;
+
+import org.apache.camel.test.junit6.CamelTestSupport;
+import org.asteriskjava.manager.ManagerConnection;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Checks that the ssl option reaches the AMI connection of the consumer and
the producer. Creating the connection does
+ * not connect to the server, so no Asterisk server is needed.
+ */
+public class AsteriskSslTest extends CamelTestSupport {
+
+ private static final String URI =
"asterisk:myVoIP?hostname=localhost&username=admin&password=secret";
+
+ @Test
+ void sslIsOffByDefault() throws Exception {
+ AsteriskEndpoint endpoint = context.getEndpoint(URI +
"&action=QUEUE_STATUS", AsteriskEndpoint.class);
+ assertFalse(endpoint.isSsl());
+
+ assertFalse(managerConnectionOf((AsteriskProducer)
endpoint.createProducer()).isSsl());
+ assertFalse(managerConnectionOf((AsteriskConsumer)
endpoint.createConsumer(exchange -> {
+ })).isSsl());
+ }
+
+ @Test
+ void sslReachesTheManagerConnection() throws Exception {
+ AsteriskEndpoint endpoint = context.getEndpoint(URI +
"&action=QUEUE_STATUS&ssl=true", AsteriskEndpoint.class);
+ assertTrue(endpoint.isSsl());
+
+ ManagerConnection producerConnection =
managerConnectionOf((AsteriskProducer) endpoint.createProducer());
+ assertTrue(producerConnection.isSsl());
+ assertEquals("localhost", producerConnection.getHostname());
+ assertEquals("admin", producerConnection.getUsername());
+
+ ManagerConnection consumerConnection =
managerConnectionOf((AsteriskConsumer) endpoint.createConsumer(exchange -> {
+ }));
+ assertTrue(consumerConnection.isSsl());
+ assertEquals("localhost", consumerConnection.getHostname());
+ }
+
+ private static ManagerConnection managerConnectionOf(AsteriskProducer
producer) {
+ AsteriskConnection connection = producer.getConnection();
+ connection.connect();
+ return connection.getManagerConnection();
+ }
+
+ private static ManagerConnection managerConnectionOf(AsteriskConsumer
consumer) {
+ AsteriskConnection connection = consumer.getConnection();
+ connection.connect();
+ return connection.getManagerConnection();
+ }
+}
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AsteriskEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AsteriskEndpointBuilderFactory.java
index ba0c9f293d3c..6426d1ce9a39 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AsteriskEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AsteriskEndpointBuilderFactory.java
@@ -109,6 +109,54 @@ public interface AsteriskEndpointBuilderFactory {
doSetProperty("password", password);
return this;
}
+ /**
+ * Whether to connect to the Asterisk Manager Interface (AMI) over TLS
+ * instead of plain TCP, so that the username, the password, the
actions
+ * and the events are not sent in clear text. The Asterisk server must
+ * accept AMI over TLS (tlsenable and tlsbindaddr in the manager.conf
+ * file), and the port option must be set to its TLS port, usually
5039,
+ * as the default port 5038 is the one of plain TCP. The certificate of
+ * the server is checked with the default SSL socket factory and trust
+ * store of the JVM (javax.net.ssl.trustStore). The host name of the
+ * server is not checked against the certificate, and a custom
+ * SSLContext is not supported, as asterisk-java does not offer it.
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: security
+ *
+ * @param ssl the value to set
+ * @return the dsl builder
+ */
+ default AsteriskEndpointConsumerBuilder ssl(boolean ssl) {
+ doSetProperty("ssl", ssl);
+ return this;
+ }
+ /**
+ * Whether to connect to the Asterisk Manager Interface (AMI) over TLS
+ * instead of plain TCP, so that the username, the password, the
actions
+ * and the events are not sent in clear text. The Asterisk server must
+ * accept AMI over TLS (tlsenable and tlsbindaddr in the manager.conf
+ * file), and the port option must be set to its TLS port, usually
5039,
+ * as the default port 5038 is the one of plain TCP. The certificate of
+ * the server is checked with the default SSL socket factory and trust
+ * store of the JVM (javax.net.ssl.trustStore). The host name of the
+ * server is not checked against the certificate, and a custom
+ * SSLContext is not supported, as asterisk-java does not offer it.
+ *
+ * The option will be converted to a <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: security
+ *
+ * @param ssl the value to set
+ * @return the dsl builder
+ */
+ default AsteriskEndpointConsumerBuilder ssl(String ssl) {
+ doSetProperty("ssl", ssl);
+ return this;
+ }
/**
* The name of the AMI user, as defined in the manager.conf file of the
* Asterisk server. The consumer and the producer each log in with it
@@ -371,6 +419,54 @@ public interface AsteriskEndpointBuilderFactory {
doSetProperty("password", password);
return this;
}
+ /**
+ * Whether to connect to the Asterisk Manager Interface (AMI) over TLS
+ * instead of plain TCP, so that the username, the password, the
actions
+ * and the events are not sent in clear text. The Asterisk server must
+ * accept AMI over TLS (tlsenable and tlsbindaddr in the manager.conf
+ * file), and the port option must be set to its TLS port, usually
5039,
+ * as the default port 5038 is the one of plain TCP. The certificate of
+ * the server is checked with the default SSL socket factory and trust
+ * store of the JVM (javax.net.ssl.trustStore). The host name of the
+ * server is not checked against the certificate, and a custom
+ * SSLContext is not supported, as asterisk-java does not offer it.
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: security
+ *
+ * @param ssl the value to set
+ * @return the dsl builder
+ */
+ default AsteriskEndpointProducerBuilder ssl(boolean ssl) {
+ doSetProperty("ssl", ssl);
+ return this;
+ }
+ /**
+ * Whether to connect to the Asterisk Manager Interface (AMI) over TLS
+ * instead of plain TCP, so that the username, the password, the
actions
+ * and the events are not sent in clear text. The Asterisk server must
+ * accept AMI over TLS (tlsenable and tlsbindaddr in the manager.conf
+ * file), and the port option must be set to its TLS port, usually
5039,
+ * as the default port 5038 is the one of plain TCP. The certificate of
+ * the server is checked with the default SSL socket factory and trust
+ * store of the JVM (javax.net.ssl.trustStore). The host name of the
+ * server is not checked against the certificate, and a custom
+ * SSLContext is not supported, as asterisk-java does not offer it.
+ *
+ * The option will be converted to a <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: security
+ *
+ * @param ssl the value to set
+ * @return the dsl builder
+ */
+ default AsteriskEndpointProducerBuilder ssl(String ssl) {
+ doSetProperty("ssl", ssl);
+ return this;
+ }
/**
* The name of the AMI user, as defined in the manager.conf file of the
* Asterisk server. The consumer and the producer each log in with it
@@ -522,6 +618,54 @@ public interface AsteriskEndpointBuilderFactory {
doSetProperty("password", password);
return this;
}
+ /**
+ * Whether to connect to the Asterisk Manager Interface (AMI) over TLS
+ * instead of plain TCP, so that the username, the password, the
actions
+ * and the events are not sent in clear text. The Asterisk server must
+ * accept AMI over TLS (tlsenable and tlsbindaddr in the manager.conf
+ * file), and the port option must be set to its TLS port, usually
5039,
+ * as the default port 5038 is the one of plain TCP. The certificate of
+ * the server is checked with the default SSL socket factory and trust
+ * store of the JVM (javax.net.ssl.trustStore). The host name of the
+ * server is not checked against the certificate, and a custom
+ * SSLContext is not supported, as asterisk-java does not offer it.
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: security
+ *
+ * @param ssl the value to set
+ * @return the dsl builder
+ */
+ default AsteriskEndpointBuilder ssl(boolean ssl) {
+ doSetProperty("ssl", ssl);
+ return this;
+ }
+ /**
+ * Whether to connect to the Asterisk Manager Interface (AMI) over TLS
+ * instead of plain TCP, so that the username, the password, the
actions
+ * and the events are not sent in clear text. The Asterisk server must
+ * accept AMI over TLS (tlsenable and tlsbindaddr in the manager.conf
+ * file), and the port option must be set to its TLS port, usually
5039,
+ * as the default port 5038 is the one of plain TCP. The certificate of
+ * the server is checked with the default SSL socket factory and trust
+ * store of the JVM (javax.net.ssl.trustStore). The host name of the
+ * server is not checked against the certificate, and a custom
+ * SSLContext is not supported, as asterisk-java does not offer it.
+ *
+ * The option will be converted to a <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: security
+ *
+ * @param ssl the value to set
+ * @return the dsl builder
+ */
+ default AsteriskEndpointBuilder ssl(String ssl) {
+ doSetProperty("ssl", ssl);
+ return this;
+ }
/**
* The name of the AMI user, as defined in the manager.conf file of the
* Asterisk server. The consumer and the producer each log in with it