Updating cdrc integration tests with the new settings

This commit is contained in:
DanB
2019-06-10 12:14:55 +02:00
parent 940af63081
commit 23bd9721fd
17 changed files with 157 additions and 131 deletions

View File

@@ -56,7 +56,6 @@ Parameters specific per config instance:
func NewCdrc(cdrcCfgs []*config.CdrcCfg, httpSkipTlsCheck bool, cdrs rpcclient.RpcClientConnection,
closeChan chan struct{}, dfltTimezone string, roundDecimals int, filterS *engine.FilterS) (*Cdrc, error) {
cdrcCfg := cdrcCfgs[0]
cdrc := &Cdrc{
httpSkipTlsCheck: httpSkipTlsCheck,
cdrcCfgs: cdrcCfgs,
@@ -193,10 +192,10 @@ func (self *Cdrc) processFile(filePath string) error {
recordsProcessor = NewCsvRecordsProcessor(csvReader, self.timezone, fn, self.dfltCdrcCfg,
self.cdrcCfgs, self.httpSkipTlsCheck, self.unpairedRecordsCache, self.partialRecordsCache,
self.dfltCdrcCfg.CacheDumpFields, self.filterS)
case utils.FWV:
case utils.MetaFileFWV:
recordsProcessor = NewFwvRecordsProcessor(file, self.dfltCdrcCfg, self.cdrcCfgs,
self.httpClient, self.httpSkipTlsCheck, self.timezone, self.filterS)
case utils.XML:
case utils.MetaFileXML:
if recordsProcessor, err = NewXMLRecordsProcessor(file, self.dfltCdrcCfg.CDRRootPath,
self.timezone, self.httpSkipTlsCheck, self.cdrcCfgs, self.filterS); err != nil {
return err

View File

@@ -90,7 +90,10 @@ func TestCsvITResetDataDb(t *testing.T) {
func TestCsvITCreateCdrDirs(t *testing.T) {
for _, cdrcProfiles := range csvCfg.CdrcProfiles {
for _, cdrcInst := range cdrcProfiles {
for _, dir := range []string{cdrcInst.CdrInDir, cdrcInst.CdrOutDir} {
if !cdrcInst.Enabled {
continue
}
for _, dir := range []string{cdrcInst.CDRInPath, cdrcInst.CDROutPath} {
if err := os.RemoveAll(dir); err != nil {
t.Fatal("Error removing folder: ", dir, err)
}
@@ -197,7 +200,7 @@ func TestCsvIT2InitCdrDb(t *testing.T) {
func TestCsvIT2CreateCdrDirs(t *testing.T) {
for _, cdrcProfiles := range csvCfg.CdrcProfiles {
for _, cdrcInst := range cdrcProfiles {
for _, dir := range []string{cdrcInst.CdrInDir, cdrcInst.CdrOutDir} {
for _, dir := range []string{cdrcInst.CDRInPath, cdrcInst.CDROutPath} {
if err := os.RemoveAll(dir); err != nil {
t.Fatal("Error removing folder: ", dir, err)
}
@@ -289,7 +292,7 @@ func TestCsvIT3InitCdrDb(t *testing.T) {
func TestCsvIT3CreateCdrDirs(t *testing.T) {
for _, cdrcProfiles := range csvCfg.CdrcProfiles {
for _, cdrcInst := range cdrcProfiles {
for _, dir := range []string{cdrcInst.CdrInDir, cdrcInst.CdrOutDir} {
for _, dir := range []string{cdrcInst.CDRInPath, cdrcInst.CDROutPath} {
if err := os.RemoveAll(dir); err != nil {
t.Fatal("Error removing folder: ", dir, err)
}
@@ -376,7 +379,7 @@ func TestCsvIT4InitCdrDb(t *testing.T) {
func TestCsvIT4CreateCdrDirs(t *testing.T) {
for _, cdrcProfiles := range csvCfg.CdrcProfiles {
for _, cdrcInst := range cdrcProfiles {
for _, dir := range []string{cdrcInst.CdrInDir, cdrcInst.CdrOutDir} {
for _, dir := range []string{cdrcInst.CDRInPath, cdrcInst.CDROutPath} {
if err := os.RemoveAll(dir); err != nil {
t.Fatal("Error removing folder: ", dir, err)
}
@@ -463,7 +466,7 @@ func TestCsvIT5InitCdrDb(t *testing.T) {
func TestCsvIT5CreateCdrDirs(t *testing.T) {
for _, cdrcProfiles := range csvCfg.CdrcProfiles {
for _, cdrcInst := range cdrcProfiles {
for _, dir := range []string{cdrcInst.CdrInDir, cdrcInst.CdrOutDir} {
for _, dir := range []string{cdrcInst.CDRInPath, cdrcInst.CDROutPath} {
if err := os.RemoveAll(dir); err != nil {
t.Fatal("Error removing folder: ", dir, err)
}

View File

@@ -90,17 +90,17 @@ func TestFlatstoreitCreateCdrFiles(t *testing.T) {
flatstoreCdrcCfg = cdrcCfg
}
}
if err := os.RemoveAll(flatstoreCdrcCfg.CdrInDir); err != nil {
t.Fatal("Error removing folder: ", flatstoreCdrcCfg.CdrInDir, err)
if err := os.RemoveAll(flatstoreCdrcCfg.CDRInPath); err != nil {
t.Fatal("Error removing folder: ", flatstoreCdrcCfg.CDRInPath, err)
}
if err := os.MkdirAll(flatstoreCdrcCfg.CdrInDir, 0755); err != nil {
t.Fatal("Error creating folder: ", flatstoreCdrcCfg.CdrInDir, err)
if err := os.MkdirAll(flatstoreCdrcCfg.CDRInPath, 0755); err != nil {
t.Fatal("Error creating folder: ", flatstoreCdrcCfg.CDRInPath, err)
}
if err := os.RemoveAll(flatstoreCdrcCfg.CdrOutDir); err != nil {
t.Fatal("Error removing folder: ", flatstoreCdrcCfg.CdrOutDir, err)
if err := os.RemoveAll(flatstoreCdrcCfg.CDROutPath); err != nil {
t.Fatal("Error removing folder: ", flatstoreCdrcCfg.CDROutPath, err)
}
if err := os.MkdirAll(flatstoreCdrcCfg.CdrOutDir, 0755); err != nil {
t.Fatal("Error creating folder: ", flatstoreCdrcCfg.CdrOutDir, err)
if err := os.MkdirAll(flatstoreCdrcCfg.CDROutPath, 0755); err != nil {
t.Fatal("Error creating folder: ", flatstoreCdrcCfg.CDROutPath, err)
}
}
@@ -134,22 +134,22 @@ func TestFlatstoreitProcessFiles(t *testing.T) {
}
//Rename(oldpath, newpath string)
for _, fileName := range []string{"acc_1.log", "missed_calls_1.log", "acc_2.log", "acc_3.log"} {
if err := os.Rename(path.Join("/tmp", fileName), path.Join(flatstoreCdrcCfg.CdrInDir, fileName)); err != nil {
if err := os.Rename(path.Join("/tmp", fileName), path.Join(flatstoreCdrcCfg.CDRInPath, fileName)); err != nil {
t.Fatal(err)
}
}
time.Sleep(time.Duration(3) * time.Second) // Give time for processing to happen and the .unparired file to be written
filesInDir, _ := ioutil.ReadDir(flatstoreCdrcCfg.CdrInDir)
filesInDir, _ := ioutil.ReadDir(flatstoreCdrcCfg.CDRInPath)
if len(filesInDir) != 0 {
t.Errorf("Files in cdrcInDir: %+v", filesInDir)
}
filesOutDir, _ := ioutil.ReadDir(flatstoreCdrcCfg.CdrOutDir)
filesOutDir, _ := ioutil.ReadDir(flatstoreCdrcCfg.CDROutPath)
if len(filesOutDir) != 5 {
f := []string{}
for _, s := range filesOutDir {
f = append(f, s.Name())
t.Errorf("File %s:", s.Name())
if partContent, err := ioutil.ReadFile(path.Join(flatstoreCdrcCfg.CdrOutDir, s.Name())); err != nil {
if partContent, err := ioutil.ReadFile(path.Join(flatstoreCdrcCfg.CDROutPath, s.Name())); err != nil {
t.Error(err)
} else {
t.Errorf("%s", partContent)
@@ -160,7 +160,7 @@ func TestFlatstoreitProcessFiles(t *testing.T) {
return
}
ePartContent := "INVITE|2daec40c|548625ac|dd0c4c617a9919d29a6175cdff223a9p@0:0:0:0:0:0:0:0|200|OK|1436454408|*prepaid|1001|1002||3401:2069362475\n"
if partContent, err := ioutil.ReadFile(path.Join(flatstoreCdrcCfg.CdrOutDir, "acc_3.log.unpaired")); err != nil {
if partContent, err := ioutil.ReadFile(path.Join(flatstoreCdrcCfg.CDROutPath, "acc_3.log.unpaired")); err != nil {
t.Error(err)
} else if (ePartContent) != (string(partContent)) {
t.Errorf("Expecting:\n%s\nReceived:\n%s", ePartContent, string(partContent))

View File

@@ -96,7 +96,10 @@ func TestFwvitCreateCdrFiles(t *testing.T) {
}
for _, cdrcProfiles := range fwvCfg.CdrcProfiles {
for _, cdrcInst := range cdrcProfiles {
for _, dir := range []string{cdrcInst.CdrInDir, cdrcInst.CdrOutDir} {
if !cdrcInst.Enabled {
continue
}
for _, dir := range []string{cdrcInst.CDRInPath, cdrcInst.CDROutPath} {
if err := os.RemoveAll(dir); err != nil {
t.Fatal("Error removing folder: ", dir, err)
}
@@ -142,15 +145,15 @@ func TestFwvitProcessFiles(t *testing.T) {
if err := ioutil.WriteFile(path.Join("/tmp", fileName), []byte(FW_CDR_FILE1), 0755); err != nil {
t.Fatal(err.Error())
}
if err := os.Rename(path.Join("/tmp", fileName), path.Join(fwvCdrcCfg.CdrInDir, fileName)); err != nil {
if err := os.Rename(path.Join("/tmp", fileName), path.Join(fwvCdrcCfg.CDRInPath, fileName)); err != nil {
t.Fatal(err)
}
time.Sleep(time.Duration(1) * time.Second)
filesInDir, _ := ioutil.ReadDir(fwvCdrcCfg.CdrInDir)
filesInDir, _ := ioutil.ReadDir(fwvCdrcCfg.CDRInPath)
if len(filesInDir) != 0 {
t.Errorf("Files in cdrcInDir: %d", len(filesInDir))
}
filesOutDir, _ := ioutil.ReadDir(fwvCdrcCfg.CdrOutDir)
filesOutDir, _ := ioutil.ReadDir(fwvCdrcCfg.CDROutPath)
if len(filesOutDir) != 1 {
t.Errorf("In CdrcOutDir, expecting 1 files, got: %d", len(filesOutDir))
}
@@ -195,17 +198,17 @@ func TestFwvit2CreateCdrFiles(t *testing.T) {
fwvCdrcCfg = cdrcCfg
}
}
if err := os.RemoveAll(fwvCdrcCfg.CdrInDir); err != nil {
t.Fatal("Error removing folder: ", fwvCdrcCfg.CdrInDir, err)
if err := os.RemoveAll(fwvCdrcCfg.CDRInPath); err != nil {
t.Fatal("Error removing folder: ", fwvCdrcCfg.CDRInPath, err)
}
if err := os.MkdirAll(fwvCdrcCfg.CdrInDir, 0755); err != nil {
t.Fatal("Error creating folder: ", fwvCdrcCfg.CdrInDir, err)
if err := os.MkdirAll(fwvCdrcCfg.CDRInPath, 0755); err != nil {
t.Fatal("Error creating folder: ", fwvCdrcCfg.CDRInPath, err)
}
if err := os.RemoveAll(fwvCdrcCfg.CdrOutDir); err != nil {
t.Fatal("Error removing folder: ", fwvCdrcCfg.CdrOutDir, err)
if err := os.RemoveAll(fwvCdrcCfg.CDROutPath); err != nil {
t.Fatal("Error removing folder: ", fwvCdrcCfg.CDROutPath, err)
}
if err := os.MkdirAll(fwvCdrcCfg.CdrOutDir, 0755); err != nil {
t.Fatal("Error creating folder: ", fwvCdrcCfg.CdrOutDir, err)
if err := os.MkdirAll(fwvCdrcCfg.CDROutPath, 0755); err != nil {
t.Fatal("Error creating folder: ", fwvCdrcCfg.CDROutPath, err)
}
}
@@ -236,15 +239,15 @@ func TestFwvit2ProcessFiles(t *testing.T) {
if err := ioutil.WriteFile(path.Join("/tmp", fileName), []byte(FW_CDR_FILE1), 0644); err != nil {
t.Fatal(err.Error())
}
if err := os.Rename(path.Join("/tmp", fileName), path.Join(fwvCdrcCfg.CdrInDir, fileName)); err != nil {
if err := os.Rename(path.Join("/tmp", fileName), path.Join(fwvCdrcCfg.CDRInPath, fileName)); err != nil {
t.Fatal(err)
}
time.Sleep(time.Duration(1) * time.Second)
filesInDir, _ := ioutil.ReadDir(fwvCdrcCfg.CdrInDir)
filesInDir, _ := ioutil.ReadDir(fwvCdrcCfg.CDRInPath)
if len(filesInDir) != 0 {
t.Errorf("Files in cdrcInDir: %d", len(filesInDir))
}
filesOutDir, _ := ioutil.ReadDir(fwvCdrcCfg.CdrOutDir)
filesOutDir, _ := ioutil.ReadDir(fwvCdrcCfg.CDROutPath)
if len(filesOutDir) != 1 {
t.Errorf("In CdrcOutDir, expecting 1 files, got: %d", len(filesOutDir))
}
@@ -291,17 +294,17 @@ func TestFwvit3CreateCdrFiles(t *testing.T) {
fwvCdrcCfg = cdrcCfg
}
}
if err := os.RemoveAll(fwvCdrcCfg.CdrInDir); err != nil {
t.Fatal("Error removing folder: ", fwvCdrcCfg.CdrInDir, err)
if err := os.RemoveAll(fwvCdrcCfg.CDRInPath); err != nil {
t.Fatal("Error removing folder: ", fwvCdrcCfg.CDRInPath, err)
}
if err := os.MkdirAll(fwvCdrcCfg.CdrInDir, 0755); err != nil {
t.Fatal("Error creating folder: ", fwvCdrcCfg.CdrInDir, err)
if err := os.MkdirAll(fwvCdrcCfg.CDRInPath, 0755); err != nil {
t.Fatal("Error creating folder: ", fwvCdrcCfg.CDRInPath, err)
}
if err := os.RemoveAll(fwvCdrcCfg.CdrOutDir); err != nil {
t.Fatal("Error removing folder: ", fwvCdrcCfg.CdrOutDir, err)
if err := os.RemoveAll(fwvCdrcCfg.CDROutPath); err != nil {
t.Fatal("Error removing folder: ", fwvCdrcCfg.CDROutPath, err)
}
if err := os.MkdirAll(fwvCdrcCfg.CdrOutDir, 0755); err != nil {
t.Fatal("Error creating folder: ", fwvCdrcCfg.CdrOutDir, err)
if err := os.MkdirAll(fwvCdrcCfg.CDROutPath, 0755); err != nil {
t.Fatal("Error creating folder: ", fwvCdrcCfg.CDROutPath, err)
}
}
@@ -345,15 +348,15 @@ func TestFwvit3ProcessFiles(t *testing.T) {
if err := ioutil.WriteFile(path.Join("/tmp", fileName), []byte(FW_CDR_FILE1), 0644); err != nil {
t.Fatal(err.Error())
}
if err := os.Rename(path.Join("/tmp", fileName), path.Join(fwvCdrcCfg.CdrInDir, fileName)); err != nil {
if err := os.Rename(path.Join("/tmp", fileName), path.Join(fwvCdrcCfg.CDRInPath, fileName)); err != nil {
t.Fatal(err)
}
time.Sleep(time.Duration(1) * time.Second)
filesInDir, _ := ioutil.ReadDir(fwvCdrcCfg.CdrInDir)
filesInDir, _ := ioutil.ReadDir(fwvCdrcCfg.CDRInPath)
if len(filesInDir) != 0 {
t.Errorf("Files in cdrcInDir: %d", len(filesInDir))
}
filesOutDir, _ := ioutil.ReadDir(fwvCdrcCfg.CdrOutDir)
filesOutDir, _ := ioutil.ReadDir(fwvCdrcCfg.CDROutPath)
if len(filesOutDir) != 1 {
t.Errorf("In CdrcOutDir, expecting 1 files, got: %d", len(filesOutDir))
}

View File

@@ -75,12 +75,15 @@ func TestPartcsvITResetDataDb(t *testing.T) {
func TestPartcsvITCreateCdrDirs(t *testing.T) {
for path, cdrcProfiles := range partcsvCfg.CdrcProfiles {
for _, cdrcInst := range cdrcProfiles {
if path == "/tmp/cdrctests/partcsv1/in" {
partcsvCDRCDirIn1, partcsvCDRCDirOut1 = cdrcInst.CdrInDir, cdrcInst.CdrOutDir
} else if path == "/tmp/cdrctests/partcsv2/in" {
partcsvCDRCDirIn2, partcsvCDRCDirOut2 = cdrcInst.CdrInDir, cdrcInst.CdrOutDir
if !cdrcInst.Enabled {
continue
}
for _, dir := range []string{cdrcInst.CdrInDir, cdrcInst.CdrOutDir} {
if path == "/tmp/cdrctests/partcsv1/in" {
partcsvCDRCDirIn1, partcsvCDRCDirOut1 = cdrcInst.CDRInPath, cdrcInst.CDROutPath
} else if path == "/tmp/cdrctests/partcsv2/in" {
partcsvCDRCDirIn2, partcsvCDRCDirOut2 = cdrcInst.CDRInPath, cdrcInst.CDROutPath
}
for _, dir := range []string{cdrcInst.CDRInPath, cdrcInst.CDROutPath} {
if err := os.RemoveAll(dir); err != nil {
t.Fatal("Error removing folder: ", dir, err)
}

View File

@@ -65,7 +65,10 @@ func TestXmlITResetDataDb(t *testing.T) {
func TestXmlITCreateCdrDirs(t *testing.T) {
for _, cdrcProfiles := range xmlCfg.CdrcProfiles {
for _, cdrcInst := range cdrcProfiles {
for _, dir := range []string{cdrcInst.CdrInDir, cdrcInst.CdrOutDir} {
if !cdrcInst.Enabled {
continue
}
for _, dir := range []string{cdrcInst.CDRInPath, cdrcInst.CDROutPath} {
if err := os.RemoveAll(dir); err != nil {
t.Fatal("Error removing folder: ", dir, err)
}
@@ -74,8 +77,8 @@ func TestXmlITCreateCdrDirs(t *testing.T) {
}
}
if cdrcInst.ID == "XMLit1" { // Initialize the folders to check later
xmlPathIn1 = cdrcInst.CdrInDir
xmlPathOut1 = cdrcInst.CdrOutDir
xmlPathIn1 = cdrcInst.CDRInPath
xmlPathOut1 = cdrcInst.CDROutPath
}
}
}
@@ -157,7 +160,10 @@ func TestXmlIT2InitCdrDb(t *testing.T) {
func TestXmlIT2CreateCdrDirs(t *testing.T) {
for _, cdrcProfiles := range xmlCfg.CdrcProfiles {
for _, cdrcInst := range cdrcProfiles {
for _, dir := range []string{cdrcInst.CdrInDir, cdrcInst.CdrOutDir} {
if !cdrcInst.Enabled {
continue
}
for _, dir := range []string{cdrcInst.CDRInPath, cdrcInst.CDROutPath} {
if err := os.RemoveAll(dir); err != nil {
t.Fatal("Error removing folder: ", dir, err)
}
@@ -166,8 +172,8 @@ func TestXmlIT2CreateCdrDirs(t *testing.T) {
}
}
if cdrcInst.ID == "XMLWithFilter" { // Initialize the folders to check later
xmlPathIn1 = cdrcInst.CdrInDir
xmlPathOut1 = cdrcInst.CdrOutDir
xmlPathIn1 = cdrcInst.CDRInPath
xmlPathOut1 = cdrcInst.CDROutPath
}
}
}
@@ -243,7 +249,10 @@ func TestXmlIT3InitCdrDb(t *testing.T) {
func TestXmlIT3CreateCdrDirs(t *testing.T) {
for _, cdrcProfiles := range xmlCfg.CdrcProfiles {
for _, cdrcInst := range cdrcProfiles {
for _, dir := range []string{cdrcInst.CdrInDir, cdrcInst.CdrOutDir} {
for _, dir := range []string{cdrcInst.CDRInPath, cdrcInst.CDROutPath} {
if !cdrcInst.Enabled {
continue
}
if err := os.RemoveAll(dir); err != nil {
t.Fatal("Error removing folder: ", dir, err)
}
@@ -252,8 +261,8 @@ func TestXmlIT3CreateCdrDirs(t *testing.T) {
}
}
if cdrcInst.ID == "msw_xml" { // Initialize the folders to check later
xmlPathIn1 = cdrcInst.CdrInDir
xmlPathOut1 = cdrcInst.CdrOutDir
xmlPathIn1 = cdrcInst.CDRInPath
xmlPathOut1 = cdrcInst.CDROutPath
}
}
}
@@ -329,7 +338,10 @@ func TestXmlIT4InitCdrDb(t *testing.T) {
func TestXmlIT4CreateCdrDirs(t *testing.T) {
for _, cdrcProfiles := range xmlCfg.CdrcProfiles {
for _, cdrcInst := range cdrcProfiles {
for _, dir := range []string{cdrcInst.CdrInDir, cdrcInst.CdrOutDir} {
if !cdrcInst.Enabled {
continue
}
for _, dir := range []string{cdrcInst.CDRInPath, cdrcInst.CDROutPath} {
if err := os.RemoveAll(dir); err != nil {
t.Fatal("Error removing folder: ", dir, err)
}
@@ -338,8 +350,8 @@ func TestXmlIT4CreateCdrDirs(t *testing.T) {
}
}
if cdrcInst.ID == "msw_xml2" { // Initialize the folders to check later
xmlPathIn1 = cdrcInst.CdrInDir
xmlPathOut1 = cdrcInst.CdrOutDir
xmlPathIn1 = cdrcInst.CDRInPath
xmlPathOut1 = cdrcInst.CDROutPath
}
}
}
@@ -415,7 +427,10 @@ func TestXmlIT5InitCdrDb(t *testing.T) {
func TestXmlIT5CreateCdrDirs(t *testing.T) {
for _, cdrcProfiles := range xmlCfg.CdrcProfiles {
for _, cdrcInst := range cdrcProfiles {
for _, dir := range []string{cdrcInst.CdrInDir, cdrcInst.CdrOutDir} {
if !cdrcInst.Enabled {
continue
}
for _, dir := range []string{cdrcInst.CDRInPath, cdrcInst.CDROutPath} {
if err := os.RemoveAll(dir); err != nil {
t.Fatal("Error removing folder: ", dir, err)
}
@@ -424,8 +439,8 @@ func TestXmlIT5CreateCdrDirs(t *testing.T) {
}
}
if cdrcInst.ID == "XMLWithFilterID" { // Initialize the folders to check later
xmlPathIn1 = cdrcInst.CdrInDir
xmlPathOut1 = cdrcInst.CdrOutDir
xmlPathIn1 = cdrcInst.CDRInPath
xmlPathOut1 = cdrcInst.CDROutPath
}
}
}
@@ -526,7 +541,10 @@ func TestXmlIT6InitCdrDb(t *testing.T) {
func TestXmlIT6CreateCdrDirs(t *testing.T) {
for _, cdrcProfiles := range xmlCfg.CdrcProfiles {
for _, cdrcInst := range cdrcProfiles {
for _, dir := range []string{cdrcInst.CdrInDir, cdrcInst.CdrOutDir} {
if !cdrcInst.Enabled {
continue
}
for _, dir := range []string{cdrcInst.CDRInPath, cdrcInst.CDROutPath} {
if err := os.RemoveAll(dir); err != nil {
t.Fatal("Error removing folder: ", dir, err)
}
@@ -535,8 +553,8 @@ func TestXmlIT6CreateCdrDirs(t *testing.T) {
}
}
if cdrcInst.ID == "XMLWithIndex" { // Initialize the folders to check later
xmlPathIn1 = cdrcInst.CdrInDir
xmlPathOut1 = cdrcInst.CdrOutDir
xmlPathIn1 = cdrcInst.CDRInPath
xmlPathOut1 = cdrcInst.CDROutPath
}
}
}

View File

@@ -242,7 +242,7 @@ const CGRATES_CFG_JSON = `
"cdrs_conns": [ // connections to CDRs. <*internal|x.y.z.y:1234>
{"address": "*internal"}
],
"cdr_format": "*file_csv", // CDR file format <*file_csv|*freeswitch_csv|*fwv|*opensips_flatstore|*partial_csv>
"cdr_format": "*file_csv", // CDR file format <*file_csv|*freeswitch_csv|*file_fwv|*opensips_flatstore|*partial_csv|*file_xml>
"field_separator": ",", // separator used in case of csv files
"timezone": "", // timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB>
"run_delay": 0, // sleep interval in seconds between consecutive runs, 0 to use automation via inotify

View File

@@ -29,9 +29,9 @@
{
"id": "part1",
"enabled": true,
"cdr_format": "partial_csv",
"cdr_in_dir": "/tmp/cdrctests/partcsv1/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_dir": "/tmp/cdrctests/partcsv1/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_format": "*partial_csv",
"cdr_in_path": "/tmp/cdrctests/partcsv1/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_path": "/tmp/cdrctests/partcsv1/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_source_id": "partial_csv_test", // free form field, tag identifying the source of the CDRs within CDRS database
"partial_record_cache": "1s", // duration to cache partial records when not pairing
"partial_cache_expiry_action": "*dump_to_file",
@@ -70,8 +70,8 @@
"id": "post_on_expiry",
"enabled": true,
"cdr_format": "partial_csv",
"cdr_in_dir": "/tmp/cdrctests/partcsv2/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_dir": "/tmp/cdrctests/partcsv2/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_in_path": "/tmp/cdrctests/partcsv2/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_path": "/tmp/cdrctests/partcsv2/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_source_id": "partial_csv_test2", // free form field, tag identifying the source of the CDRs within CDRS database
"partial_record_cache": "1s", // duration to cache partial records when not pairing
"partial_cache_expiry_action": "*post_cdr",

View File

@@ -32,16 +32,16 @@
{
"id": "*default",
"enabled": true,
"cdr_in_dir": "/tmp/cdrctests/csvit1/in",
"cdr_out_dir": "/tmp/cdrctests/csvit1/out",
"cdr_in_path": "/tmp/cdrctests/csvit1/in",
"cdr_out_path": "/tmp/cdrctests/csvit1/out",
"cdr_source_id": "csvit1",
},
{
"id": "*CSVit2", // identifier of the CDRC runner
"enabled": true, // enable CDR client functionality
"field_separator": ";",
"cdr_in_dir": "/tmp/cdrctests/csvit2/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_dir": "/tmp/cdrctests/csvit2/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_in_path": "/tmp/cdrctests/csvit2/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_path": "/tmp/cdrctests/csvit2/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_source_id": "csvit2", // free form field, tag identifying the source of the CDRs within CDRS database
"content_fields":[ // import content_fields template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value
{"tag": "TOR", "field_id": "ToR", "type": "*composed", "value": "*voice", "mandatory": true},
@@ -65,8 +65,8 @@
"id": "*CSVWithFilter1", // identifier of the CDRC runner
"enabled": true, // enable CDR client functionality
"field_separator": ";",
"cdr_in_dir": "/tmp/csvwithfilter1/csvit1/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_dir": "/tmp/csvwithfilter1/csvit1/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_in_path": "/tmp/csvwithfilter1/csvit1/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_path": "/tmp/csvwithfilter1/csvit1/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_source_id": "csvit1", // free form field, tag identifying the source of the CDRs within CDRS database
"filters":["*string:~3:1002"], //filter Account to be 1002
"content_fields":[ // import content_fields template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value
@@ -91,8 +91,8 @@
"id": "*CSVWithFilter2", // identifier of the CDRC runner
"enabled": true, // enable CDR client functionality
"field_separator": ";",
"cdr_in_dir": "/tmp/csvwithfilter2/csvit2/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_dir": "/tmp/csvwithfilter2/csvit2/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_in_path": "/tmp/csvwithfilter2/csvit2/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_path": "/tmp/csvwithfilter2/csvit2/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_source_id": "csvit2", // free form field, tag identifying the source of the CDRs within CDRS database
"filters":["*string:~3:1002","*string:~1:*prepaid","*gte:~6:70"], //filter Account to be 1002 and RequestType *prepaid
"content_fields":[ // import content_fields template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value
@@ -117,8 +117,8 @@
"id": "*CSVit4", // identifier of the CDRC runner
"enabled": true, // enable CDR client functionality
"field_separator": ";",
"cdr_in_dir": "/tmp/csvwithfilter3/csvit3/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_dir": "/tmp/csvwithfilter3/csvit3/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_in_path": "/tmp/csvwithfilter3/csvit3/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_path": "/tmp/csvwithfilter3/csvit3/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_source_id": "csvit4", // free form field, tag identifying the source of the CDRs within CDRS database
"filters":["*string:~1:*postpaid"], //filter Account to be 1002
"content_fields":[ // import content_fields template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value
@@ -144,8 +144,8 @@
"id": "DifferentTenant", // identifier of the CDRC runner
"enabled": true, // enable CDR client functionality
"field_separator": ";",
"cdr_in_dir": "/tmp/csvwithfilter4/csvit4/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_dir": "/tmp/csvwithfilter4/csvit4/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_in_path": "/tmp/csvwithfilter4/csvit4/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_path": "/tmp/csvwithfilter4/csvit4/out", // absolute path towards the directory where processed CDRs will be moved
"tenant": "~2", // tenant used in filterS.Pass
"filters":["FLTR_CDRC_ACC"], // if tenant is itsyscom.com will check if Account is 1001 and if tenant is cgrates.org will check if Account is 1002
"cdr_source_id": "diffTenant", // free form field, tag identifying the source of the CDRs within CDRS database

View File

@@ -40,13 +40,13 @@
"cdrs_conns": [
{"address": "*internal"} // address where to reach CDR server. <*internal|x.y.z.y:1234>
],
"cdr_format": "opensips_flatstore", // CDR file format <csv|freeswitch_csv|fwv|opensips_flatstore>
"cdr_format": "*opensips_flatstore", // CDR file format <csv|freeswitch_csv|fwv|opensips_flatstore>
"field_separator": "|", // separator used in case of csv files
"run_delay": 0, // sleep interval in seconds between consecutive runs, 0 to use automation via inotify
"max_open_files": 1024, // maximum simultaneous files to process
"data_usage_multiply_factor": 1024, // conversion factor for data usage
"cdr_in_dir": "/tmp/cgr_flatstore/cdrc/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_dir": "/tmp/cgr_flatstore/cdrc/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_in_path": "/tmp/cgr_flatstore/cdrc/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_path": "/tmp/cgr_flatstore/cdrc/out", // absolute path towards the directory where processed CDRs will be moved
"failed_calls_prefix": "missed_calls", // used in case of flatstore CDRs to avoid searching for BYE records
"cdr_source_id": "flatstore", // free form field, id identifying the source of the CDRs within CDRS database
"partial_record_cache": "1s", // duration to cache partial records when not pairing

View File

@@ -40,9 +40,9 @@
"cdrs_conns": [
{"address": "*internal"} // address where to reach CDR server. <*internal|x.y.z.y:1234>
],
"cdr_format": "fwv", // CDR file format <csv|freeswitch_csv|fwv|opensips_flatstore>
"cdr_in_dir": "/tmp/cgr_fwv/cdrc/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_dir": "/tmp/cgr_fwv/cdrc/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_format": "*file_fwv", // CDR file format <csv|freeswitch_csv|fwv|opensips_flatstore>
"cdr_in_path": "/tmp/cgr_fwv/cdrc/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_path": "/tmp/cgr_fwv/cdrc/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_source_id": "cdrc", // free form field, tag identifying the source of the CDRs within CDRS database
"header_fields": [
{"tag": "FileName", "field_id": "CdrFileName", "type": "*composed", "value": "~95-135", "padding":"right"},

View File

@@ -41,9 +41,9 @@
"cdrs_conns": [
{"address": "*internal"} // address where to reach CDR server. <*internal|x.y.z.y:1234>
],
"cdr_format": "fwv", // CDR file format <csv|freeswitch_csv|fwv|opensips_flatstore>
"cdr_in_dir": "/tmp/cgr_fwv/cdrc/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_dir": "/tmp/cgr_fwv/cdrc/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_format": "*file_fwv", // CDR file format <csv|freeswitch_csv|fwv|opensips_flatstore>
"cdr_in_path": "/tmp/cgr_fwv/cdrc/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_path": "/tmp/cgr_fwv/cdrc/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_source_id": "cdrc", // free form field, id identifying the source of the CDRs within CDRS database
"filters":["*string:~0-10:CDR0000010"],
"header_fields": [
@@ -84,8 +84,8 @@
{"address": "*internal"} // address where to reach CDR server. <*internal|x.y.z.y:1234>
],
"cdr_format": "fwv", // CDR file format <csv|freeswitch_csv|fwv|opensips_flatstore>
"cdr_in_dir": "/tmp/cgr_fwv/cdrc/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_dir": "/tmp/cgr_fwv/cdrc/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_in_path": "/tmp/cgr_fwv/cdrc/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_path": "/tmp/cgr_fwv/cdrc/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_source_id": "cdrc", // free form field, id identifying the source of the CDRs within CDRS database
"filters":["FLTR_FWV"],
"header_fields": [

View File

@@ -25,10 +25,10 @@
{
"id": "XMLit1",
"enabled": true,
"cdr_format": "xml",
"cdr_in_dir": "/tmp/cdrctests/xmlit1/in",
"cdr_out_dir": "/tmp/cdrctests/xmlit1/out",
"cdr_path": "broadWorksCDR.cdrData",
"cdr_format": "*file_xml",
"cdr_in_path": "/tmp/cdrctests/xmlit1/in",
"cdr_out_path": "/tmp/cdrctests/xmlit1/out",
"cdr_root_path": "broadWorksCDR.cdrData",
"cdr_source_id": "xmlit1",
"content_fields":[ // import content_fields template, id will match internally CDR field, in case of .csv value will be represented by index of the field value
{"tag": "TOR", "field_id": "ToR", "type": "*composed", "value": "*voice", "mandatory": true},

View File

@@ -25,10 +25,10 @@
{
"id": "XMLWithFilter",
"enabled": true,
"cdr_format": "xml",
"cdr_in_dir": "/tmp/cdrcxmlwithfilters/xmlit1/in",
"cdr_out_dir": "/tmp/cdrcxmlwithfilters/xmlit1/out",
"cdr_path": "broadWorksCDR.cdrData",
"cdr_format": "*file_xml",
"cdr_in_path": "/tmp/cdrcxmlwithfilters/xmlit1/in",
"cdr_out_path": "/tmp/cdrcxmlwithfilters/xmlit1/out",
"cdr_root_path": "broadWorksCDR.cdrData",
"cdr_source_id": "xmlit1",
"filters": ["*string:~broadWorksCDR.cdrData.basicModule.userNumber:1002","*string:~broadWorksCDR.cdrData.headerModule.type:Normal"],
"content_fields":[ // import content_fields template, id will match internally CDR field, in case of .csv value will be represented by index of the field value
@@ -48,9 +48,9 @@
{
"id": "msw_xml", // identifier of the CDRC runner
"enabled": true, // enable CDR client functionality
"cdr_format": "xml", // CDR file format <csv|freeswitch_csv|fwv|opensips_flatstore|partial_csv.
"cdr_in_dir": "/tmp/cdrcxmlwithfilters2/xmlit2/in",
"cdr_out_dir": "/tmp/cdrcxmlwithfilters2/xmlit2/out",
"cdr_format": "*file_xml", // CDR file format <csv|freeswitch_csv|fwv|opensips_flatstore|partial_csv.
"cdr_in_path": "/tmp/cdrcxmlwithfilters2/xmlit2/in",
"cdr_out_path": "/tmp/cdrcxmlwithfilters2/xmlit2/out",
"cdr_path": "File.CDRs.Call", // path towards one CDR element in case of XML CDRs
"cdr_source_id": "zw_cfs1", // free form field, tag identifying the source of the CDRs within CDRS database
"content_fields":[ // import content_fields template, id will match internally CDR field, in case of .csv value will be represented by index of the field value
@@ -71,10 +71,10 @@
{
"id": "msw_xml2", // identifier of the CDRC runner
"enabled": true, // enable CDR client functionality
"cdr_format": "xml", // CDR file format <csv|freeswitch_csv|fwv|opensips_flatstore|partial_csv.
"cdr_in_dir": "/tmp/cdrcxmlwithfilters3/xmlit3/in",
"cdr_out_dir": "/tmp/cdrcxmlwithfilters3/xmlit3/out",
"cdr_path": "File.CDRs.Call", // path towards one CDR element in case of XML CDRs
"cdr_format": "*file_xml", // CDR file format <csv|freeswitch_csv|fwv|opensips_flatstore|partial_csv.
"cdr_in_path": "/tmp/cdrcxmlwithfilters3/xmlit3/in",
"cdr_out_path": "/tmp/cdrcxmlwithfilters3/xmlit3/out",
"cdr_root_path": "File.CDRs.Call", // path towards one CDR element in case of XML CDRs
"cdr_source_id": "zw_cfs1", // free form field, tag identifying the source of the CDRs within CDRS database
"content_fields":[ // import content_fields template, id will match internally CDR field, in case of .csv value will be represented by index of the field value
{"tag": "TOR", "field_id": "ToR", "type": "*composed", "value": "*voice", "mandatory": true},
@@ -96,10 +96,10 @@
{
"id": "XMLWithFilterID",
"enabled": true,
"cdr_format": "xml",
"cdr_in_dir": "/tmp/cdrcxmlwithfilters/xmlit5/in",
"cdr_out_dir": "/tmp/cdrcxmlwithfilters/xmlit5/out",
"cdr_path": "broadWorksCDR.cdrData",
"cdr_format": "*file_xml",
"cdr_in_path": "/tmp/cdrcxmlwithfilters/xmlit5/in",
"cdr_out_path": "/tmp/cdrcxmlwithfilters/xmlit5/out",
"cdr_root_path": "broadWorksCDR.cdrData",
"cdr_source_id": "xmlit1",
"filters": ["FLTR_XML"],
"content_fields":[ // import content_fields template, id will match internally CDR field, in case of .csv value will be represented by index of the field value
@@ -119,10 +119,10 @@
{
"id": "XMLWithIndex",
"enabled": true,
"cdr_format": "xml",
"cdr_in_dir": "/tmp/cdrcxmlwithindex/xmlit1/in",
"cdr_out_dir": "/tmp/cdrcxmlwithindex/xmlit1/out",
"cdr_path": "complete-success-notification",
"cdr_format": "*file_xml",
"cdr_in_path": "/tmp/cdrcxmlwithindex/xmlit1/in",
"cdr_out_path": "/tmp/cdrcxmlwithindex/xmlit1/out",
"cdr_root_path": "complete-success-notification",
"cdr_source_id": "xmlit1",
"content_fields":[ // import content_fields template, id will match internally CDR field, in case of .csv value will be represented by index of the field value
{"tag": "TOR", "field_id": "ToR", "type": "*composed", "value": "*voice", "mandatory": true},

View File

@@ -5,8 +5,8 @@
{
"id": "CDRC-CSV2",
"enabled": true, // enable CDR client functionality
"cdr_in_dir": "/tmp/cgrates/cdrc_fs/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_dir": "/tmp/cgrates/cdrc_fs/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_in_path": "/tmp/cgrates/cdrc_fs/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_path": "/tmp/cgrates/cdrc_fs/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_source_id": "fs_csv", // free form field, tag identifying the source of the CDRs within CDRS database
"content_fields":[ // import template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value
{"tag": "tor", "cdr_field_id": "tor", "type": "cdrfield", "value": "^*voice", "mandatory": true},

View File

@@ -28,15 +28,15 @@
{
"id": "CDRC-CSV1",
"enabled": true, // enable CDR client functionality
"cdr_in_dir": "/tmp/cgrates/cdrc1/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_dir": "/tmp/cgrates/cdrc1/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_in_path": "/tmp/cgrates/cdrc1/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_path": "/tmp/cgrates/cdrc1/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_source_id": "csv1", // free form field, tag identifying the source of the CDRs within CDRS database
},
{
"id": "CDRC-CSV2",
"enabled": true, // enable CDR client functionality
"cdr_in_dir": "/tmp/cgrates/cdrc2/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_dir": "/tmp/cgrates/cdrc2/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_in_path": "/tmp/cgrates/cdrc2/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_path": "/tmp/cgrates/cdrc2/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_source_id": "csv2", // free form field, tag identifying the source of the CDRs within CDRS database
"content_fields":[ // import template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value
{"cdr_field_id": "tor", "value": "~7:s/^(voice|data|sms|generic)$/*$1/"},
@@ -57,8 +57,8 @@
"id": "CDRC-CSV3",
"enabled": true, // enable CDR client functionality
"field_separator": ";", // separator used in case of csv files
"cdr_in_dir": "/tmp/cgrates/cdrc3/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_dir": "/tmp/cgrates/cdrc3/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_in_path": "/tmp/cgrates/cdrc3/in", // absolute path towards the directory where the CDRs are stored
"cdr_out_path": "/tmp/cgrates/cdrc3/out", // absolute path towards the directory where processed CDRs will be moved
"cdr_source_id": "csv3", // free form field, tag identifying the source of the CDRs within CDRS database
"content_fields":[ // import template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value
{"cdr_field_id": "tor", "value": "^*voice"},

View File

@@ -179,7 +179,6 @@ const (
META_DEFAULT = "*default"
STATIC_VALUE_PREFIX = "^"
CSV = "csv"
FWV = "fwv"
MetaPartialCSV = "*partial_csv"
DRYRUN = "dry_run"
META_COMBIMED = "*combimed"
@@ -189,6 +188,7 @@ const (
OK = "OK"
CDRE_FIXED_WIDTH = "fwv"
XML_PROFILE_PREFIX = "*xml:"
MetaFileXML = "*file_xml"
CDRE = "cdre"
CDRC = "cdrc"
MASK_CHAR = "*"