[asterisk-users] Simplifying dial-plan

Warren Selby wcselby at selbytech.com
Thu Dec 23 05:10:02 UTC 2010


On Wed, Dec 22, 2010 at 10:12 PM, Stephen Reese <rsreese at gmail.com> wrote:

> Thanks Warren, that's what I'm looking to do.
>
> First question is where did ${MACRO_EXTEN} come from, I assumed
> ${EXTEN} is a built in variable?
>
> Secondly, where would the 1 and/or area-code need to be placed? Could
> an additional argument be used to specify the prefix, i.e. a third
> variable be specified in the outbond-context to implement the
> OutboundDial macro, or is the MACRO_EXTEN suppose to be an
> implementation of this?
>
> exten => s,n,Dial(SIP/{$ARG3}${MACRO_EXTEN}@vitel-outbound2)
>
> As Jeroen mentioned previously a goto may be used, would this help,
> seems similar to what I am trying to accomplish.
>
> exten => _NXXNXXXXXX,1,Goto(1${EXTEN},1)
> exten => _NXXXXXX,1,Goto(1555${EXTEN},1)
>
>
>
To answer your first question - ${MACRO_EXTEN} is a macro-specific
variable.  It's the ${EXTEN} that called the macro, since using ${EXTEN}
inside a Macro would just give you a value of "s".

As for your second question, that's pretty easy to do.  If every outbound
call needs to be formatted in the format 1NXXNXXXXXX, you would do this
(again, untested, but should be good along with the macro I gave you
earlier):

[globals]
DEFAULT_AREA_CODE=555 ; swap with your default area code

[outbound-context]

exten => _1NXXNXXXXXX,1,Macro(OutboundDial,${CHANNEL},${EXTERNAL_CALLERID})
exten => _NXXNXXXXXX,1,Goto(outbound-context,1${EXTEN},1)
exten => _NXXXXXX,1,Goto(outbound-context,1${DEFAULT_AREA_CODE}${EXTEN},1)
exten => _011.,1,Macro(OutboundDial,${CHANNEL},${EXTERNAL_CALLERID})
exten => 911,1,Macro(OutboundDial,${CHANNEL},${EXTERNAL_CALLERID})


-- 
Thanks,
--Warren Selby, dCAP
http://www.selbytech.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20101222/56e9aadc/attachment.htm>


More information about the asterisk-users mailing list