Jul 26

New Zealand Dialplan for snom phones

There are a couple of benefits to using a dialplan on your IP phone, one of the main ones being that it allows the phone to know when you're finished dialing so it can put your call through without a delay or the need to push an extra button.

The snom desktop phones (snom 300, snom 320, snom 360, snom 370) support a powerful regular expression based dialplan.

This post shows you how to build a dialplan to handle most of the numbers in the New Zealand numbering scheme. So lets get started.

First off we'll handle local and national numbers, this will work for the whole country.

!^([2-9][0-9]{6})$!\1@\d!d
!^(0[34679][2-9]{1}[0-9]{6})$!\1@\d!d

Next up is free calling (0800, 0508) and subscription (0900) services.

!^((0800|0508)[0-9]{6})$!\1@\d!d
!^(0900[0-9]{5})$!\1@\d!d

Starting to get a little more complex now is Vodafone. There are a couple of oddities to their number which require a few rules.

!^(02102[0-9]{6})$!\1@\d!d
!^(021[346789][0-9]{5})$!\1@\d!d
!^(0210[^2][0-9]{5})$!\1@\d!d
!^(021[^0][0-9]{6})$!\1@\d!d
The last two entries here could be simplified into one if the phone supported negative lookaheads, which it appears it doesn't.

This will handle 2Talk VoIP mobile numbers.

!^(02889[0-9]{4})$!\1@\d!d
and all other mobile numbers can be caught with the following
!^(02[479][0-9]{7})$!\1@\d!d

If you happen to use the paging service this pattern will catch that The paging service is a mixture of 6 and 7 digits long;

!^(0261[0-9]{5})$!\1@\d!d
!^(0262[0-9]{6})$!\1@\d!d

Here's the final dialplan in a format ready to be pasted into the "Dial-Plan String" field on your snom phone. This can be found in the web interface under "Identity 1" (where 1 is the identity you're using) in the SIP tab.

!^([2-9][0-9]{6})$!\1@\d!d !^(0[34679][2-9]{1}[0-9]{6})$!\1@\d!d !^(1[0-9]{2})$!\1@\d!d !^((0800|0508)[0-9]{6})$!\1@\d!d !^(0900[0-9]{5})$!\1@\d!d !^(02102[0-9]{6})$!\1@\d!d !^(021[346789][0-9]{5})$!\1@\d!d !^(02889[0-9]{4})$!\1@\d!d !^(02[46789][0-9]{7})$!\1@\d!d !^(0261[0-9]{5})$!\1@\d!d !^(0262[0-9]{6})$!\1@\d!d !^(0210[^2][0-9]{5})$!\1@\d!d !^(021[^0][0-9]{6})$!\1@\d!d

There's a couple of cases that we don't handle here; one is International numbers, these are a variable length and we can't really tell when they're finished being dialed. The other is some short service codes such as 018 etc. All this means is that you'll have to push the OK/tick button to initiate the dial.

Questions, criticisms, comments and suggestions are most welcome in the comments section below.

UPDATE: I forgot to mention the service/emergency codes which is included in the full dialplan above which is

!^(1[0-9]{2})$!\1@\d!d

4 responses to "New Zealand Dialplan for snom phones"

  1. Hi Hads,

    Thanks you very much for this excellent information! You have just saved me about a day or so of my lacking regular expressions skills. :)

    Just one criticism for the sake of it, can you put your emergency number dialplan in the main body of the text. Just about started making one my self but found it in the final wrap up.

    Thanks a bunch,

    Henry
  2. Hi Henry,

    Thanks for your comments, it's always nice to hear feedback and I'm glad it's useful for you. I hadn't noticed that I missed out the emergency pattern from the main body, I'll look at updating that.

    Also seems we're missing line breaks in the comments :)

    Cheers!

    hads
  3. Nice one. I was missing the mobile dial plans.
    I also use a single extra plan for the 2talk voicemail number
    !^(\*55)$!\1@\d!d
  4. Thanks. This is really useful. Appreciate you making it available.

    Rgds,

    Daniel

Leave a comment