[asterisk-users] exten versus EXTEN
Steve Edwards
asterisk.org at sedwards.com
Mon Apr 6 22:55:58 CDT 2015
On Mon, 6 Apr 2015, thufir wrote:
> p 176 has exten => 1NXXNXXXXXXX,1,Dial(SIP/${EXTEN}@myprovider)
>
> how is "exten" distinct from "EXTEN"? What is this line of code doing?
This is a line of 'classic' dialplan (as opposed to AEL, Lua, or ...).
It defines a single step in the dialplan.
It 'says' if the extension matches the pattern 1NXXNXXXXXXX, dial
myprovider using the SIP protocol and pass the value of the current
extension.
exten is not case sensitive. exten is the same as EXTEN. If you write
EXTEN, Asterisk will clobber it ('dialplan save') and rewrite it as exten
so you might as well just use exten.
> https://wiki.asterisk.org/wiki/display/AST/Asterisk+Standard+Channel+Variables
>
> says that EXTEN is the current extension.
You can reference the current value of EXTEN like:
same = n,verbose(The current value of EXTEN is ${EXTEN})
Another good reason to use exten so you won't confuse 'the next guy' who
has to maintain your code.
> In ruby, you this:
>
> H = Hash["a" => 100, "b" => 200]
>
> The => is a mapping, or at least that's my understanding. What does it mean
> in Asterisk? I didn't
> fully appreciate that Asterisk is, apparently, its own language.
'=>' is the same as '=' when used in the dialplan. Personally, I always
use '=' as the dialplan doesn't seem to be the place for some object
oriented mumbo-jumbo -- at least to my 'C programmer till I die' eyes.
--
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