Home » 2005 » December » 07

Daily Archives: Wednesday, December 7, 2005

The Most Versatile VoIP Provider: FREE PORTING

Follow-Me Cruising: Implementing Bluetooth Proximity Detection with Asterisk and a TomTom GPS

tomtomWe’ve pretty well documented how you can set up Bluetooth Proximity Detection using a bluetooth headset or cellphone with your Asterisk® PBX. Once configured, phone calls in your home or office can automatically be transferred to your cellphone whenever you take off carrying your bluetooth device. In our original articles, you’ll recall that we recommended a bluetooth headset as the ideal way to track your comings and goings at very little cost. But today, we want to add another bit of magic to the project and also give you something to tell Santa about. It’s the incredible Tom Tom Go, a portable GPS device that has the Garmin’s of the world shaking in their boots because this thing is so easy to use and just does everything right. Having endured absolutely terrible built-in GPS units in both Cadillac and Mercedes Benz automobiles and not-much-better Garmin units, take it from us. Buy a TomTom. Our Cadillac GPS had to be replaced four times and finally with a unit from a later 2005 Escalade before you could store a location and call it up without crashing the entire system. And GM wonders why they’re losing money. Worse yet, to put a name with a location using the Mercedes GPS still requires a trip to the manual. It’s that painful and unintuitive! So, when your friendly car dealer touts the built-in GPS devices in their automobiles, JUST SAY NO! We haven’t seen a built-in unit yet that doesn’t suck.

Some Hints for GPS manufacturers: Nobody wants a GPS that reproduces an entire paper street map on a 4 inch screen. We’re trying to figure out how to get somewhere! What’s important is the name of the street you’re on, the names of the next few cross streets, and how far to drive until the next turn. Which way to turn with a little advance warning is also a nice touch. And, by the way, we’re smart enough to know not to be fiddling with the GPS while the car is moving so don’t lock the damn unit when the car is moving. In case you haven’t heard, some cars can actually have more than one person riding in them at the same time. They’re called passengers, and they can even chew gum and operate a GPS while seated in the passenger seat. Bozos! Here’s the best hint of all: Go buy a TomTom for you and your company and copy what they’ve done.

TomTom at a Glance. With the TomTom, you can either get the flash drive model 300 with the entire U.S. and Canada maps on a single chip, or there’s a hard disk version 700 which also gives you a hands-free speakerphone and phonebook for use with your compatible bluetooth cellphone. Treo 650 fans are SOL. Both TomTom models provide automatic route calculation and turn-by-turn directions through a built-in speaker. And, with either unit, you also can get traffic reports and the latest weather forecasts not to mention points of interest alerts showing where every "safety" camera is located in many European countries. If you can’t figure out how to use a TomTom in under 15 minutes, you need to stay away from anything that uses electricity. Yes, it’s that good. And all the TomTom units are Linux-based so you can download the source code and build your own GPS if that’s your thing. Circuit City will even let you try a TomTom for two weeks and return it for a full refund. So take them up on the offer. Then, if you decide to buy one, take the Circuit City unit back and buy it on the web. It’ll save you over $200! With the current $50 rebate and free U.S. traffic reports, the TomTom Go 300 can be purchased for under $500 with some careful shopping (HINT: PriceGrabber.com). See how nice we are! We could have encouraged you to click on the link below and actually make us a little money … but who needs it, right?


Using a TomTom for Proximity Detection. Once you have your TomTom Go device, you also can use it in our Bluetooth Proximity Detection system in lieu of a headset. Here’s how. Because the TomTom unit is designed to allow you to download weather reports and traffic information using your bluetooth-enabled cellphone, that, of course, means the TomTom unit talks bluetooth. So, just like your bluetooth headset, the only trick is discovering the MAC address of the TomTom’s built-in bluetooth adapter. The device is designed to operate on its internal battery for a day at a time. Thus it’s pretty simple to carry the unit to your Asterisk server and turn it on. Once it’s on, tap the screen once, tap the right arrow icon twice to move to the third page, and then tap TomTom Weather. When prompted whether to set up your wireless internet connection now, tap Yes. While logged into your Asterisk server, type hcitool scan and, presto, your TomTom unit will dutifully report its MAC address for all the world to see:

[root@asterisk1 tmp]# hcitool scan
Scanning ...
00:0F:3D:4B:DF:E0 n/a

