It's free software day again at Nerd Vittles, and today we're updating our Telephone Reminder System for Asterisk@Home 2.5. The system lets you schedule reminders for future events and, when the appointed date and time arrives, Asterisk® will swing into action and place a call to the number you designate to deliver your customized reminder message. Asterisk@Home is bundled with a wakeup call system which lets you schedule one wakeup call per extension for any time during the next 24 hours. It's a great product. However, after using a terrific, web-based email reminder system in the Linux and Mac worlds, we wanted something a bit more flexible and robust for Asterisk that would really show off the platform. The original version of this software got broken with Asterisk@Home 2.4 and later so today we're going to fix it. If you're still running an older version of Asterisk@Home, use our original tutorial and software.

[NOTE: This application has been updated. For the latest article, click here.]

The smarts for this system already have been incorporated into our new TeleYapper 2.5 Voice Messaging System. But that's a real-time system meaning it begins calling immediately after you choose a group of people to call. This system is different in that you can schedule the calls for the near or distant future, you can specify different numbers for the calls, and you can customize the recorded message for each call. In short, it's perfect for appointment reminders, birthday reminders, anniversary reminders, and anything else you want to remember. All it takes is a phone call to set up each reminder. There's no web page to fill in and no database required to manage the reminders. You can schedule as many reminders per phone number as your little fingers care to dial! And did we mention? It's still FREE! Some of your fellow readers chipped in to pay for the Allison IVR prompts so those are included at no cost as well.

Prerequisites. We've tested version 2.5 of Telephone Reminders with an ISO-installed version of Asterisk@Home 2.5 only. If you wish to use it with some other version of Asterisk@Home or with a "pure Asterisk" system, then you're on your own. It won't work with version 1.x of Asterisk@Home, but it'll probably be fine with subsequent releases. Let us know by posting a comment. And the software to schedule reminders is no longer dependent upon the wakeup call system which ships with Asterisk@Home. You should be able to install this project and get everything working in about 30 minutes.


How It Works. The reminder system is actually quite simple to use. You dial extension 1-2-3 on your Asterisk system, enter your password, and then you'll be prompted to record a reminder message. Next you enter the phone number, date, and time for delivery of the reminder message. When the appointed date and time arrives, Asterisk will place the call to the number you specified using your default dialing rules and will play the customized reminder when the call is answered. If the call is not answered, the call will be repeated n number of times with a delay between calls of x minutes before giving up on the call. You'll get an email with the call reminder setup if desired. You also get to configure the number of retries and the delay between calls.

Finally, a word about failed calls. Reminders are important to most folks, or you wouldn't be scheduling them. So failed calls are problematic. On the one hand, you don't want to overburden your phone system placing thousands of reminder calls just because the calls continue to fail. You may have entered an incorrect phone number, for example. So our middle-of-the-road solution to failed calls is this. You can tell the system how many times to repeat the call and how much time to eat up between attempts. If the call still fails, the reminder will be deleted from the system. But the reminder message is preserved. If you look in /var/lib/asterisk/sounds/custom on your system, you will see some custom sound files (such as the reminder prompts which all begin with reminder). In addition, you will see the actual reminder messages for each of your reminders. The naming convention is HourMinute.Date.PhoneNumber.gsm. If you see entries in this directory with dates before today's date, those are failed call reminders. You can play the sound files on most computers by simply double-clicking on the files. You can delete old reminders while logged in as root on your Asterisk system with a command like this:

