mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Fixups for loader to work with dry_run when destinations file not provided, config fixups, doc fixups
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -51,9 +51,9 @@
|
||||
# mediator = # Address where to reach the Mediator. Empty for disabling mediation. <""|internal>
|
||||
|
||||
[cdre]
|
||||
# cdr_format = csv # Exported CDRs format <csv>
|
||||
# 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 <csv>
|
||||
# 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 <http_cgr>
|
||||
# run_delay = 0 # Sleep interval in seconds between consecutive runs, 0 to use automation via inotify
|
||||
# cdr_type = csv # CDR file format <csv|freeswitch_csv>.
|
||||
# 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.
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
::
|
||||
|
||||
|
||||
@@ -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],
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package utils
|
||||
|
||||
const (
|
||||
VERSION = "0.9.1rc3"
|
||||
VERSION = "0.9.1c3"
|
||||
POSTGRES = "postgres"
|
||||
MYSQL = "mysql"
|
||||
MONGO = "mongo"
|
||||
|
||||
Reference in New Issue
Block a user