[asterisk-users] Stopping putgoing calls after working hours

Benjamin Jacob benjamin.jacob at masconit.com
Tue Oct 17 21:57:28 MST 2006


Mohamed A. Gombolaty wrote:

> Dear Rich,
>
> It seems that my question is very general I apologize for that, but I 
> am glad to see others like yourself pointing me in different 
> directions, it seems all around the world we have problems with the 
> cleaning folks.
>
> What I have in mind is to make the phone user lock his phone when he 
> is leaving with a special code and relock it back when he comes to 
> work (and
>
u mean unlock it......

> as for emergency calls there are attendants who work at night who will 
> be able to make an emergency call whenever needed at the spot), now 
> there is nothing that seems to be able to do that directly, I have 
> played around with the gotoiftime and also the time based dial plan 
> include sent in mails before that.
>
> But while working I thought of another approach why not create a php 
> web interface that each user logs in with a special username and 
> password and gives him access to lock his phone, and what php does is 
> actually change the secret password to something else than the 
> configured on the phone, this should make the phone unable to 
> authenticate thus not being able to make a call, and unlocking it 
> returns the password to it's right form, I have already found the 
> tables that I need to play around so I will restart making the php. I 
> will update the list back with my final result.
>  
>
> Do you guys think I could send a mail to the dev site to see if they 
> can add this  feature to asterisk.
>
Am writing a few dialplans that you could use. I havent testted it.. u 
might have to refine it.. am writing all this at runtime :-)

To lock and unlock phones, you need not go to php and change passwords 
etc. You can use DB operations.

To lock phones, users can call into one particular number, e.g. *01
[lockphone]
exten => *01,1,Set(DB(LOCKPHONE/${CALLERID(num)})=1})

To unlock phones, u set the DB custom variable LOCKPHONE  to zero, using 
another number, say *02
[unlockphone]
exten => *02,1,Set(DB(LOCKPHONE/${CALLERID(num)})=0})

So, to avoid calls, you'll have to check the value of this custom 
variable everytime. To avoid repeated checks even in the day time, you 
can put the following dialplan, only in contexts which are invoked at 
night(read the previous posts).

[night-context]
exten => 911,1,Dial(Zap/999)  ;;;;;;;;;;;wotever syntax, I've never 
worked with ZAP, for 911 emergency calls even at night.
include => lockphone
include => unlockphone
include => othernumbers

[othernumbers]
exten => _[0-9].,1, Set(locked=DB(LOCKPHONE/${CALLERID(num)}))
exten => _[0-9].,2,GotoIf($[${locked}=0]?:5)    ;;;;;;;; allow call only 
if phone is unlocked
exten => _[0-9].,3, Dial(SIP/${EXTEN})           ;;;;;;;; phone is 
unlocked , so call away to glory
exten => _[0-9].,4, Hangup
exten => _[0-9].,5, Playback(hussh-sleep-now)  ;;;;;;;;;;; cant call 
now, cuz phones locked
exten => _[0-9].,6, Hangup


Now you lock n unlock ur phones whenever u want.

cheerz
- Ben.


More information about the asterisk-users mailing list