call static method

Future<OutgoingCall> call({
  1. required CallRequest callRequest,
  2. CallOptions? options,
})

Makes an outgoing call specified by callRequest to another user of Infobip's WebRTC platform.

Additional call options can be optionally specified.

Implementation

static Future<OutgoingCall> call({required CallRequest callRequest, CallOptions? options}) async {
  if (_token == null) throw const NoTokenError();
  if (callRequest.destination.isEmpty) throw const NoDestinationError();

  String res = await instance._channel.invokeMethod('call',
      {"destination": callRequest.destination, "options": options != null ? jsonEncode(options.toJson()) : null});

  _activeCall = OutgoingCall.fromJson(jsonDecode(res));
  activeCall?.callEventListener = callRequest.callEventListener;
  return activeCall as OutgoingCall;
}