cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1119
Views
25
Helpful
9
Replies

SIP-Profile copy with two @ in the History-Info Header

Frank Mittrup
Level 1
Level 1

Hi all,

my CUBE is sitting between S4B and PSTN and I'm struggling with call-forward. PSTN is expecting the internal number in the PAI header for authentication. We now enabled call-history at the MS site and I do receive a History-Info Header with the right number.

HISTORY-INFO: <sip:+492111234567@testdomain.grp;user=phone?Reason=SIP%3Bcause%3D302%3Btext%3D%22Moved%20Temporarily%22>;index=1;ms-retarget-reason=forwarding,<sip:+40999999@testdomain.grp;user=phone>;index=1.
P-ASSERTED-IDENTITY: <tel:+49171445566>

 

This is my sip-profile:

rule 4 request INVITE peer-header sip HISTORY-INFO copy "sip:(.*)@" u07
rule 5 request INVITE sip-header P-ASSERTED-IDENTITY modify "tel:.*@(.*)" "sip:\u07@sip-provider.com>"

 

The problem is, that the copy command is taking everything out of the history-info till the second @ but I need just the number in front of the first @.

 

Current outcome:

P-ASSERTED-IDENTITY: <sip:+492111234567@testdomain.grp;user=phone?Reason=SIP%3Bcause%3D302%3Btext%3D%22Moved%20Temporarily%22>;index=1;ms-retarget-reason=forwarding,<sip:+40999999@@sip-provider.com>

Target outcome:

P-ASSERTED-IDENTITY: <sip:+492111234567@sip-provider.com>

 

Thanks for any hint.

Frank

9 Replies 9

Would it be possible for you to post the entire SIP profile as you have it now and a complete output for the SIP content that you'd like to modify? I tried to take what you shared in your post and run it in the SIP profile test tool at this link, but it did not like it at all.



Response Signature


If your numbers are fixed length you can use the correct number of dots instead of the wildcard *.  In your example this would work, or at least it works in the test tool ...

request INVITE peer-header sip HISTORY-INFO copy "sip:(.............)@" u07

Hi Roger,

the SIP-Profile Test Tool does not work for me today as well.

Cisco has failed to process your data, Cisco engineers have been notified


But here the full picture:

voice class sip-profiles 700
rule 1 request INVITE peer-header sip From copy "sip:(.*)@" u07
rule 2 request INVITE peer-header sip P-Asserted-Identity copy "sip:(.*)@" u07
rule 3 request INVITE peer-header sip Diversion copy "sip:(.*)@" u07
rule 4 request INVITE peer-header sip HISTORY-INFO copy "sip:(.*)@" u07
rule 5 request INVITE sip-header P-Asserted-Identity modify "sip:.*@(.*)" "sip:\u07@sip-provider.com>"


Inbound Invite from S4B:

INVITE sip:+40999999@10.1.3.2;user=phone SIP/2.0
FROM: <sip:+49171445566@damovo.com;user=phone>;epid=090655A707;tag=9fc5a21dbc
TO: <sip:+40999999@10.1.3.2;user=phone>
CSEQ: 208060 INVITE
CALL-ID: dca03239-dcc1-45e5-bfeb-4f7f062fdac1
MAX-FORWARDS: 70
VIA: SIP/2.0/TCP 10.1.1.3:53307;branch=z9hG4bKc31269a3
CONTACT: <sip:testdomain.grp:5068;transport=Tcp;maddr=10.1.1.3;ms-opaque=840b83723e491ba9>
CONTENT-LENGTH: 336
SUPPORTED: 100rel
USER-AGENT: RTCC/6.0.0.0 MediationServer
CONTENT-TYPE: application/sdp
ALLOW: ACK
HISTORY-INFO: <sip:+492111234567@testdomain.grp;user=phone?Reason=SIP%3Bcause%3D302%3Btext%3D%22Moved%20Temporarily%22>;index=1;ms-retarget-reason=forwarding,<sip:+40999999@testdomain.grp;user=phone>;index=1.
P-ASSERTED-IDENTITY: <tel:+49171445566>
Allow: CANCEL,BYE,INVITE,PRACK,UPDATE


