Dialing Rules - VoIP.ms Wiki

Dialing Rules

From VoIP.ms Wiki

Jump to: navigation, search

There are many ways that you can create Dialing Rules in the Asterisk/PBX system. In this article we will provide you some samples and how to create them. The Dialing Rules that we are going to include is the 10 digit dialing to USA and Canada and how to emulate your local telephone company.

Asterisk / PBX

10 Digits Dialing to USA/Canada

If you want to dial without the 1 , or without the 1+area code, here's how you can do it. Edit extensions.conf. Note that in our example, when we match NXXNXXXXXX, we add a 1 in front of the number to dial. Dial(SIP/1${EXTEN}@voipms). In the 7 digits example, let's say your area code is 214. When you dial 7 numbers, the dial command will add 1214 in front. Dial(SIP/1214${EXTEN}@voipms). Replace the 214 by the area code you want your local calls to be.

         [mycontext]
         ; International Calls
         exten => _011.,1,Dial(SIP/${EXTEN}@voipms)
         exten => _011.,n,Hangup()
         ; USA / Canada
         exten => _1NXXNXXXXXX,1,Dial(SIP/${EXTEN}@voipms)
         exten => _1NXXNXXXXXX,n,Hangup()
         ; 10 Digits dialing
         exten => NXXNXXXXXX,1,Dial(SIP/1${EXTEN}@voipms)
         exten => NXXNXXXXXX,n,Hangup()
         ; 7 Digits local dialing, in this example, your area code is 214
         exten => NXXXXXX,1,Dial(SIP/1214${EXTEN}@voipms)
         exten => NXXXXXX,n,Hangup()

Emulating your local telephone company dialing behaviors in other countries

In this example, we'll use Mexico. With some tweaking, you can match your own country behaviors.

For Mexico, you may not want to dial 011+ 52(country code) + local phone number to call your neighbor. In this example, we'll show you how to simulate the dialing rules of the mexican (Telmex) phone company.

    [mycontext]
    ; International Calls from Mexico to other countries
    exten => _00.,1,Dial(SIP/${EXTEN}@voipms)
    exten => _00.,n,Hangup()


    ; USA / Canada from Mexico
    ; We know this is redundant to the previous example (_00.)
    ; but this is just to show you the dialing rules to call from Mexico to the USA and Canada,
    ; in case you would want to disable international dialing by removing the previous example.
    exten => _001NXXNXXXXXX,1,Dial(SIP/${EXTEN:2}@voipms)
    exten => _001NXXNXXXXXX,n,Hangup()


    ; Long distance calls dialing rules in mexico:  01 + Area code + Number 
    exten => _01NXXXXXXXXX,1,Dial(SIP/01152${EXTEN:2}@voipms)
    exten => _01NXXNXXXXXX,n,Hangup()


    ; Local Dialing from land line to another land line if your area code is 2 digits 
    ; In this example, your area code would be 55 for mexico city, and a 8 digits local number
    exten => _NXXXXXXX,1,Dial(0115255${EXTEN}@voipms)
    exten => _NXXXXXXX,n,Hangup()


    ; Local Dialing from land line to another land line if your area code is 3 digits 
    ; In this example, your area code would be 999 for Merida, and a 7 digits local number
    exten => _NXXXXXX,1,Dial(01152999${EXTEN}@voipms)
    exten => _NXXXXXX,n,Hangup()


    ; To call a local cell phone from land line. 044 + area code + number
    ; But to call mexico cellular from outside, you need 52 + 1 + Area code + number
    ; Here's how to do it
    exten => _044NXXXXXXXXX,1,Dial(SIP/011521${EXTEN:3}@voipms) 
    exten => _044NXXXXXXXXX,n,Hangup()


    ; To call a long distance cellular from a landline, 045 + area code + number
    exten => _045NXXXXXXXXX,1,Dial(SIP/011521${EXTEN:3}@voipms)
    exten => _045NXXXXXXXXX,n,Hangup()


    ; {EXTEN} is the number you dialed. When it's followed by a semi column and a digit,
    ; it's the quantity of digits you want to strip from the beginning of the number.
Personal tools
Namespaces
Variants
Actions
VoIP.ms Wiki
Configuration
Guides (English)
Guides (Français)
Guías (Español)
Toolbox