Example #1
0
        protected void Authorize(ServiceType pServiceType)
        {
            cdr.DestNumber = session.DestNumber;

            RbrResult _rc;

            if (pServiceType == ServiceType.Wholesale)
            {
                _rc = sessionHandler.AuthorizeWholesale(session.Id, session.OrigIPAddress, string.Empty, session.ANI, session.DestNumber, out LegIn, out legOutOptions);
            }
            else if (pServiceType == ServiceType.Retail)
            {
                _rc = sessionHandler.AuthorizeRetail(session, out LegIn, out legOutOptions);
            }
            else
            {
                throw new Exception(string.Format("SessionScriptBase.Authorize: Unknown ServiceType: {0}", pServiceType));
            }

            if (LegIn != null)
            {
                session.CustomerAcctId = LegIn.CustomerAcctId;                  //TODO: remove CustomerID from ISession !
                cdr.Set(LegIn);
            }

            if (_rc != RbrResult.Success)
            {
                throw new RbrException(_rc, string.Format("SessionScriptBase.Authorize{0}", pServiceType), string.Format("RbrResult={0}", _rc));
            }

            setLegOutOptions();
        }