Exemplo n.º 1
0
        public void FireCallEvent(Dialog dialog)
        {
            System.Windows.Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, (System.Action)(() =>
            {
                try
                {
                    if (dialog.DialogEvent.Equals("POST") && dialog.State.Equals("ALERTING")) //Call Start Event
                    {
                        var remoteAddress = new System.ServiceModel.EndpointAddress(_CapturePointUrl);
                        //MessageBox.Show("1");
                        ////  ServiceReference1.iWebServiceCapturePointClient iWebServiceCapturePoint = new ServiceReference1.iWebServiceCapturePointClient( );
                        //WebReference.KVPair dialogID = new WebReference.KVPair();
                        //dialogID.key = "CiscoCallID";
                        //WebReference.KVPairValue dialogIDValue = new WebReference.KVPairValue();
                        //dialogIDValue.ValueString = dialog.ID;
                        //dialogID.value = dialogIDValue;
                        //WebReference.KVPair[] kvList = new WebReference.KVPair[]{ dialogID };
                        //Boolean F = true;
                        //WebReference.KVPair[] kvPairPlaceHolder = new WebReference.KVPair[] { dialogID };

                        //WebReference.KVPair[] userData = new WebReference.KVPair[] { dialogID };


                        //MessageBox.Show("2");

                        // MessageBox.Show(_MediaType);
                        //iWebServiceCapturePoint.Submit("", "CiscoCall", _MediaType, "", "", int.Parse(_TenantID),
                        //        _QueueName, "", "", // Virtual Call
                        //        "", "", "", "", F, "", kvList, kvList, userData, F, ref kvPairPlaceHolder);

                        //   iWebServiceCapturePoint.Submit("", "CiscoCall", _MediaType, "", "", int.Parse(_TenantID),
                        //_QueueName, "", "", // Virtual Call
                        //"", "", "", "", F, "", kvList, kvList, userData, F, ref kvPairPlaceHolder);
                        // MessageBox.Show("Virtual Call is created for the call id :" + dialog.ID);


                        //   MessageBox.Show("2");
                        //   WebReference.WebServiceCapturePoint ws = new WebReference.WebServiceCapturePoint();
                        //   ws.Submit("", "CiscoCall", _MediaType, "", "", int.Parse(_TenantID),true,
                        //_QueueName, "", "", // Virtual Call
                        //"", "", "","", F, "", kvList, kvList, userData, ref kvPairPlaceHolder);
                        //   MessageBox.Show("3");



                        ServiceReference5.iWebServiceCapturePointClient iWebServiceCapturePoint = new ServiceReference5.iWebServiceCapturePointClient(new System.ServiceModel.BasicHttpBinding(), remoteAddress);

                        KVList kvList            = new KVList();
                        Boolean F                = false;
                        KVList kvPairPlaceHolder = new KVList();

                        KVList userData           = new KVList();
                        KVPair dialogID           = new KVPair();
                        dialogID.key              = "CiscoCallID";
                        KVPairValue dialogIDValue = new KVPairValue();
                        dialogIDValue.ValueString = dialog.ID;
                        dialogID.value            = dialogIDValue;
                        userData.Add(dialogID);
                        Nullable <bool> hold = null;

                        iWebServiceCapturePoint.Submit("", "New Call", _MediaType, "", "", int.Parse(_TenantID),
                                                       _QueueName, "", "", // Virtual Call
                                                       "", "", "", "", F, "", kvList, kvList, userData, hold, ref kvPairPlaceHolder);

                        Model.FinAgent.FireLogMessage("Virtual Call is created for the call id :" + dialog.ID);
                        Model.FinAgent.FireLogMessage("Virtual Call from : " + dialog.FromAddress + " To : " + dialog.ToAddress);
                        if (kvPairPlaceHolder != null)
                        {
                            foreach (ServiceReference5.KVPair kvPair in kvPairPlaceHolder)
                            {
                                Model.FinAgent.FireLogMessage("Virtual Call Received response Key : " + kvPair.key + " and Value : " + kvPair.value.ValueString + " for dialog id: " + dialog.ID);
                            }
                        }

                        //Start the popup activities

                        string CICFormatted = null;

                        //CIC Exist
                        if (((CallVariableClass)dialog.MediaProperties.CallVariables[3]).Value != null)
                        {
                            //check the CIC length is 16 digits
                            CICFormatted       = ((CallVariableClass)dialog.MediaProperties.CallVariables[3]).Value;
                            string customerCIC = "123492";
                            CICFormatted       = customerCIC;

                            while (CICFormatted.Length < 16)
                            {
                                CICFormatted = "0" + CICFormatted;
                            }
                        }
                        if (CICFormatted == null)
                        {
                            CICFormatted = "NA";
                        }


                        string fromAddress = "*****@*****.**";
                        string toAddress   = "*****@*****.**";
                        Dictionary <string, string> data = new Dictionary <string, string>();
                        //data.Add("CallVar4", CICFormatted);
                        data.Add("CallVar4", CICFormatted);
                        data.Add("InetractionID", dialog.ID);
                        data.Add("CaseID", "NA");
                        data.Add("AgentID", FinesseEventListener.Instance.FinAgent.AgentInformation.AgentID);
                        data.Add("AgentExt", FinesseEventListener.Instance.FinAgent.AgentInformation.Extension);
                        //data.Add("FromAddress", dialog.FromAddress);
                        //data.Add("ToAddress", dialog.ToAddress);
                        data.Add("FromAddress", fromAddress);
                        data.Add("ToAddress", toAddress);
                        // data.Add("DialNumber", dialog.MediaProperties.DialedNumber);
                        data.Add("DialNumber", "8016");



                        //We should popup interaction ID now
                        WSEventListener.Instance.FireWSEvent(data, EventType.CALL, EventDirection.START);
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.ToString());
                    Model.FinAgent.FireLogMessage(e.ToString());
                }
            }));
        }
Exemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="cb"></param>
 /// <param name="ds"></param>
 private void BindComboBoxDataSource(ComboBox cb, KVList ds)
 {
     cb.DataSource    = ds;
     cb.DisplayMember = "Key";
     cb.ValueMember   = "Value";
 }