in bluez, free software, profusion

Handsfree Profile into BlueZ and oFono

I’m proud to announce that BlueZ and oFono now support the Handsfree role of the Bluetooth Handsfree profile. This means that your Desktop now can now act like a headset bluetooth and handle calls from your cell phone.  The work was done during the last 2 months here at ProFUSION.

On the BlueZ side a new API was designed using the fd-passing feature of DBus 1.3.  This new API uses the concept of Agents where oFono plays the Agent role.  In the HFP case the Agent role is to handle the AT engine stuff while BlueZ will only take care of the RFCOMM and SCO connections.

The RFCOMM socket is passed to the Agent in oFono via DBus, then oFono uses it to send and receive the AT commands to establish a Service Level Connection, i. e., make the handshake procedure. If it succeeds oFono will be ready to make and answers calls. Your HFP enabled phone will show up as a  modem in oFono, like any other oFono modem.

The work was initially based on patches from Zhenhua Zhang(from Intel) and the audio interaction to handle the SCO data inside Pulseaudio was done by João Paulo Rechi Vita(from ProFUSION too). He also did the demo video below.

After pairing the devices using some BlueZ agent like kbluetooth or gnome-bluetooth, you’ll be able to see the modem in oFono and you can enable it ( i. e., make the handshake procedure to establish an HFP Service Level Connection) using the enable-modem script from the test directory on oFono source.

In order to test this you need the Audio Gateway interface enabled in BlueZ. For that, edit your /etc/bluetooth/audio.conf  and add “Enable=Gateway” to it.

HFP code is already merged upstream on the BlueZ and oFono trees. The API is described in doc/hfp-api.txt in BlueZ source.

  1. Hello,

    Thanks for the great work on ofono.

    I’d like to use this without PA, I want my own application to have access to the SCO socket and events so my app can write/read the raw audio (PCM I assume?).

    I am kind of clueless about where to configure things.

    I already set Enable=Gateway in /etc/bluetooth/audio.conf, which I assume is read by bluetoothd when starts. However, how does it know which cell phone to use? assuming I have more than one?

    The idea is to have several cell phones available to place and receive calls and bridge the audio to wherever I want to.

    Any guide lines will be appreciated

  2. oFono can handle multiple phones, and to have a clue on how to get the audio look to the bluetooth module inside pulseaudio.

  3. Does it work with Android mobile phone?

    Most mobile phone support Handsfree Profile, but unfortunately only AudioGateway role. I’m trying to find a solution for both. If it works with Android phone, then I can use it as a Bluetooth headset.

    If it doesn’t, how to make it work?

  4. and I can see the HFAG service available with “sdptool browse local”. I want to connect an handsfree audio device (like car kit) to the Linux box as audio gateway, while peeking the AT Commands from the RFCOMM channel. Unfortunately I can’t find the API from the documentation. Is there any Shell command like pppd, hcidd, dund…? I want to make use of the AT command to activate some other application.

  5. I have a requirement in android gingerbread version.
    I need to support my android mobile in handsfree role.

    i heared about ofono project. is it available for android ?
    where i can get the ofonod for android gingerbread ?

  6. i am using
    * bluez 4.96
    * the following changes are made in the audio.conf file in /etc/bluetoothaudio Gatweway = Enabled HFP = true
    * Ubuntu version tried on 11.04 and 11.10
    * x86 processor.

    I am able to connect to the system, but only a moment. It is not stable and gets disconnected by itself automatically.
    please help me to overcome this problem

  7. i want to set my device as handsfree role in HFP on Android2.3 with BlueZ4.69, and how to use ofono?
    does ofono supported on android?
    thanks for your guide
    be appreciated

  8. Hi LiWenyan,

    I am also looking for ofono supported on android, And here i had also asked the same question a long time ago but din’t get any reply from the website owners..

    So please let me know if you get any solution.

    my id is

Comments are closed.