send method

void send()

Create the client transaction and send the message.

Implementation

void send() {
  EventManager handlers = EventManager();
  handlers.on(EventOnRequestTimeout(), (EventOnRequestTimeout event) {
    _eventHandlers.emit(event);
  });
  handlers.on(EventOnTransportError(), (EventOnTransportError event) {
    _eventHandlers.emit(event);
  });
  handlers.on(EventOnAuthenticated(), (EventOnAuthenticated event) {
    _eventHandlers.emit(event);
  });
  handlers.on(EventOnReceiveResponse(), (EventOnReceiveResponse event) {
    _receiveResponse(event.response!);
  });

  switch (_method) {
    case SipMethod.INVITE:
      clientTransaction =
          InviteClientTransaction(_ua, _ua.transport!, _request!, handlers);
      break;
    case SipMethod.ACK:
      clientTransaction =
          AckClientTransaction(_ua, _ua.transport!, _request!, handlers);
      break;
    default:
      clientTransaction = NonInviteClientTransaction(
          _ua, _ua.transport!, _request!, handlers);
  }

  clientTransaction.send();
}