//-------------------------------------------- Private -----------------------------------
        CustomerRoute getCustomerRoute(short pServiceId, int pBaseRouteId)
        {
            CustomerRoute _customerRoute = null;

            using (Rbr_Db _db = new Rbr_Db()) {
                RouteRow _routeRow = _db.RouteCollection.GetByPrimaryKey(pBaseRouteId);
                if (_routeRow != null)
                {
                    WholesaleRouteRow _wholesaleRouteRow = _db.WholesaleRouteCollection.GetByServiceIdBaseRouteId(pServiceId, pBaseRouteId);
                    if (_wholesaleRouteRow != null)
                    {
                        _customerRoute = new CustomerRoute(_wholesaleRouteRow, _routeRow);
                    }
                    else
                    {
                        T.LogRbr(LogSeverity.Error, "CustomerRouteImdbRepository.getCustomerRoute", string.Format("ServiceRouteRow NOT FOUND: {0}, {1}", pServiceId, pBaseRouteId));
                    }
                }
                else
                {
                    T.LogRbr(LogSeverity.Error, "CustomerRouteImdbRepository.getCustomerRoute", string.Format("CustomerRouteRow NOT FOUND: {0}, {1}", pServiceId, pBaseRouteId));
                }
            }
            return(_customerRoute);
        }
Example #2
0
        public ActionResult Territory(Zipcode zipId, Worker id)
        {
            var customerZipList = _context.Customers.Include(m => m.Zipcode).Include(c => c.City).Include(s => s.State).Include(d => d.PickUpDay).ToList();

            var customers = customerZipList;
            var customerz = new List <Customer>();

            foreach (var customer in customers)
            {
                if (customer.ZipcodeId == zipId.Id)
                {
                    customerz.Add(customer);
                }
            }
            customers = customerZipList;

            Worker temporaryWorker = new Worker();

            temporaryWorker.CustomerList = customers;

            var viewModel = new CustomerRoute
            {
                Customers   = customerz,
                WorkerZipId = zipId.Id
            };


            //customer.ConcatAddress = customer.Address.StreetOne + " " + customer.Address.StreetTwo + " " + customer.Address.City.CityName + "," + customer.Address.State.StateName + " " + customer.Address.Zipcode.ZipcodeNum;
            return(View("Territory", viewModel));
        }
Example #3
0
        public ActionResult DoWTerritory(int id, int zipId)
        {
            var customerZipList = _context.Customers.Include(m => m.Zipcode).Include(c => c.City).Include(s => s.State).Include(d => d.PickUpDay).ToList();

            var customers = customerZipList;
            var customerz = new List <Customer>();

            foreach (var customer in customers)
            {
                if (customer.ZipcodeId == zipId && customer.PickUpDayId == id)
                {
                    customerz.Add(customer);
                }
            }
            customers = customerZipList;

            Worker temporaryWorker = new Worker();

            temporaryWorker.CustomerList = customers;

            var viewModel = new CustomerRoute
            {
                DayOfWeekId = id,
                Customers   = customerz,
                WorkerZipId = zipId
            };



            return(View("CustomerSameZipCode", viewModel));
        }
        public void TestLCR()
        {
            var _customerAcct  = CustomerAcct.Get(1180);
            var _customerRoute = CustomerRoute.Get(7248, 40, 258);
            var _legOutList    = RoutingService.Instance.GetTerminationByDestination(_customerAcct, _customerRoute, "5535520312389", 10800);

            Assert.IsTrue(_legOutList.Count == 2);
        }
