This is the second in our series of articles showing how to deploy a Bluetooth Proximity Detection system with Asterisk@Home. Part I is here. When we’re finished, your system will automatically transfer incoming calls in your home or office to your cellphone or any other phone whenever you leave home base carrying your bluetooth-enabled cellphone or your bluetooth headset. You’ll recall that we recommended the headset approach because cellphones have a nasty habit of putting themselves and their bluetooth adapter to sleep when you’re not on the phone. If bluetooth on the phone is sleeping, we lose our ability to detect your comings and goings so be reasonable and do it our way. Use a bluetooth headset. Once you remove the earpiece, the bluetooth headset fits comfortably in your pocket and isn’t much larger than a flash drive. For our purposes the bluetooth headset will be functioning primarily as an electronic key although there’s no reason you can’t also use it in conjunction with either your bluetooth cellphone, or a softphone connected to your primary Asterisk@Home PBX, or all of the above. The major difference in our approach and some of the other proximity detection systems which (still) are on the drawing boards is cost. Our bluetooth headset “key” costs roughly $30 delivered to your door. Most of the corporate dream systems require a $200 badge (to do the same thing) and then an incredibly expensive server (to do what we’re doing with an old clunker PC). So, yes, open source technology is a very good thing for all of us. And it deserves your financial support. Here’s a link if you’d like to make a contribution in any amount to the Asterisk@Home project. End of sermon.
NOTE: This article has been updated to take advantage of TrixBox, freePBX, and the iPhone. For the current article, click here.
Detect the presence of a Bluetooth device
This example shows how to check for the presence of a mobile phone. The code was based on the article 'Implementing Bluetooth Proximity Detection with Asterisk.#!/usr/bin/ruby #file: whereib.rb deviceid = '00:0E:6D:29:38:EB' devicename = 'Nokia 6600' count = 0 while count < 1 if `hcitool name #{deviceid}`.chomp == devicename puts devicename + ' IN RANGE' puts Time.now else puts devicename + ' OUT OF RANGE' puts Time.now end sleep 7 end__