Ejemplo n.º 1
0
        internal object request <T>(string operacion, string Method, string _token, out EResultado ERROR, string inx)
        {
            object _obj    = new object();
            string _objeto = "";

            ERROR = null;
            try
            {
                //string URL = "http://14.10.0.15:9109/api/"; //QA LIRAY
                string URL = "http://14.10.0.15:9105/api/"; //PRODUCCION LIRAY

                //string URL = "http://10.68.71.103:9105/api/";
                //string URL = "http://localhost:49353/api/";
                URL               = URL + operacion;
                Webrequest        = (HttpWebRequest)WebRequest.Create(URL);
                Webrequest.Method = Method;
                if (Webrequest.Method == "POST")
                {
                    using (var streamWriter = new StreamWriter(Webrequest.GetRequestStream()))
                    {
                        streamWriter.Write(inx);
                    }
                    Webrequest.ContentType = "application/json";
                }

                Webrequest.Headers.Add("TokenAplicativo", "5CD2487E16E828E46AEDC36288E38");
                Webrequest.Headers.Add("Token", _token);

                ASCIIEncoding encoding = new ASCIIEncoding();
                byte[]        byte1    = encoding.GetBytes(URL);

                using (response = Webrequest.GetResponse() as HttpWebResponse)
                {
                    var dataStream = response.GetResponseStream();
                    var reader     = new StreamReader(dataStream);
                    var _response  = reader.ReadToEnd();
                    var bytes      = Encoding.UTF8.GetBytes(_response);
                    _objeto = Encoding.UTF8.GetString(bytes);
                    _obj    = JsonConvert.DeserializeObject <T>(_objeto);
                }
            }
            catch (WebException webex)
            {
                WebResponse errResp = webex.Response;
                string      text    = "";
                using (Stream respStream = errResp.GetResponseStream())
                {
                    StreamReader reader = new StreamReader(respStream);
                    text = reader.ReadToEnd();

                    string request = "";
                }
            }
            catch (Exception e)
            {
            }

            return(_obj);
        }
