Posts tagged: reminders

Incredible PBX: Adding Google Calendars with Asterisk 1.8

One of the exciting new features in Asterisk 1.8 is external calendar integration including iCal, caldav, Microsoft Exchange, and ews. Hats off to Terry Wilson at Digium® for his great work on the calendaring API. Unfortunately, there hasn’t been much written about integrating the calendars into FreePBX®-based Asterisk® systems… until now. Because we’re all about free, our focus today will be Google Calendar integration, but we’ll provide you some links to get any of the other calendar types integrated into PBX in a Flash and Incredible PBX if that’s what floats your boat. In addition to being free, Google Calendar is one of the best calendaring apps on the planet. Its beauty lies in the incredible flexibility it provides for group scheduling and the sharing and transparent integration of dozens of calendars (both public and private) not to mention real-time updating with your favorite Android smartphones. Apple does much the same thing with iCal on the Mac and iPhone… for an annual fee.

The rainbow of colors you see in the left column of the screenshot above each represent a different calendar. All of the calendar entries from all of these calendars are integrated into the single calendar display on the right with a simple color scheme to identify where each calendar entry originated. As mentioned, these calendars can not only be from your friends and business associates, they also can be publicly available, read-only calendars for subject matter such as holidays, schedules of your favorite sports teams and rock bands, school calendars, etc. Take a look at iCalWorld to get a quick handle on what’s available. See also this Google resource.

The one bit of advice we would provide in setting up Google Calendar is don’t put all your eggs in one basket. Create separate calendars for different individuals and for different types of events. And don’t mix business with personal. Also keep internal business events separate from those that you might want to share with customers. Down the road, this facilitates sharing just the information of importance to different groups of friends and business associates. Bottom Line: Spend a little time thinking about organization of your calendars. It will pay off handsomely down the road.

Once you integrate Google Calendar into Incredible PBX, you can use it to alert you to upcoming appointments, to schedule and activate conference calls, and even to log the date, time, length, and recipient of all your outbound and/or incoming phone calls.

For today, we’ll get the software installed and functioning. And we’ll help you set up a simple reminder system based upon appointment entries in your Google Calendar. We’ll also give you some good reference materials so that you can experiment a bit on your own. In coming weeks, we’ll build a time slips system to keep track of all your phone calls.

Prerequisites. As mentioned, you’ll need a Gmail account as well as Asterisk 1.8 and PIAF-Purple with Incredible PBX 1.8 to follow along in today’s tutorial. All of the pieces are optional except for Asterisk 1.8 and a fairly current version of FreePBX, but we’ll leave that exercise for the pioneers. The script is licensed as GPL code so knock yourself out.

The Gotchas. Nothing is ever easy, is it? There always are a few surprises to worry about. Here’s the current short list for Asterisk Calendaring. When you schedule a meeting or appointment with Google Calendar, there is an option to set an alert to remind you of the meeting at any time you like on a per appointment basis. So, if you have a meeting 50 miles from home, you could set the alert for 90 minutes in advance while a meeting next door could be set with a 5 minute alert. All of that works fine in Google Calendar. Unfortunately, in Asterisk 1.8.4, there’s a math bug that subtracts the hour differential between your time zone and Greenwich Mean Time (GMT) from these alert times. If you happen to live in the GMT time zone, there’s no bug. However, those living on the East Coast of the U.S. will find their reminder calls arriving four hours too early. If you set an alert for 60 minutes before a scheduled meeting, Asterisk will call you 5 hours in advance. For our West Coast friends, it’s an 8 hour bug. Fortunately, the Asterisk Calendaring config file provides an option to override these alerts with a reminder call at a fixed number of minutes before each appointment. While it lacks the individual appointment flexibility to schedule alerts of different durations, it does work. So, for the time being, we’ll be using that.

