[asterisk-users] How to limit extension to allow only internal calls
Steve Edwards
asterisk.org at sedwards.com
Mon Jun 2 19:53:48 CDT 2008
On Tue, 3 Jun 2008, DEVEL STAROSTA wrote:
> I want to notice that trixbox with all modules installed have a lot of
> configuration files and is very hard to place solution.
What's Trixbox? :)
> So, I've added this in extensions_custom.conf (file included by
> extensions.conf)
> [service]
> exten => _2XXX,1,Dial(SIP/${EXTEN}, 20,rT) ; this match only wth 4
> digits ad with the first digit begins with "2" (nb: all internals in
> hotel begin with 2: 2000-reception, 2001 - office and so on)
> exten => _2XXX,n,Hangup()
>
> after this:
>
> exten => 2100,1,dial(${service}) ; 1-st floor telephone service
> exten => 2200,1,dial(${service}) ; 2-nd floor telephone service
> exten => 2300,1,dial(${service}) ; 3 floor telephone service
> exten => 2400,1,dial(${service}) ; 4 floor telephone service
Are 2100, 2200, 2300, 2400 all supposed to dial the same destination?
You probably want something like this:
[general]
SERVICE-PHONE-1 = sip/front-desk
SERVICE-PHONE-2 = sip/service-phone-2
SERVICE-PHONE-3 = zap/1
SERVICE-PHONE-4 = zap/2
[service]
exten = 2100,1, dial(${SERVICE-PHONE-1})
exten = 2200,1, dial(${SERVICE-PHONE-2})
exten = 2300,1, dial(${SERVICE-PHONE-3})
exten = 2400,1, dial(${SERVICE-PHONE-4})
exten = _2xxx,1, dial(sip/${EXTEN},20,rT)
exten = _2xxx,n, hangup()
Note that I removed the space between "," and "2." Asterisk's parser
is not very smart in how it handles spaces (IMNSHO). Using them will
come back to bite you later when you start using expressions and if
statements.
Also note that something as obtuse as:
exten = _2[1-4]00,1, dial(${SERVICE-PHONE-${EXTEN:1:1}})
does not quite work because _2xxx is evaluated before _2[1-4]00 -- go
figure :)
Thanks in advance,
------------------------------------------------------------------------
Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000
More information about the asterisk-users
mailing list