[Asterisk-Users] Re: Dial Plan - How to prepend a digit

Tony Mountifield tony at softins.clara.co.uk
Mon Apr 25 13:03:14 MST 2005


In article <5ca26b971fb804b2dbbfbcfa8893180b at user.net>,
Daniel Salama <dsalama at user.net> wrote:
> I'd like to create a dial rule that when someone tries to dial a 
> particular number, the same number is dialed, except that prefixed with 
> some additional digit(s). How can this be specified on extensions.conf?

Easy. Say you want to prepend 90 onto any number beginning with 7,
and 91 onto a particular number, and dial anything else normally:

[specials]
exten => _7.,1,Dial(Zap/g1/90${EXTEN})
exten => 1234567890,1,Dial(Zap/g1/91${EXTEN})

[outgoing]
include => specials
exten => _X.,1,Dial(Zap/g1/${EXTEN})

You need to put the exceptions into an included context, because that's
the only way to guarantee they are considered before the default case.
See http://www.voip-info.org/wiki-Asterisk+config+extensions.conf+sorting
for more discussion of this issue.

Cheers
Tony
-- 
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org



More information about the asterisk-users mailing list