connect method
Places new call using raw parameters passed directly to Twilio's REST API endpoint 'makeCall'. Returns true if successful, false otherwise.
extraOptions
will be added to the callPayload sent to your server
See twilio_js.Device.connect
Implementation
@override
Future<bool?> connect({Map<String, dynamic>? extraOptions}) async {
assert(device != null, "Twilio device is null, make sure you have initialized the device first by calling [ setTokens({required String accessToken, String? deviceToken}) ] ");
Logger.logLocalEvent("Making new call with Connect");
// handle parameters
final params = <String, String>{};
extraOptions?.forEach((key, value) {
params[key] = value.toString();
});
try {
final callParams = js_util.jsify(params);
final options = twilio_js.DeviceConnectOptions(params: callParams);
final promise = _device!.connect(options);
nativeCall = await js_util.promiseToFuture(promise);
_attachCallEventListeners(_jsCall!);
} catch (e) {
printDebug("Failed to place call: $e");
return false;
}
return true;
}