acceptCall method

Call acceptCall(
  1. IncomingInviteParams invite,
  2. String callerName,
  3. String callerNumber,
  4. String clientState, {
  5. bool isAttach = false,
  6. Map<String, String> customHeaders = const {},
})

Accepts the incoming call specified via the invite parameter, sending your local specified callerName, callerNumber and clientState

Implementation

Call acceptCall(IncomingInviteParams invite, String callerName,
    String callerNumber, String clientState,
    {bool isAttach = false, Map<String, String> customHeaders = const {}}) {
  Call answerCall = getCallOrNull(invite.callID!) ?? _createCall();
  answerCall.callId = invite.callID;

  answerCall.sessionCallerName = callerName;
  answerCall.sessionCallerNumber = callerNumber;
  answerCall.callState = CallState.active;
  answerCall.sessionDestinationNumber =
      invite.callerIdName ?? "Unknown Caller";
  answerCall.sessionClientState = clientState;

  var destinationNum = invite.callerIdNumber;

  answerCall.peerConnection = Peer(txSocket);
  answerCall.peerConnection?.accept(callerName, callerNumber, destinationNum!,
      clientState, answerCall.callId!, invite, customHeaders, isAttach);
  answerCall.callHandler.changeState(CallState.active, answerCall);
  answerCall.stopAudio();
  if (answerCall.callId != null) {
    updateCall(answerCall);
  }
  return answerCall;
}