For this example configuration our SIP trunk provider has specified that for Invite packets:
- From header must contain the originating caller ID without the leading zero, e.g. From: "1143210757" <sip:1143213213@192.168.0.253>
- To header must contain the called number with the leading zero for UK calls or 00 for international, e.g. To: <sip:07891234567@1.2.3.4>
voice translation-rule 200
rule 1 /^0\(.*\)/ /\1/
!
voice translation-profile SIP_OUT
translate calling 200
Now a UC500 series formats the Remote-Party-ID and From fields with the caller ID from the ephone-dn that initiated the call:
Remote-Party-ID: "Firstname Lastname" <sip:1143213213@192.168.0.253>
From: "Firstname Lastname" <sip:1143213213@192.168.0.253>To rewrite them to the correct format with the caller ID inside the quote marks we use a sip-profile. These are applied globally and allow us to amend the SIP headers:
voice service voip
sip
sip-profiles 100
voice class sip-profile 100
request ANY sdp-header Connection-Info remove
response ANY sdp-header Connection-Info remove
request invite sip-header Remote-Party-ID modify "\"(.*)\" <sip:(.*)@(.*)>" "\"\2\" <sip:\2@\3>"
request invite sip-header From modify "\"(.*)\" <sip:(.*)@(.*)>" "\"\2\" <sip:\2@\3>"
The regular expression "\"(.*)\" <sip:(.*)@(.*)>" "\"\2\" <sip:\2@\3>" identifies the text contained in quote marks, followed by the text before and after the @ symbol. It then replaces the text contained in quote marks with the text before the @ symbol. The end result of this is that From: "Firstname Lastname" <sip:1143213213@192.168.0.253> becomes From: "1143213213" <sip:1143213213@192.168.0.253>.
Further reading on using sip-profiles can be found here.
No comments:
Post a Comment