I am using Freepbx 13 and trying to add/set the X-Tenant in the SIP Header. I have found topics that should work and have added the following lines to extensions_custom.config
[macro-dialout-trunk-predial-hook]
exten => s,1,NoOp(CUSTOM: Setting x_tenant for source ${CALLERID(number)}))
exten => s,n,GoSub(func-set-sipheader,s,1(X-Tenant,${CALLERID(number)}))
exten => s,n,MacroExit()
setting the X-Tenant to the outgoing callerID.
In the asterisk log files I see the following:
– Executing [s@macro-dialout-trunk:18] Macro(“SIP/1111-00000000”, “dialout-trunk-predial-hook,”) in new stack
– Executing [s@macro-dialout-trunk-predial-hook:1] NoOp(“SIP/1111-00000000”, “CUSTOM: Setting x_tenant to 1234567890)”) in new stack
– Executing [s@macro-dialout-trunk-predial-hook:2] Gosub(“SIP/1111-00000000”, “func-set-sipheader,s,1(X-Tenant,1234567890)”) in new stack
– Executing [s@func-set-sipheader:1] NoOp(“SIP/1111-00000000”, “Sip Add Header function called. Adding X-Tenant = 1234567890”) in new stack
– Executing [s@func-set-sipheader:2] Set(“SIP/1111-00000000”, “HASH(__SIPHEADERS,X-Tenant)=1234567890”) in new stack
– Executing [s@func-set-sipheader:3] Return(“SIP/1111-00000000”, “”) in new stack
– Executing [s@macro-dialout-trunk-predial-hook:3] MacroExit(“SIP/1111-00000000”, “”) in new stack
– Executing [s@macro-dialout-trunk:19] GotoIf(“SIP/1111-00000000”, “0?bypass,1”) in new stack
So it appears that it is working but then I capture the INVITE traffic and I don’t see the X-Tenant header in the traffic.
INVITE sip:calledphonenumber@remoteipaddress:5060 SIP/2.0
Via: SIP/2.0/UDP localipaddress:5062;rport;branch=z9hG4bKPj498e797f-573f-461f-a74e-102e4f6a7108
From: sip:callingphonenumber@localipaddress;tag=6d394146-1fdc-4d73-b405-cd7499d3d9d3
To: sip:calledphonenumber@remoteipaddress
Contact: sip:asterisk@localipaddress:5062
Call-ID: 8ee7610a-a03c-465d-ba8d-605062ee4113
CSeq: 23421 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, REF
, MESSAGE
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
P-Asserted-Identity: sip:callingphonenumber@localipaddress
Remote-Party-ID: sip:callingphonenumber@localipaddress;privacy=off;screen=no
Max-Forwards: 70
User-Agent: Asterisk PBX 13.22.0
Content-Type: application/sdp
Content-Length: 341
v=0
o=- 1158752519 1158752519 IN IP4 192.168.0.111
s=Asterisk
c=IN IP4 localipaddress
t=0 0
m=audio 12184 RTP/AVP 0 8 3 111 9 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:111 G726-32/8000
a=rtpmap:9 G722/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv
I’m sure I am missing something simple but it seems to be alluding me. I would appreciate it if someone could please help me find the problem?
Thanks