[asterisk-users] Dialplan strategy suggestions needed

Steve Edwards asterisk.org at sedwards.com
Sat Aug 1 10:20:13 CDT 2009


> On 1 Aug 2009, at 08:32, Myles Wakeham wrote:
>
>> I have a new Asterisk system going into production next week and I'm a 
>> bit stumped as to the best way to handle the Dialplans for it.
>> 
>> I have separate entire phone 'systems' for each incoming DID.  For 
>> example, this one system will handle 4 separate incoming DIDs.  The 
>> first (let's call it Company A) takes a call, plays a menu, gets input 
>> from the caller, directs them to the appropriate extension (ie. Press 1 
>> for sales, 2 for support, etc.).

On Sat, 1 Aug 2009, Tim Panton wrote:

> Sure, have a top level context that inbound calls from the ITSP go into:
>
> [from-ITSP]
> exten => 2125551112,1,Goto(companya,${EXTEN},1)
> exten => 2125551111,1,Goto(companyb,${EXTEN},1)
>
> ; then separate contexts for each company:
> [companya]
> extern => 2125551111,1,.....
> extern => 2125551111,2,.....
>
> [companyb]
> extern => 2125551112,1,.....
> extern => 2125551112,2,.....

Typing off the top of my "1.2 Luddite" head (meaning I use an "obsolete" 
version of Asterisk and the code is "untested, proceed at you're own 
risk"), I'd:

1) Add a "verbose" at the start of the contexts to show what's going on.

2) Save the incoming number in the first context and then use "s" for 
clarity and maintainability.

3) Use "n" for clarity and maintainability.

4) Reformat for "readability" -- which may not render well in all mail 
clients :(

So I'd suggest:

; All calls start here
[from-ITSP]
         exten = _x.,1,                  verbose(1,[${CONTEXT}:${EXTEN}])
         exten = _x.,n,                  set(DNIS=${EXTEN})
         exten = 2125551111,3,           goto(companya,s,1)
         exten = 2125551112,3,           goto(companyb,s,1)
         exten = 2125551113,3,           goto(companyc,s,1)
         exten = _x.,3,                  verbose(1,Un-configured DNIS - ${DNIS})
         exten = _x.,n,                  hangup()

; Cruft for companya
[companya]
         exten = s,1,                    verbose(1,[${CONTEXT}:${EXTEN}])
         exten = s,n,                    ...
         exten = s,n,                    hangup()

; Cruft for companyb
[companyb]
         exten = s,1,                    verbose(1,[${CONTEXT}:${EXTEN}])
         exten = s,n,                    ...
         exten = s,n,                    hangup()

; (end of /etc/asterisk/extensions.conf)

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000



More information about the asterisk-users mailing list