[asterisk-users] Listen to ARI events

Joshua C. Colp jcolp at sangoma.com
Wed Jun 7 08:56:14 CDT 2023


On Wed, Jun 7, 2023 at 10:46 AM TTT <lists at telium.io> wrote:

> I’ve reread the documentation a few times, and what isn’t clear is whether
> I need an app=X parameter in the url.  In other words, can I only get
> events for a single named statis app?  Or can I get events for the entire
> Asterisk server?
>
>
>
> The command below (without app= parameter) results in no events being
> shown, but no error either.
>

You must specify an app as well. If you don't, it should reply with a 400.
If it's not... then are you connecting to Asterisk? What does the console
say? For example I did the following:

wscat --connect
"ws://kappa:8088/ari/events?api_key=asterisk:asterisk&subscribeAll=yes&app=test"

Which connected successfully and then I did a call which resulted in:

 {"type":"ChannelCreated","timestamp":"2023-06-07T10:54:56.295-0300","channel":{"id":"1686146096.1","name":"PJSIP/mytrunk_endpoint-00000000","state":"Down","protocol_id":"","caller":{"name":"Electron","number":"1009"},"connected":{"name":"","number":""},"accountcode":"","dialplan":{"context":"from-external","exten":"s","priority":1,"app_name":"","app_data":""},"creationtime":"2023-06-07T10:54:56.295-0300","language":"en"},"asterisk_id":"0c:c4:7a:ba:b3:5a","application":"test"}
<
{"type":"ChannelDialplan","timestamp":"2023-06-07T10:54:56.295-0300","dialplan_app":"AppDial2","dialplan_app_data":"(Outgoing
Line)","channel":{"id":"1686146096.1","name":"PJSIP/mytrunk_endpoint-00000000","state":"Down","protocol_id":"d89ddae0-6568-4ab4-995b-8feb39366a58","caller":{"name":"Electron","number":"1009"},"connected":{"name":"","number":""},"accountcode":"","dialplan":{"context":"from-external","exten":"s","priority":1,"app_name":"AppDial2","app_data":"(Outgoing
Line)"},"creationtime":"2023-06-07T10:54:56.295-0300","language":"en"},"asterisk_id":"0c:c4:7a:ba:b3:5a","application":"test"}
<
{"type":"Dial","timestamp":"2023-06-07T10:54:56.295-0300","dialstatus":"","forward":"","dialstring":"mytrunk_endpoint","peer":{"id":"1686146096.1","name":"PJSIP/mytrunk_endpoint-00000000","state":"Down","protocol_id":"d89ddae0-6568-4ab4-995b-8feb39366a58","caller":{"name":"Electron","number":"1009"},"connected":{"name":"","number":""},"accountcode":"","dialplan":{"context":"from-external","exten":"s","priority":1,"app_name":"AppDial2","app_data":"(Outgoing
Line)"},"creationtime":"2023-06-07T10:54:56.295-0300","language":"en"},"asterisk_id":"0c:c4:7a:ba:b3:5a","application":"test"}
<
{"cause":34,"type":"ChannelHangupRequest","timestamp":"2023-06-07T10:54:56.296-0300","channel":{"id":"1686146096.1","name":"PJSIP/mytrunk_endpoint-00000000","state":"Down","protocol_id":"d89ddae0-6568-4ab4-995b-8feb39366a58","caller":{"name":"Electron","number":"1009"},"connected":{"name":"","number":""},"accountcode":"","dialplan":{"context":"from-external","exten":"s","priority":1,"app_name":"AppDial2","app_data":"(Outgoing
Line)"},"creationtime":"2023-06-07T10:54:56.295-0300","language":"en"},"asterisk_id":"0c:c4:7a:ba:b3:5a","application":"test"}
<
{"type":"Dial","timestamp":"2023-06-07T10:54:56.296-0300","dialstatus":"CONGESTION","forward":"","dialstring":"mytrunk_endpoint","peer":{"id":"1686146096.1","name":"PJSIP/mytrunk_endpoint-00000000","state":"Down","protocol_id":"d89ddae0-6568-4ab4-995b-8feb39366a58","caller":{"name":"Electron","number":"1009"},"connected":{"name":"","number":""},"accountcode":"","dialplan":{"context":"from-external","exten":"s","priority":1,"app_name":"AppDial2","app_data":"(Outgoing
Line)"},"creationtime":"2023-06-07T10:54:56.295-0300","language":"en"},"asterisk_id":"0c:c4:7a:ba:b3:5a","application":"test"}
<
{"type":"ChannelDestroyed","timestamp":"2023-06-07T10:54:56.296-0300","cause":34,"cause_txt":"Circuit/channel
congestion","channel":{"id":"1686146096.1","name":"PJSIP/mytrunk_endpoint-00000000","state":"Down","protocol_id":"d89ddae0-6568-4ab4-995b-8feb39366a58","caller":{"name":"Electron","number":"1009"},"connected":{"name":"","number":""},"accountcode":"","dialplan":{"context":"from-external","exten":"s","priority":1,"app_name":"AppDial2","app_data":"(Outgoing
Line)"},"creationtime":"2023-06-07T10:54:56.295-0300","language":"en"},"asterisk_id":"0c:c4:7a:ba:b3:5a","application":"test"}


-- 
Joshua C. Colp
Asterisk Project Lead
Sangoma Technologies
Check us out at www.sangoma.com and www.asterisk.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20230607/5fbbe747/attachment.html>


More information about the asterisk-users mailing list