AnsweredAssumed Answered

Multiple Diversion Headers with " and , in values

Question asked by bombachris on Sep 3, 2014
Latest reply on Sep 5, 2014 by bombachris

We are trying to apply a normalization script that removes all but the last Diversion header.  The problem is that our DH's contain "Lastname, Firstname" in them and that is screwing up the script.  How do I ignore the " and the , in the DH so I end up with an array result of DiversArray[1] and DiversArray[2]?  Also, is there a  way to add a domain to the end of "sip:LastnameF@10.95.249.32" so that the SIP URI is sent to Unity Connection?  Since CUC is 10.5, I am syncing the SIP URIs from LDAP as Alternate Extensions.  The script in use is:

 

Script:

 

M = {}

 

function M.outbound_INVITE(msg)

    local DiversArray = msg:getHeaderValues("Diversion")

    local DiversCount = #DiversArray

    if DiversCount > 1 then

        for I = 1, (DiversCount - 1) do

            msg:removeHeaderValue("Diversion", DiversArray[I])

        end

    end

end

 

return M

 

 

The incoming Invite:

 

INVITE sip:10072@10.95.249.120:5065 SIP/2.0

Via: SIP/2.0/TCP 10.95.249.32:5065;branch=z9hG4bK3466886ed1e5bd

From: "Chris Bomba" <sip:19297@10.95.249.32>;tag=5197421~eabeda24-350b-4a32-bee7-488ec9eff82b-57346743

To: <sip:10072@10.95.249.120>

Date: Tue, 02 Sep 2014 18:09:15 GMT

Call-ID: 3e661d00-406107cb-220803-20f95f0a@10.95.249.32

Supported: 100rel,timer,resource-priority,replaces

Min-SE:  1800

User-Agent: Cisco-CUCM9.1

Allow: INVITE, OPTIONS, INFO, BYE, CANCEL, ACK, PRACK, UPDATE, REFER, SUBSCRIBE, NOTIFY

CSeq: 101 INVITE

Expires: 180

Allow-Events: presence, kpml

Supported: X-cisco-srtp-fallback

Supported: Geolocation

Call-Info: <sip:10.95.249.32:5065>;method="NOTIFY;Event=telephone-event;Duration=500"

Cisco-Guid: 1046879488-0000065536-0000162743-0553213706

Session-Expires:  1800

Diversion: "lastname, firstname" <sip:lastnamef@10.95.249.32>;reason=no-answer;privacy=off;screen=no

Diversion: "lastname, firstname" <sip:15350@10.95.249.32>;reason=no-answer;privacy=off;screen=yes

P-Asserted-Identity: "Chris Bomba" <sip:19297@10.95.249.32>

Remote-Party-ID: "Chris Bomba" <sip:19297@10.95.249.32>;party=calling;screen=yes;privacy=off

Contact: <sip:19297@10.95.249.32:5065;transport=tcp>;video;audio;bfcp

Max-Forwards: 69

Content-Type: application/sdp

Content-Length: 1449

 

 

 

The resulting Invite after script:

 

INVITE sip:10072@10.95.249.120:5065 SIP/2.0

Via: SIP/2.0/TCP 10.95.249.32:5065;branch=z9hG4bK347ebf311e78fa

From: "Chris Bomba" <sip:19297@10.95.249.32>;tag=5205025~eabeda24-350b-4a32-bee7-488ec9eff82b-57350235

To: <sip:10072@10.95.249.120>

Date: Tue, 02 Sep 2014 18:52:16 GMT

Call-ID: 40cb7580-406111e0-221468-20f95f0a@10.95.249.32

Supported: 100rel,timer,resource-priority,replaces

Min-SE:  1800

User-Agent: Cisco-CUCM9.1

Allow: INVITE, OPTIONS, INFO, BYE, CANCEL, ACK, PRACK, UPDATE, REFER, SUBSCRIBE, NOTIFY

CSeq: 101 INVITE

Expires: 180

Allow-Events: presence, kpml

Supported: X-cisco-srtp-fallback

Supported: Geolocation

Call-Info: <sip:10.95.249.32:5065>;method="NOTIFY;Event=telephone-event;Duration=500"

Cisco-Guid: 1087075712-0000065536-0000163179-0553213706

Session-Expires:  1800

Diversion: firstname" <sip:lastnamef@10.95.249.32>;reason=no-answer;privacy=off;screen=no

Diversion: firstname" <sip:15350@10.95.249.32>;reason=no-answer;privacy=off;screen=yes

P-Asserted-Identity: "Chris Bomba" <sip:19297@10.95.249.32>

Remote-Party-ID: "Chris Bomba" <sip:19297@10.95.249.32>;party=calling;screen=yes;privacy=off

Contact: <sip:19297@10.95.249.32:5065;transport=tcp>;video;audio;bfcp

Max-Forwards: 69

Content-Type: application/sdp

Content-Length: 1449

 

 

 

 

Because of the "Lastname, Firstname" in the Diversion Header we get and error when parsing:

 

 

39762672.002 |15:12:50.581 |AppInfo  |//SIPLua/Info/SipMessage_removeHeaderValue: API failure(-5) for Device: Unity_Connection_SIPTrunk_01 Script: UseLastDiversion callid 2050ea80-406116b2-2219c2-20f95f0a@10.95.249.32 header 'Diversion' value ' Firstname" <sip:Lastnamef@10.95.249.32>;reason=no-answer;privacy=off;screen=no'

39762672.003 |15:12:50.581 |AppInfo  |//SIPLua/Info/SipMessage_removeHeaderValue: API failure(-5) for Device: Unity_Connection_SIPTrunk_01 Script: UseLastDiversion callid 2050ea80-406116b2-2219c2-20f95f0a@10.95.249.32 header 'Diversion' value '"Lastname'

Outcomes