cancel method

void cancel(
  1. String? reason
)

Implementation

void cancel(String? reason) {
  // Send only if a provisional response (>100) has been received.
  if (state != TransactionState.PROCEEDING) {
    return;
  }

  OutgoingRequest cancel =
      OutgoingRequest(SipMethod.CANCEL, request.ruri, ua, <String, dynamic>{
    'route_set': request.getHeaders('route'),
    'call_id': request.getHeader('call-id'),
    'cseq': request.cseq
  });

  cancel.setHeader('from', request.getHeader('from'));
  cancel.setHeader('via', request.getHeader('via'));
  cancel.setHeader('to', request.getHeader('to'));

  if (reason != null) {
    cancel.setHeader('reason', reason);
  }

  transport!.send(cancel);
}