示例#1
0
        public ScriptInfo Create(ISession pSession)
        {
            ScriptInfo _script = null;

            try {
                TimokLogger.Instance.LogRbr(LogSeverity.Status, INIT_SESSION_LABEL, string.Format("Request: ANI={0}, IP={1}, AccessNumber={2}, DestNumber={3}", pSession.ANI, pSession.OrigIPAddress, pSession.AccessNumber, pSession.DestNumber));
                globalCPS.TakeSample();

                var _origEP = Endpoint.Get(pSession.OrigIPAddress);
                if (_origEP == null)
                {
                    TimokLogger.Instance.LogRbr(LogSeverity.Error, INIT_SESSION_LABEL, string.Format("Endpoint NOT FOUND, {0}", pSession.OrigIPAddress));
                    return(_script);
                }
                _origEP.TakeSample();

                if (Configuration.Instance.Main.ANIRequired)                    //NOTE: this should be CustomerAcct property
                {
                    TimokLogger.Instance.LogRbr(LogSeverity.Debug, INIT_SESSION_LABEL, "Validating ANI");
                    validateANI(pSession.ANI);
                }

                var _retailService = RetailService.Get(pSession.AccessNumber);
                if (_retailService == null)
                {
                    TimokLogger.Instance.LogRbr(LogSeverity.Debug, INIT_SESSION_LABEL, "Get Wholesale Script");
                    _script = getWholesaleScript();
                }
                else
                {
                    TimokLogger.Instance.LogRbr(LogSeverity.Debug, INIT_SESSION_LABEL, "Get CustomerAcctId");
                    pSession.CustomerAcctId = CustomerAcct.GetCustomerAcctId(pSession.AccessNumber);
                    _script = _retailService.GetRetailScript();
                }
            }
            catch (RbrException _rbrex) {
                TimokLogger.Instance.LogRbr(LogSeverity.Error, INIT_SESSION_LABEL, string.Format("RbrException, from: {0}\r\n{1}", _rbrex.Source, _rbrex.Message));
            }
            catch (Exception _ex) {
                TimokLogger.Instance.LogRbr(LogSeverity.Critical, INIT_SESSION_LABEL, string.Format("Exception:\r\n{0}", _ex));
            }
            finally {
                TimokLogger.Instance.LogRbr(LogSeverity.Status, INIT_SESSION_LABEL, string.Format("Response: ScriptInfo={0}", _script == null ? "null" : _script.ToString()));
            }
            return(_script);
        }
示例#2
0
 //--------------------- Public instance methods -------------------------------------
 public void TakeSample()
 {
     cpsMeter.TakeSample();
 }