newInvite method
using the provided callerName
, callerNumber
and a clientState
Implementation
Call newInvite(String callerName, String callerNumber,
String destinationNumber, String clientState,
{Map<String, String> customHeaders = const {}}) {
Call inviteCall = _createCall();
inviteCall.sessionCallerName = callerName;
inviteCall.sessionCallerNumber = callerNumber;
inviteCall.sessionDestinationNumber = destinationNumber;
inviteCall.sessionClientState = clientState;
customHeaders = customHeaders;
inviteCall.callId = const Uuid().v4();
var base64State = base64.encode(utf8.encode(clientState));
updateCall(inviteCall);
inviteCall.peerConnection = Peer(inviteCall.txSocket);
inviteCall.peerConnection?.invite(
callerName,
callerNumber,
destinationNumber,
base64State,
inviteCall.callId!,
inviteCall.sessid,
customHeaders);
//play ringback tone
inviteCall.playAudio(ringBackpath);
inviteCall.callHandler.changeState(CallState.newCall, inviteCall);
return inviteCall;
}