5. Dial Plan Rule Examples for the sample class
Note:
For using the sample.java, please specify the variable below in the sv.properties file:
dialplan.plugins.matching.pkg = plugin
Example-1: $sample.hello
[Matching Patterns] $request = ^INVITE $sample.hello = (.+) [Deploy Patterns] To = sip:%1@domain.com
The call will be forwarded to sip:hello@domain.com
Example-2: $sample.reverse( string )
[Matching Patterns] $request = ^INVITE $geturi( To ) = sip:(.+)@(.+) $sample.reverse( "%1" ) = (.+) [Deploy Patterns] To = sip:%3@%2
The call will be forwarded to the reversed username SIP-URI.
For example, if original To header is “sip:1234@domain.com”, new To header will be “sip:4321@domain.com”.
Example-3: $sample.alias( username )
[Matching Patterns] $request = ^INVITE To = sip:(.+)@ $sample.alias( "%1" ) = (.+) [Deploy Patterns] To = %2
The call will be forwarded to the aliased SIP-URI based on the username.
Example-4: $sample.adminuri
[Matching Patterns] $request = ^INVITE $sample.adminuri = (.+) [Deploy Patterns] To = %1
The call will be forwarded to the adminstrator’s SIP-URI.
Example-5: $sample.equals( string1, string2, [string3] )
[Matching Patterns] $request = ^INVITE $geturi( From ) = @(.+) $geturi( To ) = @(.+) $sample.equals( "%1", "%2", "domain.com" ) = true [Deploy Patterns] $action = 603
The call will be rejected if a domain name of both From and To headers are same and the domain name is “domain.com”.
Example-6: $sample.webget
[Matching Patterns] $request = ^INVITE $sample.webget = (.+) [Deploy Patterns] To = %1
The call will be forwarded to the new SIP-URI obtained from the web “http://brekeke.com/username.txt”.