[asterisk-users] extensions.conf 4 digit dialing question

William Piper william.piper at gmail.com
Tue Jul 18 20:39:25 MST 2006


On 7/18/06, Jerry Bonner <Jerry.Bonner at cptelecom.net> wrote:
>
>   Hi all,
>
> Does anyone have any tips on how I would accomplish a plan where if a user
> dials 4 digits, then prefix 6 digits, then if there is a local extension
> configured for that number dial it, otherwise send it out another sip
> gateway ( my pstn gateway)?
>
> Perhaps more specifically, are there any construtcs that would "dial
> extension if exists"? Because I want to make sure I dial a sip extension
> before routing it out to the pstn.
>
> ~jerry
>
I believe that something like this will do what you are looking for:

[4digitContext]
exten => XXXX,1,goto(checkdids,123456${EXTEN},1) ;Change 1-6 with whatever
the prefix

[checkdids]
;this will try to find a match in 'mydids' before sending out to 'dialout'
include => mydids
include => dialout

[mydids]
;this is the context that houses your DID's.
exten => _8135551212,1,Dial,SIP/whatever
exten => _9195551212,1,Dial,SIP/whatever2

[dialout]
;This will prefix a '1' to the number and make the call.
exten => _XXXXXXXXXX.,1,Dial,SIP/1${EXTEN}@carrier

I believe this should help you.
Good luck,

bp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060718/dc6b5a0c/attachment.htm


More information about the asterisk-users mailing list