Example #5
0
        public List <LegOut> GetTerminationByDestination(CustomerAcct pCustomerAcct, CustomerRoute pCustomerRoute, string pDestNumber, int pTimeLimit)
        {
            var _routingAlgorithm = pCustomerRoute.RoutingAlgorithmType;

            TimokLogger.Instance.LogRbr(LogSeverity.Status, "RbrDispatcher.GetTerminationByDestination", string.Format("Routing Alghorithm={0}", _routingAlgorithm));

            var _carrierRoutes = getCarrierRoutes(pCustomerAcct, pCustomerRoute, _routingAlgorithm, pDestNumber);

            if (_carrierRoutes == null || _carrierRoutes.Count == 0)
            {
                throw new RbrException(RbrResult.Carrier_NoRoutesFound, "RoutingService.GetTerminationByDestination", string.Format("DestinationNumber={0}", pDestNumber));
            }

            var _termInfoList = new List <TerminationInfo>();

            foreach (var _carrierRoute in _carrierRoutes)
            {
                var _carrierAcct = CarrierAcct.Get(_carrierRoute.CarrierAcctId);
                if (_carrierAcct.Status != Status.Active)
                {
                    TimokLogger.Instance.LogRbr(LogSeverity.Error, "RoutingService.GetTerminationByDestination", string.Format("CarrierAcct NOT Active, CarrierAcct={0}", _carrierAcct.Id));
                    continue;
                }

                if (CarrierAcct.NumberOfCallsCounter.ContainsKey(_carrierAcct.Id))
                {
                    if (CarrierAcct.NumberOfCallsCounter[_carrierAcct.Id] >= _carrierAcct.MaxNumberOfCalls)
                    {
                        TimokLogger.Instance.LogRbr(LogSeverity.Error, "RoutingService.GetTerminationByDestination", string.Format("CarrierAcct Max Calls Limit, CarrierAcct={0}", _carrierAcct.Id));
                        continue;
                    }
                }
                else
                {
                    CarrierAcct.NumberOfCallsCounter.Add(_carrierAcct.Id, 0);
                }
                CarrierAcct.NumberOfCallsCounter[_carrierAcct.Id] += 1;

                var _termEP = _carrierRoute.GetFirstTermEndpoint();
                if (_termEP == null)
                {
                    continue;
                }

                var _termInfo = new TerminationInfo(_carrierAcct, _carrierRoute, _termEP);
                TimokLogger.Instance.LogRbr(LogSeverity.Debug, "RbrDispatcher.GetTerminationByDestination", string.Format("TermInfo={0}", _termInfo));
                _termInfoList.Add(_termInfo);
            }

            if (_termInfoList == null || _termInfoList.Count == 0)
            {
                throw new RbrException(RbrResult.Carrier_NoTermEPsFound, "RoutingService.GetTerminationByDestination", string.Format("DestinationNumber={0}", pDestNumber));
            }

            return(getLegOutOptions(pCustomerAcct, pDestNumber, _termInfoList, pTimeLimit));
        }
        static bool rerateCDR(CDRViewRow_Base pCdrViewRow, IBackgroundWorker pBackgroundWorker)
        {
            try {
                var _customerAcct = CustomerAcct.Get(pCdrViewRow.Customer_acct_id);
                if (_customerAcct == null)
                {
                    pBackgroundWorker.ReportStatus(string.Format("ERROR! CustomerAcct NOT FOUND, {0}", pCdrViewRow.Customer_acct_id));
                    return(false);
                }

                var _customerRoute = CustomerRoute.Get(_customerAcct.ServiceId, _customerAcct.RoutingPlanId, pCdrViewRow.Customer_route_id);
                if (_customerRoute == null)
                {
                    pBackgroundWorker.ReportStatus(string.Format("ERROR! CustomerRoute NOT FOUND, {0}", pCdrViewRow.Customer_route_id));
                    return(false);
                }

                var _carrierAcct = CarrierAcct.Get(pCdrViewRow.Carrier_acct_id);
                if (_carrierAcct == null)
                {
                    pBackgroundWorker.ReportStatus(string.Format("ERROR! CarrierAcct NOT FOUND, {0}", pCdrViewRow.Carrier_acct_id));
                    return(false);
                }

                var _carrierRoute = CarrierRoute.Get(_carrierAcct.Id, pCdrViewRow.Carrier_route_id);
                if (_carrierRoute == null)
                {
                    pBackgroundWorker.ReportStatus(string.Format("ERROR! CarrierRoute NOT FOUND, {0}", pCdrViewRow.Carrier_route_id));
                    return(false);
                }

                var _cdr = new Cdr(pCdrViewRow);
                _customerAcct.RateCall(_customerRoute, ref _cdr);
                pCdrViewRow.Customer_duration = _cdr.CustomerDuration;
                pCdrViewRow.Price             = _cdr.CustomerPrice;
                _carrierAcct.RateCall(_carrierRoute, ref _cdr);
                pCdrViewRow.Carrier_duration = _cdr.CarrierDuration;
                pCdrViewRow.Cost             = _cdr.CarrierCost;
            }
            catch (Exception _ex) {
                pBackgroundWorker.ReportStatus(string.Format("Exception! {0}", _ex.Message));
                TimokLogger.Instance.LogRbr(LogSeverity.Critical, "CdrExportController.rerate", string.Format("Exception:\r\n{0}", _ex));
                return(false);
            }
            return(true);
        }
