makeCall static method
Make SIP call
Implementation
static Future<void> makeCall(String targetUri) async {
try {
if (_sipHelper == null) {
throw Exception('SIP service not initialized');
}
if (_registrationState?.state != RegistrationStateEnum.REGISTERED) {
throw Exception('Not registered. Please register first.');
}
debugPrint('═══════════════════════════════════════');
debugPrint('📞 SIP CALL OUTGOING');
debugPrint('═══════════════════════════════════════');
debugPrint('Target URI: $targetUri');
debugPrint('═══════════════════════════════════════');
// Ensure target URI has sip: prefix
final uri = targetUri.startsWith('sip:') ? targetUri : 'sip:$targetUri';
// Make call
debugPrint('📞 Initiating SIP call to: $uri');
await _sipHelper!.call(uri, voiceOnly: true);
debugPrint('✅ SIP: Call initiated successfully');
debugPrint('📞 Waiting for call state updates...');
} catch (e, stackTrace) {
_printException('Make Call', e, stackTrace);
rethrow;
}
}