2. Architecture =============== The CGRateS suite consits of three software applications, described bellow. 2.1. cgr-engine -------------- The most important and complex as functionality. Customisable through the use of a configuration file, it will start on demand one or more services, outlined bellow. :: rif@grace:~$ cgr-engine -help Usage of cgr-engine: -cdrs Enforce starting of the cdrs daemon overwriting config -config_dir string Configuration directory path. (default "/etc/cgrates/") -cpuprofile string write cpu profile to file -pid string Write pid file -rater Enforce starting of the rater daemon overwriting config -scheduler Enforce starting of the scheduler daemon .overwriting config -singlecpu Run on single CPU core -version Prints the application version. :Example: cgr-engine -config_dir=/etc/cgrates 2.1.1. Rater service ~~~~~~~~~~~~~~~~~~~~ Responsible with the following tasks: - Operates on balances. - Computes prices for rating subjects. - Monitors and executes triggers. Accessed by components using it's functionality via RPC or directly within same running cgr-engine process. 2.1.2. Balancer service ~~~~~~~~~~~~~~~~~~~~~~~ Optional component, used as proxy/balancer to a pool of Rater workers. The Raters will register their availability to the Balancer thus implementing dynamic HA functionality. 2.1.3. Scheduler service ~~~~~~~~~~~~~~~~~~~~~~~~ Used to execute periodic/scheduled tasks. 2.1.4. SessionManager service ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Responsible with call control on the Telecommunication Switch side. Operates in two different modes (per call or globally): - Prepaid - Monitors call start. - Checks balance availability for the call. - Enforces global timer for a call at call-start. - Executes routing commands for the call where that is necessary ( eg call un-park in case of FreeSWITCH). - Periodically executes balance debits on call at the beginning of debit interval. - Enforce call disconnection on insufficient balance. - Refunds the balance taken in advance at the call stop. - Postpaid - Executes balance debit on call-stop. All call actions are logged into CGRateS's LogDB. 2.1.5 Mediator service ~~~~~~~~~~~~~~~~~~~~~~ Responsible to mediate the CDRs generated by Telecommunication Switch. Has the ability to combine CDR fields into rating subject and run multiple mediation processes on the same record. On Linux machines, able to work with inotify kernel subsystem in order to process the records close to real-time after the Switch has released them. 2.2. cgr-loader --------------- Used for importing the rating information into the CGRateS database system. :: rif@grace:~$ cgr-loader -help Usage of cgr-loader: -cdrstats_address string CDRStats service to contact for data reloads, empty to disable automatic data reloads (default "127.0.0.1:2013") -datadb_host string The DataDb host to connect to. (default "127.0.0.1") -datadb_name string The name/number of the DataDb to connect to. (default "11") -datadb_passwd string The DataDb user's password. -datadb_port string The DataDb port to bind to. (default "6379") -datadb_type string The type of the DataDb database (default "redis") -datadb_user string The DataDb user to sign in as. -dbdata_encoding string The encoding used to store object data in strings (default "msgpack") -dry_run When true will not save loaded data to dataDb but just parse it for consistency and errors. -flushdb Flush the database before importing -from_stordb Load the tariff plan from storDb to dataDb -history_server string The history server address:port, empty to disable automaticautomatic history archiving (default "127.0.0.1:2013") -load_history_size int Limit the number of records in the load history (default 10) -migrate_rc8 Migrate Accounts, Actions and ActionTriggers to RC8 structures -path string The path to folder containing the data files (default "./") -rater_address string Rater service to contact for cache reloads, empty to disable automatic cache reloads (default "127.0.0.1:2013") -runid string Uniquely identify an import/load, postpended to some automatic fields -stats Generates statsistics about given data. -stordb_host string The storDb host to connect to. (default "127.0.0.1") -stordb_name string The name/number of the storDb to connect to. (default "cgrates") -stordb_passwd string The storDb user's password. (default "CGRateS.org") -stordb_port string The storDb port to bind to. (default "3306") -stordb_type string The type of the storDb database (default "mysql") -stordb_user string The storDb user to sign in as. (default "cgrates") -timezone string Timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB> (default "Local") -to_stordb Import the tariff plan from files to storDb -tpdb_host string The TariffPlan host to connect to. (default "127.0.0.1") -tpdb_name string The name/number of the TariffPlan to connect to. (default "10") -tpdb_passwd string The TariffPlan user's password. -tpdb_port string The TariffPlan port to bind to. (default "6379") -tpdb_type string The type of the TariffPlan database (default "redis") -tpdb_user string The TariffPlan user to sign in as. -tpid string The tariff plan id from the database -users_address string Users service to contact for data reloads, empty to disable automatic data reloads (default "127.0.0.1:2013") -validate When true will run various check on the loaded data to check for structural errors -verbose Enable detailed verbose logging output -version Prints the application version. :Example: cgr-loader -flushdb 2.3. cgr-console ---------------- Command line tool used to interface with the Rater (or Balancer). Able to execute sub-commands :: rif@grace:~$ cgr-console -help Usage of cgr-console: -rpc_encoding string RPC encoding used (default "json") -server string server address host:port (default "127.0.0.1:2012") -verbose Show extra info about command execution. -version Prints the application version. rif@grace:~$ cgr-console help_more 2013/04/13 17:23:51 Usage: cgr-console [cfg_opts...{-h}] :Example: cgr-console status