Adding a custom diversion header

Hello,

In order to forward calls with the original callerID our provider requires us to send a diversion header. I’ve successfully managed to do this by simply editing extensions_additional.conf, adding the string under [macro-dialout-trunk]. The problem is that this file is overwritten if we change some settings in the FreePBX interface.

Where should I put the string to avoid it being overwritten?

exten => s,n,SIPAddHeader(Diversion:sip:>[email protected]>;privacy=off;reason=unconditional)

I know that I can probably add it under ‘macro-dialout-trunk’; in /var/www/html/admin/modules/core/functions.inc.php - but i don’t know how to format it correctly.

In advanced settings you can already enable diversion header as a option.

I tried to enable that setting before, but I didnt find where I can edit the header? Our provider only seems to accept a specific string.

Can I somehow add this to extentions_custom.conf?

Edit: Just tested that option again. It does add a header, but not in the correct format that my provider accepts. This is added by the option in the asterisk log:

SIPAddHeader(Diversion: >tel:PHONENUMBER>;reason=no-answer;screen=no;privacy=off)

I need it to look like this:

SIPAddHeader(Diversion:>sip:[email protected]>;privacy=off;reason=unconditional)

(had to replace < in order to show in the forum)

In the file extensions_custom.conf using the context [macro-dialout-trunk-predial-hook] will execute on all outbound calls. Provided the diversion header does not interfere with other trunk calls you can use it directly.

My extensions_custom.conf looks like this:

[macro-dialout-trunk-predial-hook]
exten => s,n,SIPAddHeader(Diversion:>sip:[email protected]>;privacy=off;reason=unconditional)

But I cant see it being added in the asterisk logs…

edit: All I can see that contains macro-dialout-trunk-predial-hook is this:

– Executing [[email protected]:1] MacroExit

The first line requires a priority of 1, not an ‘n’, i.e.:

[macro-dialout-trunk-predial-hook]
exten => s,1,SIPAddHeader(Diversion:>sip:[email protected]>;privacy=off;reason=unconditional)

Cheers mate! That fixed it.

1 Like

Hi Fralla,

Does this allow you to manipulate the diversion header ?
What does your provider require in the diversion header ?

I am not sure what the purpose of this is but in my case, I am sending [email protected] in the diversion header.
I am trying to send the original CID when a call is transferred or forwarded out.
When I do that, my PAI is sent as [email protected] and diversion is my [email protected]

My provider wants me to send [email protected] as the PAI and/or in the diversion header.
I tried the steps described in this post with no avail.

Could you please list the step by step to do that ?

Thanks a lot

I have the same issue with Time Warner SIP trunks not forwarding the CID of the inbound caller when the extension is forwarded to a users mobile phone. The forwarded call always displays the office number instead of the callers CID.

Time Warner has come back with the following.

I’ve confirmed with my product team that we can support out pulsing the CID of forwarded calls without using RNIE:
-The original caller number could be sent in the FROM field or PAI header.
-The forwarding number (TWC DID number) must be in the DIVERSION header for forwarded calls.

Your notes show the PAI header has the correct info per the requirements above but I didn’t see that you have the DID in the Diversion header.

is there a way to do this without doing as ‘macro-dialout-trunk’ ? I dont want to risk breaking other trunk calls. What is the best way to accomplish this?

Any help is much appreciated