Add *partial_csv type in eventReader ( almost complete)

This commit is contained in:
TeoV
2020-01-17 15:58:47 +02:00
parent 35caf1390f
commit c074fd2369
12 changed files with 694 additions and 22 deletions

View File

@@ -255,6 +255,77 @@
{"tag": "NrOfCdrs", "type": "metatag", "metatag_id":"total_cdrs", "value": "~*req.142-150"},
{"tag": "TotalDuration", "type": "metatag", "metatag_id":"total_duration", "value": "~*req.150-162"},
],
},
{
"id": "PartialCSV1",
"enabled": true,
"run_delay": -1,
"type": "*partial_csv",
"source_path": "/tmp/partErs1/in",
"flags": ["*cdrs"],
"processed_path": "/tmp/partErs1/out",
"partial_record_cache": "2s",
"partial_cache_expiry_action": "*dump_to_file",
"content_fields":[
{"tag": "ToR", "field_id": "ToR", "type": "*constant", "value": "*voice", "mandatory": true},
{"tag": "AccId1", "field_id": "OriginID", "type": "*composed", "value": "~*req.0"},
{"tag": "AccId2", "field_id": "OriginID", "type": "*composed", "value": "_"},
{"tag": "AccId3", "field_id": "OriginID", "type": "*composed", "value": "~*req.1"},
{"tag": "AccId4", "field_id": "OriginID", "type": "*composed", "value": "_"},
{"tag": "AccId5", "field_id": "OriginID", "type": "*composed", "value": "~*req.4"},
{"tag": "OrderID", "field_id": "OrderID", "type": "*unix_timestamp", "value": "~*req.3"},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*constant", "value": "127.0.0.1", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*rated", "mandatory": true},
{"tag": "Tenant", "field_id": "Tenant", "type": "*constant", "value": "cgrates.org", "mandatory": true},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*variable", "value": "~*req.0:s/^49([1-9]\\d+)$/0$1/", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*variable", "value": "~*req.1:s/^00(\\d+)$/+$1/", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*variable", "value": "~*req.4", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*variable", "value": "~*req.4", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*variable", "value": "~*req.6:s/^(\\d+)$/${1}s/", "mandatory": true},
{"tag": "Partial", "field_id": "Partial", "type": "*constant", "value": "true", "filters":["*string:~*req.10:partial"]},
],
"cache_dump_fields": [
{"tag": "OriginID", "type": "*composed", "value": "~OriginID"},
{"tag": "OrderID", "type": "*composed", "value": "~OrderID"},
{"tag": "RequestType", "type": "*composed", "value": "~RequestType"},
{"tag": "Account", "type": "*composed", "value": "~Account"},
{"tag": "Destination", "type": "*composed", "value": "~Destination"},
{"tag": "SetupTime", "type": "*composed", "value": "~SetupTime", "layout": "2006-01-02T15:04:05Z07:00"},
{"tag": "AnswerTime", "type": "*composed", "value": "~AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"},
{"tag": "Usage", "type": "*composed", "value": "~Usage"},
{"tag": "Cost", "type": "*composed", "value": "~Cost","rounding_decimals":5},
],
},
{
"id": "PartialCSV_PostExpiry",
"enabled": true,
"run_delay": -1,
"type": "*partial_csv",
"source_path": "/tmp/partErs2/in",
"processed_path": "/tmp/partErs2/out",
"flags": ["*cdrs"],
"partial_record_cache": "1s",
"partial_cache_expiry_action": "*post_cdr",
"content_fields":[
{"tag": "ToR", "field_id": "ToR", "type": "*constant", "value": "*voice", "mandatory": true},
{"tag": "AccId1", "field_id": "OriginID", "type": "*composed", "value": "~*req.0"},
{"tag": "AccId2", "field_id": "OriginID", "type": "*composed", "value": "_"},
{"tag": "AccId3", "field_id": "OriginID", "type": "*composed", "value": "~*req.1"},
{"tag": "AccId4", "field_id": "OriginID", "type": "*composed", "value": "_"},
{"tag": "AccId5", "field_id": "OriginID", "type": "*composed", "value": "~*req.4"},
{"tag": "OrderID", "field_id": "OrderID", "type": "*unix_timestamp", "value": "~*req.3"},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*constant", "value": "127.0.0.1", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*rated", "mandatory": true},
{"tag": "Tenant", "field_id": "Tenant", "type": "*constant", "value": "cgrates.org", "mandatory": true},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*variable", "value": "~*req.0:s/^49([1-9]\\d+)$/0$1/", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*variable", "value": "~*req.1:s/^00(\\d+)$/+$1/", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*variable", "value": "~*req.4", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*variable", "value": "~*req.4", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*variable", "value": "~*req.6:s/^(\\d+)$/${1}s/", "mandatory": true},
{"tag": "Partial", "field_id": "Partial", "type": "*constant", "value": "true", "filters":["*string:~*req.10:partial"]}
],
}
],
},

