[asterisk-users] Lock extension from asterisk

Gordon Henderson
2007-08-17T12:01:06Z

On Fri, 17 Aug 2007, Andres Jimenez wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi all
>
> I am working in a new set up with Grandstream GXP-2000 handsets. I
> like those phone, but they lack a feature I need: the phone cannot be
> locked by the user.
>
> What I actually want is a user to be able to avoid someone else making
> calls from his phone without giving him access to SIP configuration
> access to the phone.
>
> i.e. let say I want user 132 (that uses extension 132 in our system)
> to be able to lock his phone (located in a publicly accessible
> office).

The easy answer is: Yes...

> Could he dial an special extension (i.e. 9999) and Asterisk will drop
> any call until another special extension (i.e. 8888) is dialed?
>
> Suggestions?

It all depends on how your dialplan works. If you have one macro that
controls calls from extensions to other extensions, or outside lines, then
you can implement 2 numbers to set/clear a "flag" in the astdb, then
in
the bits where to call other extensions, (or outside lines) call a macro
that tests for the flag being set...

You can use the extensions voicemail PIN to validate the unlocking too for
futher security.

Soooo.... (all untested!)

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)=)

(I think I swapped the 8888 and 9999 here, but I'm sure you can see that!)

and in the dial-plan where call processing takes place:

exten =>  s,1,Set(me=${CALLERID(num)})
exten =>  s,n,Set(locked=${DB(${me}/locked)})
exten =>  s,n,GotoIf(${locked}?:doneLockCheck)

exten =>  s,n,Playback(sorry-cant-let-you-do-that)
exten =>  s,n,Hangup()
exten =>  s,n(doneLockCheck),Noop(We're not locked)


Gordon