private void XmlStation_StationCallChanged(object sender, StationCallChangedEventArgs arg) { /* string station = arg.StationCall.CallConnection.DeviceID.ID;*/ // may hien tai //string a = arg.StationCall.CallAppearance.ToString(); string b = arg.StationCall.CallerDN; // nguoi goi string c = arg.StationCall.CalledDN; // nguoi nghe string d = arg.StationCall.CallState.ToString(); //string w = arg.StationCall.CallEvents[0].ToString(); string e = arg.StationCall.CallDirection.ToString(); // huong goi vao //string r = arg.StationCall.CallMembers[0].ToString(); //co cuoc goi toi switch ((int)arg.StationCall.CallState) { // thong bao case (int)enCallState.Alerting: incoming_call_id = arg.StationCall.CallConnection.CallID.ToString(); txtIncoming.Text = "Incoming: " + arg.StationCall.CallerDN; txtStatus.Text = "Ringing"; log.Info("--Call Recieved from: " + arg.StationCall.CallerDN + " to " + arg.StationCall.CalledDN); call_type = CallType.AnswerCall; btnPlaceCall.Enabled = true; btnDrop.Enabled = true; btnHold.Enabled = false; btnTransfer.Enabled = false; btnConference.Enabled = false; break; // bat may case (int)enCallState.Connected: txtStatus.Text = "Connected"; log.Info("--Having conversation between: " + arg.StationCall.CallerDN + " and " + arg.StationCall.CalledDN); callTimer.Start(); btnPlaceCall.Enabled = false; btnDrop.Enabled = true; btnHold.Enabled = true; btnTransfer.Enabled = true; btnConference.Enabled = true; break; // cup may case (int)enCallState.Idle: log.Info("--End conversation between: " + arg.StationCall.CallerDN + " and " + arg.StationCall.CalledDN + "\n Duration: " + lblCallTimer.Text); xmlStation.AgentSetState(enReqAgentState.ready, comm.agentID, comm.agentPassword, enWorkMode.WM_AUTO_IN, 0); break; // goi di case (int)enCallState.Connecting: incoming_call_id = arg.StationCall.CallConnection.CallID.ToString(); txtStatus.Text = "Connecting"; log.Info("--Is connecting with: " + arg.StationCall.CalledDN); btnPlaceCall.Enabled = false; btnDrop.Enabled = true; btnHold.Enabled = false; btnTransfer.Enabled = false; btnConference.Enabled = false; txtIncoming.Text = "Out-going: " + arg.StationCall.CalledDN; txtbDialNumber.Clear(); break; // hold case (int)enCallState.Hold: holdTimer.Start(); callTimer.Stop(); txtStatus.Text = "Holding"; log.Info("--Hold conversation between: " + arg.StationCall.CallerDN + " and " + arg.StationCall.CalledDN); break; } }
private static void PrintEventToLog(StationCallChangedEventArgs arg) { try { Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("ITNVPluginPlayMsg:TelephonyEventHandler arg.CallEvent.CallEventType=" + arg.CallEvent.CallEventType + " begin ===>"); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("ITNVPluginPlayMsg:TelephonyEventHandler arg.StationCall.CallAppearance=" + arg.StationCall.CallAppearance); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("ITNVPluginPlayMsg:TelephonyEventHandler arg.StationCall.CallConnection.CallID=" + arg.StationCall.CallConnection.CallID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("ITNVPluginPlayMsg:TelephonyEventHandler arg.StationCall.CallConnection.DeviceID.ID=" + arg.StationCall.CallConnection.DeviceID.ID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("ITNVPluginPlayMsg:TelephonyEventHandler arg.StationCall.CallConnection.DeviceID.Type=" + arg.StationCall.CallConnection.DeviceID.Type); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("ITNVPluginPlayMsg:TelephonyEventHandler arg.StationCall.CallDirection=" + arg.StationCall.CallDirection); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("ITNVPluginPlayMsg:TelephonyEventHandler arg.StationCall.CalledDN=" + arg.StationCall.CalledDN); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("ITNVPluginPlayMsg:TelephonyEventHandler arg.StationCall.CallerDN=" + arg.StationCall.CallerDN); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("ITNVPluginPlayMsg:TelephonyEventHandler arg.StationCall.CallFlag=" + arg.StationCall.CallFlag); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("ITNVPluginPlayMsg:TelephonyEventHandler arg.StationCall.CallMembers.Count=" + arg.StationCall.CallMembers.Count); for (int i = 0; i < arg.StationCall.CallMembers.Count; i++) { Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("ITNVPluginPlayMsg:TelephonyEventHandler arg.StationCall.CallMembers[" + i + "].MemberDN=" + arg.StationCall.CallMembers[i].MemberDN); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("ITNVPluginPlayMsg:TelephonyEventHandler arg.StationCall.CallMembers[" + i + "].TypeOfNumber=" + arg.StationCall.CallMembers[i].TypeOfNumber); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("ITNVPluginPlayMsg:TelephonyEventHandler arg.StationCall.CallMembers[" + i + "].IsListenHeld=" + arg.StationCall.CallMembers[i].IsListenHeld); } Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("ITNVPluginPlayMsg:TelephonyEventHandler arg.StationCall.CallState=" + arg.StationCall.CallState); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("ITNVPluginPlayMsg:TelephonyEventHandler arg.StationCall.ConferencePendingState=" + arg.StationCall.ConferencePendingState); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("ITNVPluginPlayMsg:TelephonyEventHandler arg.StationCall.Key=" + arg.StationCall.Key); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("ITNVPluginPlayMsg:TelephonyEventHandler arg.StationCall.TransferPendingState=" + arg.StationCall.TransferPendingState); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("ITNVPluginPlayMsg:TelephonyEventHandler arg.StationCall.UCID=" + arg.StationCall.UCID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("ITNVPluginPlayMsg:TelephonyEventHandler arg.StationCall.UUI=" + arg.StationCall.UUI); } catch { } switch (arg.CallEvent.CallEventType) { case AgileSoftware.Developer.Device.enCallEventType.CSTADelivered: try { Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("CSTADelivered------------>"); CSTADeliveredEventArgs argdel = arg.CallEvent.EventInfo as CSTADeliveredEventArgs; try { Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("AlertingDevice.ID: " + argdel.AlertingDevice.ID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("AlertingDevice.Type: " + argdel.AlertingDevice.Type); } catch { } try { Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("CalledDevice.ID: " + argdel.CalledDevice.ID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("CalledDevice.Type: " + argdel.CalledDevice.Type); } catch { } try { Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("CallingDevice.ID: " + argdel.CallingDevice.ID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("CallingDevice.Type: " + argdel.CallingDevice.Type); } catch { } try { Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("Connection.CallID: " + argdel.Connection.CallID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("Connection.DeviceID: " + argdel.Connection.DeviceID.ID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("Connection.DeviceID: " + argdel.Connection.DeviceID.Type); } catch { } Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("EventCause: " + argdel.EventCause); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("GlobalCallLinkageID: " + argdel.GlobalCallLinkageID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("InvokeID: " + argdel.InvokeID); try { Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("LastRedirectionDevice.ID: " + argdel.LastRedirectionDevice.ID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("LastRedirectionDevice.Type: " + argdel.LastRedirectionDevice.Type); } catch { } try { Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("LocalConnectionState): " + argdel.LocalConnectionState); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("MonitorCrossRefID: " + argdel.MonitorCrossRefID); } catch { } try { Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("NetworkCalledDevice.ID: " + argdel.NetworkCalledDevice.ID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("NetworkCalledDevice.Type: " + argdel.NetworkCalledDevice.Type); } catch { } try { Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("NetworkCallingDevice.ID: " + argdel.NetworkCallingDevice.ID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("NetworkCallingDevice.Type: " + argdel.NetworkCallingDevice.Type); } catch { } try { Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("OriginatingNIDConnection.CallID: " + argdel.OriginatingNIDConnection.CallID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("OriginatingNIDConnection.DeviceID.ID: " + argdel.OriginatingNIDConnection.DeviceID.ID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("OriginatingNIDConnection.DeviceID.Type: " + argdel.OriginatingNIDConnection.DeviceID.Type); } catch { } try { Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("PrivateData.DistributingVDN): " + ((PrivateDataDelivered)argdel.PrivateData).DistributingVDN); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("PrivateData.SplitSkill): " + ((PrivateDataDelivered)argdel.PrivateData).SplitSkill); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("PrivateData.UserEnteredCode.CollectVDN): " + ((PrivateDataDelivered)argdel.PrivateData).UserEnteredCode.CollectVDN); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("PrivateData.UserEnteredCode.Data): " + ((PrivateDataDelivered)argdel.PrivateData).UserEnteredCode.Data); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("PrivateData.UserEnteredCode.Indicator): " + ((PrivateDataDelivered)argdel.PrivateData).UserEnteredCode.Indicator); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("PrivateData.UserEnteredCode.Type): " + ((PrivateDataDelivered)argdel.PrivateData).UserEnteredCode.Type); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("PrivateData.Version): " + ((PrivateDataDelivered)argdel.PrivateData).Version); } catch { } Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("UserData: " + argdel.UserData); } catch { } break; case AgileSoftware.Developer.Device.enCallEventType.CSTAEstablished: try { CSTAEstablishedEventArgs argest = arg.CallEvent.EventInfo as CSTAEstablishedEventArgs; Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("CSTAEstablished------------>"); try { Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("AnsweringDevice.ID: " + argest.AnsweringDevice.ID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("AnsweringDevice.Type: " + argest.AnsweringDevice.Type); } catch { } try { Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("CalledDevice.ID: " + argest.CalledDevice.ID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("CalledDevice.Type: " + argest.CalledDevice.Type); } catch { } try { Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("CallingDevice.ID: " + argest.CallingDevice.ID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("CallingDevice.Type: " + argest.CallingDevice.Type); } catch { } try { Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("EstablishedConnection.CallID: " + argest.EstablishedConnection.CallID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("EstablishedConnection.DeviceID: " + argest.EstablishedConnection.DeviceID.ID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("EstablishedConnection.DeviceID: " + argest.EstablishedConnection.DeviceID.Type); } catch { } Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("EventCause: " + argest.EventCause); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("GlobalCallLinkageID: " + argest.GlobalCallLinkageID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("InvokeID: " + argest.InvokeID); try { Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("LastRedirectionDevice.ID: " + argest.LastRedirectionDevice.ID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("LastRedirectionDevice.Type: " + argest.LastRedirectionDevice.Type); } catch { } Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("LocalConnectionState): " + argest.LocalConnectionState); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("MonitorCrossRefID: " + argest.MonitorCrossRefID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("UserData: " + argest.UserData); } catch { } break; case AgileSoftware.Developer.Device.enCallEventType.CSTAConnectionCleared: CSTAConnectionClearedEventArgs argdisc = arg.CallEvent.EventInfo as CSTAConnectionClearedEventArgs; Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("CSTAConnectionCleared------------>"); try { Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("DroppedConnection.CallID: " + argdisc.DroppedConnection.CallID); } catch { } try { Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("ReleasingDevice.ID: " + argdisc.ReleasingDevice.ID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("ReleasingDevice.Type: " + argdisc.ReleasingDevice.Type); } catch { } try { Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("DroppedConnection.DeviceID.ID: " + argdisc.DroppedConnection.DeviceID.ID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("DroppedConnection.DeviceID.Type: " + argdisc.DroppedConnection.DeviceID.Type); } catch { } try { Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("EventCause: " + argdisc.EventCause); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("GlobalCallLinkageID: " + argdisc.GlobalCallLinkageID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("InvokeID: " + argdisc.InvokeID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("LocalConnectionState: " + argdisc.LocalConnectionState); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("MonitorCrossRefID: " + argdisc.MonitorCrossRefID); Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("UserData: " + argdisc.UserData); } catch { } break; } Plugin.PimBroker.ErrorLogging.AddErrorToListInformation("ITNVPluginPlayMsg:TelephonyEventHandler arg.CallEvent.CallEventType=" + arg.CallEvent.CallEventType + " end <==="); }