Make 2 ari clients subscribe to events on an extension

Hi everyone,

I have an extension mentioned in extensions.conf file (say ‘123’). There are two separate ari client applications (one written in nodeJS and other in golang), which need to subscribe events on ‘123’, e.g. new incoming call, in call DTMF and call disconnection.

As far as I could find in the community posts and comments, at a time only the latest connection to ARI web socket will receive events. Is there any way, that 2 separate ARI client applications can get events for that extension, e.g. maybe modifying the extension.conf file?

Asterisk Version is 18.x .

Two separate individual named applications can receive individual events as they wish. Subscribing to endpoint events from one does not prevent the other from subscribing.

Thanks for the reply. Currently in my extension.conf, the config for extension ‘123’ looks like this:

exten => 123,1,NoOp("In 123")
same => n,Ringing				
same => n,Stasis(handlerapp)	
same => n,Hangup()

And the two ARI client applications (one in golang and another in nodeJS) are listening for the events on the stasis application “handlerapp”

As per the following two replies from you, only the latest connection to an asterisk stasis app will receive the events.

I am sure, I am missing something here.

Regardless of what application you use, I think you can still specify “subscribeAll=true” to receive events for other applications.

No, modifying the extension.conf file in Asterisk 18.x won’t enable multiple ARI clients to receive events for the same extension simultaneously. Unfortunately, due to limitations in the ARI architecture, only the latest connection to the websocket receives events.

However, there are alternative approaches to achieve your desired functionality:

  1. Event Bridge: Implement an event bridge application (e.g., in NodeJS or Golang) that subscribes to the extension and then broadcasts the events to your separate client applications.
  2. Shared ARI Connection: Use a single client application (ideally written in a language both teams are familiar with) to subscribe to the extension and then distribute the events to your separate applications using other communication channels (e.g., message queues, websockets).

Both approaches require additional development effort, but they provide a way for multiple clients to receive events for the same extension.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.