callPhoneNumber static method

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

Make a call towards a phone number, specified with callRequest.

Additional call options can be optionally specified.

Implementation

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

  String jsonStr = await instance._channel.invokeMethod('callPhoneNumber', {
    "destination": callRequest.destination,
  });

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