From 0305fe7974ddb3bba72b0b4348d45df957e4dd52 Mon Sep 17 00:00:00 2001 From: Robert Long Date: Mon, 26 Jul 2021 11:44:43 -0700 Subject: [PATCH] update incoming call event handler --- src/ConferenceCall.js | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/src/ConferenceCall.js b/src/ConferenceCall.js index f8bddb12..0dfbcde9 100644 --- a/src/ConferenceCall.js +++ b/src/ConferenceCall.js @@ -144,24 +144,16 @@ export class ConferenceCall extends EventEmitter { return; } - // HACK: Horrible hack necessary because callHandler sets opponentMember - // asynchronously before emitting the Call.incoming event. - const pollOpponentMember = () => { - if (call.opponentMember) { - const userId = call.opponentMember.userId; - this._addCall(call, userId); - console.debug( - "_onIncomingCall", - `Answering incoming call ${call.callId} from ${userId}` - ); - call.answer(); - return; - } - - setTimeout(pollOpponentMember, 100); - }; - - pollOpponentMember(); + if (call.opponentMember) { + const userId = call.opponentMember.userId; + this._addCall(call, userId); + console.debug( + "_onIncomingCall", + `Answering incoming call ${call.callId} from ${userId}` + ); + call.answer(); + return; + } }; _addCall(call, userId) {