Пример #1
0
        public CSTAConfirmationEvent Parse(IStructReader reader)
        {
            Logger logger = LogManager.GetLogger("TSAPIClient");

            try
            {
                object result;

                logger.Info("CSTAMakePredictiveCallConfParser.Parse: eventType=CSTA_MAKE_PREDICTIVE_CALL_CONF");
                logger.Info("CSTAMakePredictiveCallConfParser.Parse: try to read the CSTAMakePredictiveCallConfEvent_t confirmation event...");

                if (reader.TryReadStruct(typeof(CSTAMakePredictiveCallConfEvent_t), out result))
                {
                    logger.Info("CSTAMakePredictiveCallConfParser.Parse: successfully read the CSTAMakePredictiveCallConfEvent_t confirmation event!");

                    CSTAMakePredictiveCallConfEvent_t makePredictiveCall = (CSTAMakePredictiveCallConfEvent_t)result;

                    CSTAConfirmationEvent cstaConfirmation = new CSTAConfirmationEvent
                    {
                        u = { makePredictiveCall = makePredictiveCall }
                    };

                    return(cstaConfirmation);
                }
            }
            catch (Exception err)
            {
                logger.Error(string.Format("Error in CSTAMakePredictiveCallConfParser.Parse: {0}", err));
            }

            return(null);
        }
Пример #2
0
        public CSTAConfirmationEvent Parse(IStructReader reader)
        {
            Logger logger = LogManager.GetLogger("TSAPIClient");

            try
            {
                object result;

                logger.Info("CSTAQueryDndConfParser.Parse: eventType=CSTA_QUERY_DND_CONF");
                logger.Info("CSTAQueryDndConfParser.Parse: try to read the CSTAQueryDndConfEvent_t confirmation event...");

                if (reader.TryReadStruct(typeof(CSTAQueryDndConfEvent_t), out result))
                {
                    logger.Info("CSTAQueryDndConfParser.Parse: successfully read the CSTAQueryDndConfEvent_t confirmation event!");

                    CSTAQueryDndConfEvent_t queryDnd = (CSTAQueryDndConfEvent_t)result;

                    CSTAConfirmationEvent cstaConfirmation = new CSTAConfirmationEvent {
                        u = { queryDnd = queryDnd }
                    };

                    return(cstaConfirmation);
                }
            }
            catch (Exception err)
            {
                logger.Error(string.Format("Error in CSTAQueryDndConfParser.Parse: {0}", err));
            }

            return(null);
        }
Пример #3
0
        public CSTAConfirmationEvent Parse(IStructReader reader)
        {
            Logger logger = LogManager.GetLogger("TSAPIClient");

            try
            {
                object result;

                logger.Info("CSTAChangeMonitorFilterConfParser.Parse: eventType=CSTA_CHANGE_MONITOR_FILTER_CONF");
                logger.Info("CSTAChangeMonitorFilterConfParser.Parse: try to read the CSTAChangeMonitorFilterConfEvent_t confirmation event...");

                if (reader.TryReadStruct(typeof(CSTAChangeMonitorFilterConfEvent_t), out result))
                {
                    logger.Info("CSTAChangeMonitorFilterConfParser.Parse: successfully read the CSTAChangeMonitorFilterConfEvent_t confirmation event!");

                    CSTAChangeMonitorFilterConfEvent_t changeMonitorFilter = (CSTAChangeMonitorFilterConfEvent_t)result;

                    CSTAConfirmationEvent cstaConfirmation = new CSTAConfirmationEvent
                    {
                        u = { changeMonitorFilter = changeMonitorFilter }
                    };

                    return(cstaConfirmation);
                }

                return(null);
            }
            catch (Exception err)
            {
                logger.Error(string.Format("Error in CSTAChangeMonitorFilterConfParser.Parse: {0}", err));
            }

            return(null);
        }
        public CSTAConfirmationEvent Parse(IStructReader reader)
        {
            try
            {
                logger.Info("CSTAConferenceCallConfParser.Parse: eventType=CSTA_CONFERENCE_CALL_CONF");

                CSTAConferenceCallConfEvent_t conferenceCall = new CSTAConferenceCallConfEvent_t
                {
                    newCall  = ReadNewCall(reader),
                    connList = ReadConnList(reader)
                };

                CSTAConfirmationEvent cstaConfirmation = new CSTAConfirmationEvent {
                    u = { conferenceCall = conferenceCall }
                };

                return(cstaConfirmation);
            }
            catch (Exception err)
            {
                logger.Error(string.Concat("Error in CSTAConferenceCallConfParser.Parse: ", err.ToString()));
            }

            return(null);
        }
