newInvite method

void newInvite(
  1. String callerName,
  2. String callerNumber,
  3. String destinationNumber,
  4. String clientState, {
  5. Map<String, String> customHeaders = const {},
})

Creates an invitation to send to a destinationNumber or SIP Destination using the provided callerName, callerNumber and a clientState

Implementation

void newInvite(String callerName, String callerNumber,
    String destinationNumber, String clientState,
    {Map<String, String> customHeaders = const {}}) {
  sessionCallerName = callerName;
  sessionCallerNumber = callerNumber;
  sessionDestinationNumber = destinationNumber;
  sessionClientState = clientState;
  customHeaders = customHeaders;
  callId = const Uuid().v4();
  var base64State = base64.encode(utf8.encode(clientState));

  peerConnection = Peer(_txSocket);
  peerConnection?.invite(callerName, callerNumber, destinationNumber,
      base64State, callId!, _sessid, customHeaders);
  //play ringback
  playAudio(ringBackFile);
}