Roll Tide: Let Allison and Asterisk Plan Your Next Surfin’ Safari

The one thing that Mark Spencer and I totally agree upon is that neither one of us shouts "Roll Tide" very often. So... my apologies to all of my Auburn friends for the headline. I didn't really mean it! We'll have more to say about Digium®'s Pit Bull approach to software development in coming weeks. But today we're celebrating the arrival of summer and Joe Roper's safe passage through the Straits of Gibraltar. We'll leave Asterisk® politics for a gloomy, rainy day. From the Never to Be Outdone Department: If you need your weekly fix of The Worst of Asterisk, then here's a link to the FreePBX news item describing Fonality's latest shenanigans. You might want to start with the initial revelations and then hold your nose while reading the follow-up responses. Pretty sad stuff for an open source project or any other business for that matter. The Silver Lining: Could there be a better mousetrap looming on the horizon? Stay tuned!

Introducing xTide for Asterisk. Whether you're a beach bum or would just love to get a current surf report from the nearest telephone, then today's your lucky day! With xTide for Asterisk, you get the latest text-to-speech (TTS) tide predictions as well as solar and lunar forecasts for any port of call in the United States. To use the application, just dial T-I-D-E from any phone connected to your PBX in a Flash system and Allison or Egor will tell you everything you ever wanted to know about sunrise, sunset, moonrise, moonset, and today's and tomorrow's high and low tide predictions for almost any oceanfront location. And we'll also show you how to connect the system up to a phone number of your choice so that tide reports are as close as your cellphone. Of course, retrieving reports with Flite and Egor is free. Cepstral with Allison will set you back a meager $25. If you want a quick demo, dial 425-906-5918. Thanks, IPKall.

Overview. The xTide for Asterisk application is a little different than some of our other text-to-speech applications which rely upon servers hosted by other folks. With xTide for Asterisk, we're actually going to install the full xTide app (about 40MB of code) on your PBX in a Flash server. As configured, it's a very well-behaved application that uses virtually no system resources except when you retrieve a report. And, remember, xTide should not be used for navigation or anything else that really matters! It's a statistical application, not a weather expert nor a rocket scientist. But special thanks anyway to David Flater for his continuing development of xTide! With xTide for Asterisk, you can generate text-to-speech reports over the phone, and you also can access David's complete xTide application by pointing your web browser to the dedicated xTide web server to retrieve anything you ever wanted to know about solar, lunar, and tide forecasts for almost anywhere in the United States. There's even an x-Windows interface if you've installed it on your system. The complete list of locations supported by xTide is available here or you can retrieve the list from your own xTide server: http://serverIPaddress:88/index.html. And, yes, for our foreign friends, there's a worldwide version of the harmonics files which is available for non-commercial use only. You'll need to manually install it if you want to use it. Source RPMs also are available if you want them.

Prerequisites. We've tested this installation with PBX in a Flash 1.1 and 1.2 so it's a one-minute drill if you've already got one of those systems in place. You can download the current version of PBX in a Flash here. And complete documentation is available here. With other Asterisk-based aggregations, there may be some additional wrinkles, but we'll leave those for the pioneers to iron out. For PBX in a Flash users, you simply download our script, mark it as executable, and run it. A minute later, you're ready to begin your surfing career.

Setup Tips. Once you complete the installation, you'll have three separate xTide applications available. xtide is actually the x-Windows interface which we're not going to be using because of the x-Windows overhead on your server. tide is the command-line equivalent which we'll be using to create TTS reports for Asterisk. You also can use it interactively, and we'll show you how in a minute. There's also a a web server dedicated to serving up all sorts of xTide reports which can be retrieved with your favorite browser. While it is activated after the install completes, it won't automatically restart when you reboot your server unless you set it up to do so. We did this to minimize the load on your system if you only plan to retrieve reports using the TTS telephony interface. The only other setup step involves choosing your default location for the reports, and there are pages of locations from which to choose. We'll walk you through the location setup process momentarily, but first, let's install the application.

Installation on PBX in a Flash Systems. We've tested this installation on dedicated PBX in a Flash 1.1 and 1.2 servers. It does not run on hosted servers without satisfying additional dependencies which we'll leave to the hosted system providers to work out. To install, log into your server as root and issue the following commands:

cd /root
wget http://bestof.nerdvittles.com/applications/xtide/xtide.pbx
chmod +x xtide.pbx
./xtide.pbx

If you plan to use the application with the Cepstral TTS engine, choose option 2 when prompted. Note: We recommend you first install Cepstral before proceeding. If you're not using Cepstral, choose option 1 for the default Flite TTS engine. But keep in mind that Flite does not work with Asterisk 1.6-beta while Cepstral does... if you follow our tutorial.

Choosing a Default Location. Tides, sunrise, and sunset obviously differ depending upon your coastal location. As installed, you'll get the information for Pawleys Island, South Carolina which is the site of our webcam. If you'd like to try out our system, just dial our free IPKall number for the Pawleys Island xTide report: 425-906-5918. To use another location on your own system, you first need to decipher whether it's in the list of supported locations. Once you have your location, test it using the following command: tide -l "sitename". For example, tide -l "pawleys" returns the tide information in the default setup. Once you get a report for the desired location, edit /etc/asterisk/xtide.conf and replace "pawleys" with the SITE location you've chosen. Then add a descriptive SITENAME. Do NOT add any blank lines to the config file, or nothing will work. Save your changes and run a simple test by dialing T-I-D-E from a telephone connected to your server.

