[asterisk-users] PJSIP add header not working

Joshua Colp jcolp at digium.com
Mon Oct 2 10:20:10 CDT 2017


On Mon, Oct 2, 2017, at 12:06 PM, Andre Gronwald wrote:
> Hi,
> I am trying to add a custom header to my calls to map several call-legs 
> into a global call for viewing.
> 
> For this to work I read the call-id from pjsip-channel and write it into 
> X-CID:
> 
> ######
>      -- Executing [s at macro-dialout-trunk-predial-hook:4] 
> Set("PJSIP/10-00000006", 
> "pjsipCallId=313530363933383438363436353930-1gh0bjceo933") in new stack
>      -- Executing [s at macro-dialout-trunk-predial-hook:5] 
> Set("PJSIP/10-00000006", 
> "PJSIP_HEADER(add,X-CID)=313530363933383438363436353930-1gh0bjceo933") 
> in new stack
>      -- Executing [s at macro-dialout-trunk:18] GotoIf("PJSIP/10-00000006", 
> "0?bypass,1") in new stack
>      -- Executing [s at macro-dialout-trunk:19] ExecIf("PJSIP/10-00000006", 
> "1?Set(CONNECTEDLINE(num,i)=0xxxxxxxxxxxxxx)") in new stack
>      -- Executing [s at macro-dialout-trunk:20] ExecIf("PJSIP/10-00000006", 
> "1?Set(CONNECTEDLINE(name,i)=CID:3xxxxx)") in new stack
>      -- Executing [s at macro-dialout-trunk:21] ExecIf("PJSIP/10-00000006", 
> "0?Set(CONNECTEDLINE(name,i)=CID:(Hidden)3xxxxx)") in new stack
>      -- Executing [s at macro-dialout-trunk:22] GotoIf("PJSIP/10-00000006", 
> "0?customtrunk") in new stack
>      -- Executing [s at macro-dialout-trunk:23] Dial("PJSIP/10-00000006", 
> "PJSIP/0xxxxxxxxxxxxxx at 3xxxxx,300,T") in new stack
>      -- Called PJSIP/0xxxxxxxxxxxxxx at 3xxxxx

The PJSIP_HEADER dialplan function operates on the channel it is invoked
on. In this case you are using it on the caller, not the called party.
The wiki documentation[1] includes an example of how to apply it to an
outgoing call.

[1]
https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Function_PJSIP_HEADER

-- 
Joshua Colp
Digium, Inc. | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.digium.com & www.asterisk.org



More information about the asterisk-users mailing list