03-07-2013 02:18 AM - edited 03-16-2019 04:07 PM
Hi
I see user name in Remote-Party-ID and from headers. |SIP From: "Sirhan Ibrahim"<sip:+9615793@phm1svlync1.wataniya-maldives.com;user=phone.
Please advice how to remove the user name and send only the number e.g <sip:+9615793@phm1svlync1.wataniya-maldives.com;user=phone
at the voice gateway level ,
your ideas and advices are much appricated
thanks
Purna
Solved! Go to Solution.
03-07-2013 02:25 AM
You can use sip profiles..
voice class sip-profiles 5
request INVITE sip-header Remote-Party-ID modify "Remote-Party-ID: (.*<)(.*>)" "Remote-Party-ID: <\2"
Then apply it to the dial-peer facing your ITSP
dial-peer voice xx voip
voice-class sip profiles 5
Please rate all useful posts
"opportunity is a haughty goddess who waste no time with those who are unprepared"
03-08-2013 04:27 AM
+5 to Deji!
Purna -
Yes go ahead and try for the From header as well. It looks ok.
Your second question: I will try to explain, but I dont have a console nearby excuse any syntax errors:
The way you modify header is match whatever is in first quotes " " and replace within second quotes " ", ex "X" "Y" - you are replacing X with Y.
Now in your example in your first quotes:
"Remote-Party-ID: (.*<)(.*>)" - you are saying match - Remote-Party-ID: followed by set1 (.*<) set2(.*>)
Sets are a way to copy data that can be restored in matching quotes. In your example:
Set1= (.*<) = anything before angle bracket < and the bracket sign itself < - data in set1 becomes - "Sirhan Ibrahim" <
Set2 = (.*>) = anything before angle bracket > and bracket sign > - this is your set 2 - sip:+9615793@phm1svlync1.wataniya-maldives.com>
.* are wild cards meaning any string with one or more digits
Second quotes: you are replacing:
"Remote-Party-ID: <\2" which means replace with - Remote-Party-ID: < - followed by \2, which means set2 - whatever is matched in set2 in the first quotes is copied here.
So if your message before modification is:
Remote-Party-ID: "Sirhan Ibrahim" <>;user=phone.
After modification it should become:
Remote-Party-ID: <>;user=phone.
Test it and let us know how did you go.
Hope it helps.
Terry
Sent from Cisco Technical Support App>>
03-07-2013 02:25 AM
You can use sip profiles..
voice class sip-profiles 5
request INVITE sip-header Remote-Party-ID modify "Remote-Party-ID: (.*<)(.*>)" "Remote-Party-ID: <\2"
Then apply it to the dial-peer facing your ITSP
dial-peer voice xx voip
voice-class sip profiles 5
Please rate all useful posts
"opportunity is a haughty goddess who waste no time with those who are unprepared"
03-08-2013 12:31 AM
Thanks , I will test this today and will give you an update..one more concern please...
as we need to remove it from "FROM" header as well, can we try the following..and can you advice whats the real meaning of "Remote-Party-ID: <\2" at the end ?
i will try the following :
voice class sip-profiles 5
request INVITE sip-header Remote-Party-ID modify "Remote-Party-ID: (.*<)(.*>)" "Remote-Party-ID: <\2"
request INVITE sip-header From modify "From: (.*<)(.*>)" "From: <\2"
Then apply it to the dial-peer facing your ITSP
dial-peer voice xx voip
voice-class sip profiles 5
thanks
Purna
03-08-2013 04:27 AM
+5 to Deji!
Purna -
Yes go ahead and try for the From header as well. It looks ok.
Your second question: I will try to explain, but I dont have a console nearby excuse any syntax errors:
The way you modify header is match whatever is in first quotes " " and replace within second quotes " ", ex "X" "Y" - you are replacing X with Y.
Now in your example in your first quotes:
"Remote-Party-ID: (.*<)(.*>)" - you are saying match - Remote-Party-ID: followed by set1 (.*<) set2(.*>)
Sets are a way to copy data that can be restored in matching quotes. In your example:
Set1= (.*<) = anything before angle bracket < and the bracket sign itself < - data in set1 becomes - "Sirhan Ibrahim" <
Set2 = (.*>) = anything before angle bracket > and bracket sign > - this is your set 2 - sip:+9615793@phm1svlync1.wataniya-maldives.com>
.* are wild cards meaning any string with one or more digits
Second quotes: you are replacing:
"Remote-Party-ID: <\2" which means replace with - Remote-Party-ID: < - followed by \2, which means set2 - whatever is matched in set2 in the first quotes is copied here.
So if your message before modification is:
Remote-Party-ID: "Sirhan Ibrahim" <>;user=phone.
After modification it should become:
Remote-Party-ID: <>;user=phone.
Test it and let us know how did you go.
Hope it helps.
Terry
Sent from Cisco Technical Support App>>
03-08-2013 06:44 AM
Terry, First of all congrats on your CSC spotlight award! you deserve it mate..You have been excellent on the forum. Keep the nice posts coming
Secondly this explanation is great..love it.
Finally do you know what type of regular expression cisco uses with sip profiles..is it (PERC) or posix or just regulkar expression..Would love a doc to delve deeper into this..I spent a few hours 2 days ago to try and figure this profile out..took me a while
Please rate all useful posts
"opportunity is a haughty goddess who waste no time with those who are unprepared"
03-08-2013 06:26 PM
Deji - Thanks for the encouragement and your kind words mate!!
You are the SIP specialist buddy.
Regards to your last question - I am not too sure, I think for SIP modification as well the underlying engine is SED just like the voice translation rules - but with some different rules. Cisco's site only just mentions below in regards to SIP header manipulation:
"The syntax for message modification uses regular expression notation to match and replace fields in messages."
http://www.cisco.com/en/US/products/sw/voicesw/ps5640/products_configuration_example09186a0080982499.shtml#conf
In this link they mention using SED for number translations in the below link:
http://www.cisco.com/en/US/tech/tk652/tk90/technologies_configuration_example09186a00803f818a.shtml#related
Where knowledge of the basic regular expressions helps, most of it had to learn by playing with it in the lab.
Not sure if its of any help but I guess its quite under documented.
Thanks again for the encouragement!
Terry
03-09-2013 01:56 PM
Thanks Terry.
Please rate all useful posts
"opportunity is a haughty goddess who waste no time with those who are unprepared"
03-10-2013 03:17 AM
Hi Terry and aokan,
This is spot on!!! working as expected ..I tested this today as customer was having some other issues to be solved..
thanks for your excellent explanation and support :
additionally customers asks to change the "screen " parameter as well...
now we send it as :
Remote-Party-ID: <>;party=calling;screen=no;privacy=off >
so i thought of using the following SIP manipulation for that,,please advice me on that :
sip manipulation that I thought of :
request INVITE sip-header Remote-Party-ID modify "screen=no" "screen=yes"
Thanks a lot for your great support and advices,
Purna
03-10-2013 05:12 AM
Purna,
Yes this would work. Whatever you explicitly match and replace will get changed, rest of the header should pass through as it is.
In your case screen=no will be matched and replaced with screen=yes
Test it and let us know how did you go.
Terry
Please rate all helpful posts.
Sent from Cisco Technical Support iPhone App
03-12-2013 02:14 AM
Hi ,
I have tested above and it is working fine as expected , SP is asking to remove the "+" from the from header ,
Please let me know your advices on that ,
<>+9615793@10.10.4.37>>
Thanks
Purna
03-12-2013 04:20 AM
It might be easier to just use a voice translation profiles to remove the + on the dial-peer towards your ITSP
voice translation-rule 10
rule 1 /^\+\(9615...\)/ /\1/
voice translation-profile RemovePlus
translate called 10
Then apply this to the dial-peer
dial-peer voice xx voip
translation-profile outgoing RemovePlus
Please rate all useful posts
"opportunity is a haughty goddess who waste no time with those who are unprepared"
06-15-2016 05:21 AM
Hi, great explanation, and pointers below.
but with respect to the example given: request contains the following header: Remote-Party-ID: "Sirhan Ibrahim" ;user=phone
with this modification:
request INVITE sip-header Remote-Party-ID modify "Remote-Party-ID: (.*<)(.*>)" "Remote-Party-ID: <\2"
anything before the < makes up the first set : why isn't that equal to "Sirhan Ibrahim" ;user=phone but equal to "Sirhan Ibrahim"
Is the match within the context/delimited to 1 tag in the header ?
many thanks,
Juan
06-15-2016 06:09 AM
Because the display name is before the angle bracket and anything before the angle bracket is stored as set 1.
Set1= (.*<) = anything before angle bracket < and the bracket sign itself < - data in set1 becomes - "Sirhan Ibrahim" <
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide