public ATTEvent_t Parse(IStructReader reader)
        {
            Logger logger = LogManager.GetLogger("TSAPIClient");

            try
            {
                logger.Info("ATTQueryAgentStateConfParser.Parse: eventType=ATT_QUERY_AGENT_STATE_CONF");

                object result;

                if (reader.TryReadStruct(typeof(ATTQueryAgentStateConfEvent_t), out result))
                {
                    ATTQueryAgentStateConfEvent_t queryAgentState = (ATTQueryAgentStateConfEvent_t)result;

                    ATTEvent_t attEvent = new ATTEvent_t()
                    {
                        eventType = (ushort)eventType
                    };

                    attEvent.u.queryAgentState = queryAgentState;

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

            return(null);
        }
Beispiel #2
0
        public void Invoke(CSTAQueryAgentStateConfEvent_t csta, ATTQueryAgentStateConfEvent_t att)
        {
            if (_start)
            {
                _mode = att;
                _sate = csta.agentState;
                if (csta.agentState == AgentState_t.agNull)
                {
                    LogoutInvoke();
                }
                else
                {
                    LoginInvoke();
                    switch (_mode.workMode)
                    {
                    case ATTWorkMode_t.wmManualIn: ReadyInvoke(); break;

                    case ATTWorkMode_t.wmAuxWork: NotReadyInvoke(); break;

                    case ATTWorkMode_t.wmAftcalWk: AftCallInvoke(); break;
                    }
                }
                _start = false;
            }
            else
            {
                if (_sate != csta.agentState || _mode.workMode != att.workMode || _mode.reasonCode != att.reasonCode || _mode.talkState != att.talkState)
                {
                    if (csta.agentState == AgentState_t.agNull && _sate != AgentState_t.agNull)
                    {
                        LogoutInvoke();
                    }
                    if (csta.agentState != AgentState_t.agNull && _sate == AgentState_t.agNull)
                    {
                        LoginInvoke();
                    }
                    _mode = att;
                    _sate = csta.agentState;
                    switch (_mode.workMode)
                    {
                    case ATTWorkMode_t.wmAutoIn:
                    case ATTWorkMode_t.wmManualIn: ReadyInvoke(); break;

                    case ATTWorkMode_t.wmAuxWork: NotReadyInvoke(); break;

                    case ATTWorkMode_t.wmAftcalWk: AftCallInvoke(); break;
                    }
                }
            }

            _timer.Change((long)Timeouts.Login, (long)Timeouts.Login);
        }
Beispiel #3
0
 public QueryAgentStateEventReturn(CstaConfirmationEvent a1, ATTEvent_t a2)
 {
     Csta = a1.queryAgentState;
     Att  = a2.queryAgentState;
 }