Diversion Header - Can't pass caller ID from outside call to cell phone via Follow-Me - XO Communication

I just recently setup TB 2.6.07 using XO Communications as a SIP trunk provider. The follow-me will not work unless I hard code a caller-ID on the XO trunk. This is not good because the users would like to see who is calling their cell-phones off the FreePBX Follow-me.

After doing research, I found out that they require a diversion header for the broadsoft switch to accept the call.

I have been on the phone with XO’s sip engineers. I am working with one I really like and who I feel knows his stuff. In his log files, he says he is not seeing any diversion headers in the sip packets from the TB box and therefore it will not work. He says if we can send a diversion header in the packet with the caller DID info, it will pass the caller ID. What is important is that our from field contains the XO DID.

I think this is very important as a group we start to duscuss this. XO is now selling this SIP product instead of a triditional T1’s. I like it becuase it saves me a T1 card for any system I configure. As time goes on, I can only see the traditinal T1 disappearing all together. Why do we need it if we can keep the entire call SIP?

If this starts to become the norm and the carrier class companies set the requirements that sip based PBX systems can only send autherized DID’s then we need to figure out how to incorporate this into Free PBX/Asterisk.

If anyone has any information in this topic, I would like to know more. Is diversion header in any builds of Asterisk? What does the FreePBX group think about this?


Page 6 of 25

Blind Transfer Calls Received from PSTN back to PSTN
Trixbox does not insert diversion header, BW rejects the transferred calls.
Workaround: None

What you are looking for is altering the SIP packets which is not something that FreePBX does at it’s level, It can only use the options presents to if via asterisk. So this needs to be decussed with the development group of asterisk.

It looks like others are using the diversion header in Asterisk. I am trying to understand if they have a patched verison of asterisk or if asterisk supports the sip diversion header.


Any update on this?

FreePBX 2.9 has an Advanced Option to set a Diversion Header for all calls that originated from outside and are going back outside assuming they came in with a DID and will use that DID that they came in with.

I am working on the same thing, and as I have come from hand configured asterisk it seems pretty easy. I put this in the extension_custom.conf file using FreePBX on Elastix 2.0. Please Note that I set the trunk callerID in the web interface to <sip:[email protected]>

exten => s,1,Macro(SetCallerIdSipDiversion)

exten => s,1,NoOp(SetCallerIdSipDiversion)
exten => s,n,GotoIf($["${DIAL_TRUNK}" != “3”]?end)
exten => s,n,GotoIf($["${CALLERID(num)" : ALLOWEDNUMBER]?end)
exten => s,n,NoOp(SetCallerIdSipDiversion setting caller id)
exten => s,n,SIPAddHeader(Diversion: ${TRUNKOUTCID};reason=user-busy;screen=no;privacy=off)
exten => s,n(end),NoOp()

Hi Philippe,

I upgraded to 2.9 and found the generate diversion setting and set it to true. Still not working. Is there anything else that needs to be done to enable this feature? What can I do to troubleshoot this?



Has anyone got this working, we get the diversion header rewrite(I think) but it writes the ougoing number, not the inkoming DID:

SIPAddHeader(“SIP/Phonera-00000266”, “Diversion: tel:0371226100;reason=no-answer;screen=no;privacy=off”)

This is from an incoming call going out thru 0371226100…


Based on what you are seeing I would say its a bug and open a bug report at freepbx.org/trac on it.

Has anyone been able to get this to work?

XO doesn’t seem very willing to work with me other than saying it should work with a diversion header, because they state that FreePBX isn’t XO Lab Certified.

If you want to ask XO for an example of what they are expecting in the Diversion Header, then take a snap shot of what your system is sending out as the Diversion Header when you enable the feature in FreePBX, and put the two in a ticket with a bug report, we could have a look to see if there is something we are doing wrong or additional configuration we need to add to form a proper diversion header.

XO should be willing to provide you with such an example, if they are not willing to do that, you may want to consider looking elsewhere for service (or talking to your rep to escalate getting their cooperation).

Case :

Number 55095390 is provisioned on a freepbx 2.10.1 asterisk 1.8.11
(Asterisk 1.8.11-cert1 built by root @ 89-139-19-10.digium.internal on a x86_64 running Linux on 2012-04-24 21:54:42 UTC)

Scenario: A call from the PSTN to the freepbx is forwarded back to the PSTN via same SIP Trunk.

a-nr :70103600
b-nr unconditional forwarded to 99998888 (CFU via Feature Codes)

Invite to forwarded number should contain the following parameters:
From: 70103622
Diversion: 55095390

Is this a bug or can this be solved by using a script in extensions_custom.conf ?

We are not seeing the diversion header at all in the signaling.

“Generate Diversion Headers” is set to “True” in Advanced SIP Settings…

Without this diversion header, we cant use SIP Providers because the billing will be incorrect…


Finally after almost two weeks of fighting with XO and sending multiple sip traces I was able to get escalated to a Tier III Switch Technician. He informed me that the issue is that they require the diversion header to be sent as sip:[email protected] where NPANXXXXXX is one of our DIDs and XXX.XXX.XXX.XXX is the host ip, but we are sending it as tel:NPANXXXXXX. This results in the call failing with a response of 604 “Does not exist anywhere.”

I opened a bug report as suggested by Philippe #6047