I've built a WebRTC softphone client on android (using React Native) but the service uses proper uris for dialing (not just telephone numbers) so in order to get Connection Service integration we use a PhoneAccount and I set the allowable uri type to include SCHEME_SIP - without it, I can't dial using the tel: uri as it doesn't follow the right format - a UI alert pops up telling me so.
All is good, everything works up until the phone gets rebooted and the PhoneAccount disappears from the list and we can no longer make/receive calls without opening the app up again and enabling the PhoneAccount.
I use a project called react-native-callkeep to handle callkit/connection service and you can see the patch where I added support for SIP uris below.
So yes, all works great until a reboot and adb shows these logs during that reboot.
01-18 17:31:49.827 2435 2435 D SIP : [SipAccountRegistry] verifyAndPurgeInvalidPhoneAccounts, deleting account: ComponentInfo{retracted.app.id/io.wazo.callkeep.VoiceConnectionService}, ***, UserHandle{0}
01-18 17:31:49.829 1520 2898 I Telecom : CallsManager: Sending phone-account ComponentInfo{retracted.app.id/io.wazo.callkeep.VoiceConnectionService}, ***, UserHandle{0} unregistered intent as user: TSI.uPA@AQs
01-18 17:31:49.829 1520 2898 I Telecom : CallsManager: Sending phone-account unregistered intent to default dialer: TSI.uPA@AQs
which after a little googling takes you to...
So if your Phone Account has a SIP Scheme attached to it and you dont have a corresponding SipProfile attached, your calling account/phoneAccount gets deleted... useful.
So I've made a sip profile with the name being the same as the ID of the phone account.... but it looks like it doesnt get saved in the SipProfileDb (referenced in that code)...and then on a reboot of course it isnt in the DB for the check... and we go round in circles. As far as I can see theres no way for me to access that sipPorofileDb and its purely there for accounts made in the Settings UI of the native phone app.
A) can I bring in SipProfileDb into my code and save to it? If this is meant to be done; then why can't I find any docs around this?
B) if I can't what am I missing? The fact I can create a PhoneAccount with a SIP uri enabled on it, for it only to be deleted by the telecom service is super weird and feels like a bug.