Testing with oFono Phonesim
SonicDE uses ModemManager for telephony, but the competing oFono stack has a very useful debugging tool. This page describes how to use it to develop telephony features.
Phonesim
Phonesim adds a fake phone modem that can be controlled through a Qt user interface. It can be used to test various parts of a phone's user interface: making and receiving calls, signal strength, sending SMS and so on.
The current stable release of Phonesim is based on Qt 5. On most distributions, you need to compile it yourself from the source code. For a version based on Qt 6, there is this fork. In some cases, you may be able to install ofono-phonesim from your distribution's repository.
To set it up for development:
-
Install oFono.
-
Edit
/etc/ofono/phonesim.confand uncomment everything, so that it looks like this:[phonesim] Address=127.0.0.1 Port=12345 -
Start the oFono daemon:
systemctl start ofono -
Start Phonesim:
./src/phonesim -gui -p 12345 ../src/default.xmlAt first nothing happens. This is fine, as the user interface only appears once the virtual modem is activated.
-
From the oFono source directory, run
./test/enable-modemto bring the modem up. The control window should appear. -
Run
./test/online-modemto activate the modem. -
Install oFono2MM, then reload the available services and restart ModemManager:
systemctl daemon-reload systemctl restart ModemManagerThe running ModemManager is now the fake implementation, based on oFono. To restore the normal ModemManager later, delete
/usr/lib/systemd/system/ModemManager.service.d/10-ofono2mm.conf.
Applications that use ModemManager should now see the fake modem. For example, the upstream Spacebar application can receive SMS. Start spacebar-daemon before spacebar.