Added config for partial csv with multiple methods

This commit is contained in:
Trial97
2021-06-08 17:15:17 +03:00
committed by Dan Christian Bogos
parent a27c22ba4e
commit fc97f6546d
5 changed files with 234 additions and 5 deletions

View File

@@ -481,7 +481,64 @@
{"tag": "ExtraInfo1", "path": "*cgreq.ExtraInfo1", "type": "*constant", "value": "ExtraInfo1"},
{"tag": "ExtraInfo2", "path": "*cgreq.ExtraInfo2", "type": "*constant", "value": "ExtraInfo2"},
],
}
},
{
"id": "PartialWithMultipleMethods",
"enabled": true,
"run_delay": "-1",
"type": "*file_csv",
"opts": {
"csvFieldSeparator":",",
"partialcsvFieldSeparator": ",",
"partialCacheAction": "*dump_to_file",
"partialOrderField": "~*opts.orderID",
"partialPath": "/tmp/flatstoreMMErs/out",
"csvLazyQuotes": true,
},
"source_path": "/tmp/flatstoreMMErs/in",
"processed_path": "/tmp/flatstoreMMErs/out",
"flags": ["*cdrs"],
"fields":[
{"tag": "OriginHost", "path": "*cgreq.OriginHost", "type": "*constant","value":"flatStoreACK", "mandatory": true},
{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable","value":"~*req.4;~*req.2;~*req.3", "mandatory": true},
{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*postpaid", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
{"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.8", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
{"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.8", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
{"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.14", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.7", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.7", "mandatory": true,"filters": ["*string:~*req.1:ACK"]},
{"tag": "EndTime", "path": "*cgreq.EndTime", "type": "*variable","value": "~*req.7", "mandatory": true, "filters": ["*string:~*req.1:BYE"]},
{"tag": "DisconnectCause", "path": "*cgreq.DisconnectCause", "type": "*variable", "value": "~*req.5; ;~*req.6", "mandatory": true},
{"tag": "DialogId", "path": "*cgreq.DialogId", "type": "*variable", "value": "~*req.12"},
{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "true", "filters": ["*notstring:~*req.1:CANCEL"]},
{"tag": "Invite", "path": "*opts.invite", "type": "*constant", "value": "true", "filters":["*string:~*req.1:INVITE"]},
{"tag": "Bye", "path": "*opts.bye", "type": "*constant", "value": "true", "filters":["*string:~*req.1:BYE"]},
{"tag": "Ack", "path": "*opts.ack", "type": "*constant", "value": "true", "filters":["*string:~*req.1:ACK"]},
{"tag": "Order", "path": "*opts.orderID", "type": "*variable", "value": "~*req.1"},
{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "false", "filters": ["*string:~*req.1:CANCEL"]},
{"tag": "Usage", "path": "*cgreq.Usage", "type": "*constant","value": "0", "mandatory": true, "filters": ["*string:~*req.1:CANCEL"]},
],
"partial_commit_fields": [
{"tag": "Usage", "path": "*cgreq.Usage", "type": "*usage_difference","value": "~*req.EndTime;~*req.AnswerTime", "mandatory": true, "filters": ["*exists:~*opts.invite:","*exists:~*opts.bye:","*exists:~*opts.ack:"]},
{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "false","filters": ["*exists:~*opts.invite:","*exists:~*opts.bye:","*exists:~*opts.ack:"]},
],
"cache_dump_fields": [
{"tag": "OriginHost", "path": "*exp.OriginHost", "type": "*variable", "value":"~*req.OriginHost"},
{"tag": "OriginID", "path": "*exp.OriginID", "type": "*variable", "value":"~*req.OriginID"},
{"tag": "RequestType", "path": "*exp.RequestType", "type": "*variable", "value":"~*req.RequestType"},
{"tag": "Account", "path": "*exp.Account", "type": "*variable", "value":"~*req.Account"},
{"tag": "Subject", "path": "*exp.Subject", "type": "*variable", "value":"~*req.Subject"},
{"tag": "Destination", "path": "*exp.Destination", "type": "*variable", "value":"~*req.Destination"},
{"tag": "SetupTime", "path": "*exp.SetupTime", "type": "*variable", "value":"~*req.SetupTime"},
{"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value":"~*req.AnswerTime"},
{"tag": "EndTime", "path": "*exp.EndTime", "type": "*variable", "value":"~*req.EndTime"},
{"tag": "DisconnectCause", "path": "*exp.DisconnectCause", "type": "*variable", "value":"~*req.DisconnectCause"},
{"tag": "DialogId", "path": "*exp.DialogId", "type": "*variable", "value":"~*req.DialogId"},
],
},
],
},

View File

@@ -483,7 +483,64 @@
{"tag": "ExtraInfo1", "path": "*cgreq.ExtraInfo1", "type": "*constant", "value": "ExtraInfo1"},
{"tag": "ExtraInfo2", "path": "*cgreq.ExtraInfo2", "type": "*constant", "value": "ExtraInfo2"},
],
}
},
{
"id": "PartialWithMultipleMethods",
"enabled": true,
"run_delay": "-1",
"type": "*file_csv",
"opts": {
"csvFieldSeparator":",",
"partialcsvFieldSeparator": ",",
"partialCacheAction": "*dump_to_file",
"partialOrderField": "~*opts.orderID",
"partialPath": "/tmp/flatstoreMMErs/out",
"csvLazyQuotes": true,
},
"source_path": "/tmp/flatstoreMMErs/in",
"processed_path": "/tmp/flatstoreMMErs/out",
"flags": ["*cdrs"],
"fields":[
{"tag": "OriginHost", "path": "*cgreq.OriginHost", "type": "*constant","value":"flatStoreACK", "mandatory": true},
{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable","value":"~*req.4;~*req.2;~*req.3", "mandatory": true},
{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*postpaid", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
{"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.8", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
{"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.8", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
{"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.14", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.7", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.7", "mandatory": true,"filters": ["*string:~*req.1:ACK"]},
{"tag": "EndTime", "path": "*cgreq.EndTime", "type": "*variable","value": "~*req.7", "mandatory": true, "filters": ["*string:~*req.1:BYE"]},
{"tag": "DisconnectCause", "path": "*cgreq.DisconnectCause", "type": "*variable", "value": "~*req.5; ;~*req.6", "mandatory": true},
{"tag": "DialogId", "path": "*cgreq.DialogId", "type": "*variable", "value": "~*req.12"},
{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "true", "filters": ["*notstring:~*req.1:CANCEL"]},
{"tag": "Invite", "path": "*opts.invite", "type": "*constant", "value": "true", "filters":["*string:~*req.1:INVITE"]},
{"tag": "Bye", "path": "*opts.bye", "type": "*constant", "value": "true", "filters":["*string:~*req.1:BYE"]},
{"tag": "Ack", "path": "*opts.ack", "type": "*constant", "value": "true", "filters":["*string:~*req.1:ACK"]},
{"tag": "Order", "path": "*opts.orderID", "type": "*variable", "value": "~*req.1"},
{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "false", "filters": ["*string:~*req.1:CANCEL"]},
{"tag": "Usage", "path": "*cgreq.Usage", "type": "*constant","value": "0", "mandatory": true, "filters": ["*string:~*req.1:CANCEL"]},
],
"partial_commit_fields": [
{"tag": "Usage", "path": "*cgreq.Usage", "type": "*usage_difference","value": "~*req.EndTime;~*req.AnswerTime", "mandatory": true, "filters": ["*exists:~*opts.invite:","*exists:~*opts.bye:","*exists:~*opts.ack:"]},
{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "false","filters": ["*exists:~*opts.invite:","*exists:~*opts.bye:","*exists:~*opts.ack:"]},
],
"cache_dump_fields": [
{"tag": "OriginHost", "path": "*exp.OriginHost", "type": "*variable", "value":"~*req.OriginHost"},
{"tag": "OriginID", "path": "*exp.OriginID", "type": "*variable", "value":"~*req.OriginID"},
{"tag": "RequestType", "path": "*exp.RequestType", "type": "*variable", "value":"~*req.RequestType"},
{"tag": "Account", "path": "*exp.Account", "type": "*variable", "value":"~*req.Account"},
{"tag": "Subject", "path": "*exp.Subject", "type": "*variable", "value":"~*req.Subject"},
{"tag": "Destination", "path": "*exp.Destination", "type": "*variable", "value":"~*req.Destination"},
{"tag": "SetupTime", "path": "*exp.SetupTime", "type": "*variable", "value":"~*req.SetupTime"},
{"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value":"~*req.AnswerTime"},
{"tag": "EndTime", "path": "*exp.EndTime", "type": "*variable", "value":"~*req.EndTime"},
{"tag": "DisconnectCause", "path": "*exp.DisconnectCause", "type": "*variable", "value":"~*req.DisconnectCause"},
{"tag": "DialogId", "path": "*exp.DialogId", "type": "*variable", "value":"~*req.DialogId"},
],
},
],
},

View File

@@ -480,7 +480,64 @@
{"tag": "ExtraInfo1", "path": "*cgreq.ExtraInfo1", "type": "*constant", "value": "ExtraInfo1"},
{"tag": "ExtraInfo2", "path": "*cgreq.ExtraInfo2", "type": "*constant", "value": "ExtraInfo2"},
],
}
},
{
"id": "PartialWithMultipleMethods",
"enabled": true,
"run_delay": "-1",
"type": "*file_csv",
"opts": {
"csvFieldSeparator":",",
"partialcsvFieldSeparator": ",",
"partialCacheAction": "*dump_to_file",
"partialOrderField": "~*opts.orderID",
"partialPath": "/tmp/flatstoreMMErs/out",
"csvLazyQuotes": true,
},
"source_path": "/tmp/flatstoreMMErs/in",
"processed_path": "/tmp/flatstoreMMErs/out",
"flags": ["*cdrs"],
"fields":[
{"tag": "OriginHost", "path": "*cgreq.OriginHost", "type": "*constant","value":"flatStoreACK", "mandatory": true},
{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable","value":"~*req.4;~*req.2;~*req.3", "mandatory": true},
{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*postpaid", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
{"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.8", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
{"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.8", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
{"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.14", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.7", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.7", "mandatory": true,"filters": ["*string:~*req.1:ACK"]},
{"tag": "EndTime", "path": "*cgreq.EndTime", "type": "*variable","value": "~*req.7", "mandatory": true, "filters": ["*string:~*req.1:BYE"]},
{"tag": "DisconnectCause", "path": "*cgreq.DisconnectCause", "type": "*variable", "value": "~*req.5; ;~*req.6", "mandatory": true},
{"tag": "DialogId", "path": "*cgreq.DialogId", "type": "*variable", "value": "~*req.12"},
{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "true", "filters": ["*notstring:~*req.1:CANCEL"]},
{"tag": "Invite", "path": "*opts.invite", "type": "*constant", "value": "true", "filters":["*string:~*req.1:INVITE"]},
{"tag": "Bye", "path": "*opts.bye", "type": "*constant", "value": "true", "filters":["*string:~*req.1:BYE"]},
{"tag": "Ack", "path": "*opts.ack", "type": "*constant", "value": "true", "filters":["*string:~*req.1:ACK"]},
{"tag": "Order", "path": "*opts.orderID", "type": "*variable", "value": "~*req.1"},
{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "false", "filters": ["*string:~*req.1:CANCEL"]},
{"tag": "Usage", "path": "*cgreq.Usage", "type": "*constant","value": "0", "mandatory": true, "filters": ["*string:~*req.1:CANCEL"]},
],
"partial_commit_fields": [
{"tag": "Usage", "path": "*cgreq.Usage", "type": "*usage_difference","value": "~*req.EndTime;~*req.AnswerTime", "mandatory": true, "filters": ["*exists:~*opts.invite:","*exists:~*opts.bye:","*exists:~*opts.ack:"]},
{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "false","filters": ["*exists:~*opts.invite:","*exists:~*opts.bye:","*exists:~*opts.ack:"]},
],
"cache_dump_fields": [
{"tag": "OriginHost", "path": "*exp.OriginHost", "type": "*variable", "value":"~*req.OriginHost"},
{"tag": "OriginID", "path": "*exp.OriginID", "type": "*variable", "value":"~*req.OriginID"},
{"tag": "RequestType", "path": "*exp.RequestType", "type": "*variable", "value":"~*req.RequestType"},
{"tag": "Account", "path": "*exp.Account", "type": "*variable", "value":"~*req.Account"},
{"tag": "Subject", "path": "*exp.Subject", "type": "*variable", "value":"~*req.Subject"},
{"tag": "Destination", "path": "*exp.Destination", "type": "*variable", "value":"~*req.Destination"},
{"tag": "SetupTime", "path": "*exp.SetupTime", "type": "*variable", "value":"~*req.SetupTime"},
{"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value":"~*req.AnswerTime"},
{"tag": "EndTime", "path": "*exp.EndTime", "type": "*variable", "value":"~*req.EndTime"},
{"tag": "DisconnectCause", "path": "*exp.DisconnectCause", "type": "*variable", "value":"~*req.DisconnectCause"},
{"tag": "DialogId", "path": "*exp.DialogId", "type": "*variable", "value":"~*req.DialogId"},
],
},
],
},

View File

@@ -477,7 +477,64 @@
{"tag": "ExtraInfo1", "path": "*cgreq.ExtraInfo1", "type": "*constant", "value": "ExtraInfo1"},
{"tag": "ExtraInfo2", "path": "*cgreq.ExtraInfo2", "type": "*constant", "value": "ExtraInfo2"},
],
}
},
{
"id": "PartialWithMultipleMethods",
"enabled": true,
"run_delay": "-1",
"type": "*file_csv",
"opts": {
"csvFieldSeparator":",",
"partialcsvFieldSeparator": ",",
"partialCacheAction": "*dump_to_file",
"partialOrderField": "~*opts.orderID",
"partialPath": "/tmp/flatstoreMMErs/out",
"csvLazyQuotes": true,
},
"source_path": "/tmp/flatstoreMMErs/in",
"processed_path": "/tmp/flatstoreMMErs/out",
"flags": ["*cdrs"],
"fields":[
{"tag": "OriginHost", "path": "*cgreq.OriginHost", "type": "*constant","value":"flatStoreACK", "mandatory": true},
{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable","value":"~*req.4;~*req.2;~*req.3", "mandatory": true},
{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*postpaid", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
{"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.8", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
{"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.8", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
{"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.14", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.7", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.7", "mandatory": true,"filters": ["*string:~*req.1:ACK"]},
{"tag": "EndTime", "path": "*cgreq.EndTime", "type": "*variable","value": "~*req.7", "mandatory": true, "filters": ["*string:~*req.1:BYE"]},
{"tag": "DisconnectCause", "path": "*cgreq.DisconnectCause", "type": "*variable", "value": "~*req.5; ;~*req.6", "mandatory": true},
{"tag": "DialogId", "path": "*cgreq.DialogId", "type": "*variable", "value": "~*req.12"},
{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "true", "filters": ["*notstring:~*req.1:CANCEL"]},
{"tag": "Invite", "path": "*opts.invite", "type": "*constant", "value": "true", "filters":["*string:~*req.1:INVITE"]},
{"tag": "Bye", "path": "*opts.bye", "type": "*constant", "value": "true", "filters":["*string:~*req.1:BYE"]},
{"tag": "Ack", "path": "*opts.ack", "type": "*constant", "value": "true", "filters":["*string:~*req.1:ACK"]},
{"tag": "Order", "path": "*opts.orderID", "type": "*variable", "value": "~*req.1"},
{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "false", "filters": ["*string:~*req.1:CANCEL"]},
{"tag": "Usage", "path": "*cgreq.Usage", "type": "*constant","value": "0", "mandatory": true, "filters": ["*string:~*req.1:CANCEL"]},
],
"partial_commit_fields": [
{"tag": "Usage", "path": "*cgreq.Usage", "type": "*usage_difference","value": "~*req.EndTime;~*req.AnswerTime", "mandatory": true, "filters": ["*exists:~*opts.invite:","*exists:~*opts.bye:","*exists:~*opts.ack:"]},
{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "false","filters": ["*exists:~*opts.invite:","*exists:~*opts.bye:","*exists:~*opts.ack:"]},
],
"cache_dump_fields": [
{"tag": "OriginHost", "path": "*exp.OriginHost", "type": "*variable", "value":"~*req.OriginHost"},
{"tag": "OriginID", "path": "*exp.OriginID", "type": "*variable", "value":"~*req.OriginID"},
{"tag": "RequestType", "path": "*exp.RequestType", "type": "*variable", "value":"~*req.RequestType"},
{"tag": "Account", "path": "*exp.Account", "type": "*variable", "value":"~*req.Account"},
{"tag": "Subject", "path": "*exp.Subject", "type": "*variable", "value":"~*req.Subject"},
{"tag": "Destination", "path": "*exp.Destination", "type": "*variable", "value":"~*req.Destination"},
{"tag": "SetupTime", "path": "*exp.SetupTime", "type": "*variable", "value":"~*req.SetupTime"},
{"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value":"~*req.AnswerTime"},
{"tag": "EndTime", "path": "*exp.EndTime", "type": "*variable", "value":"~*req.EndTime"},
{"tag": "DisconnectCause", "path": "*exp.DisconnectCause", "type": "*variable", "value":"~*req.DisconnectCause"},
{"tag": "DialogId", "path": "*exp.DialogId", "type": "*variable", "value":"~*req.DialogId"},
],
},
],
},

View File

@@ -57,7 +57,8 @@ func testCreateDirs(t *testing.T) {
"/tmp/partErs1/in", "/tmp/partErs1/out", "/tmp/partErs2/in", "/tmp/partErs2/out",
"/tmp/flatstoreErs/in", "/tmp/flatstoreErs/out", "/tmp/ErsJSON/in", "/tmp/ErsJSON/out",
"/tmp/readerWithTemplate/in", "/tmp/readerWithTemplate/out",
"/tmp/flatstoreACKErs/in", "/tmp/flatstoreACKErs/out"} {
"/tmp/flatstoreACKErs/in", "/tmp/flatstoreACKErs/out",
"/tmp/flatstoreMMErs/in", "/tmp/flatstoreMMErs/out"} {
if err := os.RemoveAll(dir); err != nil {
t.Fatal("Error removing folder: ", dir, err)
}