Example #7
0
        int parseCustomer(Cdr pCdr, out CustomerAcct pCustomerAcct, out CustomerRoute pCustomerRoute)
        {
            var _result = 0;

            pCustomerAcct  = null;
            pCustomerRoute = null;

            try {
                pCustomerAcct = pCdr.CustomerAcctId > 0 ? CustomerAcct.Get(pCdr.CustomerAcctId) : CustomerAcct.Get(pCdr.DNIS);

                if (CustomerAcct.NumberOfCallsCounter.ContainsKey(pCustomerAcct.Id))
                {
                    if (CustomerAcct.NumberOfCallsCounter[pCustomerAcct.Id] > 0)
                    {
                        T.LogRbr(LogSeverity.Debug, "BillingService.parseCustomer:", string.Format("Calls LIMIT stat, CustomerAcct={0}, NumberOfCalls={1}", pCustomerAcct.Id, CustomerAcct.NumberOfCallsCounter[pCustomerAcct.Id]));
                        CustomerAcct.NumberOfCallsCounter[pCustomerAcct.Id] -= 1;
                    }
                }

                //-- get customer route
                pCustomerRoute = CustomerRoute.Get(pCustomerAcct.ServiceId, pCustomerAcct.RoutingPlanId, pCdr.CustomerBaseRouteId);
                if (pCustomerRoute == null)
                {
                    T.LogRbr(LogSeverity.Debug, "BillingService.parseCustomer:", string.Format("Didn't find CustomerRoute by CustomerRouteId={0}", pCdr.CustomerBaseRouteId));
                    try { pCustomerRoute = CustomerRoute.Get(pCustomerAcct.ServiceId, pCustomerAcct.CallingPlanId, pCustomerAcct.RoutingPlanId, pCdr.DestNumber); } catch { }
                    if (pCustomerRoute == null)
                    {
                        T.LogRbr(LogSeverity.Debug, "BillingService.parseCustomer:", string.Format("Didn't find CustomerRoute by ServiceId={0}, CallingPlanId={1}, DestNumber={2}", pCustomerAcct.ServiceId, pCustomerAcct.CallingPlanId, pCdr.DestNumber));
                        return(++_result);
                    }
                }
            }
            catch (RbrException _ex) {
                T.LogRbr(LogSeverity.Error, "BillingService.parseCustomer:", string.Format("Exception:\r\n{0}", _ex.Message));
                return(1);
            }
            catch (Exception _ex) {
                T.LogRbr(LogSeverity.Error, "BillingService.parseCustomer:", string.Format("Exception:\r\n{0}", _ex));
                return(1);
            }
            return(_result);
        }
        public override RbrResult AuthorizeRetail(ISession pSession, out LegIn pLegIn, out List <LegOut> pLegOutOptions)
        {
            pLegIn = new LegIn
            {
                ANI             = pSession.ANI,
                IP              = pSession.OrigIPAddress,
                IPAndPort       = string.Empty,
                CustomerAcctId  = 0,
                CustomerRouteId = 0,
                PromptTimeLimit = 0
            };

            pLegOutOptions = null;

            try {
                logger.LogRbr(LogSeverity.Status, AUTHORIZE_RETAIL_LABEL, string.Format("Request: IP={0}, ANI={1}, AccessNumber={2}, CardNumber={3}, DestNumber={4}", pSession.OrigIPAddress, pSession.ANI, pSession.AccessNumber, pSession.CardNumber, pSession.DestNumber));

                var _retailService = RetailService.Get(pSession.AccessNumber);
                var _retailAcct    = _retailService.GetRetailAccount(pSession);

                var _customerAcct = CustomerAcct.Get(_retailAcct.CustomerAcctId);

                if (CustomerAcct.NumberOfCallsCounter.ContainsKey(_customerAcct.Id))
                {
                    if (CustomerAcct.NumberOfCallsCounter[_customerAcct.Id] > _customerAcct.MaxNumberOfCalls)
                    {
                        throw new RbrException(RbrResult.Customer_MaxCallsReached, AUTHORIZE_RETAIL_LABEL, string.Format("CustomerAcct ID={0}, MaxCalls={1}", _customerAcct.Id, CustomerAcct.NumberOfCallsCounter[_customerAcct.Id]));
                    }
                }
                else
                {
                    CustomerAcct.NumberOfCallsCounter.Add(_customerAcct.Id, 0);
                }
                CustomerAcct.NumberOfCallsCounter[_customerAcct.Id] += 1;

                var _destNumber    = routingService.CleanDestNumber(string.Empty, pSession.DestNumber);
                var _customerRoute = CustomerRoute.Get(_customerAcct.ServiceId, _customerAcct.CallingPlanId, _customerAcct.RoutingPlanId, _destNumber);
                pLegIn.CustomerRouteId = _customerRoute.BaseRouteId;

                //-- Authorize Wholesale Account
                var _wholesaleTimeLimit = _customerAcct.Authorize(_customerRoute);

                //-- Authorize Retail Account
                int _timeLimit;
                _retailService.Authorize(pSession, _retailAcct, _customerRoute, out _timeLimit, out pLegIn.PromptTimeLimit);
                if (_timeLimit > _wholesaleTimeLimit)
                {
                    logger.LogRbr(LogSeverity.Status, AUTHORIZE_RETAIL_LABEL, string.Format("Customer MaxCallTime REACHED, CustomerAcctId={0}, TimeLimit={1}", _customerAcct.Id, _wholesaleTimeLimit));
                    _timeLimit = _wholesaleTimeLimit;
                }
                if (_timeLimit == 0)
                {
                    throw new RbrException(RbrResult.Retail_NoBalanceForRoute, AUTHORIZE_RETAIL_LABEL, string.Format("NOT Enough Balance for Route, CustomerAcctId={0}, (W) RouteId={1}", _customerAcct.Id, _customerRoute.WholesaleRouteId));
                }
                //-- propmpt multiplier
                if (_customerRoute.Multiplier > 0)
                {
                    pLegIn.PromptTimeLimit = (_timeLimit * _customerRoute.Multiplier) / 100;
                }
                else
                {
                    pLegIn.PromptTimeLimit = _timeLimit;
                }

                pLegOutOptions = routingService.GetTerminationByDestination(_customerAcct, _customerRoute, _destNumber, _timeLimit);

                _retailAcct.UpdateUsage();

                //TODO: Move up to IVR for additional LCR calls!!
                cdrAggrExporter.OnCallSetup(pSession.AccessNumber, pLegOutOptions[0].CarrierAcctId, pLegOutOptions[0].CarrierBaseRouteId, _customerAcct.Id, pLegIn.CustomerRouteId, pSession.OrigIPAddress, IPUtil.ExtractIPAddress(pLegOutOptions[0].DestIPAndPort));

                logger.LogRbr(LogSeverity.Status, AUTHORIZE_RETAIL_LABEL, string.Format("Response: Dest#={0}, CalledIP={1}, CustId={2}, CarrierId={3}, CustRouteId={4}, CarrierRouteId={5}, TimeLimit={6}, PTimeLimit={7}",
                                                                                        /**/ pLegOutOptions[0].DestNumber,
                                                                                        /**/ pLegOutOptions[0].DestIPAndPort,
                                                                                        /**/ _customerAcct.Id,
                                                                                        /**/ pLegOutOptions[0].CarrierAcctId,
                                                                                        /**/ _customerRoute.BaseRouteId,
                                                                                        /**/ pLegOutOptions[0].CarrierBaseRouteId,
                                                                                        /**/ pLegOutOptions[0].TimeLimit,
                                                                                        /**/ pLegIn.PromptTimeLimit));
            }
            catch (RbrException _rbrex) {
                logger.LogRbr(LogSeverity.Error, AUTHORIZE_RETAIL_LABEL, string.Format("RbrException, from: {0}\r\n{1}", _rbrex.Source, _rbrex.Message));
                return(_rbrex.RbrResult);
            }
            catch (Exception _ex) {
                logger.LogRbr(LogSeverity.Critical, AUTHORIZE_RETAIL_LABEL, string.Format("Exception:\r\n{0}", _ex));
                return(RbrResult.ExceptionThrown);
            }
            return(RbrResult.Success);
        }
