Topic: Asterisk, chan_bluetooth, bluez and Headset working together with SIP

Hi lads,

as mentioned earlier in http://forum.openwrt.org/viewtopic.php?id=1650
bluez is working on the Asus WL-500g. I migrated chan_bluetooth for
asterisk to OpenWRT. With this combination you can now receive SIP
calls with your Bluetooth headset with 2 way audio. If this isn't a
cheap wireless SIP phone? With all the power of asterisk, bluez and
openwrt.... Yippie.

Only problem is to dial out from that device. Web Interface might be
an idea...

I'll try to send the patches to wbx this week, if someone shows
interest.

Some output (not faked ;-)) :

[chan_bluetooth.so] => (Bluetooth Channel Driver)
Jan  1 06:05:36 NOTICE[2671]: chan_bluetooth/chan_bluetooth.c:1931 rfcomm_listen: Listening for RFCOMM channel 3 connections on FD 15
Jan  1 06:05:36 NOTICE[2671]: chan_bluetooth/chan_bluetooth.c:1931 rfcomm_listen: Listening for RFCOMM channel 2 connections on FD 16
Jan  1 06:05:36 NOTICE[2671]: chan_bluetooth/chan_bluetooth.c:1975 sco_listen: Listening for SCO connections on FD 17
Jan  1 06:05:36 NOTICE[2671]: chan_bluetooth/chan_bluetooth.c:1827 sdp_register: HeadsetAudioGateway service registered
Jan  1 06:05:36 NOTICE[2671]: chan_bluetooth/chan_bluetooth.c:1877 sdp_register: HeadsetAudioGateway service registered
Jan  1 06:05:36 NOTICE[2671]: chan_bluetooth/chan_bluetooth.c:3211 load_module: Loaded Bluetooth support, Rev: 38 $

[...]

Asterisk Ready.
*CLI> Jan  1 06:05:41 NOTICE[2681]: chan_bluetooth/chan_bluetooth.c:2147 try_connect: Initialised bluetooth link to device AutoBlue
[HS]   AutoBlue > AT+BRSF=24
[HS]   AutoBlue < +BRSF: 23
[HS]   AutoBlue < OK
[HS]   AutoBlue > AT+CIND=?
[HS]   AutoBlue < +CIND: ("service",(0,1)),("call",(0,1)),("callsetup",(0-4))
[HS]   AutoBlue < OK
[HS]   AutoBlue > AT+CIND?
[HS]   AutoBlue < +CIND: 1,0,0
[HS]   AutoBlue < OK
[HS]   AutoBlue > AT+CMER=3, 0, 0, 1
[HS]   AutoBlue < OK
[HS]   AutoBlue > AT+BVRA=1

bluetooth show peers
BDAddr            Name       Role Status      A/C SCOCon/Fd/Th Sig
----------------- ---------- ---- ----------- --- ------------ ---
00:0E:A1:01:49:AE AutoBlue   HS   Ready       Yes -1/-1/0      N/A
*CLI>
[HS]   AutoBlue < +CIEV: 3,1
[HS]   AutoBlue < RING
[HS]   AutoBlue < RING
[HS]   AutoBlue > ATA
[HS]   AutoBlue < +CIEV: 2,1
[HS]   AutoBlue < +CIEV: 3,0
Jan  1 06:07:46 WARNING[2685]: chan_bluetooth/chan_bluetooth.c:578 sco_thread: SCO thread started on fd 28, pid 2685
[HS]   AutoBlue < OK
[HS]   AutoBlue > AT+VGS=11
[HS]   AutoBlue < OK
[HS]   AutoBlue > AT+CHUP
[HS]   AutoBlue < OK
[HS]   AutoBlue < +CIEV: 2,0


Bye, Markus.

Using Asus WL-500g and WL-500gx

Re: Asterisk, chan_bluetooth, bluez and Headset working together with SIP

Has this been submitted yet???

Re: Asterisk, chan_bluetooth, bluez and Headset working together with SIP

