diff --git a/cdrc/cdrc.go b/cdrc/cdrc.go index d6e539f97..7393b95e8 100644 --- a/cdrc/cdrc.go +++ b/cdrc/cdrc.go @@ -74,7 +74,6 @@ func (self *Cdrc) Run() error { self.processCdrDir() time.Sleep(self.cgrCfg.CdrcRunDelay) } - return nil } // Loads all fields (primary and extra) into cfgCdrFields, do some pre-checks (eg: in case of csv make sure that values are integers) @@ -178,7 +177,6 @@ func (self *Cdrc) trackCDRFiles() (err error) { engine.Logger.Err(fmt.Sprintf("Inotify error: %s", err.Error())) } } - return } // Processe file at filePath and posts the valid cdr rows out of it diff --git a/data/conf/cgrates.cfg b/data/conf/cgrates.cfg index fa3900a67..1ba1e1a2c 100644 --- a/data/conf/cgrates.cfg +++ b/data/conf/cgrates.cfg @@ -51,9 +51,9 @@ # mediator = # Address where to reach the Mediator. Empty for disabling mediation. <""|internal> [cdre] -# cdr_format = csv # Exported CDRs format -# extra_fields = # List of extra fields to be exported out in CDRs -# export_dir = /var/log/cgrates/cdr/out/cgr # Path where the exported CDRs will be placed +# cdr_format = csv # Exported CDRs format +# extra_fields = # List of extra fields to be exported out in CDRs +# export_dir = /var/log/cgrates/cdr/cdrexport/csv # Path where the exported CDRs will be placed [cdrc] # enabled = false # Enable CDR client functionality @@ -61,8 +61,8 @@ # cdrs_method = http_cgr # Mechanism to use when posting CDRs on server # run_delay = 0 # Sleep interval in seconds between consecutive runs, 0 to use automation via inotify # cdr_type = csv # CDR file format . -# cdr_in_dir = /var/log/cgrates/cdr/in/csv # Absolute path towards the directory where the CDRs are stored. -# cdr_out_dir = /var/log/cgrates/cdr/out/csv # Absolute path towards the directory where processed CDRs will be moved. +# cdr_in_dir = /var/log/cgrates/cdr/cdrc/in # Absolute path towards the directory where the CDRs are stored. +# cdr_out_dir = /var/log/cgrates/cdr/cdrc/out # Absolute path towards the directory where processed CDRs will be moved. # cdr_source_id = freeswitch_csv # Free form field, tag identifying the source of the CDRs within CGRS database. # accid_field = 0 # Accounting id field identifier. Use index number in case of .csv cdrs. # reqtype_field = 1 # Request type field identifier. Use index number in case of .csv cdrs. diff --git a/data/scripts/freeswitch_cdr_csv_rotate.sh b/data/scripts/freeswitch_cdr_csv_rotate.sh index 09eae3564..90d096f7c 100755 --- a/data/scripts/freeswitch_cdr_csv_rotate.sh +++ b/data/scripts/freeswitch_cdr_csv_rotate.sh @@ -1,7 +1,7 @@ #! /usr/bin/env sh FS_CDR_CSV_DIR=/var/log/freeswitch/cdr-csv -CGR_CDRC_IN_DIR=/var/log/cgrates/cdr/in/csv +CGR_CDRC_IN_DIR=/var/log/cgrates/cdr/cdrc/in /usr/bin/fs_cli -x "cdr_csv rotate" diff --git a/docs/installation.rst b/docs/installation.rst index ab383ab6d..76f9bfa94 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -51,13 +51,13 @@ As DataDB types (rating and accounting subsystems): - Redis_ -As StorDB (persistent storage for CDRs and tariff plan versions): +As StorDB (persistent storage for CDRs and tariff plan versions). + +Once installed there should be no special requirements in terms of setup since no schema is necessary. - MySQL_ -Redis_: once installed there should be no special requirements in terms of setup since no schema is necessary. - -MySQL_: once database is installed, CGRateS database needs to be set-up out of provided scripts (example for the paths set-up by debian package) +Once database is installed, CGRateS database needs to be set-up out of provided scripts (example for the paths set-up by debian package) :: diff --git a/engine/loader_csv.go b/engine/loader_csv.go index 1752c724a..e839111ef 100644 --- a/engine/loader_csv.go +++ b/engine/loader_csv.go @@ -334,13 +334,15 @@ func (csvr *CSVReader) LoadDestinationRates() (err error) { break } } - if !destinationExists { - if dbExists, err := csvr.dataStorage.ExistsData(DESTINATION_PREFIX, record[1]); err != nil { + var err error + if !destinationExists && csvr.dataStorage != nil { + if destinationExists, err = csvr.dataStorage.ExistsData(DESTINATION_PREFIX, record[1]); err != nil { return err - } else if !dbExists { - return fmt.Errorf("Could not get destination for tag %v", record[1]) } } + if !destinationExists { + return fmt.Errorf("Could not get destination for tag %v", record[1]) + } dr := &utils.TPDestinationRate{ DestinationRateId: tag, DestinationRates: []*utils.DestinationRate{ @@ -417,13 +419,14 @@ func (csvr *CSVReader) LoadRatingProfiles() (err error) { csvr.ratingProfiles[key] = rp } _, exists := csvr.ratingPlans[record[5]] - if !exists { - if dbExists, err := csvr.dataStorage.ExistsData(RATING_PLAN_PREFIX, record[5]); err != nil { + if !exists && csvr.dataStorage != nil { + if exists, err = csvr.dataStorage.ExistsData(RATING_PLAN_PREFIX, record[5]); err != nil { return err - } else if !dbExists { - return errors.New(fmt.Sprintf("Could not load rating plans for tag: %v", record[5])) } } + if !exists { + return errors.New(fmt.Sprintf("Could not load rating plans for tag: %v", record[5])) + } rpa := &RatingPlanActivation{ ActivationTime: at, RatingPlanId: record[5], diff --git a/engine/storage_sql.go b/engine/storage_sql.go index 0f4e34b78..fa57d834a 100644 --- a/engine/storage_sql.go +++ b/engine/storage_sql.go @@ -668,7 +668,7 @@ func (self *SQLStorage) LogCallCost(uuid, source, runid string, cc *CallCost) (e } func (self *SQLStorage) GetCallCostLog(cgrid, source, runid string) (cc *CallCost, err error) { - row := self.Db.QueryRow(fmt.Sprintf("SELECT cgrid, accid, direction, tenant, tor, account, subject, destination, connect_fee, cost, timespans, source FROM %s WHERE cgrid='%s' AND source='%s'", utils.TBL_COST_DETAILS, cgrid, source, runid)) + row := self.Db.QueryRow(fmt.Sprintf("SELECT cgrid, accid, direction, tenant, tor, account, subject, destination, connect_fee, cost, timespans, source FROM %s WHERE cgrid='%s' AND source='%s' AND runid='%s'", utils.TBL_COST_DETAILS, cgrid, source, runid)) var accid, src string var timespansJson string cc = &CallCost{Cost: -1} diff --git a/pkg/debian/postinst b/pkg/debian/postinst index af3e428a3..fe1460296 100755 --- a/pkg/debian/postinst +++ b/pkg/debian/postinst @@ -27,9 +27,10 @@ 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/ + chown -R cgrates:cgrates /var/run/cgrates/ ;; abort-upgrade|abort-remove|abort-deconfigure) diff --git a/pkg/debian/rules b/pkg/debian/rules index 889fbd6cb..047c58cc1 100755 --- a/pkg/debian/rules +++ b/pkg/debian/rules @@ -33,6 +33,7 @@ binary-arch: clean mkdir -p $(PKGDIR)/var/log/cgrates/cdr/cdrc/out mkdir -p $(PKGDIR)/var/log/cgrates/cdr/cdrexport/csv mkdir -p $(PKGDIR)/var/log/cgrates/history + mkdir -p $(PKGDIR)/var/run/cgrates dh_strip dh_compress dh_fixperms diff --git a/utils/consts.go b/utils/consts.go index 5f17455f2..070638c1f 100644 --- a/utils/consts.go +++ b/utils/consts.go @@ -1,7 +1,7 @@ package utils const ( - VERSION = "0.9.1rc3" + VERSION = "0.9.1c3" POSTGRES = "postgres" MYSQL = "mysql" MONGO = "mongo"