void telecomProvider_CallEnded(object sender, LineEventArgs e) { if (e.LineNumber == lineNumber) { try { LoggingService.AddLogEntry(LogLevel.Basic, "(Line " + e.LineNumber + ") Call Ended", false); StopSounds(e.LineNumber); // Add a call history item if (Properties.Settings.Default.EnableCallHistory) { WOSI.CallButler.Data.CallButlerDataset.CallHistoryDataTable callHistoryTable = new WOSI.CallButler.Data.CallButlerDataset.CallHistoryDataTable(); WOSI.CallButler.Data.CallButlerDataset.CallHistoryRow callHistoryItem = callHistoryTable.NewCallHistoryRow(); callHistoryItem.CallDuration = (TimeSpan)(DateTime.Now - callStartTime); callHistoryItem.CallerDisplayName = imlInterp.CallerDisplayName; callHistoryItem.CallerHost = imlInterp.CallerHost; callHistoryItem.CallerUsername = imlInterp.CallerUsername; callHistoryItem.ToUsername = imlInterp.DialedUsername; callHistoryItem.ToHost = imlInterp.DialedHost; callHistoryItem.CallID = Guid.NewGuid(); callHistoryItem.CustomerID = Properties.Settings.Default.CustomerID; callHistoryItem.Timestamp = callStartTime; callHistoryTable.AddCallHistoryRow(callHistoryItem); dataProvider.PersistCallHistory(callHistoryItem); } } catch (Exception ex) { LoggingService.AddLogEntry(LogLevel.ErrorsOnly, "(Line " + lineNumber + ") Unable to add a call history entry: " + ex.ToString(), true); } //UpdateExtensionCall(e.LineNumber, CallStatus.NotOnCall, null, null); //UpdateExtensionCallStatus(CallStatus.NotOnCall); try { if (imlInterp == null) { LoggingService.AddLogEntry(LogLevel.ErrorsOnly, "**** Iml Interpreter is NULL", true); } imlInterp.SignalHangup(); } catch (Exception ex) { LoggingService.AddLogEntry(LogLevel.ErrorsOnly, "(Line " + lineNumber + ") Unable to signal the end of a script: " + ex.ToString(), true); } if (imlInterp.ImlScript == null) { // Automatically unlock our line Locked = false; } callID = Guid.Empty; extension = null; CheckAvailability(); } }