View File

@@ -258,6 +258,77 @@
{"tag": "NrOfCdrs", "type": "metatag", "metatag_id":"total_cdrs", "value": "~*req.142-150"},
{"tag": "TotalDuration", "type": "metatag", "metatag_id":"total_duration", "value": "~*req.150-162"},
],
},
{
"id": "PartialCSV1",
"enabled": true,
"run_delay": -1,
"type": "*partial_csv",
"source_path": "/tmp/partErs1/in",
"flags": ["*cdrs"],
"processed_path": "/tmp/partErs1/out",
"partial_record_cache": "2s",
"partial_cache_expiry_action": "*dump_to_file",
"content_fields":[
{"tag": "ToR", "field_id": "ToR", "type": "*constant", "value": "*voice", "mandatory": true},
{"tag": "AccId1", "field_id": "OriginID", "type": "*composed", "value": "~*req.0"},
{"tag": "AccId2", "field_id": "OriginID", "type": "*composed", "value": "_"},
{"tag": "AccId3", "field_id": "OriginID", "type": "*composed", "value": "~*req.1"},
{"tag": "AccId4", "field_id": "OriginID", "type": "*composed", "value": "_"},
{"tag": "AccId5", "field_id": "OriginID", "type": "*composed", "value": "~*req.4"},
{"tag": "OrderID", "field_id": "OrderID", "type": "*unix_timestamp", "value": "~*req.3"},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*constant", "value": "127.0.0.1", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*rated", "mandatory": true},
{"tag": "Tenant", "field_id": "Tenant", "type": "*constant", "value": "cgrates.org", "mandatory": true},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*variable", "value": "~*req.0:s/^49([1-9]\\d+)$/0$1/", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*variable", "value": "~*req.1:s/^00(\\d+)$/+$1/", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*variable", "value": "~*req.4", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*variable", "value": "~*req.4", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*variable", "value": "~*req.6:s/^(\\d+)$/${1}s/", "mandatory": true},
{"tag": "Partial", "field_id": "Partial", "type": "*constant", "value": "true", "filters":["*string:~*req.10:partial"]},
],
"cache_dump_fields": [
{"tag": "OriginID", "type": "*composed", "value": "~OriginID"},
{"tag": "OrderID", "type": "*composed", "value": "~OrderID"},
{"tag": "RequestType", "type": "*composed", "value": "~RequestType"},
{"tag": "Account", "type": "*composed", "value": "~Account"},
{"tag": "Destination", "type": "*composed", "value": "~Destination"},
{"tag": "SetupTime", "type": "*composed", "value": "~SetupTime", "layout": "2006-01-02T15:04:05Z07:00"},
{"tag": "AnswerTime", "type": "*composed", "value": "~AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"},
{"tag": "Usage", "type": "*composed", "value": "~Usage"},
{"tag": "Cost", "type": "*composed", "value": "~Cost","rounding_decimals":5},
],
},
{
"id": "PartialCSV_PostExpiry",
"enabled": true,
"run_delay": -1,
"type": "*partial_csv",
"source_path": "/tmp/partErs2/in",
"processed_path": "/tmp/partErs2/out",
"flags": ["*cdrs"],
"partial_record_cache": "1s",
"partial_cache_expiry_action": "*post_cdr",
"content_fields":[
{"tag": "ToR", "field_id": "ToR", "type": "*constant", "value": "*voice", "mandatory": true},
{"tag": "AccId1", "field_id": "OriginID", "type": "*composed", "value": "~*req.0"},
{"tag": "AccId2", "field_id": "OriginID", "type": "*composed", "value": "_"},
{"tag": "AccId3", "field_id": "OriginID", "type": "*composed", "value": "~*req.1"},
{"tag": "AccId4", "field_id": "OriginID", "type": "*composed", "value": "_"},
{"tag": "AccId5", "field_id": "OriginID", "type": "*composed", "value": "~*req.4"},
{"tag": "OrderID", "field_id": "OrderID", "type": "*unix_timestamp", "value": "~*req.3"},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*constant", "value": "127.0.0.1", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*rated", "mandatory": true},
{"tag": "Tenant", "field_id": "Tenant", "type": "*constant", "value": "cgrates.org", "mandatory": true},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*variable", "value": "~*req.0:s/^49([1-9]\\d+)$/0$1/", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*variable", "value": "~*req.1:s/^00(\\d+)$/+$1/", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*variable", "value": "~*req.4", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*variable", "value": "~*req.4", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*variable", "value": "~*req.6:s/^(\\d+)$/${1}s/", "mandatory": true},
{"tag": "Partial", "field_id": "Partial", "type": "*constant", "value": "true", "filters":["*string:~*req.10:partial"]}
],
}
],
},