rm -f /var/lib/asterisk/sounds/custom/*.20060123.*.gsm

Just be sure you don't delete today's reminder messages or messages with a future date, or your entire reminder system will be up in smoke!


Here are the components that make up the complete system:

  • AutoAttendant Contexts to Create Reminder
  • Code Snippet to Answer 1-2-3 Calls
  • Allison Voice Prompts for the Reminder IVR Interface
  • checkdate.php AGI script to Check for Dates in the Past
  • checktime.php AGI script to Check for Times in the Past
  • reminder.php AGI script to Schedule Calls
  • Reminder Call Processing Contexts
  • run_reminders script to Check for Reminders
  • Limitations. There are a few limitations you need to be aware of. First, you can't schedule delivery of a reminder within the first 5 minutes after midnight each night. That's when the reminder system does its housekeeping. Second, you must schedule reminders at least 5 minutes after you place your call to set up the reminder. This gives the system ample time to generate the configuration files it needs and to put them in the right places. Third, the current reminder system does not fully support simultaneous scheduling of multiple reminders. The current system uses unique names to identify sound files generated by multiple simultaneous callers. However, it still is theoretically possible for two different callers to schedule two reminders for the same phone number and the same reminder time and to do so at the exact same time. This would cause one of the reminders to be discarded. We just wanted to alert you to this remote possibility. But we hasten to add that the chance of this happening is pretty small even in a very large Asterisk system with hundreds of users. There's also no present ability to link to a database for scheduling reminders. Nor can you schedule recurring reminders for events such as birthdays and anniversaries. But we'll get to some of these features one day soon.

    License. This software is licensed for your use under a Creative Commons Attribution-ShareAlike 2.5 license. Before using this software, please read the terms of the license. A Plain English version of the license is available here. You may not charge a fee for something we are giving you for free. Finally, we ask that you preserve our copyright notice in any copies of the software you make. The same applies to derivative works. If you do not accept the terms of the license, do not use the software. Even if you accept the terms of the license, keep in mind that BY USING THIS SOFTWARE, YOU ASSUME ALL RISKS OF USE AND NO WARRANTIES EXPRESS OR IMPLIED ARE PROVIDED WITH THIS FREE SOFTWARE INCLUDING FITNESS FOR A PARTICULAR USE AND MERCHANTABILITY. In short, it's up to you to determine, at your own risk, whether this software meets your needs. Don't assume that it will, and don't assume that the code is error-free. It's probably not.


    The Game Plan. To get the Reminder System set up, we're first going to move all of the code into the proper places. This includes the modifications to the dialplan contexts, installation of the new Allison voice prompts, and installation of the PHP/AGI scripts. Then we'll walk you through configuring the system. And finally we'll schedule a reminder to make sure everything went according to plan.

    Modifying Your Dialplan. Step #1 is to cut-and-paste some code into your dialplan. Paste this 2.5 code update to the bottom of the extensions_custom.conf file in the /etc/asterisk directory on your system.

    For Step #2, cut-and-paste the following code snippet into the top section of extensions_custom.conf in the [from-internal-custom] context:

    exten => 123,1,Answer
    exten => 123,2,Wait(1)
    exten => 123,3,Authenticate(12345678)
    exten => 123,4,Goto(reminder,s,1)

    If, for some reason, you already are using extension 1-2-3 on your Asterisk system for some other purpose, then simply adjust the 123 extension in the four lines above to another number that works on your system. This is the number you will dial to schedule reminders. Line 3 is important as well. This is where you set a password for scheduling reminders on your system. Anyone that knows the password can schedule reminders. Simply replace 12345678 with a password that's secure enough for you to sleep well.

    Finally, a head's up. When you do the cut-and-paste, double-check the long lines of code such as h,1 in [reminder9] and be sure all of the text ends up on a single line. Otherwise, things won't work correctly. Once you've added the two sections of code above, save extensions_custom.conf and reload Asterisk.

    Installing Reminder Voice Prompts. As some of you know, we mounted a campaign to raise a little dough to pay for Allison, the Voice of Asterisk, to record custom voice prompts for the original version of the reminder system. To all that contributed, thank you! Whether you contributed to the cause or not, those voice prompts are free for the taking subject to the terms of the license agreement, and they all still work for version 2.5. Just log into your Asterisk server as root and enter the following commands:

    cd /var/lib/asterisk/sounds/custom
    wget http://nerdvittles.com/reminder_voice.zip
    unzip reminder_voice.zip
    rm reminder_voice.zip
    chmod 664 reminder*.gsm
    chown asterisk:asterisk reminder*.gsm


    Installing the Reminder PHP/AGI Scripts. Now we're getting to the new code for version 2.5. While you're still logged in as root, let's install the final pieces of code that you'll need to get things working. Just execute the commands below:

    cd /var/lib/asterisk/agi-bin
    wget http://nerdvittles.com/aah2/reminder25.zip
    unzip reminder25.zip
    rm reminder25.zip
    chmod 775 reminder.php
    chown asterisk:asterisk reminder.php
    chmod 775 check*.php
    chown asterisk:asterisk check*.php
    chmod 777 run_reminders
    chown asterisk:asterisk run_reminders

    Update: For those using Asterisk@Home 2.7 and those who have applied a yum update after early April 2006 which loaded a new Linux kernel, a problem has been reported by a couple of folks indicating that the reminders fail because the time stamps don't get properly preserved when a reminder is moved to Asterisk's outgoing directory. We haven't seen the problem on our test system but, if you experience the problem with reminders not reminding when they're supposed to, use the following code instead of the above. Our special thanks to Wolf Paul for the fixes including an all-new run_reminders Perl script.

    cd /var/lib/asterisk/agi-bin
    wget http://nerdvittles.com/aah2/reminder27.zip
    unzip reminder27.zip
    rm reminder27.zip
    chmod 775 reminder.php
    chown asterisk:asterisk reminder.php
    chmod 775 check*.php
    chown asterisk:asterisk check*.php
    chmod 777 run_reminders
    chown asterisk:asterisk run_reminders

    Creating Reminders Directory. While you're still logged in as root, create the directory to store your reminders until the day arrives to execute them. Just issue the following commands:

    su asterisk
    cd /var/spool/asterisk
    mkdir reminders
    exit

    Setting Up the Reminder Crontab Entry. Now we need to set up the cron job to actually move reminders into the Asterisk call processing directory on the day they are scheduled to run. While logged in as root, edit the crontab file: nano -w /etc/crontab. Be sure you typed the exit command in the last step, or you'll be logged in as asterisk instead of root. And you won't be able to edit the file! Now cut-and-paste the following command to the very bottom of the crontab file. It should go on its own line. There is no longer an entry for wakeup calls (if you read the original tutorial).

    0 0 * * * root /var/lib/asterisk/agi-bin/run_reminders >/dev/null 2>&1

    Once you've added the line, save your changes: Ctrl-X, Y, then press Enter. Whew! That's it for the Reminder code. Now let's configure the system, and you'll be all set.


    Configuring the Reminder System. To configure the reminder system, you'll need to edit the reminder.php script while logged in as root: nano -w /var/lib/asterisk/agi-bin/reminder.php. You'll notice a section of variables at the top of the file that looks like this:

    $extensionmaxdigits=4 ;
    $debug = 1;
    $newlogeachdebug = 1;
    $emaildebuglog = 0;
    $email = "yourname@yourdomain" ;
    $trunk = "local" ;
    $callerid = "6781234567" ;
    $numcallattempts=6 ;
    $calldelaybetweenruns=300 ;
    $timetoring=40 ;
    $acctcode= "Reminder" ;

    This is the only section of code you ought to mess with. When we update the code in coming months to add features, we'll assume everything else has been left intact. Be very careful when editing this file. Don't remove any semicolons or quotation marks, or nothing will work! Here's a quick run-down on what each of the above variables does:

  • $extensionmaxdigits=4 ... Sets the maximum number of digits for treating outbound calls as calls to local extensions.
  • $debug = 1 ... If set to 1, then a debug log is created in /var/log/asterisk/reminder.txt. Instructions for deleting reminders are in the log.
  • $newlogeachdebug = 1 ... If set to 1, then a new debug log is created each time a reminder is scheduled. Otherwise, file grows and grows.
  • $emaildebuglog = 0 ... If set to 1, the debug log is emailed to the email address set below when each reminder is scheduled.
  • $email = "yourname@yourdomain" ... Enter your actual email address between the quotation marks. Only works if line above is set to 1.
  • $trunk = "local" ... If set to "local", calls are routed using your default dialplan rules. Otherwise, specify a trunk to use, e.g. "sip/telasip-gw".
  • $callerid = "6781234567" ... Specify your caller ID number. Only used if $trunk is not set to "local" above.
  • $numcallattempts=6 ... If there is no answer on the Reminder call, how many times should Asterisk attempt to deliver the reminder?
  • $calldelaybetweenruns=300 ... How many seconds delay should there be between failed call attempts to deliver a reminder?
  • $timetoring=40 ... How many seconds should the call ring when attempting to deliver a reminder?
  • $acctcode= "Reminder" ... What accouting code should be used for reminder calls?
  • Once you've configured the Reminder System to meet your needs, save your changes: Ctrl-X, Y, then press Enter. HINT: You may want to start with the defaults which will work well for most folks.


    Scheduling A Reminder. We're ready to take the Reminder System for a trial run at this juncture. Make sure you've reloaded your Asterisk system, and then dial 123 from an extension on your system. Enter the password you set up for your system and then press the pound key.

    Entering a Reminder Message. You'll first be prompted to record a reminder message. This is the message that will be played when someone answers the reminder call. If you're not scheduling this reminder for yourself, then the message ought to explain who's calling and what the purpose of the call is. Once you've recorded your message, press the pound key to end the recording. You can replay or rerecord the reminder if desired while you're in this step of the reminder creation process.

    Entering the Callback Number. When prompted for the reminder callback number, there are a couple of things to keep in mind. First, if you've specified "local" as the trunk to use for reminders in the reminder.php script, then the phone numbers can be entered in any format supported by your dialplan. Press the pound key after entering the appropriate number. The calls will be placed using the trunks specified in your dialplan rules. The one exception is extensions on your local Asterisk system since these can't be routed by Asterisk@Home using your outbound calls dialplan rules. The way we handle extensions is by examining the length of the phone number. At the top of reminder.php, you can specify the maximum number of digits for local extensions by setting $extensionmaxdigits. So long as the callback number is less than or equal to this number of digits, the system has the smarts to correctly route the call to a local extension.

    If you have designated a particular trunk for placement of reminder calls, then you'll need to make certain that the format of the phone numbers entered for reminders on your system matches a dial string supported for this outbound trunk in your dialplan. For example, if this trunk requires that calls be entered with a 1 and then an area code and 7-digit number, then that is the only format that should be used for entering callback numbers in your reminder system. Again, the one exception is calls to local extensions. So long as the number of a local extension is entered with less than or equal the number of digits set for the $extensionmaxdigits variable in reminder.php, the call will be routed properly to the local extension regardless of the trunk setting.

    Finally, here's a shortcut that can be used if the phone you're using to schedule the reminder is the same one on which you want to get the reminder callback. In this case, just press the pound key when prompted for the number to which to deliver the reminder message. This will set the callback number as the caller ID of the phone you used to schedule the call. If it's a local extension, then the caller ID will be set to the local extension number of the phone from which you placed the reminder scheduling call. Just be sure your $extensionmaxdigits is set correctly or calls to local extensions will fail.

    Entering the Date of the Reminder. Once you accept the reminder message, you'll be prompted to enter the date on which this reminder will be delivered. Dates are entered using a four-digit year, then a two-digit month, and then a two-digit day using the time zone of the Asterisk system running the Telephone Reminders System. There is some error correction but not much. You obviously can't schedule reminders in the past! And you don't need to press the pound key after entering the eight digits. An enhancement in version 2.5 is that you now can press the pound key (#) instead of entering an 8-digit date, and the system will set the reminder date to today. Once you've entered a date, the system will tell you what date you entered including the day of the week. If the entry is correct, just press 1 to move on.

    Entering the Time of the Reminder. Now you'll be prompted to enter the delivery time for your reminder. Times are entered as a two-digit hour and two-digit minute using the time zone of the Asterisk system running the Telephone Reminders System. For times less than 1200, you will be prompted whether you meant AM or PM. For those that understand military time, you can avoid this step by entering times using the format: 1345 which means 1:45 p.m. You don't need to press the pound key after entering the four-digit time for delivery of your reminder. Keep in mind that you cannot schedule a reminder for delivery in the first five minutes after midnight. Other times "in the midnight hour" should be entered in the format: 0045 which means 12:45 a.m. Keep in mind that reminder times always must be at least 5 minutes in the future. Finally, you cannot schedule two reminders for the exact same date and time for delivery to the same phone number. Once you enter a delivery time, the system will play back both the date and time for the reminder as a precaution. Press 1 to accept your entries and store the reminder to disk.


    Where Reminders Are Stored. There are actually two files that make up each reminder: the .call file which places the actual call and the .gsm file which is the reminder message itself. The file naming convention is HourMinute.Date.PhoneNumber with either a .call or .gsm extension. The sound files are all stored in /var/lib/asterisk/sounds/custom. Prior to the delivery date of the reminder message, the .call file is stored in /var/spool/asterisk/reminders. Then, at midnight on the date the reminder is scheduled for delivery, the run_reminders script in /var/lib/asterisk/agi-bin moves the affected .call files to /var/spool/asterisk/outgoing. The .call files in the outgoing directory are reviewed every minute of the day by Asterisk. By examining the time stamp of the file, Asterisk looks for a match with the current hour and minute of the day. Once the time for the call arrives, Asterisk processes the .call script and places the call. All dialing retries are handled internally by Asterisk with no user or program control so it's important to set your default values correctly in the reminder.php script as explained above. Once the .call file is processed, Asterisk discards the file whether the call was successful or not. As noted above, the reminder message file is only discarded if the call is completed successfully. So, from time to time, you do need to review the contents of /var/lib/asterisk/sounds/custom and discard reminder messages, if any, with dates in the past. Note also that, if you begin scheduling a reminder and change your mind and hang up after recording a reminder message, that message will still exist in /var/lib/asterisk/sounds/custom.

    Finally, a word of caution about the reminder message files: be very careful in deleting these files. The message files and .call files are linked by filename only, and there is no error detection or correction if the message file gets discarded before the time for the reminder call arrives. What would happen in such a situation is the call would be placed, someone would answer, Allison would say "please hold for an important reminder," and then there would be a brief silence followed by Allison saying "to repeat this reminder, press 1; otherwise, press 2" which is not entirely helpful.

    Reminder and Wakeup Call Processing. It has been documented that flooding Asterisk with a bunch of .call scripts simultaneously can cause some of the scripts to be discarded without being executed. We hope this has been resolved in Asterisk 1.2.4, but just be alert to the possibility of a problem if multiple calls are scheduled at exactly the same time to different numbers.

    When you're first getting started with the reminder system, it's probably a good idea to fire up Asterisk's Command Line Interface (CLI): asterisk -r. Then you can watch as the reminders are scheduled and reminder calls are placed. Just schedule a reminder for five minutes from the time you begin the reminder call, and you'll be all set to give it a whirl.

    For Programmers Only. If you're just getting into PHP and AGI programming with Asterisk, then have a second look at reminder.php. In particular, take a look at the section of code that begins with parse agi headers into array. As best we can tell, our initial tutorial on Telephone Reminders was the first version of this subroutine written in PHP that actually worked. We've tried to repeat our success here. If you review the log file (reminder.txt), you will see a listing of all the AGI headers which are passed by Asterisk to PHP. But this is the first code we've seen that correctly reads the headers into variables where you can actually retrieve the content. We call it a feature. For example, the commented out line ($tmp = $agi['dnid']) shows the syntax to retrieve the DNID value from Asterisk. Just make a mental note that the parse AGI headers code in reminder.php actually works. Some of our previous code inherited the mistakes of others, but we've now taken the time to get this functioning properly because we needed it for something else. Here's the complete list of AGI headers that can be saved to variables in your PHP code should the need ever arise:

    read: agi_request: reminder.php
    read: agi_channel: SIP/204-6a1a
    read: agi_language: en
    read: agi_type: SIP
    read: agi_uniqueid: 1138010325.1367
    read: agi_callerid: "Line2" <204>
    read: agi_dnid: 123
    read: agi_rdnis: unknown
    read: agi_context: reminder9
    read: agi_extension: h
    read: agi_priority: 2
    read: agi_enhanced: 0.0
    read: agi_accountcode:

    You'll also want to take note of a little quirk in Asterisk (compared to some PBXs). To decipher the extension which actually placed a call, you must parse the agi_channel variable for the data between the slash and hyphen characters since the DNID (dialed number identifier) returns the extension being called (as opposed to the originating extension) when an internal call is placed. Here's one PHP approach to get the answer which in this case happens to be extension 204. Regex wizards could probably save a line of code, but who cares.

    $CallingID = substr(stristr($agi['channel'],"/"),1);
    $CallingID = substr($CallingID,0,strrpos($CallingID,"-"));

    Finally, it appears that Asterisk's outgoing call queue now relies exclusively on the timestamp of files in the directory to determine when to execute each call. In short, Asterisk no longer uses the name of a file to determine when to execute it. Great idea! That, in turn, means that our reliance on a separate folder for reminders on future dates may no longer be necessary. We haven't finished testing this and wanted to get a working application back in circulation for those that were already using version 1 when AAH 2.5 was released. As soon as we can document that this new functionality is 100% reliable, we will revise the code a bit and eliminate the necessity of using a separate cron job and directory to move files around each day. That also will eliminate the slight delay at midnight which is referenced in the existing tutorial.

    Web Interface to Telephone Reminders. We've built a very simple web page that will let you review which reminders are pending on your system. Once installed with the newly enhanced Asterisk@Home Menu System (see below), it can be accessed by going to the IP address of your Asterisk system with a web browser and then choosing the Telephone Reminders button. Or you can access it directly at http://192.168.0.111/reminders/ using the IP address of your Asterisk system. To install the Telephone Reminders web interface, log into your Asterisk system as root and then issue the following commands:

    cd /var/www/html
    mkdir reminders
    cd reminders
    wget http://nerdvittles.com/aah2/webreminder.zip
    unzip webreminder.zip
    rm webreminder.zip

    Be advised that we are just getting started with a web interface to the Telephone Reminders application. Stay tuned for loads of additional features!

    AAH Web Facelift. Last, but not least, the folks at KennonSoft have posted an update to the AAH web interface (see inset). If you like it, here's how to install it. While still logged into your server as root, issue the following commands:

    cd /var/www/html
    wget http://www.kennonsoft.com/community/admin-ui.tar
    wget http://nerdvittles.com/wp-images/asteridex.png
    wget http://nerdvittles.com/wp-images/asterimind.png
    tar -xvf admin-ui.tar
    rm -f admin-ui.tar
    wget http://nerdvittles.com/aah2/index.zip
    unzip index.zip
    rm -f index.zip

    NOTE: It's been reported that there is a display formatting bug with IE 6. Lines 2, 3, 4, and 7 of the code above should all begin with wget. Also be advised that the last three lines of code above get you the third column of icons to support our AsteriDex and Telephone Reminder applications. If you don't want to use these applications, just don't execute the last 3 lines of code above.

    If you'd like to use our AsteriDex RoboDialer, install it from the link in this sentence and the icon will get you there. If you've moved your AsteriDex application to a directory different than asteridex, make the necessary adjustment in the index.html file.

    Security Reminder. If you plan to open the Asterisk web interface on your system to the public Internet, make sure to take security precautions to reduce the risk of a stranger trashing your system or running up your phone bill. Just click here and search for our articles on security to get your system up to speed.

    Wish List? Well, that about covers version 2.5 of our shiny new Reminder System for Asterisk. We have some other bells and whistles we'll be adding over the next few days and weeks so check the bottom of this article from time to time for a New Enhancements section. For example, we plan to add a feature that will let you schedule dates by simply entering the number of days from today and pressing pound. And we want to do something similar for times so that you can enter something like 90# to schedule a reminder for a time slot 90 minutes from now. If you have other enhancement suggestions and recommendations for version 3, we'd love to hear from you. Just post a comment to this topic, and we'll have a look. In the meantime, enjoy!

    Want More Projects? For a complete catalog of all our previous Asterisk projects, click here. For the most recent articles, click here and just scroll down the page. Get your Headline News the easy way: Planet Asterisk, Planet Gadget, Planet Mac, and Planet Daily. Quick read, no fluff.

    Got a PDA or Web-Enabled Smartphone? Check out our new PDAweather.org site and get the latest weather updates and forecasts from the National Weather Service perfectly formatted for quick download and display on your favorite web-enabled PDA, cellphone, or Internet Tablet. And, of course, it's FREE!

    Hot Tip! O'Reilly's must-have book, Asterisk: The Future of Telephony, is still available for free download here under a Creative Commons license. This is a cleaned up version of the original PDF which fixes pagination and compresses the file size to 3.9MB using Acrobat's Reduce File Size tool. Requires at least Acrobat 4 to load. Special thanks to Alexander Burke for all the hard work cleaning this up.

    New Enhancements. Assuming you have email messaging working on your Asterisk system, Telephone Reminders now has the ability to deliver an email copy of reminders to the recipient in addition to a phone call. Be advised that, if the phone call is never completed, the email copy of the reminder will not be delivered. The reason for this is because Asterisk never passes the call to the context which handles delivery of the email message until the call is connected. So ... no connection, no email. However, if the recipient has an answering machine or voice mail, that would trigger delivery of the email message. If you can live with this shortcoming at least for the time being, here's how to activate delivery of email reminders. First, if you downloaded the Telephone Reminders contexts for extensions_custom.conf before 5 p.m. on Thursday, February 23, do it again from here. Then cut-and-replace only the last two contexts with the matching contexts at the bottom of your extensions_custom.conf file: [remindem] and [remindem2]. Save your changes and reload Asterisk.

    Once you've installed the new contexts to support email messaging, step two is registering email addresses for extensions and phone numbers to which you want email reminders delivered. Log in to your Asterisk server as root, and start up the Command Line Interface (CLI): asterisk -r. For each extension and phone number for which you want to activate email reminders, enter a command at the CLI prompt that looks like this: database put EMAIL 6781234567 joe@schmo.com where 6781234567 is the phone number of the reminder recipient and joe@schmo.com is the recipient's email address. You can display all existing EMAIL addresses that have been entered into your Asterisk database with this command: database show EMAIL. If you need to modify an existing entry, simply delete it and reenter it. To delete an existing entry, use the following syntax: database del EMAIL 6781234567.

    Be Sociable, Share!

    This article has 11 comments

    1. Awesome, I’ve been waiting like a 4 year old for Christmas morning, and Christmas has finally come. I followed the directions, and it works flawlessly. Made a few test calls, and whammo, right on time delivery. Thanks Uncle Ward. Again, excellent work!!!

      (PS The AMP facelift was great too, thanks for including that in here, looks very nice now)

    2. Asterisk@Home 2.6 has been released. Is that another soup-to-nuts I smell?

    3. Hi Ward,

      Thanks for the wonderful work. As part of the wish list, would it be possible to add 1 more field in Asteridex (ie email address) and use these emails to send reminders. At least, by then Asterisk admin can maintain only 1 database.

      Again, thank you.

    4. I installed reminder 2.5 on A@H2.7 and it works up to the password prompt and then it just sounds a busy signal. Has anyone installed it successfuly on 2.7. Thanks.

      BTW this site ROCKS!!!!!!

      [WM: Thanks. Just tried it on our system, and it worked fine. If you moved it from a previous version, did you remember to recreate the /var/spool/asterisk/reminders directory? Run CLI and then agi debug and see what it says when you attempt to schedule a reminder. Then post the results in another comment. ]

    5. An update to this article has been posted which addresses a problem with time stamps in the original code that appears to have arisen since the latest Linux kernel was released. This applies to anyone using Asterisk@Home 2.7 and those who have applied a yum update after early April, 2006.

    6. Are there any plans to create a web interface to add reminders? I would not mind one that simply used festival on a text message at a given appointment.

      [WM: There is an open source web-based reminder app floating around, but it would make sense to add it to ours so I’ll put it on the Wish List. Thanks.]

    7. This works almost straight out the box on Trixbox 1.1.1. The only changes I made were:
      Used the 2.7 version, not 2.5
      Installed the web interface. I changed line 40 of /var/www/html/reminders/index.php to read
      if (preg_match("/[0-9]*\.[0-9]+\..*\.[a-z]+/",$entry)) {

      I did this so that the other files that I record in their don’t get displayed as well. This regular expression seems to match only the sound files that are part of the reminder system.

    8. Hey Ward, any plans to update this app to Trixbox? Also I found this app and though it would be a nice touch… http://rminder.com

      [WM: Just add a Misc Destinations for Reminders with the extension 123, and everything works as is. In fact, it’s part of the VMware version available for download from Nerd Vittles. The site you referenced looks interesting. I’ll see what I can do.]

    9. One more thing, I’m using a SPA3102 as an FXO to dial out through the PSTN. I’ve defined number starting with 123 to be dialed out via the PSTN trunk. When I punch in 1230101234567 (my cellphone) as a reminder number..m at the reminder time, the reminder kicks in…my cellphone rings, but when I pick up, the reminder message is alreadt played, and is being repeared the 2nd time…. if I let the phone ring a few times, I guess I would completley mis the message. How can I make sure the message is not played back UNTIL the cellphone is picked up?. My setup is described here : http://rizsher.tripod.com/trixbox/main.htm

      Thanks.

    10. Two more issues, I’ve setup email address for the extensions using database put email. When a reminder is picked up, the following lines appear in Asterisk CLI:

      77,1″, "email=EMAIL/100″) in new stack
      — DBget: varname=email, family=EMAIL, key=100
      — DBget: set variable email to myemail@gmail.com
      — Executing GotoIf("Local/100@from-internal-1e77,1″, "0?4″) in new stack
      — Executing System("Local/100@from-internal-1e77,1″, "mime-construct –to myemail@gmail.com –subject "Telephone Reminder" –attachment /var/lib/asterisk/sounds/reminders/1354.20061013.100.gsm –type audio/gsm –file 1354.20061013.100.gsm –multipart multipart/mixed –string "An important reminder is attached to this message."") in

      However, no email is received on my gmail account. I know email is working as voicemails left on extension 100 get forwarded to the gmail account as attachments w/o a problem.

      Secondly, if the reminder call is not picked up quick enough, it gets picked up by one of my IVRs, and obviosuly, the phone stops ringing then. I had a similar problem with *62 reminder. The fix by fluke for that is described here: http://www.trixbox.org/modules/newbb/viewtopic.php?topic_id=3610&forum=2#forumpost14600 , can something similar be done such that reminder calls are not intercepted by the IVRs?.

    11. Has this wonderful app been updated for trixbox 2 ?

      [WM: Not yet.]