Zimans, how is latency with your prog? I have quite a bit of delay but I suspect that's because aplay might be buffering it a little before playing it. Or maybe the pipe is buffering it. Anybody know how to prevent a pipe from buffering?
Zimans, could you tell me what I need to compile your app? Not sure if I have all the correct libs.
Do you possibly have a x86 binary?
Thanks in advance.
Zimans, how is latency with your prog? I have quite a bit of delay but I suspect that's because aplay might be buffering it a little before playing it. Or maybe the pipe is buffering it. Anybody know how to prevent a pipe from buffering?
The lib you are probably missing is libiax. You need to get the version from svn at digium, as the released libiax is depreciated.
here is the svn link. (Or should be)
svn co http://svn.digium.com/svn/libiax2/trunk/
Also, I forgot to include an example conf file.
biax.conf
it looks for /usr/etc/biax.conf
I can only guess, but I believe my app is pretty quick. Asterisk sends me 320 bytes at a time, so I buffer and send 320 bytes at a time in return. This makes asterisk happier than sending smaller chunks. 320 bytes = 50ms.
FYI Sco data comes in chunks of 48 bytes. I buffer what I get from asterisk and send 48 bytes for every 48 bytes I get from the phone. Asterisk really handles all the timing.
When I called my GF's phone using the setup, there was a delay between 0.5 and 1 second. But there are alot of sources of delay in the chain (PAP2, Asterisk, Phone Network, GSM network) WHen I make regular calls it really is no different then when I'm talking on the phone normally).
--Zims
--------------------------------------------------------------------------------
Now, Where are my Pants?
Hey everybody!!
I am also interested in using my pc as a handsfree with bluetooth!!
So far i get connection with my mobile phone but my sound seems to have some kind of problems because i get the next result;
[root@wireless-10-12-9-46 handsfree]# ./handsfree 00:16:75:99:4d:61 8
Voice setting: 0x0060
RFCOMM channel connected
sending.cmd AT+BRSF=31
poll descriptors count 1
poll descriptors count 1
>>
+MBAN: Copyright 2000-2002 Motorola, Inc.
+BRSF: 63
OK
boo.
sending.cmd AT+CIND=?
>>
+CIND: ("Voice Mail",(0,1)),("service",(0,1)),("call",(0,1)),("Ro am",(0-2)),("signal",(0-5)),("callsetup",(0-3)),("smsfull",(0,1))
OK
sending.cmd AT+CIND?
>>
+CIND: 0,1,0,1,5,0,0
OK
sending.cmd AT+CMER=3,0,0,1
>>
OK
sending.cmd AT+CMER=3,0,0,1
>>
OK
sending.cmd AT+CLIP=1
>>
OK
sending.cmd AT+NREC=0
>>
OK
sending.cmd AT+CHLD=?
>>
+CHLD: (0,1,1x,2,2x,3,4)
OK
0005 0005 0005 0005 0005 0005 0005 0005 0005 0005 0005 0005 0005 0005 0005 0005 0005 0005 0005 0005 0005 0005 0005 0005
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
maxbuf: 2730
0 0 0 0 0 0 0 0 960 0 0 0 0 0 0 0
indicator 0
check: total 960, middle 960, fraction 100 % val 1
adj=0
.run
write to audio interface failed (Too many open files)
.run
write to audio interface failed (Invalid cross-device link)
0 0 0 0 0 0 0 0 936 0 0 0 0 0 0 0
.run
write to audio interface failed (Invalid cross-device link)
.run
write to audio interface failed (Device or resource busy)
.run
write to audio interface failed (Not a directory)
.run
write to audio interface failed (Invalid cross-device link)
.run
write to audio interface failed (Not a directory)
.run
write to audio interface failed (Too many open files)
lost sco audio connection (-1 107)!
listening s set up.
At the end of this process i check my mobile phone and it is said that the phone is connected to a handsfree device. However if i make a phone call the only thing i get from the prompt is that i had a "Segmentation fault".
Any idea of what could be wrong? i am working with mandriva 2007 and i checked my alsa drivers.
Yes, that's exactly what I got. So I commented out all of the alsa-related calls and instead just wrote the sco data to /tmp/audioOut (which I created with mkfifo). Then I did aplay -f S16_LE /tmp/audioOut, and I can hear audio, albeit with some lag and random crashes.
Rewriting this may have to wait a few days, as I just got a new car yesterday (03 passat glx) and will have to play around with it a little...
Thanks to you all, I have handsfree connecting to my phone now. It appears as though an active connection is required for 'hcitool con' to return any data for my phone. To be honest, I have not used handsfree since I had originally attempted back at the beginning of December. Now, after simply running 'handsfree [address] [channel]', my phone connected, Bluetooth icon appears on the phone. In terms of audio, I get tones (ie pressing buttons), but audio playback doesn't come through. Still looking into that.
To get this to work, all I did was place the command 'sdptool add hf' in my local initialization script, configured hcid.conf, and started the Bluetooth init script. Then simply executed handsfree as above.
I am using gentoo as well, with bluez-utils 2.25-r1, bluez-libs 2.25, and a 2.6.19-rc5 kernel. I am beginning to think an update to bluez is what got this to work better. I did not make any changes to the code, nor did I 'mkfifo /tmp/ctrl' yet. Also, it seems there is a lot of Bluetooth in the kernel now, and that the latest kernel patch is for 2.6.19, though I did a quick grep and think I don't have the latest patch. 2.6.20-rc6-mm3 does however have the latest patch, but I haven't compiled this kernel yet.
In the meantime, I've been attempting to setup DUN via Sprint, but haven't had enough time yet.
This is great how many people are interested in using Bluetooth on Linux, and the potential for progress seems great.
Thanks gentoocar!
I did mkfifo /tmp/audioOut and aplay -f U8 /tmp/audioOut but i still get the next result ( i am just posting the most relevant part so it is not too long):
sending.cmd AT+CHLD=?
>>
+CHLD: (0,1,1x,2,2x,3,4)
OK
fff7 fff8 fff8 fffb fffd ffff 0000 0001 0002 fff1 fff3 fff5 fff6 fff7 fff8 fffa fffc fffe 0000 0001 0002 fff0 fff2 fff4
-9 -8 -8 -5 -3 -1 0 1 2 -15 -13 -11 -10 -9 -8 -6 -4 -2 0 1 2 -16 -14 -12
maxbuf: 2730
0 0 0 0 0 0 0 0 960 0 0 0 0 0 0 0
indicator 0
check: total 960, middle 960, fraction 100 % val 1
adj=0
0 0 0 0 0 0 0 0 936 0 0 0 0 0 0 0
lost sco audio connection (-1 107)!
listening s set up.
I am using U8 because i think is the pcm code way of coding the audio. You used S16_LE, i also tried with this one but i even get more errors.
So any idea how to solve this lost sco sudio connection?
Thanks a lot !!
What Bluetooth chips are people using?
I have a Broadcom based adapter and I needed to patch the kernel to get SCO audio out to work. I could receive audio, but not send.
Just an FYI as people troubleshoot.
--Zims
--------------------------------------------------------------------------------
Now, Where are my Pants?
It's great to see so many people interested in this. I think I will create a SF site tonight to host this project. Any ideas for a name? I was thinking "Handsfree 2" but that's a little lackluster...
Bookmarks