You can also use miax (http://sourceforge.net/projects/miax/) for a very small IAX client capable of working with bluetooth too.

Re: Asterisk, chan_bluetooth, bluez and Headset working together with SIP

futaris: the chan_bluetooth module has been commited to CVS (head). Some recent binary packages are available in my testing repository.
As always, feedback is welcome

gdamjan: i'll put miax on my TODO

Re: Asterisk, chan_bluetooth, bluez and Headset working together with SIP

Hi.
Sorry for answering late... but I was implementing some new features....

I was bothered by only being able to answer calls with the current chan_bluetooth. So I implemented a third mode called GUI (the others being AG and HS), which connects to a (Sony Ericsson) mobile and displays a menu there with which you can select a SIP address to call. The SIP address gets called and then the Headset gets called, not the mobile (yet?).

So OpenWRT is now the base for a wireless SIP phone! Isn't that cool?

Binaries are at http://www.comnets.uni-bremen.de/~mab/openwrt/packages/
chan_bluetooth is still integrated into the main asterisk package for me. I'll merge with CVS head ASAP.

For this to work you need modified configuration files:
/etc/asterisk/bluetooth.conf
/etc/asterisk/extensions.conf
/etc/asterisk/sip.conf
/etc/asterisk/modules.conf
/etc/asterisk/manager.conf
Examples are at http://www.comnets.uni-bremen.de/~mab/o … eriskconf/
Where you need to adopt the <TAGS> to your needs.

The headset currently needs the name AutoBlue and needs to be paired before you start asterisk.

Regards, Markus

Using Asus WL-500g and WL-500gx

Re: Asterisk, chan_bluetooth, bluez and Headset working together with SIP

Hi, markushx

very cool with the work which you did for getting this to work on the OpenWRT. I recently had a go at this over the weekend
and I've recently come up against a brickwall.

Equipment - Belkin USB Dongle, ASUS WL-500G, Nokia 6680 & Logitech Freedom Headset (HS02-V07)

1. I've noticed this error message ‘AT+CHLD=?' (+CHLD=?)’ appears when starting asterisk.

2. I’m unable to answer the incomming call via the headset, pushing the answer button does nothing? Although I can hear the ringing tone for the incoming call. smile


My theory is that it's related to the 'Unknown AT command', but as I say it's only a theory.

Any help would be grateful.

Many thanks

gplenty

Ps: Um would it be possible to release the chan_bluetooth with GUI type? Or is this specific to a Sony p900 ?

****Asterisk CLI Output****
1. Asterisk startup
Jan  2 02:29:58 NOTICE[1009]: chan_bluetooth.c:2041 try_connect: Initialised bluetooth link to device Logitech HS02-V07
[HS] Logitech HS02-V07 > AT+BRSF=26
[HS] Logitech HS02-V07 < +BRSF: 23
[HS] Logitech HS02-V07 < OK
Urgent handler
[HS] Logitech HS02-V07 > AT+CIND=?
Urgent handler
[HS] Logitech HS02-V07 < +CIND: ("service",(0,1)),("call",(0,1)),("callsetup",(0-4))
Urgent handler
[HS] Logitech HS02-V07 < OK
Urgent handler
[HS] Logitech HS02-V07 > AT+CIND?
[HS] Logitech HS02-V07 < +CIND: 1,0,0
[HS] Logitech HS02-V07 < OK
Urgent handler
[HS] Logitech HS02-V07 > AT+CMER=3, 0, 0, 1
[HS] Logitech HS02-V07 < OK
Urgent handler
[HS] Logitech HS02-V07 > AT+CHLD=?
Urgent handler
Jan  2 02:29:59 WARNING[1009]: chan_bluetooth.c:2196 process_rfcomm_cmd: Unknown AT Command: 'AT+CHLD=?' (+CHLD=?)
[HS] Logitech HS02-V07 < ERROR
Urgent handler

*****CLI> bluetooth show peers *****
BDAddr            Name       Role Status      A/C SCOCon/Fd/Th Sig
----------------- ---------- ---- ----------- --- ------------ ---
00:0D:44:2F:44:A8 Logitech HS02-V07 HS   Ready       Yes -1/-1/0      N/A


2. 2nd Problem
[HS] Logitech HS02-V07 HS < RING
Urgent handler
[HS] Logitech HS02-V07 HS < RING
Urgent handler
[HS] Logitech HS02-V07 HS < RING
Urgent handler
[HS] Logitech HS02-V07 HS < RING
Urgent handler
[HS] Logitech HS02-V07 HS < RING
Urgent handler
[HS] Logitech HS02-V07 HS < RING
Urgent handler
[HS] Logitech HS02-V07 HS < RING
Urgent handler
Urgent handler
Jan  2 03:17:36 NOTICE[1068]: chan_bluetooth.c:2493 rd_close: Device Logitech HS02-V07 HS disconnected, scheduled reconnect in 5 seconds: Connection timed out (errno 145)
[HS] Logitech HS02-V07 HS < +CIEV: 3,0
Urgent handler

Re: Asterisk, chan_bluetooth, bluez and Headset working together with SIP

gplenty wrote:

1. I've noticed this error message ‘AT+CHLD=?' (+CHLD=?)’ appears when starting asterisk.

My first guess would be, that you have not paired with your headset. Although the "Ready" in "bluetooth show peers" and "Urgent Handler" irritates me.
Try

hcitool cc 00:0D:44:2F:44:A8

and see whether

hcitool conn

reports something like this:
Connections:
        < ACL 00:0A:D9:EB:FD:D8 handle 41 state 1 lm MASTER
(Before you start asterisk.)

For the AT comands see a file called dg_at_2003_r4a.pdf (e.g. at http://gcuervo.spymac.com/docs/dg_at_2003_r4a.pdf ) which is a reference for Sony Ericsson mobiles.
CHLD means something like hold the call.

gplenty wrote:

Ps: Um would it be possible to release the chan_bluetooth with GUI type? Or is this specific to a Sony p900 ?...

https://www.comnets.uni-bremen.de/~mab/ … ooth.mod.c
but at the moment it is only tested with a t610 and your mobile needs to understand AT*EASM commands, which is a SonyEricsson special (I think). But try it and report your results/modifications.

Bye,
m

Using Asus WL-500g and WL-500gx

Re: Asterisk, chan_bluetooth, bluez and Headset working together with SIP

My fault, the chan_bluetooth in CVS was the one from http://www.crazygreek.co.uk/content/chan_bluetooth and not the one from markus, sorry.

This was just fixed in CVS.

Re: Asterisk, chan_bluetooth, bluez and Headset working together with SIP

Hello,

I want to build a GSM gateway with a BT GSM phone that makes VOIP calls. The scenario I want to realize:
1) From a classical GSM phone, make a GSM call to the BT GSM phone;
2) When the BT GSM phone pick up, the user of the classical GSM phone compose a SIP phone number;
3) The BT GSM phone compose the phone number to the SIP provider;
4) The BT GSM phone acts as a voice bridge between the classical GSM phone and SIP call.

