Joseph Tanner
2006-Jan-19 15:32 UTC
[Asterisk-Users] Cannot compile chan_bluetooth on Asterisk 1.2.1
The short of it: I am unable to compile chan_bluetooth on Asterisk 1.2.1 on CentOS 4.2. I installed using the Asterisk@Home 2.2 iso. Server is a plain Celeron 2.93GHz box. Asterisk source is in /usr/src/asterisk, newest chan_bluetooth source is in /usr/src/asterisk-test/bluetooth/chan_bluetooth (I have two older versions in other directories). Steps taken: Followed the instructions here to a T: http://www.crazygreek.co.uk/content/chan_bluetooth. Basically, edit /usr/src/asterisk/channels/Makefile adding chan_bluetooth.so to CHANNEL_LIBS, and at the very bottom adding include /usr/src/asterisk-test/bluetooth/chan_bluetooth/Makefile. First tried the version by David Woodhouse, exact command used to download was "cvs -d :pserver:anoncvs at cvs.infradead.org:/home/cvs co chan_bluetooth". Also tried the version at http://www.crazygreek.co.uk/data/pages/chan_bluetooth/latest.tar.gz. Lastly, wanted to try a newer version of Theo's code on the SVN server, which was down. Google helped me find r40 at http://rock.inode.at/ROCK-2.1/c/chan_bluetooth-r40.tar.bz2. Using the newest version (by David Woodhouse) gives me this error: make[1]: Entering directory `/usr/src/asterisk/channels' gcc -shared -Xlinker -x -o chan_bluetooth.so /usr/src/asterisk-test/bluetooth/chan_bluetooth/chan_bluetooth.o -lbluetooth gcc: /usr/src/asterisk-test/bluetooth/chan_bluetooth/chan_bluetooth.o: No such file or directory make[1]: *** [chan_bluetooth.so] Error 1 make[1]: Leaving directory `/usr/src/asterisk/channels' make: *** [subdirs] Error 1 Using an older version will at least try to compile, but giving many errors. I found by using the Makefile from an older version with the newest, it also tries to compile but with errors as well. The only difference I see in the Makefile is using a .tmp directory in the chan_bluetooth directory in order to compile. Here's the end of the error using that Makefile (I'd post the entire error, but it fills up the buffer and I can't copy it all, let me know if you need more than I posted): /usr/src/asterisk-test/bluetooth/chan_bluetooth/chan_bluetooth.c: In function `load_module': /usr/src/asterisk-test/bluetooth/chan_bluetooth/chan_bluetooth.c:3210: error: `sdp_session_t' undeclared (first use in this function) /usr/src/asterisk-test/bluetooth/chan_bluetooth/chan_bluetooth.c:3210: error: `sess' undeclared (first use in this function) /usr/src/asterisk-test/bluetooth/chan_bluetooth/chan_bluetooth.c:3221: warning: implicit declaration of function `hci_open_dev' /usr/src/asterisk-test/bluetooth/chan_bluetooth/chan_bluetooth.c:3227: warning: implicit declaration of function `hci_read_voice_setting' /usr/src/asterisk-test/bluetooth/chan_bluetooth/chan_bluetooth.c:3228: warning: implicit declaration of function `htobs' /usr/src/asterisk-test/bluetooth/chan_bluetooth/chan_bluetooth.c:3244: warning: implicit declaration of function `hci_devba' /usr/src/asterisk-test/bluetooth/chan_bluetooth/chan_bluetooth.c:3248: error: `BDADDR_LOCAL' undeclared (first use in this function) /usr/src/asterisk-test/bluetooth/chan_bluetooth/chan_bluetooth.c:3248: error: `SDP_RETRY_IF_BUSY' undeclared (first use in this function) make[1]: *** [/usr/src/asterisk-test/bluetooth/chan_bluetooth/.tmp/chan_bluetooth.o] Error 1 make[1]: Leaving directory `/usr/src/asterisk/channels' make: *** [subdirs] Error 1 [root@asterisk1 asterisk]# I have also tried a few things, moving the include statement up in the Makefile, adding #define ASTERISK_VERSION_NUM 010201 to the top of chan_bluetooth.c (also used 010200, and 000000). In /usr/src/asterisk/include/asterisk/version.h, it kept being set to 000000, I had to edit the Makefile in /usr/src/asterisk to force it to 010201 (after trying it with the 000000 value first, of course). When compiling Asterisk, I will do a make clean then make. When making minor changes I would just do a make clean in /usr/src/asterisk/channels then a make in /usr/src/asterisk. The two errors above were after doing a complete make clean in /usr/src/asterisk, then a make. Hopefully I gave enough information, if I missed anything let me know. Thank you.
Joseph Tanner
2006-Jan-20 13:43 UTC
[Asterisk-Users] Cannot compile chan_bluetooth on Asterisk 1.2.1
Ok, I did get this going (somewhat), and in case someone else has the same issues I'll detail what I had to do. First, I was using the instructions at http://mundy.org/blog/index.php?p=79. They stated that Asterisk@Home 2.2 already had all the rpms necessary for bluetooth and that I could skip the yum install step. I did, however, run the command anyways after a few failed attempts. There's an error in the rpm name, they tell you to install bluez-libs, the correct name is bluez-libs-devel (at least, that's what I needed to install). I still couldn't compile the newest cvs version of chan_bluetooth, so I again tried my trick of using the Makefile from an older version (which used .tmp to compile) and it worked! Once compiled, I installed and started up asterisk. I then received a message on my phone asking if I wanted to allow asterisk to connect, and then asked for a pin. This took a bit of figuring out, but I got passed that. In /etc/bluetooth/hcid.conf, there's a line that says "pin_helper /usr/bin/bluepin;" (it may have a different path, the important thing is the pin_helper part). Now backup the script in question, i.e. in my case mv /usr/bin/bluepin /usr/bin/bluepin.bak. Use your editor of choice to create a new file with the same name, and in it enter: #!/bin/sh -e echo "PIN:1234" Replace the 1234 with whatever you want your pin to be. I don't know if this is necessary, but I also edited /etc/bluetooth/pin to read: 1234 Again, 1234 should be whatever you want your pin to be. I then stopped asterisk, stopped the bluetooth service, started the bluetooth service back up, started asterisk, then when my phone asked for a pin I put in 1234, and it worked! You may also need to make another edit to hcid.conf, under Local Device Class change it to read class "0x200404;" or possibly "class 0x700408;". This makes your bluetooth dongle look like a headset, and not a data device (I experienced some flakiness until I changed this). Now, I edited /etc/asterisk/bluetooth.conf appropriately (changed the channel for the phone to 7, it's a Motorola V551), started it all up, made some test calls and...no audio! The cellphone works great otherwise. It'll connect, stay connected as long as I want it to, and when I hang up the asterisk extension the cellphone will disconnect too. Too bad I didn't realize 611 was a free call until after I made a lot of test calls (it's a prepaid phone). I did call our home number directly to see if maybe I just had a one-way audio problem, but nobody could hear a thing on either end. I will continue to troubleshoot this before I ask another question about it, but it's not looking good. BTW, the usb dongle I'm using is a Linksys USBBT100.