sendRequest method

OutgoingRequest sendRequest(
  1. SipMethod method,
  2. Map<String, dynamic>? options
)

Implementation

OutgoingRequest sendRequest(SipMethod method, Map<String, dynamic>? options) {
  options = options ?? <String, dynamic>{};
  List<dynamic> extraHeaders = options['extraHeaders'] != null
      ? Utils.cloneArray(options['extraHeaders'])
      : <dynamic>[];
  EventManager eventHandlers =
      options['eventHandlers'] as EventManager? ?? EventManager();
  String? body = options['body'] ?? null;
  OutgoingRequest request = _createRequest(method, extraHeaders, body);

  // Increase the local CSeq on authentication.
  eventHandlers.on(EventOnAuthenticated(), (EventOnAuthenticated event) {
    local_seqnum = local_seqnum! + 1;
  });

  DialogRequestSender request_sender =
      DialogRequestSender(this, request, eventHandlers);

  request_sender.send();

  // Return the instance of OutgoingRequest.
  return request;
}