Exten Versus EXTEN

Home » Asterisk Users » Exten Versus EXTEN
Asterisk Users 1 Comment

p 176 has exten => 1NXXNXXXXXXX,1,Dial(SIP/${EXTEN}@myprovider)

how is “exten” distinct from “EXTEN”? What is this line of code doing?

https://wiki.asterisk.org/wiki/display/AST/Asterisk+Standard+Channel+Variables

says that EXTEN is the current extension.

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.

thanks,

Thufir

One thought on - Exten Versus EXTEN

  • 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.

    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.

    ‘=>’ 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.