Closed beinghassandar1 closed 2 years ago
@beinghassandar1
How are you creating the Call
object thats used to mute? The native library needs to be loaded before the native functions can be called. The log snippet indicates the library was not loaded when mute
was called. Can you share the code snippet?
@kbagchiGWC
We initialize the Twilio instance when app is opened. After that, to create the call,
private void connectCall(FragmentActivity context, String contactNo, String token) {
Map<String, String> params = new HashMap<>();
params.put("To", contactNo);
ConnectOptions connectOptions = new ConnectOptions.Builder(token)
.params(params)
.build();
accessToken = token;
mAudioManager.setSpeakerphoneOn(true);
activeCallConnection = Voice.connect(context, connectOptions, new TwilioCallConnectionListener(context, this));
}
To Mute/Unmute the call
if (activeCallConnection != null) {
activeCallConnection.mute(mute);
}
Voice.connect()
is one of the methods in the SDK that checks if the native library is loaded or not. If not loaded, it initiates the loading of the twilio_voice_android_s
library. If your code is calling methods on the Call
object returned from the Voice.connect()
immediately, the library may not have completed loading yet. Once the library loads, this kind of linking error should not happen. My guess is that the library was not loaded when the following code block is executed.
if (activeCallConnection != null) {
activeCallConnection.mute(mute);
}
Do you know the Call.State
of activeCallConnection
when activeCallConnection.mute(mute)
is called? To confirm the library is loaded prior to calling mute(...)
you can check if the activeCallConnection
is in Call.State.RINGING
or Call.State.CONNECTED
state.
Interesting. I was checking this state for when we send digits like this
if (activeCallConnection != null && activeCallConnection.getState() == Call.State.CONNECTED) {
activeCallConnection.sendDigits(digit);
}
I'll add this for Mute function too.
Closing this due to inactivity.
Description
Hello. I am using Twilio voice SDK and there is this issue that keeps happening on some devices.
[Description of the issue]
Steps to Reproduce
After Call is established, mute the mic.
Code
Expected Behavior
[What you expect to happen]
Actual Behavior
[What actually happens]
Reproduces How Often
Once a week
[What percentage of the time does it reproduce?]
Twilio Call SID(s)
You can find the Call SID in the SDK using Call.getSid() or CallInvite.getCallSid(). The Call SID can also be found on the Twilio Calls Console: https://www.twilio.com/console/voice/calls/logs.
Logs
com.twilio.voice.Call.nativeMute Call.java com.twilio.voice.Call.mute Call.java:1159 communication.twilio.TwilioComManager.setMicMute TwilioComManager.java:849 communication.fragments.TwilioCallingFragment.setUpMicSpeakerUi TwilioCallingFragment.java:243 communication.fragments.TwilioCallingFragment.setCallAcceptedUI TwilioCallingFragment.java:619 communication.fragments.TwilioCallingFragment.incomingCallAccepted TwilioCallingFragment.java:583 communication.twilio.TwilioComManager.acceptIncomingCall TwilioComManager.java:548 communication.fragments.TwilioCallingFragment.onClick TwilioCallingFragment.java:368 android.view.View.performClick View.java:7472 android.view.View.performClickInternal View.java:7445 android.view.View.access$3600 View.java:820 android.view.View$PerformClick.run View.java:28533 android.os.Handler.handleCallback Handler.java:938 android.os.Handler.dispatchMessage Handler.java:99 android.os.Looper.loop Looper.java:268 android.app.ActivityThread.main ActivityThread.java:8073 java.lang.reflect.Method.invoke Method.java com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run RuntimeInit.java:627 com.android.internal.os.ZygoteInit.main ZygoteInit.java:997
Versions
All relevant version information for the issue.
Voice Android SDK
'com.twilio:voice-android:6.0.1'
OS Version
Android 9 But we did get this crash on Android 11 too.
Device Model
Huawei nova 3i