Administrator TOOTAI
2018-Nov-27 12:13 UTC
[asterisk-users] PJSIP add header on forwarded call
Le 27/11/2018 à 12:13, Joshua C. Colp a écrit :> On Tue, Nov 27, 2018, at 5:49 AM, Administrator TOOTAI wrote:[...] >> >> [TOOTAiAudio] >> ; >> ; Call our gateway >> >> exten = s,1,Set(PJSIP_HEADER(add,X-TOOTAiAudio-CALLED)=${ARG1}) >> same = n,Dial(PJSIP/${ARG1}@TOOTAiAudio,,T) >> same = n,Return >> >> exten = h,1,NoOp() >> same = n,NoOp(Hangup Cause: ${HANGUPCAUSE}) >> same = n,NoOp(Dial status : ${DIALSTATUS}) >> same = n,NoOp(X-TOOTAiAudio=${PJSIP_HEADER(read,X-TOOTAiAudio-CALLED)}) >> same = n,Return[...]>> >> Why can't be PJSIP extra headers setted in this case ? > > As documented on the wiki[1] the PJSIP_HEADER dialplan function has to be executed on the PJSIP channel itself, not the calling channel. You need to use a pre-dial handler and invoke it there. > > [1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Function_PJSIP_HEADER >Thanks Joshua, that worked. As you see above I want to have the value of headers when call is ended. Problem is that on h extension the channel already gone. Is there a solution to archieve this ? -- Daniel
On Tue, Nov 27, 2018, at 8:13 AM, Administrator TOOTAI wrote:> Le 27/11/2018 à 12:13, Joshua C. Colp a écrit : > > On Tue, Nov 27, 2018, at 5:49 AM, Administrator TOOTAI wrote:[...] > >> > >> [TOOTAiAudio] > >> ; > >> ; Call our gateway > >> > >> exten = s,1,Set(PJSIP_HEADER(add,X-TOOTAiAudio-CALLED)=${ARG1}) > >> same = n,Dial(PJSIP/${ARG1}@TOOTAiAudio,,T) > >> same = n,Return > >> > >> exten = h,1,NoOp() > >> same = n,NoOp(Hangup Cause: ${HANGUPCAUSE}) > >> same = n,NoOp(Dial status : ${DIALSTATUS}) > >> same = n,NoOp(X-TOOTAiAudio=${PJSIP_HEADER(read,X-TOOTAiAudio-CALLED)}) > >> same = n,Return > [...] > >> > >> Why can't be PJSIP extra headers setted in this case ? > > > > As documented on the wiki[1] the PJSIP_HEADER dialplan function has to be executed on the PJSIP channel itself, not the calling channel. You need to use a pre-dial handler and invoke it there. > > > > [1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Function_PJSIP_HEADER > > > > Thanks Joshua, that worked. As you see above I want to have the value of > headers when call is ended. Problem is that on h extension the channel > already gone. > > Is there a solution to archieve this ?Is there a reason you can't use a normal dialplan variable instead? Otherwise I don't believe PJSIP_HEADER will retrieve such information regardless, it's for querying headers on an incoming INVITE. -- Joshua C. Colp Digium - A Sangoma Company | Senior Software Developer 445 Jan Davis Drive NW - Huntsville, AL 35806 - US Check us out at: www.digium.com & www.asterisk.org
Administrator TOOTAI
2018-Nov-27 12:31 UTC
[asterisk-users] PJSIP add header on forwarded call
Le 27/11/2018 à 13:18, Joshua C. Colp a écrit :> On Tue, Nov 27, 2018, at 8:13 AM, Administrator TOOTAI wrote: >> Le 27/11/2018 à 12:13, Joshua C. Colp a écrit : >>> On Tue, Nov 27, 2018, at 5:49 AM, Administrator TOOTAI wrote:[...] >>>> >>>> [TOOTAiAudio] >>>> ; >>>> ; Call our gateway >>>> >>>> exten = s,1,Set(PJSIP_HEADER(add,X-TOOTAiAudio-CALLED)=${ARG1}) >>>> same = n,Dial(PJSIP/${ARG1}@TOOTAiAudio,,T) >>>> same = n,Return >>>> >>>> exten = h,1,NoOp() >>>> same = n,NoOp(Hangup Cause: ${HANGUPCAUSE}) >>>> same = n,NoOp(Dial status : ${DIALSTATUS}) >>>> same = n,NoOp(X-TOOTAiAudio=${PJSIP_HEADER(read,X-TOOTAiAudio-CALLED)}) >>>> same = n,Return >> [...] >>>> >>>> Why can't be PJSIP extra headers setted in this case ? >>> >>> As documented on the wiki[1] the PJSIP_HEADER dialplan function has to be executed on the PJSIP channel itself, not the calling channel. You need to use a pre-dial handler and invoke it there. >>> >>> [1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Function_PJSIP_HEADER >>> >> >> Thanks Joshua, that worked. As you see above I want to have the value of >> headers when call is ended. Problem is that on h extension the channel >> already gone. >> >> Is there a solution to archieve this ? > > Is there a reason you can't use a normal dialplan variable instead?That's what I do at this time. I thought I could bypass this by retriving the output of headers Otherwise I don't believe PJSIP_HEADER will retrieve such information regardless, it's for querying headers on an incoming INVITE.>Ok, thanks for your help. -- Daniel