Thanks for looking into this!


Thanks,

Frank

We also need to see the outbound Invite, without your profile being applied.  If it's the same as the inbound that you show, the existing PAI header shows a "<tel: ..." whereas your profile in Rule 5  looking to find and replace a "<sip: ..." value.

If that's how it is you could match and replace with ..

request INVITE peer-header sip HISTORY-INFO copy "sip:(.............)@" u07
request INVITE sip-header P-Asserted-Identity modify "<.*>.*" "<sip:\u07>@sip-provider.com>"

But as I say, that relies on your numbers being fixed length.

Looks like as soon as you mix in a wild card match in the picture it takes the entire string, not just the part before the @. I've tried many different permutations in the test tool and so far I can't get any of them to get the wanted result if there is anything with a wild card in the match part.



Response Signature


With your data and this profile I got what looks to be what you want in the test tool.

voice class sip-profiles 700
rule 1 request INVITE peer-header sip HISTORY-INFO copy "<sip:(.............)@" u07
rule 2 request INVITE sip-header P-Asserted-Identity modify "<.*>.*" "<sip:\u07@sip-provider.com>"

Snag_1fc263e.png

Snag_1fcb5cc.png



Response Signature


Hi Roger, Tony,

 

thanks a lot in supporting me here!

 

As I have a + in front of my number, this fixed length string does work

rule 1 request INVITE peer-header sip HISTORY-INFO copy "<sip:(\+.............)@" u07
rule 2 request INVITE sip-header P-Asserted-Identity modify "<.*>.*" "<sip:\u07@sip-provider.com>"

Think my colleagues found an good Regex which works for the SIP-Profile Tester based on looking after digits 0 - 9.

rule 1 request INVITE peer-header sip HISTORY-INFO copy "sip:(\+\d{1,})@" u01

 

But unfortunately that does not work in real life. Any idea why?

 

Will check now, if the fixed length approach works for me because I have just internal numbers and they should be not variable length.

 

Thanks a lot,

Frank

 

I guess Cisco doesn't support the \d regular expression element.   Unfortunately Cisco has no reference documentation for SIP Profiles, or at least none that I have found or that anyone on here could point to.  So we are left with a bit of guess work for header names and regular expression syntax, particularly if you're doing something that's a bit different from the examples they give.

Hi Frank,

 

you may try followings:

 

Soultion 1:
you can extend the match string in your sip profile and prove the call behavior:
rule 4 request INVITE peer-header sip HISTORY-INFO copy "sip:(.*)@testdomain.grp;user=phone?" u07
rule 6 request INVITE sip-header P-ASSERTED-IDENTITY modify "tel:.*@(.*)" "sip:\u07@sip-provider.com>"

 

Soultion2:
on SIP trunk you can use a SIP Normalization Script to get the first number of History-Info as Diversion header and then your sip-profiles could get the Diversion as u07:

 

M = {}
M.allowHeaders = {"History-Info", "x-pbx-id"}
function M.inbound_INVITE(msg)
msg:convertHIToDiversion()
end
return M


Message
INVITE sip:1001@10.10.10.1 SIP/2.0
.
History-Info: <sip:2401@10.10.10.2?Reason=sip;cause=302;text="unconditional">;index=1
History-Info: <sip:1001@10.10.10.1>;index=1.1

 

Result
INVITE sip:1001@10.10.10.1 SIP/2.0
.
Diversion: <sip:2401@10.10.10.2>;reason=unconditional;counter=1
History-Info: <sip:2401@10.10.10.2?Reason=sip;cause=302;text="unconditional">;index=1
History-Info: <sip:1001@10.10.10.1>;index=1.1


Reference for convertHIToDiversion:
https://d1nmyq4gcgsfi5.cloudfront.net/fileMedia/12089d2d-f579-4dd7-a67f-f96d92f3e350/9.0(1)_developer_guide_for_sip_transparency_and_normalization.pdf