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 {},
}) {
  final Call answerCall = getCallOrNull(invite.callID!) ?? _createCall()
    ..callId = invite.callID
    ..sessionCallerName = callerName
    ..sessionCallerNumber = callerNumber
    ..callState = CallState.active
    ..sessionDestinationNumber = invite.callerIdNumber ?? '-1'
    ..sessionClientState = clientState;

  final destinationNum = invite.callerIdNumber;

  answerCall.peerConnection = Peer(txSocket, _debug, this);
  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;
}