Is it at all possible to set a Global Variable freely whenever a context gets used without having to enter an extension priority to use SetGlobalVar? This is really limiting the dialplan for me. Heres an example of what I would like to be able to do. [globals] AREACODE [local] exten=_NXXXXXX,1,Dial(SIP/${AREACODE}${EXTEN}/blah) [anyoldcontext1] AREACODE=313 include=local [anyoldcontext2] AREACODE=810 include=local so then sip accounts would point towards either anyoldcontext1 or anyoldcontext2 and depending on what is set in sip.conf for a context depends on what their area code the sip account would use. Anyone have any ideas? I suppose my last resort will be to modify the source but an simple alternative would be nice. Thanks a lot -Chad -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20050624/604749fb/attachment.htm
Is it at all possible to set a Global Variable freely whenever a context gets used without having to enter an extension priority to use SetGlobalVar? This is really limiting the dialplan for me. Heres an example of what I would like to be able to do. [globals] AREACODE [local] exten=_NXXXXXX,1,Dial(SIP/${AREACODE}${EXTEN}/blah) [anyoldcontext1] AREACODE=313 include=local [anyoldcontext2] AREACODE=810 include=local so then sip accounts would point towards either anyoldcontext1 or anyoldcontext2 and depending on what is set in sip.conf for a context depends on what their area code the sip account would use. Anyone have any ideas? I suppose my last resort will be to modify the source but an simple alternative would be nice. Thanks a lot -Chad -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20050624/00e47659/attachment.htm
Kevin P. Fleming
2005-Jun-24 11:37 UTC
[Asterisk-Users] Set global variables without extension..
chouck wrote:> [anyoldcontext1] > AREACODE=313 > include=local > > [anyoldcontext2] > AREACODE=810 > include=local[anyoldcontext] exten => _X.,1,Set(AREACODE=313) include => local [anyoldcontext2] exten => _X.,1,Set(AREACODE=810) include => local [local] exten => _XXXXX,2,Dial(${AREACODE}...) This will do exactly what you want, except if you try to send a call to this context that should not match anything in 'local' (since it will match the _X. pattern).