Asterisk: Bluetooth Proximity Detection to auto divert calls to mobile

By tonyhughes Hughes, in , posted: 17-Jan-2007 00:51

After some hair pulling and head scratching, I finally managed to nut out the guide at Nerd Vittles on how to set up a Bluetooth proximity detection system for the Asterisk open source PBX system.

It took a little bit of extra Google searching, and trying to remember a number of command line tools, but I finally got it done.

What it does, essentially is detects if your bluetooth enabled mobile phone is in the house/office. If so, then it knows you are home, and incoming calls make your regular home phone ring. If there is no bluetooth signal, it decides that you are not in the house, and automatically diverts all calls (that you ask it to), to your mobile phone.

A script constantly (about once a minute), monitors the bluetooth dongle attached to the Asterisk box. It scans the area for bluetooth devices, and if it finds your phones MAC address (pre setup in the scripts of course), it makes a flag file 1 byte in size. If your phone is not in range, it makes the flag file 0 bytes in size.

From there, a bit of smarts lets Asterisk know if you are home or not.

I have this completely working up until the Asterisk config part, because I need some sleep! But my flag file updates quite happily based on my bluetooth device being in the house or not.

Another way to activate this, as listed in the guide, is to base it on a bluetooth headset, which is a great idea. I will do some testing, and see if the dongle picks up an old headset I have here from where I park my car. If so, I will plug the headset into a car charger in the vehicle, and it can stay on permanently - then my proximity detection will be based on my car being home, rather than my cellphones bluetooth being on (it could be off for various reasons).

Its also possible to use Bluetooth proximity detection to turn lights on when you arrive home etc... but lets not go there just yet!

Other related posts:
Flatmates busting your ADSL cap? Remedy...
Hawkes Bay Today (newspaper) scraping Trademe for telemarketing
Smart Connect - a free alternative to Psiloc Connect for S60 Nokia Smartphones (E71 etc)

Comment by sbiddle, on 17-Jan-2007 06:50

The next cool thing you want to do Tony is work on a Bluetooth extension for your phone so that all incoming mobile calls are transferred to the incoming queue of Asterisk when your phone is within range. You can also select the mobile as an outgoing trunk.

I got this working once and then killed it and have never got it working properly again but quite a few sites document how to do it.

Comment by Grant17, on 17-Jan-2007 08:08

It's interesting to read about your experiments with VoIP and Asterisk Tony, thanks for posting the details of what you are doing.

If you can get it all working together, you will have the coolest home phone setup in NZ I reckon .

Comment by juha, on 17-Jan-2007 08:38

Rollyerown convergence! Cool stuff.

Author's note by tonyhughes, on 17-Jan-2007 08:47

I figure that there are many people who are interested in getting Asterisk going, who are perfectly technically literate, but perhaps not familiar with Linux etc. I really recommend Trixbox 2.0 as the installation of choice - it provides a web based GUI for most things, and you can still install webmin and whatever else you want.

It runs quite happily in a Microsoft Virtual PC too, so you dont even have to dedicate a box to it. I found that with the limited ram on my laptop, my virtual pc could only dedicate 128MB to the cause, and external trunks worked and sounded fine, but internal asterisk-generated prompts were badly choppy. Neither here nor there for someone who just wants to explore and play, before building a production system on a dedicated box (PIII 500MHz/256MB or higher). My install is taking up just shy of 2GB at the moment.

Comment by sbiddle, on 17-Jan-2007 09:59

Just one other thing for anybody reading this

Is the best guide available for TrixBox (and Asterisk n00bies)

Author's note by tonyhughes, on 17-Jan-2007 10:01


Comment by sbiddle, on 17-Jan-2007 11:25

I'm happy you're getting excited about Asterisk! So many people think Skype = VoIP! :-)

Author's note by tonyhughes, on 17-Jan-2007 12:45

Skype has done a lot to bring VoIP into the minds and homes of people who wouldnt know about it otherwise, but the wonderful world of open standards and opensource, along with SIP providers who provide lots of free services is very appealing.

The likes of WxC in conjunction with Linksys hardware (PAP2Ts etc) make the whole process pretty painless for newbies too.

I cant wait to put this system into production at home.

Comment by Ryan Condon, on 13-Feb-2007 07:51

Tony, I have posted some questions on the Trixbox forum and at Nerd Vittles (gotta love Ward). I also have achieved the detection of the BT device, but I have no idea how to get it in the dial plan. See this link for my description. If you have any idea how to achieve this it would be greatly appreciated! Thanks Ryan

Subscribe To My RSS Feed