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.

Leave a Reply