07-12-2021 02:20 PM
Hi Everyone,
I want to create a SIP profile that essentially takes the number in the From field of an INVITE and adds a Diversion header with this number for all outbound calls from our CUBE to our ITSP.
I found this example from a Cisco Doc and a previous forum post:
request INVITE sip-header From modify “(.*sip:1234@.*)” “\1\x0D\x0ADiversion: <sip:5678@example.com>”
Using this example, I want '1234' and '5678' to be the same variable. So, we would receive the INVITE w/ the calling number 5551234567 in the From field and then add a diversion header <sip:5551234567@example.com> while the From field remains intact.
Can something like this be done just using a SIP profile? I've been messing around with the SIP-Profile Test Tool today and I can get the static configuration to work; I just cannot get the dynamic portion to work like I want.
Please let me know if I need to clarify any of this.
Thank you,
Solved! Go to Solution.
07-13-2021 07:22 AM
Hi Jesse,
If you see Diversion header already in the Invite, then you can use the below to copy the value from From header and update the same in Diversion header.
voice class sip-profiles 1
request INVITE sip-header From copy "<sip:(.*)@.*" u01
request INVITE sip-header Diversion copy ".*<sip:(.*)@.*" u02
request INVITE sip-header Diversion modify "(.*)<sip:.*@(.*)" "\1<sip:\u01@\2"
You can refer some sample usage of SIP profiles in the below link and create one based on your requirement:
HTH
Rajan
Please rate all useful posts by clicking the star below and mark solutions as accepted wherever applicable
07-13-2021 10:32 AM - edited 07-13-2021 10:39 AM
Adding to your answer, would it not be possible to add this to the SIP profile to add the diversion header if it doesn’t exist?
request INVITE sip-header Diversion add "(.*)<sip:.*@(.*)" "\1<sip:\u01@\2"
07-13-2021 07:22 AM
Hi Jesse,
If you see Diversion header already in the Invite, then you can use the below to copy the value from From header and update the same in Diversion header.
voice class sip-profiles 1
request INVITE sip-header From copy "<sip:(.*)@.*" u01
request INVITE sip-header Diversion copy ".*<sip:(.*)@.*" u02
request INVITE sip-header Diversion modify "(.*)<sip:.*@(.*)" "\1<sip:\u01@\2"
You can refer some sample usage of SIP profiles in the below link and create one based on your requirement:
HTH
Rajan
Please rate all useful posts by clicking the star below and mark solutions as accepted wherever applicable
07-13-2021 10:32 AM - edited 07-13-2021 10:39 AM
Adding to your answer, would it not be possible to add this to the SIP profile to add the diversion header if it doesn’t exist?
request INVITE sip-header Diversion add "(.*)<sip:.*@(.*)" "\1<sip:\u01@\2"
07-13-2021 03:09 PM
Thanks for your responses. I'll try these out when I get the opportunity and report back.
07-13-2021 07:30 PM
In case anyone comes across this in the future and wants to reference this, I finally found a config that works (for my use case). Essentially, I used both of your replies and created a sip profile paired it with a Sip copylist, where 'x.x.x.x' is the IP address that I'm not explicitly including here:
voice class sip-profiles 101 (apply to outgoing Dial peer to ITSP)
request INVITE peer-header sip From copy "<sip:(.*)@" u01
request INVITE sip-header Diversion add "Diversion:<sip:\u01@X.X.X.X>"
request INVITE sip-header Diversion copy ".*<sip:(.*)@.*" u02
request INVITE sip-header Diversion modify "(.*)<sip:.*@(.*)" "\1<sip:\u01@\2"
voice class sip-copylist 101 (apply to incoming Dial peer from CUCM)
sip-header From
Again, thanks for the help Rajan and Roger!
07-13-2021 11:59 PM
Great to hear that you managed to get it to work and thank you reporting back to the community for the full solution of your inquiry.
Please remember to mark your question as answered so that it’s easier for anyone else to use it as a solution.
07-14-2021 02:05 AM
Hi Jesse,
Glad we are able to help. Thanks for the confirmation.
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