[cisco-voip] Modify calling number in SIP invite on CUCM 11

Daniel Pagan dpagan at fidelus.com
Tue Jul 5 15:55:12 EDT 2016


Deepak:

I think I accidentally omitted a second "end" in the second script. There should be another end before "return M".

- Dan

Sent from my mobile device.

On Jul 5, 2016, at 3:39 PM, Daniel Pagan <dpagan at fidelus.com<mailto:dpagan at fidelus.com>> wrote:

The script I sent earlier should work with some tweaking. What I sent was specifically for the Remote-Party-ID header. If you want to take a From: header with 8889184192 and change it to 1102, and similarly 8889184193 and change it to 1103, the simple script below should work for you:

M = {}
function M.outbound_INVITE(msg)
msg:applyNumberMask("From", "110X")
end
return M

But this isn’t very scalable and would cause issues if you have different ranges outside of 110X. For more granularity, you can use something like what I typed below, which will first check the From: header for a specific string and then apply a specific mask only if that string exists. In the example below, it’s checking the From header for 88891841 and applying the 110X mask only if it’s found. In your example, it will find 8889184192 and send 1102 in the From header. You can take this, and duplicate the section between if and the first end in order to achieve your desired results for other ranges. Run it through an online LUA script tester to confirm no errors exist.

M = {}
function M.outbound_INVITE(msg)
local from = msg:getHeader("From")
                if from and string.match(from,"88891841")
                then
                msg:applyNumberMask("From", "110X")
                end
return M

But I should mention one more that I do believe a calling party transform CSS (outgoing on the SIP trunk) and transform mask will take care of this for you much more easily than a LUA script. I only included one because you specifically requested. TAC doesn’t officially support/troubleshoot LUA scripts anyway so there’s that caveat to keep in mind.

Hope this helps.

- Dan


From: Deepak Maggo [mailto:dmaggo at ipcelerate.com]
Sent: Tuesday, July 05, 2016 2:03 PM
To: Daniel Pagan <dpagan at fidelus.com<mailto:dpagan at fidelus.com>>
Cc: cisco-voip at puck.nether.net<mailto:cisco-voip at puck.nether.net>
Subject: Re: [cisco-voip] Modify calling number in SIP invite on CUCM 11

Hi Daniel,

Please let me know if I can replace the SIPADDR in SIP INVITE with the parameter "x-nearendaddr=1102" in the SIP INVITE.

I tried your script with the last suggestions but its manipulating the External Phone Number Mask and its not giving me desired results.

Thanks & Regards,
Deepak Maggo

On Tue, Jul 5, 2016 at 12:47 PM, Daniel Pagan <dpagan at fidelus.com<mailto:dpagan at fidelus.com>> wrote:
That script will take care of the From: header for you. Just modify “Remote Party ID” to “From” and the “XXXX” to “110X”. You’ll need to modify the script if you have multiple ranges of course. Also note that this does not evaluate the calling number before applying the mask - unlike how a Calling Party Xform would work for outgoing calls on a trunk. This will simply mask the user portion of SIP URI the From header in all outgoing INVITE requests regardless of its current value. I would use this if you’re certain your From header needs to be modified, but a calling party transform on outgoing calls might also do the trick on the SIP trunk(I’m guessing since I haven’t looked at your scenario myself).

Hope this helps.

From: Deepak Maggo [mailto:dmaggo at ipcelerate.com<mailto:dmaggo at ipcelerate.com>]
Sent: Tuesday, July 05, 2016 11:45 AM
To: Daniel Pagan <dpagan at fidelus.com<mailto:dpagan at fidelus.com>>

Cc: cisco-voip at puck.nether.net<mailto:cisco-voip at puck.nether.net>
Subject: Re: [cisco-voip] Modify calling number in SIP invite on CUCM 11

Thanks Daniel for the reply.

Let me give you brief what I am trying to achieve:

I am trying to record the calls using BIB configuration on CUCM, when I dial the internal extensions I am getting the internal extension number as SIPADDR in SIP INVITE from phone. but when it makes any PSTN/outbound call, phone sends the "External Phone Number Mask" as SIPADDR in SIP INVITE from phone to the recorder. I want to display the External Phone Number Mask on PSTN/Outbound Calls on called numbers but on the BIB's SIP INVITE sent by Calling Phone to the recorder. Below is one example of SIP INIVITE which I am getting and what I want:


2265: Recording Profile Pattern
888XXX4192: External Phone Number Mask on extension '1102'
Extension # : 1102
9173XXXXX456: Dialed PSTN Number

Current SIP INIVITE to Recorder:

