[Asterisk-Users] Re: Setting variable for a context for all extensions?

Tony Mountifield tony at softins.clara.co.uk
Mon May 9 06:58:47 MST 2005


In article <427DB623.5050801 at wormgoor.com>,
Mark Wormgoor <mark at 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 at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org



More information about the asterisk-users mailing list