This is the first in a series of articles that will provide step-by-step instructions for implementing Bluetooth Proximity Detection. We’re going to focus on using it with Asterisk®@Home, a terrific PBX which also happens to be free. But your imagination is really the only limitation. At the very least, when we’re finished, you’ll be able to walk out of your home or office carrying your bluetooth phone or headset and have your Asterisk server automatically transfer your incoming calls to your cellphone. And, when you return carrying your bluetooth phone or headset, Asterisk will automatically cancel the call transfers and reactivate delivery of incoming calls to the designated phones in your home or office. As simple as this concept may sound, the devil is in the details. So we want to spend today warning you of all the minefields that lie ahead and telling you what hardware you’ll need to make things work. If you hurry, you can implement the whole system for just over $50, and we’ll show you how to do it without even owning a bluetooth cellphone. In subsequent articles, we’ll put the pieces together and get a basic system working. Then we’ll add more bells and whistles and give you some implementation and deployment suggestions. You’ll quickly come to appreciate how Bluetooth Proximity Detection can be used to implement all sorts of other features. When we’re finished, you’ll also appreciate the potential of bluetooth to revolutionize the workplace. And it goes far beyond your phone system. Imagine an automated IN/OUT message board in businesses such as real estate or the advertising potential to tailor TV display ads in stores based upon not only your presence but also the type of cellphone you are carrying. Your office can even kiss its old punch clock goodbye when we’re finished. For those with new Cadillac or Mercedes automobiles, you can unlock your car and start it just by approaching the vehicle with your "key" still in your pocket. So where do we start?

NOTE: This article has been updated to take advantage of TrixBox, freePBX, and the iPhone. For the current article, click here.

Overview. The basic idea behind proximity detection is that we run a software application on a computer to "watch" for approaching people. We then want it to do something when you (or a customer) gets within range. How do it know? Well, in our case, this is where Bluetooth comes in. Unlike motion detectors which can’t tell the difference between a human and a gorilla, bluetooth devices all have a unique MAC address just like a network card. And most bluetooth devices also have a name. So long as the bluetooth device is configured to advertise its presence, we can detect when it is within range and when it’s not. That’s the second major difference between bluetooth and traditional motion detectors. Ever been in a public restroom or an office when all the lights went out because everybody was sitting too still for too long? So motion detectors have some limitations. Bluetooth doesn’t. In case you’ve been living under a rock for the past six years, bluetooth is a wireless communications protocol that uses short range radio frequency to connect devices into wireless personal area networks (PANs). The most common Class II 2.5mW devices have a range of 32 feet (10 meters). Class I devices have a range of up to 100 meters. Most bluetooth cellphones, headsets, and computer peripherals such as mice and keyboards are Class II devices. If you want more background, go here.





Prerequisites. For our proximity detection project, we’re going to connect a bluetooth network adapter to an Asterisk@Home box and make it our master. That simply means we’re going to use this network adapter to look for other bluetooth devices within range. The only limitation is you can’t have your Asterisk@Home box shoved in a closet in the basement if you want this to work. It will need to be within 30 feet or so of where you’ll be when you’re at home or in the office. If this doesn’t work for you, then here’s an alternative. Just get in the habit of putting your cellphone or bluetooth headset down near your Asterisk@Home box when you’re "in" and take it with you when you’re "out." Many offices, particularly in the real estate business, have a receptionist with agent mailboxes immediately beside or behind the receptionist desk. Just put your Asterisk box with its bluetooth adapter under the receptionist’s desk and leave your cellphone or wireless headset in your mailbox whenever you return to the office. The adapter we recommend which is quirk-free is dLink’s DBT-120. You can find them on the net for about $30, but you can usually beat that price by watching the Sunday circulars for computer and office depot/max stores in your area … if you don’t mind mail-in rebates. But, do you really want the PBX for your whole office sitting under the receptionist’s desk? Probably not. But don’t worry, we’ve got some other tricks up our sleeve so keep reading.





We keep mentioning a headset so we won’t keep you in suspense any longer. You don’t need a bluetooth cellphone to make our proximity detection project work. A bluetooth wireless headset works just as well. In fact, it works better! And you’ll have a great addition to your computer system and cellphone as an added bonus. Cellphones have a nasty habit of putting themselves in sleep mode very quickly when not in use to conserve battery power. The only problem is that most, if not all, cellphone makers turn off the bluetooth adapter when they activate sleep mode because they’re all so short-sighted that the only thing they think you use bluetooth for is to talk to your wireless headset or exchange files with your PC. Stupid! Bluetooth headsets on the other hand are always on listening for a call. The one we like has a rated standby time of 200 hours between battery charges so it’s perfect for this project. These devices typically cost anywhere from $50 to $100 but, if you hurry, there’s a vendor selling our favorite, the Plantronics M3000, for under $20. Here’s the link at PriceGrabber. Don’t wait. They’re never this cheap, and this vendor only has 50 of them. And Buy.com has a similar unit from IOgear for about the same price once you factor in the cost of shipping. Will you need to wear your bluetooth headset and look like a Nerd to make this work? Not at all. Just turn it on, stuff it in your pocket, and call it a key.

Now let’s address the computer issues. First, your machine obviously needs USB adapter support so you have a place to plug in your bluetooth adapter. Second, we need a machine that can run software that can detect bluetooth devices. Having spent a week scouring the Internet and testing various products which touted their bluetooth proximity detection, let me save you some time. If you are fortunate enough to have a Sony Ericsson phone with bluetooth, some of the commercial products such as BluePhoneElite for the Mac or Salling Clicker for Mac or Windows work great for proximity detection. There’s even an open source product, Romeo for the Mac, that works. If you have a single-tasking Palm device including the Treo 650 cellphone, don’t waste your time. And bluetooth headsets aren’t detected at all by any of the products. This is primarily because proximity detection was considered a gee-whiz extra in most of these products so it’s not implemented very well. The good news is that, if you happen to have a bluetooth cellphone that does work with one of these products, it might make proximity detection more practical because you could handle the proximity interaction with your desktop machine instead of with your telephone system’s PBX. But, who cares. We just want it to work.





So where does that leave us on the computer front? The bottom line is you’re going to need a Linux machine and a fairly current version of the Linux operating system to get the bluetooth tools installed that we need. As luck would have it, the new Asterisk@Home 2.0 beta release works great … and it’s free. And it automatically installs CentOS/4, the free knock-off of RedHat’s commercial Enterprise Linux 4. Because Asterisk@Home is free and will run on any old clunker PC, you may want to install the Asterisk@Home 2.0 beta on a dedicated machine and just use it for proximity detection. This solves the colocation problem with your main PBX, and it has the added benefit of reducing the load on your primary Asterisk server. The other terrific benefit of this approach is you’ll have a hot standby system for your main PBX, and we’ll integrate that into our tutorials one of these days, too. When your one and only Asterisk@Home box dies, do you really want to be without phone service? Keep in mind that proximity detection also takes some horsepower because we’ll be running a script once a minute to see who’s in and who’s not. And, no, Asterisk@Home 1.5 won’t work. Believe me, we’ve tried and it was just about as frustrating as trying to use a Treo 650 for proximity detection. A total bust!

Well, that covers the basics and provides you the information you’ll need to start assembling the pieces for the proximity detection project. We’ll leave it to you to get your bluetooth hardware ordered and to get your Asterisk@Home 2.0 beta up and running before moving on to Chapters 2 and 3.

Some Recent Nerd Vittles Articles of Interest…