Ringback tone
What is a ringback tone?
The ringback tone is a tone which originates from circuit switch old telephone
lines to tell the caller that the phone of the callee is ringing.
It tells you when you call someone, that the phone at the other end is ringing.
For mobile networks, the behaviour is as much other things, well defined, but complex.
While placing a VoLTE call, the ringback tone was missing on postmarketOS/Google Pixel 3a.
2G phone call / circuit-switched call
For 2G/GSM networks, it depends how the network is working and maybe even on the load of the network.
Eeg. a phone is calling a land line, the network can decide to save radio resources, it can assign the phone
the traffic channel for voice data (TCH) only after the other side accepted the call.
However if it does this, there may some lost voice samples, because the network & phone needs some time to establish
the traffic channel.
In this case, the phone has to generate the ringback tone.
But if the network has enough resources, it may assign the phone the traffic channel for voice data early
which improve the user experience, because there isn't the lost audio at the beginning.
4G phone call / VoLTE / packet-switched call
There are no traffic channel to save, but there is bandwidth, even a VoLTE calls uses only a little bit of bandwidth.
VoLTE is based on SIP (Session Initiation Protocol).
For SIP calls, the default case is the ringback tone generation is done on the phone.
There is a special case, called early media, where the network will generate the ringback tone,
but usually this is only used when giving you a custom ringback tone.
Qualcomm basebands
Back to OpenIMSd. When I started to do VoLTE calls with the Pixel 3a or Oneplus 6T, there were no
ringback tone.
Qualcomm basebands has a special TLV for ringback tone generation in the voice call status messages,
I've not yet tested the exact behaviour with 2G networks yet,
but for 4G network, the baseband adds the TLV and tells the user space to generate the ringback tone.
Missing bits and peaces to get ringback tone generation for VoLTE calls
libqmi needs to decode the TLV, the QMI messages are already present, only this TLV wasn't known.
I've created a merge request for libqmi to add it.
ModemManager needs to announce the local ringback via d-bus. Merge request for ModemManager
I'm using phosh with postmarketOS on the device, so gnome-calls is connecting to ModemManager to handle the voice calls.
Thankfully there is already a ringback tone generation for SIP which I could use as well.
Merge Request for gnome-calls