register method Null safety
- String username,
- {String? type,
- bool? sendRegister,
- bool? forceUdp,
- bool? forceTcp,
- bool? sips,
- bool? rfc2543Cancel,
- bool? refresh,
- String? secret,
- String? ha1Secret,
- String? authuser,
- String? displayName,
- String? userAgent,
- String? proxy,
- String? outboundProxy,
- Map<
String, dynamic> ? headers, - List<
Map< ? contactParams,String, dynamic> > - List<
String> ? incomingHeaderPrefixes, - String? masterId,
- int? registerTtl}
Register client to sip server
username
: SIP URI to register
type
: if guest or helper, no SIP REGISTER is actually sent; optional
sendRegister
: true|false; if false, no SIP REGISTER is actually sent; optional
Implementation
Future<void> register(
String username, {
String? type,
bool? sendRegister,
bool? forceUdp,
bool? forceTcp,
bool? sips,
bool? rfc2543Cancel,
bool? refresh,
String? secret,
String? ha1Secret,
String? authuser,
String? displayName,
String? userAgent,
String? proxy,
String? outboundProxy,
Map<String, dynamic>? headers,
List<Map<String, dynamic>>? contactParams,
List<String>? incomingHeaderPrefixes,
String? masterId,
int? registerTtl,
}) async {
var payload = {
"request": "register",
"type": type,
"send_register": sendRegister,
"force_udp":
forceUdp, //<true|false; if true, forces UDP for the SIP messaging; optional>,
"force_tcp":
forceTcp, //<true|false; if true, forces TCP for the SIP messaging; optional>,
"sips":
sips, //<true|false; if true, configures a SIPS URI too when registering; optional>,
"rfc2543_cancel":
rfc2543Cancel, //<true|false; if true, configures sip client to CANCEL pending INVITEs without having received a provisional response first; optional>,
"username": username,
"secret": secret, //"<password to use to register; optional>",
"ha1_secret":
ha1Secret, //"<prehashed password to use to register; optional>",
"authuser":
authuser, //"<username to use to authenticate (overrides the one in the SIP URI); optional>",
"display_name":
displayName, //"<display name to use when sending SIP REGISTER; optional>",
"user_agent":
userAgent, //"<user agent to use when sending SIP REGISTER; optional>",
"proxy":
proxy, //"<server to register at; optional, as won't be needed in case the REGISTER is not goint to be sent (e.g., guests)>",
"outbound_proxy":
outboundProxy, //"<outbound proxy to use, if any; optional>",
"headers":
headers, //"<object with key/value mappings (header name/value), to specify custom headers to add to the SIP REGISTER; optional>",
"contact_params":
contactParams, //"<array of key/value objects, to specify custom Contact URI params to add to the SIP REGISTER; optional>",
"incoming_header_prefixes":
incomingHeaderPrefixes, //"<array of strings, to specify custom (non-standard) headers to read on incoming SIP events; optional>",
"refresh":
refresh, //"<true|false; if true, only uses the SIP REGISTER as an update and not a new registration; optional>",
"master_id":
masterId, //"<ID of an already registered account, if this is an helper for multiple calls (more on that later); optional>",
"register_ttl":
registerTtl, //"<integer; number of seconds after which the registration should expire; optional>"
}..removeWhere((key, value) => value == null);
JanusEvent response = JanusEvent.fromJson(await this.send(data: payload));
JanusError.throwErrorFromEvent(response);
}