Пример #5
0
        public CSTAConfirmationEvent Parse(IStructReader reader)
        {
            Logger logger = LogManager.GetLogger("TSAPIClient");

            try
            {
                object result;

                logger.Info("CSTASetAgentStateConfParser.Parse: eventType=CSTA_SET_AGENT_STATE_CONF");
                logger.Info("CSTASetAgentStateConfParser.Parse: try to read the CSTASetAgentStateConfEvent_t confirmation event...");

                if (reader.TryReadStruct(typeof(CSTASetAgentStateConfEvent_t), out result))
                {
                    logger.Info("CSTASetAgentStateConfParser.Parse: successfully read the CSTASetAgentStateConfEvent_t confirmation event!");

                    CSTASetAgentStateConfEvent_t setAgentState = (CSTASetAgentStateConfEvent_t)result;

                    CSTAConfirmationEvent cstaConfirmation = new CSTAConfirmationEvent
                    {
                        u = { setAgentState = setAgentState }
                    };

                    return(cstaConfirmation);
                }

                return(null);
            }
            catch (Exception err)
            {
                logger.Error(string.Format("Error in CSTASetAgentStateConfParser.Parse: {0}", err));
            }

            return(null);
        }
        public CSTAConfirmationEvent Parse(IStructReader reader)
        {
            Logger logger = LogManager.GetLogger("TSAPIClient");

            try
            {
                object result;

                logger.Info("CSTARouteRegisterReqConfParser.Parse: eventType=CSTA_ROUTE_REGISTER_REQ_CONF");
                logger.Info("CSTARouteRegisterReqConfParser.Parse: try to read the CSTARouteRegisterReqConfEvent_t confirmation event...");

                if (reader.TryReadStruct(typeof(CSTARouteRegisterReqConfEvent_t), out result))
                {
                    logger.Info("CSTARouteRegisterReqConfParser.Parse: successfully read the CSTARouteRegisterReqConfEvent_t confirmation event!");

                    CSTARouteRegisterReqConfEvent_t routeRegister = (CSTARouteRegisterReqConfEvent_t)result;

                    CSTAConfirmationEvent cstaConfirmation = new CSTAConfirmationEvent
                    {
                        u = { routeRegister = routeRegister }
                    };

                    return(cstaConfirmation);
                }

                return(null);
            }
            catch (Exception err)
            {
                logger.Error(string.Format("Error in CSTARouteRegisterReqConfParser.Parse: {0}", err));
            }

            return(null);
        }
Пример #7
0
        public CSTAConfirmationEvent Parse(IStructReader reader)
        {
            Logger logger = LogManager.GetLogger("TSAPIClient");

            try
            {
                object result;                

                logger.Info("CSTAAnswerCallConfParser.Parse: eventType=CSTA_ANSWER_CALL_CONF");
                logger.Info("CSTAAnswerCallConfParser.Parse: try to read the CSTAAnswerCallConfEvent_t confirmation event...");

                if (reader.TryReadStruct(typeof(CSTAAnswerCallConfEvent_t), out result))
                {
                    logger.Info("CSTAAnswerCallConfParser.Parse: successfully read the CSTAAnswerCallConfEvent_t confirmation event!");

                    CSTAAnswerCallConfEvent_t answerCall = (CSTAAnswerCallConfEvent_t)result;

                    CSTAConfirmationEvent cstaConfirmation = new CSTAConfirmationEvent { u = { answerCall = answerCall } };

                    return cstaConfirmation;
                }
            }
            catch (Exception err)
            {
                logger.Error(string.Format("Error in CSTAAnswerCallConfParser.Parse: {0}", err));
            }

            return null;            
        }
Пример #8
0
        public CSTAConfirmationEvent Parse(IStructReader reader)
        {
            try
            {
                logger.Info("CSTASnapshotCallConfParser.Parse: eventType=CSTA_SNAPSHOT_CALL_CONF");

                CSTASnapshotCallConfEvent_t snapshotCall = new CSTASnapshotCallConfEvent_t
                {
                    snapshotData = ReadSnapshotCallData(reader)
                };

                CSTAConfirmationEvent cstaConfirmation = new CSTAConfirmationEvent {
                    u = { snapshotCall = snapshotCall }
                };

                return(cstaConfirmation);
            }
            catch (Exception err)
            {
                logger.Error(string.Format("Error in CSTASnapshotCallConfParser.Parse: {0}", err));
            }

            return(null);
        }
