Thanx Jacob,

I did notice the locking phones at night mails in the list, and I have just finished making the solution and it is just what I wanted here is my addition in the extension.conf (with trixbox I did it in extensions_trixbox.conf), note I have used the Authenticate command also with the astdb just serach voip-info for the command and you will understand the drill, for each phone number I added the password needed  using the database put command from console  :
 

;MAG Addition for phone locking
;to lock extensions
exten => *00,1,Wait(1)
exten => *00,2,Answer
exten => *00,3,Authenticate(/${CALLERID(num)}|d) ; the caller will be prompted for password
exten => *00,4,Set(DB(LOCKPHONE/${CALLERID(num)})=1)  ; if passed the lock variable will be set to equal one
exten => *00,5,Hangup

;to unlock extensions
exten => *01,1,Wait(1)
exten => *01,2,Answer
exten => *01,3,Authenticate(/${CALLERID(name)}|d) ; same as above
exten => *01,4,Set(DB(LOCKPHONE/${CALLERID(num)})=0); reverse of the above
exten => *01,5,Hangup

All that is left is to make a line that checks the variable in astdb   when the calls are going to trunks and ofcourse made the trunk responsible for emergency calls without this feature so you can only call the police, ambulance, power and fire departments and internal extensions but not the costly outside calls
 
 

Thx
MAG
 

Benjamin Jacob wrote:

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.
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

-- 
Thx
MAG
 
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to