I think that the solution could be based on the following chain:

a GSM Phone <-GSM-> a BT GSM Phone <-bt-> asus <-chan_bluetooth-> asterisk <-SIP-> sipprovider

Did someone succeed in setting up such a configuration?
Any advice is welcomed.


Thank you

Michel

Re: Asterisk, chan_bluetooth, bluez and Headset working together with SIP

i can't get this running at all - when asterisk comes to loading chan_bluetooth it core dumps. Can anyone who got this working tell me the exact versions of the software that you used?
bluez seems to work fine otherwise.

Re: Asterisk, chan_bluetooth, bluez and Headset working together with SIP

clarity wrote:

i can't get this running at all - when asterisk comes to loading chan_bluetooth it core dumps. Can anyone who got this working tell me the exact versions of the software that you used?
bluez seems to work fine otherwise.

Hi,

Apparently the chan_bluetooth patch the OpenWRT repository is no longer correct for the currently used version of Asterisk: the patch was originally meant for Asterisk 1.0.9 but does not work for Asterisk 1.2.1 because of an API change in Asterisk. When loading the chan_bluetooth module it makes the Asterisk 1.2.1 process crash. The following patch corrects that:

Index: asterisk-1.0.9-chan_bluetooth.patch
===================================================================
--- asterisk-1.0.9-chan_bluetooth.patch (revision 4637)
+++ asterisk-1.0.9-chan_bluetooth.patch (working copy)
@@ -3153,7 +3153,7 @@
+  struct ast_variable * v;
+  char * cat;
+
-+  cfg = ast_load(BLT_CONFIG_FILE);
++  cfg = ast_config_load(BLT_CONFIG_FILE);
+
+  if (!cfg) {
+    ast_log(LOG_NOTICE, "Unable to load Bluetooth config: %s.  Bluetooth disabled\n", BLT_CONFIG_FILE);

This code could/should actually be in a separate asterisk-1.2.X-chan_bluetooth.patch.
Perhaps you could verify that this works in your environment as well; if needed I can put up a patched binary package asterisk-chan-bluetooth_1.2.1-1_mipsel.ipk.

Regards,

Hans

Re: Asterisk, chan_bluetooth, bluez and Headset working together with SIP

Yes zandbelt, if you wan post the binary package ?

Thanks a lot smile

SeDkY

Re: Asterisk, chan_bluetooth, bluez and Headset working together with SIP

SeDkY wrote:

Yes zandbelt, if you wan post the binary package ?

Thanks a lot smile

It is (temporarily) at:

http://zandbelt.dyndns.org/asterisk-cha … mipsel.ipk

I did not update the version number in anticipation of an actual new release, after which this link will be invalid.

Regards,

Hans.

14 (edited by LoneShadow 2007-08-14 18:14:23)

Re: Asterisk, chan_bluetooth, bluez and Headset working together with SIP

Have you guys been able to make a call from the bluetooth headset ? maybe like press a button and it dials out one number ?

- LS

Re: Asterisk, chan_bluetooth, bluez and Headset working together with SIP

Hello!

I have a wgt634u with kamikaze 7.07 a Jabra A320s bluetooth dongle a Moto H500 and a Nokia 6230i
I set up the bluetooth based on this topic, but I use the original kamikaze ipkg source.

My asterisk gives this error message:

Jan  1 00:01:20 NOTICE[859]: chan_bluetooth.c:2233 rfcomm_listen: Listening for RFCOMM channel 3 connections on FD 13
Jan  1 00:01:20 NOTICE[859]: chan_bluetooth.c:2233 rfcomm_listen: Listening for RFCOMM channel 2 connections on FD 14
Jan  1 00:01:20 NOTICE[859]: chan_bluetooth.c:2233 rfcomm_listen: Listening for RFCOMM channel 4 connections on FD 15
Jan  1 00:01:20 NOTICE[859]: chan_bluetooth.c:2277 sco_listen: Listening for SCO connections on FD 17
Jan  1 00:01:20 NOTICE[859]: chan_bluetooth.c:2129 sdp_register: HeadsetAudioGateway service registered
Jan  1 00:01:20 NOTICE[859]: chan_bluetooth.c:2179 sdp_register: HeadsetAudioGateway service registered
Jan  1 00:01:20 NOTICE[859]: chan_bluetooth.c:3564 load_module: Loaded Bluetooth support, Rev: 6526 $
.................... ]
Asterisk Ready.
*CLI> Jan  1 00:01:22 NOTICE[867]: chan_bluetooth.c:2509 try_connect: RFCOMM connect start.
Jan  1 00:01:22 NOTICE[867]: chan_bluetooth.c:2511 try_connect: RFCOMM connect done.
Jan  1 00:01:22 WARNING[867]: chan_bluetooth.c:2514 try_connect: NBIO connect() to AutoBlue returned 2: No such file or direc
tory
Jan  1 00:01:22 NOTICE[867]: chan_bluetooth.c:2509 try_connect: RFCOMM connect start.
Jan  1 00:01:22 NOTICE[867]: chan_bluetooth.c:2511 try_connect: RFCOMM connect done.
Jan  1 00:01:22 WARNING[867]: chan_bluetooth.c:2514 try_connect: NBIO connect() to Nokia returned 2: No such file or director
y