Asterisk Calendar alerts also were supposed to be triggered only for events in which your Status has been set to Busy. A typical example would be a medical appointment. Instead, the alerts are generated for all calendar entries. So, if you’ve got 12 children and you’ve set all-day calendar entries to remind you of their birthdays each year, be forewarned that using your default Google Calendar will trigger a friendly reminder call at 11:50 p.m. on the night before each of your kids’ birthdays. Unless you and your spouse are both Night Owls, this might lead to some “WAF issues” if you get our drift. The workaround that we’ll implement today is to create a secondary appointments calendar and reserve it just to schedule meetings and appointments for which you wish to receive reminder calls at 10 minutes before each event. You can change the notification time to any fixed number of minutes desired. As we mentioned, one nice feature of Google Calendar is that entries on secondary calendars will automatically display on your main calendar. Just be sure to schedule the appointments on the correct calendar (we’ll show you how) if you want a reminder call.

Setting Up a Google Appointments Calendar. Before we get Asterisk configured for calendaring, let’s first set up your secondary Google appointments calendar. Log into the Gmail account that you either already use or will begin using for scheduling Calendar entries. Just click on the Calendar tab at the top of the screen and set up your default calendar if it doesn’t already exist. Once it’s set up, there will be a calendar list in the left margin under My Calendars. Just below your existing Calendar(s), there will be a Tasks entry, and below that will be an Add link to add a new calendar. Click on Add and fill in the main pieces of information as shown below. Use appointments for the name of the calendar and make sure you set the correct Time Zone for your hometown. Then save your entries by clicking the Create Calendar button.

Once you have created your new appointments calendar, we need one other piece of information to use it with Asterisk. Under My Calendars in the left margin, click on the down arrow beside appointments and choose Calendar Settings. That will bring up a form that looks like this:

The next to the last section of the form is entitled Calendar Address. You’ll see an entry to the right of the section title called Calender ID with a long alphanumeric string followed by Write down the Calendar ID or copy it to clipboard. Don’t include! You can ignore the statement that the link is inoperative unless you make your calendar public. It actually works just fine with your Google credentials which we’ll configure as part of the Asterisk setup below.

Configuring Asterisk for Google Calendar Integration. PBX in a Flash and Incredible PBX come with most of the components you’ll need to get calendaring to work. However, there are a few missing pieces at the moment. These will require that Asterisk be recompiled, and we’ve built a little script to do all of it for you. Just log into your server as root and issue the following commands:

cd /root
chmod +x

After you enter your Google credentials and Calendar ID, the script will temporarily shut down Asterisk, download the missing components for calendaring, recompile Asterisk, and customize the calendar setup with your Google credentials. Then the script will complete the setup and restart Asterisk. The whole process takes about 5 to 10 minutes.

Asterisk Calendar Configuration. Here are the pieces in the default Google Calendar config file that will be replaced with your personal settings:

type = caldav
;url =
url =
user =
secret = userpassword
refresh = 10
timeframe = 120
autoreminder = 10
channel = local/8005551212@from-internal
context = from-internal
extension = 225
waittime = 45

If you should ever need to make changes to these settings again, you’ll find the entries with your Google credentials at the end of the calendar.conf config file in /etc/asterisk. Remember to restart Asterisk after making any changes. The commented out URL entry is the one you’d use to access your main Google Calendar instead of the secondary appointments calendar we created above. If the GMT bug is ever fixed, this would be a step forward.

Extension 225 (C-A-L) is the extension that will be called to actually play back the reminder information. You’ll find this block of code at the top of extensions_custom.conf in the [from-internal-custom] context. You can make any adjustments you’d like. We simply set this up to give you a template to follow. As configured, the reminder will read you a summary, the starting time, location, and any description associated with each calendar entry. If you have a Cepstral voice in addition to Flite, just change the Flite entries to Swift. Then restart Asterisk: amportal restart.

Asterisk Calendar Test Drive. Asterisk keeps track of your scheduled events by checking your Google Calendar every 10 minutes. We recommend configuring reminders for calls 10 minutes before any scheduled event in the appointments calendar. What this means is you probably should never schedule an event expecting to get a reminder call if the event is less than about a half hour in the future. If you use a setting for the autoreminder time other than 10 minutes, this will obviously be different for you.

So let’s schedule an appointment for an hour from the current time. Click on the Calendar tab in Gmail. And then click on the down arrow beside the appointments calendar in the left column. Choose Create Event on this Calendar. You’ll get a form that looks like this. Click Save to store your new Calendar entry. Then go have a beer and wait for your call.

