[asterisk-users] Sip cause and response codes in dialplan

Antony Stone Antony.Stone at asterisk.open.source.it
Tue Feb 20 08:14:09 CST 2018


On Tuesday 20 February 2018 at 14:09:05, Marcus Kvarsell wrote:

> Hi,
> 
> I am experimenting with getting hold of the sip cause and sip response from
> outgoing call. How could i make a userevent printing the sip cause and/or
> sip response. I have tried using hangupcause, sip_cause and such , but i
> am not getting any data.

You don't say which version of Asterisk you're using, so I can't guarantee 
that the following will work for you, but I got this to work using Asterisk 
11.13.1:

In sip.conf, under the [general] stanza, define:
storesipcause=yes

You will get a warning to use hangupcause instead, but I haven't got that to 
do the same thing, so it's no substitute, I think.

Then, in your Dial() command, use M() to call a macro when the call gets 
answered.  https://www.voip-info.org/wiki/view/Asterisk+cmd+Dial

In the macro definition, you can use ${HASH(SIP_CAUSE,${CDR(channel)})} to get 
the SIP response code.  It returns values such as "SIP 200 OK".


Hope that helps,


Antony.

-- 
I conclude that there are two ways of constructing a software design: One way 
is to make it so simple that there are _obviously_ no deficiencies, and the 
other way is to make it so complicated that there are no _obvious_ 
deficiencies.

 - C A R Hoare

                                                   Please reply to the list;
                                                         please *don't* CC me.



More information about the asterisk-users mailing list