Locking and unlocking a phone?

Hi, hi followed your advice… but i am unable to see this working, i added the same way in the extension-custom conf…
but that dont work…
when i set the destination as:

custom-setlock,s,1 freepbx open a msg box and state that this is not valid.

could you give a hand?

In my case i am searching a simple way to shut all phone, as i say many one cheating about my telephone system on the saturday and past business hour.

I was thnking if i could use this in conjunction witha time condition in order to dial a day/night code to prevent all phones from outbound-routes.

cheer

liku

Ok sorry to all.

My mistake was that i was trying to use misc dest instead of custom destination.
Maybe a misread.

Work great many thanks!

With this dialplan, you can set the password everytime you lock the extension. Also, VALIDPIN can be used by administrators to unlock the extension.

[custom-checklock]
exten => _.,1,NoOp(AMPUSER/${CALLERID(num)}/locked)
exten => _.,n,Gotoif($[${DB_EXISTS(AMPUSER/${CALLERID(num)}/locked)}=0]?carryon)
exten => _.,n,Set(PINCOUNT=0)
exten => _.,n,Set(VALIDPIN=1234)
exten => _.,n(readpin),Read(PIN,vm-password,)
exten => _.,n,Gotoif($[${PIN}=${VALIDPIN}]?carryon)
exten => _.,n,Gotoif($[${PIN}=${DB(AMPUSER/${CALLERID(num)}/locked)}]?carryon)
exten => _.,n,Set(PINCOUNT=$[${PINCOUNT}+1])
exten => _.,n,Playback(vm-incorrect)
exten => _.,n,GotoIf($[${PINCOUNT}>3]?h)
exten => _.,n,Wait(1)
exten => _.,n,Goto(readpin)
exten => _.,n(carryon),NoOp(${DB_DELETE(AMPUSER/${CALLERID(num)}/locked)})
exten => _.,n,Goto(from-internal,${EXTEN},1)
exten => h,1,Hangup

[custom-setlock]
exten => s,1,NoOp(In Set Lock)
exten => s,n,Read(PIN1,vm-password,)
exten => s,n,Read(PIN2,vm-password,)
exten => s,n,Gotoif($[${PIN1}=${PIN2}]?okey)
exten => s,n,Playback(an-error-has-occured)
exten => s,n,Hangup
exten => s,n(okey),Set(DB(AMPUSER/${CALLERID(num)}/locked)=${PIN1})
exten => s,n,Playback(vm-goodbye)
exten => s,n,Hangup

Nice that you updated this, I think I will add it to a How-To so people can more easily find it… but you forgot the emergency call bypass in [custom-checklock] (I fixed it in the How-To).

i am able to configured login and logut option, but i am looking for different password for diferent extensions.
Ex 111 - 5854
222 - 78452
Please help.

This worked fine for me. However I already have contexts set up on my phones using the Custom Contexts module. Maybe I am asking a lot, but can anyone suggest a way to use this useful feature so it actually changes the phone’s context from [from-internal] to, for example [internal-only]?
This last would be a predefined Custom Context.

Incidentally with Hotel Receptions, Doorphones etc, the “batphone” feature on Zap channels (immediate=yes) works well. If people can’t actually dial there is no need to restrict.

It was easy enough when I figured it out. Instead of

 exten => _.,n,Goto(from-internal,${EXTEN},1)

For a predefined Custom Context called internal-only

 exten => _.,n,Goto(internal-only,${EXTEN},1)

The context is called custom-checklock-internal-only

An announcement is needed to tell blocked callers which number(s) they can actually can dial, right now its a bit cryptic.

I will also try out Ward Mundy’s Phone Genie to set the extension locks remotely, this could be a very handy feature sometimes.

Since I was already using the Custom Contexts module, I modified the code so that a locked extension doesn’t completely lock, it falls back to a more restricted context so that, for example, internal calls can still be made. I kept the emergency number feature though. I also used two feature codes, one to lock, and the other to unlock the phone, had to do this for spouse approval. And finally I used the Phone Genie application to do this remotely. This works in parallel to the local application, so a phone can be locked remotely and unlocked locally and vice-versa.
In all of this I didn’t write one line of original code, I just adapted the information kindly provided above. Thanks, all.