Using the Web Interface. To use the web interface on your private network, go to the following link using the actual IP address of your Asterisk system: http://serverIPaddress:88/. Complete documentation and a FAQ are available. To access the web interface from the Internet, you'll need to redirect TCP port 88 to the private IP address of your Asterisk server. When you reboot your server, the dedicated web server for xTide will not start automatically. We set it up this way for those that don't want the overhead of a third web server. Remember Apache and WebMin already are running. If you don't plan to use the xTide web interface, then you're all set. If you want to permanently enable xttpd, then log into your server as root and issue the following command:

chkconfig --levels 2345 xttpd on

Creating an External Phone Number for xTide. In a previous column, we walked you through setting up a SIP proxy with PBX in a Flash. To expose xTide for Asterisk to the phones of the outside world, the cheapest approach is a free phone number from IPKall. Before obtaining one, you'll need a dyndns.org fully-qualified domain name that points to the public IP address of your server. Then set up your SIP proxy for xtide and create an Inbound Route in FreePBX for xtide that routes incoming calls to custom-xtide,s,1. Now insert the following code at the bottom of /etc/asterisk/extensions_custom.conf and reload your dialplan. Here's the code:

[custom-xtide]
exten => s,1,Answer
exten => s,2,Wait(1)
exten => s,3,Dial(local/8433@from-internal)
exten => s,4,Hangup

Now sign up for your phone number at IPKall and use a valid email address. Otherwise, you'll never receive your phone number! Your IPKall entries should look something like this:

Account Type: SIP
SIP Phone Number: xtide
SIP Proxy: yourdomain.dyndns.org
Email Address: yourname@gmail.com
Password: yourpassword
Seconds to Ring: 120

Programmer's Corner. Except for a few lines of dialplan code, xTide for Asterisk makes exclusive use of bash commands to manipulate the output of tide and turn it into speech. The results are stored in /tmp so Linux will handle file cleanup automatically. The application that does the heavy lifting is /var/lib/asterisk/agi-bin/xtide. You'll also find xtide.flite and xtide.cepstral in the same directory. Should you wish to change text-to-speech engines, just copy the appropriate file over to xtide. For the whiz kids, we're always open to suggestions on how to improve the code which makes extensive use of eval, sed, and cut to get the proper results from the xtide output. No need to elaborate on our crappy bash programming skills. We already know that!

One piece of code we've included to reduce the overhead on Cepstral usage is a test for the timestamp of /tmp/xtide.txt. If it matches today's date, then we simply skip processing of a new xtide request and play the previously generated xtide.wav file. This might matter if you decide to change TTS engines in the middle of the day. To force a regeneration of the xtide.wav file, just rm -f /tmp/xtide.* after making a change in your xTide TTS engine. One final tip... if you generate your own TTS files using tide, don't use our xtide.* and other temporary file names (which start with the name of your chosen port city) while logged in as root, or this application will be unable to delete or overwrite them. HINT: su asterisk before playing. Enjoy!

Other TTS Applications for Asterisk. xTide for Asterisk is the latest in our growing collection of text-to-speech applications for Asterisk:

  • AsteriDex RoboDialer
  • Asterisk Weather Station by Airport Code
  • Asterisk Weather Station by Zip Code
  • Worldwide Weather Forecasts
  • MailCall for Asterisk
  • NewsClips for Asterisk
  • TeleYapper
  • Telephone Reminders for Asterisk
  • CallWho for AsteriDex (beta)

To download the latest versions, visit our Best of Nerd Vittles site.


Vitelity Special: Time Is Running Out. Remember, you only have two more weeks until July 15 to get your half-price DIDs 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 before the end of June, and you can purchase a Tier A DID with unlimited incoming calls for just $3.79 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.


Some Recent Nerd Vittles Articles of Interest...

Be Sociable, Share!

3 Responses to “Roll Tide: Let Allison and Asterisk Plan Your Next Surfin’ Safari”

  1. Benjamin Ko says:

    Dear Mr. Mundy,

    First of all, I really appreciate you for your valuable information.

    I tried to access pbxinaflash forum site: pbxinaflash.com/forum,
    but I cannot open the forum page.

    Please let me know how to read pbxinaflash forums.

    Thanks in advance.

    Benjamin Ko

    [WM: You'll need to check with your Internet Service Provider. There are no blocks of IP addresses at our end. The only other folks having a problem are a few of the provinces in Mainland China. Sorry.]

  2. Tim Wright says:

    We’ve been using vitelity for quite a while (thanks to mundy). When the winds came and blew down all the trees and power lines, my calls got automagically routed to my cell. The people with cablemodem phones did not (charter?). Don’t forget to add E911 service and grab a vfax line while you’re at it. When you’re done adding in all the goodies you still pay less than your low-tech neighbors!

  3. Chris says:

    Gee I guess the deal ended, I went through the process, but it tried to wack me for 35 bucks up front.

    [WM: All Internet hosting providers require payment in advance for services. Think about it. How would they ever collect? You are free to cancel at any time and receive a refund for any of the $35 you didn't use.]

Leave a Reply

Ringbinder theme by Themocracy