Content

Page tree



Introduction

On the phone, a dial plan may have the following functions:

  • Determine when a number is complete (e.g. ten-digit number in USA)
  • Automatically convert local numbers into global numbers (e.g. dialing 398330 in Berlin, Germany gets converted into +4930398330)
  • Automatically append the local domain (e.g. dialing 398330 gets converted into sip:398330@company.com;user=phone)


The phone is able to generate predefined dial plans from the user interface.

The dial plan depends on the outgoing line identity; therefore the snom phone supports multiple dial plan entries, one for each identity. Those entries are available in the SIP/Stack settings.

From a requirement point of view, dial plans are similar to the replacements known from ENUM or NAPTR. Therefore, snom built upon these mechanisms and added some more features that make them suitable for the above scenarios.

The first additional feature is that there can be more than one pattern. The patterns are separated by spaces. The first pattern which yields a match is taken.



Dial Plan Entries

Dial plan entries have three parts. The parts may be separated by any character; typically the characters “!” or “|” are used for separation.

The first part contains a pattern which is used for matching the dialed number. The second part contains the result or the dial plan step and the third (optional) part contains flags that set additional processing attributes.


The following flags are available:

  • The “d” flag means that the number is complete and can be dialed. Example:“|([0-9]{5})|sip:\1@test.com|d” means that a number with five digits will be dialed automatically.
  • The “i” flag means that the comparisons should be done case-insensitive.



Substitutions

Substitutions are found in the second part of the dial plan entry. Substitutions are marked by a leading \

  • The “d” replacement inserts the name of the registrar.
    For example, „!*!sip:\1@\d!“ inserts the domain name behind the „@“ symbol.

  • Numbers are backreferences to match-groups of the regEx part according to RFC2915.
    For example, “!(.+)!sip:\1@domain!” inserts a “sip:” before the string (which is the first match). Attention, before firmware 8.5 only the backreferences 1-9 are available.



Triggering ENUM

The phone supports ENUM lookup. In order to trigger the steps described in the ENUM RFC2916, the SIP URI must contain the parameter phone set to yes (“;phone=yes”).

The ENUM handling of the phone is described in a separate document.



Summary of extended regular expressions

See also the Internet for detail description of extended regular expressions.

  • To match a character, just use that character. If a character has a special meaning, it has to be escaped by the backslash character. Characters with special meaning: . ( a simple period), - (minus) or any type of brackets.
  • ^ matches the beginning of a string, $ matches the end of a string
  • dot („.“) matches every character.
  • To match a range of characters, use [ and ] and list the characters between the brackets. Ranges can be defined by the dash symbol. Ranges can be negated by the ^ symbol (for example [^0-9] matches all characters but numbers).
  • +“, „*“, „?“ are multipliers which match at least once („+“), any number of times („*“), or does not match, and at most once („?“). Multipliers can also be explicitly stated in curly brackets, for example {5,9} means at least 5 times, at most 9 times. {5,} means at least five times, {5} means exactly five times. Without multiplier, exactly one match is expected.
  • Brackets can be used to group matches (like in „(abc)?“ which matches „abc“ or the empty string).
  • The „|“ can be used to indicate alternate matches (like in „a|b“ which matches a or b).


Examples:

  • (sip:)?(+?[0-9]+)@.+” matches SIP URI that contain a telephone number (like sip:+4930432343@isp.de or 30432343@isp.de).
  • ^sip:([^@]*)@(.*)” matches SIP URI that contain a user name
  • (A(B(C)DE)(F)G)” matches “ABCDEFG
  • (http://([^/:]+))|(SIP:([^@]+)@.*)” matches a http URL or a SIP URI.



Examples for Dial Plans

Convert an emergency number into a SIP URL

This pattern could look like this:

!^911$!sip:emergency@local!d

Separated by the exclamation mark, it contains the pattern for the 911 and the resulting SIP URI. The d flag indicates that there is no need to press the Ok key after dialing this number.

Make the phone dial a number when the pound key is pressed

The pattern could look like this:

!([^#]+)#!sip:\1@\d!d

This dial plan entry will look for a pattern ending in a pound symbol and use this as the user name in a SIP URI (not including the pound symbol).

Matching an international number

Just put the 011 pattern at the front of the pattern, like in

|^011([0-9]*)$|sip:+\1@\d;phone=yes|

This pattern requires that the user presses the Ok key in order to start the call.

Area codes

Example 1:

If the phone number has digits between 3 and 6 then use an area code:

"|^([0-9]{3,4})$|sip:030\1@\d""|^([0-9]{5,6})$|sip:030\1@\d"

Example 2:

Use an area code all the time:

|^([0-9]*)$|sip:030\1@\d

Make the phone dial a number if a certain number of digits have been reached

The following dial plan entry could be used:

|^1([0-9]{10})$|sip:+1\1@\d;phone=yes|d
This pattern will look for a number starting with 1 and followed by ten digits. It will replace it with a URI that contain the hint to try an ENUM lookup first before sending it to the proxy.

Calling a complete URI

This is a little bit more difficult because of the number of allowed characters in the user name. The following character can be base for such a dial plan entry

|^([a-zA-Z0-9&=+\$,;?\-_.!~*‘()%]+@.+)|sip:\1|

Separating * codes from normal numbers

This is sometimes desired e.g. a plan is needed to add a leading 0 to an outgoing number not starting with 0 e.g. 3039833104 should be dialed as 03039833104 but not 03039833104 be converted to 003039833104. One could use the following for this purpose:

|^([1-9]{2})([0-9]{6,})$|sip:0\1\2@\d


But if a start code is followed by a destination e.g. *7939833452, it is not desired to convert it to 07939833452, because the pbx is expected to get the whole string and use it accordingly. Hence we can concatenate a plan to the one above to look after such exceptions:

"|^\*([0-9]*)$|sip:*\1@\d""|^([1-9]{2})([0-9]{6,})$|sip:0\1\2@\d"

Separated by the exclamation mark, it contains the pattern for the 911 and the resulting SIP URI. The d flag indicates that there is no need to press the Ok key after dialing this number.

Leading Zeros

If a number starts with 9 and has at least 8 further digits then use a leading Zero

|^9([0-9]{8})$|sip:09\1@\d

If a number has 2 digits don't use a leading zero. When more than 2 digits use the leading zero

|^([0-9]{3,})$|sip:0\1@\d

Concatenate dial plans

To concatenate dialplans just write them one after another including "" quotes. You will get after concatenating the above two dialplans.

"|^9([0-9]{8})$|sip:09\1@\d" "|^([0-9]{3,})$|sip:0\1@\d"

Dial a certain number with another outgoing identity

|^911|sip:emergency@provider.de|d

To change the + to 00

|^\+([0-9]*)$|sip:00\1@\d;phone=yes|

Allow calls only with a leading string

To allow only calls to numbers with 9 at the beginning. All other numbers will be blocked.

|^[^9]([0-9]{0,})$|sip:blocked\@\d