Reading SIP response Code in ARI

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.


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

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.

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?

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

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])


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 =‘channel-dump’,subscribeAll=‘true’) in code using ARI (asterisk 16 )

but hitting with below issue

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

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