Example #9
0
        public override RbrResult AuthorizeWholesale(string pCallId,
                                                     string pOrigIP,
                                                     string pAlias,
                                                     string pANI,
                                                     string pDestNumber,
                                                     out LegIn pLegIn,
                                                     out List <LegOut> pLegOutOptions)
        {
            pLegIn = new LegIn
            {
                ANI             = pANI,
                CustomerAcctId  = 0,
                CustomerRouteId = 0,
                IP              = pOrigIP,
                IPAndPort       = String.Empty,
                PromptTimeLimit = 0
            };

            pLegOutOptions = null;
            var _outDestNumber = pDestNumber;             //it may be cleared of inbound prefix and overwritten by outbound Prefix, IntlDialCode

            try {
                //-- Resolve OrigEndPoint and strip off origPrefix intl -dialcode:
                var _origEP = Endpoint.Get(pOrigIP);
                if (_origEP == null)
                {
                    throw new RbrException(RbrResult.OrigEP_NotFound, AUTHORIZE_WHOLESALE_LABEL, string.Format("OrigEP IP={0}", pOrigIP));
                }
                _origEP.TakeSample();
                pLegIn.IPAndPort = string.Format("{0}:{1}", _origEP.IPAddress, _origEP.Port);
                if (_origEP.Status != Status.Active)
                {
                    throw new RbrException(RbrResult.OrigEP_NotActive, AUTHORIZE_WHOLESALE_LABEL, string.Format("OrigEP IP={0}", _origEP.IPAddress));
                }

                //-- Get inbound prefix and clean destNumber
                var _prefixIn = _origEP.GetPrefixIn(_outDestNumber);
                _outDestNumber = routingService.CleanDestNumber(_prefixIn, _outDestNumber);

                //-- First try to get CustomerAcct:
                var _customerAcct = CustomerAcct.Get(_origEP, _prefixIn);
                if (_customerAcct == null)
                {
                    throw new RbrException(RbrResult.Customer_NotFound, AUTHORIZE_WHOLESALE_LABEL, string.Format("CustomerAcct NOT FOUND, OrigEPId={0}, Prefix={1}", _origEP.Id, _prefixIn));
                }
                pLegIn.CustomerAcctId = _customerAcct.Id;

                //-- Limit CustomerAcct number of Calls
                if (CustomerAcct.NumberOfCallsCounter.ContainsKey(_customerAcct.Id))
                {
                    if (CustomerAcct.NumberOfCallsCounter[_customerAcct.Id] > _customerAcct.MaxNumberOfCalls)
                    {
                        throw new RbrException(RbrResult.Customer_MaxCallsReached, AUTHORIZE_WHOLESALE_LABEL, string.Format("CustomerAcct ID={0}, MaxCalls={1}", _customerAcct.Id, CustomerAcct.NumberOfCallsCounter[_customerAcct.Id]));
                    }
                }
                else
                {
                    CustomerAcct.NumberOfCallsCounter.Add(_customerAcct.Id, 0);
                }
                CustomerAcct.NumberOfCallsCounter[_customerAcct.Id] += 1;

                //-- Get and validate customer route:
                var _customerRoute = CustomerRoute.Get(_customerAcct.ServiceId, _customerAcct.CallingPlanId, _customerAcct.RoutingPlanId, _outDestNumber);
                pLegIn.CustomerRouteId = _customerRoute.BaseRouteId;
                if (_customerRoute.Status != Status.Active)
                {
                    throw new RbrException(RbrResult.Customer_RouteBlocked, AUTHORIZE_WHOLESALE_LABEL, string.Format("Customer Route BLOCKED, RouteId={0}", _customerRoute));
                }

                //-- Authorize CustomerAcct and get TimeLimit (if PrepaidEnabled):
                var _timeLimit = _customerAcct.Authorize(_customerRoute);

                //-- Get best termination choice:
                pLegOutOptions = routingService.GetTerminationByDestination(_customerAcct, _customerRoute, _outDestNumber, _timeLimit);

                //TODO: Move up to IVR for additional LCR calls!!
                cdrAggrExporter.OnCallSetup(string.Empty,
                                            pLegOutOptions[0].CarrierAcctId,
                                            pLegOutOptions[0].CarrierBaseRouteId,
                                            _customerAcct.Id,
                                            pLegIn.CustomerRouteId,
                                            _origEP.IPAddress,
                                            IPUtil.ExtractIPAddress(pLegOutOptions[0].DestIPAndPort));
            }
            catch (RbrException _rbrex) {
                logger.LogRbr(LogSeverity.Error, AUTHORIZE_WHOLESALE_LABEL, string.Format("RbrException, from: {0}\r\n{1}", _rbrex.Source, _rbrex.Message));
                return(_rbrex.RbrResult);
            }
            catch (Exception _ex) {
                logger.LogRbr(LogSeverity.Critical, AUTHORIZE_WHOLESALE_LABEL, string.Format("Exception:\r\n{0}", _ex));
                return(RbrResult.ExceptionThrown);
            }
            return(RbrResult.Success);
        }
