makeCall method
Future<int>
makeCall({
- required String callee,
- required bool sendSdp,
- required bool videoCall,
- bool reportToConnectionService = true,
- String? displayName,
override
Initiates an outgoing call.
Invokes the native 'makeCall' method via MethodChannel.
Returns session ID on success, -1 or error code on failure. Note: Android returns Long (64-bit), iOS returns Int. We use dynamic to handle both and convert to Dart int.
Implementation
@override
Future<int> makeCall({
required String callee,
required bool sendSdp,
required bool videoCall,
bool reportToConnectionService = true,
String? displayName,
}) async {
final args = {
'callee': callee,
'sendSdp': sendSdp,
'videoCall': videoCall,
'reportToConnectionService': reportToConnectionService,
if (displayName != null) 'displayName': displayName,
};
_logCall('makeCall', args);
try {
// Use dynamic to handle both Long (Android) and Int (iOS)
final result = await methodChannel.invokeMethod<dynamic>(
'makeCall',
args,
);
final sessionId = (result as num?)?.toInt() ?? -1;
_logResponse('makeCall', sessionId);
return sessionId;
} on PlatformException catch (e) {
_logError('makeCall', e);
return -1;
}
}