onTerminated method

void onTerminated(
  1. int callId,
  2. int statusCode
)

Handle teminated call event raised by library (removes call instance from list and notifies UI)

Implementation

void onTerminated(int callId, int statusCode) async {
  _logs?.print('onTerminated callId:$callId statusCode:$statusCode');

  CallModel? call = _findCall(callId);
  if(call != null) {
    String reason = await SiprixVoipSdk().getSipHeader(callId, "Reason") ?? "-";
    _cdrs?.setTerminated(callId, statusCode, reason, call.displName, call.durationStr);

    _callItems.remove(call);
    _logs?.print('Removed call: $callId');

    if(_confModeStarted && !hasConnectedFewCalls()) {
      _confModeStarted = false;
    }

    notifyListeners();
  }
}