Example #10
0
        /// <summary>
        /// ----------------------------------------------------------------------------------------
        /// </summary>
        public int ProcessCallComplete(Cdr pCdr)
        {
            //-- Get OrigEP
            var _origEP = Endpoint.Get(pCdr.OrigIP);

            if (_origEP == null)
            {
                T.LogRbr(LogSeverity.Critical, "ProcessCallComplete:", string.Format("Endpoint NOT FOUND, IP={0}", pCdr.OrigIP));
                return(1);
            }
            pCdr.OrigEPId = _origEP.Id;

            //-- Remove prefix and '011' from destination number
            if (_origEP.WithPrefixes)
            {
                pCdr.PrefixIn = _origEP.GetPrefixIn(pCdr.DestNumber);
                if (pCdr.PrefixIn.Length > 0)
                {
                    pCdr.DestNumber = pCdr.DestNumber.Substring(pCdr.PrefixIn.Length);
                }
            }
            pCdr.LocalNumber = pCdr.DestNumber;

            if (pCdr.DestNumber.StartsWith(AppConstants.ZeroOneOne))
            {
                pCdr.DestNumber = pCdr.DestNumber.Substring(3);
            }

            //-- get carrier acct, termEp and route
            int          _result       = 0;
            CarrierRoute _carrierRoute = null;
            CarrierAcct  _carrierAcct  = null;

            if (_result == 0)
            {
                _result = parseCarrier(pCdr, out _carrierAcct, out _carrierRoute);
            }

            //-- Get CustomerAcct and route
            CustomerRoute _customerRoute = null;
            CustomerAcct  _customerAcct  = null;

            if (pCdr.CustomerAcctId > 0 || pCdr.DNIS > 0)
            {
                _result = parseCustomer(pCdr, out _customerAcct, out _customerRoute);
                if (_customerRoute != null)
                {
                    pCdr.CountryCode       = _customerRoute.CountryCode;
                    pCdr.CustomerRouteName = _customerRoute.Name;
                    pCdr.LocalNumber       = pCdr.DestNumber.Substring(_customerRoute.CountryCode.ToString().Length);
                }
            }
            else
            {
                _result++;
            }

            //-- extract prefix-out
            if (_carrierAcct != null && !string.IsNullOrEmpty(_carrierAcct.PrefixOut))
            {
                pCdr.PrefixOut = _carrierAcct.PrefixOut;
            }
            else if (_customerAcct != null && !string.IsNullOrEmpty(_customerAcct.PrefixOut))
            {
                pCdr.PrefixOut = _customerAcct.PrefixOut;
            }

            //-- do rating, debiting
            if (_carrierAcct != null && _customerAcct != null && pCdr.Duration > 0 && _result == 0)
            {
                _result += _carrierAcct.RateCall(_carrierRoute, ref pCdr);
                _result += _customerAcct.RateCall(_customerRoute, ref pCdr);
                if (_customerAcct.IsPrepaid)
                {
                    _customerAcct.Debit(pCdr.CustomerPrice);
                }
            }

            //-- always do Retail RetailAcct and SubAcct status needs to be reset to 'Active'
            var _retailAcct = RetailAccount.Get(_customerAcct, pCdr, configuration, T);

            if (_retailAcct != null && _customerRoute != null)
            {
                _result += _retailAcct.Rate(_customerRoute, ref pCdr);
                if (_retailAcct.IsPrepaid && pCdr.RetailPrice > decimal.Zero)
                {
                    _retailAcct.Debit(pCdr.RetailPrice, pCdr.UsedBonusMinutes);
                }
            }

            //-- Write to text file
            if (configuration.Main.LogCdrToFile)
            {
                _result += dualFileWriter.WriteLine(pCdr.Export());
            }

            return(_result);
        }