camel-documentation / camel-asterisk.md
otavio021's picture
Upload folder using huggingface_hub
2f8ca06 verified

Asterisk

Since Camel 2.18

Both producer and consumer are supported

The Asterisk component allows you to work easily with an Asterisk PBX Server http://www.asterisk.org/ using asterisk-java

This component helps to interface with Asterisk Manager Interface

Maven users will need to add the following dependency to their pom.xml for this component:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-asterisk</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

URI format

asterisk:name[?options]

Action

Supported actions are:

  • QUEUE_STATUS: Queue status

  • SIP_PEERS: List SIP peers

  • EXTENSION_STATE: Check extension status

Examples

Producer Example

from("direct:in")
  .to("asterisk://myVoIP?hostname=hostname&username=username&password=password&action=EXTENSION_STATE")

Consumer Example

from("asterisk:myVoIP?hostname=hostname&username=username&password=password")
  .log("Received a message - ${body}");

Component Configurations

Name Description Default Type
bridgeErrorHandler Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. false boolean
lazyStartProducer 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 producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. false boolean
autowiredEnabled Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. true boolean

Endpoint Configurations

Name Description Default Type
name Name of component string
hostname The hostname of the asterisk server string
password Login password string
username Login username string
bridgeErrorHandler Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. false boolean
exceptionHandler To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. object
exchangePattern Sets the exchange pattern when the consumer creates an exchange. object
action What action to perform such as getting queue status, sip peers or extension state. object
lazyStartProducer 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 producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. false boolean