From 55980e053683dbdc21f8b625cdd21d972709b160 Mon Sep 17 00:00:00 2001 From: DanB Date: Sun, 29 Jan 2017 20:53:11 +0100 Subject: [PATCH] Configuration change - http_failed_dir -> failed_requests_dir --- config/config.go | 6 +- config/config_defaults.go | 68 +- config/config_json_test.go | 2 +- config/config_test.go | 4 +- config/libconfig_json.go | 2 +- data/conf/cgrates/cgrates.json | 792 +++++++++--------- .../cgrates/etc/cgrates/cgrates.json | 1 - engine/action.go | 12 +- engine/cdrs.go | 2 +- general_tests/cdrs_replication_it_test.go | 6 +- packages/jessie/rules | 2 +- packages/redhat_fedora/cgrates.spec | 2 +- packages/squeeze/rules | 2 +- utils/consts.go | 1 + utils/httpclient.go | 2 +- 15 files changed, 467 insertions(+), 437 deletions(-) diff --git a/config/config.go b/config/config.go index f89e53358..622a52d07 100644 --- a/config/config.go +++ b/config/config.go @@ -221,7 +221,7 @@ type CGRConfig struct { HttpSkipTlsVerify bool // If enabled Http Client will accept any TLS certificate TpExportPath string // Path towards export folder for offline Tariff Plans HttpPosterAttempts int - HttpFailedDir string // Directory path where we store failed http requests + FailedRequestsDir string // Directory path where we store failed http requests MaxCallDuration time.Duration // The maximum call duration (used by responder when querying DerivedCharging) // ToDo: export it in configuration file LockingTimeout time.Duration // locking mechanism timeout to avoid deadlocks LogLevel int // system wide log level, nothing higher than this will be logged @@ -757,8 +757,8 @@ func (self *CGRConfig) loadFromJsonCfg(jsnCfg *CgrJsonCfg) error { if jsnGeneralCfg.Httpposter_attempts != nil { self.HttpPosterAttempts = *jsnGeneralCfg.Httpposter_attempts } - if jsnGeneralCfg.Http_failed_dir != nil { - self.HttpFailedDir = *jsnGeneralCfg.Http_failed_dir + if jsnGeneralCfg.Failed_requests_dir != nil { + self.FailedRequestsDir = *jsnGeneralCfg.Failed_requests_dir } if jsnGeneralCfg.Default_timezone != nil { self.DefaultTimezone = *jsnGeneralCfg.Default_timezone diff --git a/config/config_defaults.go b/config/config_defaults.go index cd17942d7..a5b30ddfd 100644 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -27,44 +27,44 @@ const CGRATES_CFG_JSON = ` // This is what you get when you load CGRateS with an empty configuration file. "general": { - "instance_id": "", // identifier of this instance in the cluster, if empty it will be autogenerated - "log_level": 6, // control the level of messages logged (0-emerg to 7-debug) - "http_skip_tls_verify": false, // if enabled Http Client will accept any TLS certificate - "rounding_decimals": 5, // system level precision for floats - "dbdata_encoding": "msgpack", // encoding used to store object data in strings: - "tpexport_dir": "/var/spool/cgrates/tpe", // path towards export folder for offline Tariff Plans - "httpposter_attempts": 3, // number of http attempts before considering request failed (eg: *call_url) - "http_failed_dir": "/var/spool/cgrates/http_failed", // directory path where we store failed http requests - "default_request_type": "*rated", // default request type to consider when missing from requests: <""|*prepaid|*postpaid|*pseudoprepaid|*rated> - "default_category": "call", // default category to consider when missing from requests - "default_tenant": "cgrates.org", // default tenant to consider when missing from requests - "default_timezone": "Local", // default timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB> - "connect_attempts": 3, // initial server connect attempts - "reconnects": -1, // number of retries in case of connection lost - "connect_timeout": "1s", // consider connection unsuccessful on timeout, 0 to disable the feature - "reply_timeout": "2s", // consider connection down for replies taking longer than this value - "response_cache_ttl": "0s", // the life span of a cached response - "internal_ttl": "2m", // maximum duration to wait for internal connections before giving up - "locking_timeout": "5s", // timeout internal locks to avoid deadlocks + "instance_id": "", // identifier of this instance in the cluster, if empty it will be autogenerated + "log_level": 6, // control the level of messages logged (0-emerg to 7-debug) + "http_skip_tls_verify": false, // if enabled Http Client will accept any TLS certificate + "rounding_decimals": 5, // system level precision for floats + "dbdata_encoding": "msgpack", // encoding used to store object data in strings: + "tpexport_dir": "/var/spool/cgrates/tpe", // path towards export folder for offline Tariff Plans + "httpposter_attempts": 3, // number of http attempts before considering request failed (eg: *call_url) + "failed_requests_dir": "/var/spool/cgrates/failed_requests", // directory path where we store failed requests + "default_request_type": "*rated", // default request type to consider when missing from requests: <""|*prepaid|*postpaid|*pseudoprepaid|*rated> + "default_category": "call", // default category to consider when missing from requests + "default_tenant": "cgrates.org", // default tenant to consider when missing from requests + "default_timezone": "Local", // default timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB> + "connect_attempts": 3, // initial server connect attempts + "reconnects": -1, // number of retries in case of connection lost + "connect_timeout": "1s", // consider connection unsuccessful on timeout, 0 to disable the feature + "reply_timeout": "2s", // consider connection down for replies taking longer than this value + "response_cache_ttl": "0s", // the life span of a cached response + "internal_ttl": "2m", // maximum duration to wait for internal connections before giving up + "locking_timeout": "5s", // timeout internal locks to avoid deadlocks }, "cache":{ - "destinations": {"limit": 10000, "ttl":"0s", "precache": false}, - "reverse_destinations": {"limit": 10000, "ttl":"0s", "precache": false}, - "rating_plans": {"limit": 10000, "ttl":"0s","precache": true}, - "rating_profiles": {"limit": 10000, "ttl":"0s", "precache": false}, - "lcr": {"limit": 10000, "ttl":"0s", "precache": false}, - "cdr_stats": {"limit": 10000, "ttl":"0s", "precache": false}, - "actions": {"limit": 10000, "ttl":"0s", "precache": false}, - "action_plans": {"limit": 10000, "ttl":"0s", "precache": false}, - "account_action_plans": {"limit": 10000, "ttl":"0s", "precache": false}, - "action_triggers": {"limit": 10000, "ttl":"0s", "precache": false}, - "shared_groups": {"limit": 10000, "ttl":"0s", "precache": false}, - "aliases": {"limit": 10000, "ttl":"0s", "precache": false}, - "reverse_aliases": {"limit": 10000, "ttl":"0s", "precache": false}, - "derived_chargers": {"limit": 10000, "ttl":"0s", "precache": false}, - "resource_limits": {"limit": 10000, "ttl":"0s", "precache": false}, + "destinations": {"limit": 10000, "ttl":"0s", "precache": false}, // control destination caching + "reverse_destinations": {"limit": 10000, "ttl":"0s", "precache": false}, // control reverse destinations index caching + "rating_plans": {"limit": 10000, "ttl":"0s","precache": true}, // control rating plans caching + "rating_profiles": {"limit": 10000, "ttl":"0s", "precache": false}, // control rating profiles caching + "lcr": {"limit": 10000, "ttl":"0s", "precache": false}, // control lcr rules caching + "cdr_stats": {"limit": 10000, "ttl":"0s", "precache": false}, // control cdr stats queues caching + "actions": {"limit": 10000, "ttl":"0s", "precache": false}, // control actions caching + "action_plans": {"limit": 10000, "ttl":"0s", "precache": false}, // control action plans caching + "account_action_plans": {"limit": 10000, "ttl":"0s", "precache": false}, // control account action plans index caching + "action_triggers": {"limit": 10000, "ttl":"0s", "precache": false}, // control action triggers caching + "shared_groups": {"limit": 10000, "ttl":"0s", "precache": false}, // control shared groups caching + "aliases": {"limit": 10000, "ttl":"0s", "precache": false}, // control aliases caching + "reverse_aliases": {"limit": 10000, "ttl":"0s", "precache": false}, // control reverse aliases index caching + "derived_chargers": {"limit": 10000, "ttl":"0s", "precache": false}, // control derived charging rule caching + "resource_limits": {"limit": 10000, "ttl":"0s", "precache": false}, // control resource limits caching }, diff --git a/config/config_json_test.go b/config/config_json_test.go index c91ef8c5d..c9b7482d0 100644 --- a/config/config_json_test.go +++ b/config/config_json_test.go @@ -45,7 +45,7 @@ func TestDfGeneralJsonCfg(t *testing.T) { Dbdata_encoding: utils.StringPointer("msgpack"), Tpexport_dir: utils.StringPointer("/var/spool/cgrates/tpe"), Httpposter_attempts: utils.IntPointer(3), - Http_failed_dir: utils.StringPointer("/var/spool/cgrates/http_failed"), + Failed_requests_dir: utils.StringPointer("/var/spool/cgrates/failed_requests"), Default_request_type: utils.StringPointer(utils.META_RATED), Default_category: utils.StringPointer("call"), Default_tenant: utils.StringPointer("cgrates.org"), diff --git a/config/config_test.go b/config/config_test.go index abc9b23f9..433900100 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -154,8 +154,8 @@ func TestCgrCfgJSONDefaultsGeneral(t *testing.T) { if cgrCfg.HttpPosterAttempts != 3 { t.Error(cgrCfg.HttpPosterAttempts) } - if cgrCfg.HttpFailedDir != "/var/spool/cgrates/http_failed" { - t.Error(cgrCfg.HttpFailedDir) + if cgrCfg.FailedRequestsDir != "/var/spool/cgrates/failed_requests" { + t.Error(cgrCfg.FailedRequestsDir) } if cgrCfg.DefaultReqType != "*rated" { t.Error(cgrCfg.DefaultReqType) diff --git a/config/libconfig_json.go b/config/libconfig_json.go index acefb5fe4..412857773 100644 --- a/config/libconfig_json.go +++ b/config/libconfig_json.go @@ -26,7 +26,7 @@ type GeneralJsonCfg struct { Dbdata_encoding *string Tpexport_dir *string Httpposter_attempts *int - Http_failed_dir *string + Failed_requests_dir *string Default_request_type *string Default_category *string Default_tenant *string diff --git a/data/conf/cgrates/cgrates.json b/data/conf/cgrates/cgrates.json index 980d7570c..298c7368b 100644 --- a/data/conf/cgrates/cgrates.json +++ b/data/conf/cgrates/cgrates.json @@ -6,440 +6,466 @@ // This file contains the default configuration hardcoded into CGRateS. // This is what you get when you load CGRateS with an empty configuration file. -//"general": { -// "http_skip_tls_verify": false, // if enabled Http Client will accept any TLS certificate -// "rounding_decimals": 5, // system level precision for floats -// "dbdata_encoding": "msgpack", // encoding used to store object data in strings: -// "tpexport_dir": "/var/spool/cgrates/tpe", // path towards export folder for offline Tariff Plans -// "httpposter_attempts": 3, // number of http attempts before considering request failed (eg: *call_url) -// "http_failed_dir": "/var/spool/cgrates/http_failed", // directory path where we store failed http requests -// "default_request_type": "*rated", // default request type to consider when missing from requests: <""|*prepaid|*postpaid|*pseudoprepaid|*rated> -// "default_category": "call", // default category to consider when missing from requests -// "default_tenant": "cgrates.org", // default tenant to consider when missing from requests -// "default_timezone": "Local", // default timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB> -// "connect_attempts": 3, // initial server connect attempts -// "reconnects": -1, // number of retries in case of connection lost -// "connect_timeout": "1s", // consider connection unsuccessful on timeout, 0 to disable the feature -// "reply_timeout": "2s", // consider connection down for replies taking longer than this value -// "response_cache_ttl": "0s", // the life span of a cached response -// "internal_ttl": "2m", // maximum duration to wait for internal connections before giving up -// "locking_timeout": "5s", // timeout internal locks to avoid deadlocks -// "cache_dump_dir": "", // cache dump for faster start (leave empty to disable) -// "log_level": 6, // control the level of messages logged (0-emerg to 7-debug) -//}, +// "general": { +// "instance_id": "", // identifier of this instance in the cluster, if empty it will be autogenerated +// "log_level": 6, // control the level of messages logged (0-emerg to 7-debug) +// "http_skip_tls_verify": false, // if enabled Http Client will accept any TLS certificate +// "rounding_decimals": 5, // system level precision for floats +// "dbdata_encoding": "msgpack", // encoding used to store object data in strings: +// "tpexport_dir": "/var/spool/cgrates/tpe", // path towards export folder for offline Tariff Plans +// "httpposter_attempts": 3, // number of http attempts before considering request failed (eg: *call_url) +// "failed_requests_dir": "/var/spool/cgrates/failed_requests", // directory path where we store failed requests +// "default_request_type": "*rated", // default request type to consider when missing from requests: <""|*prepaid|*postpaid|*pseudoprepaid|*rated> +// "default_category": "call", // default category to consider when missing from requests +// "default_tenant": "cgrates.org", // default tenant to consider when missing from requests +// "default_timezone": "Local", // default timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB> +// "connect_attempts": 3, // initial server connect attempts +// "reconnects": -1, // number of retries in case of connection lost +// "connect_timeout": "1s", // consider connection unsuccessful on timeout, 0 to disable the feature +// "reply_timeout": "2s", // consider connection down for replies taking longer than this value +// "response_cache_ttl": "0s", // the life span of a cached response +// "internal_ttl": "2m", // maximum duration to wait for internal connections before giving up +// "locking_timeout": "5s", // timeout internal locks to avoid deadlocks +// }, -//"cache":{ -// "destinations": {"limit": 10000, "ttl":"0s", "precache": false}, -// "reverse_destinations": {"limit": 10000, "ttl":"0s", "precache": false}, -// "rating_plans": {"limit": 10000, "ttl":"0s","precache": true}, -// "rating//_profiles": {"limit": 10000, "ttl":"0s", "precache": false}, -// "lcr": //{"limit": 10000, "ttl":"0s", "precache": false}, -// "cdr_stats": {"limit": 10000, "ttl":"0s", "precache": false}, -// "actions": {"limit": 10000, "ttl":"0s", "precache": false}, -// "action_plans": {"limit": 10000, "ttl":"0s", "precache": false}, -// "action_triggers": {"limit": 10000, "ttl":"0s", "precache": false}, -// "shared_groups": {"limit": 10000, "ttl":"0s", "precache": false}, -// "aliases": {"limit": 10000, "ttl":"0s", "precache": false}, -// "reverse_aliases": {"limit": 10000, "ttl":"0s", "precache": false}, -//}, +// "cache":{ +// "destinations": {"limit": 10000, "ttl":"0s", "precache": false}, // control destination caching +// "reverse_destinations": {"limit": 10000, "ttl":"0s", "precache": false}, // control reverse destinations index caching +// "rating_plans": {"limit": 10000, "ttl":"0s","precache": true}, // control rating plans caching +// "rating_profiles": {"limit": 10000, "ttl":"0s", "precache": false}, // control rating profiles caching +// "lcr": {"limit": 10000, "ttl":"0s", "precache": false}, // control lcr rules caching +// "cdr_stats": {"limit": 10000, "ttl":"0s", "precache": false}, // control cdr stats queues caching +// "actions": {"limit": 10000, "ttl":"0s", "precache": false}, // control actions caching +// "action_plans": {"limit": 10000, "ttl":"0s", "precache": false}, // control action plans caching +// "account_action_plans": {"limit": 10000, "ttl":"0s", "precache": false}, // control account action plans index caching +// "action_triggers": {"limit": 10000, "ttl":"0s", "precache": false}, // control action triggers caching +// "shared_groups": {"limit": 10000, "ttl":"0s", "precache": false}, // control shared groups caching +// "aliases": {"limit": 10000, "ttl":"0s", "precache": false}, // control aliases caching +// "reverse_aliases": {"limit": 10000, "ttl":"0s", "precache": false}, // control reverse aliases index caching +// "derived_chargers": {"limit": 10000, "ttl":"0s", "precache": false}, // control derived charging rule caching +// "resource_limits": {"limit": 10000, "ttl":"0s", "precache": false}, // control resource limits caching +// }, -//"listen": { -// "rpc_json": "127.0.0.1:2012", // RPC JSON listening address -// "rpc_gob": "127.0.0.1:2013", // RPC GOB listening address -// "http": "127.0.0.1:2080", // HTTP listening address -//}, +// "listen": { +// "rpc_json": "127.0.0.1:2012", // RPC JSON listening address +// "rpc_gob": "127.0.0.1:2013", // RPC GOB listening address +// "http": "127.0.0.1:2080", // HTTP listening address +// }, -//"http": { // HTTP server configuration -// "json_rpc_url": "/jsonrpc" // JSON RPC relative URL ("" to disable) -// "ws_url": "/ws", // WebSockets relative URL ("" to disable) -// "use_basic_auth": false, // use basic authentication -// "auth_users": {} // basic authentication usernames and base64-encoded passwords (eg: { "username1": "cGFzc3dvcmQ=", "username2": "cGFzc3dvcmQy "}) -//}, +// "http": { // HTTP server configuration +// "json_rpc_url": "/jsonrpc", // JSON RPC relative URL ("" to disable) +// "ws_url": "/ws", // WebSockets relative URL ("" to disable) +// "use_basic_auth": false, // use basic authentication +// "auth_users": {} // basic authentication usernames and base64-encoded passwords (eg: { "username1": "cGFzc3dvcmQ=", "username2": "cGFzc3dvcmQy "}) +// }, -//"tariffplan_db": { // database used to store active tariff plan configuration -// "db_type": "redis", // tariffplan_db type: -// "db_host": "127.0.0.1", // tariffplan_db host address -// "db_port": 6379, // port to reach the tariffplan_db -// "db_name": "10", // tariffplan_db name to connect to -// "db_user": "", // sername to use when connecting to tariffplan_db -// "db_password": "", // password to use when connecting to tariffplan_db -//}, +// "tariffplan_db": { // database used to store active tariff plan configuration +// "db_type": "redis", // tariffplan_db type: +// "db_host": "127.0.0.1", // tariffplan_db host address +// "db_port": 6379, // port to reach the tariffplan_db +// "db_name": "10", // tariffplan_db name to connect to +// "db_user": "", // sername to use when connecting to tariffplan_db +// "db_password": "", // password to use when connecting to tariffplan_db +// }, -//"data_db": { // database used to store runtime data (eg: accounts, cdr stats) -// "db_type": "redis", // data_db type: -// "db_host": "127.0.0.1", // data_db host address -// "db_port": 6379, // data_db port to reach the database -// "db_name": "11", // data_db database name to connect to -// "db_user": "", // username to use when connecting to data_db -// "db_password": "", // password to use when connecting to data_db -// "load_history_size": 10, // Number of records in the load history -//}, +// "data_db": { // database used to store runtime data (eg: accounts, cdr stats) +// "db_type": "redis", // data_db type: +// "db_host": "127.0.0.1", // data_db host address +// "db_port": 6379, // data_db port to reach the database +// "db_name": "11", // data_db database name to connect to +// "db_user": "", // username to use when connecting to data_db +// "db_password": "", // password to use when connecting to data_db +// "load_history_size": 10, // Number of records in the load history +// }, -//"stor_db": { // database used to store offline tariff plans and CDRs -// "db_type": "mysql", // stor database type to use: -// "db_host": "127.0.0.1", // the host to connect to -// "db_port": 3306, // the port to reach the stordb -// "db_name": "cgrates", // stor database name -// "db_user": "cgrates", // username to use when connecting to stordb -// "db_password": "CGRateS.org", // password to use when connecting to stordb -// "max_open_conns": 100, // maximum database connections opened -// "max_idle_conns": 10, // maximum database connections idle -// "cdrs_indexes": [], // indexes on cdrs table to speed up queries, used only in case of mongo -//}, +// "stor_db": { // database used to store offline tariff plans and CDRs +// "db_type": "mysql", // stor database type to use: +// "db_host": "127.0.0.1", // the host to connect to +// "db_port": 3306, // the port to reach the stordb +// "db_name": "cgrates", // stor database name +// "db_user": "cgrates", // username to use when connecting to stordb +// "db_password": "CGRateS.org", // password to use when connecting to stordb +// "max_open_conns": 100, // maximum database connections opened +// "max_idle_conns": 10, // maximum database connections idle +// "cdrs_indexes": [], // indexes on cdrs table to speed up queries, used only in case of mongo +// }, -//"balancer": { -// "enabled": false, // start Balancer service: -//}, +// "balancer": { +// "enabled": false, // start Balancer service: +// }, -//"rals": { -// "enabled": false, // enable Rater service: -// "balancer": "", // register to balancer as worker: <""|*internal|x.y.z.y:1234> -// "cdrstats_conns": [], // address where to reach the cdrstats service, empty to disable stats functionality: <""|*internal|x.y.z.y:1234> -// "historys_conns": [], // address where to reach the history service, empty to disable history functionality: <""|*internal|x.y.z.y:1234> -// "pubsubs_conns": [], // address where to reach the pubusb service, empty to disable pubsub functionality: <""|*internal|x.y.z.y:1234> -// "users_conns": [], // address where to reach the user service, empty to disable user profile functionality: <""|*internal|x.y.z.y:1234> -// "aliases_conns": [], // address where to reach the aliases service, empty to disable aliases functionality: <""|*internal|x.y.z.y:1234> -// "rp_subject_prefix_matching": false, // enables prefix matching for the rating profile subject -// "lcr_subject_prefix_matching": false // enables prefix matching for the lcr subject -//}, +// "rals": { +// "enabled": false, // enable Rater service: +// "balancer": "", // register to balancer as worker: <""|*internal|x.y.z.y:1234> +// "cdrstats_conns": [], // address where to reach the cdrstats service, empty to disable stats functionality: <""|*internal|x.y.z.y:1234> +// "historys_conns": [], // address where to reach the history service, empty to disable history functionality: <""|*internal|x.y.z.y:1234> +// "pubsubs_conns": [], // address where to reach the pubusb service, empty to disable pubsub functionality: <""|*internal|x.y.z.y:1234> +// "users_conns": [], // address where to reach the user service, empty to disable user profile functionality: <""|*internal|x.y.z.y:1234> +// "aliases_conns": [], // address where to reach the aliases service, empty to disable aliases functionality: <""|*internal|x.y.z.y:1234> +// "rp_subject_prefix_matching": false, // enables prefix matching for the rating profile subject +// "lcr_subject_prefix_matching": false // enables prefix matching for the lcr subject +// }, -//"scheduler": { -// "enabled": false, // start Scheduler service: -//}, +// "scheduler": { +// "enabled": false, // start Scheduler service: +// }, -//"cdrs": { -// "enabled": false, // start the CDR Server service: -// "extra_fields": [], // extra fields to store in CDRs for non-generic CDRs -// "store_cdrs": true, // store cdrs in storDb -// "cdr_account_summary": false, // add account information from dataDB -// "sm_cost_retries": 5, // number of queries to sm_costs before recalculating CDR -// "rals_conns": [ -// {"address": "*internal"} // address where to reach the Rater for cost calculation, empty to disable functionality: <""|*internal|x.y.z.y:1234> -// ], -// "pubsubs_conns": [], // address where to reach the pubusb service, empty to disable pubsub functionality: <""|*internal|x.y.z.y:1234> -// "users_conns": [], // address where to reach the user service, empty to disable user profile functionality: <""|*internal|x.y.z.y:1234> -// "aliases_conns": [], // address where to reach the aliases service, empty to disable aliases functionality: <""|*internal|x.y.z.y:1234> -// "cdrstats_conns": [], // address where to reach the cdrstats service, empty to disable stats functionality<""|*internal|x.y.z.y:1234> -// "cdr_replication":[], -//}, +// "cdrs": { +// "enabled": false, // start the CDR Server service: +// "extra_fields": [], // extra fields to store in CDRs for non-generic CDRs +// "store_cdrs": true, // store cdrs in storDb +// "cdr_account_summary": false, // add account information from dataDB +// "sm_cost_retries": 5, // number of queries to sm_costs before recalculating CDR +// "rals_conns": [ +// {"address": "*internal"} // address where to reach the Rater for cost calculation, empty to disable functionality: <""|*internal|x.y.z.y:1234> +// ], +// "pubsubs_conns": [], // address where to reach the pubusb service, empty to disable pubsub functionality: <""|*internal|x.y.z.y:1234> +// "users_conns": [], // address where to reach the user service, empty to disable user profile functionality: <""|*internal|x.y.z.y:1234> +// "aliases_conns": [], // address where to reach the aliases service, empty to disable aliases functionality: <""|*internal|x.y.z.y:1234> +// "cdrstats_conns": [], // address where to reach the cdrstats service, empty to disable stats functionality<""|*internal|x.y.z.y:1234> +// "cdr_replication":[ +// // { +// // "transport": "*http_post", // mechanism to use when replicating +// // "address": "http://127.0.0.1:12080/cdr_http", // address where to replicate +// // "attempts": 1, // number of attempts for POST before failing on file +// // "cdr_filter": "", // filter the CDRs being replicated +// // "content_fields": [ // template of the replicated content fields +// // {"tag": "CGRID", "type": "*composed", "value": "CGRID"}, +// // {"tag":"RunID", "type": "*composed", "value": "RunID"}, +// // {"tag":"TOR", "type": "*composed", "value": "ToR"}, +// // {"tag":"OriginID", "type": "*composed", "value": "OriginID"}, +// // {"tag":"RequestType", "type": "*composed", "value": "RequestType"}, +// // {"tag":"Direction", "type": "*composed", "value": "Direction"}, +// // {"tag":"Tenant", "type": "*composed", "value": "Tenant"}, +// // {"tag":"Category", "type": "*composed", "value": "Category"}, +// // {"tag":"Account", "type": "*composed", "value": "Account"}, +// // {"tag":"Subject", "type": "*composed", "value": "Subject"}, +// // {"tag":"Destination", "type": "*composed", "value": "Destination"}, +// // {"tag":"SetupTime", "type": "*composed", "value": "SetupTime", "layout": "2006-01-02T15:04:05Z07:00"}, +// // {"tag":"AnswerTime", "type": "*composed", "value": "AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"}, +// // {"tag":"Usage", "type": "*composed", "value": "Usage"}, +// // {"tag":"Cost", "type": "*composed", "value": "Cost"}, +// // ], +// // }, +// ] +// }, -//"cdrstats": { -// "enabled": false, // starts the cdrstats service: -// "save_interval": "1m", // interval to save changed stats into dataDb storage -//}, +// "cdrstats": { +// "enabled": false, // starts the cdrstats service: +// "save_interval": "1m", // interval to save changed stats into dataDb storage +// }, -//"cdrc": [ -// { -// "id": "*default", // identifier of the CDRC runner -// "enabled": false, // enable CDR client functionality -// "dry_run": false, // do not send the CDRs to CDRS, just parse them -// "cdrs_conns": [ -// {"address": "*internal"} // address where to reach CDR server. <*internal|x.y.z.y:1234> -// ], -// "cdr_format": "csv", // CDR file format -// "field_separator": ",", // separator used in case of csv files -// "timezone": "", // timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB> -// "run_delay": 0, // sleep interval in seconds between consecutive runs, 0 to use automation via inotify -// "max_open_files": 1024, // maximum simultaneous files to process, 0 for unlimited -// "data_usage_multiply_factor": 1024, // conversion factor for data usage -// "cdr_in_dir": "/var/spool/cgrates/cdrc/in", // absolute path towards the directory where the CDRs are stored -// "cdr_out_dir": "/var/spool/cgrates/cdrc/out", // absolute path towards the directory where processed CDRs will be moved -// "failed_calls_prefix": "missed_calls", // used in case of flatstore CDRs to avoid searching for BYE records -// "cdr_path": "", // path towards one CDR element in case of XML CDRs -// "cdr_source_id": "freeswitch_csv", // free form field, tag identifying the source of the CDRs within CDRS database -// "cdr_filter": "", // filter CDR records to import -// "continue_on_success": false, // continue to the next template if executed -// "partial_record_cache": "10s", // duration to cache partial records when not pairing -// "partial_cache_expiry_action": "*dump_to_file", // action taken when cache when records in cache are timed-out <*dump_to_file|*post_cdr> -// "header_fields": [], // template of the import header fields -// "content_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": "2", "mandatory": true}, -// {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "3", "mandatory": true}, -// {"tag": "RequestType", "field_id": "RequestType", "type": "*composed", "value": "4", "mandatory": true}, -// {"tag": "Direction", "field_id": "Direction", "type": "*composed", "value": "5", "mandatory": true}, -// {"tag": "Tenant", "field_id": "Tenant", "type": "*composed", "value": "6", "mandatory": true}, -// {"tag": "Category", "field_id": "Category", "type": "*composed", "value": "7", "mandatory": true}, -// {"tag": "Account", "field_id": "Account", "type": "*composed", "value": "8", "mandatory": true}, -// {"tag": "Subject", "field_id": "Subject", "type": "*composed", "value": "9", "mandatory": true}, -// {"tag": "Destination", "field_id": "Destination", "type": "*composed", "value": "10", "mandatory": true}, -// {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", "value": "11", "mandatory": true}, -// {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", "value": "12", "mandatory": true}, -// {"tag": "Usage", "field_id": "Usage", "type": "*composed", "value": "13", "mandatory": true}, -// ], -// "trailer_fields": [], // template of the import trailer fields -// "cache_dump_fields": [ -// {"tag": "CGRID", "type": "*composed", "value": "CGRID"}, -// {"tag": "RunID", "type": "*composed", "value": "RunID"}, -// {"tag": "TOR", "type": "*composed", "value": "ToR"}, -// {"tag": "OriginID", "type": "*composed", "value": "OriginID"}, -// {"tag": "RequestType", "type": "*composed", "value": "RequestType"}, -// {"tag": "Direction", "type": "*composed", "value": "Direction"}, -// {"tag": "Tenant", "type": "*composed", "value": "Tenant"}, -// {"tag": "Category", "type": "*composed", "value": "Category"}, -// {"tag": "Account", "type": "*composed", "value": "Account"}, -// {"tag": "Subject", "type": "*composed", "value": "Subject"}, -// {"tag": "Destination", "type": "*composed", "value": "Destination"}, -// {"tag": "SetupTime", "type": "*composed", "value": "SetupTime", "layout": "2006-01-02T15:04:05Z07:00"}, -// {"tag": "AnswerTime", "type": "*composed", "value": "AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"}, -// {"tag": "Usage", "type": "*composed", "value": "Usage"}, -// {"tag": "Cost", "type": "*composed", "value": "Cost"}, -// ], -// }, -//], +// "cdrc": [ +// { +// "id": "*default", // identifier of the CDRC runner +// "enabled": false, // enable CDR client functionality +// "dry_run": false, // do not send the CDRs to CDRS, just parse them +// "cdrs_conns": [ +// {"address": "*internal"} // address where to reach CDR server. <*internal|x.y.z.y:1234> +// ], +// "cdr_format": "csv", // CDR file format +// "field_separator": ",", // separator used in case of csv files +// "timezone": "", // timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB> +// "run_delay": 0, // sleep interval in seconds between consecutive runs, 0 to use automation via inotify +// "max_open_files": 1024, // maximum simultaneous files to process, 0 for unlimited +// "data_usage_multiply_factor": 1024, // conversion factor for data usage +// "cdr_in_dir": "/var/spool/cgrates/cdrc/in", // absolute path towards the directory where the CDRs are stored +// "cdr_out_dir": "/var/spool/cgrates/cdrc/out", // absolute path towards the directory where processed CDRs will be moved +// "failed_calls_prefix": "missed_calls", // used in case of flatstore CDRs to avoid searching for BYE records +// "cdr_path": "", // path towards one CDR element in case of XML CDRs +// "cdr_source_id": "freeswitch_csv", // free form field, tag identifying the source of the CDRs within CDRS database +// "cdr_filter": "", // filter CDR records to import +// "continue_on_success": false, // continue to the next template if executed +// "partial_record_cache": "10s", // duration to cache partial records when not pairing +// "partial_cache_expiry_action": "*dump_to_file", // action taken when cache when records in cache are timed-out <*dump_to_file|*post_cdr> +// "header_fields": [], // template of the import header fields +// "content_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": "2", "mandatory": true}, +// {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "3", "mandatory": true}, +// {"tag": "RequestType", "field_id": "RequestType", "type": "*composed", "value": "4", "mandatory": true}, +// {"tag": "Direction", "field_id": "Direction", "type": "*composed", "value": "5", "mandatory": true}, +// {"tag": "Tenant", "field_id": "Tenant", "type": "*composed", "value": "6", "mandatory": true}, +// {"tag": "Category", "field_id": "Category", "type": "*composed", "value": "7", "mandatory": true}, +// {"tag": "Account", "field_id": "Account", "type": "*composed", "value": "8", "mandatory": true}, +// {"tag": "Subject", "field_id": "Subject", "type": "*composed", "value": "9", "mandatory": true}, +// {"tag": "Destination", "field_id": "Destination", "type": "*composed", "value": "10", "mandatory": true}, +// {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", "value": "11", "mandatory": true}, +// {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", "value": "12", "mandatory": true}, +// {"tag": "Usage", "field_id": "Usage", "type": "*composed", "value": "13", "mandatory": true}, +// ], +// "trailer_fields": [], // template of the import trailer fields +// "cache_dump_fields": [ // template used when dumping cached CDR, eg: partial CDRs +// {"tag": "CGRID", "type": "*composed", "value": "CGRID"}, +// {"tag": "RunID", "type": "*composed", "value": "RunID"}, +// {"tag": "TOR", "type": "*composed", "value": "ToR"}, +// {"tag": "OriginID", "type": "*composed", "value": "OriginID"}, +// {"tag": "RequestType", "type": "*composed", "value": "RequestType"}, +// {"tag": "Direction", "type": "*composed", "value": "Direction"}, +// {"tag": "Tenant", "type": "*composed", "value": "Tenant"}, +// {"tag": "Category", "type": "*composed", "value": "Category"}, +// {"tag": "Account", "type": "*composed", "value": "Account"}, +// {"tag": "Subject", "type": "*composed", "value": "Subject"}, +// {"tag": "Destination", "type": "*composed", "value": "Destination"}, +// {"tag": "SetupTime", "type": "*composed", "value": "SetupTime", "layout": "2006-01-02T15:04:05Z07:00"}, +// {"tag": "AnswerTime", "type": "*composed", "value": "AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"}, +// {"tag": "Usage", "type": "*composed", "value": "Usage"}, +// {"tag": "Cost", "type": "*composed", "value": "Cost"}, +// ], +// }, +// ], -//"cdre": { -// "*default": { -// "cdr_format": "csv", // exported CDRs format -// "field_separator": ",", -// "data_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from KBytes to Bytes) -// "sms_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from SMS unit to call duration in some billing systems) -// "mms_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from MMS unit to call duration in some billing systems) -// "generic_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from GENERIC unit to call duration in some billing systems) -// "cost_multiply_factor": 1, // multiply cost before export, eg: add VAT -// "export_directory": "/var/spool/cgrates/cdre", // path where the exported CDRs will be placed -// "header_fields": [], // template of the exported header fields -// "content_fields": [ // template of the exported content fields -// {"tag": "CGRID", "type": "*composed", "value": "CGRID"}, -// {"tag":"RunID", "type": "*composed", "value": "RunID"}, -// {"tag":"TOR", "type": "*composed", "value": "ToR"}, -// {"tag":"OriginID", "type": "*composed", "value": "OriginID"}, -// {"tag":"RequestType", "type": "*composed", "value": "RequestType"}, -// {"tag":"Direction", "type": "*composed", "value": "Direction"}, -// {"tag":"Tenant", "type": "*composed", "value": "Tenant"}, -// {"tag":"Category", "type": "*composed", "value": "Category"}, -// {"tag":"Account", "type": "*composed", "value": "Account"}, -// {"tag":"Subject", "type": "*composed", "value": "Subject"}, -// {"tag":"Destination", "type": "*composed", "value": "Destination"}, -// {"tag":"SetupTime", "type": "*composed", "value": "SetupTime", "layout": "2006-01-02T15:04:05Z07:00"}, -// {"tag":"AnswerTime", "type": "*composed", "value": "AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"}, -// {"tag":"Usage", "type": "*composed", "value": "Usage"}, -// {"tag":"Cost", "type": "*composed", "value": "Cost", "rounding_decimals": 4}, -// ], -// "trailer_fields": [], // template of the exported trailer fields -// }, -//}, +// "cdre": { +// "*default": { +// "cdr_format": "csv", // exported CDRs format +// "field_separator": ",", +// "data_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from KBytes to Bytes) +// "sms_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from SMS unit to call duration in some billing systems) +// "mms_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from MMS unit to call duration in some billing systems) +// "generic_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from GENERIC unit to call duration in some billing systems) +// "cost_multiply_factor": 1, // multiply cost before export, eg: add VAT +// "export_directory": "/var/spool/cgrates/cdre", // path where the exported CDRs will be placed +// "header_fields": [], // template of the exported header fields +// "content_fields": [ // template of the exported content fields +// {"tag": "CGRID", "type": "*composed", "value": "CGRID"}, +// {"tag":"RunID", "type": "*composed", "value": "RunID"}, +// {"tag":"TOR", "type": "*composed", "value": "ToR"}, +// {"tag":"OriginID", "type": "*composed", "value": "OriginID"}, +// {"tag":"RequestType", "type": "*composed", "value": "RequestType"}, +// {"tag":"Direction", "type": "*composed", "value": "Direction"}, +// {"tag":"Tenant", "type": "*composed", "value": "Tenant"}, +// {"tag":"Category", "type": "*composed", "value": "Category"}, +// {"tag":"Account", "type": "*composed", "value": "Account"}, +// {"tag":"Subject", "type": "*composed", "value": "Subject"}, +// {"tag":"Destination", "type": "*composed", "value": "Destination"}, +// {"tag":"SetupTime", "type": "*composed", "value": "SetupTime", "layout": "2006-01-02T15:04:05Z07:00"}, +// {"tag":"AnswerTime", "type": "*composed", "value": "AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"}, +// {"tag":"Usage", "type": "*composed", "value": "Usage"}, +// {"tag":"Cost", "type": "*composed", "value": "Cost", "rounding_decimals": 4}, +// ], +// "trailer_fields": [], // template of the exported trailer fields +// }, +// }, -//"sm_generic": { -// "enabled": false, // starts SessionManager service: -// "listen_bijson": "127.0.0.1:2014", // address where to listen for bidirectional JSON-RPC requests -// "rals_conns": [ -// {"address": "*internal"} // address where to reach the Rater <""|*internal|127.0.0.1:2013> -// ], -// "cdrs_conns": [ -// {"address": "*internal"} // address where to reach CDR Server, empty to disable CDR capturing <*internal|x.y.z.y:1234> -// ], -// "smg_replication_conns": [], // replicate sessions towards these SMGs -// "debit_interval": "0s", // interval to perform debits on. -// "min_call_duration": "0s", // only authorize calls with allowed duration higher than this -// "max_call_duration": "3h", // maximum call duration a prepaid call can last -// "session_ttl": "0s", // time after a session with no updates is terminated, not defined by default -// //"session_ttl_last_used": "", // tweak LastUsed for sessions timing-out, not defined by default -// //"session_ttl_usage": "", // tweak Usage for sessions timing-out, not defined by default -// "session_indexes": [], // index sessions based on these fields for GetActiveSessions API -//}, +// "sm_generic": { +// "enabled": false, // starts SessionManager service: +// "listen_bijson": "127.0.0.1:2014", // address where to listen for bidirectional JSON-RPC requests +// "rals_conns": [ +// {"address": "*internal"} // address where to reach the Rater <""|*internal|127.0.0.1:2013> +// ], +// "cdrs_conns": [ +// {"address": "*internal"} // address where to reach CDR Server, empty to disable CDR capturing <*internal|x.y.z.y:1234> +// ], +// "smg_replication_conns": [], // replicate sessions towards these SMGs +// "debit_interval": "0s", // interval to perform debits on. +// "min_call_duration": "0s", // only authorize calls with allowed duration higher than this +// "max_call_duration": "3h", // maximum call duration a prepaid call can last +// "session_ttl": "0s", // time after a session with no updates is terminated, not defined by default +// //"session_ttl_last_used": "", // tweak LastUsed for sessions timing-out, not defined by default +// //"session_ttl_usage": "", // tweak Usage for sessions timing-out, not defined by default +// "session_indexes": [], // index sessions based on these fields for GetActiveSessions API +// }, -//"sm_asterisk": { -// "enabled": false, // starts Asterisk SessionManager service: -// "create_cdr": false, // create CDR out of events and sends it to CDRS component -// "asterisk_conns":[ // instantiate connections to multiple Asterisk servers -// {"address": "127.0.0.1:8088", "user": "cgrates", "password": "CGRateS.org", "connect_attempts": 3,"reconnects": 5} -// ], -//}, +// "sm_asterisk": { +// "enabled": false, // starts Asterisk SessionManager service: +// "create_cdr": false, // create CDR out of events and sends it to CDRS component +// "asterisk_conns":[ // instantiate connections to multiple Asterisk servers +// {"address": "127.0.0.1:8088", "user": "cgrates", "password": "CGRateS.org", "connect_attempts": 3,"reconnects": 5} +// ], +// }, -//"sm_freeswitch": { -// "enabled": false, // starts SessionManager service: -// "rals_conns": [ -// {"address": "*internal"} // address where to reach the Rater <""|*internal|127.0.0.1:2013> -// ], -// "cdrs_conns": [ -// {"address": "*internal"} // address where to reach CDR Server, empty to disable CDR capturing <*internal|x.y.z.y:1234> -// ], -// "rls_conns": [], // address where to reach the ResourceLimiter service, empty to disable stats functionality: <""|*internal|x.y.z.y:1234> -// "create_cdr": false, // create CDR out of events and sends them to CDRS component -// "extra_fields": [], // extra fields to store in auth/CDRs when creating them -// "debit_interval": "10s", // interval to perform debits on. -// "min_call_duration": "0s", // only authorize calls with allowed duration higher than this -// "max_call_duration": "3h", // maximum call duration a prepaid call can last -// "min_dur_low_balance": "5s", // threshold which will trigger low balance warnings for prepaid calls (needs to be lower than debit_interval) -// "low_balance_ann_file": "", // file to be played when low balance is reached for prepaid calls -// "empty_balance_context": "", // if defined, prepaid calls will be transfered to this context on empty balance -// "empty_balance_ann_file": "", // file to be played before disconnecting prepaid calls on empty balance (applies only if no context defined) -// "subscribe_park": true, // subscribe via fsock to receive park events -// "channel_sync_interval": "5m", // sync channels with freeswitch regularly -// "max_wait_connection": "2s", // maximum duration to wait for a connection to be retrieved from the pool -// "event_socket_conns":[ // instantiate connections to multiple FreeSWITCH servers -// {"address": "127.0.0.1:8021", "password": "ClueCon", "reconnects": 5} -// ], -//}, +// "sm_freeswitch": { +// "enabled": false, // starts SessionManager service: +// "rals_conns": [ +// {"address": "*internal"} // address where to reach the Rater <""|*internal|127.0.0.1:2013> +// ], +// "cdrs_conns": [ +// {"address": "*internal"} // address where to reach CDR Server, empty to disable CDR capturing <*internal|x.y.z.y:1234> +// ], +// "rls_conns": [], // address where to reach the ResourceLimiter service, empty to disable stats functionality: <""|*internal|x.y.z.y:1234> +// "create_cdr": false, // create CDR out of events and sends them to CDRS component +// "extra_fields": [], // extra fields to store in auth/CDRs when creating them +// "debit_interval": "10s", // interval to perform debits on. +// "min_call_duration": "0s", // only authorize calls with allowed duration higher than this +// "max_call_duration": "3h", // maximum call duration a prepaid call can last +// "min_dur_low_balance": "5s", // threshold which will trigger low balance warnings for prepaid calls (needs to be lower than debit_interval) +// "low_balance_ann_file": "", // file to be played when low balance is reached for prepaid calls +// "empty_balance_context": "", // if defined, prepaid calls will be transfered to this context on empty balance +// "empty_balance_ann_file": "", // file to be played before disconnecting prepaid calls on empty balance (applies only if no context defined) +// "subscribe_park": true, // subscribe via fsock to receive park events +// "channel_sync_interval": "5m", // sync channels with freeswitch regularly +// "max_wait_connection": "2s", // maximum duration to wait for a connection to be retrieved from the pool +// "event_socket_conns":[ // instantiate connections to multiple FreeSWITCH servers +// {"address": "127.0.0.1:8021", "password": "ClueCon", "reconnects": 5} +// ], +// }, -//"sm_kamailio": { -// "enabled": false, // starts SessionManager service: -// "rals_conns": [ -// {"address": "*internal"} // address where to reach the Rater <""|*internal|127.0.0.1:2013> -// ], -// "cdrs_conns": [ -// {"address": "*internal"} // address where to reach CDR Server, empty to disable CDR capturing <*internal|x.y.z.y:1234> -// ], -// "create_cdr": false, // create CDR out of events and sends them to CDRS component -// "debit_interval": "10s", // interval to perform debits on. -// "min_call_duration": "0s", // only authorize calls with allowed duration higher than this -// "max_call_duration": "3h", // maximum call duration a prepaid call can last -// "evapi_conns":[ // instantiate connections to multiple Kamailio servers -// {"address": "127.0.0.1:8448", "reconnects": 5} -// ], -//}, +// "sm_kamailio": { +// "enabled": false, // starts SessionManager service: +// "rals_conns": [ +// {"address": "*internal"} // address where to reach the Rater <""|*internal|127.0.0.1:2013> +// ], +// "cdrs_conns": [ +// {"address": "*internal"} // address where to reach CDR Server, empty to disable CDR capturing <*internal|x.y.z.y:1234> +// ], +// "create_cdr": false, // create CDR out of events and sends them to CDRS component +// "debit_interval": "10s", // interval to perform debits on. +// "min_call_duration": "0s", // only authorize calls with allowed duration higher than this +// "max_call_duration": "3h", // maximum call duration a prepaid call can last +// "evapi_conns":[ // instantiate connections to multiple Kamailio servers +// {"address": "127.0.0.1:8448", "reconnects": 5} +// ], +// }, -//"sm_opensips": { -// "enabled": false, // starts SessionManager service: -// "listen_udp": "127.0.0.1:2020", // address where to listen for datagram events coming from OpenSIPS -// "rals_conns": [ -// {"address": "*internal"} // address where to reach the Rater <""|*internal|127.0.0.1:2013> -// ], -// "cdrs_conns": [ -// {"address": "*internal"} // address where to reach CDR Server, empty to disable CDR capturing <*internal|x.y.z.y:1234> -// ], -// "reconnects": 5, // number of reconnects if connection is lost -// "create_cdr": false, // create CDR out of events and sends it to CDRS component -// "debit_interval": "10s", // interval to perform debits on. -// "min_call_duration": "0s", // only authorize calls with allowed duration higher than this -// "max_call_duration": "3h", // maximum call duration a prepaid call can last -// "events_subscribe_interval": "60s", // automatic events subscription to OpenSIPS, 0 to disable it -// "mi_addr": "127.0.0.1:8020", // address where to reach OpenSIPS MI to send session disconnects -//}, +// "sm_opensips": { +// "enabled": false, // starts SessionManager service: +// "listen_udp": "127.0.0.1:2020", // address where to listen for datagram events coming from OpenSIPS +// "rals_conns": [ +// {"address": "*internal"} // address where to reach the Rater <""|*internal|127.0.0.1:2013> +// ], +// "cdrs_conns": [ +// {"address": "*internal"} // address where to reach CDR Server, empty to disable CDR capturing <*internal|x.y.z.y:1234> +// ], +// "create_cdr": false, // create CDR out of events and sends it to CDRS component +// "debit_interval": "10s", // interval to perform debits on. +// "min_call_duration": "0s", // only authorize calls with allowed duration higher than this +// "max_call_duration": "3h", // maximum call duration a prepaid call can last +// "events_subscribe_interval": "60s", // automatic events subscription to OpenSIPS, 0 to disable it +// "mi_addr": "127.0.0.1:8020", // address where to reach OpenSIPS MI to send session disconnects +// }, -//"diameter_agent": { -// "enabled": false, // enables the diameter agent: -// "listen": "127.0.0.1:3868", // address where to listen for diameter requests -// "dictionaries_dir": "/usr/share/cgrates/diameter/dict/", // path towards directory holding additional dictionaries to load -// "sm_generic_conns": [ -// {"address": "*internal"} // connection towards SMG component for session management -// ], -// "pubsubs_conns": [], // address where to reach the pubusb service, empty to disable pubsub functionality: <""|*internal|x.y.z.y:1234> -// "create_cdr": true, // create CDR out of CCR terminate and send it to SMG component -// "cdr_requires_session": true, // only create CDR if there is an active session at terminate -// "debit_interval": "5m", // interval for CCR updates -// "timezone": "", // timezone for timestamps where not specified, empty for general defaults <""|UTC|Local|$IANA_TZ_DB> -// "origin_host": "CGR-DA", // diameter Origin-Host AVP used in replies -// "origin_realm": "cgrates.org", // diameter Origin-Realm AVP used in replies -// "vendor_id": 0, // diameter Vendor-Id AVP used in replies -// "product_name": "CGRateS", // diameter Product-Name AVP used in replies -// "request_processors": [ -// { -// "id": "*default", // formal identifier of this processor -// "dry_run": false, // do not send the events to SMG, just log them -// "publish_event": false, // if enabled, it will publish internal event to pubsub -// "request_filter": "Subscription-Id>Subscription-Id-Type(0)", // filter requests processed by this processor -// "flags": [], // flags to influence processing behavior -// "continue_on_success": false, // continue to the next template if executed -// "append_cca": true, // when continuing will append cca fields to the previous ones -// "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}, -// ], -// "cca_fields":[ // fields returned in CCA -// {"tag": "GrantedUnits", "field_id": "Granted-Service-Unit>CC-Time", "type": "*handler", "handler_id": "*cca_usage", "mandatory": true}, -// ], -// }, -// ], -//}, +// "diameter_agent": { +// "enabled": false, // enables the diameter agent: +// "listen": "127.0.0.1:3868", // address where to listen for diameter requests +// "dictionaries_dir": "/usr/share/cgrates/diameter/dict/", // path towards directory holding additional dictionaries to load +// "sm_generic_conns": [ +// {"address": "*internal"} // connection towards SMG component for session management +// ], +// "pubsubs_conns": [], // address where to reach the pubusb service, empty to disable pubsub functionality: <""|*internal|x.y.z.y:1234> +// "create_cdr": true, // create CDR out of CCR terminate and send it to SMG component +// "cdr_requires_session": true, // only create CDR if there is an active session at terminate +// "debit_interval": "5m", // interval for CCR updates +// "timezone": "", // timezone for timestamps where not specified, empty for general defaults <""|UTC|Local|$IANA_TZ_DB> +// "origin_host": "CGR-DA", // diameter Origin-Host AVP used in replies +// "origin_realm": "cgrates.org", // diameter Origin-Realm AVP used in replies +// "vendor_id": 0, // diameter Vendor-Id AVP used in replies +// "product_name": "CGRateS", // diameter Product-Name AVP used in replies +// "request_processors": [ +// { +// "id": "*default", // formal identifier of this processor +// "dry_run": false, // do not send the events to SMG, just log them +// "publish_event": false, // if enabled, it will publish internal event to pubsub +// "request_filter": "Subscription-Id>Subscription-Id-Type(0)", // filter requests processed by this processor +// "flags": [], // flags to influence processing behavior +// "continue_on_success": false, // continue to the next template if executed +// "append_cca": true, // when continuing will append cca fields to the previous ones +// "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}, +// ], +// "cca_fields":[ // fields returned in CCA +// {"tag": "GrantedUnits", "field_id": "Granted-Service-Unit>CC-Time", "type": "*handler", "handler_id": "*cca_usage", "mandatory": true}, +// ], +// }, +// ], +// }, -//"historys": { -// "enabled": false, // starts History service: . -// "history_dir": "/var/lib/cgrates/history", // location on disk where to store history files. -// "save_interval": "1s", // interval to save changed cache into .git archive -//}, +// "historys": { +// "enabled": false, // starts History service: . +// "history_dir": "/var/lib/cgrates/history", // location on disk where to store history files. +// "save_interval": "1s", // interval to save changed cache into .git archive +// }, -//"pubsubs": { -// "enabled": false, // starts PubSub service: . -//}, +// "pubsubs": { +// "enabled": false, // starts PubSub service: . +// }, -//"aliases": { -// "enabled": false, // starts Aliases service: . -//}, +// "aliases": { +// "enabled": false, // starts Aliases service: . +// }, -//"users": { -// "enabled": false, // starts User service: . -// "indexes": [], // user profile field indexes -//}, +// "users": { +// "enabled": false, // starts User service: . +// "indexes": [], // user profile field indexes +// }, -//"rls": { -// "enabled": false, // starts ResourceLimiter service: . -// "cdrstats_conns": [], // address where to reach the cdrstats service, empty to disable stats functionality: <""|*internal|x.y.z.y:1234> -// "cache_dump_interval": "0s", // dump cache regularly to dataDB, 0 - dump at start/shutdown: <""|*never|$dur> -// "usage_ttl": "3h", // expire usage records if older than this duration <""|*never|$dur> -//}, +// "rls": { +// "enabled": false, // starts ResourceLimiter service: . +// "cdrstats_conns": [], // address where to reach the cdrstats service, empty to disable stats functionality: <""|*internal|x.y.z.y:1234> +// "cache_dump_interval": "0s", // dump cache regularly to dataDB, 0 - dump at start/shutdown: <""|*never|$dur> +// "usage_ttl": "3h", // expire usage records if older than this duration <""|*never|$dur> +// }, -//"mailer": { -// "server": "localhost", // the server to use when sending emails out -// "auth_user": "cgrates", // authenticate to email server using this user -// "auth_password": "CGRateS.org", // authenticate to email server with this password -// "from_address": "cgr-mailer@localhost.localdomain" // from address used when sending emails out -//}, +// "mailer": { +// "server": "localhost", // the server to use when sending emails out +// "auth_user": "cgrates", // authenticate to email server using this user +// "auth_password": "CGRateS.org", // authenticate to email server with this password +// "from_address": "cgr-mailer@localhost.localdomain" // from address used when sending emails out +// }, -//"suretax": { -// "url": "", // API url -// "client_number": "", // client number, provided by SureTax -// "validation_key": "", // validation key provided by SureTax -// "business_unit": "", // client’s Business Unit -// "timezone": "Local", // convert the time of the events to this timezone before sending request out -// "include_local_cost": false, // sum local calculated cost with tax one in final cost -// "return_file_code": "0", // default or Quote purposes <0|Q> -// "response_group": "03", // determines how taxes are grouped for the response <03|13> -// "response_type": "D4", // determines the granularity of taxes and (optionally) the decimal precision for the tax calculations and amounts in the response -// "regulatory_code": "03", // provider type -// "client_tracking": "CGRID", // template extracting client information out of StoredCdr; <$RSRFields> -// "customer_number": "Subject", // template extracting customer number out of StoredCdr; <$RSRFields> -// "orig_number": "Subject", // template extracting origination number out of StoredCdr; <$RSRFields> -// "term_number": "Destination", // template extracting termination number out of StoredCdr; <$RSRFields> -// "bill_to_number": "", // template extracting billed to number out of StoredCdr; <$RSRFields> -// "zipcode": "", // template extracting billing zip code out of StoredCdr; <$RSRFields> -// "plus4": "", // template extracting billing zip code extension out of StoredCdr; <$RSRFields> -// "p2pzipcode": "", // template extracting secondary zip code out of StoredCdr; <$RSRFields> -// "p2pplus4": "", // template extracting secondary zip code extension out of StoredCdr; <$RSRFields> -// "units": "^1", // template extracting number of “lines” or unique charges contained within the revenue out of StoredCdr; <$RSRFields> -// "unit_type": "^00", // template extracting number of unique access lines out of StoredCdr; <$RSRFields> -// "tax_included": "^0", // template extracting tax included in revenue out of StoredCdr; <$RSRFields> -// "tax_situs_rule": "^04", // template extracting tax situs rule out of StoredCdr; <$RSRFields> -// "trans_type_code": "^010101", // template extracting transaction type indicator out of StoredCdr; <$RSRFields> -// "sales_type_code": "^R", // template extracting sales type code out of StoredCdr; <$RSRFields> -// "tax_exemption_code_list": "", // template extracting tax exemption code list out of StoredCdr; <$RSRFields> -//}, +// "suretax": { +// "url": "", // API url +// "client_number": "", // client number, provided by SureTax +// "validation_key": "", // validation key provided by SureTax +// "business_unit": "", // client’s Business Unit +// "timezone": "Local", // convert the time of the events to this timezone before sending request out +// "include_local_cost": false, // sum local calculated cost with tax one in final cost +// "return_file_code": "0", // default or Quote purposes <0|Q> +// "response_group": "03", // determines how taxes are grouped for the response <03|13> +// "response_type": "D4", // determines the granularity of taxes and (optionally) the decimal precision for the tax calculations and amounts in the response +// "regulatory_code": "03", // provider type +// "client_tracking": "CGRID", // template extracting client information out of StoredCdr; <$RSRFields> +// "customer_number": "Subject", // template extracting customer number out of StoredCdr; <$RSRFields> +// "orig_number": "Subject", // template extracting origination number out of StoredCdr; <$RSRFields> +// "term_number": "Destination", // template extracting termination number out of StoredCdr; <$RSRFields> +// "bill_to_number": "", // template extracting billed to number out of StoredCdr; <$RSRFields> +// "zipcode": "", // template extracting billing zip code out of StoredCdr; <$RSRFields> +// "plus4": "", // template extracting billing zip code extension out of StoredCdr; <$RSRFields> +// "p2pzipcode": "", // template extracting secondary zip code out of StoredCdr; <$RSRFields> +// "p2pplus4": "", // template extracting secondary zip code extension out of StoredCdr; <$RSRFields> +// "units": "^1", // template extracting number of “lines” or unique charges contained within the revenue out of StoredCdr; <$RSRFields> +// "unit_type": "^00", // template extracting number of unique access lines out of StoredCdr; <$RSRFields> +// "tax_included": "^0", // template extracting tax included in revenue out of StoredCdr; <$RSRFields> +// "tax_situs_rule": "^04", // template extracting tax situs rule out of StoredCdr; <$RSRFields> +// "trans_type_code": "^010101", // template extracting transaction type indicator out of StoredCdr; <$RSRFields> +// "sales_type_code": "^R", // template extracting sales type code out of StoredCdr; <$RSRFields> +// "tax_exemption_code_list": "", // template extracting tax exemption code list out of StoredCdr; <$RSRFields> +// }, } \ No newline at end of file diff --git a/data/tutorials/asterisk_ari/cgrates/etc/cgrates/cgrates.json b/data/tutorials/asterisk_ari/cgrates/etc/cgrates/cgrates.json index a7de36f27..007f45d24 100644 --- a/data/tutorials/asterisk_ari/cgrates/etc/cgrates/cgrates.json +++ b/data/tutorials/asterisk_ari/cgrates/etc/cgrates/cgrates.json @@ -9,7 +9,6 @@ "dbdata_encoding": "msgpack", // encoding used to store object data in strings: "tpexport_dir": "/var/spool/cgrates/tpe", // path towards export folder for offline Tariff Plans "httpposter_attempts": 3, // number of http attempts before considering request failed (eg: *call_url) - "http_failed_dir": "/var/spool/cgrates/http_failed", // directory path where we store failed http requests "default_request_type": "*rated", // default request type to consider when missing from requests: <""|*prepaid|*postpaid|*pseudoprepaid|*rated> "default_category": "call", // default category to consider when missing from requests "default_tenant": "cgrates.org", // default tenant to consider when missing from requests diff --git a/engine/action.go b/engine/action.go index 1a1652c8c..49569c275 100644 --- a/engine/action.go +++ b/engine/action.go @@ -413,9 +413,11 @@ func callUrl(ub *Account, sq *StatsQueueTriggered, a *Action, acs Actions) error return err } cfg := config.CgrConfig() - fallbackPath := path.Join(cfg.HttpFailedDir, fmt.Sprintf("act_%s_%s_%s.json", a.ActionType, a.ExtraParameters, utils.GenUUID())) + ffn := &utils.FallbackFileName{Module: "act/" + a.ActionType, Transport: utils.MetaHTTPjson, Address: a.ExtraParameters, + RequestID: utils.GenUUID(), FileSuffix: utils.JSNSuffix} _, err = utils.NewHTTPPoster(config.CgrConfig().HttpSkipTlsVerify, - config.CgrConfig().ReplyTimeout).Post(a.ExtraParameters, utils.CONTENT_JSON, jsn, config.CgrConfig().HttpPosterAttempts, fallbackPath) + config.CgrConfig().ReplyTimeout).Post(a.ExtraParameters, utils.CONTENT_JSON, jsn, + config.CgrConfig().HttpPosterAttempts, path.Join(cfg.FailedRequestsDir, ffn.AsString())) return err } @@ -433,9 +435,11 @@ func callUrlAsync(ub *Account, sq *StatsQueueTriggered, a *Action, acs Actions) return err } cfg := config.CgrConfig() - fallbackPath := path.Join(cfg.HttpFailedDir, fmt.Sprintf("act_%s_%s_%s.json", a.ActionType, a.ExtraParameters, utils.GenUUID())) + ffn := &utils.FallbackFileName{Module: "act/" + a.ActionType, Transport: utils.MetaHTTPjson, Address: a.ExtraParameters, + RequestID: utils.GenUUID(), FileSuffix: utils.JSNSuffix} go utils.NewHTTPPoster(config.CgrConfig().HttpSkipTlsVerify, - config.CgrConfig().ReplyTimeout).Post(a.ExtraParameters, utils.CONTENT_JSON, jsn, config.CgrConfig().HttpPosterAttempts, fallbackPath) + config.CgrConfig().ReplyTimeout).Post(a.ExtraParameters, utils.CONTENT_JSON, jsn, + config.CgrConfig().HttpPosterAttempts, path.Join(cfg.FailedRequestsDir, ffn.AsString())) return nil } diff --git a/engine/cdrs.go b/engine/cdrs.go index f2bdaaff1..9647fdd56 100644 --- a/engine/cdrs.go +++ b/engine/cdrs.go @@ -502,7 +502,7 @@ func (self *CdrServer) replicateCdr(cdr *CDR) error { } go func(body interface{}, rplCfg *config.CDRReplicationCfg, content string, errChan chan error) { fallbackPath := path.Join( - self.cgrCfg.HttpFailedDir, + self.cgrCfg.FailedRequestsDir, rplCfg.FallbackFileName()) if _, err := self.httpPoster.Post(rplCfg.Address, content, body, rplCfg.Attempts, fallbackPath); err != nil { utils.Logger.Err(fmt.Sprintf( diff --git a/general_tests/cdrs_replication_it_test.go b/general_tests/cdrs_replication_it_test.go index e7141adc0..3b8576922 100644 --- a/general_tests/cdrs_replication_it_test.go +++ b/general_tests/cdrs_replication_it_test.go @@ -146,16 +146,16 @@ func TestCdrsFileFailover(t *testing.T) { break } } - filesInDir, _ := ioutil.ReadDir(cdrsMasterCfg.HttpFailedDir) + filesInDir, _ := ioutil.ReadDir(cdrsMasterCfg.FailedRequestsDir) if len(filesInDir) == 0 { - t.Fatalf("No files in directory: %s", cdrsMasterCfg.HttpFailedDir) + t.Fatalf("No files in directory: %s", cdrsMasterCfg.FailedRequestsDir) } var fileName string for _, file := range filesInDir { // First file in directory is the one we need, harder to find it's name out of config fileName = file.Name() break } - filePath := path.Join(cdrsMasterCfg.HttpFailedDir, fileName) + filePath := path.Join(cdrsMasterCfg.FailedRequestsDir, fileName) if readBytes, err := ioutil.ReadFile(filePath); err != nil { t.Error(err) } else if !reflect.DeepEqual(failoverContent, readBytes) { // Checking just the prefix should do since some content is dynamic diff --git a/packages/jessie/rules b/packages/jessie/rules index ea722b2dd..20bca83f2 100755 --- a/packages/jessie/rules +++ b/packages/jessie/rules @@ -38,7 +38,7 @@ binary-arch: clean mkdir -p $(PKGDIR)/var/spool/cgrates/cdre/csv mkdir -p $(PKGDIR)/var/spool/cgrates/cdre/fwv mkdir -p $(PKGDIR)/var/spool/cgrates/tpe - mkdir -p $(PKGDIR)/var/spool/cgrates/http_failed + mkdir -p $(PKGDIR)/var/spool/cgrates/failed_requests mkdir -p $(PKGDIR)/var/lib/cgrates/history mkdir -p $(PKGDIR)/var/lib/cgrates/cache_dump dh_strip diff --git a/packages/redhat_fedora/cgrates.spec b/packages/redhat_fedora/cgrates.spec index 4b14d0fdc..ddf7a85e4 100644 --- a/packages/redhat_fedora/cgrates.spec +++ b/packages/redhat_fedora/cgrates.spec @@ -93,7 +93,7 @@ mkdir -p $RPM_BUILD_ROOT%{_spooldir}/cdrc/out mkdir -p $RPM_BUILD_ROOT%{_spooldir}/cdre/csv mkdir -p $RPM_BUILD_ROOT%{_spooldir}/cdre/fwv mkdir -p $RPM_BUILD_ROOT%{_spooldir}/tpe -mkdir -p $RPM_BUILD_ROOT%{_spooldir}/http_failed +mkdir -p $RPM_BUILD_ROOT%{_spooldir}/failed_requests mkdir -p $RPM_BUILD_ROOT%{_libdir}/history mkdir -p $RPM_BUILD_ROOT%{_libdir}/cache_dump install -D -m 0644 -p src/github.com/cgrates/cgrates/packages/redhat_fedora/%{name}.options $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name} diff --git a/packages/squeeze/rules b/packages/squeeze/rules index 9f2acbb53..1831bcd3f 100755 --- a/packages/squeeze/rules +++ b/packages/squeeze/rules @@ -37,7 +37,7 @@ binary-arch: clean mkdir -p $(PKGDIR)/var/spool/cgrates/cdre/csv mkdir -p $(PKGDIR)/var/spool/cgrates/cdre/fwv mkdir -p $(PKGDIR)/var/spool/cgrates/tpe - mkdir -p $(PKGDIR)/var/spool/cgrates/http_failed + mkdir -p $(PKGDIR)/var/spool/cgrates/failed_requests mkdir -p $(PKGDIR)/var/lib/cgrates/history mkdir -p $(PKGDIR)/var/lib/cgrates/cache_dump dh_strip diff --git a/utils/consts.go b/utils/consts.go index 1f24efbd9..466191e3a 100644 --- a/utils/consts.go +++ b/utils/consts.go @@ -218,6 +218,7 @@ const ( META_FILLER = "*filler" META_HANDLER = "*handler" META_HTTP_POST = "*http_post" + MetaHTTPjson = "*http_json" MetaHTTPjsonCDR = "*http_json_cdr" META_HTTP_JSONRPC = "*http_jsonrpc" MetaHTTPjsonMap = "*http_json_map" diff --git a/utils/httpclient.go b/utils/httpclient.go index b6ebe7cdf..b445d23d2 100644 --- a/utils/httpclient.go +++ b/utils/httpclient.go @@ -45,7 +45,7 @@ func NewFallbackFileNameFronString(fileName string) (ffn *FallbackFileName, err return nil, fmt.Errorf("unsupported module: %s", ffn.Module) } fileNameWithoutModule := fileName[moduleIdx+1:] - for _, trspt := range []string{MetaHTTPjsonCDR, MetaHTTPjsonMap, META_HTTP_POST} { + for _, trspt := range []string{MetaHTTPjsonCDR, MetaHTTPjsonMap, MetaHTTPjson, META_HTTP_POST} { if strings.HasPrefix(fileNameWithoutModule, trspt) { ffn.Transport = trspt break