Ejemplo n.º 2
0
        public EResultado TerminoInteraccion(out EResultado MensaejError, TerminoInteraccion inxtermino, string token)
        {
            MensaejError = null;

            try
            {
                var JsonInxVoz = JsonConvert.SerializeObject(inxtermino);
                error = request <EResultado>("TerminoInteraccion", "POST", token, out error, JsonInxVoz) as EResultado;
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(error);
        }
Ejemplo n.º 3
0
        public EResultado InteraccionCampana(out EResultado MensaejError, Campana inxCampana, string token)
        {
            MensaejError = null;

            try
            {
                var JsonInxCampana = JsonConvert.SerializeObject(inxCampana);
                error = request <EResultado>("Campanas", "POST", token, out error, JsonInxCampana) as EResultado;
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(error);
        }
Ejemplo n.º 4
0
        public EResultado VistaInteraccion(out EResultado MensaejError, EVistaInteraccion vistaInteraccion, string token)
        {
            MensaejError = null;

            try
            {
                var JsonTipificacion = JsonConvert.SerializeObject(vistaInteraccion);
                error = request <EResultado>("VistaInteraccion", "POST", token, out error, JsonTipificacion) as EResultado;
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(error);
        }
Ejemplo n.º 5
0
        public IList <Atendimento> ListaPorResultado(EResultado resutado)
        {
            IList <Atendimento> nova = new List <Atendimento>();
            var lista = Listar();

            foreach (var atendimento in lista)
            {
                if (atendimento.Resultado == resutado)
                {
                    nova.Add(atendimento);
                }
            }


            return(nova);
        }
Ejemplo n.º 6
0
        public Autentificacion autentificacion(out EResultado MensaejError, Agente ag)
        {
            Autentificacion _auth = new Autentificacion();

            MensaejError = null;
            try
            {
                _auth        = request <Autentificacion>("Autentificacion?username="******"&firstName=" + ag.firstName + "&lastName=" + ag.lastName + "&tenantDBID=" + ag.tenantDBid + "&Agentdbid=" + ag.agentDBid + "&employeID=" + ag.EmployeeId + "", "GET", "", out error, "") as Autentificacion;
                MensaejError = error;
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(_auth);
        }
Ejemplo n.º 7
0
        public Filtro ListaFiltro(out EResultado MensaejError, string token)
        {
            Filtro     filtro = new Filtro();
            EResultado error  = new EResultado();

            MensaejError = null;
            try
            {
                filtro       = request <Filtro>("listaFiltros", "GET", token, out error, "") as Filtro;
                MensaejError = error;
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(filtro);
        }
Ejemplo n.º 8
0
        public List <Atached> ListAtached(out EResultado MensaejError, string token)
        {
            List <Atached> listaArbol = new List <Atached>();
            EResultado     error      = new EResultado();

            MensaejError = null;
            try
            {
                listaArbol   = request <List <Atached> >("listaAttach", "GET", token, out error, "") as List <Atached>;
                MensaejError = error;
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(listaArbol);
        }
Ejemplo n.º 9
0
        public Arbol ArbolTipificacion(out EResultado MensaejError, string token)
        {
            Arbol      listaArbol = new Arbol();
            EResultado error      = new EResultado();

            MensaejError = null;
            try
            {
                listaArbol   = request <Arbol>("ArbolTipificacion", "GET", token, out error, "") as Arbol;
                MensaejError = error;
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(listaArbol);
        }
Ejemplo n.º 10
0
        public HistorialCliente Historial(out EResultado MensaejError, string token, string medio, string valorTipo, string periodo, string tipo, string top, int tenant)
        //public HistorialCliente Historial(out EResultado MensaejError, string token,string medio,string valorTipo,string periodo,string tipo, string top)
        {
            HistorialCliente listaArbol = new HistorialCliente();
            EResultado       error      = new EResultado();

            MensaejError = null;
            try
            {
                //Historial? ani = 932 & dni = 932 & valorTipo = &periodo = T & tipo = &top = 10
                listaArbol   = request <HistorialCliente>("Historial?medio=" + medio + "&valorTipo=" + valorTipo + "&periodo=" + periodo + "&tipo=" + tipo + "&top=" + top + "&tenant=" + tenant + "", "GET", token, out error, "") as HistorialCliente;
                MensaejError = error;
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(listaArbol);
        }
        //private static void GuardarInteraccionEnPullPreview(Interaccion datosInx, IInteraction inx)
        //{
        //    try
        //    {
        //        var item = inx.OutboundChainRecord.Records.FirstOrDefault();
        //        if (item != null)
        //        {
        //            XDocument Documento = new XDocument();
        //            XElement xmlOut = null;
        //            datosInx.GenRecordId = item.UserData.GetAsInt("recordid");
        //            datosInx.GenChainIdCampana = item.ChainID;
        //            datosInx.GenCampaingName = inx.OutboundChainRecord.CampaignName;
        //            datosInx.GenGuid = item.CallAttemptGUID;
        //            datosInx.GenAttempt = item.Attempts;
        //            datosInx.UserName = Agente.UserName;
        //            datosInx.GenFirstName = AgenteConfig.FirstName.ToString();
        //            datosInx.GenLastName = AgenteConfig.LastName.ToString();
        //            datosInx.GenGroupName = item.CampaignInfo.GroupName;
        //            datosInx.GenTipoInteraccion = 7;
        //            datosInx.GenCanalEntrada = item.CampaignInfo.CampaignEvent;
        //            datosInx.GenEvento = item.CampaignInfo.CampaignEvent;
        //            datosInx.GenDestino = item.PhoneNumber;

        //            datosInx.GenOrigen = inx.Agent.Place.PlaceName;
        //            datosInx.GenFechaInicioCall = DateTime.Now;

        //            datosInx.GenEstadoTipificacion = "PENDIENTE DE TIPIFICACION";
        //            datosInx.GenEstadoInteraccion = "TRAE REGISTROS DE CAMPAÑA";

        //            try
        //            {
        //                 Documento = Utility.GeneraXML(inx);
        //            }
        //            catch (Exception)
        //            {

        //            }

        //            if (Documento != null)
        //            {
        //                 xmlOut = XElement.Parse(Documento.ToString());
        //            }

        //            datosInx.fields = xmlOut;
        //            _metodos.GuardaCampana(datosInx);
        //        }

        //    }
        //    catch (Exception error)
        //    {
        //        GenesysAlert.SendMessage(
        //            "Se ha producido un error al obtener los datos de la interacción en InteractionPullPreview -> PreviewRecord: " +
        //            error.Message, "Public", SeverityType.Error);
        //    }
        //}



        //private static void GuardarInteraccionEnPushPreview(Interaccion datosInx, IInteraction inx)
        //{
        //    try
        //    {
        //        var item = inx.OutboundChainRecord.Records.FirstOrDefault();
        //        if (item != null)
        //        {
        //            datosInx.GenRecordId = item.UserData.GetAsInt("recordid");
        //            datosInx.GenChainIdCampana = item.ChainID;
        //            datosInx.GenCampaingName = inx.OutboundChainRecord.CampaignName;
        //            datosInx.GenGuid = item.CallAttemptGUID;
        //            datosInx.GenAttempt = item.Attempts;
        //            datosInx.UserName = Agente.UserName;
        //            datosInx.GenFirstName = AgenteConfig.FirstName.ToString();
        //            datosInx.GenLastName = AgenteConfig.LastName.ToString();
        //            datosInx.GenGroupName = item.CampaignInfo.GroupName;
        //            datosInx.GenTipoInteraccion = 6;
        //            datosInx.GenCanalEntrada = "PreviewRecord";
        //            datosInx.GenEvento = "PreviewRecord";
        //            datosInx.GenDestino = item.PhoneNumber;

        //            datosInx.GenOrigen = inx.Agent.Place.PlaceName;
        //            datosInx.GenFechaInicioCall = DateTime.Now;

        //            datosInx.GenEstadoTipificacion = "PENDIENTE DE TIPIFICACION";
        //            datosInx.GenEstadoInteraccion = "TRAE REGISTROS DE CAMPAÑA";

        //            try
        //            {
        //                XDocument Documento = Utility.GeneraXML(inx);
        //            }
        //            catch (Exception)
        //            {

        //            }


        //            _metodos.GuardaCampana(datosInx);
        //        }

        //    }
        //    catch (Exception error)
        //    {
        //        GenesysAlert.SendMessage(
        //            "Se ha producido un error al obtener los datos de la interacción en InteractionPullPreview -> PreviewRecord: " +
        //            error.Message, "Public", SeverityType.Error);
        //    }
        //}

        //private static void GuardaInteraccionEmailOutboundEnAck(Interaccion datosInx, IInteraction inx)
        //{
        //    try
        //    {
        //        var email = inx as IInteractionOutboundEmail;

        //        if (email != null)
        //        {
        //            if (email.EntrepriseEmailInteractionCurrent.Id != null)
        //                datosInx.GenConnid = email.EntrepriseEmailInteractionCurrent.Id;
        //            if (email.EntrepriseEmailInteractionCurrent.ParentID != null)
        //                datosInx.GenParentId = email.EntrepriseEmailInteractionCurrent.ParentID;
        //            datosInx.GenTipoInteraccion = 11;
        //            datosInx.GenFechaInicioCall = email.EntrepriseEmailInteractionCurrent.StartDate;
        //            datosInx.UserName = Agente.UserName;
        //            datosInx.GenFirstName = AgenteConfig.FirstName.ToString();
        //            datosInx.GenLastName = AgenteConfig.LastName.ToString();
        //            datosInx.GenArea = AreaTipificacion;

        //            if (email.EntrepriseEmailInteractionCurrent.From != null)
        //                datosInx.GenFrom = email.EntrepriseEmailInteractionCurrent.From;
        //            if (email.EntrepriseEmailInteractionCurrent.To != null)
        //                datosInx.GenTo = string.Join(",", email.EntrepriseEmailInteractionCurrent.To);
        //            if (email.EntrepriseEmailInteractionCurrent.Bcc != null)
        //                datosInx.GenCco = string.Join(",", email.EntrepriseEmailInteractionCurrent.Bcc);

        //            var inxDuration = inx.Duration;
        //            if (inxDuration.Ticks > 0)
        //            {
        //                datosInx.GenDuracionCall = inxDuration.TotalSeconds.ToString(CultureInfo.InvariantCulture);
        //                datosInx.GenFechaTerminoCall = inx.StartDate.Add(inxDuration);
        //            }

        //            datosInx.GenEstadoInteraccion = email.EntrepriseEmailInteractionCurrent.IdType.Subtype;
        //        }
        //        datosInx.GenEstadoTipificacion = "PENDIENTE DE TIPIFICACION";
        //        _metodos.GuardaInteraccionEmail(datosInx);
        //    }
        //    catch (Exception error)
        //    {
        //        GenesysAlert.SendMessage(
        //            "Se ha producido un error al obtener los datos de la interacción en InteractionOutboundEmail -> EventAck: " +
        //            error.Message, "Public", SeverityType.Error);
        //    }
        //}

        //private static void GuardaInteraccionEmailInboundEnAck(Interaccion datosInx, IInteraction inx)
        //{
        //    try
        //    {
        //        var email = inx as IInteractionInboundEmail;
        //        if (email != null)
        //        {
        //            if (email.EntrepriseEmailInteractionCurrent.Id != null)
        //                datosInx.GenConnid = email.EntrepriseEmailInteractionCurrent.Id;
        //            if (email.EntrepriseEmailInteractionCurrent.ParentID != null)
        //                datosInx.GenParentId = email.EntrepriseEmailInteractionCurrent.ParentID;
        //            datosInx.GenTipoInteraccion = 11;
        //            datosInx.GenFechaInicioCall = inx.StartDate;
        //            datosInx.UserName = Agente.UserName;
        //            datosInx.GenFirstName = AgenteConfig.FirstName.ToString();
        //            datosInx.GenLastName = AgenteConfig.LastName.ToString();
        //            datosInx.GenArea = AreaTipificacion;

        //            if (email.EntrepriseEmailInteractionCurrent.From != null)
        //                datosInx.GenFrom = email.EntrepriseEmailInteractionCurrent.From;
        //            if (email.EntrepriseEmailInteractionCurrent.To != null)
        //                datosInx.GenTo = string.Join(",", email.EntrepriseEmailInteractionCurrent.To);
        //            if (email.EntrepriseEmailInteractionCurrent.Bcc != null)
        //                datosInx.GenCco = string.Join(",", email.EntrepriseEmailInteractionCurrent.Bcc);

        //            var inxDuration = inx.Duration;
        //            if (inxDuration.Ticks > 0)
        //            {
        //                datosInx.GenDuracionCall = inxDuration.TotalSeconds.ToString(CultureInfo.InvariantCulture);
        //                datosInx.GenFechaTerminoCall = inx.StartDate.Add(inxDuration);
        //            }

        //            datosInx.GenEstadoInteraccion = email.EntrepriseEmailInteractionCurrent.IdType.Subtype;
        //        }
        //        datosInx.GenEstadoTipificacion = "PENDIENTE DE TIPIFICACION";
        //        _metodos.GuardaInteraccionEmail(datosInx);
        //    }
        //    catch (Exception error)
        //    {
        //        GenesysAlert.SendMessage(
        //            "Se ha producido un error al obtener los datos de la interacción en InteractionInboundEmail -> EventAck: " +
        //            error.Message, "Public", SeverityType.Error);
        //    }
        //}

        //private static void GuardaInteraccionEmailInboundEnInvite(Interaccion datosInx, IInteraction inx)
        //{
        //    try
        //    {
        //        var email = inx as IInteractionInboundEmail;

        //        if (email != null)
        //        {
        //            if (email.EntrepriseEmailInteractionCurrent.Id != null)
        //                datosInx.GenConnid = email.EntrepriseEmailInteractionCurrent.Id;
        //            if (email.EntrepriseEmailInteractionCurrent.ParentID != null)
        //                datosInx.GenParentId = email.EntrepriseEmailInteractionCurrent.ParentID;
        //            datosInx.GenTipoInteraccion = 5;
        //            datosInx.GenFechaInicioCall = inx.StartDate;
        //            datosInx.UserName = Agente.UserName;
        //            datosInx.GenFirstName = AgenteConfig.FirstName.ToString();
        //            datosInx.GenLastName = AgenteConfig.LastName.ToString();
        //            datosInx.GenArea = AreaTipificacion;

        //            if (email.EntrepriseEmailInteractionCurrent.From != null)
        //                datosInx.GenFrom = email.EntrepriseEmailInteractionCurrent.From;
        //            if (email.EntrepriseEmailInteractionCurrent.To != null)
        //                datosInx.GenTo = string.Join(",", email.EntrepriseEmailInteractionCurrent.To);
        //            if (email.EntrepriseEmailInteractionCurrent.Bcc != null)
        //                datosInx.GenCco = string.Join(",", email.EntrepriseEmailInteractionCurrent.Bcc);

        //            datosInx.GenEstadoInteraccion = email.EntrepriseEmailInteractionCurrent.IdType.Subtype;
        //        }
        //        datosInx.GenEstadoInteraccion = "INVITACION MAIL ENTRANTE";
        //        datosInx.GenEstadoTipificacion = "PENDIENTE DE TIPIFICACION";

        //        _metodos.GuardaInteraccionEmail(datosInx);
        //    }
        //    catch (Exception error)
        //    {
        //        GenesysAlert.SendMessage(
        //            "Se ha producido un error al obtener los datos de la interacción en InteractionInboundEmail -> EventInvite: " +
        //            error.Message, "Public", SeverityType.Error);
        //    }
        //}

        private static void ConvierteClaseCampana(IInteraction inx)
        {
            try
            {
                var item = inx.OutboundChainRecord.Records.FirstOrDefault();
                if (item != null)
                {
                    Campana campana = new Campana();
                    campana.CaseId            = inx.CaseId;
                    campana.Campaing_name     = inx.OutboundChainRecord.CampaignName;
                    campana.Calling_list_name = inx.OutboundChainRecord.CallingListName;
                    campana.GUID          = item.CallAttemptGUID;
                    campana.campaign_dbid = item.CampaignInfo.ApplicationID;

                    campana.campaignMode = inx.GetAttachedData("DIALMODE") != null?
                                           inx.GetAttachedData("DIALMODE").ToString() :
                                               "";

                    try
                    {
                        XDocument Documento = Utility.GeneraXML(inx);
                        XElement  xmlOut    = null;
                        if (Documento != null)
                        {
                            xmlOut = XElement.Parse(Documento.ToString());
                        }
                        campana.Field = xmlOut;
                    }
                    catch (Exception) { }

                    EResultado resultado = null;
                    _metodoApi.InteraccionCampana(out resultado, campana, token);
                    _metodos.InsertaRegistroMarkDoneModule(inx);
                }
            }
            catch (Exception)
            {
            }
        }
        private void ConvierteClase(int idEvento, IMessage evento, IInteraction inx)
        {
            var data = "";

            if (_caseIdentifier.CaseId != null)
            {
                data = _caseIdentifier.CaseId;
            }
            else if (inx.CaseId != null)
            {
                data = _caseIdentifier.CaseId;
            }

            InteractionVoz inxVoz  = new InteractionVoz();
            Campana        campana = new Campana();

            switch (idEvento)
            {
            case EventDialing.MessageId:
                var eventDial = evento as EventDialing;
                inxVoz.CImessage = new CImessage
                {
                    nombreEvento   = eventDial.Name,
                    ani            = eventDial.ANI,
                    dnis           = eventDial.DNIS,
                    CallType       = eventDial.CallType,
                    Connid         = eventDial.ConnID.ToString(),
                    eventId        = eventDial.Id,
                    TransferConnid = eventDial.TransferConnID != null?
                                     eventDial.TransferConnID.ToString() :
                                         "",
                };
                inxVoz.Cinteraction = new CIInteracion
                {
                    CaseId            = inx.CaseId,
                    HasOutboundRecord = inx.HasOutboundChainRecord,
                    Records           = null,
                    type = inx.Type
                };

                inxVoz.CinteractionWebInx = new CIInteracionWeb
                {
                    formulario = null,
                    ParentId   = inx.ParentInteractionId
                };

                if (inxVoz.Cinteraction.HasOutboundRecord)
                {
                    ICampaignManager cm = _container.Resolve <ICampaignManager>();
                    IWCampaign       c;

                    for (int i = 0; i < cm.IWCampaigns.Count(); i++)
                    {
                        if (cm.IWCampaigns[i].Mode.Value != null)
                        {
                            inxVoz.CImessage.DialMode = cm.IWCampaigns[i].Mode.Value.ToString();
                        }
                    }
                }


                var xmlAtachado = Utility.GeneraXMLAtachado(listaAtached, inx);
                if (xmlAtachado != null)
                {
                    inxVoz.ATTACHED = XElement.Parse(xmlAtachado.ToString());
                }
                if (inx.IsMonitoredByMe)
                {
                    inxVoz.CImessage.EsMonitoreada = true;
                }
                break;

            case EventAck.MessageId:
                var eventInvite = evento as EventAck;
                inxVoz.CImessage = new CImessage
                {
                    nombreEvento = eventInvite.Name,
                    ani          = "",
                    dnis         = "",

                    Connid         = inx.InteractionId,
                    eventId        = eventInvite.Id,
                    TransferConnid = ""
                };
                inxVoz.Cinteraction = new CIInteracion
                {
                    CaseId            = inx.CaseId,
                    HasOutboundRecord = inx.HasOutboundChainRecord,
                    Records           = null,
                    type = inx.Type
                };

                inxVoz.CinteractionWebInx = new CIInteracionWeb
                {
                    formulario = null,
                    ParentId   = inx.EntrepriseInteractionCurrent.Id
                };

                if (inxVoz.Cinteraction.HasOutboundRecord)
                {
                    ICampaignManager cm = _container.Resolve <ICampaignManager>();
                    IWCampaign       c;

                    for (int i = 0; i < cm.IWCampaigns.Count(); i++)
                    {
                        if (cm.IWCampaigns[i].Mode.Value != null)
                        {
                            inxVoz.CImessage.DialMode = cm.IWCampaigns[i].Mode.Value.ToString();
                        }
                    }
                }


                var xmlAtachadoInvite = Utility.GeneraXMLAtachado(listaAtached, inx);
                if (xmlAtachadoInvite != null)
                {
                    inxVoz.ATTACHED = XElement.Parse(xmlAtachadoInvite.ToString());
                }
                if (inx.IsMonitoredByMe)
                {
                    inxVoz.CImessage.EsMonitoreada = true;
                }
                break;

            case EventEstablished.MessageId:
                var eventEstablished = evento as EventEstablished;
                inxVoz.CImessage = new CImessage
                {
                    nombreEvento   = eventEstablished.Name,
                    ani            = eventEstablished.ANI,
                    dnis           = eventEstablished.DNIS,
                    CallType       = eventEstablished.CallType,
                    Connid         = eventEstablished.ConnID.ToString(),
                    eventId        = eventEstablished.Id,
                    TransferConnid = eventEstablished.TransferConnID != null?
                                     eventEstablished.TransferConnID.ToString() :
                                         "",
                };
                inxVoz.Cinteraction = new CIInteracion
                {
                    CaseId            = inx.CaseId,
                    HasOutboundRecord = inx.HasOutboundChainRecord,
                    Records           = null,
                    type = inx.Type
                };
                inxVoz.CinteractionWebInx = new CIInteracionWeb
                {
                    formulario = null,
                    ParentId   = inx.ParentInteractionId
                };

                if (inxVoz.Cinteraction.HasOutboundRecord)
                {
                    ICampaignManager cm = _container.Resolve <ICampaignManager>();
                    IWCampaign       c;

                    for (int i = 0; i < cm.IWCampaigns.Count(); i++)
                    {
                        if (cm.IWCampaigns[i].Mode.Value != null)
                        {
                            inxVoz.CImessage.DialMode = cm.IWCampaigns[i].Mode.Value.ToString();
                        }
                        var nombreCampaign = cm.IWCampaigns[i].Name.ToString();
                    }

                    if (inxVoz.CImessage.DialMode.Equals("PROGRESSIVE") || inxVoz.CImessage.DialMode.Equals("PREDICTIVE"))
                    {
                        ConvierteClaseCampana(inx);
                    }
                }

                var xmlAtachad = Utility.GeneraXMLAtachado(listaAtached, inx);
                if (xmlAtachad != null)
                {
                    inxVoz.ATTACHED = XElement.Parse(xmlAtachad.ToString());
                }
                string transferidoOrigen = "";
                if (eventEstablished.UserData.GetAsKeyValueCollection("IWAttachedDataInformation") != null)
                {
                    var ValuesKey = eventEstablished.UserData.GetAsKeyValueCollection("IWAttachedDataInformation");
                    if (ValuesKey.GetValues("GCS_TransferringAgentName") != null)
                    {
                        transferidoOrigen = ValuesKey.GetValues("GCS_TransferringAgentName").FirstOrDefault().ToString();
                    }
                }
                if (inx.IsMonitoredByMe)
                {
                    inxVoz.CImessage.EsMonitoreada = true;
                }

                //if (transferidoOrigen != "" && transferidoOrigen != Agente.UserName)
                //    return;

                break;

            case EventPartyChanged.MessageId:
                var eventPartyChanged = evento as EventPartyChanged;
                inxVoz.CImessage = new CImessage
                {
                    nombreEvento   = eventPartyChanged.Name,
                    ani            = eventPartyChanged.ANI,
                    dnis           = eventPartyChanged.DNIS,
                    CallType       = eventPartyChanged.CallType,
                    Connid         = eventPartyChanged.ConnID.ToString(),
                    eventId        = eventPartyChanged.Id,
                    TransferConnid = eventPartyChanged.PreviousConnID != null?
                                     eventPartyChanged.PreviousConnID.ToString() : "",
                };
                inxVoz.Cinteraction = new CIInteracion
                {
                    CaseId            = inx.CaseId,
                    HasOutboundRecord = inx.HasOutboundChainRecord,
                    Records           = null,
                    type = inx.Type
                };

                inxVoz.CinteractionWebInx = new CIInteracionWeb
                {
                    formulario = null,
                    ParentId   = inx.ParentInteractionId
                };

                if (inx.GetAttachedData("GCS_TransferringAgentName") != null)
                {
                    var agenteTransferencia = inx.GetAttachedData("GCS_TransferringAgentName").ToString();

                    if (!agenteTransferencia.Equals(Agente.UserName))
                    {
                        _metodos.InsertaRegistroMarkDoneModule(inx);
                        return;
                    }
                }
                if (inx.IsMonitoredByMe)
                {
                    inxVoz.CImessage.EsMonitoreada = true;
                }
                break;

            case EventReleased.MessageId:
                var eventReleased = evento as EventReleased;
                inxVoz.CImessage = new CImessage
                {
                    nombreEvento   = eventReleased.Name,
                    ani            = eventReleased.ANI,
                    dnis           = eventReleased.DNIS,
                    CallType       = eventReleased.CallType,
                    Connid         = eventReleased.ConnID.ToString(),
                    eventId        = eventReleased.Id,
                    TransferConnid = eventReleased.TransferConnID != null?
                                     eventReleased.TransferConnID.ToString() :
                                         "",

                                         Release = eventReleased.Extensions.GetAsString("ReleasingParty") != null?
                                                   eventReleased.Extensions.GetAsString("ReleasingParty").ToString() :
                                                       null,
                };
                inxVoz.Cinteraction = new CIInteracion
                {
                    CaseId            = inx.CaseId,
                    HasOutboundRecord = inx.HasOutboundChainRecord,
                    Records           = null,
                    type = inx.Type
                };

                if (inx.EntrepriseInteractionCurrent.Profile != null)
                {
                    if (inx.EntrepriseInteractionCurrent.Profile.ToString().Equals("Transfered"))
                    {
                        inxVoz.CImessage.TransferConnid = inx.EntrepriseInteractionCurrent.Data.Owner != null?
                                                          inx.EntrepriseInteractionCurrent.Data.Owner.ToString() : "";
                    }
                }



                if (inxVoz.Cinteraction.HasOutboundRecord)
                {
                    ICampaignManager cm = _container.Resolve <ICampaignManager>();
                    IWCampaign       c;

                    for (int i = 0; i < cm.IWCampaigns.Count(); i++)
                    {
                        if (cm.IWCampaigns[i].Mode.Value != null)
                        {
                            inxVoz.CImessage.DialMode = cm.IWCampaigns[i].Mode.Value.ToString();
                        }
                    }

                    if (inxVoz.CImessage.DialMode.Equals("PROGRESSIVE") || inxVoz.CImessage.DialMode.Equals("PREDICTIVE"))
                    {
                        ConvierteClaseCampana(inx);
                    }
                }

                if (inxVoz.CImessage.TransferConnid.Equals(inxVoz.CImessage.Connid))
                {
                    inxVoz.CImessage.TransferConnid = eventReleased.TransferConnID != null?
                                                      eventReleased.TransferConnID.ToString() :
                                                          "";
                }
                if (inx.EntrepriseInteractionCurrent.Profile != null)
                {
                    if (inx.EntrepriseInteractionCurrent.Profile.ToString().Equals("Transfered"))
                    {
                        inxVoz.CImessage.TransferredNetworkCallID = 1;
                    }
                }
                if (inx.IsMonitoredByMe)
                {
                    inxVoz.CImessage.TransferConnid = "";
                }

                if (inx.IsMonitoredByMe)
                {
                    inxVoz.CImessage.EsMonitoreada = true;
                }
                break;

            case Platform.Voice.Protocols.TServer.Events.EventUserEvent.MessageId:
                var evetUserEvent = evento as Platform.Voice.Protocols.TServer.Events.EventUserEvent;

                break;

            default:
                return;

                break;
            }


            EResultado resultado = null;

            _metodoApi.InteraccionVoz(out resultado, inxVoz, token);
        }
        /// <summary>
        /// Executes the command.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        /// <param name="progress">The progress.</param>
        /// <returns></returns>
        /// <summary>
        /// Executes the command.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        /// <param name="progress">The progress.</param>
        /// <returns></returns>
        public bool Execute(IDictionary <string, object> parameters, IProgressUpdater progress)
        {
            // To go to the main thread


            if (Application.Current.Dispatcher != null && !Application.Current.Dispatcher.CheckAccess())
            {
                object result = Application.Current.Dispatcher.Invoke(DispatcherPriority.Send, new ExecuteDelegate(Execute), parameters, progress);
                return((bool)result);
            }
            else
            {
                // Ok, we are in the main thread
                log.Info("Execute");
                IInteraction interactionVoice = parameters["InteractionMarkDone0"] as IInteraction;
                var          inx = InteraccionGenesys.GetAttachedData(interactionVoice);

                // Get the parameter


                if (interactionVoice != null)
                {
                    var tipoInteraccion = interactionVoice.Type;
                    switch (tipoInteraccion)
                    {
                    case "InteractionVoice":

                        termino.CaseId    = interactionVoice.CaseId;
                        termino.Agentdbid = InteractionExtensionCrossnetModule.AgenteConfig != null ?
                                            InteractionExtensionCrossnetModule.AgenteConfig.DBID : 0;

                        inx.genEventoMarkdone = "InteractionVoice";

                        inx.IdMarkdone = interactionVoice.EntrepriseInteractionCurrent.Id;
                        break;

                    case "InteractionPullPreview":
                        var item = interactionVoice.OutboundChainRecord.Records.FirstOrDefault();
                        inx.genEventoMarkdone = "PreviewRecord";
                        inx.IdMarkdone        = item.CallAttemptGUID;

                        termino.CaseId    = interactionVoice.CaseId;
                        termino.Agentdbid = InteractionExtensionCrossnetModule.AgenteConfig != null ?
                                            InteractionExtensionCrossnetModule.AgenteConfig.DBID : 0;

                        inx.genEventoMarkdone = "PreviewRecord";

                        break;

                    case "InteractionCallback":
                        termino.CaseId    = interactionVoice.CaseId;
                        termino.Agentdbid = InteractionExtensionCrossnetModule.AgenteConfig != null ?
                                            InteractionExtensionCrossnetModule.AgenteConfig.DBID : 0;

                        inx.genEventoMarkdone = "InteractionCallback";

                        inx.IdMarkdone = interactionVoice.EntrepriseInteractionCurrent.Id;

                        break;
                    }
                    if (InteractionExtensionCrossnetModule.TablaTipificaciones == null)
                    {
                        return(false);
                    }

                    EResultado resultado = null;

                    _metodoApi.TerminoInteraccion(out resultado, termino, InteractionExtensionCrossnetModule.token);

                    DataRow resultMarkDone = null;
                    switch (tipoInteraccion)
                    {
                    case "InteractionVoice":
                        inx.genEventoMarkdone = "InteractionVoice";
                        inx.IdMarkdone        = interactionVoice.EntrepriseInteractionCurrent.Id;
                        resultMarkDone        = InteractionExtensionCrossnetModule._TablaInteraccion.Select("idMarkDone = '" + inx.IdMarkdone +
                                                                                                            "' and Agente ='" + inx.GenAgente + "'").FirstOrDefault();

                        break;

                    case "InteractionPullPreview":
                        var item = interactionVoice.OutboundChainRecord.Records.FirstOrDefault();
                        inx.genEventoMarkdone = "PreviewRecord";
                        inx.IdMarkdone        = item.CallAttemptGUID;
                        resultMarkDone        = InteractionExtensionCrossnetModule._TablaInteraccion.Select("idMarkDone = '" + inx.IdMarkdone +
                                                                                                            "' and Agente ='" + inx.GenAgente + "'").FirstOrDefault();

                        break;

                    case "InteractionCallback":
                        inx.genEventoMarkdone = "InteractionCallback";
                        inx.IdMarkdone        = interactionVoice.EntrepriseInteractionCurrent.Id;
                        resultMarkDone        = InteractionExtensionCrossnetModule._TablaInteraccion.Select("idMarkDone = '" + inx.IdMarkdone +
                                                                                                            "' and Agente ='" + inx.GenAgente + "'").FirstOrDefault();

                        break;
                    }
                    string Estado = resultMarkDone["Estado"] != null ? resultMarkDone["Estado"].ToString() : "";
                    if (!Estado.Equals("TIPIFICADO"))
                    {
                        GenesysAlert.SendMessage("Favor tipificar", "Public", SeverityType.Warning);
                        return(true);
                    }
                    else
                    {
                        switch (tipoInteraccion)
                        {
                        case "InteractionVoice":
                            InteractionExtensionCrossnetModule._TablaInteraccion.Select("idMarkDone = '" + inx.IdMarkdone +
                                                                                        "' and Agente ='" + inx.GenAgente + "'").FirstOrDefault().Delete();
                            break;

                        case "InteractionPullPreview":
                            var item = interactionVoice.OutboundChainRecord.Records.FirstOrDefault();
                            InteractionExtensionCrossnetModule._TablaInteraccion.Select("idMarkDone = '" + inx.IdMarkdone +
                                                                                        "' and Agente ='" + inx.GenAgente + "'").FirstOrDefault().Delete();

                            break;

                        case "InteractionCallback":
                            InteractionExtensionCrossnetModule._TablaInteraccion.Select("idMarkDone = '" + inx.IdMarkdone +
                                                                                        "' and Agente ='" + inx.GenAgente + "'").FirstOrDefault().Delete();
                            break;
                        }
                    }
                }

                return(false);
            }
        }