startOutgoingCall static method

Future<void> startOutgoingCall({
  1. required String callerName,
  2. required String callerId,
  3. String? avatar,
})

Start an outgoing call

Implementation

static Future<void> startOutgoingCall({
  required String callerName,
  required String callerId,
  String? avatar,
}) async {
  try {
    final callId = uuid.v4();
    debugPrint('VoIP: Starting outgoing call - ID: $callId');

    final params = CallKitParams(
      id: callId,
      nameCaller: callerName,
      appName: 'VoIP Test',
      avatar: avatar ?? '',
      handle: callerId,
      type: 0,
      duration: 30000,
      extra: <String, dynamic>{'userId': callerId},
      headers: <String, dynamic>{'apiKey': 'Abc123', 'platform': 'flutter'},
      android: const AndroidParams(
        isCustomNotification: true,
        isShowLogo: false,
        ringtonePath: 'system_ringtone_default',
        backgroundColor: '#0955fa',
        backgroundUrl: 'https://i.pravatar.cc/300',
        actionColor: '#4CAF50',
      ),
      ios: const IOSParams(
        handleType: 'generic',
        supportsVideo: true,
        maximumCallGroups: 2,
        maximumCallsPerCallGroup: 1,
        audioSessionMode: 'videoChat',
        audioSessionActive: true,
      ),
    );

    await FlutterCallkitIncoming.startCall(params);
    debugPrint('VoIP: Outgoing call started successfully');
  } catch (e, stackTrace) {
    _printException('Start Outgoing Call', e, stackTrace);
    rethrow;
  }
}