The devices are paired.

Could you help me?

Thank you!

Re: Asterisk, chan_bluetooth, bluez and Headset working together with SIP

this is patch for "AT+CHLD=?" problem.

several headset needs this at command. for example, motorola s9 and my unknown headset.

this patch is not support 3-way calling.

--- chan_bluetooth.c.orig       2008-06-16 03:26:10.000000000 +0900
+++ chan_bluetooth.c    2008-06-16 03:36:29.000000000 +0900
@@ -1401,6 +1401,20 @@
 /* -- Handle negotiation when we're an AG -- */

 /* Bluetooth Support */
+static int
+atcmd_chld_test(blt_dev_t * dev)
+{
+  send_atcmd(dev, "+CHLD: %d", 0);
+  return 0;
+}
+
+static int
+atcmd_ccwa_set(blt_dev_t * dev, const char * arg,int len)
+{
+  int length;
+  length = write(dev->rd, "\r\nOK\r\n", 6);
+  return (length) ? 0 : -1;
+}

 static int
 atcmd_brsf_set(blt_dev_t * dev, const char * arg, int len)
@@ -1957,6 +1971,8 @@
   { "*EIPS", atcmd_eips_set, NULL,            NULL,                 NULL,             NULL },
   { "+VGS",  atcmd_vgs_set,  NULL,            NULL,                 NULL,             NULL },
   { "+BLDN", NULL,           NULL,            atcmd_bldn_execute,   NULL,             NULL },
+  { "+CHLD", NULL,             NULL,            NULL,              atcmd_chld_test,             NULL },
+  { "+CCWA", atcmd_ccwa_set,           NULL,            NULL,              NULL,             NULL },
 };

 #define ATCMD_LIST_LEN (sizeof(atcmd_list) / sizeof(blt_atcb_t))

Re: Asterisk, chan_bluetooth, bluez and Headset working together with SIP

Great job for you guys. Good luck on the work and i know the output is going to be great. Can't wait for the release.



Regards,
Georgina
placement-financier