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 {},
}) {
final Call inviteCall = _createCall()
..sessionCallerName = callerName
..sessionCallerNumber = callerNumber
..sessionDestinationNumber = destinationNumber
..sessionClientState = clientState;
customHeaders = customHeaders;
inviteCall.callId = const Uuid().v4();
final base64State = base64.encode(utf8.encode(clientState));
updateCall(inviteCall);
inviteCall.peerConnection = Peer(inviteCall.txSocket, _debug, this);
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;
}