Where To Go From Here. We’ve just scratched the surface of what you can do with Asterisk 1.8 using Google Calendars. We recommend you now review the chapter in the new Asterisk Definitive Guide book that covers calendaring in some detail. It will give you a good handle on what’s possible. For a more technical discussion, take a look at this contribution from one of the PIAF Forum regulars. Amazing stuff! There’s also a good article in VoIP Today that’s worth a careful read. Be aware that, if you recompile Asterisk to add support for Microsoft Exchange, you probably will break the Google Calendar connection that we’ve outlined today. At least, we never have been able to get the two to coexist. If you have better luck, please post your results. The reason for the problem is that the Exchange connector depends upon neon-0.29 which is not yet part of CentOS 5.x. We’ll keep you posted on our progress. Enjoy!

Originally published: Monday, May 23, 2011

Changes in PBX in a Flash Distribution. In light of the events outlined in our recent Nerd Vittles article and the issues with Asterisk 1.8.4, the PIAF Dev Team has made some changes in our distribution methodology. As many of you know, PBX in a Flash is the only distribution that compiles Asterisk from source code during the install. This has provided us enormous flexibility to distribute new releases with the latest Asterisk code. Unfortunately, Asterisk 1.8 is still a work in progress to put it charitably. We also feel some responsibility to insulate our users from show-stopping Asterisk releases. Going forward, the plan is to reserve the PIAF-Purple default install for the most stable version of Asterisk 1.8. As of June 1, Asterisk is the new PIAF-Purple default install. Other versions of Asterisk 1.8 (newer and older) will be available through a new configuration utility which now is incorporated into the PIAF ISO.

