cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
6307
Views
20
Helpful
7
Replies

CUBE - ADD Diversion header IF we see a specific number in FROM header ?

voip7372
Level 4
Level 4

Hi

I need to ADD a diversion header to a SIP message in CUBE but ONLY if I see a specific number in the From header (or in some cases the P-Asserted-Identity header).  

I think this is possible, but I'm not sure of the correct entry for this in CUBE.  I have existing entries in CUBE that modify a diversion header but in this case, using the same SIP profile, I just need to look for a specific number in the From or P-Asserted-Identity header and if we see a match for that number, then ADD a Diversion header (with another number as the diversion number).  The reason for this is so we can send direct calls from one of our other non-Cisco servers to CUCM and then to our CUBE connected to Verizon VoIP and still be able to get the call accepted by Verizon and also have the correct calling party number (caller-id) shown to the customer we call.  The issue is right now, I can make these calls work by using CUCM to change the calling party number to be a valid Verizon number we own, but then the number the customer sees is not the number we want them to see.  We'd like to present our toll free number to them. 

 

If you know how to do this and can share an example with me, I'd greatly appreciate it.

 

Here's what I'd like to do...

In the example SIP invite below (some info changed for posting in public), if CUBE sees 8005553030 in the From header, we would like to add a simple diversion header with one of our valid numbers in it like 5134441212 (just an example, not a real number).   

 

Original Invite:

INVITE sip:917145551212@172.16.5.30:5060 SIP/2.0
Via: SIP/2.0/UDP 172.16.5.38:5060;branch=z9hG4bK2ba06716d3639e
From: "Calling Party Name" <sip:8005553030@172.16.5.38>;tag=15796350~5684f657-76db-4822-8613-dc18390a270b-65072047
To: <sip:917145551212@172.16.5.30>
Date: Wed, 07 Mar 2018 17:26:34 GMT
Call-ID: ad800680-aa0120ca-26e4cf-26057a92@172.16.5.38
Supported: 100rel,timer,resource-priority,replaces
Min-SE: 1800
User-Agent: Cisco-CUCM11.5
Allow: INVITE, OPTIONS, INFO, BYE, CANCEL, ACK, PRACK, UPDATE, REFER, SUBSCRIBE, NOTIFY
CSeq: 101 INVITE
Expires: 180
Allow-Events: presence
Supported: X-cisco-srtp-fallback,X-cisco-original-called
Call-Info: <urn:x-cisco-remotecc:callinfo>;x-cisco-video-traffic-class=MIXED
Session-ID: f3a9c99b96bd5e9a6c9989ab15796349;remote=00000000000000000000000000000000
Cisco-Guid: 2910848640-0000065536-0000393054-0637893266
Session-Expires: 1800
P-Asserted-Identity: "Calling Party Name" <sip:8005553030@172.16.5.38>
Remote-Party-ID: "Calling Party Name" <sip:8005553030@172.16.5.38>;party=calling;screen=yes;privacy=off
Contact: <sip:8005553030@172.16.5.38:5060>
Max-Forwards: 68
Content-Length: 0

 

If we have a new rule that works, then this Invite below would be an example with a Diversion header added for the purpose of getting Verizon to accept the call and send out it with no trouble:

INVITE sip:917145551212@172.16.5.30:5060 SIP/2.0
Via: SIP/2.0/UDP 172.16.5.38:5060;branch=z9hG4bK2ba06716d3639e
From: "Calling Party Name" <sip:8005553030@172.16.5.38>;tag=15796350~5684f657-76db-4822-8613-dc18390a270b-65072047
To: <sip:917145551212@172.16.5.30>
Date: Wed, 07 Mar 2018 17:26:34 GMT
Call-ID: ad800680-aa0120ca-26e4cf-26057a92@172.16.5.38
Supported: 100rel,timer,resource-priority,replaces
Min-SE: 1800
User-Agent: Cisco-CUCM11.5
Allow: INVITE, OPTIONS, INFO, BYE, CANCEL, ACK, PRACK, UPDATE, REFER, SUBSCRIBE, NOTIFY
CSeq: 101 INVITE
Expires: 180
Allow-Events: presence
Supported: X-cisco-srtp-fallback,X-cisco-original-called
Call-Info: <urn:x-cisco-remotecc:callinfo>;x-cisco-video-traffic-class=MIXED
Session-ID: f3a9c99b96bd5e9a6c9989ab15796349;remote=00000000000000000000000000000000
Cisco-Guid: 2910848640-0000065536-0000393054-0637893266
Session-Expires: 1800

