[asterisk-users] getting real sip status after dial

Khalil Khamlichi khamlichi.khalil at gmail.com
Sat Jun 9 14:10:44 CDT 2018


Thanks for your response Eric,

Here is some testing code, as you can see ${HANGUPCAUSE(${ARG1},tech)}
is empty if number is not found (HANGUPCAUSE=1) or if sip request
times-out (HANGUPCAUSE=0) (a dead far end for example) so I had to
check value HANGUPCAUSE and filter out zero and one before moving on.
where all I need is simply the sip code returned from the server that
even softphones are able to give me.


[autodial_out]
exten => _X.,1,NoOP( testing manager dial out )
 same => n,Dial(PJSIP/${EXTEN}@${TRUNK},25,b(autodial_out^setup_hup_handler^1)g)
 same => n,Hangup()


exten => setup_hup_handler,1,Set(CHANNEL(hangup_handler_push)=hdlr1,s,1(${CHANNEL}))
 same => n,Return()


[hdlr1]
exten => s,1,NoOp(START==============================================================================)
 same => n,Set(HANGUPCAUSE_STRING=${HANGUPCAUSE_KEYS()})
 same => n,Set(ASTcause=${HANGUPCAUSE})
 same => n,Set(GO=Found)
 same => n,GotoIf($[${ASTcause}=0]?NotFound0:Check2)
 same => n(Check2),GotoIf($[${ASTcause}=1]?NotFound1:Found)
 same => n(Found),Set(SIPcause=${HANGUPCAUSE(${ARG1},tech)})
 same => n,Goto(End)
 same => n(NotFound0),Set(SIPcause=SIP 500 Server Internal Error)
 same => n,Goto(End)
 same => n(NotFound1),Set(SIPcause=SIP 404 Not Found)
 same => n,Goto(End)
 same => n(End),Set(============================ ${SIPcause} /
${ASTcause} =======================END)
 same => n,Return()


On Sat, Jun 9, 2018 at 7:02 PM Eric Wieling <ewieling at nyigc.com> wrote:
>
> I think HANGUPCAUSE is channel agnostic.
>
> See: core show function HANGUPCAUSE
>
> Some thing like this IIRC:
>      Set(my_cause=${HANGUPCAUSE(${CHANNEL(name)},tech)})
>
> Remember the incoming leg of the call and the outgoing leg of the call
> are different channels.  Make sure you are giving HANGUPCAUSE the
> correct channel.
>
> On 06/09/2018 02:01 PM, Khalil Khamlichi wrote:
> > It seems very weird to me that we cannot access sip code of a call
> > from pjsip which information is actually returned from the provider,
> > so it is available to asterisk, why does asterisk hide it ?
> > On Sat, Jun 9, 2018 at 5:08 PM Khalil Khamlichi
> > <khamlichi.khalil at gmail.com> wrote:
> >>
> >> Hi,
> >>
> >> Is there any way I can get exact sip status from pjsip after a dial ?
> >> or all we can
> >> get is asterisk hangup causes ?
> >>
> >> Thanks in advance.
> >>
> >> KKh
> >
>
> --
> http://help.nyigc.net/



More information about the asterisk-users mailing list