-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue concurrent call SIM/Twilio with ConnectionService #345
Comments
We don't have an OnePlus device with us to reproduce the issue. Have you tried the same scenario with another VOIP app i.e. FB messenger , Skype, WhatsApp? That way you can confirm if the issue is with your app or the phone app on the device. I also wanted to point out there seems to be issues with the phone app in OnePlus devices, below are few from their community page :
Please specify the make/model of the Samsung devices that have the same issue. We have recently released AudioSwitch, a new Android library for managing audio routing in real-time communication apps. This library enables:
The QS app uses this library. You can refer to this PR for the changes required to adopt this library. Let us know if this change resolves the audio focus issue. |
Hello @kbagchiGWC So I've tried the AudioSwitch lib, it's working pretty well on Samsung devices even with concurrent calls (Twilio vs SIM), however the issue persists with OnePlus devices |
Hey @Fgabz Glad to know that AudioSwitch is working well for you! I wanted to follow up on trying these steps on a OnePlus device with WhatsApp, FB Messenger, or Skype to see if the behavior is the same. This would help our triaging efforts. Thanks! |
Hey @aaalaniz ! We tried with WhatsApp, FB Messenger and Signal App, unfortunately, they blocked the ability to do this (either they end the app call or block the ability to start one) and I'm not using Skype, so I wasn't able to try it. However I tried with this app https://play.google.com/store/apps/details?id=com.onoffapp.app&hl=en and got the same issue we got with our app |
Hey @Fgabz I was reading more about
The article seems to explicitly exclude this use case (even though the call being on hold is not mentioned as in the previous bullet). Nevertheless, these constraints may explain why this behavior is not supported in other commonly used calling apps. Does ending the call versus holding the call significantly impact your use case? Thanks! |
Actually the documentation is not very clear on this point because from what we tried It's possible and it's working pretty well and it's handled by the default phone APP UI/UX as a normal concurrent call like two SIM calls (we can switch from one to call to another from default phone APP UI/UX) I think what the documentation is saying is that we can't have two ongoing calls at the same time (meaning a kind of conference call) Also on Samsung and Pixel phones, it's working well. It might be an issue with OnePlus devices on how they're focusing audio input It's really important for us to be able to handle this use case. For now, we disabled this feature on all OnePlus devices but we would like to avoid that since it's impacted a lot of our users. Also another error that is showing during a concurrent call:
|
If you want to try on your device (I assume it will work if you don't have a OnePlus) We have pretty much the same configuration on our app. |
Hey @Fgabz We don't have a OnePlus device on hand, but our data shows that the OnePlus 6 would be a good representative of field devices. Do you know if the issue is reproducible on this device? Is this issue reproducible on all OnePlus devices or just a subset? We can order a device and investigate. However, in the meantime, I recommend ending the PSTN call on OnePlus devices instead of putting on hold (as you have already done). Also, have you tried filing an issue with google? They will be able to provide more insight into the expected behavior of applications that use ConnectionService. I agree that the documentation could be more explicit about putting ongoing PSTN calls on hold and how that impacts VoIP app calls. Thanks! |
Hello @aaalaniz! You will be able to reproduce the error on the OnePlus6. We tried different devices from OnePlus 3 to OnePlus 7, and they all show the same audio input issue. In the meantime, I'll fill a bug in their issue tracker to get more insight from Google. Thanks! |
Hello @aaalaniz! Were you able to test the use case on a OnePlus ? Thanks! |
Hi @Fgabz We got a OnePlus Device and will try to reproduce the issue and see if there is a workaround. We will keep you posted on our findings. Thanks. |
Hi @Fgabz We experimented with the OnePlus 6 device and wanted to share some of our findings. We have realized that the behavior differs based on how the VoIP application is integrated with ConnectionService. Following is the use case you described :
We can easily reproduce the audio experience described here, if the VoIP app does not integrate incoming call with We have also experimented with the VoIP app when the incoming call is integrated with We need some clarifications :
Thanks. |
Hello @kbagchiGWC and thanks for your help! So what we did:
As a reminder the sound is working(we can hear the caller) but the voice recording isn't working meaning that the caller can't hear the app, but as soon as we are ending the SIM call everything works (the caller can hear us). I've put some error logs here, that we can see only when there is a SIM call holding with an ongoing VOIP call. It might be related. 0-07-21 12:24:59.916 799-7495/? E/audio_hw_primary: start_input_stream: pcm_prepare returned -1 |
Hi @Fgabz We found the behavior explained below different during our testing because the SIM call goes on hold as soon as the the VoIP call is answered.
public Connection onCreateIncomingConnection(PhoneAccountHandle connectionManagerPhoneAccount, ConnectionRequest request) {
Connection incomingCallConnection = createIncomingConnection(request);
incomingCallConnection.setConnectionCapabilities(Connection.CAPABILITY_HOLD);
incomingCallConnection.setConnectionCapabilities(Connection.CAPABILITY_MUTE);
........
return incomingCallConnection;
}
Thanks. |
I'll try tomorrow the code above and share my findings at the same time. |
Hello @kbagchiGWC So what I did and found:
The phoneaccount is provided this way
The connection object =>
The registration =>
How the call is added to phone stack =>
|
Hello @kbagchiGWC and sorry for the delay, Here an example of call made with a OnePlus 6T CAbb72bcc189a3ca149b1d9e3842b82318 |
Is this the only device that has the issue? We are not able to reproduce the issue using our OnePlus 6 test device. |
@kbagchiGWC the issue is on all OnePlus we tested(6T to 7T). |
Thanks for the information. Unfortunately we are not able to suggest a fix as we can't reproduce the issue on the OnePlus 6T we have. We will work on a quickstart example with ConnectionService that may help to debug the issue. In the mean time can you share your implementation of how you are passing the Twilio incoming call to ConnectionService?
|
Sure @kbagchiGWC `val isAlreadyInCall = telecomManagerProvider.isAlreadyInCall()
|
@kbagchiGWC any news on the ConnectionService sample? |
Hi @Fgabz (and @4brunu). I've been transitioning a library to the native Android "callkit" i.e. myBundle.containsKey(Constants.INCOMING_CALL_INVITE) or var ci: CallInvite? = null
// ...
ci = myBundle.getParcelable<CallInvite>(Constants.INCOMING_CALL_INVITE) /// next problem arrives over here In your example/provided code, it seems you're passing the QuestionTo confirm, were you successful in "getting" the My attempt below, results in a SnippetsBelow I present 2 key snippets:
In this second snippet, I have 2 comments showing where the problem occurs. File: private fun handleFCMCallInvite(callInvite: CallInvite, notificationId: Int) {
// Get telecom manager
val telecomManager = getSystemService(TELECOM_SERVICE) as TelecomManager
// Get PhoneAccountHandle
val caller = callInvite.from!!.toString()
val componentName = ComponentName(applicationContext.packageName, TwilioVoiceConnectionService::class.java.name)
val phoneAccountHandle = PhoneAccountHandle(componentName, caller)
// Create my Bundle containing information e.g. notificationId and callInvite
val myBundle = Bundle()
myBundle.putParcelable(Constants.INCOMING_CALL_INVITE, callInvite)
myBundle.putInt(Constants.INCOMING_CALL_NOTIFICATION_ID, notificationId)
// Add new incoming call to the telecom manager
telecomManager.addNewIncomingCall(phoneAccountHandle, Bundle().apply {
putBundle(EXTRA_INCOMING_CALL_EXTRAS, myBundle)
putParcelable(EXTRA_PHONE_ACCOUNT_HANDLE, phoneAccountHandle)
})
} File: override fun onCreateIncomingConnection(connectionManagerPhoneAccount: PhoneAccountHandle?, request: ConnectionRequest?): Connection {
super.onCreateIncomingConnection(connectionManagerPhoneAccount, request)
Log.d(TAG, "onCreateIncomingConnection")
val connection: Connection = VoipConnection(applicationContext)
connection.extras = request?.extras
var ci: CallInvite? = null
val myBundle: Bundle? = connection.extras.getBundle(TelecomManager.EXTRA_INCOMING_CALL_EXTRAS);
if(myBundle != null) {
Log.d(TAG, "onCreateIncomingConnection: myBundle is not null")
if (myBundle.containsKey(Constants.INCOMING_CALL_INVITE) ) {
Log.d(TAG, "onCreateIncomingConnection: myBundle contains INCOMING_CALL_INVITE")
ci = myBundle.getParcelable<CallInvite>(Constants.INCOMING_CALL_INVITE)
} else {
Log.d(TAG, "onCreateIncomingConnection: myBundle does not contain INCOMING_CALL_INVITE")
}
} else {
Log.d(TAG, "onCreateIncomingConnection: myBundle is null")
}
// ...
// return VoipConnection(...)
} Hi @kbagchiGWC, maybe you (or a fellow colleague) could provide some insight into this issue (I'm assuming I may be missing something): The above results in the following exception:
Libraries, etc
|
Hey @cybex-dev, I think I got the same issue that you have, and the problem from what I can remember is that you can't pass a parcelable to with the key So what I ended up doing is converting the parcelable that I want to pass there to a json string, and passing the string itself instead of the parcelable. Something like this.
Then on the method Hope it helped. |
Hi @4brunu Thanks for getting back - I came across this thread, it was quite helpful. ProblemI found the solution, the issue was disjointed from Twilio, well-documented in #561. To quote from @afalls-twilio :
CauseThis set me on the right track, the Voice SDK's ClassLoader seemed to be initialised (set) on the wrong thread. Solutionvar ci: CallInvite? = null
val myBundle: Bundle? = connection.extras.getBundle(TelecomManager.EXTRA_INCOMING_CALL_EXTRAS);
// Add class loader for CallInvite
myBundle.classLoader = CallInvite::class.java.classLoader Though it resolves the immediate problem, a solution (long-term) is as @afalls-twilio suggests, to capture the loader where it was initialised. |
It seems, that the issue is in SIM card carrier. I have similar issue, but with Google Pixel 3/7. Here is the details. Google recommends to not allow 3d party app place calls while there is GSM call for such operators. Unfortunately, Google did not list all of such operators. |
Issue concurrent call SIM/Twilio with ConnectionService
Hello,
We're building an app using the Twilio SDK however, we faced some issues with the microphone when there is a concurrent call between SIM and Twilio.
The app is not able to get the focus of the microphone, even if the SIM call is holding
We faced the issue on all OnePlus devices and on Samsung devices we had to manually call
audioManager.mode = AudioManager.MODE_IN_COMMUNICATION
right after answering the callHave you faced the same problem while using ConnectionService
(I've looked in https://github.com/kbagchiGWC/voice-quickstart-android/tree/connection_service_example_makecall to find answer, but didn't find anything that could help us)?
And is there a solution to fix this?
Logs showing:
OpenSLESRecorder: Bad OpenSL ES record timing
Device Model
OnePlus
The text was updated successfully, but these errors were encountered: