chan_btp - Bluetooth Presence Tutorial

Here's a basic tutorial on how to use chan_btp:

This tutorial assumes you have a working copy of btpd and chan_btp is compiled into asterisk. If you don't, grab the latest copy using the svn repository. See http://www.asterisk.org/download for more info.

1) Start the btp daemon by typing 'btpd &'

2) Configure /etc/btpd.conf

report => gus:test1@127.0.0.1:3856 ; where to send reports
discover => no
scan => 00:0E:6D:32:11:20 ; Your bluetooth device address goes here

If you have configured it correctly and your bluetooth device is detected, then you'll see something like this in your console:

Already connected to '00:0E:6D:32:11:20'!
Disconnected from '00:0E:6D:32:11:20'
Didn't find open connection for '00:0E:6D:32:11:20', trying for new one...
Sent connect command to '00:0E:6D:32:11:20', opcode 1029!
Got 4 bytes of setup status!
Got connected to '00:0E:6D:32:11:20'
Got complete on unknown opcode 2061/1, length 6
Got unknown event '1b' with 3 bytes
Time to try to do link quality on '00:0E:6D:32:11:20'!
Requested link quality from '00:0E:6D:32:11:20', op code is 5123
Sending report to '127.0.0.1:3856'
Report: 00:0E:6D:32:11:20 is at 242 (0:09)
Time to try to do link quality on '00:0E:6D:32:11:20'!
Requested link quality from '00:0E:6D:32:11:20', op code is 5123
Sending report to '127.0.0.1:3856'
Report: 00:0E:6D:32:11:20 is at 246 (0:13)


3) Configure /etc/asterisk/btp.conf accordingly

[locators]
locator => gus:test1,SIP/gus ; This should match your user:pass in your btpd.conf

[clients]
client => gus,00:0E:00:16:59:BF,SIP/5555555@yourprovider
In short:

The report line in /etc/btpd.conf ties in with the locators in /etc/asterisk/btp.conf

report => username:password@ip-address:port

ie. report using username and password to the machine at ip address and port

Since my btpd is actually running on the same machine, so I use 127.0.0.1. You can use multiple machines
running btpd that report to a central asterisk box.

4) Configure /etc/asterisk/btp.conf

The locator lines in /etc/asterisk/btp.conf list the usernames/passwords that will be sent
to it from the btpd daemon machines. So you should have one that matches.

locator => username:password,channel-to-use-when-detected

ie. listen for username and password and use channel-to-use-when-detected for calls

Then in the [clients] section you add the device and channel it should use when presence is not detected

client => name-to-use-in-dial-statement,device-id,default-channel-when-is-not-detected

5) Configure extensions.conf

exten => 200,1,Playback(pls-hold-while-try)
exten => 200,2,Dial(BTP/gus,60,m)
exten => 200,3,Hangup

Change it to whatever you want, you get the idea.

If you have any questions or comments, please feel free to post them here. I'd like to thank Andy Powell and Mark Spencer for their help.
Here's a basic tutorial on how to use chan_btp:

This tutorial assumes you have a working copy of btpd and chan_btp is compiled into asterisk. If you don't, grab the latest copy using the svn repository. See http://www.asterisk.org/download for more info.

1) Start the btp daemon by typing 'btpd &'

2) Configure /etc/btpd.conf

report => gus:test1@127.0.0.1:3856 ; where to send reports
discover => no
scan => 00:0E:6D:32:11:20 ; Your bluetooth device address goes here

If you have configured it correctly and your bluetooth device is detected, then you'll see something like this in your console:

Already connected to '00:0E:6D:32:11:20'!
Disconnected from '00:0E:6D:32:11:20'
Didn't find open connection for '00:0E:6D:32:11:20', trying for new one...
Sent connect command to '00:0E:6D:32:11:20', opcode 1029!
Got 4 bytes of setup status!
Got connected to '00:0E:6D:32:11:20'
Got complete on unknown opcode 2061/1, length 6
Got unknown event '1b' with 3 bytes
Time to try to do link quality on '00:0E:6D:32:11:20'!
Requested link quality from '00:0E:6D:32:11:20', op code is 5123
Sending report to '127.0.0.1:3856'
Report: 00:0E:6D:32:11:20 is at 242 (0:09)
Time to try to do link quality on '00:0E:6D:32:11:20'!
Requested link quality from '00:0E:6D:32:11:20', op code is 5123
Sending report to '127.0.0.1:3856'
Report: 00:0E:6D:32:11:20 is at 246 (0:13)


3) Configure /etc/asterisk/btp.conf accordingly

[locators]
locator => gus:test1,SIP/gus ; This should match your user:pass in your btpd.conf

[clients]
client => gus,00:0E:00:16:59:BF,SIP/5555555@yourprovider
In short:

The report line in /etc/btpd.conf ties in with the locators in /etc/asterisk/btp.conf

report => username:password@ip-address:port

ie. report using username and password to the machine at ip address and port

Since my btpd is actually running on the same machine, so I use 127.0.0.1. You can use multiple machines
running btpd that report to a central asterisk box.

4) Configure /etc/asterisk/btp.conf

The locator lines in /etc/asterisk/btp.conf list the usernames/passwords that will be sent
to it from the btpd daemon machines. So you should have one that matches.

locator => username:password,channel-to-use-when-detected

ie. listen for username and password and use channel-to-use-when-detected for calls

Then in the [clients] section you add the device and channel it should use when presence is not detected

client => name-to-use-in-dial-statement,device-id,default-channel-when-is-not-detected

5) Configure extensions.conf

exten => 200,1,Playback(pls-hold-while-try)
exten => 200,2,Dial(BTP/gus,60,m)
exten => 200,3,Hangup

Change it to whatever you want, you get the idea.

If you have any questions or comments, please feel free to post them here. I'd like to thank Andy Powell and Mark Spencer for their help.
Created by: antibala, Last modification: Fri 05 of Nov, 2010 (09:34 UTC) by admin
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+