callStateChanged method
void
callStateChanged(
- Call call,
- CallState state
)
Implementation
@override
void callStateChanged(Call call, CallState state) {
// Reset incoming call flag if this is a new call
if (_currentCall?.id != call.id) {
_lastShownCallId = null;
debugPrint('📞 New call detected, resetting CallKit UI flag');
}
_currentCall = call;
_callState = state;
debugPrint('═══════════════════════════════════════');
debugPrint('📞 SIP CALL STATE CHANGED');
debugPrint('═══════════════════════════════════════');
debugPrint('🔄 State: ${state.state}');
debugPrint('📱 Direction: ${call.direction}');
debugPrint('📞 Call ID: ${call.id}');
debugPrint('📞 Call Info: ${call.toString()}');
debugPrint('═══════════════════════════════════════');
// Print detailed call status
_printCallStatus(call, state);
onCallStateChanged?.call(state);
// Handle call events (fire and forget since callback is sync)
_handleCallState(state).catchError((e) {
debugPrint('Error handling call state: $e');
});
}