mandatory property
Map<String, Null Function(PitelSipSettings src, PitelSipSettings? dst)>
mandatory
getter/setter pair
Implementation
Map<String, Null Function(PitelSipSettings src, PitelSipSettings? dst)>
mandatory =
<String, Null Function(PitelSipSettings src, PitelSipSettings? dst)>{
'sockets': (PitelSipSettings src, PitelSipSettings? dst) {
List<WebSocketInterface>? sockets = src.sockets;
/* Allow defining sockets parameter as:
* Socket: socket
* List of Socket: [socket1, socket2]
* List of Objects: [{socket: socket1, weight:1}, {socket: Socket2, weight:0}]
* List of Objects and Socket: [{socket: socket1}, socket2]
*/
List<WebSocketInterface> copy = <WebSocketInterface>[];
if (sockets is List && sockets!.isNotEmpty) {
for (WebSocketInterface socket in sockets) {
if (Socket.isSocket(socket)) {
copy.add(socket);
}
}
} else {
throw exceptions.ConfigurationError('sockets', sockets);
}
dst!.sockets = copy;
},
'uri': (PitelSipSettings src, PitelSipSettings? dst) {
dynamic uri = src.uri;
if (src.uri == null && dst!.uri == null) {
throw exceptions.ConfigurationError('uri', null);
}
if (!uri.contains(RegExp(r'^sip:', caseSensitive: false))) {
uri = '${dart_sip_c.SIP}:$uri';
}
dynamic parsed = URI.parse(uri);
if (parsed == null) {
throw exceptions.ConfigurationError('uri', parsed);
} else if (parsed.user == null) {
throw exceptions.ConfigurationError('uri', parsed);
} else {
dst!.uri = parsed;
}
}
};