Re: [asterisk-users] Listen to ARI events

2023-06-07 Thread Joshua C. Colp
On Wed, Jun 7, 2023 at 3:26 PM TTT  wrote:

> I’ve been looking through the docs (near
> https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+Applications+REST+API)
> and am searching for a list of events I can subscribe to.  Is this list
> published?  Or can I query the ARI for a list of available events?
>

You don't subscribe to events, you subscribe to event sources[1] but if
subscribeAll is passed, you are subscribed to everything. The events are on
the wiki[2] with events having base type Event.

[1]
https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+Applications+REST+API#Asterisk20ApplicationsRESTAPI-subscribe
[2] https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+REST+Data+Models

-- 
Joshua C. Colp
Asterisk Project Lead
Sangoma Technologies
Check us out at www.sangoma.com and www.asterisk.org
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Listen to ARI events

2023-06-07 Thread TTT
I’ve been looking through the docs (near 
https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+Applications+REST+API) 
and am searching for a list of events I can subscribe to.  Is this list 
published?  Or can I query the ARI for a list of available events?

 

Thanks

Brian

 

From: asterisk-users [mailto:asterisk-users-boun...@lists.digium.com] On Behalf 
Of Joshua C. Colp
Sent: Wednesday, June 7, 2023 11:08 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion 

Subject: Re: [asterisk-users] Listen to ARI events

 

On Wed, Jun 7, 2023 at 12:04 PM TTT mailto:li...@telium.io> > 
wrote:

Ok that worked.

 

Since I have not declared a statis app called “test”, does that mean any 
non-existent app name on the URL will subscribe to all system events?  (Or is 
test a built-in app name)

 

Applications are not declared or configured anywhere. The act of connecting a 
websocket with an app name creates them. And no, you have to pass 
subscribeAll=yes to have the websocket subscribed to all events. 

 

-- 

Joshua C. Colp

Asterisk Project Lead

Sangoma Technologies

Check us out at www.sangoma.com <http://www.sangoma.com>  and www.asterisk.org 
<http://www.asterisk.org> 

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Listen to ARI events

2023-06-07 Thread Joshua C. Colp
On Wed, Jun 7, 2023 at 12:04 PM TTT  wrote:

> Ok that worked.
>
>
>
> Since I have not declared a statis app called “test”, does that mean any
> non-existent app name on the URL will subscribe to all system events?  (Or
> is test a built-in app name)
>

Applications are not declared or configured anywhere. The act of connecting
a websocket with an app name creates them. And no, you have to pass
subscribeAll=yes to have the websocket subscribed to all events.

-- 
Joshua C. Colp
Asterisk Project Lead
Sangoma Technologies
Check us out at www.sangoma.com and www.asterisk.org
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Listen to ARI events

2023-06-07 Thread TTT
Ok that worked.

 

Since I have not declared a statis app called “test”, does that mean any 
non-existent app name on the URL will subscribe to all system events?  (Or is 
test a built-in app name)

 

Brian

 

From: asterisk-users [mailto:asterisk-users-boun...@lists.digium.com] On Behalf 
Of Joshua C. Colp
Sent: Wednesday, June 7, 2023 9:56 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion 

Subject: Re: [asterisk-users] Listen to ARI events

 

On Wed, Jun 7, 2023 at 10:46 AM TTT mailto:li...@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-","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-","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-","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-","state":"Down","protocol_id":"d89ddae0-6568-4ab4-995b-8feb39366a58","caller":{"name":"Electron","number":"1009"},"connected":{"name":"","number":""},"accountcode":"","dialplan":{"con

Re: [asterisk-users] Listen to ARI events

2023-06-07 Thread Joshua C. Colp
On Wed, Jun 7, 2023 at 10:46 AM TTT  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-","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-","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-","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-","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-","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-","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
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Listen to ARI events

2023-06-07 Thread TTT
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.

 

Thanks

Brian

(Ast newbie)

 

 

