示例#1
0
        /// <summary>
        /// Login Interface...
        /// </summary>
        /// <returns></returns>
        public override bool InitAndLogOn()
        {
            TelephonyProvider.CtiType ctiType = TelephonyProvider.CtiType.None;
            string agentNumber = string.Empty;

            try
            {
                ConfigurationValueReader configReader = ConfigurationValueReader.ConfigurationReader();
                ctiType     = (TelephonyProvider.CtiType)Convert.ToInt32(configReader.ReadAppSettings("CtiType"), CultureInfo.InvariantCulture);
                agentNumber = configReader.ReadAppSettings("MachineName");
            }
            catch
            {
            }

            if (ctiType == TelephonyProvider.CtiType.None ||
                string.IsNullOrEmpty(agentNumber))
            {
                return(false);
            }

            // Initialize the CTI class
            ctiProvider = InitializeCti();

            if (ctiProvider != null)
            {
                bool ctiLogin = Init(ctiType);

                // If agentNumber is null, then we aren't supporting CTI.
                if (ctiLogin && !string.IsNullOrEmpty(agentNumber))
                {
                    myLine = InitializeLine(agentNumber);
                    if (myLine == null)
                    {
                        Logging.Error(Application.ProductName, ResourceStrings.UNABLETOCONFIGUREPHONE);
                    }

                    /// this is the new call event for TAPI/TSAPI
                    cti.Cti.CallChanged += new CallEventHandler(Cti_CallChanged);
                }
            }

            if (ctiProvider != null)
            {
                //raise Agent ready Event.
                if (AgentStateChangedEvent != null)
                {
                    AgentStateChangedEvent(this, new CtiCoreEventArgs("AgentStateChange", CtiAgentStates.AVAILABLE, string.Empty));
                }
            }

            // True for success
            return(ctiProvider != null);
        }
        /// <summary>
        /// The init of the Line class.
        /// </summary>
        /// <param name="cti">The actualized Telephony object</param>
        /// <param name="type">The Telephony type </param>
        public override void Init(TelephonyProvider cti, Microsoft.Ccf.Csr.Cti.Providers.TelephonyProvider.CtiType type)
        {
            base.Init(cti, type);
            LineClassProvider line = null;

            DevCount = this.tapiCti.CtiTapi.DeviceCount();
            for (int i = 0; i < DevCount; i++)
            {
                //line = new LineClass( cti, cti.CtiTapi.GetDeviceID( i ), Telephony.CtiType.TAPI );
                line = LineClassProvider.Instance();
                line.Init(this.tapiCti, this.tapiCti.CtiTapi.GetDeviceID(i), TelephonyProvider.CtiType.TAPI);
                Lines.Add(line);
            }
        }
示例#3
0
 /// <summary>
 /// The init of the Call class.
 /// </summary>
 /// <param name="cti">The actualized Telephony object</param>
 /// <param name="line">The actualized line object</param>
 /// <param name="callID">The ID of the call.</param>
 public override void Init(TelephonyProvider cti, LineClassProvider line, int callID)
 {
     base.Init(cti, line, callID);
 }
        public SelectCallDlg(LineClassProvider myLine, string command)
        {
            bool         showThisCall;
            ListViewItem item;

            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();


            this.Text = ResourceStrings.SELECT_CALL_DLG_TEXT;

            if (command != null)
            {
                btnOk.Text = command;
                command    = command.Replace("&", "");
                command    = command.ToLower(System.Globalization.CultureInfo.InvariantCulture);
            }
            foreach (CallClassProvider call in myLine.Calls)
            {
                showThisCall = false;
                if (command == "unhold" && call.CanUnhold())
                {
                    showThisCall = true;
                }
                else if (command == "hold" && call.CanHold())
                {
                    showThisCall = true;
                }
                else if (command == "answer" && call.CanAnswer())
                {
                    showThisCall = true;
                }
                else if (command == "hangup" && call.CanHangup())
                {
                    showThisCall = true;
                }
                else if (command == "transfer" && call.CanTransfer())
                {
                    showThisCall = true;
                }
                else if (command == null)                    // use as default for all
                {
                    showThisCall = true;
                }

                if (showThisCall)
                {
                    item = callsList.Items.Add(call.Started.ToShortTimeString());
                    item.SubItems.Add(CallClassProvider.CallStateText(call.State));

                    if (call.UserTag != null)
                    {
                        item.SubItems.Add(call.UserTag + "  " + call.Parties);
                    }
                    else
                    {
                        item.SubItems.Add(call.Parties);
                    }
                    item.Tag = call;
                }
            }
            if (callsList.Items.Count > 0)
            {
                callsList.Items[0].Selected = true;
            }
            if (callsList.Items.Count == 1)
            {
                selectedCall = (CallClassProvider)callsList.Items[0].Tag;
            }
        }
示例#5
0
        public SelectCallDlg(LineClassProvider myLine, string command)
        {
            bool         showThisCall;
            ListViewItem item;

            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.startedCol.Text = localize.SELECT_CALL_DLG_STARTED_COL;
            this.stateCol.Text   = localize.SELECT_CALL_DLG_STATE_COL;
            this.partiesCol.Text = localize.SELECT_CALL_DLG_PARTIES_COL;
            this.btnOk.Text      = localize.SELECT_CALL_DLG_BTN_OK;
            this.btnCancel.Text  = localize.SELECT_CALL_DLG_BTN_CANCEL;
            this.label1.Text     = localize.SELECT_CALL_DLG_LABEL1;
            this.Text            = localize.SELECT_CALL_DLG_TEXT;

            if (command != null)
            {
                btnOk.Text = command;
                command    = command.Replace("&", "");
                command    = command.ToLower();
            }
            foreach (CallClassProvider call in myLine.Calls)
            {
                showThisCall = false;
                if (command == "unhold" && call.CanUnhold())
                {
                    showThisCall = true;
                }
                else if (command == "hold" && call.CanHold())
                {
                    showThisCall = true;
                }
                else if (command == "answer" && call.CanAnswer())
                {
                    showThisCall = true;
                }
                else if (command == "hangup" && call.CanHangup())
                {
                    showThisCall = true;
                }
                else if (command == "transfer" && call.CanTransfer())
                {
                    showThisCall = true;
                }
                else if (command == null)                    // use as default for all
                {
                    showThisCall = true;
                }

                if (showThisCall)
                {
                    item = callsList.Items.Add(call.Started.ToShortTimeString());
                    item.SubItems.Add(CallClassProvider.CallStateText(call.State));

                    if (call.UserTag != null)
                    {
                        item.SubItems.Add(call.UserTag + "  " + call.Parties);
                    }
                    else
                    {
                        item.SubItems.Add(call.Parties);
                    }
                    item.Tag = call;
                }
            }
            if (callsList.Items.Count > 0)
            {
                callsList.Items[0].Selected = true;
            }
            if (callsList.Items.Count == 1)
            {
                selectedCall = (CallClassProvider)callsList.Items[0].Tag;
            }
        }