conference method

Future<VICall> conference(
  1. String conference, {
  2. VICallSettings? settings,
})

Creates a new VICall instance and starts the conference.

conference - The call destination. For SIP compatibility reasons it should be a non-empty string even if the number itself is not used by a Voximplant cloud 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:

Implementation

Future<VICall> conference(
  String conference, {
  VICallSettings? settings,
}) async {
  try {
    if (settings == null) {
      settings = VICallSettings();
    }
    Map<String, dynamic>? data = await _channel
        .invokeMapMethod<String, dynamic>('Client.call', <String, dynamic>{
      'number': conference,
      'sendVideo': settings.videoFlags.sendVideo,
      'receiveVideo': settings.videoFlags.receiveVideo,
      'videoCodec': settings.preferredVideoCodec.toString(),
      'customData': settings.customData,
      'extraHeaders': settings.extraHeaders,
      'conference': true,
      'enableSimulcast': settings.enableSimulcast,
    });
    if (data == null) {
      _VILog._e('VIClient: conference: data was null, skipping');
      throw VIException(
        VIClientError.ERROR_INTERNAL,
        'VIClient:conference: data was null',
      );
    }
    VICall call = VICall._(data['callId'], _channel);
    return call;
  } on PlatformException catch (e) {
    throw VIException(e.code, e.message);
  }
}