call method
Creates a new VICall instance and starts the outgoing call.
number
- The call destination that might be
Voximplant username, phone number or SIP URI. Actual routing is then
performed by a VoxEngine scenario.
Optional settings
- Additional call parameters like video direction
for the call, preferred video codec, custom data.
Throws VIException, if the client is not logged in, otherwise returns VICall instance.
Errors:
- VICallError.ERROR_CLIENT_NOT_LOGGED_IN - If the client is not logged in
- VICallError.ERROR_MISSING_PERMISSION - Android only. If permissions are not granted for the call: audio calls - RECORD_AUDIO video calls - RECORD_AUDIO and CAMERA
Implementation
Future<VICall> call(String number, {VICallSettings? settings}) async {
try {
if (settings == null) {
settings = VICallSettings();
}
Map<String, dynamic>? data = await _channel
.invokeMapMethod<String, dynamic>('Client.call', <String, dynamic>{
'number': number,
'sendVideo': settings.videoFlags.sendVideo,
'receiveVideo': settings.videoFlags.receiveVideo,
'videoCodec': settings.preferredVideoCodec.toString(),
'customData': settings.customData,
'extraHeaders': settings.extraHeaders,
'conference': false,
});
if (data == null) {
_VILog._e('VIClient: call: data was null, skipping');
throw VIException(
VIClientError.ERROR_INTERNAL,
'VIClient:call: data was null',
);
}
VICall call = VICall._(data['callId'], _channel);
return call;
} on PlatformException catch (e) {
throw VIException(e.code, e.message);
}
}