xTide for Asterisk

The latest Tides, Solar and Lunar Happenings By Phone for Any Port City

Nerd Vittles' xTide for Asterisk is a text-to-speech (TTS) application that provides today's and tomorrow's tides, solar, and lunar info for almost any port city. The report is as close as your telephone, or a convenient web portal also is supported. Just dial T-I-D-E (8433) from a phone connected to your Asterisk PBX. Text-to-speech messages can be delivered using Flite or Cepstral. Installation is a one-minute operation using a Nerd Vittles script which is downloaded onto your PBX in a Flash system.

Prerequisites

xTide for Asterisk needs a LAMP-based platform (Linux, Apache, MySQL, and PHP) to work. We recommend PBX in a Flash, but other systems such as trixbox 2.x should suffice as well. To use the text-to-speech telephony interface, you also will need a functioning text-to-speech engine. Both Flite and Cepstral are supported in Asterisk 1.4 and Cepstral is supported in Asterisk 1.6.

How It Works

xTide for Asterisk is simple to use. Dial extension T-I-D-E (8433) on your Asterisk system. Your xTide report will be delivered using the TTS engine you have chosen for the port city preconfigured on your system. You also can access the complete xTide system through a web browser by pointing to the IP address of your Asterisk server on TCP port 88, e.g. http://192.168.0.100:88/.

Installing xTide for Asterisk

[zip] xTide for Asterisk Install Script (2KB)

Installation takes about a minute. Log into your PBX in a Flash server as root and execute the following commands:

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

Dialplan Setup

Most of the heavy-lifting for the xTide for Asterisk system is handled by a bash script and a simple addition to the Asterisk dialplan. With PBX in a Flash systems, these additions are made to the extensions_custom.conf file in /etc/asterisk as part of the install. On other systems, you may need to manually add the following code to the [from-internal-custom] context in extensions_custom.conf:

exten => 8433,1,Answer
exten => 8433,n,Wait(1)
exten => 8433,n,System(/var/lib/asterisk/agi-bin/xtide)
exten => 8433,n,Playback(/tmp/xtide)
exten => 8433,n,Wait(1)
exten => 8433,n,Hangup

FreePBX Setup

While still connected to your PBX in a Flash server with FreePBX in your browser, click on the Setup tab and then Misc Destinations. Add a new entry for xTide with 8433 as the Dial entry.

 Add Misc Destination
description:
dial:   

Save your entry and reload your Asterisk dialplan when prompted to do so.

Configuring the Preferred Port for xTide Data

The default port setting for xTide for Asterisk is Pawleys Island, South Carolina. You can change this to meet your needs. There are three steps to reconfiguring the desired port city. First, identify a port city supported by xTide. Second, test the port city you have chosen using the tide application. Third, configure xTide for Asterisk for your desired port city.

To identify whether a particular port city is supported by xTide, visit the following link and search for the city you wish to use. Once you have verified that your desired location is supported, test it manually with the tide application that was installed as part of xTide for Asterisk. Log into your server as root and issue the command: tide -l "portcity". Some examples are shown below:

tide -l "pawleys"
tide -l "boston"
tide -l "san diego"

Once you have verified that you get a tide report for your chosen city, you need to configure xTide for Asterisk to support that destination. While still logged in as root, edit /etc/asterisk/xtide.conf and change the contents to your new city. Be careful NOT to add any blank lines to the config file!

SITE="pawleys"
SITENAME="Pawlees Island, South Carolina"  (note the change in spelling to assist Cepstral)

Test Drive xTide for Asterisk

You can try out xTide for Asterisk by visiting our Pawleys Island WebCam site or just dial: 843-284-6979.

Nerd Vittles Original Article (6/16/2008): Roll Tide: Let Allison and Asterisk Plan Your Next Surfin Safari