Tap here to compare the top VoIP providersTap here to hide the top VoIP Providers
Asterisk tips Wake-Up Call PHP
Set a Wake Up callFeatures:
- Schedule or delete a single wake-up call
- No means to edit an entry
- No CRON job or daemon needed, scheduling works by .call file timestamp
Ubuntu 13.10 - After upgrading to Ubuntu 13.10 wakeup calls stopped working, they ended up being created for 20 hours into the future... The fix was to set the timezone in /etc/php5/cli/php.in
Updated 2008-Nov-23 Andy Wysocki awysocki -at- absoftware dot_here com
- WakeUp Call program set the time up to 23:59 minutes in the future
- Lots of error checking to make sure its done correctly
- Some fun prompts if the user pressed the wrong DTMFs
- allow DTMF'ing over the prompts, to speed up the process
- Allow for # key option when entering time. ie: 700# or 0700 both now work
- Tested with Asterisk 220.127.116.11
- Some of the FXO FXS devices use *77 to block the last caller ID so you may need to change the example extension number
- Option to prompt for AM/PM all the time or Military time and not prompt, or the mixed mode.
- Operator mode. List the extensions that can act as a wake up operator to set wake up's for other extensions
- Changed the call to AGI(wakeup.php) from the agi,wakeup.php
NOTE: It was suggested that the TOUCH and MOVE command in the PHP script be swapped. So the move is done first then the touch. This might work some of the time but there is a chance that Asterisk will pick up the CALL FILE before the touch command can be run on it. The betst way to do is to have the TMP directory be on the same physical drive as the Asterisk OUTGOING directory. This way when the move command is run it just moves the pointer and the file date and time stay the same. If the tmp directory is on a different physical drive then the file is copied and the date and time stamp are updated, asterisk could grab the file before touch is called.
I made a tar file http://qod.com/wakeup.2.0.tar
Ver 2.0 ->
Go Back to: Asterisk tips and tricks - Asterisk AGI
Here is the README from the TAR file:
2008/06/25 - Version 2.0
This code was tested with ASTERISK Rel 1.4.11
1 - Copy the wakeup.php file into
make sure the PHP file is executable. You might have to run DOS2UNIX against it since I'm lazy and use my windows editor on it
2 - Next update your extensions file to include an extension to call to schedule your wakeup calls.
exten => 77,1,AGI(wakeup.php)
exten => 77,n,Hangup
3 - Reload your extensions table in asterisk with "dialplan reload" or stop and start asterisk.
When you call into Extension 77 you should be prompted for all your wakeup call time. This program uses the standard and additional sound files. So nothing else should be needed.
If you want your wakeup calls to annoy you where you can not go back to sleep until you answer a match question. Jon Radon gave me this PERL script you can use to have it quiz you with a match question to make sure you are awake.
Just uncomment the parm_application and parm_data lines for wakeconfirm.agi
Make sure you have the AGI.pm file loaded. I got a copy from http://asterisk.gnuinter.net/
2.0 - Jun 25, 2008
Added in an operator mode. So one or many extensions can create wakeup calls for other
extensions. See the $parm_operator_mode variables in the PHP file
1.31 - Feb 21, 2008
Fixed a bug where if using the $parm_short_entry set on. Depending on where you key the values in, if after the
last prompt or break though the prompts, and the input would time out, the code worked differenty. After the
prompts the input would be considered valid, if during the prompts, the input would be considered invalid.
Now on any timeout, the input is considered invalid.
1.30 - Nov 5, 2007
Added new option to allow input time current way, Military, or always prompt. See the $parm_prompt_ampm=0,
0 current method, if after 13:00 won't prompt for am/pm (mixed mode)
1 military time never prompt for am/pm (mil mode)
2 always prompt for am/pm and only accept to 1259 for time (am/pm mode)
1.21 - Nov 1, 2007
- Changed the split channel again, this will now allow for IAX2 type channels
- Changed the way the channel name is split, now will correctly split a SIP name if you have other than numbers in the name
- Added an option to allow for entry of 3 digit times. So you can enter 700# to mean 7:00 instead of having to enter 0700
If you have questions or find bugs, let me know
awysocki (a) absoftware dot .com
I've removed the code, it was just too much work to format it for the wiki pages, Just download the TAR file and reference it.
"Q1 - I call in and don't hear anything"
A1 - There can be lots of issues here, Check that the PHP script in the cgi-bin directory has the execute bit on. check that the php file is formatted for unix. (use dos2unix command) check that you have both the standard and extra sound files installed, and last, turn on the parm_debug option and look at the log file created by the PHP file. It should help you out, if its not created then check with Asterisk as to why it may not be calling the script
"Q2 - As soon as I enter my time, the system calls the phone back and not at the time in the future"
A2 - This most likely is because your TMP directory is on a different physical disk in the system. Make a tmp directory just above the OUTGOING directory in asterisk and use that , so when the MV command is used the date and time of the file won't be changed
"Q3 - I see the call file and everything is working, but when the time is reached Asterisk doesn't call the phone and there are errors in the Asterisk log file"
A3 - Check if you are using caller ID or Channel format. If using caller ID try setting the $parm_chan_ext = 1; in the PHP file. This will use the channel, This method one works when calling the extensions connected to this asterisk. It will not work for calling off the system like to your cell/mobile phone. This may be a feature you really want.
Any other problems e-mail me and as time permits I will help you out
Asterisk tips Weather PHP - Asterisk tips Airport Weather PHP
Asterisk tips Wake-Up Call PHP with Snooze/Annoy
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+