Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

This rule involves the following actions.

  1. Look for an INVITE.
  2. Look for a FROM header.
  3. If there is a FROM header, look at the URI username and do a REGEX to see if it is a toll-free number.

  4. If the URI username is a toll-free number, then look to see if a DIVERSION header exists. If a DIVERSION header does not exist, action is to add a DIVERSION header.

Code Block
languagenone
set profiles signaling sipAdaptorProfile "DIVERSION_ADD" rule "1"
set profiles signaling sipAdaptorProfile "DIVERSION_ADD" rule "1" applyMatchHeader "one"
set profiles signaling sipAdaptorProfile "DIVERSION_ADD" rule "1" criterion "1" type "message"
set profiles signaling sipAdaptorProfile "DIVERSION_ADD" rule "1" criterion "1" message messageTypes "request" methodTypes "invite"
set profiles signaling sipAdaptorProfile "DIVERSION_ADD" rule "1" criterion "2" type "header"
set profiles signaling sipAdaptorProfile "DIVERSION_ADD" rule "1" criterion "2" header name "From" condition "exist" hdrInstance "all"
set profiles signaling sipAdaptorProfile "DIVERSION_ADD" rule "1" criterion "3" type "token"
set profiles signaling sipAdaptorProfile "DIVERSION_ADD" rule "1" criterion "3" token condition "regex-match" tokenType "uriusername"
set profiles signaling sipAdaptorProfile "DIVERSION_ADD" rule "1" criterion "3" token regexp string "^(\+?1)?(8(00|44|55|66|77|88)[2-9]\d{6})$"
 
set profiles signaling sipAdaptorProfile "DIVERSION_ADD" rule "1" action "1" type "variable" operation "store"
set profiles signaling sipAdaptorProfile "DIVERSION_ADD" rule "1" action "1" from type "value" value "tollfree"
set profiles signaling sipAdaptorProfile "DIVERSION_ADD" rule "1" action "1" to type "variable" variableValue "var1" variableScopeValue "local"
 
set profiles signaling sipAdaptorProfile "DIVERSION_ADD" rule "2"
set profiles signaling sipAdaptorProfile "DIVERSION_ADD" rule "2" applyMatchHeader "one"
set profiles signaling sipAdaptorProfile "DIVERSION_ADD" rule "2" criterion "1" type "message"
set profiles signaling sipAdaptorProfile "DIVERSION_ADD" rule "2" criterion "1" message messageTypes "request" methodTypes "invite"
set profiles signaling sipAdaptorProfile "DIVERSION_ADD" rule "2" criterion "2" type "variable"
set profiles signaling sipAdaptorProfile "DIVERSION_ADD" rule "2" criterion "2" variable condition "has-value" variableID "var1" value "tollfree"
set profiles signaling sipAdaptorProfile "DIVERSION_ADD" rule "2" criterion "3" type "header"
set profiles signaling sipAdaptorProfile "DIVERSION_ADD" rule "2" criterion "3" header name "Diversion" condition "absent" hdrInstance "all"
 
set profiles signaling sipAdaptorProfile "DIVERSION_ADD" rule "2" action "1" type "header" operation "add" headerPosition "first"
set profiles signaling sipAdaptorProfile "DIVERSION_ADD" rule "2" action "1" to type "header" value "Diversion"
set profiles signaling sipAdaptorProfile "DIVERSION_ADD" rule "2" action "1" from type "header" value sip:6022826398@10.93.196.195;reason=unknown;privacy=off

Input PDU:

Code Block
languagenone
INVITE sip:6029774112@10.93.107.28 SIP/2.0
Via: SIP/2.0/UDP 10.97.13.13;branch=z9hG4bK883050be30F7072B
From: "Charles Schwab" sip:8004354000@10.97.13.13;tag=BE07D554-EB9ADD71
To: sip:6029774112@10.93.107.28
CSeq: 1 INVITE
Call-ID: 34045e80-54dc09fd-192eb6e2@10.97.13.13
Contact: sip:6023842702@10.97.13.13
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, INFO, MESSAGE, SUBSCRIBE, NOTIFY, PRACK, UPDATE, REFER
User-Agent: PolycomVVX-VVX_600-UA/5.0.1.4068
Accept-Language: en
Supported: 100rel,replaces
Allow-Events: conference,talk,hold
Max-Forwards: 70
Content-Type: application/sdp
Content-Length: 353

Transformed PDU:

Code Block
languagenone
INVITE sip:6029774112@172.31.150.113:5073 SIP/2.0
Diversion: sip:6022826398@10.93.196.195;reason=unknown;privacy=off
Via: SIP/2.0/UDP 10.93.196.195:5060;branch=z9hG4bK00Befc6712f6c9974d7
From: "Charles Schwab" sip:8004354000@10.93.196.195;tag=gK002bbbdf
To: sip:6029774112@172.31.150.113
Call-ID: 7741_58493185@10.93.196.195
CSeq: 835645375 INVITE
Max-Forwards: 70
Allow: INVITE,ACK,CANCEL,BYE,REFER,NOTIFY,PRACK,OPTIONS
Accept: application/sdp, application/isup, application/dtmf, application/dtmf-relay,  multipart/mixed
Contact: "8004354000" sip:6023842702@10.93.196.195:5060
Supported: timer,100rel,precondition,replaces
Session-Expires: 1800
Min-SE: 90
Content-Length:  248
Content-Disposition: session; handling=required
Content-Type: application/sdp 

Pagebreak