mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-14 20:59:53 +05:00
Added tests for flatstore with ACK and LazyQuotes
This commit is contained in:
committed by
Dan Christian Bogos
parent
c6ee38990a
commit
344aec93e8
@@ -390,6 +390,63 @@
|
||||
{"tag": "DialogId", "path": "*exp.DialogId", "type": "*variable", "value":"~*req.DialogId"},
|
||||
],
|
||||
|
||||
},
|
||||
{
|
||||
"id": "FlatstoreOsipsWithACK",
|
||||
"enabled": true,
|
||||
"run_delay": "-1",
|
||||
"type": "*file_csv",
|
||||
"opts": {
|
||||
"csvFieldSeparator":"|",
|
||||
"partialcsvFieldSeparator": "|",
|
||||
"partialCacheAction": "*dump_to_file",
|
||||
"partialOrderField": "~*opts.order",
|
||||
"partialPath": "/tmp/flatstoreACKErs/out",
|
||||
"csvLazyQuotes": true,
|
||||
},
|
||||
"source_path": "/tmp/flatstoreACKErs/in",
|
||||
"processed_path": "/tmp/flatstoreACKErs/out",
|
||||
"flags": ["*cdrs"],
|
||||
"fields":[
|
||||
{"tag": "OriginHost", "path": "*cgreq.OriginHost", "type": "*constant","value":"flatStoreACK", "mandatory": true},
|
||||
{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable","value":"~*req.3;~*req.1;~*req.2", "mandatory": true},
|
||||
{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*variable", "value": "~*req.7", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
|
||||
{"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.8", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
|
||||
{"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.8", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
|
||||
{"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.9", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
|
||||
{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.6", "mandatory": true,"filters": ["*string:~*req.0:ACK"]},
|
||||
{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.6", "mandatory": true,"filters": ["*string:~*req.0:ACK"]},
|
||||
{"tag": "EndTime", "path": "*cgreq.EndTime", "type": "*variable","value": "~*req.6", "mandatory": true, "filters": ["*string:~*req.0:BYE"]},
|
||||
{"tag": "DisconnectCause", "path": "*cgreq.DisconnectCause", "type": "*variable", "value": "~*req.4; ;~*req.5", "mandatory": true},
|
||||
{"tag": "DialogId", "path": "*cgreq.DialogId", "type": "*variable", "value": "~*req.11"},
|
||||
{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "true"},
|
||||
{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "false","filters": ["*prefix:~*vars.FileName:missed_calls"]},
|
||||
{"tag": "Invite", "path": "*opts.invite", "type": "*constant", "value": "true", "filters":["*string:~*req.0:INVITE"]},
|
||||
{"tag": "Bye", "path": "*opts.bye", "type": "*constant", "value": "true", "filters":["*string:~*req.0:BYE"]},
|
||||
{"tag": "Ack", "path": "*opts.ack", "type": "*constant", "value": "true", "filters":["*string:~*req.0:ACK"]},
|
||||
{"tag": "Order", "path": "*opts.order", "type": "*constant", "value": "0", "filters":["*string:~*req.0:INVITE"]},
|
||||
{"tag": "Order", "path": "*opts.order", "type": "*constant", "value": "1", "filters":["*string:~*req.0:ACK"]},
|
||||
{"tag": "Order", "path": "*opts.order", "type": "*constant", "value": "2", "filters":["*string:~*req.0:BYE"]},
|
||||
],
|
||||
"partial_commit_fields": [
|
||||
{"tag": "Usage", "path": "*cgreq.Usage", "type": "*constant","value": "0", "mandatory": true, "filters": ["*prefix:~*vars.FileName:missed_calls"]},
|
||||
{"tag": "Usage", "path": "*cgreq.Usage", "type": "*usage_difference","value": "~*req.EndTime;~*req.AnswerTime", "mandatory": true, "filters": ["*notprefix:~*vars.FileName:missed_calls","*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"},
|
||||
],
|
||||
|
||||
},
|
||||
{
|
||||
"id": "JSONReader",
|
||||
|
||||
@@ -392,6 +392,63 @@
|
||||
{"tag": "DialogId", "path": "*exp.DialogId", "type": "*variable", "value":"~*req.DialogId"},
|
||||
],
|
||||
|
||||
},
|
||||
{
|
||||
"id": "FlatstoreOsipsWithACK",
|
||||
"enabled": true,
|
||||
"run_delay": "-1",
|
||||
"type": "*file_csv",
|
||||
"opts": {
|
||||
"csvFieldSeparator":"|",
|
||||
"partialcsvFieldSeparator": "|",
|
||||
"partialCacheAction": "*dump_to_file",
|
||||
"partialOrderField": "~*opts.order",
|
||||
"partialPath": "/tmp/flatstoreACKErs/out",
|
||||
"csvLazyQuotes": true,
|
||||
},
|
||||
"source_path": "/tmp/flatstoreACKErs/in",
|
||||
"processed_path": "/tmp/flatstoreACKErs/out",
|
||||
"flags": ["*cdrs"],
|
||||
"fields":[
|
||||
{"tag": "OriginHost", "path": "*cgreq.OriginHost", "type": "*constant","value":"flatStoreACK", "mandatory": true},
|
||||
{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable","value":"~*req.3;~*req.1;~*req.2", "mandatory": true},
|
||||
{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*variable", "value": "~*req.7", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
|
||||
{"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.8", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
|
||||
{"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.8", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
|
||||
{"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.9", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
|
||||
{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.6", "mandatory": true,"filters": ["*string:~*req.0:ACK"]},
|
||||
{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.6", "mandatory": true,"filters": ["*string:~*req.0:ACK"]},
|
||||
{"tag": "EndTime", "path": "*cgreq.EndTime", "type": "*variable","value": "~*req.6", "mandatory": true, "filters": ["*string:~*req.0:BYE"]},
|
||||
{"tag": "DisconnectCause", "path": "*cgreq.DisconnectCause", "type": "*variable", "value": "~*req.4; ;~*req.5", "mandatory": true},
|
||||
{"tag": "DialogId", "path": "*cgreq.DialogId", "type": "*variable", "value": "~*req.11"},
|
||||
{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "true"},
|
||||
{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "false","filters": ["*prefix:~*vars.FileName:missed_calls"]},
|
||||
{"tag": "Invite", "path": "*opts.invite", "type": "*constant", "value": "true", "filters":["*string:~*req.0:INVITE"]},
|
||||
{"tag": "Bye", "path": "*opts.bye", "type": "*constant", "value": "true", "filters":["*string:~*req.0:BYE"]},
|
||||
{"tag": "Ack", "path": "*opts.ack", "type": "*constant", "value": "true", "filters":["*string:~*req.0:ACK"]},
|
||||
{"tag": "Order", "path": "*opts.order", "type": "*constant", "value": "0", "filters":["*string:~*req.0:INVITE"]},
|
||||
{"tag": "Order", "path": "*opts.order", "type": "*constant", "value": "1", "filters":["*string:~*req.0:ACK"]},
|
||||
{"tag": "Order", "path": "*opts.order", "type": "*constant", "value": "2", "filters":["*string:~*req.0:BYE"]},
|
||||
],
|
||||
"partial_commit_fields": [
|
||||
{"tag": "Usage", "path": "*cgreq.Usage", "type": "*constant","value": "0", "mandatory": true, "filters": ["*prefix:~*vars.FileName:missed_calls"]},
|
||||
{"tag": "Usage", "path": "*cgreq.Usage", "type": "*usage_difference","value": "~*req.EndTime;~*req.AnswerTime", "mandatory": true, "filters": ["*notprefix:~*vars.FileName:missed_calls","*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"},
|
||||
],
|
||||
|
||||
},
|
||||
{
|
||||
"id": "JSONReader",
|
||||
|
||||
@@ -389,6 +389,63 @@
|
||||
{"tag": "DialogId", "path": "*exp.DialogId", "type": "*variable", "value":"~*req.DialogId"},
|
||||
],
|
||||
|
||||
},
|
||||
{
|
||||
"id": "FlatstoreOsipsWithACK",
|
||||
"enabled": true,
|
||||
"run_delay": "-1",
|
||||
"type": "*file_csv",
|
||||
"opts": {
|
||||
"csvFieldSeparator":"|",
|
||||
"partialcsvFieldSeparator": "|",
|
||||
"partialCacheAction": "*dump_to_file",
|
||||
"partialOrderField": "~*opts.order",
|
||||
"partialPath": "/tmp/flatstoreACKErs/out",
|
||||
"csvLazyQuotes": true,
|
||||
},
|
||||
"source_path": "/tmp/flatstoreACKErs/in",
|
||||
"processed_path": "/tmp/flatstoreACKErs/out",
|
||||
"flags": ["*cdrs"],
|
||||
"fields":[
|
||||
{"tag": "OriginHost", "path": "*cgreq.OriginHost", "type": "*constant","value":"flatStoreACK", "mandatory": true},
|
||||
{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable","value":"~*req.3;~*req.1;~*req.2", "mandatory": true},
|
||||
{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*variable", "value": "~*req.7", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
|
||||
{"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.8", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
|
||||
{"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.8", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
|
||||
{"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.9", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
|
||||
{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.6", "mandatory": true,"filters": ["*string:~*req.0:ACK"]},
|
||||
{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.6", "mandatory": true,"filters": ["*string:~*req.0:ACK"]},
|
||||
{"tag": "EndTime", "path": "*cgreq.EndTime", "type": "*variable","value": "~*req.6", "mandatory": true, "filters": ["*string:~*req.0:BYE"]},
|
||||
{"tag": "DisconnectCause", "path": "*cgreq.DisconnectCause", "type": "*variable", "value": "~*req.4; ;~*req.5", "mandatory": true},
|
||||
{"tag": "DialogId", "path": "*cgreq.DialogId", "type": "*variable", "value": "~*req.11"},
|
||||
{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "true"},
|
||||
{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "false","filters": ["*prefix:~*vars.FileName:missed_calls"]},
|
||||
{"tag": "Invite", "path": "*opts.invite", "type": "*constant", "value": "true", "filters":["*string:~*req.0:INVITE"]},
|
||||
{"tag": "Bye", "path": "*opts.bye", "type": "*constant", "value": "true", "filters":["*string:~*req.0:BYE"]},
|
||||
{"tag": "Ack", "path": "*opts.ack", "type": "*constant", "value": "true", "filters":["*string:~*req.0:ACK"]},
|
||||
{"tag": "Order", "path": "*opts.order", "type": "*constant", "value": "0", "filters":["*string:~*req.0:INVITE"]},
|
||||
{"tag": "Order", "path": "*opts.order", "type": "*constant", "value": "1", "filters":["*string:~*req.0:ACK"]},
|
||||
{"tag": "Order", "path": "*opts.order", "type": "*constant", "value": "2", "filters":["*string:~*req.0:BYE"]},
|
||||
],
|
||||
"partial_commit_fields": [
|
||||
{"tag": "Usage", "path": "*cgreq.Usage", "type": "*constant","value": "0", "mandatory": true, "filters": ["*prefix:~*vars.FileName:missed_calls"]},
|
||||
{"tag": "Usage", "path": "*cgreq.Usage", "type": "*usage_difference","value": "~*req.EndTime;~*req.AnswerTime", "mandatory": true, "filters": ["*notprefix:~*vars.FileName:missed_calls","*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"},
|
||||
],
|
||||
|
||||
},
|
||||
{
|
||||
"id": "JSONReader",
|
||||
|
||||
@@ -386,6 +386,63 @@
|
||||
{"tag": "DialogId", "path": "*exp.DialogId", "type": "*variable", "value":"~*req.DialogId"},
|
||||
],
|
||||
|
||||
},
|
||||
{
|
||||
"id": "FlatstoreOsipsWithACK",
|
||||
"enabled": true,
|
||||
"run_delay": "-1",
|
||||
"type": "*file_csv",
|
||||
"opts": {
|
||||
"csvFieldSeparator":"|",
|
||||
"partialcsvFieldSeparator": "|",
|
||||
"partialCacheAction": "*dump_to_file",
|
||||
"partialOrderField": "~*opts.order",
|
||||
"partialPath": "/tmp/flatstoreACKErs/out",
|
||||
"csvLazyQuotes": true,
|
||||
},
|
||||
"source_path": "/tmp/flatstoreACKErs/in",
|
||||
"processed_path": "/tmp/flatstoreACKErs/out",
|
||||
"flags": ["*cdrs"],
|
||||
"fields":[
|
||||
{"tag": "OriginHost", "path": "*cgreq.OriginHost", "type": "*constant","value":"flatStoreACK", "mandatory": true},
|
||||
{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable","value":"~*req.3;~*req.1;~*req.2", "mandatory": true},
|
||||
{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*variable", "value": "~*req.7", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
|
||||
{"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.8", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
|
||||
{"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.8", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
|
||||
{"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.9", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
|
||||
{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.6", "mandatory": true,"filters": ["*string:~*req.0:ACK"]},
|
||||
{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.6", "mandatory": true,"filters": ["*string:~*req.0:ACK"]},
|
||||
{"tag": "EndTime", "path": "*cgreq.EndTime", "type": "*variable","value": "~*req.6", "mandatory": true, "filters": ["*string:~*req.0:BYE"]},
|
||||
{"tag": "DisconnectCause", "path": "*cgreq.DisconnectCause", "type": "*variable", "value": "~*req.4; ;~*req.5", "mandatory": true},
|
||||
{"tag": "DialogId", "path": "*cgreq.DialogId", "type": "*variable", "value": "~*req.11"},
|
||||
{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "true"},
|
||||
{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "false","filters": ["*prefix:~*vars.FileName:missed_calls"]},
|
||||
{"tag": "Invite", "path": "*opts.invite", "type": "*constant", "value": "true", "filters":["*string:~*req.0:INVITE"]},
|
||||
{"tag": "Bye", "path": "*opts.bye", "type": "*constant", "value": "true", "filters":["*string:~*req.0:BYE"]},
|
||||
{"tag": "Ack", "path": "*opts.ack", "type": "*constant", "value": "true", "filters":["*string:~*req.0:ACK"]},
|
||||
{"tag": "Order", "path": "*opts.order", "type": "*constant", "value": "0", "filters":["*string:~*req.0:INVITE"]},
|
||||
{"tag": "Order", "path": "*opts.order", "type": "*constant", "value": "1", "filters":["*string:~*req.0:ACK"]},
|
||||
{"tag": "Order", "path": "*opts.order", "type": "*constant", "value": "2", "filters":["*string:~*req.0:BYE"]},
|
||||
],
|
||||
"partial_commit_fields": [
|
||||
{"tag": "Usage", "path": "*cgreq.Usage", "type": "*constant","value": "0", "mandatory": true, "filters": ["*prefix:~*vars.FileName:missed_calls"]},
|
||||
{"tag": "Usage", "path": "*cgreq.Usage", "type": "*usage_difference","value": "~*req.EndTime;~*req.AnswerTime", "mandatory": true, "filters": ["*notprefix:~*vars.FileName:missed_calls","*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"},
|
||||
],
|
||||
|
||||
},
|
||||
{
|
||||
"id": "JSONReader",
|
||||
|
||||
@@ -48,16 +48,29 @@ BYE|f9d3d5c3|c863a6e3|214d8f52b566e33a9349b184e72a4cca@0:0:0:0:0:0:0:0|200|OK|14
|
||||
INVITE|36e39a5|42d996f9|3a63321dd3b325eec688dc2aefb6ac2d@0:0:0:0:0:0:0:0|200|OK|1436454657|*prepaid|1001|1002||2407:1884881533
|
||||
BYE|36e39a5|42d996f9|3a63321dd3b325eec688dc2aefb6ac2d@0:0:0:0:0:0:0:0|200|OK|1436454661|||||2407:1884881533
|
||||
INVITE|3111f3c9|49ca4c42|a58ebaae40d08d6757d8424fb09c4c54@0:0:0:0:0:0:0:0|200|OK|1436454690|*prepaid|1001|1002||3099:1909036290
|
||||
BYE|3111f3c9|49ca4c42|a58ebaae40d08d6757d8424fb09c4c54@0:0:0:0:0:0:0:0|200|OK|1436454692|||||3099:1909036290` // 4
|
||||
BYE|3111f3c9|49ca4c42|a58ebaae40d08d6757d8424fb09c4c54@0:0:0:0:0:0:0:0|200|OK|1436454692|||||3099:1909036290`
|
||||
|
||||
fullMissed = `INVITE|ef6c6256|da501581|0bfdd176d1b93e7df3de5c6f4873ee04@0:0:0:0:0:0:0:0|487|Request Terminated|1436454643|*prepaid|1001|1002||1224:339382783
|
||||
INVITE|7905e511||81880da80a94bda81b425b09009e055c@0:0:0:0:0:0:0:0|404|Not Found|1436454668|*prepaid|1001|1002||1980:1216490844
|
||||
INVITE|324cb497|d4af7023|8deaadf2ae9a17809a391f05af31afb0@0:0:0:0:0:0:0:0|486|Busy here|1436454687|*postpaid|1002|1001||474:130115066` // 3
|
||||
INVITE|324cb497|d4af7023|8deaadf2ae9a17809a391f05af31afb0@0:0:0:0:0:0:0:0|486|Busy here|1436454687|*postpaid|1002|1001||474:130115066`
|
||||
|
||||
part1 = `BYE|f9d3d5c3|c863a6e3|214d8f52b566e33a9349b184e72a4ccb@0:0:0:0:0:0:0:0|200|OK|1436454651|||||1877:893549742` //1
|
||||
part1 = `BYE|f9d3d5c3|c863a6e3|214d8f52b566e33a9349b184e72a4ccb@0:0:0:0:0:0:0:0|200|OK|1436454651|||||1877:893549742`
|
||||
|
||||
part2 = `INVITE|f9d3d5c3|c863a6e3|214d8f52b566e33a9349b184e72a4ccb@0:0:0:0:0:0:0:0|200|OK|1436454647|*postpaid|1002|1003||1877:893549742
|
||||
INVITE|2daec40c|548625ac|dd0c4c617a9919d29a6175cdff223a9p@0:0:0:0:0:0:0:0|200|OK|1436454408|*prepaid|1001|1002||3401:2069362475` //1
|
||||
INVITE|2daec40c|548625ac|dd0c4c617a9919d29a6175cdff223a9p@0:0:0:0:0:0:0:0|200|OK|1436454408|*prepaid|1001|1002||3401:2069362475`
|
||||
|
||||
ackSuccessfull = `INVITE|2daec40c|548625ac|dd0c4c617a9919d29a6175cdff223a9e@0:0:0:0:0:0:0:0|200|OK||*prepaid|1001|1002||3401:2069362475|flatstore"1.0
|
||||
ACK|2daec40c|548625ac|dd0c4c617a9919d29a6175cdff223a9e@0:0:0:0:0:0:0:0|200|OK|1436454408|*prepaid|1001|1002||3401:2069362475|flatstore"1.0
|
||||
BYE|2daec40c|548625ac|dd0c4c617a9919d29a6175cdff223a9e@0:0:0:0:0:0:0:0|200|OK|1436454410|||||3401:2069362475|flatstore"1.0
|
||||
INVITE|f9d3d5c3|c863a6e3|214d8f52b566e33a9349b184e72a4cca@0:0:0:0:0:0:0:0|200|OK||*postpaid|1002|1001||1877:893549741|flatstore"1.0
|
||||
ACK|f9d3d5c3|c863a6e3|214d8f52b566e33a9349b184e72a4cca@0:0:0:0:0:0:0:0|200|OK|1436454647|*postpaid|1002|1001||1877:893549741|flatstore"1.0
|
||||
BYE|f9d3d5c3|c863a6e3|214d8f52b566e33a9349b184e72a4cca@0:0:0:0:0:0:0:0|200|OK|1436454651|||||1877:893549741|flatstore"1.0
|
||||
INVITE|36e39a5|42d996f9|3a63321dd3b325eec688dc2aefb6ac2d@0:0:0:0:0:0:0:0|200|OK||*prepaid|1001|1002||2407:1884881533|flatstore"1.0
|
||||
ACK|36e39a5|42d996f9|3a63321dd3b325eec688dc2aefb6ac2d@0:0:0:0:0:0:0:0|200|OK|1436454657|*prepaid|1001|1002||2407:1884881533|flatstore"1.0
|
||||
BYE|36e39a5|42d996f9|3a63321dd3b325eec688dc2aefb6ac2d@0:0:0:0:0:0:0:0|200|OK|1436454661|||||2407:1884881533|flatstore"1.0
|
||||
INVITE|3111f3c9|49ca4c42|a58ebaae40d08d6757d8424fb09c4c54@0:0:0:0:0:0:0:0|200|OK||*prepaid|1001|1002||3099:1909036290|flatstore"1.0
|
||||
ACK|3111f3c9|49ca4c42|a58ebaae40d08d6757d8424fb09c4c54@0:0:0:0:0:0:0:0|200|OK|1436454690|*prepaid|1001|1002||3099:1909036290|flatstore"1.0
|
||||
BYE|3111f3c9|49ca4c42|a58ebaae40d08d6757d8424fb09c4c54@0:0:0:0:0:0:0:0|200|OK|1436454692|||||3099:1909036290|flatstore"1.0`
|
||||
|
||||
flatstoreTests = []func(t *testing.T){
|
||||
testCreateDirs,
|
||||
@@ -69,6 +82,8 @@ INVITE|2daec40c|548625ac|dd0c4c617a9919d29a6175cdff223a9p@0:0:0:0:0:0:0:0|200|OK
|
||||
testFlatstoreITLoadTPFromFolder,
|
||||
testFlatstoreITHandleCdr1File,
|
||||
testFlatstoreITAnalyseCDRs,
|
||||
testFlatstoreITHandleCdr2File,
|
||||
testFlatstoreITAnalyseCDRs2,
|
||||
testCleanupFiles,
|
||||
testFlatstoreITKillEngine,
|
||||
}
|
||||
@@ -216,6 +231,43 @@ func testFlatstoreITAnalyseCDRs(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// The default scenario, out of ers defined in .cfg file
|
||||
func testFlatstoreITHandleCdr2File(t *testing.T) {
|
||||
if err := os.WriteFile(path.Join("/tmp", "acc_1.log"), []byte(ackSuccessfull), 0644); err != nil {
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
//Rename(oldpath, newpath string)
|
||||
if err := os.Rename(path.Join("/tmp", "acc_1.log"), path.Join("/tmp/flatstoreACKErs/in", "acc_1.log")); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
time.Sleep(time.Second)
|
||||
// check the files to be processed
|
||||
filesInDir, _ := os.ReadDir("/tmp/flatstoreErs/in")
|
||||
if len(filesInDir) != 0 {
|
||||
fls := make([]string, len(filesInDir))
|
||||
for i, fs := range filesInDir {
|
||||
fls[i] = fs.Name()
|
||||
}
|
||||
t.Errorf("Files in ersInDir: %+v", fls)
|
||||
}
|
||||
filesOutDir, _ := os.ReadDir("/tmp/flatstoreACKErs/out")
|
||||
ids := []string{}
|
||||
for _, fD := range filesOutDir {
|
||||
ids = append(ids, fD.Name())
|
||||
}
|
||||
if len(filesOutDir) != 1 {
|
||||
t.Errorf("Unexpected number of files in output directory: %+v, %q", len(filesOutDir), ids)
|
||||
}
|
||||
}
|
||||
|
||||
func testFlatstoreITAnalyseCDRs2(t *testing.T) {
|
||||
var reply []*engine.ExternalCDR
|
||||
if err := flatstoreRPC.Call(utils.APIerSv2GetCDRs, &utils.RPCCDRsFilter{OriginHosts: []string{"flatStoreACK"}, MinUsage: "1"}, &reply); err != nil {
|
||||
t.Error("Unexpected error: ", err.Error())
|
||||
} else if len(reply) != 4 {
|
||||
t.Error("Unexpected number of CDRs returned: ", len(reply))
|
||||
}
|
||||
}
|
||||
func testFlatstoreITKillEngine(t *testing.T) {
|
||||
if err := engine.KillEngine(*waitRater); err != nil {
|
||||
t.Error(err)
|
||||
|
||||
@@ -56,7 +56,8 @@ func testCreateDirs(t *testing.T) {
|
||||
"/tmp/xmlErs/in", "/tmp/xmlErs/out", "/tmp/fwvErs/in", "/tmp/fwvErs/out",
|
||||
"/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/readerWithTemplate/in", "/tmp/readerWithTemplate/out",
|
||||
"/tmp/flatstoreACKErs/in", "/tmp/flatstoreACKErs/out"} {
|
||||
if err := os.RemoveAll(dir); err != nil {
|
||||
t.Fatal("Error removing folder: ", dir, err)
|
||||
}
|
||||
@@ -71,7 +72,8 @@ func testCleanupFiles(t *testing.T) {
|
||||
"/tmp/ers2", "/tmp/init_session", "/tmp/terminate_session",
|
||||
"/tmp/cdrs", "/tmp/ers_with_filters", "/tmp/xmlErs", "/tmp/fwvErs",
|
||||
"/tmp/partErs1", "/tmp/partErs2", "tmp/flatstoreErs",
|
||||
"/tmp/ErsJSON", "/tmp/readerWithTemplate"} {
|
||||
"/tmp/ErsJSON", "/tmp/readerWithTemplate",
|
||||
"/tmp/flatstoreACKErs"} {
|
||||
if err := os.RemoveAll(dir); err != nil {
|
||||
t.Fatal("Error removing folder: ", dir, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user