Reading SIP response Code in ARI

Hi,
I am using Asterisk 15.5. I want to read the SIP response code in ARI for a channel. How can I read the code in ARI?

I am using Python for ARI.

Thanks

https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Channels+REST+API#Asterisk13ChannelsRESTAPI-getChannelVar

HI david,
Thanks for reply… Can you please tell what is the variable name for sip response code

https://wiki.asterisk.org/wiki/display/AST/Hangup+Cause

Hi David,

Actually i want check the “ringing” SIP Response code of Outgoing channel. Once outgoing channel sends we the ringing sip code I want to perform certain task.

I am using ari-python.
Thanks

ARI will raise events when things happen, including when the state changes to ringing. Have you dumped the events to see what is being received?

Hi Jcolp,

I am using “ChannelStateChange” but this event is not giving ringing status. In document it is mentioned that it should give ringing but I am only getting down and up status only.

What is the actual call flow?

extensions.conf
same => n(startStasis),Stasis(mystasis-dial,inbound,PJSIP/${EXTEN}@siptrunkservice)

In ARI,
I originate a outgoing channel,

outgoing = client.channels.originate(endpoint=dialplan_args[1], app=‘mystasis-dial’,appArgs=arguments_to_send,timeout=40,callerId=dialplan_args[7])

outgoing.on_event(‘ChannelStateChange’,channel_state_change_cb)

After call is answered I add both channels to the bridge.

And the SIP traffic itself?

sorry, didn’t get you

What is the output of “pjsip set logger on” which shows an outgoing call and the SIP signaling?

00007 1592846053 * <== 54.x.x.x:5061 SIP/2.0 100 Giving a try

I am getting this in my pjsip history… I don’t see ringing as sip response code…

If you don’t see ringing, then the remote side hasn’t stated that the remote side is ringing.

Ohh yupp… Got the point… I will have a word with SIP trunk provider… Thank you so much Jcolp for your quick response…

I tried something like events = client.events.eventWebsocket(app=‘channel-dump’,subscribeAll=‘true’) in code using ARI (asterisk 16 )

but hitting with below issue

root@68174e11eea6:/code# ./outgoing_call.py
Traceback (most recent call last):
File “./outgoing_call.py”, line 17, in
events = client.events.eventWebsocket(app=‘channel-dump’,subscribeAll=‘true’)
File “/usr/local/lib/python3.8/site-packages/ari/model.py”, line 62, in
return lambda **kwargs: promote(self.client, oper(**kwargs), oper.json)
File “/usr/local/lib/python3.8/site-packages/ari/model.py”, line 354, in promote
resp.raise_for_status()
AttributeError: ‘WebSocket’ object has no attribute ‘raise_for_status’
root@68174e11eea6:/code#

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