using System.Collections.Generic;
Dictionary<int, Call> m_calls = new Dictionary<int, Call>();
private Settings m_settings = new Settings();
public Call FindOrCreateCall(int _id)
if (!m_calls.TryGetValue(_id, out Call call))
call = new Call(DateTime.Now);
public void CloseByTimeoutCalls()
foreach (var call in m_calls.Values)
if (DateTime.Now -call.CallCreateTime > m_settings.MaxCallDuration)
public DateTime CallCreateTime { get; }
public Call(DateTime _callCreateTime)
CallCreateTime = _callCreateTime;
public TimeSpan MaxCallDuration => TimeSpan.FromHours(4);