[cisco-voip] Diversion Header SIP Normalization script

Roger Wiklund roger.wiklund at gmail.com
Thu Jul 14 18:07:43 EDT 2011


Just thought I'd share my SIP normalization script for Diversion header.

If you have "Redirecting Diversion Header Delivery - Outbound" enabled
on your SIP trunk the CM will add a Diversion header in the outgoing
INVITE.
It will only add it if you do CFA though, it can be used to display
the originating CLI on call forwarding, also used to authenticate
calls for SIP trunk providers etc.

However, even if you have outbound Calling Party Transformation CSSes,
The Diversion header will be ignored and still in the local format. In
my case its 46017339, but I want it to be 46856617339. A workaround is
to use SIP Normalization Script.

Here is the script:

M = {}
local mask = scriptParameters.getValue("Diversion-Mask")
  function mask_diversion(msg)
     if mask
     then
        msg:applyNumberMask("Diversion", mask)
     end
end
function M.outbound_INVITE(msg)
mask_diversion(msg)
end
return M

It defines a "variable" called Diversion-Mask
Under the SIP trunk config, select your script, and enter
Diversion-Mask in the Parameter Name
In the Parameter Value enter your mask, for example if 4685661XXXX.

That will then transform the Diversion header to a normalized format aswell.

Enjoy!

Regards
Roger


More information about the cisco-voip mailing list