N/A doesn’t tell you much, but it’s your TomTom. Trust us on this one. Once you have this tidbit of information, simply edit your ruhome script and plug in the required information:

mainasteriskbox=192.168.0.118
deviceuser=TomTom
devicemac=00:0F:3D:4B:DF:E0


Now, when you drive your automobile into your garage, your home phones will come back to life. The only wrinkle, of course, is that you’ll need to leave your GPS unit powered on while you’re home. Otherwise, powering down the TomTom would tell your Asterisk server that you had departed again. Yeah, you’re right. It’s not ideal, but it did give us the opportunity to offer a great tip for your Christmas wish list. And it ought to get you thinking that this particular device is well-suited to integrate into your home automation system to turn on the lights and hot tub. With home automation system software such as Indigo and its AppleScript object model and dictionary or Salling Clicker, you don’t have to worry about the TomTom turning itself off in the garage because all we really need is the proximity "trigger" to alert Indigo to turn on the lights. Once on, you can program Indigo to define how long the lights stay on before automatically turning themselves off again. Problem solved.

Implementing Proximity Detection on a Single Asterisk@Home 2.1 Server. Our original articles on how to deploy a Bluetooth Proximity Detection System assumed you were using two Asterisk servers, one for phone calls and a second version 2 server for proximity detection. However, now that Asterisk@Home 2.1 is soup, we thought it would be helpful to show you how to run the entire system using a single Asterisk@Home 2.1 server. First, download the updated proximity detection software here. Once you unzip the file, you’ll note that there’s a new ruhome2 file. The only changes you’ll need to make from the original tutorial are to substitute the ruhome2 file for the original ruhome file and to copy homecheck.agi to /var/lib/asterisk/agi-bin on your Asterisk@Home 2.1 server. Don’t forget to reset the file permissions as previously explained. Once you make these two simple changes, the entire proximity detection system can be run from your one and only Asterisk@Home 2.1 server.


Manually Managing In and Out Status with a SIP Phone. We’ve also received several queries from readers asking for a simple way to turn off the proximity detection system and to manually manage your IN or OUT status using buttons on a SIP telephone. In other words, when you leave your home or office, you want to press a button on the phone to tell your Asterisk server whether you’re IN or OUT. Yes, you can do it on a per extension basis using *72, but the proximity detection system transfers all calls based upon the location of your bluetooth device. To do the same thing manually, first remove the ruhome application from your crontab by logging into your server as root and deleting that line (Ctrl-K) from your crontab file. Then save your changes: Ctrl-X, Y, Enter.

export EDITOR=nano
crontab -e

Then add the following code to the [from-internal-custom] context of your extensions_custom.conf file and reload Asterisk. Note that, in the code below, you’ll have to change the name of the file in the /tmp directory from WARD to whatever filename you’re currently using with your proximity detection system. This is the deviceuser variable in your ruhome script. You’ll also need to modify the permissions on this file after logging into your Asterisk server as root, or this won’t work: chmod 666 /tmp/WARD.

exten => 46,1,Answer ; IN to deactivate call forwarding
exten => 46,2,Wait(1)
exten => 46,3,System(cp -f /var/lib/asterisk/agi-bin/notnull.file /tmp/WARD)
exten => 46,4,Playback(call-forwarding)
exten => 46,5,Playback(de-activated)
exten => 46,6,Wait(1)
exten => 46,7,Playback(goodbye)
exten => 46,8,Hangup

exten => 688,1,Answer ; OUT to activate call forwarding
exten => 688,2,Wait(1)
exten => 688,3,System(cp -f /var/lib/asterisk/agi-bin/null.file /tmp/WARD)
exten => 688,4,Playback(call-forwarding)
exten => 688,5,Playback(activated)
exten => 688,6,Wait(1)
exten => 688,7,Playback(goodbye)
exten => 688,8,Hangup

Once you make these changes, you can pick up any extension and dial IN (46) when you’re IN or OUT (688) when you’re away. You can also assign these "extensions" to buttons on almost any SIP telephone instrument if you want one-touch dialing.

Other Tutorials. There are numerous additional articles in this Asterisk HOW-TO series to keep you busy. You can read all of them by clicking here and scrolling down the page. We recommend reading at least the first four or five articles from the bottom up so that the learning curve is less painful. Then you can skip around to your heart’s content. There’s also an index of all the previous articles which you can review here.