diff --git a/apier/v1/config_it_test.go b/apier/v1/config_it_test.go index 8d351193e..31e576c12 100644 --- a/apier/v1/config_it_test.go +++ b/apier/v1/config_it_test.go @@ -225,7 +225,6 @@ func testConfigSReloadConfigFromJSONEEs(t *testing.T) { "AttributeSConns": []interface{}{}, "Cache": map[string]interface{}{"*file_csv": map[string]interface{}{"Limit": -1., "Precache": false, "Replicate": false, "StaticTTL": false, "TTL": 5000000000.}}, "Exporters": []interface{}{eporter}, - "Templates": map[string]interface{}{}, } var rpl map[string]interface{} if err := configRPC.Call(utils.ConfigSv1GetJSONSection, &config.StringWithOpts{ diff --git a/config/config_it_test.go b/config/config_it_test.go index 3df8c72db..7632902fd 100644 --- a/config/config_it_test.go +++ b/config/config_it_test.go @@ -463,7 +463,6 @@ func testCGRConfigReloadERs(t *testing.T) { expAttr := &ERsCfg{ Enabled: true, SessionSConns: []string{utils.MetaLocalHost}, - Templates: map[string][]*FCTemplate{}, Readers: []*EventReaderCfg{ { ID: utils.MetaDefault, @@ -880,7 +879,6 @@ func testCgrCfgV1ReloadConfigSection(t *testing.T) { "SessionSConns": []string{ utils.MetaLocalHost, }, - "Templates": map[string]interface{}{}, } cfg, _ := NewDefaultCGRConfig() diff --git a/config/diametercfg_test.go b/config/diametercfg_test.go index bd56e1b3f..21786a9eb 100644 --- a/config/diametercfg_test.go +++ b/config/diametercfg_test.go @@ -47,7 +47,6 @@ func TestDiameterAgentCfgloadFromJsonCfg(t *testing.T) { "vendor_id": 0, // diameter Vendor-Id AVP used in replies "product_name": "CGRateS", // diameter Product-Name AVP used in replies "synced_conn_requests": true, - "templates":{}, "request_processors": [], }, }` @@ -85,7 +84,6 @@ func TestDiameterAgentCfgAsMapInterface(t *testing.T) { "vendor_id": 0, "product_name": "CGRateS", "synced_conn_requests": true, - "templates":{}, "request_processors": [], }, }` diff --git a/data/conf/cgrates/cgrates.json b/data/conf/cgrates/cgrates.json index 65422c635..aa247dec5 100755 --- a/data/conf/cgrates/cgrates.json +++ b/data/conf/cgrates/cgrates.json @@ -304,7 +304,6 @@ // "ers": { // EventReaderService // "enabled": false, // starts the EventReader service: -// "templates":{}, // default templates for ERs // "sessions_conns":["*internal"], // RPC Connections IDs // "readers": [ // { @@ -347,7 +346,6 @@ // "cache": { // "*file_csv": {"limit": -1, "ttl": "5s", "static_ttl": false}, // }, -// "templates":{}, // default templates for EEs // "exporters": [ // { // "id": "*default", // identifier of the EventReader profile @@ -476,62 +474,6 @@ // "asr_template": "", // enable AbortSession message being sent to client on DisconnectSession // "rar_template": "", // template used to build the Re-Auth-Request // "forced_disconnect": "*none", // the request to send to diameter on DisconnectSession <*none|*asr|*rar> -// "templates":{ // default message templates -// "*err": [ -// {"tag": "SessionId", "path": "*rep.Session-Id", "type": "*variable", -// "value": "~*req.Session-Id", "mandatory": true}, -// {"tag": "OriginHost", "path": "*rep.Origin-Host", "type": "*variable", -// "value": "~*vars.OriginHost", "mandatory": true}, -// {"tag": "OriginRealm", "path": "*rep.Origin-Realm", "type": "*variable", -// "value": "~*vars.OriginRealm", "mandatory": true}, -// ], -// "*cca": [ -// {"tag": "SessionId", "path": "*rep.Session-Id", "type": "*variable", -// "value": "~*req.Session-Id", "mandatory": true}, -// {"tag": "ResultCode", "path": "*rep.Result-Code", "type": "*constant", -// "value": "2001"}, -// {"tag": "OriginHost", "path": "*rep.Origin-Host", "type": "*variable", -// "value": "~*vars.OriginHost", "mandatory": true}, -// {"tag": "OriginRealm", "path": "*rep.Origin-Realm", "type": "*variable", -// "value": "~*vars.OriginRealm", "mandatory": true}, -// {"tag": "AuthApplicationId", "path": "*rep.Auth-Application-Id", "type": "*variable", -// "value": "~*vars.*appid", "mandatory": true}, -// {"tag": "CCRequestType", "path": "*rep.CC-Request-Type", "type": "*variable", -// "value": "~*req.CC-Request-Type", "mandatory": true}, -// {"tag": "CCRequestNumber", "path": "*rep.CC-Request-Number", "type": "*variable", -// "value": "~*req.CC-Request-Number", "mandatory": true}, -// ], -// "*asr": [ -// {"tag": "SessionId", "path": "*diamreq.Session-Id", "type": "*variable", -// "value": "~*req.Session-Id", "mandatory": true}, -// {"tag": "OriginHost", "path": "*diamreq.Origin-Host", "type": "*variable", -// "value": "~*req.Destination-Host", "mandatory": true}, -// {"tag": "OriginRealm", "path": "*diamreq.Origin-Realm", "type": "*variable", -// "value": "~*req.Destination-Realm", "mandatory": true}, -// {"tag": "DestinationRealm", "path": "*diamreq.Destination-Realm", "type": "*variable", -// "value": "~*req.Origin-Realm", "mandatory": true}, -// {"tag": "DestinationHost", "path": "*diamreq.Destination-Host", "type": "*variable", -// "value": "~*req.Origin-Host", "mandatory": true}, -// {"tag": "AuthApplicationId", "path": "*diamreq.Auth-Application-Id", "type": "*variable", -// "value": "~*vars.*appid", "mandatory": true}, -// ], -// "*rar": [ -// {"tag": "SessionId", "path": "*diamreq.Session-Id", "type": "*variable", -// "value": "~*req.Session-Id", "mandatory": true}, -// {"tag": "OriginHost", "path": "*diamreq.Origin-Host", "type": "*variable", -// "value": "~*req.Destination-Host", "mandatory": true}, -// {"tag": "OriginRealm", "path": "*diamreq.Origin-Realm", "type": "*variable", -// "value": "~*req.Destination-Realm", "mandatory": true}, -// {"tag": "DestinationRealm", "path": "*diamreq.Destination-Realm", "type": "*variable", -// "value": "~*req.Origin-Realm", "mandatory": true}, -// {"tag": "DestinationHost", "path": "*diamreq.Destination-Host", "type": "*variable", -// "value": "~*req.Origin-Host", "mandatory": true}, -// {"tag": "AuthApplicationId", "path": "*diamreq.Auth-Application-Id", "type": "*variable", -// "value": "~*vars.*appid", "mandatory": true}, -// {"tag": "ReAuthRequestType", "path": "*diamreq.Re-Auth-Request-Type", "type": "*constant", -// "value": "0"}, -// ] -// }, // "request_processors": [ // list of processors to be applied to diameter messages // ], // }, @@ -962,14 +904,69 @@ // "sessions_conns": ["*internal"], // "timezone": "", // timezone of the events if not specified // "retransmission_timer": "1s", // the duration to wait to receive an ACK before resending the reply -// "templates":{ // default message templates -// "*err": [ -// {"tag": "Request", "path": "*rep.Request", "type": "*constant", -// "value": "SIP/2.0 500 Internal Server Error", "mandatory": true}, -// ], -// }, // "request_processors": [ // request processors to be applied to SIP messages // ], // }, +// "templates": { +// "*err": [ +// {"tag": "SessionId", "path": "*rep.Session-Id", "type": "*variable", +// "value": "~*req.Session-Id", "mandatory": true}, +// {"tag": "OriginHost", "path": "*rep.Origin-Host", "type": "*variable", +// "value": "~*vars.OriginHost", "mandatory": true}, +// {"tag": "OriginRealm", "path": "*rep.Origin-Realm", "type": "*variable", +// "value": "~*vars.OriginRealm", "mandatory": true}, +// ], +// "*cca": [ +// {"tag": "SessionId", "path": "*rep.Session-Id", "type": "*variable", +// "value": "~*req.Session-Id", "mandatory": true}, +// {"tag": "ResultCode", "path": "*rep.Result-Code", "type": "*constant", +// "value": "2001"}, +// {"tag": "OriginHost", "path": "*rep.Origin-Host", "type": "*variable", +// "value": "~*vars.OriginHost", "mandatory": true}, +// {"tag": "OriginRealm", "path": "*rep.Origin-Realm", "type": "*variable", +// "value": "~*vars.OriginRealm", "mandatory": true}, +// {"tag": "AuthApplicationId", "path": "*rep.Auth-Application-Id", "type": "*variable", +// "value": "~*vars.*appid", "mandatory": true}, +// {"tag": "CCRequestType", "path": "*rep.CC-Request-Type", "type": "*variable", +// "value": "~*req.CC-Request-Type", "mandatory": true}, +// {"tag": "CCRequestNumber", "path": "*rep.CC-Request-Number", "type": "*variable", +// "value": "~*req.CC-Request-Number", "mandatory": true}, +// ], +// "*asr": [ +// {"tag": "SessionId", "path": "*diamreq.Session-Id", "type": "*variable", +// "value": "~*req.Session-Id", "mandatory": true}, +// {"tag": "OriginHost", "path": "*diamreq.Origin-Host", "type": "*variable", +// "value": "~*req.Destination-Host", "mandatory": true}, +// {"tag": "OriginRealm", "path": "*diamreq.Origin-Realm", "type": "*variable", +// "value": "~*req.Destination-Realm", "mandatory": true}, +// {"tag": "DestinationRealm", "path": "*diamreq.Destination-Realm", "type": "*variable", +// "value": "~*req.Origin-Realm", "mandatory": true}, +// {"tag": "DestinationHost", "path": "*diamreq.Destination-Host", "type": "*variable", +// "value": "~*req.Origin-Host", "mandatory": true}, +// {"tag": "AuthApplicationId", "path": "*diamreq.Auth-Application-Id", "type": "*variable", +// "value": "~*vars.*appid", "mandatory": true}, +// ], +// "*rar": [ +// {"tag": "SessionId", "path": "*diamreq.Session-Id", "type": "*variable", +// "value": "~*req.Session-Id", "mandatory": true}, +// {"tag": "OriginHost", "path": "*diamreq.Origin-Host", "type": "*variable", +// "value": "~*req.Destination-Host", "mandatory": true}, +// {"tag": "OriginRealm", "path": "*diamreq.Origin-Realm", "type": "*variable", +// "value": "~*req.Destination-Realm", "mandatory": true}, +// {"tag": "DestinationRealm", "path": "*diamreq.Destination-Realm", "type": "*variable", +// "value": "~*req.Origin-Realm", "mandatory": true}, +// {"tag": "DestinationHost", "path": "*diamreq.Destination-Host", "type": "*variable", +// "value": "~*req.Origin-Host", "mandatory": true}, +// {"tag": "AuthApplicationId", "path": "*diamreq.Auth-Application-Id", "type": "*variable", +// "value": "~*vars.*appid", "mandatory": true}, +// {"tag": "ReAuthRequestType", "path": "*diamreq.Re-Auth-Request-Type", "type": "*constant", +// "value": "0"}, +// ], +// "*errSip": [ +// {"tag": "Request", "path": "*rep.Request", "type": "*constant", +// "value": "SIP/2.0 500 Internal Server Error", "mandatory": true}, +// ], +// }, + } diff --git a/data/conf/samples/cdrsexport_internal/cgrates.json b/data/conf/samples/cdrsexport_internal/cgrates.json index d1910dd24..f5f410dbd 100644 --- a/data/conf/samples/cdrsexport_internal/cgrates.json +++ b/data/conf/samples/cdrsexport_internal/cgrates.json @@ -48,22 +48,6 @@ "ees": { "enabled": true, - "templates": { - "requiredFields": [ - {"tag": "CGRID", "path": "*exp.CGRID", "type": "*variable", "value": "~*req.CGRID"}, - {"tag": "RunID", "path": "*exp.RunID", "type": "*variable", "value": "~*req.RunID"}, - {"tag": "ToR", "path": "*exp.ToR", "type": "*variable", "value": "~*req.ToR"}, - {"tag": "OriginID", "path": "*exp.OriginID", "type": "*variable", "value": "~*req.OriginID"}, - {"tag": "RequestType", "path": "*exp.RequestType", "type": "*variable", "value": "~*req.RequestType"}, - {"tag": "Tenant", "path": "*exp.Tenant", "type": "*variable", "value": "~*req.Tenant"}, - {"tag": "Category", "path": "*exp.Category", "type": "*variable", "value": "~*req.Category"}, - {"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": "OrderID", "path": "*exp.OrderID", "type": "*variable", "value": "~*req.OrderID","filter":"*string:~*opts.AddOrderID:true"} - ] - }, "exporters": [ { "id": "http_localhost", @@ -131,6 +115,23 @@ }, +"templates": { + "requiredFields": [ + {"tag": "CGRID", "path": "*exp.CGRID", "type": "*variable", "value": "~*req.CGRID"}, + {"tag": "RunID", "path": "*exp.RunID", "type": "*variable", "value": "~*req.RunID"}, + {"tag": "ToR", "path": "*exp.ToR", "type": "*variable", "value": "~*req.ToR"}, + {"tag": "OriginID", "path": "*exp.OriginID", "type": "*variable", "value": "~*req.OriginID"}, + {"tag": "RequestType", "path": "*exp.RequestType", "type": "*variable", "value": "~*req.RequestType"}, + {"tag": "Tenant", "path": "*exp.Tenant", "type": "*variable", "value": "~*req.Tenant"}, + {"tag": "Category", "path": "*exp.Category", "type": "*variable", "value": "~*req.Category"}, + {"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": "OrderID", "path": "*exp.OrderID", "type": "*variable", "value": "~*req.OrderID","filter":"*string:~*opts.AddOrderID:true"} + ] +}, + + "apiers": { "enabled": true, }, diff --git a/data/conf/samples/cdrsexport_mongo/cgrates.json b/data/conf/samples/cdrsexport_mongo/cgrates.json index 16b3996a2..56ff2a55d 100644 --- a/data/conf/samples/cdrsexport_mongo/cgrates.json +++ b/data/conf/samples/cdrsexport_mongo/cgrates.json @@ -53,22 +53,6 @@ "ees": { "enabled": true, - "templates": { - "requiredFields": [ - {"tag": "CGRID", "path": "*exp.CGRID", "type": "*variable", "value": "~*req.CGRID"}, - {"tag": "RunID", "path": "*exp.RunID", "type": "*variable", "value": "~*req.RunID"}, - {"tag": "ToR", "path": "*exp.ToR", "type": "*variable", "value": "~*req.ToR"}, - {"tag": "OriginID", "path": "*exp.OriginID", "type": "*variable", "value": "~*req.OriginID"}, - {"tag": "RequestType", "path": "*exp.RequestType", "type": "*variable", "value": "~*req.RequestType"}, - {"tag": "Tenant", "path": "*exp.Tenant", "type": "*variable", "value": "~*req.Tenant"}, - {"tag": "Category", "path": "*exp.Category", "type": "*variable", "value": "~*req.Category"}, - {"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": "OrderID", "path": "*exp.OrderID", "type": "*variable", "value": "~*req.OrderID","filter":"*string:~*opts.AddOrderID:true"} - ] - }, "exporters": [ { "id": "http_localhost", @@ -136,6 +120,23 @@ }, +"templates": { + "requiredFields": [ + {"tag": "CGRID", "path": "*exp.CGRID", "type": "*variable", "value": "~*req.CGRID"}, + {"tag": "RunID", "path": "*exp.RunID", "type": "*variable", "value": "~*req.RunID"}, + {"tag": "ToR", "path": "*exp.ToR", "type": "*variable", "value": "~*req.ToR"}, + {"tag": "OriginID", "path": "*exp.OriginID", "type": "*variable", "value": "~*req.OriginID"}, + {"tag": "RequestType", "path": "*exp.RequestType", "type": "*variable", "value": "~*req.RequestType"}, + {"tag": "Tenant", "path": "*exp.Tenant", "type": "*variable", "value": "~*req.Tenant"}, + {"tag": "Category", "path": "*exp.Category", "type": "*variable", "value": "~*req.Category"}, + {"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": "OrderID", "path": "*exp.OrderID", "type": "*variable", "value": "~*req.OrderID","filter":"*string:~*opts.AddOrderID:true"} + ] +}, + + "apiers": { "enabled": true, }, diff --git a/data/conf/samples/cdrsexport_mysql/cgrates.json b/data/conf/samples/cdrsexport_mysql/cgrates.json index 3e576446e..1746e82ff 100644 --- a/data/conf/samples/cdrsexport_mysql/cgrates.json +++ b/data/conf/samples/cdrsexport_mysql/cgrates.json @@ -50,22 +50,6 @@ "ees": { "enabled": true, - "templates": { - "requiredFields": [ - {"tag": "CGRID", "path": "*exp.CGRID", "type": "*variable", "value": "~*req.CGRID"}, - {"tag": "RunID", "path": "*exp.RunID", "type": "*variable", "value": "~*req.RunID"}, - {"tag": "ToR", "path": "*exp.ToR", "type": "*variable", "value": "~*req.ToR"}, - {"tag": "OriginID", "path": "*exp.OriginID", "type": "*variable", "value": "~*req.OriginID"}, - {"tag": "RequestType", "path": "*exp.RequestType", "type": "*variable", "value": "~*req.RequestType"}, - {"tag": "Tenant", "path": "*exp.Tenant", "type": "*variable", "value": "~*req.Tenant"}, - {"tag": "Category", "path": "*exp.Category", "type": "*variable", "value": "~*req.Category"}, - {"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": "OrderID", "path": "*exp.OrderID", "type": "*variable", "value": "~*req.OrderID","filter":"*string:~*opts.AddOrderID:true"} - ] - }, "exporters": [ { "id": "http_localhost", @@ -133,6 +117,23 @@ }, +"templates": { + "requiredFields": [ + {"tag": "CGRID", "path": "*exp.CGRID", "type": "*variable", "value": "~*req.CGRID"}, + {"tag": "RunID", "path": "*exp.RunID", "type": "*variable", "value": "~*req.RunID"}, + {"tag": "ToR", "path": "*exp.ToR", "type": "*variable", "value": "~*req.ToR"}, + {"tag": "OriginID", "path": "*exp.OriginID", "type": "*variable", "value": "~*req.OriginID"}, + {"tag": "RequestType", "path": "*exp.RequestType", "type": "*variable", "value": "~*req.RequestType"}, + {"tag": "Tenant", "path": "*exp.Tenant", "type": "*variable", "value": "~*req.Tenant"}, + {"tag": "Category", "path": "*exp.Category", "type": "*variable", "value": "~*req.Category"}, + {"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": "OrderID", "path": "*exp.OrderID", "type": "*variable", "value": "~*req.OrderID","filter":"*string:~*opts.AddOrderID:true"} + ] +}, + + "apiers": { "enabled": true, }, diff --git a/data/conf/samples/ees/cgrates.json b/data/conf/samples/ees/cgrates.json index 7ac69b6c0..b1eafb720 100644 --- a/data/conf/samples/ees/cgrates.json +++ b/data/conf/samples/ees/cgrates.json @@ -61,24 +61,6 @@ "*file_csv": {"limit": -1, "ttl": "500ms", "static_ttl": false}, "*file_fwv": {"limit": -1, "ttl": "500ms", "static_ttl": false} }, - "templates": { - "requiredFields": [ - {"tag": "CGRID", "path": "*exp.CGRID", "type": "*variable", "value": "~*req.CGRID"}, - {"tag": "RunID", "path": "*exp.RunID", "type": "*variable", "value": "~*req.RunID"}, - {"tag": "ToR", "path": "*exp.ToR", "type": "*variable", "value": "~*req.ToR"}, - {"tag": "OriginID", "path": "*exp.OriginID", "type": "*variable", "value": "~*req.OriginID"}, - {"tag": "RequestType", "path": "*exp.RequestType", "type": "*variable", "value": "~*req.RequestType"}, - {"tag": "Tenant", "path": "*exp.Tenant", "type": "*variable", "value": "~*req.Tenant"}, - {"tag": "Category", "path": "*exp.Category", "type": "*variable", "value": "~*req.Category"}, - {"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", "layout": "2006-01-02T15:04:05Z07:00"}, - {"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value": "~*req.AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"}, - {"tag": "Usage", "path": "*exp.Usage", "type": "*variable", "value": "~*req.Usage"}, - {"tag": "Cost", "path": "*exp.Cost", "type": "*variable", "value": "~*req.Cost{*round:4}"} - ], - }, "exporters": [ { "id": "CSVExporter", @@ -380,4 +362,24 @@ }, +"templates": { + "requiredFields": [ + {"tag": "CGRID", "path": "*exp.CGRID", "type": "*variable", "value": "~*req.CGRID"}, + {"tag": "RunID", "path": "*exp.RunID", "type": "*variable", "value": "~*req.RunID"}, + {"tag": "ToR", "path": "*exp.ToR", "type": "*variable", "value": "~*req.ToR"}, + {"tag": "OriginID", "path": "*exp.OriginID", "type": "*variable", "value": "~*req.OriginID"}, + {"tag": "RequestType", "path": "*exp.RequestType", "type": "*variable", "value": "~*req.RequestType"}, + {"tag": "Tenant", "path": "*exp.Tenant", "type": "*variable", "value": "~*req.Tenant"}, + {"tag": "Category", "path": "*exp.Category", "type": "*variable", "value": "~*req.Category"}, + {"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", "layout": "2006-01-02T15:04:05Z07:00"}, + {"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value": "~*req.AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"}, + {"tag": "Usage", "path": "*exp.Usage", "type": "*variable", "value": "~*req.Usage"}, + {"tag": "Cost", "path": "*exp.Cost", "type": "*variable", "value": "~*req.Cost{*round:4}"} + ], +}, + + } diff --git a/data/conf/samples/ers_internal/cgrates.json b/data/conf/samples/ers_internal/cgrates.json index a6f93afd5..563d94419 100644 --- a/data/conf/samples/ers_internal/cgrates.json +++ b/data/conf/samples/ers_internal/cgrates.json @@ -77,22 +77,6 @@ "ers": { "enabled": true, "sessions_conns": ["*internal"], - "templates": { - "reqFields": [ - {"tag": "Source", "path": "*cgreq.Source", "type": "*constant", "value": "ers_template_combined", "mandatory": true}, - {"tag": "ToR", "path": "*cgreq.ToR", "type": "*variable", "value": "~*req.2", "mandatory": true}, - {"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable", "value": "~*req.3", "mandatory": true}, - {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*variable", "value": "~*req.4", "mandatory": true}, - {"tag": "Tenant", "path": "*cgreq.Tenant", "type": "*variable", "value": "~*req.6", "mandatory": true}, - {"tag": "Category", "path": "*cgreq.Category", "type": "*variable", "value": "~*req.7", "mandatory": true}, - {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.8", "mandatory": true}, - {"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.9", "mandatory": true}, - {"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.10", "mandatory": true}, - {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.11", "mandatory": true}, - {"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.12", "mandatory": true}, - {"tag": "Usage", "path": "*cgreq.Usage", "type": "*variable", "value": "~*req.13", "mandatory": true} - ], - }, "readers": [ { "id": "file_reader1", @@ -405,6 +389,24 @@ }, +"templates": { + "reqFields": [ + {"tag": "Source", "path": "*cgreq.Source", "type": "*constant", "value": "ers_template_combined", "mandatory": true}, + {"tag": "ToR", "path": "*cgreq.ToR", "type": "*variable", "value": "~*req.2", "mandatory": true}, + {"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable", "value": "~*req.3", "mandatory": true}, + {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*variable", "value": "~*req.4", "mandatory": true}, + {"tag": "Tenant", "path": "*cgreq.Tenant", "type": "*variable", "value": "~*req.6", "mandatory": true}, + {"tag": "Category", "path": "*cgreq.Category", "type": "*variable", "value": "~*req.7", "mandatory": true}, + {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.8", "mandatory": true}, + {"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.9", "mandatory": true}, + {"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.10", "mandatory": true}, + {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.11", "mandatory": true}, + {"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.12", "mandatory": true}, + {"tag": "Usage", "path": "*cgreq.Usage", "type": "*variable", "value": "~*req.13", "mandatory": true} + ], +}, + + "apiers": { "enabled": true, "scheduler_conns": ["*internal"], diff --git a/data/conf/samples/ers_mongo/cgrates.json b/data/conf/samples/ers_mongo/cgrates.json index da34efe55..106c1eb1d 100644 --- a/data/conf/samples/ers_mongo/cgrates.json +++ b/data/conf/samples/ers_mongo/cgrates.json @@ -78,22 +78,6 @@ "ers": { "enabled": true, "sessions_conns": ["*internal"], - "templates": { - "reqFields": [ - {"tag": "Source", "path": "*cgreq.Source", "type": "*constant", "value": "ers_template_combined", "mandatory": true}, - {"tag": "ToR", "path": "*cgreq.ToR", "type": "*variable", "value": "~*req.2", "mandatory": true}, - {"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable", "value": "~*req.3", "mandatory": true}, - {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*variable", "value": "~*req.4", "mandatory": true}, - {"tag": "Tenant", "path": "*cgreq.Tenant", "type": "*variable", "value": "~*req.6", "mandatory": true}, - {"tag": "Category", "path": "*cgreq.Category", "type": "*variable", "value": "~*req.7", "mandatory": true}, - {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.8", "mandatory": true}, - {"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.9", "mandatory": true}, - {"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.10", "mandatory": true}, - {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.11", "mandatory": true}, - {"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.12", "mandatory": true}, - {"tag": "Usage", "path": "*cgreq.Usage", "type": "*variable", "value": "~*req.13", "mandatory": true} - ], - }, "readers": [ { "id": "file_reader1", @@ -406,6 +390,24 @@ }, +"templates": { + "reqFields": [ + {"tag": "Source", "path": "*cgreq.Source", "type": "*constant", "value": "ers_template_combined", "mandatory": true}, + {"tag": "ToR", "path": "*cgreq.ToR", "type": "*variable", "value": "~*req.2", "mandatory": true}, + {"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable", "value": "~*req.3", "mandatory": true}, + {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*variable", "value": "~*req.4", "mandatory": true}, + {"tag": "Tenant", "path": "*cgreq.Tenant", "type": "*variable", "value": "~*req.6", "mandatory": true}, + {"tag": "Category", "path": "*cgreq.Category", "type": "*variable", "value": "~*req.7", "mandatory": true}, + {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.8", "mandatory": true}, + {"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.9", "mandatory": true}, + {"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.10", "mandatory": true}, + {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.11", "mandatory": true}, + {"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.12", "mandatory": true}, + {"tag": "Usage", "path": "*cgreq.Usage", "type": "*variable", "value": "~*req.13", "mandatory": true} + ], +}, + + "apiers": { "enabled": true, "scheduler_conns": ["*internal"], diff --git a/data/conf/samples/ers_mysql/cgrates.json b/data/conf/samples/ers_mysql/cgrates.json index 4e31e172b..73e9d40c9 100644 --- a/data/conf/samples/ers_mysql/cgrates.json +++ b/data/conf/samples/ers_mysql/cgrates.json @@ -75,22 +75,6 @@ "ers": { "enabled": true, "sessions_conns": ["*internal"], - "templates": { - "reqFields": [ - {"tag": "Source", "path": "*cgreq.Source", "type": "*constant", "value": "ers_template_combined", "mandatory": true}, - {"tag": "ToR", "path": "*cgreq.ToR", "type": "*variable", "value": "~*req.2", "mandatory": true}, - {"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable", "value": "~*req.3", "mandatory": true}, - {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*variable", "value": "~*req.4", "mandatory": true}, - {"tag": "Tenant", "path": "*cgreq.Tenant", "type": "*variable", "value": "~*req.6", "mandatory": true}, - {"tag": "Category", "path": "*cgreq.Category", "type": "*variable", "value": "~*req.7", "mandatory": true}, - {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.8", "mandatory": true}, - {"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.9", "mandatory": true}, - {"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.10", "mandatory": true}, - {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.11", "mandatory": true}, - {"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.12", "mandatory": true}, - {"tag": "Usage", "path": "*cgreq.Usage", "type": "*variable", "value": "~*req.13", "mandatory": true} - ], - }, "readers": [ { "id": "file_reader1", @@ -403,6 +387,24 @@ }, +"templates": { + "reqFields": [ + {"tag": "Source", "path": "*cgreq.Source", "type": "*constant", "value": "ers_template_combined", "mandatory": true}, + {"tag": "ToR", "path": "*cgreq.ToR", "type": "*variable", "value": "~*req.2", "mandatory": true}, + {"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable", "value": "~*req.3", "mandatory": true}, + {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*variable", "value": "~*req.4", "mandatory": true}, + {"tag": "Tenant", "path": "*cgreq.Tenant", "type": "*variable", "value": "~*req.6", "mandatory": true}, + {"tag": "Category", "path": "*cgreq.Category", "type": "*variable", "value": "~*req.7", "mandatory": true}, + {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.8", "mandatory": true}, + {"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.9", "mandatory": true}, + {"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.10", "mandatory": true}, + {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.11", "mandatory": true}, + {"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.12", "mandatory": true}, + {"tag": "Usage", "path": "*cgreq.Usage", "type": "*variable", "value": "~*req.13", "mandatory": true} + ], +}, + + "apiers": { "enabled": true, "scheduler_conns": ["*internal"], diff --git a/data/conf/samples/ers_postgres/cgrates.json b/data/conf/samples/ers_postgres/cgrates.json index 488c07cb8..d0278221e 100644 --- a/data/conf/samples/ers_postgres/cgrates.json +++ b/data/conf/samples/ers_postgres/cgrates.json @@ -72,22 +72,6 @@ "ers": { "enabled": true, "sessions_conns": ["*internal"], - "templates": { - "reqFields": [ - {"tag": "Source", "path": "*cgreq.Source", "type": "*constant", "value": "ers_template_combined", "mandatory": true}, - {"tag": "ToR", "path": "*cgreq.ToR", "type": "*variable", "value": "~*req.2", "mandatory": true}, - {"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable", "value": "~*req.3", "mandatory": true}, - {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*variable", "value": "~*req.4", "mandatory": true}, - {"tag": "Tenant", "path": "*cgreq.Tenant", "type": "*variable", "value": "~*req.6", "mandatory": true}, - {"tag": "Category", "path": "*cgreq.Category", "type": "*variable", "value": "~*req.7", "mandatory": true}, - {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.8", "mandatory": true}, - {"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.9", "mandatory": true}, - {"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.10", "mandatory": true}, - {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.11", "mandatory": true}, - {"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.12", "mandatory": true}, - {"tag": "Usage", "path": "*cgreq.Usage", "type": "*variable", "value": "~*req.13", "mandatory": true} - ], - }, "readers": [ { "id": "file_reader1", @@ -400,6 +384,24 @@ }, +"templates": { + "reqFields": [ + {"tag": "Source", "path": "*cgreq.Source", "type": "*constant", "value": "ers_template_combined", "mandatory": true}, + {"tag": "ToR", "path": "*cgreq.ToR", "type": "*variable", "value": "~*req.2", "mandatory": true}, + {"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable", "value": "~*req.3", "mandatory": true}, + {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*variable", "value": "~*req.4", "mandatory": true}, + {"tag": "Tenant", "path": "*cgreq.Tenant", "type": "*variable", "value": "~*req.6", "mandatory": true}, + {"tag": "Category", "path": "*cgreq.Category", "type": "*variable", "value": "~*req.7", "mandatory": true}, + {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.8", "mandatory": true}, + {"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.9", "mandatory": true}, + {"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.10", "mandatory": true}, + {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.11", "mandatory": true}, + {"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.12", "mandatory": true}, + {"tag": "Usage", "path": "*cgreq.Usage", "type": "*variable", "value": "~*req.13", "mandatory": true} + ], +}, + + "apiers": { "enabled": true, "scheduler_conns": ["*internal"], diff --git a/docs/diamagent.rst b/docs/diamagent.rst index 3de460fcf..ee64741e0 100644 --- a/docs/diamagent.rst +++ b/docs/diamagent.rst @@ -38,110 +38,7 @@ With explanations in the comments: "product_name": "CGRateS", // diameter Product-Name AVP used in replies "concurrent_requests": -1, // limit the number of active requests processed by the server <-1|0-n> "synced_conn_requests": false, // process one request at the time per connection - "asr_template": "*asr", // enable AbortSession message being sent to client - // forcing session disconnection from CGRateS side - "templates":{ // message templates which can be injected within request/replies - "*err": [ // *err is used mostly in automatic diameter replies with errors - { - "tag": "SessionId", "path": "*rep.Session-Id", - "type": "*variable", "mandatory": true, - "value": "~*req.Session-Id" - }, - { - "tag": "OriginHost", "path": "*rep.Origin-Host", - "type": "*variable", "mandatory": true, - "value": "~*vars.OriginHost" - }, - { - "tag": "OriginRealm", "path": "*rep.Origin-Realm", - "type": "*variable", "mandatory": true, - "value": "~*vars.OriginRealm" - }, - ], - "*cca": [ // *cca is used into CallControlAnswer messages - { - "tag": "SessionId", "path": "*rep.Session-Id", - "type": "*composed", "mandatory": true, - "value": "~*req.Session-Id" - }, - { - "tag": "ResultCode", "path": "*rep.Result-Code", - "type": "*constant", "value": "2001"}, - { - "tag": "OriginHost", "path": "*rep.Origin-Host", - "type": "*variable", "mandatory": true, - "value": "~*vars.OriginHost" - }, - { - "tag": "OriginRealm", "path": "*rep.Origin-Realm", - "type": "*variable", "mandatory": true, - "value": "~*vars.OriginRealm" - }, - { - "tag": "AuthApplicationId", - "path": "rep.Auth-Application-Id", - "type": "*variable", "mandatory": true, - "value": "~*vars.*appid" - }, - { - "tag": "CCRequestType", - "path": "*rep.CC-Request-Type", - "type": "*variable", "mandatory": true, - "value": "~*req.CC-Request-Type" - }, - { - "tag": "CCRequestNumber", - "path": "*rep.CC-Request-Number", - "type": "*variable", "mandatory": true, - "value": "~*req.CC-Request-Number" - }, - ], - "*asr": [ // *asr is used to build AbortSessionRequest - { - "tag": "SessionId", "path": "*diamreq.Session-Id", - "type": "*variable", "mandatory": true, - "value": "~*req.Session-Id" - }, - { - "tag": "OriginHost", "path": "diamreq.Origin-Host", - "type": "*variable", "mandatory": true, - "value": "~*req.Destination-Host" - }, - { - "tag": "OriginRealm", "path": "diamreq.Origin-Realm", - "type": "*variable", "mandatory": true, - "value": "~*req.Destination-Realm" - }, - { - "tag": "DestinationRealm", - "path": "*diamreq.Destination-Realm", - "type": "*variable", "mandatory": true, - "value": "~*req.Origin-Realm" - }, - { - "tag": "DestinationHost", - "path": "*diamreq.Destination-Host", - "type": "*variable", "mandatory": true, - "value": "~*req.Origin-Host" - }, - { - "tag": "AuthApplicationId", - "path": "*diamreq.Auth-Application-Id", - "type": "*variable", "mandatory": true, - "value": "~*vars.*appid" - }, - { - "tag": "UserName", "path": "*diamreq.User-Name", - "type": "*variable", "mandatory": true, - "value": "~*req.User-Name" - }, - { - "tag": "OriginStateID", - "path": "*diamreq.Origin-State-Id", - "type": "*constant", "value": "1" - } - ] - }, + "asr_template": "*asr", // enable AbortSession message being sent to client "request_processors": [ // decision logic for message processing { "id": "SMSes", // id is used for debug in logs (ie: using *log flag)