From: asterisk-users [mailto:asterisk-users-boun...@lists.digium.com] On Behalf 
Of TTT
Sent: Tuesday, June 6, 2023 8:39 PM
To: 'Asterisk Users Mailing List - Non-Commercial Discussion' 

Subject: Re: [asterisk-users] Listen to ARI events

 

I tried the command below (with subscribeAll=yes).  I made a couple of calls 
but didn’t see any events.  Should I see events?

 

From: asterisk-users [ <mailto:asterisk-users-boun...@lists.digium.com> 
mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Joshua C. Colp
Sent: Tuesday, June 6, 2023 6:31 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion < 
<mailto:asterisk-users@lists.digium.com> asterisk-users@lists.digium.com>
Subject: Re: [asterisk-users] Listen to ARI events

 

On Tue, Jun 6, 2023 at 6:04 PM TTT mailto:li...@telium.io> > 
wrote:

I have the ARI enabled on my Asterisk test box, and want to listen to all 
events.  I can’t find the syntax to do that.  Can I only listen to events 
related to a stasis app?  

 

I was hoping that a simple wscat command like this would show me all events:

 

wscat -c "ws://localhost:8088/ari/events?api_key=asterisk:asterisk "

 

This does not listen to all events by default. If you want to listen to 
everything you can pass subscribeAll=yes[1] like so:

 

ws://localhost:8088/ari/events?api_key=asterisk:asterisk&subscribeAll=yes

 

[1] 
https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+Events+REST+API#Asterisk20EventsRESTAPI-userEvent


 

-- 

Joshua C. Colp

Asterisk Project Lead

Sangoma Technologies

Check us out at  <http://www.sangoma.com> www.sangoma.com and  
<http://www.asterisk.org> www.asterisk.org

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Listen to ARI events

2023-06-06 Thread TTT
I tried the command below (with subscribeAll=yes).  I made a couple of calls 
but didn’t see any events.  Should I see events?

 

From: asterisk-users [mailto:asterisk-users-boun...@lists.digium.com] On Behalf 
Of Joshua C. Colp
Sent: Tuesday, June 6, 2023 6:31 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion 

Subject: Re: [asterisk-users] Listen to ARI events

 

On Tue, Jun 6, 2023 at 6:04 PM TTT mailto:li...@telium.io> > 
wrote:

I have the ARI enabled on my Asterisk test box, and want to listen to all 
events.  I can’t find the syntax to do that.  Can I only listen to events 
related to a stasis app?  

 

I was hoping that a simple wscat command like this would show me all events:

 

wscat -c "ws://localhost:8088/ari/events?api_key=asterisk:asterisk "

 

This does not listen to all events by default. If you want to listen to 
everything you can pass subscribeAll=yes[1] like so:

 

ws://localhost:8088/ari/events?api_key=asterisk:asterisk&subscribeAll=yes

 

[1] 
https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+Events+REST+API#Asterisk20EventsRESTAPI-userEvent


 

-- 

Joshua C. Colp

Asterisk Project Lead

Sangoma Technologies

Check us out at www.sangoma.com <http://www.sangoma.com>  and www.asterisk.org 
<http://www.asterisk.org> 

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Listen to ARI events

2023-06-06 Thread Joshua C. Colp
On Tue, Jun 6, 2023 at 6:04 PM TTT  wrote:

> I have the ARI enabled on my Asterisk test box, and want to listen to all
> events.  I can’t find the syntax to do that.  Can I only listen to events
> related to a stasis app?
>
>
>
> I was hoping that a simple wscat command like this would show me all
> events:
>
>
>
> wscat -c "ws://localhost:8088/ari/events?api_key=asterisk:asterisk "
>

This does not listen to all events by default. If you want to listen to
everything you can pass subscribeAll=yes[1] like so:

ws://localhost:8088/ari/events?api_key=asterisk:asterisk&subscribeAll=yes

[1]
https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+Events+REST+API#Asterisk20EventsRESTAPI-userEvent

-- 
Joshua C. Colp
Asterisk Project Lead
Sangoma Technologies
Check us out at www.sangoma.com and www.asterisk.org
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users