makeCall method

  1. @override
Future<int> makeCall({
  1. required String callee,
  2. required bool sendSdp,
  3. required bool videoCall,
})
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,
}) async {
  final args = {
    'callee': callee,
    'sendSdp': sendSdp,
    'videoCall': videoCall,
  };
  _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;
  }
}