To: <sip:2265 at 10.31.X.XX>
Via: SIP/2.0/UDP 10.33.X.XXX:5060;branch=z9hG4bK1f7a48bf6a
CSeq: 101 INVITE
Call-ID: f9461400-77b1d031-10-6e08210a at 10.33.8.110<mailto:f9461400-77b1d031-10-6e08210a at 10.33.8.110>
From: "1102" <sip:888XXX4192 at 10.33.X.XXX;x-nearend;x-refci=32007259;x-nearendclusterid=StandAloneCluster;x-nearenddevice=SEP1CEXXXXXX4AC;x-nearendaddr=1102;x-farendrefci=32007260;x-farendclusterid=StandAloneCluster;x-farenddevice=10.31.8.1;x-farendaddr=9173XXXXX456>;tag=1024~05da1bec-c875-450f-8d15-930ac584ef1e-32007264
Content-Type: application/SDP
Content-Length: 317

v=0
o=WIN-N309UNLOML3 1467716653090 1467716653090 IN IP4 10.31.9.66
s=SDP
c=IN IP4  10.31.9.66
t=0 0
a=direction:active
m=audio 20488 RTP/AVP 0 8 18 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-11,16
a=recvonly



Desired SIP INVITE to Recorder:

To: <sip:2265 at 10.31.X.XX>
Via: SIP/2.0/UDP 10.33.X.XXX:5060;branch=z9hG4bK1f7a48bf6a
CSeq: 101 INVITE
Call-ID: f9461400-77b1d031-10-6e08210a at 10.33.8.110<mailto:f9461400-77b1d031-10-6e08210a at 10.33.8.110>
From: "1102" <sip:1102 at 10.33.X.XXX;x-nearend;x-refci=32007259;x-nearendclusterid=StandAloneCluster;x-nearenddevice=SEP1CEXXXXXX4AC;x-nearendaddr=1102;x-farendrefci=32007260;x-farendclusterid=StandAloneCluster;x-farenddevice=10.31.8.1;x-farendaddr=9173XXXXX456>;tag=1024~05da1bec-c875-450f-8d15-930ac584ef1e-32007264
Content-Type: application/SDP
Content-Length: 317

v=0
o=WIN-N309UNLOML3 1467716653090 1467716653090 IN IP4 10.31.9.66
s=SDP
c=IN IP4  10.31.9.66
t=0 0
a=direction:active
m=audio 20488 RTP/AVP 0 8 18 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-11,16
a=recvonly

Thanks & Regards,
Deepak Maggo

On Tue, Jul 5, 2016 at 11:19 AM, Daniel Pagan <dpagan at fidelus.com<mailto:dpagan at fidelus.com>> wrote:
It depends on which headers this external platform is parsing for caller-ID. If it’s using Remote Party ID then this will help you:

M = {}
function M.outbound_INVITE(msg)
msg:applyNumberMask("Remote-Party-ID", "XXXX")
end
return M

I’ve tested this script before, but cannot say it will fit your needs and resolve this issue. What this will do is apply a four-digit mask to your external party number on the Remote-Party-ID header.

You can replace this will “From” if needed.

It actually parses the actual SIP URI, not the display field which, in your case, already contains a four digit extension.

Applying this requires a reset of your SIP trunk - just something to keep in mind.

- Dan



From: cisco-voip [mailto:cisco-voip-bounces at puck.nether.net<mailto:cisco-voip-bounces at puck.nether.net>] On Behalf Of Deepak Maggo
Sent: Friday, July 01, 2016 3:24 PM
To: Brian Meade <bmeade90 at vt.edu<mailto:bmeade90 at vt.edu>>
Cc: cisco-voip at puck.nether.net<mailto:cisco-voip at puck.nether.net>
Subject: Re: [cisco-voip] Modify calling number in SIP invite on CUCM 11


In earlier versions of CUCM we used to get extension number as SIP address for external calls, but after upgrading the CUCM to v11.0 we are getting external phone number mask.

If anyone can help me with SIP normalisation script where I can replace the external phone number mask with extension number in SIP INVITE, which I can apply on SIP trunk to my call recorder coz I want external phone number mask to be displayed on PSTN calls.

Appreciate all help in this.

Thanks & Regards,
Deepak Maggo
On 1 Jul 2016 14:47, "Brian Meade" <bmeade90 at vt.edu<mailto:bmeade90 at vt.edu>> wrote:
It's got the extension in there too in a few fields.  I think it does the Invite this way so the recorder can match up the call from the CTI messages.

On Fri, Jul 1, 2016 at 2:30 PM, Deepak Maggo <dmaggo at ipcelerate.com<mailto:dmaggo at ipcelerate.com>> wrote:
Here is the SIP Invite from extension number "1102" with External Phone Number Mask "8889184192<tel:8889184192>", when I dial the internal extension I do receive the extension number in SIP invite:

