Mark Wormgoor
2005-May-07 23:48 UTC
[Asterisk-Users] Setting variable for a context for all extensions?
Hi, Is it possible to set a variable for a context for all extensions? I haven't been able to find it. I want something like this in extensions.conf: [from-iaxfwd] exten => .,1,RING=r3 exten => 123456,1,Goto(from-pstn,s,1) [from-internal] exten => .,1,RING=r2 include => ext-local [ext-local] exten => 1,1,Dial(Zap/1,${LONGTIMEOUT}) exten => 2,1,Dial(SIP/2,${LONGTIMEOUT}) But how do I do this? I want to change the ring depending on the starting context. The above doesn't work. Kind regards, Mark
Daniel Salama
2005-May-07 23:57 UTC
[Asterisk-Users] Setting variable for a context for all extensions?
Not entirely sure, but, I wonder what would happen if you define RING in the [globals] section first, and the use SetVar or SetGlobalVar in the other contexts to override its value. - Daniel On May 8, 2005, at 2:48 AM, Mark Wormgoor wrote:> Hi, > > Is it possible to set a variable for a context for all extensions? > I haven't been able to find it. I want something like this in > extensions.conf: > > [from-iaxfwd] > exten => .,1,RING=r3 > exten => 123456,1,Goto(from-pstn,s,1) > > [from-internal] > exten => .,1,RING=r2 > include => ext-local > > [ext-local] > exten => 1,1,Dial(Zap/1,${LONGTIMEOUT}) > exten => 2,1,Dial(SIP/2,${LONGTIMEOUT}) > > But how do I do this? I want to change the ring depending on the > starting context. The above doesn't work. > > Kind regards, > > Mark > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >
trixter http://www.0xdecafbad.com
2005-May-08 00:04 UTC
[Asterisk-Users] Setting variable for a context for all extensions?
have you tried setting the variable at the begining of the context? [contextname] varname=value On Sun, 2005-05-08 at 08:48 +0200, Mark Wormgoor wrote:> Hi, > > Is it possible to set a variable for a context for all extensions? I > haven't been able to find it. I want something like this in > extensions.conf: > > [from-iaxfwd] > exten => .,1,RING=r3 > exten => 123456,1,Goto(from-pstn,s,1) > > [from-internal] > exten => .,1,RING=r2 > include => ext-local > > [ext-local] > exten => 1,1,Dial(Zap/1,${LONGTIMEOUT}) > exten => 2,1,Dial(SIP/2,${LONGTIMEOUT}) > > But how do I do this? I want to change the ring depending on the > starting context. The above doesn't work. > > Kind regards, > > Mark > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users-- Trixter http://www.0xdecafbad.com UK +44 870 340 4605 Germany +49 801 777 555 3402 US +1 360 207 0479 or +1 516 687 5200 FreeWorldDialup: 635378 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20050508/dceebc38/attachment.pgp
El Flynn
2005-May-08 23:23 UTC
[Asterisk-Users] Setting variable for a context for all extensions?
Mark Wormgoor wrote:> Hi, > > Is it possible to set a variable for a context for all extensions? I > haven't been able to find it.Try looking up the application "SetVar": demo*CLI> show application SetVar demo*CLI> -= Info about application 'SetVar' =- [Synopsis]: Set variable to value [Description]: Setvar(#n=value): Sets channel specific variable n to value Flynn
Tony Mountifield
2005-May-09 06:58 UTC
[Asterisk-Users] Re: Setting variable for a context for all extensions?
In article <427DB623.5050801@wormgoor.com>, Mark Wormgoor <mark@wormgoor.com> wrote:> Hi, > > Is it possible to set a variable for a context for all extensions? I > haven't been able to find it. I want something like this in > extensions.conf: > > [from-iaxfwd] > exten => .,1,RING=r3 > exten => 123456,1,Goto(from-pstn,s,1)In the above example, you have both lines on priority 1. You've also forgotten the "_" to signify a pattern. Also, "_." would match the special extensions like i, h and t. Try the following: [from-iaxfwd] exten => _X.,1,RING=r3 exten => 123456,2,Goto(from-pstn,s,1) Then when a call to 123456 comes in, the first line will match (123456,1) and after executing it, Asterisk will be looking for (123456,2), which will match the second line.> [from-internal] > exten => .,1,RING=r2 > include => ext-local > > [ext-local] > exten => 1,1,Dial(Zap/1,${LONGTIMEOUT}) > exten => 2,1,Dial(SIP/2,${LONGTIMEOUT})I'm not sure whather you can use include, but you could certainly do something like this. If you want to handle both single-digit and multi-digit extensions, you have to do them separately, because "." matches a minimum of one character: [from-internal] exten => _X,1,RING=r2 exten => _X,2,Goto(ext-local,${EXTEN},1) exten => _X.,1,RING=r2 exten => _X.,2,Goto(ext-local,${EXTEN},1) [ext-local] exten => 1,1,Dial(Zap/1,${LONGTIMEOUT}) exten => 2,1,Dial(SIP/2,${LONGTIMEOUT}) Hope this helps (and works!) Cheers Tony -- Tony Mountifield Work: tony@softins.co.uk - http://www.softins.co.uk Play: tony@mountifield.org - http://tony.mountifield.org