Пример #9
0
        public CSTAConfirmationEvent Parse(IStructReader reader)
        {
            Logger logger = LogManager.GetLogger("TSAPIClient");

            try
            {
                object result;

                logger.Info("CSTAUniversalFailureConfParser.Parse: eventType=CSTA_UNIVERSAL_FAILURE_CONF");
                logger.Info("CSTAUniversalFailureConfParser.Parse: try to read the CSTAUniversalFailureConfEvent_t confirmation event...");

                if (reader.TryReadStruct(typeof(CSTAUniversalFailureConfEvent_t), out result))
                {
                    logger.Info("CSTAUniversalFailureConfParser.Parse: successfully read the CSTAUniversalFailureConfEvent_t confirmation event!");

                    CSTAUniversalFailureConfEvent_t universalFailure = (CSTAUniversalFailureConfEvent_t)result;

                    logger.Info("CSTAUniversalFailureConfParser.Parse: universalFailure={0}", universalFailure.error);

                    CSTAConfirmationEvent cstaConfirmation = new CSTAConfirmationEvent
                    {
                        u = { universalFailure = universalFailure }
                    };

                    return(cstaConfirmation);
                }

                return(null);
            }
            catch (Exception err)
            {
                logger.Error(string.Format("Error in CSTAUniversalFailureConfParser.Parse: {0}", err));
            }

            return(null);
        }
        public CSTAConfirmationEvent Parse(IStructReader reader)
        {
            Logger logger = LogManager.GetLogger("TSAPIClient");

            try
            {
                logger.Info("CSTAMonitorConfParser.Parse: eventType=CSTA_MONITOR_CONF");
                logger.Info("CSTAMonitorConfParser.Parse: try to read the CSTAMonitorConfEvent_t confirmation event...");

                object result;

                if (reader.TryReadStruct(typeof(CSTAMonitorConfEvent_t), out result))
                {
                    logger.Info("CSTAMonitorConfParser.Parse: successfully read the CSTAMonitorConfEvent_t confirmation event!");

                    CSTAMonitorConfEvent_t monitorStart = (CSTAMonitorConfEvent_t)result;

                    logger.Info("CSTAMonitorConfParser.Parse: xref={0};", monitorStart.monitorCrossRefID);

                    CSTAConfirmationEvent cstaConfirmation = new CSTAConfirmationEvent
                    {
                        u = { monitorStart = monitorStart }
                    };

                    return(cstaConfirmation);
                }

                return(null);
            }
            catch (Exception err)
            {
                logger.Error(string.Format("Error in CSTAMonitorConfParser.Parse: {0}", err));
            }

            return(null);
        }
        public CSTAConfirmationEvent Parse(IStructReader reader)
        {
            Logger logger = LogManager.GetLogger("TSAPIClient");

            try
            {
                logger.Info("CSTAGetDeviceListConfParser.Parse: eventType=CSTA_GET_DEVICE_LIST_CONF");
                logger.Info("CSTAGetDeviceListConfParser.Parse: try to read the CSTAGetDeviceListConfEvent_t confirmation event...");

                object result;

                if (reader.TryReadStruct(typeof(CSTAGetDeviceListConfEvent_t), out result))
                {
                    logger.Info("CSTAGetDeviceListConfParser.Parse: successfully read the CSTAGetDeviceListConfEvent_t confirmation event!");

                    CSTAGetDeviceListConfEvent_t getDeviceList = (CSTAGetDeviceListConfEvent_t)result;

                    logger.Info("CSTAGetDeviceListConfParser.Parse: driverSdbLevel={0};level={1};index={2};devList={3};count={4};", getDeviceList.driverSdbLevel, getDeviceList.level, getDeviceList.index, getDeviceList.devList, getDeviceList.devList.count);

                    CSTAConfirmationEvent cstaConfirmation = new CSTAConfirmationEvent
                    {
                        u = { getDeviceList = getDeviceList }
                    };

                    return(cstaConfirmation);
                }

                return(null);
            }
            catch (Exception err)
            {
                logger.Error(string.Format("Error in CSTAGetDeviceListConfParser.Parse: {0}", err));
            }

            return(null);
        }
Пример #12
0
        public CSTAConfirmationEvent Parse(IStructReader reader)
        {
            try
            {
                logger.Info("CSTATransferCallConfParser.Parse: eventType=CSTA_TRANSFER_CALL_CONF");
                CSTATransferCallConfEvent_t transferCall = new CSTATransferCallConfEvent_t
                {
                    newCall  = ReadNewCall(reader),
                    connList = ReadConnList(reader)
                };

                CSTAConfirmationEvent cstaConfirmation = new CSTAConfirmationEvent {
                    u = { transferCall = transferCall }
                };

                return(cstaConfirmation);
            }
            catch (Exception err)
            {
                logger.Error(string.Format("Error in CSTATransferCallConfParser.Parse: {0}", err));
            }

            return(null);
        }