Jul 01 07:30:24.631 [INFO] JSIPListerner: processRequest() requestType (INVITE) = INVITE
Jul 01 07:30:24.631 [INFO] JSIPListerner: processSIPInvite() callIDHeader = f89b3e00-77619055-42-6e08210a at 10.33.8.110<mailto:f89b3e00-77619055-42-6e08210a at 10.33.8.110>
Jul 01 07:30:24.631 [INFO] JSIPListerner: processSIPInvite() sipFromHeader = "1102" <sip:8889184192 at 10.33.8.110<mailto:sip%3A8889184192 at 10.33.8.110>;x-nearend;x-refci=29335531;x-nearendclusterid=StandAloneCluster;x-nearenddevice=SEP1CE85DC824AC;x-nearendaddr=1102;x-farendrefci=29335532;x-farendclusterid=StandAloneCluster;x-farenddevice=10.31.8.1;x-farendaddr=917325797456>
Jul 01 07:30:24.631 [INFO] JSIPListerner: checkHalfCall() sipFromHeader = "1102" <sip:8889184192 at 10.33.8.110<mailto:sip%3A8889184192 at 10.33.8.110>;x-nearend;x-refci=29335531;x-nearendclusterid=StandAloneCluster;x-nearenddevice=SEP1CE85DC824AC;x-nearendaddr=1102;x-farendrefci=29335532;x-farendclusterid=StandAloneCluster;x-farenddevice=10.31.8.1;x-farendaddr=917325797456>
Jul 01 07:30:24.631 [INFO] JSIPListerner: processSIPInvite() First sipFromHeader = "1102" <sip:8889184192 at 10.33.8.110<mailto:sip%3A8889184192 at 10.33.8.110>;x-nearend;x-refci=29335531;x-nearendclusterid=StandAloneCluster;x-nearenddevice=SEP1CE85DC824AC;x-nearendaddr=1102;x-farendrefci=29335532;x-farendclusterid=StandAloneCluster;x-farenddevice=10.31.8.1;x-farendaddr=917325797456>


Thanks & Regards,
Deepak Maggo

On Fri, Jul 1, 2016 at 2:16 PM, Brian Meade <bmeade90 at vt.edu<mailto:bmeade90 at vt.edu>> wrote:
What does the Invite actually look like?  I wouldn't expect this setup to show the external number mask to the recorder.

On Fri, Jul 1, 2016 at 1:33 PM, Deepak Maggo <dmaggo at ipcelerate.com<mailto:dmaggo at ipcelerate.com>> wrote:

No, I am not using any CSS Transformations.

Thanks & Regards,
Deepak Maggo
On 1 Jul 2016 13:29, "Brian Meade" <bmeade90 at vt.edu<mailto:bmeade90 at vt.edu>> wrote:
Do you have a calling party transform CSS on the SIP trunk?

On Fri, Jul 1, 2016 at 11:09 AM, Deepak Maggo <dmaggo at ipcelerate.com<mailto:dmaggo at ipcelerate.com>> wrote:
Hi Florian,

I verified my trunk as well and it is also selected as "OnNet":

<image001.png>

Thanks & Regards,
Deepak Maggo

On Fri, Jul 1, 2016 at 10:56 AM, Deepak Maggo <dmaggo at ipcelerate.com<mailto:dmaggo at ipcelerate.com>> wrote:
Florian,

Thanks for the response. My route pattern is set to OnNet only:

<image002.png>

Thanks & Regards,
Deepak Maggo

On Fri, Jul 1, 2016 at 10:50 AM, Florian Kroessbacher <florian.kroessbacher at gmail.com<mailto:florian.kroessbacher at gmail.com>> wrote:
Maybe your trunk to the Recorder is set to Offnet, try to set it Onnet


Am 1. Juli 2016, 15:47 +0200 schrieb Deepak Maggo <dmaggo at ipcelerate.com<mailto:dmaggo at ipcelerate.com>>:
Hi,


The problem I have is that we have active recording system which communicates with the CUCM cluster using a SIP trunk and uses Built-in-bridge configuration.

The invites that CUCM sends via the SIP trunk show the "External Phone Number Mask" rather than the four digit extension when make PSTN calls which will not work according to  the recording system. We need the External Phone Number Mask on phones to display the correct Caller ID.

Can anyone suggest a way to fix this?

Ideally I need a way to modify the number in the SIP invite but I cannot find any example of how to do this.

Any suggestions are welcome.

Thanks
Thanks & Regards,
Deepak Maggo
_______________________________________________
cisco-voip mailing list
cisco-voip at puck.nether.net<mailto:cisco-voip at puck.nether.net>
https://puck.nether.net/mailman/listinfo/cisco-voip



_______________________________________________
cisco-voip mailing list
cisco-voip at puck.nether.net<mailto:cisco-voip at puck.nether.net>
https://puck.nether.net/mailman/listinfo/cisco-voip






_______________________________________________
cisco-voip mailing list
cisco-voip at puck.nether.net<mailto:cisco-voip at puck.nether.net>
https://puck.nether.net/mailman/listinfo/cisco-voip
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 83647 bytes
Desc: image001.png
URL: <https://puck.nether.net/pipermail/cisco-voip/attachments/20160705/639ecc01/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 81425 bytes
Desc: image002.png
URL: <https://puck.nether.net/pipermail/cisco-voip/attachments/20160705/639ecc01/attachment-0001.png>


More information about the cisco-voip mailing list