optional property

Map<String, Null Function(PitelSipSettings src, PitelSipSettings? dst)> optional
getter/setter pair

Implementation

Map<String, Null Function(PitelSipSettings src, PitelSipSettings? dst)>
    optional =
    <String, Null Function(PitelSipSettings src, PitelSipSettings? dst)>{
  'authorization_user': (PitelSipSettings src, PitelSipSettings? dst) {
    String? authorizationUser = src.authorizationUser;
    if (authorizationUser == null) return;
    if (Grammar.parse('"$authorizationUser"', 'quoted_string') == -1) {
      return;
    } else {
      dst!.authorizationUser = authorizationUser;
    }
  },
  //! sip_domain
  'sip_domain': (PitelSipSettings src, PitelSipSettings? dst) {
    String sipDomain = src.sipDomain;
    dst!.sipDomain = sipDomain;
  },
  'user_agent': (PitelSipSettings src, PitelSipSettings? dst) {
    String userAgent = src.userAgent;
    dst!.userAgent = userAgent;
  },
  'connection_recovery_max_interval':
      (PitelSipSettings src, PitelSipSettings? dst) {
    int connectionRecoveryMaxInterval = src.connection_recovery_max_interval;
    if (connectionRecoveryMaxInterval > 0) {
      dst!.connection_recovery_max_interval = connectionRecoveryMaxInterval;
    }
  },
  'connection_recovery_min_interval':
      (PitelSipSettings src, PitelSipSettings? dst) {
    int connectionRecoveryMinInterval = src.connection_recovery_min_interval;
    if (connectionRecoveryMinInterval > 0) {
      dst!.connection_recovery_min_interval = connectionRecoveryMinInterval;
    }
  },
  'contact_uri': (PitelSipSettings src, PitelSipSettings? dst) {
    dynamic contactUri = src.contactUri;
    if (contactUri == null) return;
    if (contactUri is String) {
      dynamic uri = Grammar.parse(contactUri, 'SIP_URI');
      if (uri != -1) {
        dst!.contactUri = uri;
      }
    }
  },
  'display_name': (PitelSipSettings src, PitelSipSettings? dst) {
    String? displayName = src.displayName;
    if (displayName == null) return;
    dst!.displayName = displayName;
  },
  'instance_id': (PitelSipSettings src, PitelSipSettings? dst) {
    String? instanceId = src.instanceId;
    if (instanceId == null) return;
    if (instanceId.contains(RegExp(r'^uuid:', caseSensitive: false))) {
      instanceId = instanceId.substring(5);
    }
    if (Grammar.parse(instanceId, 'uuid') == -1) {
      return;
    } else {
      dst!.instanceId = instanceId;
    }
  },
  'no_answer_timeout': (PitelSipSettings src, PitelSipSettings? dst) {
    int noAnswerTimeout = src.noAnswerTimeout;
    if (noAnswerTimeout > 0) {
      dst!.noAnswerTimeout = noAnswerTimeout;
    }
  },
  'session_timers': (PitelSipSettings src, PitelSipSettings? dst) {
    bool sessionTimers = src.sessionTimers;
    dst!.sessionTimers = sessionTimers;
  },
  'session_timers_refresh_method':
      (PitelSipSettings src, PitelSipSettings? dst) {
    SipMethod method = src.sessionTimersRefreshMethod;
    if (method == SipMethod.INVITE || method == SipMethod.UPDATE) {
      dst!.sessionTimersRefreshMethod = method;
    }
  },
  'password': (PitelSipSettings src, PitelSipSettings? dst) {
    String? password = src.password;
    if (password == null) return;
    dst!.password = password.toString();
  },
  'realm': (PitelSipSettings src, PitelSipSettings? dst) {
    String? realm = src.realm;
    if (realm == null) return;
    dst!.realm = realm.toString();
  },
  'ha1': (PitelSipSettings src, PitelSipSettings? dst) {
    String? ha1 = src.ha1;
    if (ha1 == null) return;
    dst!.ha1 = ha1.toString();
  },
  'register': (PitelSipSettings src, PitelSipSettings? dst) {
    bool? register = src.register;
    if (register == null) return;
    dst!.register = register;
  },
  'register_expires': (PitelSipSettings src, PitelSipSettings? dst) {
    int? registerExpires = src.registerExpires;
    if (registerExpires == null) return;
    if (registerExpires > 0) {
      dst!.registerExpires = registerExpires;
    }
  },
  'registrar_server': (PitelSipSettings src, PitelSipSettings? dst) {
    dynamic registrarServer = src.registrarServer;
    if (registrarServer == null) return;
    if (!registrarServer.contains(RegExp(r'^sip:', caseSensitive: false))) {
      registrarServer = '${dart_sip_c.SIP}:$registrarServer';
    }
    dynamic parsed = URI.parse(registrarServer);
    if (parsed == null || parsed.user != null) {
      return;
    } else {
      dst!.registrarServer = parsed;
    }
  },
  'register_extra_contact_uri_params':
      (PitelSipSettings src, PitelSipSettings? dst) {
    Map<String, dynamic>? registerExtraContactUriParams =
        src.registerExtraContactUriParams;
    if (registerExtraContactUriParams == null) return;
    dst!.registerExtraContactUriParams = registerExtraContactUriParams;
  },
  'use_preloaded_route': (PitelSipSettings src, PitelSipSettings? dst) {
    bool usePreloadedRoute = src.usePreloadedRoute;
    dst!.usePreloadedRoute = usePreloadedRoute;
  },
  'dtmf_mode': (PitelSipSettings src, PitelSipSettings? dst) {
    DtmfMode dtmfMode = src.dtmfMode;
    dst!.dtmfMode = dtmfMode;
  },
};