/// <summary> /// Handle Hang up call event. /// </summary> /// <param name="commandData"></param> /// <returns></returns> public override bool HangUpCall(CtiCommandRequest commandData) { if (myLine != null) { int iCallID = TranslateCallID(commandData.CtiCallId); if (iCallID != -1) { if (CanHangUp(iCallID)) { using (SelectCallDlg dlg = new SelectCallDlg(myLine, "&Hangup")) { if (dlg.MatchingCalls > 1) { dlg.ShowDialog(); } CallClassProvider call = dlg.SelectedCall; if (call != null) { call.Hangup(); return(true); } } } } } return(false); }
/// <summary> /// Handle Pick up Call... /// this is also used for UnHold. /// </summary> /// <param name="commandData"></param> /// <returns></returns> public override bool PickupCall(CtiCommandRequest commandData) { if (myLine != null) { int iCallId = TranslateCallID(commandData.CtiCallId); if (iCallId != -1) { // is the call on hold? if (cti.GetCall(iCallId).State == CallClassProvider.CallState.Hold) { // Pick a call to retrieve using (SelectCallDlg dlg = new SelectCallDlg(myLine, "&Unhold")) { if (dlg.MatchingCalls > 1) { dlg.ShowDialog(); } CallClassProvider call = dlg.SelectedCall; if (call != null) { // place any call on hold that can be held if (cti.GetActiveCall() != null) { cti.GetActiveCall().Hold(); } call.Unhold(); return(true); } } } } } return(false); }
/// <summary> /// Answer a Call /// </summary> /// <param name="commandData"></param> /// <returns></returns> public override bool AnswerCall(CtiCommandRequest commandData) { if (myLine != null) { // Pick a call to answer using (SelectCallDlg dlg = new SelectCallDlg(myLine, "&Answer")) { if (dlg.MatchingCalls > 1) { dlg.ShowDialog(); } CallClassProvider call = dlg.SelectedCall; if (call != null) { // place any call on hold that can be held if (cti.GetActiveCall() != null) { cti.GetActiveCall().Hold(); } call.Answer(); return(true); } } } return(false); }
/// <summary> /// Handle Hold event... /// </summary> /// <param name="commandData"></param> /// <returns></returns> public override bool HoldCall(CtiCommandRequest commandData) { if (myLine != null) { // Pick a call to place on hold using (SelectCallDlg dlg = new SelectCallDlg(myLine, "&Hold")) { if (dlg.MatchingCalls > 1) { dlg.ShowDialog(); } CallClassProvider call = dlg.SelectedCall; if (call != null) { call.Hold(); return(true); } } } return(false); }
public override bool TransferCall(CtiCommandRequest commandData) { Guid transferToAgentID = Guid.Empty; try { if (myLine != null) { // Find call that can be transferred using (SelectCallDlg dlg = new SelectCallDlg(myLine, "&Transfer")) { if (dlg.MatchingCalls > 1) { dlg.ShowDialog(); } CallClassProvider call = dlg.SelectedCall; var agentStateService = AifServiceContainer.Instance.GetService <IAgentStateService>(); if (call != null) { using (GetAgentId numberDlg = new GetAgentId()) { if (numberDlg.ShowDialog() == DialogResult.OK) { try { // See if this is being transferred to an agent if (agentStateService != null) { transferToAgentID = agentStateService.GetAgentId(numberDlg.AgentNumber); if (transferToAgentID != Guid.Empty && sessionMgr.ActiveSession != null) { string state = sessionMgr.ActiveSession.Save(true); if (!String.IsNullOrEmpty(state)) { agentStateService.SetSessionTransferInformation(transferToAgentID, call.CallerNumber, state); } } // Make sure the transfer works if (call.Transfer(numberDlg.AgentNumber) < 0) { // if anything failed, clear the session transfer info if (transferToAgentID != Guid.Empty) { agentStateService.SetSessionTransferInformation(transferToAgentID, "", ""); } } // Transfer is probably working else { // Ask in case the agent is expected to do wrap up or // in case the call did not really transfer. // Don't do this if there is only a global session. if (sessionMgr.ActiveSession != null && !sessionMgr.ActiveSession.Global && TopMostMessageBox.Show(ResourceStrings.DESKTOP_CLOSE_AFTER_TRANSFER, Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes) { sessionMgr.CloseSession(sessionMgr.ActiveSession, false); } } } } catch (Exception exp) { Logging.Error(Application.ProductName, ResourceStrings.DESKTOP_ERR_TRANSFERRING_CALL, exp); // if anything failed, clear the session transfer info if (transferToAgentID != Guid.Empty) { if (agentStateService != null) { agentStateService.SetSessionTransferInformation(transferToAgentID, "", ""); } } return(false); } // try...catch } else { return(false); } } } } } else { return(false); } } catch (Exception exp) { Logging.Error(Application.ProductName, ResourceStrings.DESKTOP_ERR_TRANSFERRING_CALL, exp); return(false); } return(true); }