cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5506
Views
1
Helpful
6
Replies

Modify SIP-Header "From"

Michael Schmidt
Level 1
Level 1

Hi,

I need to modify the "From" field in the SIP-Header.

The original Sent SIP Header look like this:

_________________________________________________________________________

Sent:
INVITE sip:0408545545@10.15.165.102:5060 SIP/2.0
Via: SIP/2.0/UDP 10.35.6.9:5060;branch=z9hG4bK3261F0C
From: <sip:+491234567890@10.35.6.9>;tag=67AA226C-126B
To: <sip:0408545545@10.15.165.102>
Date: Wed, 06 Jul 2016 11:08:52 GMT
Call-ID: DAC3BF98-42A011E6-A9F58516-25C723E1@10.35.6.9
Supported: 100rel,timer,resource-priority,replaces,sdp-anat
Min-SE:  1800
Cisco-Guid: 1622580992-0000065536-0000000183-0690497546
User-Agent: Cisco-SIPGateway/IOS-15.5.3.M
Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, UPDATE, REFER, SUBSCRIBE, NOTIFY, INFO, REGISTER
CSeq: 101 INVITE
Timestamp: 1467803332
Contact: <sip:0205487877@10.35.6.9:5060>
Call-Info: <sip:10.35.6.9:5060>;method="NOTIFY;Event=telephone-event;Duration=2000"
Expires: 180
Allow-Events: telephone-event
Max-Forwards: 66
P-Asserted-Identity: <sip:+491234567890@10.15.165.102:5060>
Diversion: "username"<sip:881777@10.40.40.41>;privacy=off;reason=unconditional;screen=yes
Session-Expires:  1800
Content-Type: application/sdp
Content-Disposition: session;handling=required
Content-Length: 286

_________________________________________________________________________

The modified should look like this where the phonenumber of the From-Field is replaced to the phonenumber which is also available in "Contact"

How the SIP-Profile rule for this have to look like? Is it possible to save the phonenumber from the "Contact" Field into a variable and use it in the From-Field?

_________________________________________________________________________

Sent:
INVITE sip:0408545545@10.15.165.102:5060 SIP/2.0
Via: SIP/2.0/UDP 10.35.6.9:5060;branch=z9hG4bK3261F0C
From: <sip:0205487877@10.35.6.9>;tag=67AA226C-126B
To: <sip:0408545545@10.15.165.102>
Date: Wed, 06 Jul 2016 11:08:52 GMT
Call-ID: DAC3BF98-42A011E6-A9F58516-25C723E1@10.35.6.9
Supported: 100rel,timer,resource-priority,replaces,sdp-anat
Min-SE:  1800
Cisco-Guid: 1622580992-0000065536-0000000183-0690497546
User-Agent: Cisco-SIPGateway/IOS-15.5.3.M
Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, UPDATE, REFER, SUBSCRIBE, NOTIFY, INFO, REGISTER
CSeq: 101 INVITE
Timestamp: 1467803332
Contact: <sip:0205487877@10.35.6.9:5060>
Call-Info: <sip:10.35.6.9:5060>;method="NOTIFY;Event=telephone-event;Duration=2000"
Expires: 180
Allow-Events: telephone-event
Max-Forwards: 66
P-Asserted-Identity: <sip:+491234567890@10.15.165.102:5060>
Diversion: "username"<sip:881777@10.40.40.41>;privacy=off;reason=unconditional;screen=yes
Session-Expires:  1800
Content-Type: application/sdp
Content-Disposition: session;handling=required
Content-Length: 286

_________________________________________________________________________

BR

Michael

6 Replies 6

Atul Gaba
Cisco Employee
Cisco Employee

Here you go:-

request INVITE sip-header Contact copy "<sip:(.*)@.*" u01
request INVITE sip-header From copy ".*<sip:(.*)@.*" u02
request INVITE sip-header From modify "(.*)<sip:.*@(.*)" "\1<sip:\u01@\2"

This doc will help if you need to modify further

http://www.cisco.com/c/en/us/support/docs/unified-communications/unified-border-element/118825-technote-sip-00.html#anc5

-Atul

Hi Atul,

thank you for your answer. It`s not working because in the Contact there is not always the correct number.

In the Field "Diversion" there is the correct number but the internal one.

So the original Diversion looks like:

Diversion: "username"<sip:881777@10.40.40.41>;privacy=off;reason=unconditional;screen=yes

I need the last two numbers of this internal number and merge this with 02054878 in front so that the From look like:

From: <sip:0205487877@10.35.6.9>;tag=67AA226C-126B

Do you know the rule for this also?

BR

Michael

Try this:-

request INVITE sip-header Diversion copy "<sip:(.*)@.*" u01
request INVITE sip-header From modify "(.*)<sip:.*@(.*)" "\1<sip:\u01@\2"
request INVITE sip-header From modify "<sip:(.*)(..)@(.*)" "<sip:02054878\2@\3"

-Atul

I know this is quite old by now, but could you quickly go over what the modify does?  from what I can see, "<sip:(.*)(..)@(.*)" "<sip:02054878\2@\3" takes the original From - "<sip:(.*)(..)@(.*)" and adds 02054878 and the last 2 digits, and leaves the rest alone?

 

So if I had - 

From: " ROBERT AUSTIN" < sip:3303992@blah.blah.blah>

that would become

From: " ROBERT AUSTIN" < sip:0205487892@blah.blah.blah> ?  I am just getting the hang of this stuff and I have to modify my FROM, CONTACT, and P-Asserted-ID fields to show 10 digits instead of the 7 I am currently presenting.

Please see this document for common use cases for SIP profiles. Use SIP Profiles on CUBE Enterprise Common Use Cases 



Response Signature


Yes, I caught that in the above post from Atul, but not until after I replied, heh.  apologies.  I am going through it now.