[asterisk-users] How do I access the Dialstatus numeric code received?

Tilghman Lesher tlesher at digium.com
Tue Jun 22 11:03:49 CDT 2010


On Tuesday 22 June 2010 07:32:00 CDR wrote:
> Tilghman Lesher wrote
> > "Not available in anything other than trunk (to be 1.8).  It depends upon
> > a new
> > feature, so it's not something you can easily backport.  After dialling,
> > the SIP code is available in ${HASH(SIP_CAUSE,<channel-name>)}"
>
> In a real dialplan, how do I get a variable with channel-name?

${HASHKEYS(SIP_CAUSE)} will deliver a list of all channel names which have set
a SIP cause.

> I mean: My 
> app is Sip2Sip. I get one call inbound, get the number dialed ${EXTEN} and
> proceed to try many carriers. If the carriers send me something different
> than 503 Service Unavailable or 404 Not Found, I need to close the call and
> send back whatever SIP code I got, exactly.

I don't think you can send back the same cause code, necessarily.  It would
depend upon the state of your calling channel.  Certainly if the calling
channel is already answered, the only thing you really can do is to drop the
call.  In any case, it's the PRI cause code that you would pass to the Hangup
function that would get mapped back to a SIP cause code.  The SIP cause in the
dialplan is really only useful for dialplan logic, not for passing back to the
calling channel.

> There is no way for me to do 
> that now. Unless I am missing something, I can only play with ${DIALSTATUS}
> and do Hangup(Code), but my "Code" variable is never the same that I got
> from the second leg. I would like to be able to do
> Hangup( ${HASH(SIP_CAUSE,<channel-name>)}", where <channel-name> is the
> last channel used to dial-out. How do I do this in trunk? I will have to
> start using trunk in production. Another issues is the the function
> Hangup(Code) takes a decimal, not related to the SIP code I just got. How
> would you design your 1.8 or 1.62 dialplan around this issue?
> Thanks in advance.

No, actually, the Hangup code is directly mapped to and from SIP codes.  There
are some less-specific cause codes (codes that get mapped from more than one
SIP code), but that's the best that you can get without using a real proxy.

-- 
Tilghman Lesher
Digium, Inc. | Senior Software Developer
twitter: Corydon76 | IRC: Corydon76-dig (Freenode)
Check us out at: www.digium.com & www.asterisk.org



More information about the asterisk-users mailing list