[asterisk-users] getting real sip status after dial
Khalil Khamlichi
khamlichi.khalil at gmail.com
Sun Jun 10 07:54:55 CDT 2018
This does not work either.
getting returned sip code out of asterisk turns out to be very time
consuming, even though it is something that is already available to
PJSIP, I can see the information in sip logger, and asterisk forwards
the sip status code to the soft-phone. but does not give access it on
the dial-plan.
On Sat, Jun 9, 2018 at 7:46 PM Eric Wieling <ewieling at nyigc.com> wrote:
>
> My actual dialplan hangupcause handling is in AGI and AEL, so the
> dialplan below has not been tested.
>
> Don't use HANGUPCAUSE_KEYS, the order of the channels varies. Save the
> channel name while the dialplan is in the predial handler like below.
> MASTER_CHANNEL is used to avoid silly issues with the scope of the
> out_chan variable.
>
> [test]
> exten => _X.,1,Set(CHANNEL(hangup_handler_push)=caller_hangup,s,1)
> same => n,Dial(SIP/my-peer/12125551212,30,b(test_pre_dial^s^1))
>
> [test_pre_dial]
> ; while in the handler save the channel
> exten => _X.,1,Set(MASTER_CHANNEL(out_chan)=${CHANNEL{name})
> same => n,Return
>
> You should be able to use the caller hangup handler to get tech
> hangupcauses like "SIP 480 Temporarily Unavailable".
>
> [caller_hangup]
> exten =>
> s,1,Noop(HANGUPCAUSE(${MASTER_CHANNEL(out_chan)},tech)='${HANGUPCAUSE(${MASTER_CHANNEL(out_chan)},tech)}')
> exten => n,Return
>
>
> On 06/09/2018 03:10 PM, Khalil Khamlichi wrote:
> > 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/
>
> --
> http://help.nyigc.net/
More information about the asterisk-users
mailing list