Custom SIP header on outgoing calls

Dear, can you please help me with sending a custom sip header in FreePBX 15.0.16.49, I tried in some ways but without success, I need to send in the INVITE of the call the field:
X-SDX-survey_sip_token: d63f04e0-c499-11g9-b7d0 -29bc03531d2

Example:

INVITE sip:[email protected] SIP/2.0
To: <sip:[email protected]>
From: <sip:[email protected];cpc=test>;tag=90B030303434303000093889
Content-Type:multipart/mixed;boundary=unique-boundary-1
Diversion:<sip:[email protected]>;reason=no-answer;counter=5;privacy=off
Diversion:<sip:[email protected]>;reason=user-busy;counter=1;privacy=off
X-SDX-survey_sip_token: d63f04e0-c499-11g9-b7d0 -29bc03531d
Privacy:none
P-Asserted-Identity: <sip:[email protected];cpc=test>
Allow:INVITE,ACK,OPTIONS,BYE,CANCEL,REGISTER,INFO,UPDATE,PRACK,REFER,SUBSCRIBE,NOTIFY
Supported:100rel
Expires:120

Thanks.

Hi Daniel:

This dialplan will allow you to set a custom header on all outbound calls for a specific trunk:

[macro-dialout-trunk-predial-hook]
exten => s,1,Noop(Entering user defined context macro-dialout-trunk-predial-hook in extensions_custom.conf)
exten => s,n,ExecIF($["${OUT_${DIAL_TRUNK}_SUFFIX}"!=""]?Set(trunk_name=${OUT_${DIAL_TRUNK}_SUFFIX}):Set(trunk_name=${OUT_${DIAL_TRUNK}}))
exten => s,n,Noop(Trunk Name: ${trunk_name})
exten => s,n,GoSubIf($["${trunk_name}"="<< name of trunk >>"]?func-set-sipheader,s,1(X-SDX-survey_sip_token,d63f04e0-c499-11g9-b7d0 -29bc03531d2))
exten => s,n,MacroExit

You must edit the GoSubIf line with the actual trunk name you want the header on.

3 Likes

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.