Registrator constructor

Registrator(
  1. PitelUA ua, [
  2. Transport? transport
])

Implementation

Registrator(PitelUA ua, [Transport? transport]) {
  int regId = 1; // Force reg_id to 1.

  _ua = ua;
  _transport = transport;

  _registrar = ua.configuration!.registrarServer;
  _expires = ua.configuration!.registerExpires;

  // Call-ID and CSeq values RFC3261 10.2.
  _callId = utils.createRandomToken(22);
  _cseq = 0;

  _toUri = ua.configuration!.uri;

  _registrationTimer = null;

  // Ongoing Register request.
  _registering = false;

  // Set status.
  _registered = false;

  // Contact header.
  _contact = _ua!.contact.toString();

  // Sip.ice media feature tag (RFC 5768).
  _contact += ';+sip.ice';

  // Custom headers for REGISTER and un-REGISTER.
  _extraHeaders = <String>[];

  // Custom Contact header params for REGISTER and un-REGISTER.
  _extraContactParams = '';

  // Custom Contact URI params for REGISTER and un-REGISTER.
  setExtraContactUriParams(ua.configuration!.registerExtraContactUriParams);

  _contact += ';reg-id=$regId';
  _contact += ';+sip.instance="<urn:uuid:${_ua!.configuration!.instanceId}>"';
}