Finally We have modified the context so that once the user sets passcode, then it doesn’t ask passcode to lock the extension. The extension will be locked with passcode entered earlier one. User can reset the passcode by dialing the feature code *87 and the system will prompt for the old passcode. By dialing the *88 user can unlock the extension and by dialing *89 the extension will be locked with set passcode and it won’t prompt enter the passcode.

http://sites.google.com/site/docoflas/password-lock

Hi,

I have this working marvelously, but now I am adding in sound files to make it more, for lack of a better work, professional. What I want to do is the following:

  1. Locked extensions tries to call out, but is prompted for password because is locked. User types in password and sound file plays and says “This extension is now unlocked.” and then continues the call. BUT, I can get the sound to play, but it plays on all outbound calls (whether extension is locked or not). I just want it to play after a successful PIN entry and phone unlock. Is this possible? What I have as of code is below. Thanks! Ross

[extension-lock]
exten => _.,1,NoOp(AMPUSER/${CALLERID(num)}/locked)
exten => _.,n,Gotoif($[${DB_EXISTS(AMPUSER/${CALLERID(num)}/locked)}=0]?carryon)
exten => _.,n,Set(PINCOUNT=0)
exten => _.,n,Set(VALIDPIN=23646)
exten => _.,n(readpin),Read(PIN,custom/ExtenLocked,)
exten => _.,n,Gotoif($[${PIN}=${VALIDPIN}]?carryon)
exten => _.,n,Gotoif($[${PIN}=${DB(AMPUSER/${CALLERID(num)}/locked)}]?carryon)
exten => _.,n,Set(PINCOUNT=$[${PINCOUNT}+1])
exten => _.,n,Playback(vm-incorrect)
exten => _.,n,GotoIf($[${PINCOUNT}>3]?h)
exten => _.,n,Wait(1)
exten => _.,n,Goto(readpin)
exten => _.,n(carryon),NoOp(${DB_DELETE(AMPUSER/${CALLERID(num)}/locked)})
exten => _.,n,Goto(from-internal,${EXTEN},1)
exten => 911,1,Goto(from-internal,${EXTEN},1)
exten => h,1,Hangup

What I thought was that “exten => _.,n,Gotoif($[${PIN}=${VALIDPIN}]?carryon)” sent the call after a successful PIN entry to “exten => _.,n(carryon),NoOp(${DB_DELETE(AMPUSER/${CALLERID(num)}/locked)})”. And it does, so I tried to do

[extension-lock]
exten => _.,1,NoOp(AMPUSER/${CALLERID(num)}/locked)
exten => _.,n,Gotoif($[${DB_EXISTS(AMPUSER/${CALLERID(num)}/locked)}=0]?carryon)
exten => _.,n,Set(PINCOUNT=0)
exten => _.,n,Set(VALIDPIN=23646)
exten => _.,n(readpin),Read(PIN,custom/ExtenLocked,)
exten => _.,n,Gotoif($[${PIN}=${VALIDPIN}]?unlocked)
exten => _.,n,Gotoif($[${PIN}=${DB(AMPUSER/${CALLERID(num)}/locked)}]?carryon)
exten => _.,n,Set(PINCOUNT=$[${PINCOUNT}+1])
exten => _.,n,Playback(vm-incorrect)
exten => _.,n,GotoIf($[${PINCOUNT}>3]?h)
exten => _.,n,Wait(1)
exten => _.,n,Goto(readpin)
exten => _.,n(unlocked),Playback(custom/ExtenUnlocked)
exten => _.,n(unlocked),NoOp(${DB_DELETE(AMPUSER/${CALLERID(num)}/locked)})
exten => _.,n(carryon),NoOp(${DB_DELETE(AMPUSER/${CALLERID(num)}/locked)})
exten => _.,n,Goto(from-internal,${EXTEN},1)
exten => 911,1,Goto(from-internal,${EXTEN},1)
exten => h,1,Hangup

But it skips the sound file and goes to “carryon”.
What do I need to do? I saw that wnpaul got it to work in his post above. What did you do, wnpaul, to get the sound file to play after a successful unlock?