Пример #13
0
        internal CSTAEvent_t Read()
        {
            try
            {
                logger.Info("EventReader.Read: read event header...");

                object result;

                if (m_FrameReader.TryReadStruct(typeof(ACSEventHeader_t), out result))
                {
                    ACSEventHeader_t eventHeader = (ACSEventHeader_t)result;

                    logger.Info("EventReader.Read: acsHandle={0};eventClass={1};eventType={2};", eventHeader.acsHandle, eventHeader.eventClass, eventHeader.eventType);

                    switch (eventHeader.eventClass)
                    {
                    case Constants.CSTACONFIRMATION:

                        #region CSTACONFIRMATION

                        int invokeID = m_FrameReader.ReadInt32();

                        logger.Info("EventReader.Read.CSTACONFIRMATION: invokeID={0};", invokeID);

                        logger.Info("EventReader.Read.CSTACONFIRMATION: Getting CSTAConfParser from parserFactory...");
                        ICSTAConfirmationParser cstaConfParser = m_CSTAConfParserFactory.CreateParser(eventHeader.eventType);

                        if (cstaConfParser != null)
                        {
                            CSTAConfirmationEvent cstaConfirmation = cstaConfParser.Parse(m_FrameReader);
                            cstaConfirmation.invokeID = invokeID;

                            CSTAEvent_t cstaEvent = new CSTAEvent_t()
                            {
                                eventHeader = eventHeader,
                                Event       = { cstaConfirmation = cstaConfirmation }
                            };

                            return(cstaEvent);
                        }

                        logger.Info("EventReader.Read.CSTACONFIRMATION: ICSTAConfParserFactory failed to return parser!!");

                        #endregion CSTACONFIRMATION

                        break;

                    case Constants.CSTAUNSOLICITED:

                        #region CSTAUNSOLICITED

                        int xref = m_FrameReader.ReadInt32();

                        logger.Info("EventReader.Read.CSTAUNSOLICITED: xref={0};", xref);

                        logger.Info("EventReader.Read.CSTAUNSOLICITED: Getting CSTAUnsolicitedParser from parserFactory...");
                        ICSTAUnsolicitedParser cstaUnsolicitedParser = m_CSTAUnsolicitedParserFactory.CreateParser(eventHeader.eventType);

                        if (cstaUnsolicitedParser != null)
                        {
                            CSTAUnsolicitedEvent cstaUnsolicited = cstaUnsolicitedParser.Parse(m_FrameReader);

                            cstaUnsolicited.monitorCrossRefId = xref;

                            CSTAEvent_t cstaEvent = new CSTAEvent_t()
                            {
                                eventHeader = eventHeader,
                                Event       = { cstaUnsolicited = cstaUnsolicited }
                            };


                            return(cstaEvent);
                        }

                        logger.Info("EventReader.Read.CSTAUNSOLICITED: ICSTAUnsolicitedParserFactory failed to return parser!!");

                        #endregion CSTAUNSOLICITED

                        break;

                    case Constants.ACSCONFIRMATION:

                        #region ACSCONFIRMATION

                        invokeID = m_FrameReader.ReadInt32();

                        logger.Info("EventReader.Read.ACSCONFIRMATION: invokeID={0};", invokeID);

                        logger.Info("EventReader.Read.ACSCONFIRMATION: Getting ACSConfirmationParser from parserFactory...");
                        IACSConfirmationParser acsConfParser = m_ACSConfParserFactory.CreateParser(eventHeader.eventType);

                        if (acsConfParser != null)
                        {
                            ACSConfirmationEvent acsConfirmation = acsConfParser.Parse(m_FrameReader);
                            acsConfirmation.invokeID = invokeID;

                            CSTAEvent_t cstaEvent = new CSTAEvent_t()
                            {
                                eventHeader = eventHeader,
                                Event       = { acsConfirmation = acsConfirmation }
                            };

                            return(cstaEvent);
                        }

                        logger.Info("EventReader.Read.ACSCONFIRMATION: IACSConfirmationParserFactory failed to return parser!!");

                        #endregion ACSCONFIRMATION

                        break;

                    case Constants.ACSUNSOLICITED:

                        #region ACSUNSOLICITED

                        logger.Info("ACSUNSOLICITED :: Getting ACSUnsolicitedParser from parserFactory...");
                        IACSUnsolicitedParser acsUnsolicitedParser = m_ACSUnsolicitedParserFactory.CreateParser(eventHeader.eventType);

                        if (acsUnsolicitedParser != null)
                        {
                            ACSUnsolicitedEvent acsUnsolicited = acsUnsolicitedParser.Parse(m_FrameReader);

                            CSTAEvent_t cstaEvent = new CSTAEvent_t()
                            {
                                eventHeader = eventHeader,
                                Event       = { acsUnsolicited = acsUnsolicited }
                            };


                            return(cstaEvent);
                        }

                        logger.Info("ACSUNSOLICITED :: IACSUnsolicitedParserFactory failed to return parser!!");

                        #endregion ACSUNSOLICITED

                        break;
                    }
                }
            }
            catch (Exception err)
            {
                logger.Error(string.Format("Error in EventReader.ReadEvent: {0}", err));
            }

            return(null);
        }