Skip to content

Commit

Permalink
Merge pull request #1630 from famedly/karthi/handle-getusermedia-exce…
Browse files Browse the repository at this point in the history
…ption

fix: set cid before initWithInvite to properly end call on getUserMedia exception
  • Loading branch information
td-famedly authored Dec 4, 2023
2 parents c24b329 + 0811b89 commit 03ade55
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/src/voip/voip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,15 @@ class VoIP {
await delegate.playRingtone();
}

// When getUserMedia throws an exception, we handle it by terminating the call,
// and all this happens inside initWithInvite. If we set currentCID after
// initWithInvite, we might set it to callId even after it was reset to null
// by terminate.
currentCID = callId;

await newCall.initWithInvite(
callType, offer, sdpStreamMetadata, lifetime, confId != null);

currentCID = callId;

// Popup CallingPage for incoming call.
if (confId == null && !newCall.callHasEnded) {
await delegate.handleNewCall(newCall);
Expand Down

0 comments on commit 03ade55

Please sign in to comment.