View File

@@ -255,6 +255,78 @@
{"tag": "NrOfCdrs", "type": "metatag", "metatag_id":"total_cdrs", "value": "~*req.142-150"},
{"tag": "TotalDuration", "type": "metatag", "metatag_id":"total_duration", "value": "~*req.150-162"},
],
},
{
"id": "PartialCSV1",
"enabled": true,
"run_delay": -1,
"type": "*partial_csv",
"source_path": "/tmp/partErs1/in",
"flags": ["*cdrs"],
"processed_path": "/tmp/partErs1/out",
"partial_record_cache": "2s",
"partial_cache_expiry_action": "*dump_to_file",
"content_fields":[
{"tag": "ToR", "field_id": "ToR", "type": "*constant", "value": "*voice", "mandatory": true},
{"tag": "AccId1", "field_id": "OriginID", "type": "*composed", "value": "~*req.0"},
{"tag": "AccId2", "field_id": "OriginID", "type": "*composed", "value": "_"},
{"tag": "AccId3", "field_id": "OriginID", "type": "*composed", "value": "~*req.1"},
{"tag": "AccId4", "field_id": "OriginID", "type": "*composed", "value": "_"},
{"tag": "AccId5", "field_id": "OriginID", "type": "*composed", "value": "~*req.4"},
{"tag": "OrderID", "field_id": "OrderID", "type": "*unix_timestamp", "value": "~*req.3"},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*constant", "value": "127.0.0.1", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*rated", "mandatory": true},
{"tag": "Tenant", "field_id": "Tenant", "type": "*constant", "value": "cgrates.org", "mandatory": true},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*variable", "value": "~*req.0:s/^49([1-9]\\d+)$/0$1/", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*variable", "value": "~*req.1:s/^00(\\d+)$/+$1/", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*variable", "value": "~*req.4", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*variable", "value": "~*req.4", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*variable", "value": "~*req.6:s/^(\\d+)$/${1}s/", "mandatory": true},
{"tag": "Partial", "field_id": "Partial", "type": "*constant", "value": "true", "filters":["*string:~*req.10:partial"]},
],
"cache_dump_fields": [
{"tag": "CGRID", "type": "*composed", "value": "~CGRID"},
{"tag": "OriginID", "type": "*composed", "value": "~OriginID"},
{"tag": "OrderID", "type": "*composed", "value": "~OrderID"},
{"tag": "RequestType", "type": "*composed", "value": "~RequestType"},
{"tag": "Account", "type": "*composed", "value": "~Account"},
{"tag": "Destination", "type": "*composed", "value": "~Destination"},
{"tag": "SetupTime", "type": "*composed", "value": "~SetupTime", "layout": "2006-01-02T15:04:05Z07:00"},
{"tag": "AnswerTime", "type": "*composed", "value": "~AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"},
{"tag": "Usage", "type": "*composed", "value": "~Usage"},
{"tag": "Cost", "type": "*composed", "value": "~Cost","rounding_decimals":5},
],
},
{
"id": "PartialCSV_PostExpiry",
"enabled": true,
"run_delay": -1,
"type": "*partial_csv",
"source_path": "/tmp/partErs2/in",
"processed_path": "/tmp/partErs2/out",
"flags": ["*cdrs"],
"partial_record_cache": "1s",
"partial_cache_expiry_action": "*post_cdr",
"content_fields":[
{"tag": "ToR", "field_id": "ToR", "type": "*constant", "value": "*voice", "mandatory": true},
{"tag": "AccId1", "field_id": "OriginID", "type": "*composed", "value": "~*req.0"},
{"tag": "AccId2", "field_id": "OriginID", "type": "*composed", "value": "_"},
{"tag": "AccId3", "field_id": "OriginID", "type": "*composed", "value": "~*req.1"},
{"tag": "AccId4", "field_id": "OriginID", "type": "*composed", "value": "_"},
{"tag": "AccId5", "field_id": "OriginID", "type": "*composed", "value": "~*req.4"},
{"tag": "OrderID", "field_id": "OrderID", "type": "*unix_timestamp", "value": "~*req.3"},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*constant", "value": "127.0.0.1", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*rated", "mandatory": true},
{"tag": "Tenant", "field_id": "Tenant", "type": "*constant", "value": "cgrates.org", "mandatory": true},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*variable", "value": "~*req.0:s/^49([1-9]\\d+)$/0$1/", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*variable", "value": "~*req.1:s/^00(\\d+)$/+$1/", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*variable", "value": "~*req.4", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*variable", "value": "~*req.4", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*variable", "value": "~*req.6:s/^(\\d+)$/${1}s/", "mandatory": true},
{"tag": "Partial", "field_id": "Partial", "type": "*constant", "value": "true", "filters":["*string:~*req.10:partial"]}
],
}
],
},

