dtmf method

void dtmf(
  1. String tone
)

Sends a DTMF message with the chosen tone to the call specified via the callID

Implementation

void dtmf(String tone) {
  final uuid = const Uuid().v4();
  final dialogParams = DialogParams(
    attach: false,
    audio: true,
    callID: callId,
    callerIdName: sessionCallerName,
    callerIdNumber: sessionCallerNumber,
    clientState: sessionClientState,
    destinationNumber: sessionDestinationNumber,
    remoteCallerIdName: '',
    screenShare: false,
    useStereo: false,
    userVariables: [],
    video: false,
  );

  final infoParams = InfoParams(
    dialogParams: dialogParams,
    dtmf: tone,
    sessid: sessid,
  );

  final dtmfMessageBody = DtmfInfoMessage(
    id: uuid,
    jsonrpc: JsonRPCConstant.jsonrpc,
    method: SocketMethod.info,
    params: infoParams,
  );

  final String jsonDtmfMessage = jsonEncode(dtmfMessageBody);
  txSocket.send(jsonDtmfMessage);
}