From 749d2779594eb56632f8e7d5800d77c7646da557 Mon Sep 17 00:00:00 2001 From: DanB Date: Sat, 29 Sep 2018 20:45:14 +0200 Subject: [PATCH] Revised diameter templates for integration tests --- data/conf/samples/dmtagent/cgrates.json | 12 -- data/conf/samples/dmtagent/data.json | 183 +++++++++--------- .../samples/dmtagent/diameter_processors.json | 99 ++++------ data/conf/samples/dmtagent/simpa.json | 33 ++-- data/conf/samples/dmtagent/voice.json | 128 ++++++------ 5 files changed, 210 insertions(+), 245 deletions(-) diff --git a/data/conf/samples/dmtagent/cgrates.json b/data/conf/samples/dmtagent/cgrates.json index 7c3ff1007..510c20409 100644 --- a/data/conf/samples/dmtagent/cgrates.json +++ b/data/conf/samples/dmtagent/cgrates.json @@ -30,18 +30,6 @@ "rals": { "enabled": true, - "cdrstats_conns": [ - {"address": "*internal"} - ], - "pubsubs_conns": [ - {"address": "*internal"} - ], - "users_conns": [ - {"address": "*internal"} - ], - "aliases_conns": [ - {"address": "*internal"} - ], }, "scheduler": { diff --git a/data/conf/samples/dmtagent/data.json b/data/conf/samples/dmtagent/data.json index 8cfc07a9b..6e7da7f2e 100644 --- a/data/conf/samples/dmtagent/data.json +++ b/data/conf/samples/dmtagent/data.json @@ -3,117 +3,120 @@ "diameter_agent": { "request_processors": [ + { - "id": "data_init", // formal identifier of this processor - "dry_run": false, // do not send the events to SMG, just log them - "request_filter": "Service-Context-Id(^gprs);CC-Request-Type(1)", // filter requests processed by this processor - "continue_on_success": false, // continue to the next template if executed - "templates":{ - "*cca": [ // 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": "^*data", "mandatory": true}, - {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "Session-Id", "mandatory": true}, - {"tag": "RequestType", "field_id": "RequestType", "type": "*composed", "value": "^*prepaid", "mandatory": true}, - {"tag": "Direction", "field_id": "Direction", "type": "*composed", "value": "^*out", "mandatory": true}, - {"tag": "Tenant", "field_id": "Tenant", "type": "*composed", "value": "^cgrates.org", "mandatory": true}, - {"tag": "Category", "field_id": "Category", "type": "*composed", "value": "^generic", "mandatory": true}, - {"tag": "Account", "field_id": "Account", "type": "*grouped", "value": "Subscription-Id>Subscription-Id-Data", "field_filter":"Subscription-Id>Subscription-Id-Type(0)", "mandatory": true}, - {"tag": "Destination", "field_id": "Destination", "type": "*constant", "value": "data"}, - {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, - {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, - {"tag": "Usage", "field_id": "Usage", "type": "*constant", "value": "2048"}, - ] - } - "ccr_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": "^*data", "mandatory": true}, - {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "Session-Id", "mandatory": true}, - {"tag": "RequestType", "field_id": "RequestType", "type": "*composed", "value": "^*prepaid", "mandatory": true}, - {"tag": "Direction", "field_id": "Direction", "type": "*composed", "value": "^*out", "mandatory": true}, - {"tag": "Tenant", "field_id": "Tenant", "type": "*composed", "value": "^cgrates.org", "mandatory": true}, - {"tag": "Category", "field_id": "Category", "type": "*composed", "value": "^generic", "mandatory": true}, - {"tag": "Account", "field_id": "Account", "type": "*grouped", "value": "Subscription-Id>Subscription-Id-Data", "field_filter":"Subscription-Id>Subscription-Id-Type(0)", "mandatory": true}, + "id": "data_init", + "filters": ["*string:*vars.cmd:*ccr", "*string:*req.CC-Request-Type:1", "*prefix:*req.Service-Context-Id:gprs"], + "flags": ["*initiate", "*accounts"], + "request_fields":[ + {"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*data"}, + {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", + "value": "~*req.Session-Id", "mandatory": true}, + {"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"}, + {"tag": "Category", "field_id": "Category", "type": "*constant", "value": "generic"}, + {"tag": "Account", "field_id": "Account", "type": "*composed", + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(1)]", "mandatory": true}, {"tag": "Destination", "field_id": "Destination", "type": "*constant", "value": "data"}, - {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, - {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, + {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", + "value": "~*req.Event-Timestamp", "mandatory": true}, + {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", + "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "Usage", "field_id": "Usage", "type": "*constant", "value": "2048"}, ], - "cca_fields": [ - {"tag": "ResultCode", "field_filter": "*cgrReply>MaxUsage(^0$)", - "field_id": "Result-Code", "type": "*constant", "value": "4010"}, + "reply_fields": [ + {"tag": "CCATemplate", "type": "*template", "value": "*cca"}, + {"tag": "ResultCode", "filters": ["*string:*cgrep.MaxUsage:0"], + "field_id": "Result-Code", "type": "*constant", "value": "4010", "blocker": true}, ], }, + { - "id": "data_update_grp1", // formal identifier of this processor - "dry_run": false, // do not send the events to SMG, just log them - "request_filter": "Service-Context-Id(^gprs);CC-Request-Type(2);Multiple-Services-Credit-Control>Rating-Group(1)", // filter requests processed by this processor - "continue_on_success": true, // continue to the next template if executed - "ccr_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": "^*data", "mandatory": true}, - {"tag": "InitialOriginID", "field_id": "InitialOriginID", "type": "*composed", "value": "Session-Id", "mandatory": true}, - {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "Session-Id", "mandatory": true}, - {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "^_grp1", "append": true}, - {"tag": "RequestType", "field_id": "RequestType", "type": "*composed", "value": "^*prepaid", "mandatory": true}, - {"tag": "Direction", "field_id": "Direction", "type": "*composed", "value": "^*out", "mandatory": true}, - {"tag": "Tenant", "field_id": "Tenant", "type": "*composed", "value": "^cgrates.org", "mandatory": true}, - {"tag": "Category", "field_id": "Category", "type": "*composed", "value": "^generic", "mandatory": true}, - {"tag": "Account", "field_id": "Account", "type": "*grouped", "value": "Subscription-Id>Subscription-Id-Data", "field_filter":"Subscription-Id>Subscription-Id-Type(0)", "mandatory": true}, + "id": "data_update_grp1", + "filters": ["*string:*vars.cmd:*ccr", "*string:*req.CC-Request-Type:2", + "*string:*req.Multiple-Services-Credit-Control.Rating-Group:1", "*prefix:*req.Service-Context-Id:gprs"], + "flags": ["*update", "*accounts"], + "continue_on_success": true, + "request_fields":[ + {"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*data"}, + {"tag": "InitialOriginID", "field_id": "InitialOriginID", "type": "*composed", + "value": "~*req.Session-Id", "mandatory": true}, + {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", + "value": "~*req.Session-Id", "mandatory": true}, + {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "_grp1"}, + {"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"}, + {"tag": "Category", "field_id": "Category", "type": "*contant", "value": "generic"}, + {"tag": "Account", "field_id": "Account", "type": "*composed", + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, {"tag": "Destination", "field_id": "Destination", "type": "*constant", "value": "data"}, - {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, - {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, + {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", + "value": "~*req.Event-Timestamp", "mandatory": true}, + {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", + "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "Usage", "field_id": "Usage", "type": "*constant", "value": "2048"}, - {"tag": "LastUsed", "field_id": "LastUsed", "field_filter":"Multiple-Services-Credit-Control>Rating-Group(1)", "type": "*handler", "handler_id": "*sum", - "value": "Multiple-Services-Credit-Control>Used-Service-Unit>CC-Input-Octets;^|;Multiple-Services-Credit-Control>Used-Service-Unit>CC-Output-Octets"}, + {"tag": "LastUsed", "field_id": "LastUsed", "type": "*sum", + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(1)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(1)]"}, ], - "cca_fields": [ - {"tag": "ResultCode", "field_filter": "*cgrReply>MaxUsage(^0$)", - "field_id": "Result-Code", "type": "*constant", "value": "4010"}, + "reply_fields": [ + {"tag": "CCATemplate", "type": "*template", "value": "*cca"}, + {"tag": "ResultCode", "filters": ["*string:*cgrep.MaxUsage:0"], + "field_id": "Result-Code", "type": "*constant", "value": "4010", "blocker": true}, ], }, + { - "id": "data_update_grp2", // formal identifier of this processor - "dry_run": false, // do not send the events to SMG, just log them - "request_filter": "Service-Context-Id(^gprs);CC-Request-Type(2);Multiple-Services-Credit-Control>Rating-Group(2)", // filter requests processed by this processor - "continue_on_success": true, // continue to the next template if executed - "ccr_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": "^*data", "mandatory": true}, - {"tag": "InitialOriginID", "field_id": "InitialOriginID", "type": "*composed", "value": "Session-Id", "mandatory": true}, - {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "Session-Id", "mandatory": true}, - {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "^_grp2", "append": true}, - {"tag": "RequestType", "field_id": "RequestType", "type": "*composed", "value": "^*prepaid", "mandatory": true}, - {"tag": "Direction", "field_id": "Direction", "type": "*composed", "value": "^*out", "mandatory": true}, - {"tag": "Tenant", "field_id": "Tenant", "type": "*composed", "value": "^cgrates.org", "mandatory": true}, - {"tag": "Category", "field_id": "Category", "type": "*composed", "value": "^generic", "mandatory": true}, - {"tag": "Account", "field_id": "Account", "type": "*grouped", "value": "Subscription-Id>Subscription-Id-Data", "field_filter":"Subscription-Id>Subscription-Id-Type(0)", "mandatory": true}, + "id": "data_update_grp2", + "filters": ["*string:*vars.cmd:*ccr", "*string:*req.CC-Request-Type:2", + "*string:*req.Multiple-Services-Credit-Control.Rating-Group[1]:2", "*prefix:*req.Service-Context-Id:gprs"], + "flags": ["*update", "*accounts"], + "request_fields":[ + {"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*data"}, + {"tag": "InitialOriginID", "field_id": "InitialOriginID", "type": "*composed", + "value": "~*req.Session-Id", "mandatory": true}, + {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", + "value": "~*req.Session-Id", "mandatory": true}, + {"tag": "OriginID", "field_id": "OriginID", "type": "*constant", "value": "_grp2"}, + {"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"}, + {"tag": "Category", "field_id": "Category", "type": "*constant", "value": "generic"}, + {"tag": "Account", "field_id": "Account", "type": "*composed", "mandatory": true, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, {"tag": "Destination", "field_id": "Destination", "type": "*constant", "value": "data"}, - {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, - {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, + {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", + "value": "~*req.Event-Timestamp", "mandatory": true}, + {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", + "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "Usage", "field_id": "Usage", "type": "*constant", "value": "2048"}, - {"tag": "LastUsed", "field_id": "LastUsed", "field_filter":"Multiple-Services-Credit-Control>Rating-Group(2)", "type": "*handler", "handler_id": "*sum", - "value": "Multiple-Services-Credit-Control>Used-Service-Unit>CC-Input-Octets;^|;Multiple-Services-Credit-Control>Used-Service-Unit>CC-Output-Octets"}, + {"tag": "LastUsed", "field_id": "LastUsed", "type": "*sum", + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(2)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(2)]"}, ], - "cca_fields": [ - {"tag": "ResultCode", "field_filter": "*cgrReply>MaxUsage(^0$)", - "field_id": "Result-Code", "type": "*constant", "value": "4010"}, + "reply_fields": [ + {"tag": "CCATemplate", "type": "*template", "value": "*cca"}, + {"tag": "ResultCode", "filters": ["*string:*cgrep.MaxUsage:0"], + "field_id": "Result-Code", "type": "*constant", "value": "4010", "blocker": true}, ], }, + { - "id": "data_terminate", // formal identifier of this processor - "dry_run": false, // do not send the events to SMG, just log them - "request_filter": "Service-Context-Id(^gprs);CC-Request-Type(3)", // filter requests processed by this processor - "continue_on_success": false, // continue to the next template if executed - "ccr_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": "^*data", "mandatory": true}, - {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "Session-Id", "mandatory": true}, - {"tag": "OriginIDPrefix", "field_id": "OriginIDPrefix", "type": "*composed", "value": "Session-Id", "mandatory": true}, - {"tag": "RequestType", "field_id": "RequestType", "type": "*composed", "value": "^*prepaid", "mandatory": true}, - {"tag": "Direction", "field_id": "Direction", "type": "*composed", "value": "^*out", "mandatory": true}, - {"tag": "Tenant", "field_id": "Tenant", "type": "*composed", "value": "^cgrates.org", "mandatory": true}, - {"tag": "Category", "field_id": "Category", "type": "*composed", "value": "^generic", "mandatory": true}, - {"tag": "Account", "field_id": "Account", "type": "*grouped", "value": "Subscription-Id>Subscription-Id-Data", "field_filter":"Subscription-Id>Subscription-Id-Type(0)", "mandatory": true}, + "id": "data_terminate", + "filters": ["*string:*vars.cmd:*ccr", "*string:*req.CC-Request-Type:3", + "*prefix:*req.Service-Context-Id:gprs"], + "flags": ["*terminate", "*accounts"], + "request_fields":[ + {"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*data"}, + {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", + "value": "~*req.Session-Id", "mandatory": true}, + {"tag": "OriginIDPrefix", "field_id": "OriginIDPrefix", "type": "*composed", + "value": "~*req.Session-Id", "mandatory": true}, + {"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"}, + {"tag": "Category", "field_id": "Category", "type": "*constant", "value": "generic"}, + {"tag": "Account", "field_id": "Account", "type": "*composed", "mandatory": true, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, {"tag": "Destination", "field_id": "Destination", "type": "*constant", "value": "data"}, - {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, - {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, + {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", + "value": "~*req.Event-Timestamp", "mandatory": true}, + {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", + "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "LastUsed", "field_id": "LastUsed", "type": "*handler", "handler_id": "*sum", - "value": "Multiple-Services-Credit-Control>Used-Service-Unit>CC-Input-Octets;^|;Multiple-Services-Credit-Control>Used-Service-Unit>CC-Output-Octets"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets"}, ], }, ] diff --git a/data/conf/samples/dmtagent/diameter_processors.json b/data/conf/samples/dmtagent/diameter_processors.json index 875b811dd..43ec85e64 100644 --- a/data/conf/samples/dmtagent/diameter_processors.json +++ b/data/conf/samples/dmtagent/diameter_processors.json @@ -2,73 +2,52 @@ "diameter_agent": { "request_processors": [ + { - "id": "*default", // formal identifier of this processor - "request_filter": "Service-Context-Id(nonexistent)", // cancel matching of this processor - }, - { - "id": "dryrun1", // formal identifier of this processor - "dry_run": true, // do not send the events to SMG, just log them - "request_filter": "Service-Context-Id(dryrun1)", // filter requests processed by this processor - "continue_on_success": false, // continue to the next template if executed - "ccr_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": "^*sms", "mandatory": true}, - {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "Session-Id", "mandatory": true}, - {"tag": "RequestType", "field_id": "RequestType", "type": "*composed", "value": "^*prepaid", "mandatory": true}, - {"tag": "Direction", "field_id": "Direction", "type": "*composed", "value": "^*out", "mandatory": true}, - {"tag": "Tenant", "field_id": "Tenant", "type": "*composed", "value": "^cgrates.org", "mandatory": true}, - {"tag": "Category", "field_id": "Category", "type": "*composed", "value": "^call", "mandatory": true}, - {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, - {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, + "id": "dryrun1", + "filters": ["*string:*vars.cmd:*ccr", "*string:*req.Service-Context-Id:gprs"], + "flags": ["*dryrun"], + "request_fields":[ + {"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*sms"}, + {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", + "value": "~*req.Session-Id", "mandatory": true}, + {"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"}, + {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", "value": "~*req.Event-Timestamp", "mandatory": true}, ], - "cca_fields":[ // fields returned in CCA + "reply_fields":[ + {"tag": "CCATemplate", "type": "*template", "value": "*cca"}, {"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "300"}, ], }, + { - "id": "pubsub1", // formal identifier of this processor - "dry_run": true, // do not send the events to SMG, just log them - "publish_event": true, - "request_filter": "Service-Context-Id(pubsub1)", // filter requests processed by this processor - "continue_on_success": false, // continue to the next template if executed - "ccr_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": "^*sms", "mandatory": true}, - {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "Session-Id", "mandatory": true}, - {"tag": "RequestType", "field_id": "RequestType", "type": "*composed", "value": "^*prepaid", "mandatory": true}, - {"tag": "Direction", "field_id": "Direction", "type": "*composed", "value": "^*out", "mandatory": true}, - {"tag": "Tenant", "field_id": "Tenant", "type": "*composed", "value": "^cgrates.org", "mandatory": true}, - {"tag": "Category", "field_id": "Category", "type": "*composed", "value": "^call", "mandatory": true}, - {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, - {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, + "id": "message", + "filters": ["*string:*vars.cmd:*ccr", "*prefix:*req.Service-Context-Id:message", + "*string:*req.CC-Request-Type:4"], + "flags": ["*event", "*accounts"], + "request_fields":[ + {"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*sms"}, + {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", + "value": "~*req.Session-Id", "mandatory": true}, + {"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"}, + {"tag": "Account", "field_id": "Account", "type": "*composed", "mandatory": true, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, + {"tag": "Subject", "field_id": "Subject", "type": "*composed", "mandatory": true, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, + {"tag": "Destination", "field_id": "Destination", "type": "*composed", "mandatory": true, + "value": "~*req.Service-Information.SMS-Information.Recipient-Address.Address-Data"}, + {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", + "value": "~*req.Event-Timestamp", "mandatory": true}, + {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", + "value": "~*req.Event-Timestamp", "mandatory": true}, + {"tag": "Usage", "field_id": "Usage", "type": "*composed", + "value": "~*req.Requested-Service-Unit.CC-Time", "mandatory": true}, ], - "cca_fields":[ // fields returned in CCA - {"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "300"}, - ], - }, - { - "id": "message", // formal identifier of this processor - "dry_run": false, // do not send the events to SMG, just log them - "request_filter": "Service-Context-Id(^message)", // filter requests processed by this processor - "continue_on_success": false, // continue to the next template if executed - "ccr_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": "^*sms", "mandatory": true}, - {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "Session-Id", "mandatory": true}, - {"tag": "RequestType", "field_id": "RequestType", "type": "*composed", "value": "^*prepaid", "mandatory": true}, - {"tag": "Direction", "field_id": "Direction", "type": "*composed", "value": "^*out", "mandatory": true}, - {"tag": "Tenant", "field_id": "Tenant", "type": "*composed", "value": "^cgrates.org", "mandatory": true}, - {"tag": "Category", "field_id": "Category", "type": "*composed", "value": "^call", "mandatory": true}, - {"tag": "Account", "field_id": "Account", "type": "*composed", "value": "Subscription-Id>Subscription-Id-Data", "field_filter":"Subscription-Id>Subscription-Id-Type(0)", "mandatory": true}, - {"tag": "Subject", "field_id": "Subject", "type": "*composed", "value": "Subscription-Id>Subscription-Id-Data", "field_filter":"Subscription-Id>Subscription-Id-Type(0)", "mandatory": true}, - {"tag": "Destination", "field_id": "Destination", "type": "*composed", "value": "Service-Information>SMS-Information>Recipient-Address>Address-Data", "mandatory": true}, - {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, - {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, - {"tag": "Usage", "field_id": "Usage", "type": "*composed", "value": "Requested-Service-Unit>CC-Time", "mandatory": true}, - ], - "cca_fields":[ - {"tag": "ResultCode", "field_filter":"*cgrReply>Error(ACCOUNT_NOT_FOUND)", - "field_id": "Result-Code", "type": "*constant", "value": "5030"}, - {"tag": "ResultCode", "field_filter":"*cgrReply>Error(USER_NOT_FOUND)", - "field_id": "Result-Code", "type": "*constant", "value": "5030"}, + "reply_fields":[ + {"tag": "ResultCode", "filters": ["*string.*cgrep.Error:ACCOUNT_NOT_FOUND"], + "field_id": "Result-Code", "type": "*constant", "value": "5030", "break": true}, + {"tag": "ResultCode", "filters": ["*string.*cgrep.Error:USER_NOT_FOUND"], + "field_id": "Result-Code", "type": "*constant", "value": "5030", "break": true}, ], }, diff --git a/data/conf/samples/dmtagent/simpa.json b/data/conf/samples/dmtagent/simpa.json index 6a1fb9503..21708bfdd 100644 --- a/data/conf/samples/dmtagent/simpa.json +++ b/data/conf/samples/dmtagent/simpa.json @@ -4,23 +4,22 @@ "diameter_agent": { "request_processors": [ { - "id": "simpa_event", // formal identifier of this processor - "dry_run": false, // do not send the events to SMG, just log them - "request_filter": "Service-Context-Id(^simpa);CC-Request-Type(4)", // filter requests processed by this processor - "continue_on_success": false, // continue to the next template if executed - "ccr_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": "^*generic", "mandatory": true}, - {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "Session-Id", "mandatory": true}, - {"tag": "RequestType", "field_id": "RequestType", "type": "*composed", "value": "^*prepaid", "mandatory": true}, - {"tag": "Direction", "field_id": "Direction", "type": "*composed", "value": "^*out", "mandatory": true}, - {"tag": "Tenant", "field_id": "Tenant", "type": "*composed", "value": "^cgrates.org", "mandatory": true}, - {"tag": "Category", "field_id": "Category", "type": "*composed", "value": "^generic", "mandatory": true}, - {"tag": "Account", "field_id": "Account", "type": "*composed", "value": "Subscription-Id>Subscription-Id-Data", "field_filter":"Subscription-Id>Subscription-Id-Type(0)", "mandatory": true}, - {"tag": "Subject", "field_id": "Subject", "type": "*composed", "value": "Subscription-Id>Subscription-Id-Data", "field_filter":"Subscription-Id>Subscription-Id-Type(0)", "mandatory": true}, - {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, - {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, - {"tag": "Usage", "field_id": "Usage", "type": "*handler", "handler_id": "*value_exponent", - "value": "Requested-Service-Unit>CC-Money>Unit-Value>Value-Digits;^|;Requested-Service-Unit>CC-Money>Unit-Value>Exponent", "mandatory": true}, + "id": "simpa_event", + "filters": ["*string:*vars.cmd:*ccr", "*string:*req.CC-Request-Type:4", + "*prefix:*req.Service-Context-Id:simpa"], + "flags": ["*event", "*accounts"], + "request_fields":[ + {"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*generic"}, + {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", + "value": "~*req.Session-Id", "mandatory": true}, + {"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"}, + {"tag": "Category", "field_id": "Category", "type": "*constant", "value": "generic"}, + {"tag": "Account", "field_id": "Account", "type": "*composed", "mandatory": true, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, + {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", + "value": "~*req.Event-Timestamp", "mandatory": true}, + {"tag": "Usage", "field_id": "Usage", "type": "*value_exponent", "mandatory": true, + "value": "~*req.Requested-Service-Unit.CC-Money.Unit-Value.Value-Digits;~*req.Requested-Service-Unit.CC-Money.Unit-Value.Exponent"}, ], }, ], diff --git a/data/conf/samples/dmtagent/voice.json b/data/conf/samples/dmtagent/voice.json index 0c53c09f9..e79c9ba85 100644 --- a/data/conf/samples/dmtagent/voice.json +++ b/data/conf/samples/dmtagent/voice.json @@ -4,81 +4,77 @@ "diameter_agent": { "request_processors": [ { - "id": "VoiceInit", // formal identifier of this processor - "dry_run": false, // do not send the events to SMG, just log them - "request_filter": "Service-Context-Id(^voice);CC-Request-Type(1)", // filter requests processed by this processor - "flags": ["*accounts"], - "ccr_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}, - {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "Session-Id", "mandatory": true}, - {"tag": "RequestType", "field_id": "RequestType", "type": "*composed", "value": "^*users", "mandatory": true}, - {"tag": "Direction", "field_id": "Direction", "type": "*composed", "value": "^*out", "mandatory": true}, - {"tag": "Tenant", "field_id": "Tenant", "type": "*composed", "value": "^*users", "mandatory": true}, - {"tag": "Category", "field_id": "Category", "type": "*composed", "value": "^call", "mandatory": true}, - {"tag": "Account", "field_id": "Account", "type": "*composed", "value": "^*users", "mandatory": true}, - {"tag": "Subject", "field_id": "Subject", "type": "*composed", "value": "^*users", "mandatory": true}, + "id": "VoiceInit", + "filters": ["*string:*vars.cmd:*ccr", "*string:*req.CC-Request-Type:1", + "*prefix:*req.Service-Context-Id:voice"], + "flags": ["*initiate", "*accounts", "*attributes"], + "request_fields":[ + {"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*voice"}, + {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", + "value": "~*req.Session-Id", "mandatory": true}, + {"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*attributes"}, + {"tag": "Account", "field_id": "Account", "type": "*constant", "value": "*attributes"}, {"tag": "Destination", "field_id": "Destination", "type": "*composed", - "value": "Service-Information>IN-Information>Real-Called-Number", "mandatory": true}, - {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, - {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, - {"tag": "Usage", "field_id": "Usage", "type": "*handler", "handler_id": "*ccr_usage", "mandatory": true}, - {"tag": "SubscriberID", "field_id": "SubscriberId", "type": "*composed", "value": "Subscription-Id>Subscription-Id-Data", "mandatory": true}, + "value": "~*req.Service-Information.IN-Information.Real-Called-Number", "mandatory": true}, + {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", + "value": "~*req.Event-Timestamp", "mandatory": true}, + {"tag": "Usage", "field_id": "Usage", "type": "*ccr_usage", "mandatory": true}, + {"tag": "SubscriberID", "field_id": "SubscriberId", "type": "*composed", + "value": "~*req.Subscription-Id.Subscription-Id-Data", "mandatory": true}, ], - "cca_fields":[ - {"tag": "ResultCode", "field_filter":"*cgrReply>Error(ACCOUNT_NOT_FOUND)", - "field_id": "Result-Code", "type": "*constant", "value": "5030"}, - {"tag": "ResultCode", "field_filter":"*cgrReply>Error(USER_NOT_FOUND)", - "field_id": "Result-Code", "type": "*constant", "value": "5030"}, - {"tag": "GrantedUnits", "field_filter":"*cgrReply>Error(^$)", - "field_id": "Granted-Service-Unit>CC-Time", "type": "*composed", - "value": "*cgrReply>MaxUsage{*duration_seconds}", "mandatory": true}, + "reply_fields":[ + {"tag": "ResultCode", "filters": ["*string:*cgrep.Error:ACCOUNT_NOT_FOUND"], + "field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true}, + {"tag": "ResultCode", "filters": ["*string:*cgrep.Error:USER_NOT_FOUND"], + "field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true}, + {"tag": "GrantedUnits", "field_id": "Granted-Service-Unit.CC-Time", "type": "*composed", + "value": "~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true}, ], }, { - "id": "VoiceUpdate", // formal identifier of this processor - "dry_run": false, // do not send the events to SMG, just log them - "request_filter": "Service-Context-Id(^voice);CC-Request-Type(2)", // filter requests processed by this processor - "flags": ["*accounts"], - "ccr_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}, - {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "Session-Id", "mandatory": true}, - {"tag": "RequestType", "field_id": "RequestType", "type": "*composed", "value": "^*users", "mandatory": true}, - {"tag": "Direction", "field_id": "Direction", "type": "*composed", "value": "^*out", "mandatory": true}, - {"tag": "Tenant", "field_id": "Tenant", "type": "*composed", "value": "^*users", "mandatory": true}, - {"tag": "Category", "field_id": "Category", "type": "*composed", "value": "^call", "mandatory": true}, - {"tag": "Account", "field_id": "Account", "type": "*composed", "value": "^*users", "mandatory": true}, - {"tag": "Subject", "field_id": "Subject", "type": "*composed", "value": "^*users", "mandatory": true}, - {"tag": "Destination", "field_id": "Destination", "type": "*composed", "value": "Service-Information>IN-Information>Real-Called-Number", "mandatory": true}, - {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, - {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, - {"tag": "Usage", "field_id": "Usage", "type": "*handler", "handler_id": "*ccr_usage", "mandatory": true}, - {"tag": "SubscriberID", "field_id": "SubscriberId", "type": "*composed", "value": "Subscription-Id>Subscription-Id-Data", "mandatory": true}, + "id": "VoiceUpdate", + "filters": ["*string:*vars.cmd:*ccr", "*string:*req.CC-Request-Type:2", + "*prefix:*req.Service-Context-Id:voice"], + "flags": ["*update", "*accounts", "*attributes"], + "request_fields":[ + {"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*voice"}, + {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", + "value": "~*req.Session-Id", "mandatory": true}, + {"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*attributes"}, + {"tag": "Account", "field_id": "Account", "type": "*constant", "value": "*attributes"}, + {"tag": "Destination", "field_id": "Destination", "type": "*composed", + "value": "~*req.Service-Information.IN-Information.Real-Called-Number", "mandatory": true}, + {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", + "value": "~*req.Event-Timestamp", "mandatory": true}, + {"tag": "Usage", "field_id": "Usage", "type": "*ccr_usage", "mandatory": true}, + {"tag": "SubscriberID", "field_id": "SubscriberId", "type": "*composed", + "value": "~*req.Subscription-Id.Subscription-Id-Data", "mandatory": true}, ], - "cca_fields":[ // fields returned in CCA - {"tag": "GrantedUnits", "field_filter":"*cgrReply>Error(^$)", - "field_id": "Granted-Service-Unit>CC-Time", "type": "*composed", - "value": "*cgrReply>MaxUsage{*duration_seconds}", "mandatory": true}, + "reply_fields":[ + {"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"], + "field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true}, + {"tag": "GrantedUnits", "field_id": "Granted-Service-Unit.CC-Time", "type": "*composed", + "value": "~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true}, ], }, { - "id": "VoiceTerminate", // formal identifier of this processor - "dry_run": false, // do not send the events to SMG, just log them - "request_filter": "Service-Context-Id(^voice);CC-Request-Type(3)", // filter requests processed by this processor - "flags": ["*accounts"], - "ccr_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}, - {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "Session-Id", "mandatory": true}, - {"tag": "RequestType", "field_id": "RequestType", "type": "*composed", "value": "^*users", "mandatory": true}, - {"tag": "Direction", "field_id": "Direction", "type": "*composed", "value": "^*out", "mandatory": true}, - {"tag": "Tenant", "field_id": "Tenant", "type": "*composed", "value": "^*users", "mandatory": true}, - {"tag": "Category", "field_id": "Category", "type": "*composed", "value": "^call", "mandatory": true}, - {"tag": "Account", "field_id": "Account", "type": "*composed", "value": "^*users", "mandatory": true}, - {"tag": "Subject", "field_id": "Subject", "type": "*composed", "value": "^*users", "mandatory": true}, - {"tag": "Destination", "field_id": "Destination", "type": "*composed", "value": "Service-Information>IN-Information>Real-Called-Number", "mandatory": true}, - {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, - {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true}, - {"tag": "Usage", "field_id": "Usage", "type": "*handler", "handler_id": "*ccr_usage", "mandatory": true}, - {"tag": "SubscriberID", "field_id": "SubscriberId", "type": "*composed", "value": "Subscription-Id>Subscription-Id-Data", "mandatory": true}, + "id": "VoiceTerminate", + "filters": ["*string:*vars.cmd:*ccr", "*string:*req.CC-Request-Type:3", + "*prefix:*req.Service-Context-Id:voice"], + "flags": ["*terminate", "*accounts", "*attributes"], + "request_fields":[ + {"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*voice"}, + {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", + "value": "~*req.Session-Id", "mandatory": true}, + {"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*attributes"}, + {"tag": "Account", "field_id": "Account", "type": "*constant", "value": "*attributes"}, + {"tag": "Destination", "field_id": "Destination", "type": "*composed", + "value": "~*req.Service-Information.IN-Information.Real-Called-Number", "mandatory": true}, + {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", + "value": "~*req.Event-Timestamp", "mandatory": true}, + {"tag": "Usage", "field_id": "Usage", "type": "*ccr_usage", "mandatory": true}, + {"tag": "SubscriberID", "field_id": "SubscriberId", "type": "*composed", + "value": "~*req.Subscription-Id.Subscription-Id-Data", "mandatory": true}, ], }, ],