Dial plan scenario 3: Reserving a range of SIP extensions for calls to a SIP trunk - 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 are automatically routed to a SIP trunk.

Scenario

  • What do you want to do? You want to reserve SIP extensions 4000 to 4500 for calls that must automatically be 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 take any call made to a SIP extension that is between 4000 and 4500 and automatically route it to TrunkSIPServerA.
    • The second rule will take calls to any other SIP extension and will keep it local to Sipelia™ Server.
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. Scenario3-OnlyCallsToMyTrunk;00000000-0000-0000-0000-000000000006;ON;local;TrunkSIPServerA;(.*);\b0*4([0-4][0-9]{2}|500)\b;(.*);(.*);
  2. Scenario3-RestAreLocalCalls;00000000-0000-0000-0000-000000000006;ON;local;local;(.*);(.*);(.*);(.*);

Rule 1: Calls to the SIP trunk only

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

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 to the SIP trunk calls made with specific SIP extensions.
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 \b0*4([0-4][0-9]{2}|500)\b, meaning the Sipelia™ Server must 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 locally

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

Value letter Value label Description
A Name The name indicates that this rule will keep local any other call.
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 to keep the calls 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 (.*), 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 be apply. This dial plan results in the following:
  1. If any SIP extension dials a number between 4000 and 4500, the call will be routed to TrunkSIPServerA.
  2. If any SIP extension dials any other number, the call will remain local to Sipelia™ Server.