onSelectAnswerReceived method

Future<void> onSelectAnswerReceived(
  1. String? selectedPartyId
)

Implementation

Future<void> onSelectAnswerReceived(String? selectedPartyId) async {
  if (direction != CallDirection.kIncoming) {
    Logs().w('Got select_answer for an outbound call: ignoring');
    return;
  }
  if (selectedPartyId == null) {
    Logs().w(
        'Got nonsensical select_answer with null/undefined selected_party_id: ignoring');
    return;
  }

  if (selectedPartyId != localPartyId) {
    Logs().w(
        'Got select_answer for party ID $selectedPartyId: we are party ID $localPartyId.');
    // The other party has picked somebody else's answer
    await terminate(CallParty.kRemote, CallErrorCode.AnsweredElsewhere, true);
  }
}