View File

@@ -252,6 +252,77 @@
{"tag": "NrOfCdrs", "type": "metatag", "metatag_id":"total_cdrs", "value": "~*req.142-150"},
{"tag": "TotalDuration", "type": "metatag", "metatag_id":"total_duration", "value": "~*req.150-162"},
],
},
{
"id": "PartialCSV1",
"enabled": true,
"run_delay": -1,
"type": "*partial_csv",
"source_path": "/tmp/partErs1/in",
"flags": ["*cdrs"],
"processed_path": "/tmp/partErs1/out",
"partial_record_cache": "2s",
"partial_cache_expiry_action": "*dump_to_file",
"content_fields":[
{"tag": "ToR", "field_id": "ToR", "type": "*constant", "value": "*voice", "mandatory": true},
{"tag": "AccId1", "field_id": "OriginID", "type": "*composed", "value": "~*req.0"},
{"tag": "AccId2", "field_id": "OriginID", "type": "*composed", "value": "_"},
{"tag": "AccId3", "field_id": "OriginID", "type": "*composed", "value": "~*req.1"},
{"tag": "AccId4", "field_id": "OriginID", "type": "*composed", "value": "_"},
{"tag": "AccId5", "field_id": "OriginID", "type": "*composed", "value": "~*req.4"},
{"tag": "OrderID", "field_id": "OrderID", "type": "*unix_timestamp", "value": "~*req.3"},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*constant", "value": "127.0.0.1", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*rated", "mandatory": true},
{"tag": "Tenant", "field_id": "Tenant", "type": "*constant", "value": "cgrates.org", "mandatory": true},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*variable", "value": "~*req.0:s/^49([1-9]\\d+)$/0$1/", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*variable", "value": "~*req.1:s/^00(\\d+)$/+$1/", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*variable", "value": "~*req.4", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*variable", "value": "~*req.4", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*variable", "value": "~*req.6:s/^(\\d+)$/${1}s/", "mandatory": true},
{"tag": "Partial", "field_id": "Partial", "type": "*constant", "value": "true", "filters":["*string:~*req.10:partial"]},
],
"cache_dump_fields": [
{"tag": "OriginID", "type": "*composed", "value": "~OriginID"},
{"tag": "OrderID", "type": "*composed", "value": "~OrderID"},
{"tag": "RequestType", "type": "*composed", "value": "~RequestType"},
{"tag": "Account", "type": "*composed", "value": "~Account"},
{"tag": "Destination", "type": "*composed", "value": "~Destination"},
{"tag": "SetupTime", "type": "*composed", "value": "~SetupTime", "layout": "2006-01-02T15:04:05Z07:00"},
{"tag": "AnswerTime", "type": "*composed", "value": "~AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"},
{"tag": "Usage", "type": "*composed", "value": "~Usage"},
{"tag": "Cost", "type": "*composed", "value": "~Cost","rounding_decimals":5},
],
},
{
"id": "PartialCSV_PostExpiry",
"enabled": true,
"run_delay": -1,
"type": "*partial_csv",
"source_path": "/tmp/partErs2/in",
"processed_path": "/tmp/partErs2/out",
"flags": ["*cdrs"],
"partial_record_cache": "1s",
"partial_cache_expiry_action": "*post_cdr",
"content_fields":[
{"tag": "ToR", "field_id": "ToR", "type": "*constant", "value": "*voice", "mandatory": true},
{"tag": "AccId1", "field_id": "OriginID", "type": "*composed", "value": "~*req.0"},
{"tag": "AccId2", "field_id": "OriginID", "type": "*composed", "value": "_"},
{"tag": "AccId3", "field_id": "OriginID", "type": "*composed", "value": "~*req.1"},
{"tag": "AccId4", "field_id": "OriginID", "type": "*composed", "value": "_"},
{"tag": "AccId5", "field_id": "OriginID", "type": "*composed", "value": "~*req.4"},
{"tag": "OrderID", "field_id": "OrderID", "type": "*unix_timestamp", "value": "~*req.3"},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*constant", "value": "127.0.0.1", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*rated", "mandatory": true},
{"tag": "Tenant", "field_id": "Tenant", "type": "*constant", "value": "cgrates.org", "mandatory": true},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*variable", "value": "~*req.0:s/^49([1-9]\\d+)$/0$1/", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*variable", "value": "~*req.1:s/^00(\\d+)$/+$1/", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*variable", "value": "~*req.4", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*variable", "value": "~*req.4", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*variable", "value": "~*req.6:s/^(\\d+)$/${1}s/", "mandatory": true},
{"tag": "Partial", "field_id": "Partial", "type": "*constant", "value": "true", "filters":["*string:~*req.10:partial"]}
],
}
],
},