From f3e97e33927d630776b3d9cf8d4f69bb6fbff1df Mon Sep 17 00:00:00 2001 From: DanB Date: Mon, 2 Mar 2015 13:19:42 +0100 Subject: [PATCH] Paginator parameters rename --- apier/v1/scheduler.go | 8 +- cmd/cgr-engine/cgr-engine.go | 2 +- config/config.go | 65 +++---- data/conf/cgrates/cgrates.json | 2 +- data/scripts/pkg/debian/postinst | 2 +- .../cgrates/tariffplans/AccountActions.csv | 5 - .../cgrates/tariffplans/ActionPlans.csv | 2 - .../cgrates/tariffplans/ActionTriggers.csv | 4 - .../fs_csv/cgrates/tariffplans/Actions.csv | 3 - .../cgrates/tariffplans/DestinationRates.csv | 4 - .../cgrates/tariffplans/Destinations.csv | 4 - .../fs_csv/cgrates/tariffplans/README.md | 14 -- .../fs_csv/cgrates/tariffplans/Rates.csv | 7 - .../cgrates/tariffplans/RatingPlans.csv | 2 - .../cgrates/tariffplans/RatingProfiles.csv | 2 - .../fs_csv/cgrates/tariffplans/Timings.csv | 3 - .../fs_json/cgrates/etc/cgrates/cgrates.cfg | 174 ------------------ .../fs_json/cgrates/etc/default/cgrates | 4 +- .../fs_json/cgrates/etc/init.d/cgrates | 26 +-- .../cgrates/tariffplans/AccountActions.csv | 6 - .../cgrates/tariffplans/ActionPlans.csv | 5 - .../cgrates/tariffplans/ActionTriggers.csv | 4 - .../fs_json/cgrates/tariffplans/Actions.csv | 7 - .../cgrates/tariffplans/DerivedChargers.csv | 2 - .../cgrates/tariffplans/DestinationRates.csv | 8 - .../cgrates/tariffplans/Destinations.csv | 4 - .../fs_json/cgrates/tariffplans/README.md | 24 --- .../fs_json/cgrates/tariffplans/Rates.csv | 8 - .../cgrates/tariffplans/RatingPlans.csv | 18 -- .../cgrates/tariffplans/RatingProfiles.csv | 4 - .../cgrates/tariffplans/SharedGroups.csv | 2 - .../fs_json/cgrates/tariffplans/Timings.csv | 7 - engine/storage_sql.go | 51 ++--- utils/apitpdata.go | 16 +- utils/consts.go | 3 +- 35 files changed, 99 insertions(+), 403 deletions(-) delete mode 100644 data/tutorials/fs_csv/cgrates/tariffplans/AccountActions.csv delete mode 100644 data/tutorials/fs_csv/cgrates/tariffplans/ActionPlans.csv delete mode 100644 data/tutorials/fs_csv/cgrates/tariffplans/ActionTriggers.csv delete mode 100644 data/tutorials/fs_csv/cgrates/tariffplans/Actions.csv delete mode 100644 data/tutorials/fs_csv/cgrates/tariffplans/DestinationRates.csv delete mode 100644 data/tutorials/fs_csv/cgrates/tariffplans/Destinations.csv delete mode 100644 data/tutorials/fs_csv/cgrates/tariffplans/README.md delete mode 100644 data/tutorials/fs_csv/cgrates/tariffplans/Rates.csv delete mode 100644 data/tutorials/fs_csv/cgrates/tariffplans/RatingPlans.csv delete mode 100644 data/tutorials/fs_csv/cgrates/tariffplans/RatingProfiles.csv delete mode 100644 data/tutorials/fs_csv/cgrates/tariffplans/Timings.csv delete mode 100644 data/tutorials/fs_json/cgrates/etc/cgrates/cgrates.cfg delete mode 100644 data/tutorials/fs_json/cgrates/tariffplans/AccountActions.csv delete mode 100644 data/tutorials/fs_json/cgrates/tariffplans/ActionPlans.csv delete mode 100644 data/tutorials/fs_json/cgrates/tariffplans/ActionTriggers.csv delete mode 100644 data/tutorials/fs_json/cgrates/tariffplans/Actions.csv delete mode 100644 data/tutorials/fs_json/cgrates/tariffplans/DerivedChargers.csv delete mode 100644 data/tutorials/fs_json/cgrates/tariffplans/DestinationRates.csv delete mode 100644 data/tutorials/fs_json/cgrates/tariffplans/Destinations.csv delete mode 100644 data/tutorials/fs_json/cgrates/tariffplans/README.md delete mode 100644 data/tutorials/fs_json/cgrates/tariffplans/Rates.csv delete mode 100644 data/tutorials/fs_json/cgrates/tariffplans/RatingPlans.csv delete mode 100644 data/tutorials/fs_json/cgrates/tariffplans/RatingProfiles.csv delete mode 100644 data/tutorials/fs_json/cgrates/tariffplans/SharedGroups.csv delete mode 100644 data/tutorials/fs_json/cgrates/tariffplans/Timings.csv diff --git a/apier/v1/scheduler.go b/apier/v1/scheduler.go index b645b9ea9..7918a7f23 100644 --- a/apier/v1/scheduler.go +++ b/apier/v1/scheduler.go @@ -115,7 +115,13 @@ func (self *ApierV1) GetScheduledActions(attrs AttrsGetScheduledActions, reply * return errors.New("SCHEDULER_NOT_ENABLED") } scheduledActions := self.Sched.GetQueue() - min, max := attrs.GetLimits() + var min, max int + if attrs.Paginator.Offset != nil { + min = *attrs.Paginator.Offset + } + if attrs.Paginator.Limit != nil { + max = *attrs.Paginator.Limit + } if max > len(scheduledActions) { max = len(scheduledActions) } diff --git a/cmd/cgr-engine/cgr-engine.go b/cmd/cgr-engine/cgr-engine.go index d1bf48d20..cdaaa07d3 100644 --- a/cmd/cgr-engine/cgr-engine.go +++ b/cmd/cgr-engine/cgr-engine.go @@ -55,7 +55,7 @@ const ( ) var ( - cfgDir = flag.String("config_dir", "/etc/cgrates", "Configuration directory path.") + cfgDir = flag.String("config_dir", utils.CONFIG_DIR, "Configuration directory path.") version = flag.Bool("version", false, "Prints the application version.") raterEnabled = flag.Bool("rater", false, "Enforce starting of the rater daemon overwriting config") schedEnabled = flag.Bool("scheduler", false, "Enforce starting of the scheduler daemon .overwriting config") diff --git a/config/config.go b/config/config.go index 0843cf916..388c11e76 100644 --- a/config/config.go +++ b/config/config.go @@ -96,43 +96,46 @@ func NewCGRConfigFromJsonString(cfgJsonStr string) (*CGRConfig, error) { // Reads all .json files out of a folder/subfolders and loads them up in lexical order func NewCGRConfigFromFolder(cfgDir string) (*CGRConfig, error) { - if fi, err := os.Stat(cfgDir); err != nil { - return nil, err - } else if !fi.IsDir() { - return nil, fmt.Errorf("Path: %s not a directory.", cfgDir) - } cfg, err := NewDefaultCGRConfig() if err != nil { return nil, err } - jsonFilesFound := false - err = filepath.Walk(cfgDir, func(path string, info os.FileInfo, err error) error { - if !info.IsDir() { - return nil - } - cfgFiles, err := filepath.Glob(filepath.Join(path, "*.json")) - if err != nil { - return err - } - if cfgFiles == nil { // No need of processing further since there are no config files in the folder - return nil - } - if !jsonFilesFound { - jsonFilesFound = true - } - for _, jsonFilePath := range cfgFiles { - if cgrJsonCfg, err := NewCgrJsonCfgFromFile(jsonFilePath); err != nil { - return err - } else if err := cfg.loadFromJsonCfg(cgrJsonCfg); err != nil { - return err - } - } - return nil - }) + fi, err := os.Stat(cfgDir) if err != nil { return nil, err - } else if !jsonFilesFound { - return nil, fmt.Errorf("No config file found on path %s", cfgDir) + } else if !fi.IsDir() && cfgDir != utils.CONFIG_DIR { // If config dir defined, needs to exist, not checking for default + return nil, fmt.Errorf("Path: %s not a directory.", cfgDir) + } + if fi.IsDir() { + jsonFilesFound := false + err = filepath.Walk(cfgDir, func(path string, info os.FileInfo, err error) error { + if !info.IsDir() { + return nil + } + cfgFiles, err := filepath.Glob(filepath.Join(path, "*.json")) + if err != nil { + return err + } + if cfgFiles == nil { // No need of processing further since there are no config files in the folder + return nil + } + if !jsonFilesFound { + jsonFilesFound = true + } + for _, jsonFilePath := range cfgFiles { + if cgrJsonCfg, err := NewCgrJsonCfgFromFile(jsonFilePath); err != nil { + return err + } else if err := cfg.loadFromJsonCfg(cgrJsonCfg); err != nil { + return err + } + } + return nil + }) + if err != nil { + return nil, err + } else if !jsonFilesFound { + return nil, fmt.Errorf("No config file found on path %s", cfgDir) + } } if err := cfg.checkConfigSanity(); err != nil { return nil, err diff --git a/data/conf/cgrates/cgrates.json b/data/conf/cgrates/cgrates.json index c67721958..d09066045 100644 --- a/data/conf/cgrates/cgrates.json +++ b/data/conf/cgrates/cgrates.json @@ -239,4 +239,4 @@ // "from_address": "cgr-mailer@localhost.localdomain" // from address used when sending emails out //}, -//} \ No newline at end of file +} \ No newline at end of file diff --git a/data/scripts/pkg/debian/postinst b/data/scripts/pkg/debian/postinst index af3e428a3..d79cbed66 100755 --- a/data/scripts/pkg/debian/postinst +++ b/data/scripts/pkg/debian/postinst @@ -27,7 +27,7 @@ set -e case "$1" in configure) - adduser --quiet --system --group --disabled-password --shell /bin/false --home /var/run/cgrates --gecos "CGRateS" cgrates || true + adduser --quiet --system --group --disabled-password --shell /bin/false --gecos "CGRateS" cgrates || true chown -R cgrates:cgrates /var/log/cgrates/ chown -R cgrates:cgrates /usr/share/cgrates/ ;; diff --git a/data/tutorials/fs_csv/cgrates/tariffplans/AccountActions.csv b/data/tutorials/fs_csv/cgrates/tariffplans/AccountActions.csv deleted file mode 100644 index e00c681bf..000000000 --- a/data/tutorials/fs_csv/cgrates/tariffplans/AccountActions.csv +++ /dev/null @@ -1,5 +0,0 @@ -#Tenant,Account,Direction,ActionPlanTag,ActionTriggersTag -cgrates.org,1001,*out,PREPAID_10,STANDARD_TRIGGERS -cgrates.org,1002,*out,PREPAID_10,STANDARD_TRIGGERS -cgrates.org,1003,*out,PREPAID_10,STANDARD_TRIGGERS -cgrates.org,1004,*out,PREPAID_10,STANDARD_TRIGGERS diff --git a/data/tutorials/fs_csv/cgrates/tariffplans/ActionPlans.csv b/data/tutorials/fs_csv/cgrates/tariffplans/ActionPlans.csv deleted file mode 100644 index 24f63c8a8..000000000 --- a/data/tutorials/fs_csv/cgrates/tariffplans/ActionPlans.csv +++ /dev/null @@ -1,2 +0,0 @@ -#Tag,ActionsTag,TimingTag,Weight -PREPAID_10,PREPAID_10,ASAP,10 diff --git a/data/tutorials/fs_csv/cgrates/tariffplans/ActionTriggers.csv b/data/tutorials/fs_csv/cgrates/tariffplans/ActionTriggers.csv deleted file mode 100644 index d0b4b9023..000000000 --- a/data/tutorials/fs_csv/cgrates/tariffplans/ActionTriggers.csv +++ /dev/null @@ -1,4 +0,0 @@ -#Tag,BalanceTag,Direction,ThresholdType,ThresholdValue,Recurrent,MinSleep,BalanceDestinationTag,BalanceWeight,BalanceExpiryTime,BalanceRatingSubject,BalanceSharedGroup,StatsMinQueuedItems,ActionsTag,Weight -STANDARD_TRIGGERS,*monetary,*out,*min_balance,2,false,0,,,,,,,LOG_WARNING,10 -STANDARD_TRIGGERS,*monetary,*out,*max_balance,20,false,0,,,,,,,LOG_WARNING,10 -STANDARD_TRIGGERS,*monetary,*out,*max_counter,5,false,0,FS_USERS,,,,,,LOG_WARNING,10 diff --git a/data/tutorials/fs_csv/cgrates/tariffplans/Actions.csv b/data/tutorials/fs_csv/cgrates/tariffplans/Actions.csv deleted file mode 100644 index 103d4070f..000000000 --- a/data/tutorials/fs_csv/cgrates/tariffplans/Actions.csv +++ /dev/null @@ -1,3 +0,0 @@ -#ActionsTag,Action,BalanceType,Direction,Units,ExpiryTime,DestinationTag,RatingSubject,BalanceWeight,SharedGroup,ExtraParameters,Weight -PREPAID_10,*topup_reset,*monetary,*out,10,*unlimited,*any,,10,,,10 -LOG_WARNING,*log,,,,,,,,,,10 diff --git a/data/tutorials/fs_csv/cgrates/tariffplans/DestinationRates.csv b/data/tutorials/fs_csv/cgrates/tariffplans/DestinationRates.csv deleted file mode 100644 index c8d302fc5..000000000 --- a/data/tutorials/fs_csv/cgrates/tariffplans/DestinationRates.csv +++ /dev/null @@ -1,4 +0,0 @@ -#Tag,DestinationsTag,RatesTag,RoundingMethod,RoundingDecimals -DR_RETAIL,DST_1002,RT_20CNT,*up,4 -DR_RETAIL,DST_1003,RT_40CNT,*up,4 -DR_RETAIL,DST_FS,RT_10CNT,*up,4 diff --git a/data/tutorials/fs_csv/cgrates/tariffplans/Destinations.csv b/data/tutorials/fs_csv/cgrates/tariffplans/Destinations.csv deleted file mode 100644 index 1c19d97ea..000000000 --- a/data/tutorials/fs_csv/cgrates/tariffplans/Destinations.csv +++ /dev/null @@ -1,4 +0,0 @@ -#Tag,Prefix -DST_1002,1002 -DST_1003,1003 -DST_FS,10 diff --git a/data/tutorials/fs_csv/cgrates/tariffplans/README.md b/data/tutorials/fs_csv/cgrates/tariffplans/README.md deleted file mode 100644 index 124fa3141..000000000 --- a/data/tutorials/fs_csv/cgrates/tariffplans/README.md +++ /dev/null @@ -1,14 +0,0 @@ -Tutorial - FS_CSV -================= - -Scenario: ---------- - -* Create the necessary timings (always, asap). -* Configure 1 destination: FS_USERS. -* Calls to FreeSWITCH users will be rated with 10cents per minute for the first 60s(60s increments) then 5 cents per minute(1s increments). -* This rating profile will be valid for any rating subject. - -* Create 2 prepaid accounts (equivalent of 2 FreeSWITCH default test users - 1001, 1002). -* Add to each of the accounts a monetary balance of 10 units. -* For each balance created, attach 3 triggers to control the balance: log on balance=2, log on balance=20, log on 5 mins talked towards FS_USERS destination. diff --git a/data/tutorials/fs_csv/cgrates/tariffplans/Rates.csv b/data/tutorials/fs_csv/cgrates/tariffplans/Rates.csv deleted file mode 100644 index ded15468d..000000000 --- a/data/tutorials/fs_csv/cgrates/tariffplans/Rates.csv +++ /dev/null @@ -1,7 +0,0 @@ -#Tag,ConnectFee,Rate,RateUnit,RateIncrement,GroupIntervalStart -RT_10CNT,0.2,0.1,60s,60s,0s -RT_10CNT,0,0.05,60s,1s,60s -RT_20CNT,0.4,0.2,60s,60s,0s -RT_20CNT,0,0.1,60s,1s,60s -RT_40CNT,0.8,0.4,60s,30s,0s -RT_40CNT,0,0.2,60s,10s,60s diff --git a/data/tutorials/fs_csv/cgrates/tariffplans/RatingPlans.csv b/data/tutorials/fs_csv/cgrates/tariffplans/RatingPlans.csv deleted file mode 100644 index a8f95d3b9..000000000 --- a/data/tutorials/fs_csv/cgrates/tariffplans/RatingPlans.csv +++ /dev/null @@ -1,2 +0,0 @@ -#Tag,DestinationRatesTag,TimingTag,Weight -RP_RETAIL,DR_RETAIL,ALWAYS,10 diff --git a/data/tutorials/fs_csv/cgrates/tariffplans/RatingProfiles.csv b/data/tutorials/fs_csv/cgrates/tariffplans/RatingProfiles.csv deleted file mode 100644 index 0a2875f19..000000000 --- a/data/tutorials/fs_csv/cgrates/tariffplans/RatingProfiles.csv +++ /dev/null @@ -1,2 +0,0 @@ -#Direction,Tenant,Category,Subject,ActivationTime,RatingPlanId,RatesFallbackSubject -*out,cgrates.org,call,*any,2013-01-06T00:00:00Z,RP_RETAIL, diff --git a/data/tutorials/fs_csv/cgrates/tariffplans/Timings.csv b/data/tutorials/fs_csv/cgrates/tariffplans/Timings.csv deleted file mode 100644 index f6c4a6ffb..000000000 --- a/data/tutorials/fs_csv/cgrates/tariffplans/Timings.csv +++ /dev/null @@ -1,3 +0,0 @@ -#Tag,Years,Months,MonthDays,WeekDays,Time -ALWAYS,*any,*any,*any,*any,00:00:00 -ASAP,*any,*any,*any,*any,*asap diff --git a/data/tutorials/fs_json/cgrates/etc/cgrates/cgrates.cfg b/data/tutorials/fs_json/cgrates/etc/cgrates/cgrates.cfg deleted file mode 100644 index 774765210..000000000 --- a/data/tutorials/fs_json/cgrates/etc/cgrates/cgrates.cfg +++ /dev/null @@ -1,174 +0,0 @@ -# Real-time Charging System for Telecom & ISP environments -# Copyright (C) ITsysCOM GmbH -# -# This file contains the default configuration hardcoded into CGRateS. -# This is what you get when you load CGRateS with an empty configuration file. - -[global] -# ratingdb_type = redis # Rating subsystem database: . -# ratingdb_host = 127.0.0.1 # Rating subsystem database host address. -# ratingdb_port = 6379 # Rating subsystem port to reach the database. -# ratingdb_name = 10 # Rating subsystem database name to connect to. -# ratingdb_user = # Rating subsystem username to use when connecting to database. -# ratingdb_passwd = # Rating subsystem password to use when connecting to database. -# accountdb_type = redis # Accounting subsystem database: . -# accountdb_host = 127.0.0.1 # Accounting subsystem database host address. -# accountdb_port = 6379 # Accounting subsystem port to reach the database. -# accountdb_name = 11 # Accounting subsystem database name to connect to. -# accountdb_user = # Accounting subsystem username to use when connecting to database. -# accountdb_passwd = # Accounting subsystem password to use when connecting to database. -# stordb_type = mysql # Stor database type to use: -# stordb_host = 127.0.0.1 # The host to connect to. Values that start with / are for UNIX domain sockets. -# stordb_port = 3306 # The port to reach the logdb. -# stordb_name = cgrates # The name of the log database to connect to. -# stordb_user = cgrates # Username to use when connecting to stordb. -# stordb_passwd = CGRateS.org # Password to use when connecting to stordb. -# dbdata_encoding = msgpack # The encoding used to store object data in strings: -# rpc_json_listen = 127.0.0.1:2012 # RPC JSON listening address -# rpc_gob_listen = 127.0.0.1:2013 # RPC GOB listening address -# http_listen = 127.0.0.1:2080 # HTTP listening address -# default_reqtype = rated # Default request type to consider when missing from requests: <""|prepaid|postpaid|pseudoprepaid|rated>. -# default_category = call # Default Type of Record to consider when missing from requests. -# default_tenant = cgrates.org # Default Tenant to consider when missing from requests. -# default_subject = cgrates # Default rating Subject to consider when missing from requests. -# rounding_decimals = 10 # System level precision for floats -# http_skip_tls_veify = false # If enabled Http Client will accept any TLS certificate -# xmlcfg_path = # Path towards additional config defined in xml file - -[balancer] -# enabled = false # Start Balancer service: . - -[rater] -enabled = true # Enable RaterCDRSExportPath service: . -# balancer = # Register to Balancer as worker: <""|internal|127.0.0.1:2013>. - -[scheduler] -enabled = true # Starts Scheduler service: . - -[cdrs] -enabled = true # Start the CDR Server service: . -# extra_fields = # Extra fields to store in CDRs for non-generic CDRs - mediator = internal # Address where to reach the Mediator. Empty for disabling mediation. <""|internal> -# cdrstats = # Address where to reach the cdrstats service: -# store_disable = false # When true, CDRs will not longer be saved in stordb, useful for cdrstats only scenario - -[cdre] -# cdr_format = csv # Exported CDRs format -# data_usage_multiply_factor = 0.0 # Multiply data usage before export (eg: convert from KBytes to Bytes) -# cost_multiply_factor = 0.0 # Multiply cost before export (0.0 to disable), eg: add VAT -# cost_rounding_decimals = -1 # Rounding decimals for Cost values. -1 to disable rounding -# cost_shift_digits = 0 # Shift digits in the cost on export (eg: convert from EUR to cents) -# mask_destination_id = # Destination id containing called addresses to be masked on export -# mask_length = 0 # Length of the destination suffix to be masked - export_dir = /tmp/cgrates/cdre # Path where the exported CDRs will be placed -# export_template = cgrid,mediation_runid,tor,accid,reqtype,direction,tenant,category,account,subject,destination,setup_time,answer_time,usage,cost - # Exported fields template <""|fld1,fld2|*xml:instance_name> -[cdrc] -# enabled = false # Enable CDR client functionality -# cdrs = internal # Address where to reach CDR server. -# run_delay = 0 # Sleep interval in seconds between consecutive runs, 0 to use automation via inotify -# cdr_type = csv # CDR file format . -# csv_separator = , # Separator used in case of csv files. One character only supported and needs to be right after equal sign -# cdr_in_dir = /var/log/cgrates/cdrc/in # Absolute path towards the directory where the CDRs are stored. -# cdr_out_dir = /var/log/cgrates/cdrc/out # Absolute path towards the directory where processed CDRs will be moved. -# cdr_source_id = csv # Free form field, tag identifying the source of the CDRs within CGRS database. -# tor_field = 2 # TypeOfRecord field identifier. Use index number in case of .csv cdrs. -# accid_field = 3 # Accounting id field identifier. Use index number in case of .csv cdrs. -# reqtype_field = 4 # Request type field identifier. Use index number in case of .csv cdrs. -# direction_field = 5 # Direction field identifier. Use index numbers in case of .csv cdrs. -# tenant_field = 6 # Tenant field identifier. Use index numbers in case of .csv cdrs. -# category_field = 7 # Type of Record field identifier. Use index numbers in case of .csv cdrs. -# account_field = 8 # Account field identifier. Use index numbers in case of .csv cdrs. -# subject_field = 9 # Subject field identifier. Use index numbers in case of .csv CDRs. -# destination_field = 10 # Destination field identifier. Use index numbers in case of .csv cdrs. -# setup_time_field = 11 # Setup time field identifier. Use index numbers in case of .csv cdrs. -# answer_time_field = 12 # Answer time field identifier. Use index numbers in case of .csv cdrs. -# usage_field = 13 # Usage field identifier. Use index numbers in case of .csv cdrs. -# extra_fields = # Extra fields identifiers. For .csv, format: :[...,:] - -[mediator] - enabled = true # Starts Mediator service: . -# reconnects = 3 # Number of reconnects to rater/cdrs before giving up. -# rater = internal # Address where to reach the Rater: -# cdrstats = internal # Address where to reach the cdrstats service: -# store_disable = false # When true, CDRs will not longer be saved in stordb, useful for cdrstats only scenario - - -[cdrstats] - enabled = true # Starts the cdrstats service: -# queue_length = 50 # Number of items in the stats buffer -# time_window = 1h # Will only keep the CDRs who's call setup time is not older than time.Now()-TimeWindow -# metrics = ASR, ACD, ACC # Stat metric ids to build -# setup_interval = # Filter on CDR SetupTime -# tors = # Filter on CDR TOR fields -# cdr_hosts= # Filter on CDR CdrHost fields -# cdr_sources = # Filter on CDR CdrSource fields -# req_types = # Filter on CDR ReqType fields -# directions = # Filter on CDR Direction fields -# tenants = # Filter on CDR Tenant fields -# categories = # Filter on CDR Category fields -# accounts = # Filter on CDR Account fields -# subjects = # Filter on CDR Subject fields -# destination_prefixes = # Filter on CDR Destination prefixes -# usage_interval = # Filter on CDR Usage -# mediation_run_ids = # Filter on CDR MediationRunId fields -# rated_accounts = # Filter on CDR RatedAccount fields -# rated_subjects = # Filter on CDR RatedSubject fields -# cost_intervals = # Filter on CDR Cost - -[session_manager] - enabled = true # Starts SessionManager service: -# switch_type = freeswitch # Defines the type of switch behind: -# rater = internal # Address where to reach the Rater <""|internal|127.0.0.1:2013> -cdrs = internal # Address where to reach CDR Server, empty to disable CDR capturing <""|internal|127.0.0.1:2013> -# reconnects = 3 # Number of reconnects to rater/cdrs before giving up. -debit_interval = 2 # Interval to perform debits on. -# min_call_duration = 0s # Only authorize calls with allowed duration bigger than this -# max_call_duration = 3h # Maximum call duration a prepaid call can last - -[freeswitch] -# server = 127.0.0.1:8021 # Adress where to connect to FreeSWITCH socket. -# passwd = ClueCon # FreeSWITCH socket password. -# reconnects = 5 # Number of attempts on connect failure. -# min_dur_low_balance = 5s # Threshold which will trigger low balance warnings for prepaid calls (needs to be lower than debit_interval) -# low_balance_ann_file = # File to be played when low balance is reached for prepaid calls -# empty_balance_context = # If defined, prepaid calls will be transfered to this context on empty balance -# empty_balance_ann_file = # File to be played before disconnecting prepaid calls on empty balance (applies only if no context defined) -# cdr_extra_fields = # Extra fields to store in CDRs in case of processing them - -[opensips] -# listen_udp = 127.0.0.1:2020 # Address where to listen for datagram events coming from OpenSIPS -# mi_addr = 127.0.0.1:8020 # Adress where to reach OpenSIPS mi_datagram module -# events_subscribe_interval = 60s # Automatic events subscription to OpenSIPS, 0 to disable it -# reconnects = 3 # Number of attempts on connect failure. - -[derived_charging] -# run_ids = # Identifiers of additional sessions control. -# run_filters = # List of cdr field filters for each run. -# reqtype_fields = # Name of request type fields to be used during additional sessions control <""|*default|field_name>. -# direction_fields = # Name of direction fields to be used during additional sessions control <""|*default|field_name>. -# tenant_fields = # Name of tenant fields to be used during additional sessions control <""|*default|field_name>. -# category_fields = # Name of tor fields to be used during additional sessions control <""|*default|field_name>. -# account_fields = # Name of account fields to be used during additional sessions control <""|*default|field_name>. -# subject_fields = # Name of fields to be used during additional sessions control <""|*default|field_name>. -# destination_fields = # Name of destination fields to be used during additional sessions control <""|*default|field_name>. -# setup_time_fields = # Name of setup_time fields to be used during additional sessions control <""|*default|field_name>. -# answer_time_fields = # Name of answer_time fields to be used during additional sessions control <""|*default|field_name>. -# usage_fields = # Name of usage fields to be used during additional sessions control <""|*default|field_name>. -# combined_chargers = true # Combine accounts specific derived_chargers with server configured ones . - -[history_server] - enabled = true # Starts History service: . -# history_dir = /tmp/cgrates/history # Location on disk where to store history files. -# save_interval = 1s # Interval to save changed cache into .git archive - -[history_agent] - enabled = true # Starts History as a client: . -# server = internal # Address where to reach the master history server: - -[mailer] -# server = localhost # The server to use when sending emails out -# auth_user = cgrates # Authenticate to email server using this user -# auth_passwd = CGRateS.org # Authenticate to email server with this password -# from_address = cgr-mailer@localhost.localdomain # From address used when sending emails out - diff --git a/data/tutorials/fs_json/cgrates/etc/default/cgrates b/data/tutorials/fs_json/cgrates/etc/default/cgrates index 4e7add309..2e880651d 100644 --- a/data/tutorials/fs_json/cgrates/etc/default/cgrates +++ b/data/tutorials/fs_json/cgrates/etc/default/cgrates @@ -2,7 +2,7 @@ # start CGRateS init.d script? # starts with "true" -ENABLE=true +ENABLE=false # Start with specific user/group #USER=cgrates @@ -10,7 +10,7 @@ ENABLE=true # what extra options to give cgrates binary? # See cgr-engine -h for options -#ENGINE_OPTS='' +#DAEMON_OPTS='' # Don't forget to create an appropriate config file, # else the CGRateS system will not start. diff --git a/data/tutorials/fs_json/cgrates/etc/init.d/cgrates b/data/tutorials/fs_json/cgrates/etc/init.d/cgrates index 237ab9b7a..65cb0a701 100755 --- a/data/tutorials/fs_json/cgrates/etc/init.d/cgrates +++ b/data/tutorials/fs_json/cgrates/etc/init.d/cgrates @@ -14,20 +14,21 @@ # Do NOT "set -e" # PATH should only include /usr/* if it runs after the mountnfs.sh script -RUNDIR=/tmp/$NAME/run -PIDFILE=$RUNDIR/cgr-engine.pid PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="CGRateS real-time charging system" NAME=cgrates DAEMON=/usr/bin/cgr-engine USER=cgrates GROUP=cgrates -TUTFOLDER=/usr/share/cgrates/tutorials/fs_json/cgrates -ENGINE_OPTS="-config=$TUTFOLDER/etc/cgrates/cgrates.cfg" -PIDFILE=/tmp/cgr-engine_tutfsjson.pid +DAEMON_OPTS="" +RUNDIR=/tmp/$NAME/run +PIDFILE=$RUNDIR/cgr-engine.pid +STACKTRACE=$RUNDIR/$NAME.strace SCRIPTNAME=$TUTFOLDER/etc/init.d/$NAME DEFAULTS=$TUTFOLDER/etc/default/$NAME -ENABLE=false +ENABLE=true +TUTFOLDER=/usr/share/cgrates/tutorials/fs_json/cgrates +ENGINE_OPTS="-config=$TUTFOLDER/etc/cgrates/cgrates.cfg" HISTDIR=/tmp/$NAME/history CDREDIR=/tmp/$NAME/cdre @@ -53,7 +54,8 @@ fi # Install the run folder if [ ! -d $RUNDIR ]; then mkdir -p $RUNDIR - chown $USER:$GROUP $RUNDIR + touch $STACKTRACE + chown -R $USER:$GROUP $RUNDIR fi # Install the cdre folder if [ ! -d $CDREDIR ]; then @@ -66,7 +68,6 @@ if [ ! -d $HISTDIR ]; then chown $USER:$GROUP $HISTDIR fi - # # Function that starts the daemon/service # @@ -76,11 +77,12 @@ do_start() # 0 if daemon has been started # 1 if daemon was already running # 2 if daemon could not be started - start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ + echo "\n### Started at:" `date`>>$STACKTRACE + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test\ || return 1 - start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --exec $DAEMON --chuid $USER:$GROUP --background -- \ - $ENGINE_OPTS \ - || return 2 + start-stop-daemon --start --quiet --chuid $USER:$GROUP --make-pidfile --pidfile $PIDFILE --background\ + --startas /bin/bash -- -c "exec $DAEMON $DAEMON_OPTS >> $STACKTRACE 2>&1" \ + || return 2 } # diff --git a/data/tutorials/fs_json/cgrates/tariffplans/AccountActions.csv b/data/tutorials/fs_json/cgrates/tariffplans/AccountActions.csv deleted file mode 100644 index 4a8ecc33e..000000000 --- a/data/tutorials/fs_json/cgrates/tariffplans/AccountActions.csv +++ /dev/null @@ -1,6 +0,0 @@ -#Tenant,Account,Direction,ActionPlanTag,ActionTriggersTag -cgrates.org,1001,*out,PACKAGE_10_SHARED_A_5,STANDARD_TRIGGERS -cgrates.org,1002;1006,*out,PACKAGE_10,STANDARD_TRIGGERS -cgrates.org,1003,*out,PACKAGE_10,STANDARD_TRIGGERS -cgrates.org,1004,*out,PACKAGE_10,STANDARD_TRIGGERS -cgrates.org,1007,*out,USE_SHARED_A,STANDARD_TRIGGERS diff --git a/data/tutorials/fs_json/cgrates/tariffplans/ActionPlans.csv b/data/tutorials/fs_json/cgrates/tariffplans/ActionPlans.csv deleted file mode 100644 index ca6e464e2..000000000 --- a/data/tutorials/fs_json/cgrates/tariffplans/ActionPlans.csv +++ /dev/null @@ -1,5 +0,0 @@ -#Tag,ActionsTag,TimingTag,Weight -PACKAGE_10,TOPUP_RST_10,ASAP,10 -PACKAGE_10_SHARED_A_5,TOPUP_RST_5,ASAP,10 -PACKAGE_10_SHARED_A_5,TOPUP_RST_SHARED_5,ASAP,10 -USE_SHARED_A,SHARED_A_0,ASAP,10 diff --git a/data/tutorials/fs_json/cgrates/tariffplans/ActionTriggers.csv b/data/tutorials/fs_json/cgrates/tariffplans/ActionTriggers.csv deleted file mode 100644 index f60064b22..000000000 --- a/data/tutorials/fs_json/cgrates/tariffplans/ActionTriggers.csv +++ /dev/null @@ -1,4 +0,0 @@ -#Tag,BalanceTag,Direction,ThresholdType,ThresholdValue,Recurrent,MinSleep,BalanceDestinationTag,BalanceWeight,BalanceExpiryTime,BalanceRatingSubject,BalanceSharedGroup,StatsMinQueuedItems,ActionsTag,Weight -STANDARD_TRIGGERS,*monetary,*out,*min_balance,2,false,0,,,,,,,LOG_WARNING,10 -STANDARD_TRIGGERS,*monetary,*out,*max_balance,20,false,0,,,,,,,LOG_WARNING,10 -STANDARD_TRIGGERS,*monetary,*out,*max_counter,5,false,0,FS_USERS,,,,,,LOG_WARNING,10 \ No newline at end of file diff --git a/data/tutorials/fs_json/cgrates/tariffplans/Actions.csv b/data/tutorials/fs_json/cgrates/tariffplans/Actions.csv deleted file mode 100644 index e2153d6af..000000000 --- a/data/tutorials/fs_json/cgrates/tariffplans/Actions.csv +++ /dev/null @@ -1,7 +0,0 @@ -#ActionsTag,Action,BalanceType,Direction,Units,ExpiryTime,DestinationTag,RatingSubject,BalanceWeight,SharedGroup,ExtraParameters,Weight -TOPUP_RST_10,*topup_reset,*monetary,*out,10,*unlimited,*any,,10,,,10 -TOPUP_RST_5,*topup_reset,*monetary,*out,5,*unlimited,*any,,20,,,10 -TOPUP_RST_5,*topup_reset,*voice,*out,5,*unlimited,DST_1002,SPECIAL_1002,20,,,10 -TOPUP_RST_SHARED_5,*topup,*monetary,*out,5,*unlimited,*any,,10,SHARED_A,,10 -SHARED_A_0,*topup_reset,*monetary,*out,0,*unlimited,*any,,10,SHARED_A,,10 -LOG_WARNING,*log,,,,,,,,,,10 diff --git a/data/tutorials/fs_json/cgrates/tariffplans/DerivedChargers.csv b/data/tutorials/fs_json/cgrates/tariffplans/DerivedChargers.csv deleted file mode 100644 index aed05a80d..000000000 --- a/data/tutorials/fs_json/cgrates/tariffplans/DerivedChargers.csv +++ /dev/null @@ -1,2 +0,0 @@ -#Direction,Tenant,Category,Account,Subject,RunId,RunFilter,ReqTypeField,DirectionField,TenantField,TorField,AccountField,SubjectField,DestinationField,SetupTimeField,AnswerTimeField,UsageField -*out,cgrates.org,call,1001,1001,fs_json_run,,^rated,*default,*default,*default,*default,^1002,*default,*default,*default,*default diff --git a/data/tutorials/fs_json/cgrates/tariffplans/DestinationRates.csv b/data/tutorials/fs_json/cgrates/tariffplans/DestinationRates.csv deleted file mode 100644 index b902c0601..000000000 --- a/data/tutorials/fs_json/cgrates/tariffplans/DestinationRates.csv +++ /dev/null @@ -1,8 +0,0 @@ -#Tag,DestinationsTag,RatesTag,RoundingMethod,RoundingDecimals -DR_1002_20CNT,DST_1002,RT_20CNT,*up,4 -DR_1002_10CNT,DST_1002,RT_10CNT,*up,4 -DR_1003_20CNT,DST_1003,RT_40CNT,*up,4 -DR_1003_10CNT,DST_1003,RT_10CNT,*up,4 -DR_FS_40CNT,DST_FS,RT_40CNT,*up,4 -DR_FS_10CNT,DST_FS,RT_10CNT,*up,4 -DR_SPECIAL_1002,DST_1002,RT_1CNT,*up,4 diff --git a/data/tutorials/fs_json/cgrates/tariffplans/Destinations.csv b/data/tutorials/fs_json/cgrates/tariffplans/Destinations.csv deleted file mode 100644 index 1c19d97ea..000000000 --- a/data/tutorials/fs_json/cgrates/tariffplans/Destinations.csv +++ /dev/null @@ -1,4 +0,0 @@ -#Tag,Prefix -DST_1002,1002 -DST_1003,1003 -DST_FS,10 diff --git a/data/tutorials/fs_json/cgrates/tariffplans/README.md b/data/tutorials/fs_json/cgrates/tariffplans/README.md deleted file mode 100644 index 86e4a1187..000000000 --- a/data/tutorials/fs_json/cgrates/tariffplans/README.md +++ /dev/null @@ -1,24 +0,0 @@ -Tutorial FS_JSON -================ - -Scenario: ---------- - -- Create the necessary timings (always, asap, peak, offpeak). -- Configure 3 destinations (1002, 1003 and 10 used as catch all rule). -- As rating we configure the following: - - - Rate id: *RT_10CNT* with connect fee of 20cents, 10cents per minute for the first 60s in 60s increments followed by 5cents per minute in 1s increments. - - Rate id: *RT_20CNT* with connect fee of 40cents, 20cents per minute for the first 60s in 60s increments, followed by 10 cents per minute charged in 1s increments. - - Rate id: *RT_40CNT* with connect fee of 80cents, 40cents per minute for the first 60s in 60s increments, follwed by 20cents per minute charged in 10s increments. - - Will charge by default *RT_40CNT* for all FreeSWITCH_ destinations during peak time (Monday-Friday 08:00-19:00) and *RT_10CNT* during offpeatimes (rest). - - Account 1001 will receive a special *deal* for 1002 and 1003 destinations during peak times with *RT_20CNT*, otherwise same as default rating. - -- Create 5 accounts (equivalent of FreeSWITCH default test users - 1001, 1002, 1003, 1004, 1007). -- 1002, 1003, 1004 will receive 10units of *monetary balance. -- 1001 will receive 5 units of general *monetary and 5 units of shared balance in the shared group *SHARED_A*. -- 1007 will receive 0 units of shared balance in the shared group *SHARED_A*. -- Define the shared balance *SHARED_A* with debit policy *highest. - -- For each balance created, attach 3 triggers to control the balance: log on balance=2, log on balance=20, log on 5 mins talked towards 10xx destination. - diff --git a/data/tutorials/fs_json/cgrates/tariffplans/Rates.csv b/data/tutorials/fs_json/cgrates/tariffplans/Rates.csv deleted file mode 100644 index 5f571f24b..000000000 --- a/data/tutorials/fs_json/cgrates/tariffplans/Rates.csv +++ /dev/null @@ -1,8 +0,0 @@ -#Tag,ConnectFee,Rate,RateUnit,RateIncrement,GroupIntervalStart -RT_10CNT,0.2,0.1,60s,60s,0s -RT_10CNT,0,0.05,60s,1s,60s -RT_20CNT,0.4,0.2,60s,60s,0s -RT_20CNT,0,0.1,60s,1s,60s -RT_40CNT,0.8,0.4,60s,30s,0s -RT_40CNT,0,0.2,60s,10s,60s -RT_1CNT,0,0.01,60s,60s,0s diff --git a/data/tutorials/fs_json/cgrates/tariffplans/RatingPlans.csv b/data/tutorials/fs_json/cgrates/tariffplans/RatingPlans.csv deleted file mode 100644 index 7eb4dc71d..000000000 --- a/data/tutorials/fs_json/cgrates/tariffplans/RatingPlans.csv +++ /dev/null @@ -1,18 +0,0 @@ -#Tag,DestinationRatesTag,TimingTag,Weight -RP_RETAIL1,DR_FS_40CNT,PEAK,10 -RP_RETAIL1,DR_FS_10CNT,OFFPEAK_MORNING,10 -RP_RETAIL1,DR_FS_10CNT,OFFPEAK_EVENING,10 -RP_RETAIL1,DR_FS_10CNT,OFFPEAK_WEEKEND,10 -RP_RETAIL2,DR_1002_20CNT,PEAK,10 -RP_RETAIL2,DR_1003_20CNT,PEAK,10 -RP_RETAIL2,DR_FS_40CNT,PEAK,10 -RP_RETAIL2,DR_1002_10CNT,OFFPEAK_MORNING,10 -RP_RETAIL2,DR_1002_10CNT,OFFPEAK_EVENING,10 -RP_RETAIL2,DR_1002_10CNT,OFFPEAK_WEEKEND,10 -RP_RETAIL2,DR_1003_10CNT,OFFPEAK_MORNING,10 -RP_RETAIL2,DR_1003_10CNT,OFFPEAK_EVENING,10 -RP_RETAIL2,DR_1003_10CNT,OFFPEAK_WEEKEND,10 -RP_RETAIL2,DR_FS_10CNT,OFFPEAK_MORNING,10 -RP_RETAIL2,DR_FS_10CNT,OFFPEAK_EVENING,10 -RP_RETAIL2,DR_FS_10CNT,OFFPEAK_WEEKEND,10 -RP_SPECIAL_1002,DR_SPECIAL_1002,ALWAYS,10 diff --git a/data/tutorials/fs_json/cgrates/tariffplans/RatingProfiles.csv b/data/tutorials/fs_json/cgrates/tariffplans/RatingProfiles.csv deleted file mode 100644 index 367d42cfd..000000000 --- a/data/tutorials/fs_json/cgrates/tariffplans/RatingProfiles.csv +++ /dev/null @@ -1,4 +0,0 @@ -#Direction,Tenant,Category,Subject,ActivationTime,RatingPlanId,RatesFallbackSubject -*out,cgrates.org,call,*any,2014-01-14T00:00:00Z,RP_RETAIL1, -*out,cgrates.org,call,1001;1006,2014-01-14T00:00:00Z,RP_RETAIL2, -*out,cgrates.org,call,SPECIAL_1002,2014-01-14T00:00:00Z,RP_SPECIAL_1002, diff --git a/data/tutorials/fs_json/cgrates/tariffplans/SharedGroups.csv b/data/tutorials/fs_json/cgrates/tariffplans/SharedGroups.csv deleted file mode 100644 index c01defac4..000000000 --- a/data/tutorials/fs_json/cgrates/tariffplans/SharedGroups.csv +++ /dev/null @@ -1,2 +0,0 @@ -#Id,Account,Strategy,RatingSubject -SHARED_A,*any,*highest, diff --git a/data/tutorials/fs_json/cgrates/tariffplans/Timings.csv b/data/tutorials/fs_json/cgrates/tariffplans/Timings.csv deleted file mode 100644 index 2c5ad517e..000000000 --- a/data/tutorials/fs_json/cgrates/tariffplans/Timings.csv +++ /dev/null @@ -1,7 +0,0 @@ -#Tag,Years,Months,MonthDays,WeekDays,Time -ALWAYS,*any,*any,*any,*any,00:00:00 -ASAP,*any,*any,*any,*any,*asap -PEAK,*any,*any,*any,1;2;3;4;5,08:00:00 -OFFPEAK_MORNING,*any,*any,*any,1,00:00:00 -OFFPEAK_EVENING,*any,*any,*any,1;2;3;4;5,19:00:00 -OFFPEAK_WEEKEND,*any,*any,*any,6;7,00:00:00 diff --git a/engine/storage_sql.go b/engine/storage_sql.go index 668cb40d4..908e879c3 100644 --- a/engine/storage_sql.go +++ b/engine/storage_sql.go @@ -110,18 +110,21 @@ func (self *SQLStorage) GetTPTableIds(tpid, table string, distinct utils.TPDisti qry += fmt.Sprintf(" AND %s='%s'", key, value) } } - if pagination.SearchTerm != "" { - qry += fmt.Sprintf(" AND (%s LIKE '%%%s%%'", distinct[0], pagination.SearchTerm) - for _, d := range distinct[1:] { - qry += fmt.Sprintf(" OR %s LIKE '%%%s%%'", d, pagination.SearchTerm) - } - qry += fmt.Sprintf(")") - } if pagination != nil { - limLow, limHigh := pagination.GetLimits() - qry += fmt.Sprintf(" LIMIT %d,%d", limLow, limHigh) + if len(pagination.SearchTerm) != 0 { + qry += fmt.Sprintf(" AND (%s LIKE '%%%s%%'", distinct[0], pagination.SearchTerm) + for _, d := range distinct[1:] { + qry += fmt.Sprintf(" OR %s LIKE '%%%s%%'", d, pagination.SearchTerm) + } + qry += fmt.Sprintf(")") + } + if pagination.Limit != nil { // Keep Postgres compatibility by adding offset only when limit defined + qry += fmt.Sprintf(" LIMIT %d", *pagination.Limit) + if pagination.Offset != nil { + qry += fmt.Sprintf(" OFFSET %d", *pagination.Offset) + } + } } - rows, err := self.Db.Query(qry) if err != nil { return nil, err @@ -958,12 +961,13 @@ func (self *SQLStorage) GetStoredCdrs(qryFltr *utils.CdrsFilter) ([]*utils.Store if qryFltr.IgnoreDerived { q = q.Where(utils.TBL_RATED_CDRS+".runid = ?", utils.DEFAULT_RUNID) } - if qryFltr.PaginatorOffset != 0 { - q = q.Offset(qryFltr.PaginatorOffset) + if qryFltr.Paginator.Limit != nil { + q = q.Limit(*qryFltr.Paginator.Limit) } - if qryFltr.PaginatorLimit != 0 { - q = q.Limit(qryFltr.PaginatorLimit) + if qryFltr.Paginator.Offset != nil { + q = q.Offset(*qryFltr.Paginator.Offset) } + /* // ToDo: Fix as soon as issue on Gorm analyzed: https://github.com/jinzhu/gorm/issues/354 if qryFltr.Count { @@ -1106,9 +1110,12 @@ func (self *SQLStorage) GetTpDestinationRates(tpid, tag string, pagination *util q = q.Where("tag = ?", tag) } if pagination != nil { - limLow, limHigh := pagination.GetLimits() - q = q.Offset(limLow) - q = q.Limit(limHigh) + if pagination.Limit != nil { + q = q.Limit(*pagination.Limit) + } + if pagination.Offset != nil { + q = q.Offset(*pagination.Offset) + } } if err := q.Find(&tpDestinationRates).Error; err != nil { return nil, err @@ -1166,11 +1173,13 @@ func (self *SQLStorage) GetTpRatingPlans(tpid, tag string, pagination *utils.Pag if err := q.Find(&tpRatingPlans).Error; err != nil { return nil, err } - if pagination != nil { - limLow, limHigh := pagination.GetLimits() - q = q.Offset(limLow) - q = q.Limit(limHigh) + if pagination.Limit != nil { + q = q.Limit(*pagination.Limit) + } + if pagination.Offset != nil { + q = q.Offset(*pagination.Offset) + } } for _, tpRp := range tpRatingPlans { diff --git a/utils/apitpdata.go b/utils/apitpdata.go index d175b3dd7..6a86c4579 100644 --- a/utils/apitpdata.go +++ b/utils/apitpdata.go @@ -20,7 +20,6 @@ package utils import ( "fmt" - "math" "sort" "strconv" "strings" @@ -36,17 +35,18 @@ func (tpdi TPDistinctIds) String() string { // To paginate stuff from stordb (e.g. ids) type Paginator struct { - Page int - ItemsPerPage int - SearchTerm string + Limit *int + Offset *int + SearchTerm string } -func (pag *Paginator) GetLimits() (low, high int) { +/*func (pag *Paginator) GetLimits() (low, high int) { if pag.ItemsPerPage == 0 { return 0, math.MaxInt32 } return pag.Page * pag.ItemsPerPage, pag.ItemsPerPage } +*/ // Used on exports (eg: TPExport) type ExportedData interface { @@ -929,9 +929,8 @@ type CdrsFilter struct { CostStart *float64 // Start of the cost interval (>=) CostEnd *float64 // End of the usage interval (<) IgnoreDerived bool // Do not consider derived CDRs but original one - PaginatorOffset int // Start retrieving from this offset - PaginatorLimit int // Limit the number of items retrieved Count bool // If true count the items instead of returning data + Paginator } // Used in Rpc calls, slightly different than CdrsFilter by using string instead of Time filters @@ -1027,8 +1026,7 @@ func (self *RpcCdrsFilter) AsCdrsFilter() (*CdrsFilter, error) { CostStart: self.CostStart, CostEnd: self.CostEnd, IgnoreDerived: self.IgnoreDerived, - PaginatorOffset: self.Paginator.Page, - PaginatorLimit: self.Paginator.ItemsPerPage, + Paginator: self.Paginator, } if len(self.SetupTimeStart) != 0 { if sTimeStart, err := ParseTimeDetectLayout(self.SetupTimeStart); err != nil { diff --git a/utils/consts.go b/utils/consts.go index 890aefe0a..752abe4e4 100644 --- a/utils/consts.go +++ b/utils/consts.go @@ -1,7 +1,7 @@ package utils const ( - VERSION = "0.9.1rc5" + VERSION = "0.9.1rc6" POSTGRES = "postgres" MYSQL = "mysql" MONGO = "mongo" @@ -168,6 +168,7 @@ const ( HTTP_POST = "http_post" NANO_MULTIPLIER = 1000000000 CGR_AUTHORIZE = "CGR_AUTHORIZE" + CONFIG_DIR = "/etc/cgrates" ) var (