/// <summary> /// Destroy call. Calculate call duration time, edit call log, destroy session. /// </summary> public override void Destroy() { // stop tones & timers StopAllTimers(); MediaProxy.stopTone(); // Calculate timing if (true == Counting) { Duration = DateTime.Now.Subtract(Time); } Counting = false; // update call log if (((Type != ECallType.EDialed) || (CallingNumber.Length > 0)) && (Type != ECallType.EUndefined)) { CallLoger.addCall(Type, CallingNumber, CallingName, Time, Duration); CallLoger.save(); } // reset data CallingNumber = ""; Incoming = false; ChangeState(EStateId.IDLE); if (null != _manager) { _manager.DestroySession(Session); } }
/// <summary> /// Destroy call. Calculate call duration time, edit call log, destroy session. /// </summary> public override void Destroy() { // stop tones & timers StopAllTimers(); Task.Factory.StartNew(() => MediaProxy.stopTone(), TaskCreationOptions.PreferFairness); // Calculate timing if (true == Counting) { Duration = DateTime.Now.Subtract(Time); } Counting = false; // reset data CallingNumber = ""; Incoming = false; ChangeState(EStateId.IDLE); if (null != _manager) { _manager.DestroySession(Session); } }