Dial plan scenario 2: Reserving a range of SIP extensions for local calls - Sipelia™ 2.11

Sipelia™ User Guide 2.11

Applies to
Sipelia™ 2.11
Last updated
2022-01-10
Content type
Guides > User guides
Language
English
Product
Sipelia™
Version
2.11

In this scenario, dial plan rules are used to define a range of SIP extensions for calls that remain local to Sipelia™ Server, while calls made to any other SIP extensions are automatically routed to a SIP trunk.

Scenario

  • What do you want to do? You want the SIP extensions 4000 to 4500 reserved for calls that must remain local to Sipelia™ Server, while calls made to other SIP extensions are routed to SIP Server A.
  • What you need to do before defining the rule? Add a SIP trunk in Config Tool for SIP Server A and name it TrunkSIPServerA. This trunk name must be unique, so that the dial plan rule that you will create will not conflict with other rules, and your rule will be applied correctly.
  • How can you do it? You need to define two separate rules listed in the right order in your dial plan.
    • The first rule will keep the calls local when the destination SIP extensions are between 4000 and 4500.
    • The second rule will take calls to any other SIP extensions and route them to TrunkSIPServerA.
IMPORTANT: The rules need to be in the right order in the dial plan to work as described in this scenario.

Example of the dial plan

The following is an example of a dial plan that accomplishes the above mentioned scenario.
  1. Scenario2-OnlyLocalCalls;00000000-0000-0000-0000-000000000006;ON;local;local;(.*);\b0*4([0-4][0-9]{2}|500)\b;(.*);(.*);
  2. Scenario2-RestCallsToMyTrunk;00000000-0000-0000-0000-000000000006;ON;local;TrunkSIPServerA;(.*);(.*);(.*);(.*);

Rule 1: Only local calls

The first rule listed in the dial plan and shown below tells Sipelia™ Server to look for source SIP extensions between 4000 and 4500, and keep them local.

The value labels identified below correspond to the column labels which appear on the Dial plans page of the Sipelia plugin role.

Value letter Value label Description
A Name The name indicates that this rule will route local calls.
B Schedule The schedule is set to Always, meaning that the rule will always be verified.
C Status The status is set On, meaning that the rule is currently active.
D Direction from The field is set to local to look for calls that will be originating from Sipelia™ Server.
E Direction to The field is set to local because the calls that match the rule will remain local to Sipelia™ Server.
F Source The regular expression is set to (.*), meaning that the call can be made from any SIP extension registered to Sipelia™ Server.
G Destination The regular expression is set to \b0*4([0-4][0-9]{2}|500)\b to look for destination SIP extensions between 4000 and 4500, as described below:
\b
SIP extension boundary. Used together with the same \b element at the end of the expression, this requires the whole SIP extension to be matched. Starting or ending characters will not be omitted.
0*
Look for any number of zeros before the next character, which is 4.
4
Look for a SIP extension that begins with 4.
([0-4]
Look for a single occurrence of digits 0 through 4 after the first 4.
[0-9]{2}
Look for 2 following occurrences of digits 0 through 9, which now covers extension 4000 to 4499.
|500)
Look specifically for 500 to add 4500 in the search pattern.
\b
Match a SIP extension boundary.
H New source The regular expression (.*) is used. This means that your extension (the source caller) on Sipelia™ Server remains unchanged.
I New destination The regular expression (.*) is used. This means that the called extension remains unchanged.

Rule 2: Other calls routed to the SIP trunk

The second rule listed in the dial plan and shown below tells Sipelia™ Server to route to TrunkSIPServerA any call that is not matching the first rule.

Value letter Value label Description
A Name The name indicates that this rule will route any other call to TrunkSIPServerA.
B Schedule The schedule is set to Always, meaning that the rule will always be verified.
C Status The status is set On, meaning that the rule is currently active.
D Direction from The field is set to local to look for calls that will be originating from Sipelia™ Server.
E Direction to The field is set to TrunkSIPServerA to route the calls to that SIP trunk.
F Source The regular expression is set to (.*), meaning that the call can be made from any SIP extension registered to Sipelia™ Server.
G Destination The regular expression is set to (.*), meaning that the call can be made to reach any SIP extension.
H New source The regular expression (.*) is used. This means that your extension (the source caller) on Sipelia™ Server remains unchanged.
I New destination The regular expression (.*) is used. This means that the called extension remains unchanged.

Result

Once the dial plan is imported into Config Tool, only the highest priority rule will apply. This dial plan results in the following:
  1. If any SIP extension dials a number between 4000 and 4500, the call will remain local to Sipelia™ Server.
  2. If any SIP extension dials any other number, the call will automatically be routed to SIP Server A.