Simple Hotel Style Wake-Up Calls

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
Simple Hotel Style Wake-Up Calls
(This work is based on this thread: http://trixbox.org/forums/trixbox-forums/open-discussion/wake-calls-trixbox-ce-how-five-easy-steps) (Updated 12/19/08. The attached scripts have changed. ) These steps and attached scripts should work for any FreePBX based Asterisk installation. (Callback is dependent upon the presence of context: from-internal)

For quite a while, I have been hoping to make the simple, hotel style wake-up function, well, functional again. (Nerd Vittles Voice Reminders is a great application - but it serves a different purpose.)

This procedure will provide the "hotel style" wakeup calls, and will even support "snooze" functions. An “operator” mode is available which allows specific phones to set wake up calls for any extension.

This approach differs from the TrixThread in that only one Dial Plan Fragment is used, instead of two. This version also better uses the FreePBX extension registry, and is easier to change to respond to a phone number other than *62. I have made changes to the attached scripts – thus they are not the same as those on the TrixThread. These should be "drop and run" ready for you when used with the steps outlined below.

Step One:
Create a custom destination.
Custom Destination: custom-wakeup-calls,s,1
Description: Wake Up Calls

Step Two:
Then create a misc application
Description:Wake Up Calls
Feature Code:*62,
Feature Status: Enabled
Destination: Custom Destinations: Wake Up Calls

(You can use any feature code you like here – we use *62.)

Step Three:
Add the following new context, in
extensions_override_freepbx.conf

[custom-wakeup-calls]
exten => s,1,Answer
exten => s,2,AGI(wakeup.php)
exten => s,3,Hangup


Step Four:
Next, get the files attached to this article and copy them to /var/lib/asterisk/agi-bin


The PHP files should already be executable if not then, and change ownership to asterisk:asterisk.
cd /var/lib/asterisk/agi-bin
chown asterisk:asterisk wake*
chmod +x wakeup.php
chmod +x wakeconfirm.php
amportal restart

Everything should be running now.
Some folks have had troubles at this point - when they dial *62, they here nothing and nothing happens. Sometimes then they get hung up on. Should this happen to you, try running update-fixes.

Here are some notes about some settings inside /var/lib/asterisk/agi-bin

// Operator Mode, Allow an extension to key in wakeup calls for other extensions
$parm_operator_mode = 1;

// Operator Extension
// Enter any extension that is allowed to enter in operator mode - Caller ID is used to validate
$parm_operator_extensions= array( 0, 15 );

// The max length of an extension when entering by operator
$parm_operator_ext_len = 4;

If you want to change the script so it can run from another number than *62, its easy. In Step 2, Above, enter whatever extension or star code you wish to use in place of *62.

Then edit /var/lib/asterisk/agi-bin/wake.inc:
// Caller ID of who the wakeup call is from Change this to the extension [FONT=&quot] $parm_wakeupcallerid = '"Wake Up Call" <*62>';

I'd like to know how this works for anyone who tries it out.

Next Steps? I would like to learn how to turn this into a module for FreePBX. Some time ago, before getting this version working, I tried using some of the ones that are in the FreePBX user repository - MISTAKE - they reacted poorly with my system. If anyone reading this understand module creation - I'd like to hear from you. :D

Do you have all this working now and want to go the next step? Check Outside the Box Wake Up calls.

[/FONT]
 

Attachments

  • wakeup3.zip
    10.6 KB · Views: 104

dad311

Guru
Joined
Jan 13, 2008
Messages
604
Reaction score
2
Not getting much joy here. When I dial *62, I just get a disconnect, nothing else.

Also is there a typo in the instructions? Why is the Custom Applications: wake-up-calls,s,1 but the context is wake-up-call,s,1 (calls vs call)?

-- Executing [*62@from-internal:1] Answer("SIP/202-083a5000", "") in new stack
-- Executing [*62@from-internal:2] AGI("SIP/202-083a5000", "wakeup.php") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/wakeup.php
-- AGI Script wakeup.php completed, returning 0
-- Executing [*62@from-internal:3] Hangup("SIP/202-083a5000", "") in new stack
== Spawn extension (from-internal, *62, 3) exited non-zero on 'SIP/202-083a5000'
-- Executing [h@from-internal:1] Macro("SIP/202-083a5000", "hangupcall") in new stack
-- Executing [s@macro-hangupcall:1] ResetCDR("SIP/202-083a5000", "w") in new stack
-- Executing [s@macro-hangupcall:2] NoCDR("SIP/202-083a5000", "") in new stack
-- Executing [s@macro-hangupcall:3] GotoIf("SIP/202-083a5000", "1?skiprg") in new stack
-- Goto (macro-hangupcall,s,6)
-- Executing [s@macro-hangupcall:6] GotoIf("SIP/202-083a5000", "1?skipblkvm") in new stack
-- Goto (macro-hangupcall,s,9)
-- Executing [s@macro-hangupcall:9] GotoIf("SIP/202-083a5000", "1?theend") in new stack
-- Goto (macro-hangupcall,s,11)
-- Executing [s@macro-hangupcall:11] Hangup("SIP/202-083a5000", "") in new stack
== Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/202-083a5000' in macro 'hangupcall'
 

dad311

Guru
Joined
Jan 13, 2008
Messages
604
Reaction score
2
Success, however I had to use the wake.php and wakeconfirm.php from the Trixbox forum link.
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
More Info?

Success, however I had to use the wake.php and wakeconfirm.php from the Trixbox forum link.

Did any one else experience trouble with the .php files from my first post in this thread?

Can you describe the nature of the problem you had with them?
 

RizSher

Guru
Joined
Oct 18, 2007
Messages
146
Reaction score
7
Works perfectly. Just a note, do we really need to create the Custom Destination and Misc Application as indicated in step 1 and 2?.

The fact that we put

exten => *62,1,Answer
exten => *62,2,AGI(wakeup.php)
exten => *62,3,Hangup

in extensions_custom.conf means *62 is available as a valid extension number to be dialled anyway. I followed the instructions as detailed by tshift, got the wakeup calls working, then went and deleted the cus det and misc appl, and things work as before.
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
Custom Destination / Msic Application are to register the number (*62) so FreePBX wont let ou use it again by accident. Other than that, no you dont *have* to do those steps.
 

cjkeeme

Guru
Joined
Jun 18, 2008
Messages
203
Reaction score
0
Works perfectly! Thanks. Time to send some proposals over to all the local hotels/motels. :eurob:
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
Please review the first article in this thread - Improvements have been made. Recommended update.
 

jrglass

Guru
Joined
Oct 18, 2007
Messages
302
Reaction score
20
The new instructions worked well. How would one cancel the wakeup call if it was set wrong?

Good job,

jeff
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
Just Dial into the wakeup system again, it recognizes that you already have a call setup, and lets you delete it or update it.
 

dad311

Guru
Joined
Jan 13, 2008
Messages
604
Reaction score
2
Again, I could only get *62 to work with the script in the Trixbox link. Very strange, do you know what the differences are between the to scripts?
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
Several. A lot of the script that dealt with cutsie-pie word games (making the recipient do math to prove they were really awake) was removed, plus a change in dial out context that will prevent the TrixBox scripts from working correctly using the context as I outlined them in the steps.

I honestly cant figure out how you are making it work the way you describe. :crazy:

When you tried this new method, did you fully remove the previous attempt?
 

dad311

Guru
Joined
Jan 13, 2008
Messages
604
Reaction score
2
I was copying the wakeup2.zip file to /var/lib/asterisk/agi-bin and unzipping the file. This creates the hang-up issue.

If I manually create each file and copy/paste the info everything seems to work. :lol:


 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
A little Twist - Outside the Box

If I manually create each file and copy/paste the info everything seems to work. :lol:
Excellent! You have me wondering if its because that zip file was created with Windows instead of Centos. I'll watch and see if anyone else has that issue.

Outside The Box Wakeup Calls
If you're still with me after all this, here's another little twist for wake up calls. If you have your inbound CallerID working - the Hotel Style WakeUp Calls Feature can easily work "outside the box" - meaning its not restricted to calling inside extensions.

As sorry as it sounds -
:out: - Iv'e stayed at hotels during business travel that I'd wished I could have had a "Wakeup call by cellphone" rather than rely on the hotel WakeUp service. This works nice for us in those cases - but it should work for any phone that sends proper Caller ID information.

First – get familiar with, and get the scripts working as outlined in the first article of this thread. Then com back here, and continue on making a special Wakeup context for acess from outside lines.

Step One:
Create a custom destination.
Custom Destination: custom-wakeup-calls-pin,s,1
Description: Outside Wake Up Calls

Step Two:
Then create a misc application
Description:Outside Wake Up Calls
Feature Code:*63,
Feature Status: Enabled
Destination: Custom Destinations: Outside Wake Up Calls

(You can use any feature code you like here – we use *63.)

Step Three:
Add the following new context, in extensions_override_freepbx.conf

[custom-wakeup-calls-pin]
exten => s,1,Answer

exten => s,2,Wait(1)
exten => s,3,Authenticate(1234567)
exten => s,4,AGI(wakeup.php)
exten => s,5,Hangup


Obviously, change line s,3 1234567 to be your own complex pin.

Step Four:
Create in inbound route from any available DID, or ENUM should work also.
Set Destination: Custom Destinations: Outside Wakeup Calls

In Step 4 you could just as easily make `Outside Wakeup Calls` a choice from an IVR - stealth or not-stealth. We use a dedicated DID.


Here are some notes about some settings inside /var/lib/asterisk/agi-bin
// Operator Extension
// Enter any extension that is allowed to enter in operator mode - Caller ID is used to validate. If used WITH inside WakeUp service, then outside numbers may be mixed with extensions.
$parm_operator_extensions= array(0, 15, 5559996666, 8001234567 );


Remember, this setting is in common with the inside-Wakeup calls. If you external wakeup calls, the system will wait longer before proceeding unless the operator presses the pound key at the end of entry.

// The max length of an extension when entering by operator
$parm_operator_ext_len = 10;

Step Five:
I always do a reread config from inside the config editor., and your gonna wanna do an amportal restart for absolute sure.

Test it. Pick up any telephone that sends proper Caller ID info (This works great for me with my cell phone), and call the DID assigned to Outside Wake Up Calls.


Like always - let me know if this works for you -

Tony
 

angoyr

Guru
Joined
Apr 1, 2008
Messages
171
Reaction score
0
Success Finally.

I was having the exact same problem as dad311 for 2 days and I did what he did.
I unzipped the files to a folder on my windows machine. Deleted the ones in /var/lib/asterisk/agi-bin. I opened the wake* files in notepad and copied them to the clipboard and pasted them into new files created by webmin. I then changed the ownership to asterisk and dialed *62.

It just worked.

Thanks guys, I needed this one.

Robin.
 

rossiv

Guru
Joined
Oct 26, 2008
Messages
2,624
Reaction score
139
Problems!

I get a hang up every time. I tried update-fixes, no luck.
Code:
    -- Executing [*62@from-internal:1] NoOp("SIP/2001-088fd018", "Running miscapp 4: Wake Up Calls") in new stack
    -- Executing [*62@from-internal:2] Goto("SIP/2001-088fd018", "custom-wakeup-calls|s|1") in new stack
    -- Goto (custom-wakeup-calls,s,1)
    -- Executing [s@custom-wakeup-calls:1] Answer("SIP/2001-088fd018", "") in new stack
    -- Executing [s@custom-wakeup-calls:2] AGI("SIP/2001-088fd018", "wakeup.php") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/wakeup.php
    -- AGI Script wakeup.php completed, returning 0
    -- Executing [s@custom-wakeup-calls:3] Hangup("SIP/2001-088fd018", "") in new stack
  == Spawn extension (custom-wakeup-calls, s, 3) exited non-zero on 'SIP/2001-088fd018'
 

angoyr

Guru
Joined
Apr 1, 2008
Messages
171
Reaction score
0
rossiv,

Follow the instructions above and see if you have any success. That has worked for a few people.

Good Luck.
 

rossiv

Guru
Joined
Oct 26, 2008
Messages
2,624
Reaction score
139
How do you do that in Webmin? I have not used it before. Also changing ownership. Sorry if I am making this hard, but I am new to the commands.
 

angoyr

Guru
Joined
Apr 1, 2008
Messages
171
Reaction score
0
rossiv,

You do not have to use webmin, you can use one of the editors in Linux, like joe, vi or nano.
From any of the above, you login as root, cd /folderwithwake*files, open the editor and paste the contents from within windows. Save it then change the ownership with cd /var/lib/asterisk/agi-bin
chown asterisk:asterisk wake*
chmod +x wakeup.php
chmod +x wakeconfirm.php

I think this information is listed earlier in the thread.

To start webmin, open a browser session and go to http://yourserveraddress:9001/
This assumes you're using PIAF. If not, can't help. One of the experts will take over.

Good luck.

 

Members online

Forum statistics

Threads
25,810
Messages
167,754
Members
19,240
Latest member
nikko
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top