From a01bb2638d571526a3e6f130517ed0761bc3c319 Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Mon, 20 Aug 2012 15:13:42 +0300 Subject: [PATCH] updated configuration documentation, renamed stats_server to stats --- cmd/cgr-rater/cgr-rater.go | 6 ++-- cmd/cgr-rater/rater_test.go | 2 +- conf/balancer.config | 3 +- conf/balancer_standalone.config | 3 +- conf/full.config | 48 +++++++++++++------------ conf/rater_standalone.config | 3 +- conf/session_manager.config | 2 +- docs/tutorial.rst | 62 ++++++++++++++++++--------------- 8 files changed, 70 insertions(+), 59 deletions(-) diff --git a/cmd/cgr-rater/cgr-rater.go b/cmd/cgr-rater/cgr-rater.go index 4e004b8c4..4eef84e13 100644 --- a/cmd/cgr-rater/cgr-rater.go +++ b/cmd/cgr-rater/cgr-rater.go @@ -138,9 +138,9 @@ func readConfig(c *conf.ConfigFile) { mediator_rpc_encoding, _ = c.GetString("mediator", "rpc_encoding") mediator_skipdb, _ = c.GetBool("mediator", "skipdb") - stats_enabled, _ = c.GetBool("stats_server", "enabled") - stats_listen, _ = c.GetString("stats_server", "listen") - stats_media_path, _ = c.GetString("stats_server", "media_path") + stats_enabled, _ = c.GetBool("stats", "enabled") + stats_listen, _ = c.GetString("stats", "listen") + stats_media_path, _ = c.GetString("stats", "media_path") freeswitch_server, _ = c.GetString("freeswitch", "server") freeswitch_pass, _ = c.GetString("freeswitch", "pass") diff --git a/cmd/cgr-rater/rater_test.go b/cmd/cgr-rater/rater_test.go index aea34de1a..169462a3b 100644 --- a/cmd/cgr-rater/rater_test.go +++ b/cmd/cgr-rater/rater_test.go @@ -69,7 +69,7 @@ rater = test #address where to access rater. Can be internal, direct rater addre debit_period = 11 rpc_encoding = test # use JSON for RPC encoding -[stats_server] +[stats] enabled = true listen = test # Web server address (for stat reports) media_path = test diff --git a/conf/balancer.config b/conf/balancer.config index fa21a4d09..8d968c974 100644 --- a/conf/balancer.config +++ b/conf/balancer.config @@ -33,6 +33,7 @@ listen = 127.0.0.1:1234 # listening address host:port, internal for internal com balancer = disabled # if defined it will register to balancer as worker rpc_encoding = gob # use JSON for RPC encoding -[stats_server] +[stats] enabled = true listen = 127.0.0.1:8000 # Web server address (for stat reports) +media_path = /home/rif/Documents/prog/go/src/github.com/cgrates/cgrates/data # The path containig the css, js and templates for the web server \ No newline at end of file diff --git a/conf/balancer_standalone.config b/conf/balancer_standalone.config index 4fd8ff30d..c271f47fe 100644 --- a/conf/balancer_standalone.config +++ b/conf/balancer_standalone.config @@ -32,6 +32,7 @@ rpc_encoding = gob # use JSON for RPC encoding enabled = false -[stats_server] +[stats] enabled = true listen = 127.0.0.1:8000 # Web server address (for stat reports) +media_path = /home/rif/Documents/prog/go/src/github.com/cgrates/cgrates/data # The path containig the css, js and templates for the web server \ No newline at end of file diff --git a/conf/full.config b/conf/full.config index 5abd86863..c098b293e 100644 --- a/conf/full.config +++ b/conf/full.config @@ -15,10 +15,10 @@ # along with this program. If not, see [global] -datadb_type = redis # +datadb_type = redis # The main database: redis|mongo|postgres. datadb_host = 127.0.0.1:6379 # The host to connect to. Values that start with / are for UNIX domain sockets. datadb_name = 10 # The name of the database to connect to. -logdb_type = mongo +logdb_type = mongo # The logging database: redis|mongo|postgres|same. logdb_host = localhost # The host to connect to. Values that start with / are for UNIX domain sockets. logdb_name = cgrates # The name of the database to connect to. @@ -26,33 +26,37 @@ logdb_name = cgrates # The name of the database to connect to. [balancer] enabled = false # Start balancer server listen = 127.0.0.1:2001 # Balancer listen interface -rpc_encoding = gob # use JSON for RPC encoding +rpc_encoding = gob # Use json or gob for RPC encoding [rater] -enabled = true -listen = 127.0.0.1:2001 # listening address host:port, internal for internal communication only -balancer = disabled # if defined it will register to balancer as worker -rpc_encoding = gob # use JSON for RPC encoding +enabled = true # Start the rating service +listen = 127.0.0.1:2001 # Listening address host:port, internal for internal communication only +balancer = disabled # If defined it will register to balancer as worker +rpc_encoding = gob # Use json or gob for RPC encoding [mediator] -enabled = true -cdr_file = Master.csv # Freeswitch Master CSV CDR file. -result_file = out.csv # Generated file containing CDR and price info. -rater = internal #address where to access rater. Can be internal, direct rater address or the address of a balancer -rpc_encoding = gob # use JSON for RPC encoding -skipdb = true +enabled = true # Start the mediator service +cdr_file = Master.csv # Freeswitch Master CSV CDR file +result_file = out.csv # Generated file containing CDR and price info +rater = internal # Address where to access rater. Can be internal, direct rater address or the address of a balancer +rpc_encoding = gob # Use json or gob for RPC encoding +skipdb = true # Do not look in the database for logged cdrs, ask rater directly [scheduler] -enabled = true +enabled = true # Start the schedule service [session_manager] -enabled = true -rater = 127.0.0.1:2000 #address where to access rater. Can be internal, direct rater address or the address of a balancer -freeswitch_server = localhost:8021 # freeswitch address host:port -freeswitch_pass = ClueCon # freesw/home/rif/Documents/prog/go/src/github.com/cgrates/cgrates/confitch address host:port -rpc_encoding = gob # use JSON for RPC encoding +enabled = true # Start the session manager service +switch_type = freeswitch # The switch type to be used +debit_period = 10 # The number of seconds to be debited in advance during a call +rater = 127.0.0.1:2000 # Address where to access rater. Can be internal, direct rater address or the address of a balancer +rpc_encoding = gob # Use json or gob for RPC encoding -[stats_server] -enabled = true +[freeswitch] +server = localhost:8021 # Freeswitch address host:port +pass = ClueCon # Freeswtch address host:port + +[stats] +enabled = true # Start the stats web server listen = 127.0.0.1:8000 # Web server address (for stat reports) -media_path = /home/rif/Documents/prog/go/src/github.com/cgrates/cgrates/data +media_path = /home/rif/Documents/prog/go/src/github.com/cgrates/cgrates/data # The path containig the css, js and templates for the web server diff --git a/conf/rater_standalone.config b/conf/rater_standalone.config index 496b088eb..e523300f6 100644 --- a/conf/rater_standalone.config +++ b/conf/rater_standalone.config @@ -26,6 +26,7 @@ listen = 127.0.0.1:2001 # listening address host:port, internal for internal com balancer = disabled # if defined it will register to balancer as worker rpc_encoding = gob # use JSON for RPC encoding -[stats_server] +[stats] enabled = true listen = 127.0.0.1:8000 # Web server address (for stat reports) +media_path = /home/rif/Documents/prog/go/src/github.com/cgrates/cgrates/data # The path containig the css, js and templates for the web server \ No newline at end of file diff --git a/conf/session_manager.config b/conf/session_manager.config index 99096f2ef..b66779fca 100644 --- a/conf/session_manager.config +++ b/conf/session_manager.config @@ -36,7 +36,7 @@ enabled = true server = localhost:8021 pass = ClueCon -[stats_server] +[stats] enabled = true listen = 127.0.0.1:8000 # Web server address (for stat reports) media_path = /home/rif/Documents/prog/go/src/github.com/cgrates/cgrates/data diff --git a/docs/tutorial.rst b/docs/tutorial.rst index eaa1316fd..2aa42f9cd 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -46,57 +46,61 @@ The cgr-rater can be provided with the balancer server address and can be config :Example: cgr-rater -config=full.config -Bellow there is a full configuration file +Bellow there is a full configuration file: :: - [global] - [global] - datadb_type = redis # + datadb_type = redis # The main database: redis|mongo|postgres. datadb_host = 127.0.0.1:6379 # The host to connect to. Values that start with / are for UNIX domain sockets. datadb_name = 10 # The name of the database to connect to. - logdb_type = postgres # + logdb_type = mongo # The logging database: redis|mongo|postgres|same. logdb_host = localhost # The host to connect to. Values that start with / are for UNIX domain sockets. - logdb_port = 5432 # The port to bind to. - logdb_name = gosqltest # The name of the database to connect to. - logdb_user = rif # The user to sign in as. - logdb_passwd = test # The user's password.root + logdb_name = cgrates # The name of the database to connect to. + [balancer] enabled = false # Start balancer server listen = 127.0.0.1:2001 # Balancer listen interface - rpc_encoding = gob # use JSON for RPC encoding + rpc_encoding = gob # Use json or gob for RPC encoding [rater] - enabled = true - listen = 127.0.0.1:2001 # listening address host:port, internal for internal communication only - balancer = disabled # if defined it will register to balancer as worker - rpc_encoding = gob # use JSON for RPC encoding + enabled = true # Start the rating service + listen = 127.0.0.1:2001 # Listening address host:port, internal for internal communication only + balancer = disabled # If defined it will register to balancer as worker + rpc_encoding = gob # Use json or gob for RPC encoding [mediator] - enabled = true - cdr_file = Master.csv # Freeswitch Master CSV CDR file. - result_file = out.csv # Generated file containing CDR and price info. - rater = internal #address where to access rater. Can be internal, direct rater address or the address of a balancer - rpc_encoding = gob # use JSON for RPC encoding - skipdb = true + enabled = true # Start the mediator service + cdr_file = Master.csv # Freeswitch Master CSV CDR file + result_file = out.csv # Generated file containing CDR and price info + rater = internal # Address where to access rater. Can be internal, direct rater address or the address of a balancer + rpc_encoding = gob # Use json or gob for RPC encoding + skipdb = true # Do not look in the database for logged cdrs, ask rater directly [scheduler] - enabled = true + enabled = true # Start the schedule service [session_manager] - enabled = true - rater = 127.0.0.1:2000 #address where to access rater. Can be internal, direct rater address or the address of a balancer - freeswitch_server = localhost:8021 # freeswitch address host:port - freeswitch_pass = ClueCon # freesw/home/rif/Documents/prog/go/src/github.com/cgrates/cgrates/confitch address host:port - rpc_encoding = gob # use JSON for RPC encoding + enabled = true # Start the session manager service + switch_type = freeswitch # The switch type to be used + debit_period = 10 # The number of seconds to be debited in advance during a call + rater = 127.0.0.1:2000 # Address where to access rater. Can be internal, direct rater address or the address of a balancer + rpc_encoding = gob # Use json or gob for RPC encoding - [stats_server] - enabled = true + [freeswitch] + server = localhost:8021 # Freeswitch address host:port + pass = ClueCon # Freeswtch address host:port + + [stats] + enabled = true # Start the stats web server listen = 127.0.0.1:8000 # Web server address (for stat reports) - media_path = /home/rif/Documents/prog/go/src/github.com/cgrates/cgrates/data + media_path = /home/rif/cgrates/data # The path containig the css, js and templates for the web server +There are various sections in the configuration file that define various services that the cgr-rater process can provide. If you are not interested in a certain service you can either leave it in the configuration with the enabled option set to false or remove the section entirely to reduce clutter. + +The global sections define the databases to be used with used by CGRateS. The second database is used for logging the debit operations and various acctions operated on the accounts. The two databases can be the same type or different types. Currently we sopport redis, mongo and postgres. + The balancer will open a JSON RPC server and an HTTP server ready for taking external requests. It will also open a rater server on witch the raters will register themselves when they start. Session manager connects and monitors the freeswitch server issuing API request to other CGRateS components. It can run in standalone mode for minimal system configuration. It logs the calls information to a postgres database in order to be used by the mediator tool.