How to get PulseAudio echo-cancel to work with Ofono

pulseaudio

I'm trying to turn a small embedded device into a fully functional A2DP+HFP receiver.

I've got everything working, but I'm really having trouble figuring out how to get the module-echo-cancel to work with ofono

Here is what I have:
– PulseAudio 7.1
– Ofono 1.15

I'm running a headless system, so everything is run under the root user.

I have tried loading the module-echo-cancel from the config file, and the module loads, but when I make a call a new sink and a new source is added and the module-echo-cancel is not automatically added to them.

I have tried manually loading the module-echo-cancel after the call is established and the new sink and source is added. This does create a new virtual echo_cancelled source and sink, but it's only sitting IDLE and then gets suspended, the sound still goes through the initially created sink/source.

Listing the modules after the connection is established shows me this:

Module #21
        Name: module-loopback
        Argument: source=bluez_source.30_5A_3A_19_C0_5B.echo-cancel sink_dont_move=true source_output_properties=media.role=phone
        Usage counter: n/a
        Properties:
                module.author = "Pierre-Louis Bossart"
                module.description = "Loopback from source to sink"
                module.version = "7.1"

Module #22
        Name: module-loopback
        Argument: source=bluez_source.30_5A_3A_19_C0_5B source_dont_move=true sink_input_properties=media.role=phone
        Usage counter: n/a
        Properties:
                module.author = "Pierre-Louis Bossart"
                module.description = "Loopback from source to sink"
                module.version = "7.1"

If I try to unload this modules, load the echo-cancel module and then load the loopback module the sound gets bounced back to the phone instead of being heard from the devices speakers.

I have tried to do, but didn't helped either:

PULSE_PROP="filter.want=echo-cancel" ofonod

Any suggestion on how can I enable the echo-cancellation for Ofono?

Thank you.

Best Answer

Not sure if this helps, but if nobody else has an idea:

I have a Jolla Sailphone which is Linux based, making use of Pulseaudio and Ofono.

The audio setup is complex and I don't completely understand it. Among other things, it uses module-intended-roles to assign role properties (e.g. phone, music), routing tables in /etc/pulse and probably other stuff I haven't discovered yet.

At the end of /etc/pulse/default.pa, there are the following lines:

### Modules to allow autoloading of filters (such as echo cancellation)
### on demand. module-filter-heuristics tries to determine what filters
### make sense, and module-filter-apply does the heavy-lifting of
### loading modules and rerouting streams.
load-module module-filter-heuristics
load-module module-filter-apply

so I assume these modules activate echo cancellation. Having a look at the source of those modules may give some hints of proper usage.

Related Question