Here’s how it works. Begin the install of a new PIAF system in the usual way by booting from your USB flash drive and pressing Enter to load the most current version of CentOS 5.6. When the CentOS install finishes, your system will reboot. Accept the license agreement, and choose the PIAF-Purple option to load the latest stable version of Asterisk 1.8. Or exit to the Linux CLI if you want a different version. Log into CentOS as root. Then issue a command like this: piafdl -p beta_1841 (loads Asterisk, piafdl -p 184 (loads Asterisk 1.8.4), piafdl -p 1833 (loads Asterisk, or piafdl -p 1832 (loads Asterisk If there should ever be an outage on one of the PBX in a Flash mirrors, you can optionally choose a different mirror for the payload download by adding piafdl -c for the .com site, piafdl -d for the .org site, or piafdl -e for the .net site. Then add the payload switch, e.g. piafdl -c -p beta_1841.

Bottom Line: If you use the piafdl utility to choose a particular version of Asterisk 1.8, you are making a conscious decision to accept the consequences of your particular choice. We would have preferred implementation of a testing methodology at Digium before distribution of new Asterisk releases; however, that doesn’t appear to be in the cards. So, as new Asterisk 1.8 releases hit the street, they will be made available through the piafdl utility until such time as our PIAF Pioneers independently establish their reliability.

Need help with Asterisk? Visit the PBX in a Flash Forum.
Or Try the New, Free PBX in a Flash Conference Bridge. If you’re wondering what your fellow man is reading on Nerd Vittles these days, wonder no more. Visit our new statistical web site and check out what’s happening. It’s a terrific resource both for us and for you.

New Vitelity Special. Vitelity has generously offered a new discount for PBX in a Flash users. You now can get an almost half-price DID and 60 free minutes from our special Vitelity sign-up link. If you’re seeking the best flexibility in choosing an area code and phone number plus the lowest entry level pricing plus high quality calls, then Vitelity is the hands-down winner. Vitelity provides Tier A DID inbound service in over 3,000 rate centers throughout the US and Canada. And, when you use our special link to sign up, the Nerd Vittles and PBX in a Flash projects get a few shekels down the road while you get an incredible signup deal as well. The going rate for Vitelity’s DID service is $7.95 a month which includes up to 4,000 incoming minutes on two simultaneous channels with terminations priced at 1.45¢ per minute. Not any more! For PBX in a Flash users, here’s a deal you can’t (and shouldn’t) refuse! Sign up now, and you can purchase a Tier A DID with unlimited incoming calls for just $3.99 a month and you get a free hour of outbound calling to test out their call quality. To check availability of local numbers and tiers of service from Vitelity, click here. Do not use this link to order your DIDs, or you won’t get the special pricing! After the free hour of outbound calling, Vitelity’s rate is just 1.44¢ per minute for outbound calls in the U.S. There is a $35 prepay when you sign up. This covers future usage and any balance is fully refundable if you decide to discontinue service with Vitelity.

Some Recent Nerd Vittles Articles of Interest…

Introducing Telephone Reminders for Asterisk 1.4 with Phone and Web Scheduling

If you loved your ‘Speak and Spell’ when you were a kid, then prepare for a childhood flashback… except the Nerd Vittles version is more akin to ‘Spell and Speak.’ Today’s edition of Telephone Reminders for Asterisk® 1.4 not only lets you schedule reminders by phone using your own voice, but now you can use a clever (if we do say so) web interface as well. Just fill out a simple web form to set your reminder or recurring reminder in motion, and Telephone Reminders for Asterisk will swing into action with Flite or Cepstral’s Allison to deliver your typed message to the phone of your choice at the appointed time. It’s the perfect tool for bugging the hell out of your friends without ever picking up the phone. Wanna wake your worst enemy in the middle of the night with a nice reading of the Gettysburg Address? No problem. Actually, there is a slight problem. It’s against the law to make irritating phone calls. But it’ll be great for calling all those politicians back to thank them for the hundreds of telephone messages they delivered while you were eating dinner. And, yes, we’ve preserved all of the recurring reminder functionality that you’ve grown to love. So you can schedule one-time reminders, weekday reminders, daily reminders, weekly reminders, monthly reminders, and annual reminders. Wowee! Our special thanks to the PBX in a Flash Pioneers that really shook the bugs out of our beta release, most of which were thanks to the Deprecation Aficionados on the Asterisk Development Team. STOP DEPRECATING COMMANDS! It has no place in the business community. </rant>

To celebrate the FreePBX Training Seminar being held in our Hometown U.S.A. this week, we’ve even added a new FreePBX Interface to Telephone Reminders for those of you that like FreePBX as much as we do.

While the entire application has been designed for 15-second installation on PBX in a Flash systems, it’ll work equally well on any Asterisk 1.4 system with an Apache web server, PHP, FreePBX, and Flite or Cepstral support. But why make things difficult when PBX in a Flash is so easy to install? And, did we mention? It is and always will be free… with no tricks, ever. Visit to download your copy today.

How It Works. The original functionality of the application has been preserved. Dial 1-2-3 on a phone connected to your Asterisk 1.4 system and enter your password. The default is 12345678. Then you can record a reminder message, specify the phone number to which the reminder should be delivered, schedule the date and time for delivery, and decide whether to enable recurring reminders of one of the flavors outlined above. The Web Interface to Telephone Reminders lets you do exactly the same thing using a web browser. The only difference is that, instead of recording your reminder message, you type it and let Flite or Allison record it for you before the telephone reminder message is delivered. The FreePBX Interface to Telephone Reminders provides you the same web interface inside the FreePBX shell by adding a Reminders option under the Third Party Addon section of the Tools tab. As was true in version 3, both the telephone and web interfaces can be customized to meet your needs. See our detailed tutorial for customization tips. You now can also specify whether to use Flite or Allison for your web reminders. So let’s get started.

Installing Cepstral. If you want a perfect text-to-speech system for applications such as this one, then look no further than Cepstral. And we strongly recommend using the Voice of Allison that we’ve all grown up with in the Asterisk community. It’s the best $30 you’ll ever spend. Just follow our Cepstral installation tutorial, and you’ll be up and running in about 10 minutes. If you’ve already installed Cepstral on your system, then log into your server as root and make this one simple addition so that the Web Interface to Telephone Reminders can find the Cepstral application when it’s time to generate your text-to-speech phone reminder.

ln -s /opt/swift/bin/swift /usr/bin/swift

A Hint for the Early Pioneers. For the many pioneers that helped us get the bugs out of the beta release, THANK YOU! The best way to make sure you have a clean install of today’s release of Telephone Reminders with all the bells and whistles is to delete what you’re using now and start over. We will not delete any scheduled reminders, and it’ll only take a few minutes. Here’s how to clean off the old version on your system. Log into your server as root. First, edit crontab: nano -w /etc/crontab. Look for the two lines that look something like what you see below. Delete the two lines using Ctrl-K. Then save your changes: Ctrl-X, Y, then Enter.

0 0 * * * root /var/lib/asterisk/agi-bin/run_recurring > /dev/null
3 0 * * * root /var/lib/asterisk/agi-bin/run_reminders > /dev/null

Second, edit the extensions_custom config file: nano -w /etc/asterisk/extensions_custom.conf. There are two sections of code that need to be removed. The first will be found near the top of the file in the [from-internal-custom] context. Use Ctrl-W to search for 123, and you should see a clump of code that looks like the following. Use Ctrl-K to delete each of the lines.

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

The second section of code to be deleted will be near the bottom of the file. Use Ctrl-W to search for reminder. Delete each line of code including the context headings from the following contexts. Hint: It’s a big chunk of code!


Then save your changes: Ctrl-X, Y, then Enter.

Now let’s delete another group of files, and you’re all set. Just execute the following commands to delete the original files:

cd /var/lib/asterisk/agi-bin
rm checkdate.php
rm checktime.php
rm reminder.php
rm run_recurring
rm run_reminders
rm /var/www/html/reminders/index.php

If You’re Not Using PBX in a Flash. Only read this section if you’re not installing Telephone Reminders for Asterisk 1.4 on a PBX in a Flash system. It’s still possible to use this application without running it on a PBX in a Flash system. The major difference is that it is up to you to assure that the prerequisites are met and properly functioning. For those running trixbox 2.x systems, that is next to impossible until the trixbox developers decide to support Flite… unless you use the commercial Cepstral product. The good news is that Cepstral apparently works. The other good news is that the telephone module of Telephone Reminders does not require either Flite or Cepstral; however, the Web Interface does. As long as you’re willing to live without the Web Interface (i.e. version 3 functionality), keep reading. First, download both the install script and the payload file and manually determine what needs to be placed where. Our recommendation is to build a /root/reminders directory and execute the following commands to get all of the code:

mkdir /root/reminders
cd /root/reminders
tar -zxvf reminders.tgz

Unless you’re using PBX in a Flash or trixbox, carefully read the Telephone Reminders 3.0 tutorial on our Best of Nerd Vittles site. Then review the reminders.pbx script and make any necessary placement adjustments. Next, review the directory tree created below /root/reminders and be sure to copy and create the files and directory structure into the appropriate locations on your system. Make certain that you set ownership and file permissions properly for your system. The following assumptions are made in our setup. The root of the web server is located in /var/www/html, and Apache runs as user asterisk. AGI and PHP scripts for Asterisk are stored in /var/lib/asterisk/agi-bin. Logs for this application are written to /var/log/asterisk. Finally, the PHP and Asterisk configuration files are housed in /etc/asterisk. We don’t provide support for any installs other than on PBX in a Flash systems. Life’s too short!

Installation on PBX in a Flash Systems. We’ve saved the best for last. The entire install on a PBX in a Flash system takes about as long as it will take you to cut-and-paste the following commands. 15 seconds should do it! The script reportedly works on trixbox ce systems as well although we have not tested it. Log into your server as root and issue the following commands:

cd /root
chmod +x reminders.pbx
amportal restart
ln -s /opt/swift/bin/swift /usr/bin/swift

Test Run of Web Interface to Telephone Reminders. Assuming you have Cepstral running on your server, the web interface is ready to go since it comes configured to use Cepstral as the text-to-speech engine. We’ll show you how to change back to Flite in a minute. Using a web browser, go to the following site using the IP address of your Asterisk server: Fill in the blanks including a reminder message. If you enter a date and time in the past, the phone number you enter will start ringing as soon as you hit the Schedule Reminder button. That’s a good way to be sure everything is working without having to sit and wait for a return call.

When Things Go Wrong. Immediately after scheduling a reminder, be sure to check for the pending reminder by clicking Review Existing Reminders. You should see both a .call file and a .gsm with otherwise matching file names. If the .gsm file is missing, one of two things has happened. If you haven’t installed Cepstral and you haven’t changed the default TTS engine, then solve it by doing one or the other. If Cepstral is working on your system (swift “Hello world.” at command prompt), then you may be missing the sox application. To install it, log in as root and type: yum install sox.

Test Run of Telephone Reminders for Asterisk. On PBX in a Flash systems, the application will run once you complete the install as outlined above. Dial 1-2-3 from a phone on your system and enter the default password of 12345678 when prompted. Record a message and press #. When prompted for the phone number to which the reminder should be delivered, press # to choose the number you are calling from. When prompted for the date to deliver the message, press # to choose today. When prompted for the time, enter a 4-digit time with a 2-digit hour and 2-digit minute. Military time (24 hour clock) is fine. Make sure the time is at least 5 minutes in the future, and make sure the time on your watch and server match! Accept the settings, hang up, and wait for your reminder call.

Configuring Telephone Reminders for Asterisk. The phone interface to Telephone Reminders and the web interface are two separate applications so you’ll need to configure both of them. Let’s start with the phone interface. At a minimum, you’ll want to change the default password to something more secure. Edit /etc/asterisk/extensions_custom.conf using either nano or the FreePBX Config Edit option in Tools. Search for 123 and change the password in line 3 which looks like this. If you want to change the phone number to dial to enter reminders, simply replace 123 on every line with the number you wish to use.

exten => 123,3,Authenticate(12345678)

Update: A user on the PBX in a Flash Forum has pointed out that you can substitute the line below for the “Authenticate” line above, and the system will accept the existing voicemail password associated with the phone making the call:

exten => 123,3,vmauthenticate(${CALLERID(number)})

In order to take advantage of the new number conflict checking mechanism in FreePBX 2.4, we also recommend you add a Misc Destination for Telephone Reminders under the Setup tab. The entries should look something like the following:

Description Reminders
Dial 123

Once you’ve made the entry, click the Submit button and then reload the Asterisk dialplan when prompted.

The other changes you can make are accomplished by setting variables in the reminders.php application which is stored in /var/lib/asterisk/agi-bin. For a complete list of the variables and what they mean, take a look at the Telephony Configuration section in our Best of Nerd Vittles article.

Configuring the Web Interface to Telephone Reminders. The variable settings for the web interface are identical to those above. In addition, the text-to-speech engine can be set to Flite (instead of Cepstral) by changing the value of $ttspick from 1 to 0. The file to edit is index.php in /var/www/html/reminders. For more details, take a look at the Web Interface Configuration topic in our Best of Nerd Vittles article. Some may also find it desirable to secure the web interface to Telephone Reminders with a password. Here’s how.

Installing the FreePBX Interface to Telephone Reminders. After installing Telephone Reminders, a new Module will be available for installation in FreePBX by accessing Tools->Module Admin. Scroll to the bottom of the listing and click on Reminders and then the Install button. Once the installation completes, reload the Asterisk dialplan when prompted. A new FreePBX interface to Telephone Reminders then will display in the Third Party AddOn listing under the Tools tab in FreePBX.

Special Thanks. We want to extend our special thanks to Sangoma for their generous, unsolicited contribution to the PBX in a Flash project. While everything we produce is freely given for all to use, projects such as Nerd Vittles and PBX in a Flash still require money to fund research and product development. On behalf of the entire PBX in a Flash Development Team, thank you. SANGOMA ROCKS!!

Best of Nerd Vittles Tutorial. For those of you that prefer to read manuals, we also have a new Telephone Reminders 4.0 tutorial on our Best of Nerd Vittles site.

Need More Help? That’s what the PBX in a Flash Forum is for! Even if you don’t need help, stop by and let us know what’s on your Wish List! And remember, the Donate button at the top of Nerd Vittles makes wishes come true. Enjoy!

Some Recent Nerd Vittles Articles of Interest…

Ringbinder theme by Themocracy