Пример #1
0
 /// <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);
 }
Пример #2
0
        /// <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);
        }
Пример #3
0
 /// <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);
 }
Пример #4
0
 /// <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);
 }
Пример #5
0
        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);
        }
Пример #6
0
 public override bool MakeOutboundCall(CtiCommandRequest commandData)
 {
     return(false);
 }
Пример #7
0
 public override bool ConferenceCall(CtiCommandRequest commandData)
 {
     return(false);
 }
Пример #8
0
 public override string ExecuteGenericCommand(string commandName, CtiCommandRequest commandData)
 {
     return(string.Empty);
 }
Пример #9
0
 public override bool SetCallVariable(CtiCommandRequest commandData)
 {
     return(false);
 }
Пример #10
0
 public override bool PushUrl(CtiCommandRequest commandData)
 {
     // Not used by the TAPI Example ADapter
     return(true);
 }
Пример #11
0
 public override bool SendChatMessage(CtiCommandRequest commandData)
 {
     return(false);
 }
Пример #12
0
 public override bool RejectCall(CtiCommandRequest commandData)
 {
     return(false);
 }
 /// <summary>
 /// Called by UII’s Cti Subsystem, Request the adapter to wrap the call up
 /// </summary>
 /// <param name="commandData">CallID and additional Command Data</param>
 /// <returns></returns>
 public override bool WrapCall(CtiCommandRequest commandData)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Called by UII’s Cti Subsystem, Request the adapter to set one or more call variables on an call
 /// </summary>
 /// <param name="commandData">CallID and additional Command Data</param>
 /// <returns></returns>
 public override bool SetCallVariable(CtiCommandRequest commandData)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Called by UII’s Cti Subsystem, Request the adapter to send a chat message to the caller
 /// </summary>
 /// <param name="commandData">CallID and additional Command Data</param>
 /// <returns></returns>
 public override bool SendChatMessage(CtiCommandRequest commandData)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Called by UII’s Cti Subsystem, User defined request to the CTI adapter,
 ///     This is primarily an extensibility point to allow for “new”  functions to be implemented beyond the supplied types
 /// </summary>
 /// <param name="commandName">User defined Command name</param>
 /// <param name="commandData">CallID and additional Command Data</param>
 /// <returns></returns>
 public override string ExecuteGenericCommand(string commandName, CtiCommandRequest commandData)
 {
     throw new NotImplementedException();
 }