diff --git a/lib/src/voip/voip.dart b/lib/src/voip/voip.dart index fc836e23..dc26ef3d 100644 --- a/lib/src/voip/voip.dart +++ b/lib/src/voip/voip.dart @@ -197,18 +197,18 @@ class VoIP { content['offer']['sdp'], content['offer']['type'], ); - await newCall - .initWithInvite( - callType, offer, sdpStreamMetadata, lifetime, confId != null) - .then((_) { - // Popup CallingPage for incoming call. - if (!delegate.isBackgroud && confId == null) { - delegate.handleNewCall(newCall); - } - onIncomingCall.add(newCall); - }); + await newCall.initWithInvite( + callType, offer, sdpStreamMetadata, lifetime, confId != null); + currentCID = callId; + // Popup CallingPage for incoming call. + if (!delegate.isBackgroud && confId == null) { + delegate.handleNewCall(newCall); + } + + onIncomingCall.add(newCall); + if (delegate.isBackgroud) { /// Forced to enable signaling synchronization until the end of the call. client.backgroundSync = true;