[Asterisk-Users] can a variable be redefined within extensions.conf

Brancaleoni Matteo mbrancaleoni at espia.it
Sun Feb 1 15:17:08 MST 2004


Hi
> Can I define a variable in globals like this:
> 
> [globals]
> timeout=60
> 
> and then in another context, redefine that same variable and only have
> the new value affect the call that hit that particular extension ?

yes, works this way.
mind : each var is unique for each call... a global
var is simply shared between contexts, not between calls.
each call is a standalone entity

> 
> [example]
> exten => _9NXXXXXX,1,DBget(blah/blah)
> exten => _9NXXXXXX,102,Goto(3)
> exten => _9NXXXXXX,2,SetVar(#timeout=20)
> exten => _9NXXXXXX,3,Dial(${PSTN},${EXTEN:1},${timeout})
> exten => _9NXXXXXX,104,Do something if busy
> exten => _9NXXXXXX,4,Do something else if no answer
> 
> So, if a call goes priority 1,102,3... ${timeout} would = 60 but if the
> call went priority 1,2,3,.... then ${timeout} would =20.
yes.

> 
> Or, could I just leave the variable definition out of globals all
> together ?  What would ${timeout} evaluate to if it isn't defined ?  I
> suspect dial wouldn't be happy since the comma right before timeout
> would still be there....

so this way dial isn't unhappy... simply dial will "dial"
with no timeout

Matteo.

-- 
Brancaleoni Matteo <mbrancaleoni at espia.it>
Espia - Emmegi Srl




More information about the asterisk-users mailing list