[asterisk-users] Lock extension from asterisk

Gordon Henderson gordon+asterisk at drogon.net
Fri Aug 17 08:16:25 CDT 2007


On Fri, 17 Aug 2007, Doug Lytle wrote:

> Gordon Henderson wrote:
>> On Fri, 17 Aug 2007, Andres Jimenez wrote:
>>
>> exten => 8888,1,Answer()
>> exten => 8888,n,Set(me=${CALLERID(num)})
>> exten => 8888,n,Set(DB(${me}/locked)=1)
>>
>> exten => 9999,1,Answer()
>> exten => 9999,n,Set(me=${CALLERID(num)})
>> exten => 9999,n,VMAuthenticate(${me})
>> exten => 9999,n,Set(DB(${me}/locked)=)
>>
>>
>>
> This is good, but it can be done with just 1 extension:
>
> exten => 80*,1,Answer()
> exten => 80*,2,Set(LOCKED=${DB(phonelocked/${CALLERID(number)})})
> exten => 80*,3,GotoIf($["${LOCKED}" = "YES"]?80*,4:80*,101)
> exten => 80*,4,Set(DB(phonelocked/${CALLERID(number)})=NO)
> exten => 80*,5,Playback(de-activated)
> exten => 80*,6,Hangup()
> exten => 80*,101,Set(DB(phonelock/${CALLERID(number)})=YES)
> exten => 80*,102,Playback(activated)
> exten => 80*,103,Hangup()

XOR in dialplan :)

9 lines of code vs. my 7 (which include a validation) though ;-)

Dialplan obscurification contest, anyone? (joking - it's weird enough as 
it is!!!)


One thing I noted recently is that phones sometimes do weird things with 
*'s and #'s )-: The Siemens C460IP DECT phones in particular won't let you 
dial a number that has a * in it at any position other than the 1st digit 
- I guess this is because the phone uses it to switch from the default 
interface to the other one (PSTN vs. VoIP)

Gordon



More information about the asterisk-users mailing list