android: unregister phone account if startCall fails

This commit is contained in:
Saúl Ibarra Corretgé 2019-11-27 11:57:27 +01:00 committed by Saúl Ibarra Corretgé
parent 0eec182df4
commit 1a3736bf98
1 changed files with 7 additions and 4 deletions

View File

@ -105,13 +105,16 @@ class RNConnectionService extends ReactContextBaseJavaModule {
ConnectionService.registerStartCallPromise(callUUID, promise);
try {
TelecomManager tm
= (TelecomManager) ctx.getSystemService(
Context.TELECOM_SERVICE);
TelecomManager tm = null;
try {
tm = (TelecomManager) ctx.getSystemService(Context.TELECOM_SERVICE);
tm.placeCall(address, extras);
} catch (Exception e) {
JitsiMeetLogger.e(e, TAG + " error in startCall");
if (tm != null) {
tm.unregisterPhoneAccount(accountHandle);
}
ConnectionService.unregisterStartCallPromise(callUUID);
promise.reject(e);
}