Diversion: "Sample Name" <sip:5134441212@172.16.5.38>
P-Asserted-Identity: "Calling Party Name" <sip:8005553030@172.16.5.38>
Remote-Party-ID: "Calling Party Name" <sip:8005553030@172.16.5.38>;party=calling;screen=yes;privacy=off
Contact: <sip:8005553030@172.16.5.38:5060>
Max-Forwards: 68
Content-Length: 0

2 Accepted Solutions

Accepted Solutions

R0g22
Cisco Employee
Cisco Employee

You can use a line break to support an IF logic with a sip profile. The following should work for you -

voice class sip-profiles 1
request INVITE sip-header From modify “(.*sip:XXXX@.*)” “\1\x0D\x0ADiversion: <sip:YYYY@cisco.com>”

Here "X" would be the number in the From header that you are trying to apply the IF logic against. "Y" would be the actual number that you want in the Diversion header when the IF logic is true or a match.

Remember, these can be used to only add a header. These cannot be used to modify a header.

View solution in original post

It works!!! :-)   HOWEVER, there's one typo in your example.  I noticed it wasn't working (diversion not being added), so I google searched that string and came across this page I've never seen before.  It has many great examples!  https://www.cisco.com/c/en/us/support/docs/voice/ip-telephony-voice-over-ip-voip/211306-In-Depth-Explanation-of-Cisco-IOS-and-IO.html

 

The typo in your sample is the : is missing after the word Diversion.  After I added the : after Diversion it works like magic :-)  Thanks so much for your help.  You guys/gals (Cisco forum) have saved me many times.

My working example (bogus numbers, but just so people can see the correct syntax):

request INVITE sip-header From modify "(.*sip:8005551212@.*)" "\1\x0D\x0ADiversion: <sip:5135551212@172.16.1.25>"

 

View solution in original post

7 Replies 7

R0g22
Cisco Employee
Cisco Employee

You can use a line break to support an IF logic with a sip profile. The following should work for you -

voice class sip-profiles 1
request INVITE sip-header From modify “(.*sip:XXXX@.*)” “\1\x0D\x0ADiversion: <sip:YYYY@cisco.com>”

Here "X" would be the number in the From header that you are trying to apply the IF logic against. "Y" would be the actual number that you want in the Diversion header when the IF logic is true or a match.

Remember, these can be used to only add a header. These cannot be used to modify a header.

Thanks!  I have t leave soon, but I'll try this later and mark the question as solved if it works as expected (which I'm sure it will).  :-)

It works!!! :-)   HOWEVER, there's one typo in your example.  I noticed it wasn't working (diversion not being added), so I google searched that string and came across this page I've never seen before.  It has many great examples!  https://www.cisco.com/c/en/us/support/docs/voice/ip-telephony-voice-over-ip-voip/211306-In-Depth-Explanation-of-Cisco-IOS-and-IO.html

 

The typo in your sample is the : is missing after the word Diversion.  After I added the : after Diversion it works like magic :-)  Thanks so much for your help.  You guys/gals (Cisco forum) have saved me many times.

My working example (bogus numbers, but just so people can see the correct syntax):

request INVITE sip-header From modify "(.*sip:8005551212@.*)" "\1\x0D\x0ADiversion: <sip:5135551212@172.16.1.25>"

 

Glad it worked. Thanks for highlighting that. I didn't verify what I wrote on a CLI so didn't pay attention.

 

 

No problem.  Thanks so much for the help.

That might be the best voice doc I ever read. Great find!

I saved a copy of it in case it ever disappears some day :-)   I think it has a lot of very good, practical examples.  I've never seen that page before and I was happy to run across it.