diff --git a/agents/fsagent.go b/agents/fsagent.go index caab7023a..ac85150ae 100644 --- a/agents/fsagent.go +++ b/agents/fsagent.go @@ -196,7 +196,7 @@ func (fsa *FSsessions) onChannelPark(fsev FSEvent, connIdx int) { fsArray := SliceAsFsArray(authReply.Routes.RoutesWithParams()) if _, err := fsa.conns[connIdx].SendApiCmd(fmt.Sprintf("uuid_setvar %s %s %s\n\n", fsev.GetUUID(), utils.CGR_ROUTES, fsArray)); err != nil { - utils.Logger.Info(fmt.Sprintf("<%s> error setting suppliers: %s", + utils.Logger.Info(fmt.Sprintf("<%s> error setting routes: %s", utils.FreeSWITCHAgent, err.Error())) fsa.unparkCall(fsev.GetUUID(), connIdx, fsev.GetCallDestNr(utils.MetaDefault), err.Error()) return diff --git a/apier/v1/dispatcher.go b/apier/v1/dispatcher.go index 43063a36f..77a315ae2 100755 --- a/apier/v1/dispatcher.go +++ b/apier/v1/dispatcher.go @@ -357,7 +357,7 @@ type DispatcherAttributeSv1 struct { dA *dispatchers.DispatcherService } -// Ping implements SupplierSv1Ping +// Ping implements AttributeSv1Ping func (dA *DispatcherAttributeSv1) Ping(args *utils.CGREventWithOpts, reply *string) error { return dA.dA.AttributeSv1Ping(args, reply) } @@ -1266,7 +1266,7 @@ type DispatcherRateSv1 struct { dR *dispatchers.DispatcherService } -// Ping implements SupplierSv1Ping +// Ping implements RateSv1Ping func (dR *DispatcherRateSv1) Ping(args *utils.CGREventWithOpts, reply *string) error { return dR.dR.RateSv1Ping(args, reply) } diff --git a/config/chargerscfg.go b/config/chargerscfg.go index 27d8c8461..07269f6de 100644 --- a/config/chargerscfg.go +++ b/config/chargerscfg.go @@ -24,7 +24,7 @@ import ( "github.com/cgrates/cgrates/utils" ) -// SupplierSCfg is the configuration of supplier service +// ChargerSCfg is the configuration of charger service type ChargerSCfg struct { Enabled bool IndexedSelects bool diff --git a/data/storage/docker_mysql/scripts/create_tariffplan_tables.sql b/data/storage/docker_mysql/scripts/create_tariffplan_tables.sql index a203d7090..07a3e24c3 100644 --- a/data/storage/docker_mysql/scripts/create_tariffplan_tables.sql +++ b/data/storage/docker_mysql/scripts/create_tariffplan_tables.sql @@ -340,12 +340,12 @@ CREATE TABLE tp_filters ( ); -- --- Table structure for table `tp_suppliers` +-- Table structure for table `tp_routes` -- -DROP TABLE IF EXISTS tp_suppliers; -CREATE TABLE tp_suppliers ( +DROP TABLE IF EXISTS tp_routes; +CREATE TABLE tp_routes ( `pk` int(11) NOT NULL AUTO_INCREMENT, `tpid` varchar(64) NOT NULL, `tenant` varchar(64) NOT NULL, @@ -367,7 +367,7 @@ CREATE TABLE tp_suppliers ( `created_at` TIMESTAMP, PRIMARY KEY (`pk`), KEY `tpid` (`tpid`), - UNIQUE KEY `unique_tp_suppliers` (`tpid`,`tenant`, + UNIQUE KEY `unique_tp_routes` (`tpid`,`tenant`, `id`,`filter_ids`,`supplier_id`,`supplier_filter_ids`,`supplier_account_ids`, `supplier_ratingplan_ids`,`supplier_resource_ids`,`supplier_stat_ids` ) ); diff --git a/data/tariffplans/dispatchers_gob/Attributes.csv b/data/tariffplans/dispatchers_gob/Attributes.csv index ae0884e03..0d9a32508 100644 --- a/data/tariffplans/dispatchers_gob/Attributes.csv +++ b/data/tariffplans/dispatchers_gob/Attributes.csv @@ -6,7 +6,7 @@ cgrates.org,ATTR_API_ATTR_FAKE_AUTH,*auth,*string:~*req.ApiKey:12345,,,*req.APIM cgrates.org,ATTR_API_ATTR_AUTH,*auth,*string:~*req.ApiKey:attr12345,,,*req.APIMethods,*constant,AttributeSv1.Ping&AttributeSv1.GetAttributeForEvent&AttributeSv1.ProcessEvent,false,20 cgrates.org,ATTR_API_CHRG_AUTH,*auth,*string:~*req.ApiKey:chrg12345,,,*req.APIMethods,*constant,ChargerSv1.Ping&ChargerSv1.GetChargersForEvent&ChargerSv1.ProcessEvent,false,20 cgrates.org,ATTR_API_THR_AUTH,*auth,*string:~*req.ApiKey:thr12345,,,*req.APIMethods,*constant,ThresholdSv1.Ping&ThresholdSv1.GetThresholdsForEvent&ThresholdSv1.ProcessEvent&ThresholdSv1.GetThreshold&ThresholdSv1.GetThresholdIDs,false,20 -cgrates.org,ATTR_API_SUP_AUTH,*auth,*string:~*req.ApiKey:sup12345,,,*req.APIMethods,*constant,SupplierSv1.Ping&SupplierSv1.GetSuppliers&SupplierSv1.GetSupplierProfilesForEvent,false,20 +cgrates.org,ATTR_API_SUP_AUTH,*auth,*string:~*req.ApiKey:sup12345,,,*req.APIMethods,*constant,RouteSv1.Ping&RouteSv1.GetRoutes&RouteSv1.GetRouteProfilesForEvent,false,20 cgrates.org,ATTR_API_STAT_AUTH,*auth,*string:~*req.ApiKey:stat12345,,,*req.APIMethods,*constant,StatSv1.Ping&StatSv1.GetStatQueuesForEvent&StatSv1.GetQueueStringMetrics&StatSv1.ProcessEvent&StatSv1.GetQueueIDs&StatSv1.GetQueueFloatMetrics,false,20 cgrates.org,ATTR_API_RES_AUTH,*auth,*string:~*req.ApiKey:res12345,,,*req.APIMethods,*constant,ResourceSv1.Ping&ResourceSv1.GetResourcesForEvent&ResourceSv1.AuthorizeResources&ResourceSv1.AllocateResources&ResourceSv1.ReleaseResources&ResourceSv1.GetResource,false,20 cgrates.org,ATTR_API_SES_AUTH,*auth,*string:~*req.ApiKey:ses12345,,,*req.APIMethods,*constant,SessionSv1.Ping&SessionSv1.AuthorizeEvent&SessionSv1.AuthorizeEventWithDigest&SessionSv1.InitiateSession&SessionSv1.InitiateSessionWithDigest&SessionSv1.UpdateSession&SessionSv1.SyncSessions&SessionSv1.TerminateSession&SessionSv1.ProcessCDR&SessionSv1.ProcessMessage&SessionSv1.GetActiveSessions&SessionSv1.GetActiveSessionsCount&SessionSv1.ForceDisconnect&SessionSv1.GetPassiveSessions&SessionSv1.GetPassiveSessionsCount&SessionSv1.ReplicateSessions&SessionSv1.SetPassiveSession&SessionSv1.ProcessEvent&SessionSv1.GetCost&SessionSv1.STIRAuthenticate&SessionSv1.STIRIdentity,false,20 diff --git a/docs/administration.rst b/docs/administration.rst index a239ce486..c9d6a12c9 100644 --- a/docs/administration.rst +++ b/docs/administration.rst @@ -6,5 +6,5 @@ The general steps to get CGRateS operational are: #. Create CSV files containing the initial data for CGRateS. #. Load the data in the databases using the Loader application. #. Start the engine with the required components (depending on your setup). -#. Make API calls to the component you are interested or send events from your environment towards the :ref:`SessionS` via the :ref:`Agents`. +#. Make API calls to the component you are interested or send events from your environment towards the :ref:`SessionS` via the :ref:`Agents`. diff --git a/docs/attributes.rst b/docs/attributes.rst index 5c3a8b2db..fa74492d2 100644 --- a/docs/attributes.rst +++ b/docs/attributes.rst @@ -1,7 +1,9 @@ +.. _attributes: + AttributeS ========== -**AttributeS** is a standalone subsystem within **CGRateS** and it is the equivalent of a key-value store. It is accessed via :ref:`CGRateS RPC APIs`. +**AttributeS** is a standalone subsystem within **CGRateS** and it is the equivalent of a key-value store. It is accessed via `CGRateS RPC APIs `_. As most of the other subsystems, it is performance oriented, stored inside *DataDB* but cached inside the *cgr-engine* process. Caching can be done dynamically/on-demand or at start-time/precached and it is configurable within *cache* section in the :ref:`JSON configuration `. @@ -108,7 +110,7 @@ Type Will compute the exponent of the first field in the *Value*. Value - The value which will be set for *Path*. It can be a list of :ref:`RSRParsers` capturing even from multiple sources in the same event. If the *Value* is *\*remove* the field with *Path* will be removed from *Event* + The value which will be set for *Path*. It can be a list of RSRParsers capturing even from multiple sources in the same event. If the *Value* is *\*remove* the field with *Path* will be removed from *Event* Inline Attribute diff --git a/docs/caches.rst b/docs/caches.rst index 218202694..70f8b6686 100644 --- a/docs/caches.rst +++ b/docs/caches.rst @@ -1,3 +1,5 @@ +.. _caches: + CacheS ====== diff --git a/docs/cdrclient.rst b/docs/cdrclient.rst deleted file mode 100644 index 24f728684..000000000 --- a/docs/cdrclient.rst +++ /dev/null @@ -1,86 +0,0 @@ -CDR Client (cdrc) -================= - -It's role is to gather offline CDRs and post them to CDR Server(CDRS) component. - -Part of the *cgr-engine*, can be started on a remote server as standalone component. - -Controlled within *cdrc* section of the configuration file. - -Has two modes of operation: - -- Automated: CDR file processing is triggered on file creation/move. -- Periodic: CDR file processing will be triggered at configured time interval (delay/sleep between processes) and it will be performed on all files present in the folder (IN) at run time. - -Principles behind functionality: - -- Monitor/process a CDR folder (IN) as outlined above. -- For every file processed, extract the information based on configuration and post it via configured mechanism to CDRS. -- The fields extracted out of each CDR row are the same ones depicted in the CDRS documentation (following primary and extra fields concept). -- Once the file processing completes, move it in it's original format in another folder (OUT) in order to avoid re-processing. Here it's worth mentioning the auto-detection of duplicated CDRs at server side based on accid and host fields. -- Advanced configuration like forking a number of simultaneous client instances monitoring different folders possible through the use of *.xml* configuration. - -Import Templates ----------------- - -To specifiy custom imports (for various sources) one can specify *Import Templates*. These are definable within both *.cfg* as well as *.xml* advanced configuration files. -For increased flexibility the Import Template can be defined using CGR-RSR fields capturing both ReGexp as well as static rules. The static values will be way faster in processing but limited in functionality. - -CGR-RSR Regexp Rule -~~~~~~~~~~~~~~~~~~~ - -Format: -:: - - ~path:s/regexp_search_and_capture_rule/output_teplate/ - -Example of usage: -:: - - Input CDR field: - { - "account": "First-Account123" - } - Capture Rule: - ~account:s/^*+(Account123)$/$1-processed/ - Result after processing: - { - "account": "Account123-processed" - } - - -CGR-RSR Static Rule -~~~~~~~~~~~~~~~~~~~ - -Format: -:: - - ^path:static_value - -Example of usage: -:: - -Input CDR field: - { - "account": "First-Account123" - } - Capture Rule: - ^account:MasterAccount - Result after processing: - { - "account": "MasterAccount" - } - - -CDR Formats supported: - -CDR .CSV --------- - -Most widely used format by Telecom Switches. - -Light to read and generic to process. -CDRC should be able to process in this way any .csv CDR, independent of the Telecom Switch generating them. Incompatibilities here can come out of answer time and duration formats which can vary between CDR writer implementations. -As answer time we support a number of formats already - rfc3339, SQL/MySQL, unix timestamp. As duration we support nanoseconds granularity in our code. Time unit can be specified (eg: ms, s, m, h), or if missing, will default to nanoseconds. - -In case of *.csv* files the Import Template will contain indexes for the possition where primary fields are located (0 representing the first field) and fieldname/position format for extra fields which need not only to be extracted by row index but also to be named since .csv format does not save field names/labels. CDRC uses the following convention for extra fields in the configuration: *:[...,:]...*. diff --git a/docs/cdre.rst b/docs/cdre.rst index 40ee97cbf..df99c6363 100644 --- a/docs/cdre.rst +++ b/docs/cdre.rst @@ -10,7 +10,7 @@ CDRe ==== -**CDRe** is an extension of :ref:`CDRs`, responsible for exporting the *CDR* events processed by :ref:`CDRs`. It is accessed via :ref:`CGRateS RPC APIs` and configured within *cdre* section inside :ref:`JSON configuration `. +**CDRe** is an extension of :ref:`CDRs`, responsible for exporting the *CDR* events processed by :ref:`CDRs`. It is accessed via `CGRateS RPC APIs `_ and configured within *cdre* section inside :ref:`JSON configuration `. Export types @@ -32,7 +32,7 @@ You can control the templates which are to be executed via the filters which are Offline exports ^^^^^^^^^^^^^^^ -Are exports which are triggered via :ref:`CGRateS RPC APIs` and they have as data source the CDRs stored within *StorDB*. +Are exports which are triggered via `CGRateS RPC APIs `_ and they have as data source the CDRs stored within *StorDB*. @@ -56,16 +56,16 @@ export_format Exports into a fixed width file format. **\*http_post** - Will post the CDR to a HTTP server. The export content will be a HTTP form encoded representation of the :ref:`internal CDR object`. + Will post the CDR to a HTTP server. The export content will be a HTTP form encoded representation of the `internal CDR object `_. **\*http_json_cdr** - Will post the CDR to a HTTP server. The export content will be a JSON serialized representation of the :ref:`internal CDR object`. + Will post the CDR to a HTTP server. The export content will be a JSON serialized representation of the `internal CDR object `_. **\*http_json_map** Will post the CDR to a HTTP server. The export content will be a JSON serialized hmap with fields defined within the *fields* section of the template. **\*amqp_json_cdr** - Will post the CDR to an AMQP_ queue. The export content will be a JSON serialized representation of the :ref:`internal CDR object`. Uses AMQP_ protocol version 0.9.1. + Will post the CDR to an AMQP_ queue. The export content will be a JSON serialized representation of the `internal CDR object `_. Uses AMQP_ protocol version 0.9.1. **\*amqp_json_map** Will post the CDR to an AMQP_ queue. The export content will be a JSON serialized hmap with fields defined within the *fields* section of the template. Uses AMQP_ protocol version 1.0. diff --git a/docs/cdrexporter.rst b/docs/cdrexporter.rst deleted file mode 100644 index bdc944543..000000000 --- a/docs/cdrexporter.rst +++ /dev/null @@ -1,122 +0,0 @@ -CDR Exporter -============ - -Component to retrieve rated CDRs from internal CDRs database. - -Although nowadays it is custom to read a storage/database with tools, we do not recommend doing it so due to possibility that reads can slow down complete rating system. For this purpose we have created exporter plugins which are meant to work in tight relationship with CGRateS internal components in order to best optimize performance and avoid system locks. - - -Export Templates ----------------- - -For advanced needs CGRateS Export Templates are configurable via *.cfg*, *.xml* as well as directly within RPC call requesting the export to be performed. -Inside each Export Template one can either specify simple CDR field ids or use CGR-RSR fields capturing both Regexp as well as static rules. - -CGR-RSR Regexp Rule -~~~~~~~~~~~~~~~~~~~ - -Format: -:: - - ~path:s/regexp_search_and_capture_rule/output_teplate/ - -Example of usage: -:: - - Input CDR field: - { - "account": "First-Account123" - } - Capture Rule: - ~account:s/^*+(Account123)$/$1-processed/ - Result after processing: - { - "account": "Account123-processed" - } - - -CGR-RSR Static Rule -~~~~~~~~~~~~~~~~~~~ - -Format: -:: - - ^path:static_value - -Example of usage: -:: - -Input CDR field: - { - "account": "First-Account123" - } - Capture Rule: - ^account:MasterAccount - Result after processing: - { - "account": "MasterAccount" - } - - -Export interfaces implemented: - - -CGR-CSV -------- - -Simplest way to export CDRs in a format internally defined (with parts like *CDRExtraFields* configurable in main configuration file). - -Principles behind exports: - -- Exports are to be manually requested (although automated is planned for the future through the used of built-in scheduled actions) via exposed JSON-RPC api. Example of api call from python call provided as sample script: - - :: - - rpc.call("APIerSv1.ExportCsvCdrs",{"TimeStart":"1383823746","TimeEnd":"1383833746"} ) - -- On each export call there will be a .csv format file generated using configured separator. Location of the export folder is definable inside *cgrates.cfg*. -- File name of the export will appear like: *cdrs_$(timestamp).csv* where $(timestamp) will be replaced by unix timestamp of the server running the export process or requested via API call. -- Each exported file will have as content all the CDRs inside time interval defined in the API call. Both TimeStart and TimeEnd are optional, hence being able to obtain a full export of the available CDRs with one API call. -- To be noted here that CGRateS does not keep anywhere a history of exports, hence it is the responsibility of the system administrator to make sure that his exports are not doubled. -- If not otherwise defined, each line within the exported file will follow an internally predefined template: -cgrid,mediation_runid,tor,accid,reqtype,direction,tenant,category,account,subject,destination,setup_time,answer_time,usage,cost - :: - - $(cgrid),$(mediation_runid),$(tor),$(accid),$(reqtype),$(direction),$(direction),$(tenant),$(category),$(account),$(subject),$(destination),$(setup_time),$(answer_time),$(usage),$(cost) - - The significance of the fields exported: - - tor: type of record, meta-field, should map to one of the TORs hardcoded inside the server <*voice|*data|*sms> - - accid: represents the unique accounting id given by the telecom switch generating the CDR - - cdrhost: represents the IP address of the host generating the CDR (automatically populated by the server) - - cdrsource: formally identifies the source of the CDR (free form field) - - reqtype: matching the supported request types by the **CGRateS**, accepted values are hardcoded in the server . - - direction: matching the supported direction identifiers of the CGRateS <*out> - - tenant: tenant whom this record belongs - - category: free-form filter for this record, matching the category defined in rating profiles. - - account: account id (accounting subsystem) the record should be attached to - - subject: rating subject (rating subsystem) this record should be attached to - - destination: destination to be charged - - setup_time: set-up time of the event. Supported formats: datetime RFC3339 compatible, SQL datetime (eg: MySQL), unix timestamp. - - answer_time: answer time of the event. Supported formats: datetime RFC3339 compatible, SQL datetime (eg: MySQL), unix timestamp. - - usage: event usage information (eg: in case of tor=*voice this will represent the total duration of a call) - - extra_cdr_fields: - - selected list of cdr_extra fields via *cgrates.cfg* configuration or - - alphabetical order of the cdr extra fields stored in cdr_extra table - - -Sample CDR export file content which was made available at path: */var/log/cgrates/cdr/out/cgr/csv/cdrs_1384104724.csv* -:: - - dbafe9c8614c785a65aabd116dd3959c3c56f7f6,default,*voice,dsafdsaf,rated,*out,cgrates.org,call,1001,1001,1002,2013-11-07T08:42:25Z,2013-11-07T08:42:26Z,10000000000,1.0100 - - -CGR-FWV -------- - -Fixed width form of export CDR. Advanced template configuration available via *.xml* configuration file. - - -Hybrid CSV-FWV --------------- - -For advanced needs **CGRateS** supports exporting the CDRs as combination between *.csv* and *.fwv* formats. \ No newline at end of file diff --git a/docs/cdrs.rst b/docs/cdrs.rst index e524d9801..17e9ca9dc 100644 --- a/docs/cdrs.rst +++ b/docs/cdrs.rst @@ -4,7 +4,7 @@ CDRs ==== -**CDRs** is a standalone subsystem within **CGRateS** responsible to process *CDR* events. It is accessed via :ref:`CGRateS RPC APIs` or separate *HTTP handlers* configured within *http* section inside :ref:`JSON configuration `. +**CDRs** is a standalone subsystem within **CGRateS** responsible to process *CDR* events. It is accessed via `CGRateS RPC APIs `_ or separate *HTTP handlers* configured within *http* section inside :ref:`JSON configuration `. Due to multiple interfaces exposed, the **CDRs** is designed to function as centralized server for *CDRs* received from various sources. Examples of such sources are: *\*real-time events* from interfaces like *Diameter*, *Radius*, *Asterisk*, *FreeSWITCH*, *Kamailio*, *OpenSIPS* diff --git a/docs/cdrserver.rst b/docs/cdrserver.rst deleted file mode 100644 index 3f3eb8124..000000000 --- a/docs/cdrserver.rst +++ /dev/null @@ -1,125 +0,0 @@ -CDR Server -========== - -An important component of every rating system is represented by the CDR Server. CGRateS includes an out of the box CDR Server component, controlable in the configuration file and supporting multiple interfaces for CDR feeds. This component makes the CDRs real-time accessible (influenced by the time of receiving them) to CGRateS subsystems. - -Following interfaces are supported: - - -CDR-CGR -------- - -Available as handler within http server. - -To feed CDRs in via this interface, one must use url of the form: . - -The CDR fields are received via http form (although for simplicity we support inserting them within query parameters as well) and are expected to be urlencoded in order to transport special characters reliably. All fields are expected by CGRateS as string, particular conversions being done on processing each CDR. -The fields received are split into two different categories based on CGRateS interest in them: - -Primary fields: the fields which CGRateS needs for it's own operations and are stored into cdrs_primary table of storDb. - - -- ToR: type of record, meta-field, should map to one of the TORs hardcoded inside the server <*voice|*data|*sms> -- OriginID: represents the unique accounting id given by the telecom switch generating the CDR -- OrderID: Stor order id used as export order id -- OriginHost: represents the IP address of the host generating the CDR (automatically populated by the server) -- Source: formally identifies the source of the CDR (free form field) -- RequestType: matching the supported request types by the **CGRateS**, accepted values are hardcoded in the server . -- Category: free-form filter for this record, matching the category defined in rating profiles. -- Tenant: tenant whom this record belongs -- Account: account id (accounting subsystem) the record should be attached to -- Subject: rating subject (rating subsystem) this record should be attached to -- Destination: destination to be charged -- SetupTime: set-up time of the event. Supported formats: datetime RFC3339 compatible, SQL datetime (eg: MySQL), unix timestamp. -- AnswerTime: answer time of the event. Supported formats: datetime RFC3339 compatible, SQL datetime (eg: MySQL), unix timestamp. -- Usage: event usage information (eg: in case of tor=*voice this will represent the total duration of a call) -- CostSource: The source of this cost -- Rated: Mark the CDR as rated so we do not process it during rating - -Extra fields: any field coming in via the http request and not a member of primary fields list. These fields are stored as json encoded into *cdrs_extra* table of storDb. - -Example of sample CDR generated simply using curl: -:: - - curl --data "ToR=*voice \ - &Source=curl_cdr \ - &OrderID=abcde \ - &OriginHost=192.168.1.2 \ - &Source=sbc1 \ - &OriginID=qwerty3234567 \ - &ToR=*voice \ - &RequestType=*raw \ - &Tenant=192.168.56.66 \ - &Category=call \ - &Account=1004 \ - &Subject=1004 \ - &Destination=%2B4986517174963 \ - &SetupTime=2018-05-21T12:32:50Z \ - &AnswerTime=2018-05-21T12:32:56Z \ - &Usage=306 \ - &CostSource=*cdrs" http://127.0.0.1:2080/cdr_http - - - -CDR-FS_JSON ------------ - -Available as handler within http server, it implements the mechanism to store CDRs received from FreeSWITCH mod_json_cdr. - -This interface is available at url: . - -This handler has a different implementation logic than the previous CDR-CGR, filtering fields received in the CDR from FreeSWITCH based on predefined configuration. -The mechanism of extracting CDR information out of JSON encoded CDR received from FreeSWITCH is the following: - -- When receiving the CDR from FreeSWITCH, CGRateS will extract the content of ''variables'' object. -- Content of the ''variables'' will be filtered out and the following information will be stored into an internal CDR object: - - Fields used by CGRateS in primary mediation, known as primary fields. These are: - - uuid: internally generated uuid by FreeSWITCH for the call - - sip_local_network_addr: IP address of the FreeSWITCH box generating the CDR - - sip_call_id: call id out of SIP protocol - - cgr_reqtype: request type as understood by the CGRateS - - cgr_category: call category (optional) - - cgr_tenant: tenant this call belongs to (optional) - - cgr_account: account id in CGRateS (optional) - - cgr_subject: rating subject in CGRateS (optional) - - cgr_destination: destination being rated (optional) - - user_name: username as seen by FreeSWITCH (considered if cgr_subject or cgr_account not present) - - dialed_extension: destination number considered if cgr_destination is missing - - Fields stored at request in cdr_extra and definable in configuration file under *extra_fields*. -- Once the content will be filtered, the real CDR object will be processed, stored into storDb under *cdrs_primary* and *cdrs_extra* tables and, if configured, it will be passed further for mediation. - - -CDR-RPC -------- - -Available as RPC handler on top of CGR APIs exposed (in-process as well as GOB-RPC and JSON-RPC). This interface is used for example by CGR-SM component capturing the CDRs over event interface (eg: OpenSIPS or FreeSWITCH-ZeroConfig scenario) - -The RPC function signature looks like this: -:: - - CDRSV1.ProcessCdr(cdr *utils.StoredCdr, reply *string) error - - -The simplified StoredCdr object is represented by following: -:: - - type StoredCdr struct { - CgrId string - OrderId int64 // Stor order id used as export order id - ToR string // type of record, meta-field, should map to one of the TORs hardcoded inside the server <*voice|*data|*sms> - AccId string // represents the unique accounting id given by the telecom switch generating the CDR - CdrHost string // represents the IP address of the host generating the CDR (automatically populated by the server) - CdrSource string // formally identifies the source of the CDR (free form field) - ReqType string // matching the supported request types by the **CGRateS**, accepted values are hardcoded in the server . - Direction string // matching the supported direction identifiers of the CGRateS <*out> - Tenant string // tenant whom this record belongs - Category string // free-form filter for this record, matching the category defined in rating profiles. - Account string // account id (accounting subsystem) the record should be attached to - Subject string // rating subject (rating subsystem) this record should be attached to - Destination string // destination to be charged - SetupTime time.Time // set-up time of the event. Supported formats: datetime RFC3339 compatible, SQL datetime (eg: MySQL), unix timestamp. - AnswerTime time.Time // answer time of the event. Supported formats: datetime RFC3339 compatible, SQL datetime (eg: MySQL), unix timestamp. - Usage time.Duration // event usage information (eg: in case of tor=*voice this will represent the total duration of a call) - ExtraFields map[string]string // Extra fields to be stored in CDR - } - diff --git a/docs/cdrstats.rst b/docs/cdrstats.rst deleted file mode 100644 index ec7b26fff..000000000 --- a/docs/cdrstats.rst +++ /dev/null @@ -1,174 +0,0 @@ -.. _cdrstats-main: - -CDR Stats Server -================ - -Collects CDRs from various sources (eg: CGR-CDRS, CGR-Mediator, CGR-SM, -third-party CDR source via RPC) and builds real-time stats based on them. Each -StatsQueue has attached *ActionTriggers* with monitoring and actions -capabilities. - - -Principles of functionality: - -- Standalone component (can be started individually on remote hardware, isolated form other CGRateS compoenents). -- Performance oriented. Should be able to process tens of thousands of CDRs per second. -- Cache driven technology. But SaveInterval can be set to store this information - on redis. -- Stats are build within *StatsQueues* a CDR Stats Server being able to support - unlimited number of StatsQueues. Each CDR will be passed to all of StatsQueues - available and will be processed by individual StatsQueue based on configuration. -- Stats will be build inside Metrics (eg: ASR, ACD, ACC, TCC) and attached to specific StatsQueue. -- Each StatsQueue will have attached one *ActionTriggers* profile which will - monitor Metrics values and react on thresholds reached (unlimited number of - thresholds and reactions configurable). -- CDRs are processed by StatsQueues if they pass CDR field filters. -- CDRs are auto-removed from StatsQueues in a *fifo* manner if the QueueLength - is reached or if they do not longer fit within TimeWindow defined. - - -Configuration -------------- - -Individual StatsQueue configurations are loaded inside TariffPlan defitions, one -configuration object is internally represented as: - -:: - - type CdrStats struct { - Id string // Config id, unique per config instance - QueueLength int // Number of items in the stats buffer - TimeWindow time.Duration // Will only keep the CDRs who's call setup time is not older than time.Now()-TimeWindow - SaveInterval time.Duration // Interval to store the info into database - Metrics []string // ASR, ACD, ACC, TCC, TCD, PDD - SetupInterval []time.Time // CDRFieldFilter on SetupInterval, 2 or less items (>= start interval,< stop_interval) - ToR []string // CDRFieldFilter on TORs - CdrHost []string // CDRFieldFilter on CdrHosts - CdrSource []string // CDRFieldFilter on CdrSources - ReqType []string // CDRFieldFilter on ReqTypes - Direction []string // CDRFieldFilter on Directions - Tenant []string // CDRFieldFilter on Tenants - Category []string // CDRFieldFilter on Categories - Account []string // CDRFieldFilter on Accounts - Subject []string // CDRFieldFilter on Subjects - DestinationPrefix []string // CDRFieldFilter on DestinationPrefixes - UsageInterval []time.Duration // CDRFieldFilter on UsageInterval, 2 or less items (>= Usage, = Pdd, =Cost, ` via a rich set of *APIs*. As input **ChargerS** is capable of receiving generic events (hashmaps) with dynamic types for fields. +It works as standalone component of **CGRateS**, accessible via `CGRateS RPC `_ via a rich set of *APIs*. As input **ChargerS** is capable of receiving generic events (hashmaps) with dynamic types for fields. **ChargerS** is an **important** part of the charging process within **CGRateS** since with no *ChargingProfile* matching, there will be no billing run performed. @@ -59,6 +61,6 @@ Use cases * Calculating standard charges for the *Customer* calling as well as for the *Reseller*/*Distributor*. One can build chains of charging rules if multiple *Resellers* are involved. * Calculating revenue based on *Customer* vs *Supplier* pricing. -* Calculating pricing for multiple *Suppliers* for revenue protection. +* Calculating pricing for multiple *RouteS* for revenue protection. * Adding *local* vs *mobile* charges for *premium numbers* when accessed from mobile headsets. * etc. \ No newline at end of file diff --git a/docs/csv_tpdestinationrates.rst b/docs/csv_tpdestinationrates.rst deleted file mode 100644 index 8e7a6240c..000000000 --- a/docs/csv_tpdestinationrates.rst +++ /dev/null @@ -1,32 +0,0 @@ -DestinationRates.csv -++++++++++++++++++++ - -Attach rates to destinations. - -CSV fields as tabular representation: - -+--------------------+------------------+---------------------+ -| Tag | DestinationsTag | RatesTag | -+====================+==================+=====================+ -| DR_RETAIL_PEAK | GERMANY | LANDLINE_PEAK | -+--------------------+------------------+---------------------+ -| DR_RETAIL_OFFPEAK | GERMANY | LANDLINE_OFFPEAK | -+--------------------+------------------+---------------------+ - -**Fields** - -Index 0 - *Tag* - Free-text field used to reference the entry from other files. - -Index 1 - *DestinationsTag* - References profile in Destinations.csv_. - -Index 2 - *RatesTag* - References profile defined in Rates.csv_. - - -.. _Destinations.csv: csv_tpdestinations.rst -.. _Rates.csv: csv_tprates.rst - - - diff --git a/docs/csv_tpdestinations.rst b/docs/csv_tpdestinations.rst deleted file mode 100644 index 0babc6429..000000000 --- a/docs/csv_tpdestinations.rst +++ /dev/null @@ -1,21 +0,0 @@ -Destinations.csv -++++++++++++++++ - -Group together prefixes into destination groups identified by tag. - -CSV fields example as tabular representation: - -+------------+--------+ -| Tag | Prefix | -+============+========+ -| GERMANY | 49 | -+------------+--------+ -| GERMANY_O2 | 49176 | -+------------+--------+ - -Index 0 - *Tag* - Free-text field used to reference the specific destination from other files. - -Index 1 - *Prefix* - Destination prefix as group element - diff --git a/docs/csv_tpdestratetimings.rst b/docs/csv_tpdestratetimings.rst deleted file mode 100644 index 44113bcea..000000000 --- a/docs/csv_tpdestratetimings.rst +++ /dev/null @@ -1,35 +0,0 @@ -DestinationRateTimings.csv -++++++++++++++++++++++++++ - -Enable DestinationRates at specific times. - -CSV fields examples as tabular representations: - -+-----------------+----------------------+-----------+--------+ -| Tag | DestinationRatesTag | TimingTag | Weight | -+=================+======================+===========+========+ -| RETAIL1 | DR_RETAIL_PEAK | PEAK | 10 | -+-----------------+----------------------+-----------+--------+ -| RETAIL1 | DR_FREESWITCH_USERS | ALWAYS | 10 | -+-----------------+----------------------+-----------+--------+ - - -**Fields** - -Index 0 - *Tag* - Free-text field used to reference the entry from other files. - -Index 1 - *DestinationRatesTag* - References profile in DestinationRates.csv_. - -Index 2 - *TimingTag* - References profile defined in Timings.csv_. - -Index 3 - *Weight* - Solves possible conflicts between different DestinationRateTimings profiles matching on same interval. - Higher *Weight* has higher priority. - - -.. _DestinationRates.csv: csv_tpdestinationrates.html -.. _Timings.csv: csv_tptimings.html - diff --git a/docs/csv_tprates.rst b/docs/csv_tprates.rst deleted file mode 100644 index 60597a779..000000000 --- a/docs/csv_tprates.rst +++ /dev/null @@ -1,77 +0,0 @@ -Rates.csv -+++++++++ - -Defines the rates on the system. -Each entry is a part of a rate group, each group having at least one entry. Group entries share *Tag*, *ConnectFee*, *Weight* parameters. - -CSV fields example as tabular representation: - -+---------------------+------------+------+----------+---------------+--------------------+----------------+------------------+---------+ -| Tag | ConnectFee | Rate | RateUnit | RateIncrement | GroupIntervalStart | RoundingMethod | RoundingDecimals | Weight | -+=====================+============+======+==========+===============+====================+================+==================+=========+ -| LANDLINE_PEAK | 0.02 | 0.02 | 60s | 60s | 0s | \*up | 4 | 10 | -+---------------------+------------+------+----------+---------------+--------------------+----------------+------------------+---------+ -| MOBILE_PEAK | 1 | 2 | 60s | 10s | 0s | \*middle | 4 | 10 | -+---------------------+------------+------+----------+---------------+--------------------+----------------+------------------+---------+ -| MOBILE_PEAK | 1 | 1 | 60s | 20s | 40s | \*middle | 4 | 10 | -+---------------------+------------+------+----------+---------------+--------------------+----------------+------------------+---------+ -| MOBILE_PEAK | 1 | 0 | 60s | 10s | 60s | \*middle | 4 | 10 | -+---------------------+------------+------+----------+---------------+--------------------+----------------+------------------+---------+ - - - -Index 0 - *Tag* - Free-text field used to reference the entry from other files. - -Index 1 - *ConnectFee* - Connect fee charged at start of each call. Should be the same for all members of a group interval. - - Possible values: - * Float or integer value, granularity given by rates administrator and not predefined (eg: cent vs euro). - -Index 2 - *Rate* - The rate which will be charged. - - Possible values: - * Float or integer value, granularity given by rates administrator and not predefined (eg: cent vs euro). - -Index 3 - *RateUnit* - The duration unit which is rated by *Rate* field. - - Possible values: - * Duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". - -Index 4 - *RateIncrement* - The total duration will be split and rounded into smaller intervals based on this (eg: for *RateIncrement* of 60s, total duration of 1m2s will be charged as 2 minutes). - - Possible values: - * Duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". - -Index 5 - *GroupIntervalStart* - The position in the rate group. - - Possible values: - * Duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". - -Index 6 - *RoundingMethod* - The routine which will round the cost on each timespan. - - Possible values: - * A *MetaTag* referring the internal routine doing the rounding (eg: \*up, \*down, \*middle) - -Index 7 - *RoundingDecimals* - Round the number of decimals of each timespan based on this setting. - - Possible values: - * An integer value. - -Index 8 - *Weight* - Solve possible conflicts between different rates matching same interval based on this parameter. - Higher *Weight* has bigger priority. - Should be the same for all members of a group interval. - - Possible values: - * Float/Integer representing the rate weight on collisions. - - - diff --git a/docs/csv_tpratingprofiles.rst b/docs/csv_tpratingprofiles.rst deleted file mode 100644 index 8ff0a9322..000000000 --- a/docs/csv_tpratingprofiles.rst +++ /dev/null @@ -1,39 +0,0 @@ -RatingProfiles.csv -++++++++++++++++++ - -Main definitions file for the Rating subsystem. - -+------------------+------+-----------+---------+-----------------------+----------------------------+----------------------+ -| Tenant | ToR | Direction | Subject | ActivationTime | DestinationRateTimingTag | RatesFallbackSubject | -+==================+======+===========+=========+=======================+============================+======================+ -| cgrates.org | call | \*out | \*any | 2012-01-01T00:00:00Z | RETAIL1 | | -+------------------+------+-----------+---------+-----------------------+----------------------------+----------------------+ - -**Fields** - -Index 0 - *Tenant* - Free-text field used to identify the tenant the entries are valid for. -Index 1 - *ToR* - Free-text field used to identify the type of record the entries are valid for. -Index 2 - *Direction* - *Metatag* identifying the traffic direction the entries are valid for. Outbound direction is the only one supported for now. -Index 3 - *Subject* - Rating subject definition. - - Possible values: - * Free-text rating subject (flexible defition for example out of concatenating various cdr fields) - * "\*any" metatag matching any rating subject in the eventuality of no explicit subject string matching. -Index 4 - *ActivationTime* - Time this rating profile gets active at. - - Possible values: - * RFC3339 time as string - * Unix timestamp - * String starting with "+" to represent duration dynamically calculated at runtime (eg: +1h to specify ActivationTime one hour after runtime). - * "\*monthly" metatag for ActivationTime dynamically calculated one month after runtime. -Index 4 - *DestinationRateTimingTag* - References profile in DestinationRateTimings.csv_. -Index 5 - *RatesFallbackSubject* - Name of the fallback subject to be considered if existing subject has no destination matching the one searched. *Tenant*, *ToR*, *Direction*, *Subject* are kept when matching the fallback profile. - -.. _DestinationRateTimings.csv: csv_tpdestinationrates.html diff --git a/docs/csv_tptimings.rst b/docs/csv_tptimings.rst deleted file mode 100644 index 52ede667f..000000000 --- a/docs/csv_tptimings.rst +++ /dev/null @@ -1,60 +0,0 @@ -Timings.csv -+++++++++++ - -Holds time related definitions. - -CSV fields examples as tabular representations: - -+-----------------+--------+--------+-----------+-----------+----------+ -| Tag | Years | Months | MonthDays | WeekDays | Time | -+=================+========+========+===========+===========+==========+ -| WORKDAYS | \*any | \*any | \*any | 1;2;3;4;5 | 00:00:00 | -+-----------------+--------+--------+-----------+-----------+----------+ -| WEEKENDS | \*any | \*any | \*any | 6;7 | 00:00:00 | -+-----------------+--------+--------+-----------+-----------+----------+ -| ALWAYS | \*any | \*any | \*any | \*any | 00:00:00 | -+-----------------+--------+--------+-----------+-----------+----------+ -| ASAP | \*any | \*all | \*all | \*all | \*asap | -+-----------------+--------+--------+-----------+-----------+----------+ - -**Fields** - -Index 0 - *Tag* - Free-text field used to reference the entry from other files. - -Index 1 - *Years* - Years this timing is valid on. - - Possibile values: - * Semicolon (;) separated list of years as descriptive filter. - * "\*any" metatag used as match-any filter. - -Index 2 - *Months* - Months this timing is valid on. - - Possibile values: - * Semicolon (;) separated list of months as descriptive filter. - * "\*any" metatag used as match-any filter. - -Index 3 - *MonthDays* - Days of a month this timing is valid on. - - Possibile values: - * Semicolon (;) separated list of month days as descriptive filter. - * "\*any" metatag used as match-any filter. - -Index 4 - *WeekDays* - Days of a week this timing is valid on. Week days represented as integers where 1=Monday and 7=Sunday - - Possibile values: - * Semicolon (;) separated list of week days as descriptive filter. - * "\*any" metatag used as match-any filter. - -Index 4 - *Time* - The start time for this time period. - - Possible values: - * String representation of time (hh:mm:ss). - * "\*asap" metatag used to represent time converted at runtime. - - diff --git a/docs/datadb.rst b/docs/datadb.rst index f7f8c6001..b63abc40a 100644 --- a/docs/datadb.rst +++ b/docs/datadb.rst @@ -1,3 +1,5 @@ +.. _datadb: + DataDB ====== diff --git a/docs/derived_charging.rst b/docs/derived_charging.rst deleted file mode 100644 index 3ca545db4..000000000 --- a/docs/derived_charging.rst +++ /dev/null @@ -1,37 +0,0 @@ -DerivedCharging -=============== - -DerivedCharging is the process of forking original request into a number (configured) of emulated ones, derived from the original parameters. This mechanism used in combination with multi-tenancy supported by default by **CGRateS** can give out complex charging scenarios, needed for example in case of whitelabel-ing. - -DerivedCharging occurs in two separate places: - -- SessionManager: necessary to handle each derived (emulated) session in it's individuall loop (eg: individual resellers will have their own charging policies implemented, some paying per minute, others per second and so on) and keep them in sync (eg: one reseller is left out of money, original call should be disconnected and all emulated sessions should end their debit loops). -- Mediator: necessary to fork the CDRs into a number of derived ones influenced by the derived charging configuration and rate them individually. - -Configuration -------------- - -DerivedCharging is configured in two places: - -- Platform level configured within *cgrates.cfg* file. -- Account level configured as part of TarrifPlans defition or interactively via RPC methods. - -One DerivedCharger object will be configured by an internal object like: -:: - - type DerivedCharger struct { - RunId string // Unique runId in the chain - RunFilters string // Only run the charger if all the filters match - ReqTypeField string // Field containing request type info, number in case of csv source, '^' as prefix in case of static values - DirectionField string // Field containing direction info - TenantField string // Field containing tenant info - CategoryField string // Field containing tor info - AccountField string // Field containing account information - SubjectField string // Field containing subject information - DestinationField string // Field containing destination information - SetupTimeField string // Field containing setup time information - AnswerTimeField string // Field containing answer time information - UsageField string // Field containing usage information - } - -**CGRateS** is able to attach an unlimited number of DerivedChargers to a single request, based on configuration. \ No newline at end of file diff --git a/docs/freeswitch.rst b/docs/freeswitch.rst index 8c025b274..add0c351f 100644 --- a/docs/freeswitch.rst +++ b/docs/freeswitch.rst @@ -1,4 +1,4 @@ -.. _FreeSWITCH: http://www.freeswitch.org +.. _FreeSWITCH: https://freeswitch.com/ FreeSWITCH integration diff --git a/docs/history.rst b/docs/history.rst deleted file mode 100644 index 63209b91d..000000000 --- a/docs/history.rst +++ /dev/null @@ -1,19 +0,0 @@ -Rating history -============== - -Enhances CGRateS with ability to archive rates modifications. - -Large scaling posibility using server-agents approach. -In a distributed environment, there will be a single server (which can be backed up using technologies such as Linux-HA) and more agents sending the modifications to be archived. - -History-Agent -------------- - -Integrated in the rating loader components. - -Part of *cgr-engine* and *cgr-loader*. - -Enabled via *history_agent* configuration section within *cgr-engine* and *history_server* command line parameter in case of *cgr-loader*. - -Sends the complete rating data loaded into dataDb to *history_server* for archiving. - diff --git a/docs/importing.rst b/docs/importing.rst deleted file mode 100644 index c3409c4d9..000000000 --- a/docs/importing.rst +++ /dev/null @@ -1,244 +0,0 @@ -.. _data-importing: - -Data importing -============== - -For importing the data into CGRateS database we are using cvs files. The import process can be started as many times it is desired with one ore more csv files and the existing values are overwritten. If the -flush option is used then the database is cleaned before importing.For more details see the cgr-loader tool from the tutorial chapter. - -The rest of this section we will describe the content of every csv files. - -Rates profile --------------- - -The rates profile describes the prices to be applied for various calls to various destinations in various time frames. When a call is made the CGRateS system will locate the rates to be applied to the call using the rating profiles. - -+------------+-----+-----------+-------------+----------------------+----------------+----------------------+ -| Tenant | ToR | Direction | Subject | RatesFallbackSubject | RatesTimingTag | ActivationTime | -+============+=====+===========+=============+======================+================+======================+ -| CUSTOMER_1 | 0 | OUT | rif:from:tm | danb | PREMIUM | 2012-01-01T00:00:00Z | -+------------+-----+-----------+-------------+----------------------+----------------+----------------------+ -| CUSTOMER_1 | 0 | OUT | rif:from:tm | danb | STANDARD | 2012-02-28T00:00:00Z | -+------------+-----+-----------+-------------+----------------------+----------------+----------------------+ - -Tenant - Used to distinguish between carriers if more than one share the same database in the CGRates system. -ToR - Type of record specifies the kind of transmission this rate profile applies to. -Direction - Can be IN or OUT for the INBOUND and OUTBOUND calls. -Subject - The client/user for who this profile is detailing the rates. -RatesFallbackSubject - This specifies another profile to be used in case the call destination will not be found in the current profile. The same tenant, tor and direction will be used. -RatesTimingTag - Forwards to a tag described in the rates timing file to be used for this profile. -ActivationTime - Multiple rates timings/prices can be created for one profile with different activation times. When a call is made the appropriate profile(s) will be used to rate the call. So future prices can be defined here and the activation time can be set as appropriate. - -Rates timing -~~~~~~~~~~~~ - -This file makes links between a ratings and timings so each of them can be described once and various combinations are made possible. - -+----------+----------------+--------------+--------+ -| Tag | RatesTag | TimingTag | Weight | -+==========+================+==============+========+ -| STANDARD | RT_STANDARD | WORKDAYS_00 | 10 | -+----------+----------------+--------------+--------+ -| STANDARD | RT_STD_WEEKEND | WORKDAYS_18 | 10 | -+----------+----------------+--------------+--------+ - -Tag - A string by witch this rates timing will be referenced in other places by. -RatesTag - The rating tag described in the rates file. -TimingTag - The timing tag described in the timing file -Weight - If multiple timings cab be applied to a call the one with the lower weight wins. An example here can be the Christmas day: we can have a special timing for this day but the regular day of the week timing can also be applied to this day. The weight will differentiate between the two timings. - - -Rates -~~~~~ -Defines price groups for various destinations which will be associated to various timings. - -+---------------------+-----------------+------------+-------+-------------+ -| Tag | DestinationsTag | ConnectFee | Price | BillingUnit | -+=====================+=================+============+=======+=============+ -| RT_STANDARD | GERMANY | 0 | 0.2 | 1 | -+---------------------+-----------------+------------+-------+-------------+ -| RT_STANDARD | GERMANY_O2 | 0 | 0.1 | 1 | -+---------------------+-----------------+------------+-------+-------------+ - - -Tag - A string by witch this rate will be referenced in other places by. -DestinationsTag - The destination tag witch these rates apply to. -ConnectFee - The price to be charged once at the beginning of the call to the specified destination. -Price - The price for the billing unit expressed in cents. -BillingUnit - The billing unit expressed in seconds - -Timings -~~~~~~~ -Describes the time periods that have different rates attached to them. - -+-----------------+--------+-----------+-----------+----------+ -| Tag | Months | MonthDays | WeekDays | StartTime| -+=================+========+===========+===========+==========+ -| WORKDAYS | \*all | \*all | 1;2;3;4;5 | 00:00:00 | -+-----------------+--------+-----------+-----------+----------+ -| WEEKENDS | \*all | \*all | 6,7 | 00:00:00 | -+-----------------+--------+-----------+-----------+----------+ -| DAILY_SAME_TIME | \*all | \*all | \*all | \*now | -+-----------------+--------+-----------+-----------+----------+ -| ONE_TIME_RUN | \*none | \*none | \*none | \*now | -+-----------------+--------+-----------+-----------+----------+ - -Tag - A string by witch this timing will be referenced in other places by. -Months - Integers from 1=January to 12=December separated by semicolons (;) specifying the months for this time period. -MonthDays - Integers from 1 to 31 separated by semicolons (;) specifying the month days for this time period. -WeekDays - Integers from 1=Monday to 7=Sunday separated by semicolons (;) specifying the week days for this time period. -StartTime - The start time for this time period. \*now will be replaced with the time of the data importing. - -Destinations -~~~~~~~~~~~~ - -The destinations are binding together various prefixes / caller ids to define a logical destination group. A prefix can appear in multiple destination groups. - -+------------+--------+ -| Tag | Prefix | -+============+========+ -| GERMANY | 49 | -+------------+--------+ -| GERMANY_O2 | 49176 | -+------------+--------+ - -Tag - A string by witch this destination will be referenced in other places by. -Prefix - The prefix or caller id to be added to the specified destination. - -Account actions ---------------- - -Describes the actions to be applied to the clients/users accounts. There are two kinds of actions: timed and triggered. For the timed actions there is a scheduler application that reads them from the database and executes them at the appropriate timings. The triggered actions are executed when the specified balance counters reach certain thresholds. - -The accounts hold the various balances and counters to activate the triggered actions for each the client. - -Balance types are: MONETARY, SMS, INTERNET, INTERNET_TIME, MINUTES. - -+------------+---------+-----------+------------------+------------------+ -|Tenant | Account | Direction | ActionTimingsTag | ActionTriggersTag| -+============+=========+===========+==================+==================+ -| CUSTOMER_1 | rif | OUT | STANDARD_ABO | STANDARD_TRIGGER | -+------------+---------+-----------+------------------+------------------+ -| CUSTOMER_1 | dan | OUT | STANDARD_ABO | STANDARD_TRIGGER | -+------------+---------+-----------+------------------+------------------+ - -Tenant - Used to distinguish between carriers if more than one share the same database in the CGRates system. -Account - The identifier for the user's account. -Direction - Can be IN or OUT for the INBOUND and OUTBOUND calls. -ActionTimingsTag - Forwards to a timed action group that will be used on this account. -ActionTriggersTag - Forwards to a triggered action group that will be applied to this account. - -Action triggers -~~~~~~~~~~~~~~~ -For each account there are counters that record the activity on various balances. Action triggers allow when a counter reaches a threshold to activate a group of actions. After the execution the action trigger is marked as used and will no longer be evaluated until the triggers are reset. See actions for action trigger resetting. - -+------------------+------------+----------------+----------------+------------+--------+ -| Tag | BalanceTag | ThresholdValue | DestinationTag | ActionsTag | Weight | -+==================+============+================+================+============+========+ -| STANDARD_TRIGGER | MONETARY | 30 | \*all | SOME_1 | 10 | -+------------------+------------+----------------+----------------+------------+--------+ -| STANDARD_TRIGGER | SMS | 30 | \*all | SOME_2 | 10 | -+------------------+------------+----------------+----------------+------------+--------+ - -Tag - A string by witch this action trigger will be referenced in other places by. -BalanceTag - Specifies the balance counter by which this action will be triggered. Can be MONETARY, SMS, INTERNET, INTERNET_TIME, MINUTES. -ThresholdValue - The value of the balance counter that will trigger this action. -DestinationTag - This field is used only if the balanceTag is MINUTES. If the balance counter monitors call minutes this field indicates the destination of the calls for which the minutes are recorded. -ActionsTag - Forwards to an action group to be executed when the threshold is reached. -Weight - Specifies the order for these triggers to be evaluated. If there are multiple triggers are fired in the same time the ones with the lower weight will be executed first. - -Action timings -~~~~~~~~~~~~~~ - -+--------------+------------+------------------+--------+ -| Tag | ActionsTag | TimingTag | Weight | -+==============+============+==================+========+ -| STANDARD_ABO | SOME | WEEKLY_SAME_TIME | 10 | -+--------------+------------+------------------+--------+ -| STANDARD_ABO | SOME | WEEKLY_SAME_TIME | 10 | -+--------------+------------+------------------+--------+ - -Tag - A string by witch this action timing will be referenced in other places by. -ActionsTag - Forwards to an action group to be executed when the timing is right. -TimingTag - A timing (one time or recurrent) at which the action group will be executed -Weight - Specifies the order for these timings to be evaluated. If there are multiple action timings set to be execute on the same time the ones with the lower weight will be executed first. - -Actions -~~~~~~~ - -+--------+-------------+------------+-------+----------------+-----------+------------+---------------+--------+ -| Tag | Action | BalanceTag | Units | DestinationTag | PriceType | PriceValue | MinutesWeight | Weight | -+========+=============+============+=======+================+===========+============+===============+========+ -| SOME | TOPUP_RESET | MONETARY | 10 | \*all | | | | 10 | -+--------+-------------+------------+-------+----------------+-----------+------------+---------------+--------+ -| SOME_1 | DEBIT | MINUTES | 10 | GERMANY_O2 | PERCENT | 25 | 10 | 10 | -+--------+-------------+------------+-------+----------------+-----------+------------+---------------+--------+ - -Tag - A string by witch this action will be referenced in other places by. -Action - The action type. Can have one of the following: - - + LOG: Logs the other action values (for debugging purposes). - + RESET_TRIGGERS: Marks all action triggers as ready to be executed. - + SET_POSTPAID: Sets account to postpaid, maintains it's balances. - + RESET_POSTPAID: Set account to postpaid, reset all it's balances. - + SET_PREPAID: Sets account to prepaid, maintains it's balances. Makes sense after an account was set to POSTPAID and admin wants it back. - + RESET_PREPAID: Set account to prepaid, reset all it's balances. - + TOPUP_RESET: Add account balance. If previous balance found of the same type, reset it before adding. - + TOPUP: Add account balance. If the specific balance is not defined, define it (eg: minutes per destination). - + DEBIT: Debit account balance. - + RESET_COUNTER: Sets the counter for the BalanceTag to 0 - + RESET_ALL_COUNTERS: Sets all counters to 0 - -BalanceTag - The balance on which the action will operate -Units - The units which will be operated on the balance BalanceTag. -DestinationTag - This field is used only if the balanceTag is MINUTES. Specifies the destination of the minutes to be operated. -PriceType - This field is used only if the balanceTag is MINUTES. Specifies if the minutes price will be absolute or a percent of the normal price, Can be ABSOLUTE or PERCENT. If the value is percent the -PriceValue - This field is used only if the balanceTag is MINUTES. The price for each second. -MinutesWeight - This field is used only if the balanceTag is MINUTES. If more minute balances are suitable for a call the one with smaller weight will be used first. -Weight - If there are multiple actions in a group, they will be executed in the order of their weight (smaller first). \ No newline at end of file diff --git a/docs/installation.rst b/docs/installation.rst index acb03e9a6..b68a823d6 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -1,7 +1,7 @@ -.. _Redis: http://redis.io -.. _MySQL: http://www.mysql.org -.. _PostgreSQL: http://www.postgresql.org -.. _MongoDB: http://www.mongodb.org +.. _Redis: https://redis.io/ +.. _MySQL: https://dev.mysql.com/ +.. _PostgreSQL: https://www.postgresql.org/ +.. _MongoDB: https://www.mongodb.com/ @@ -51,7 +51,7 @@ Update & install: sudo apt-get install cgrates -Once the installation is completed, one should perform the :ref:`post-install` section in order to have the CGRateS properly set and ready to run. +Once the installation is completed, one should perform the :ref:`post_install` section in order to have the CGRateS properly set and ready to run. After *post-install* actions are performed, CGRateS will be configured in **/etc/cgrates/cgrates.json** and enabled in **/etc/default/cgrates**. @@ -94,7 +94,7 @@ To install CGRateS out of YUM execute the following commands sudo yum update sudo yum install cgrates -Once the installation is completed, one should perform the :ref:`post-install` section in order to have the CGRateS properly set and ready to run. +Once the installation is completed, one should perform the :ref:`post_install` section in order to have the CGRateS properly set and ready to run. After *post-install* actions are performed, CGRateS will be configured in **/etc/cgrates/cgrates.json** and enabled in **/etc/default/cgrates**. @@ -178,7 +178,7 @@ Install Custom Debian / Ubuntu Package Generate RPM Packages from Source -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prerequisites * :ref:`Install Golang ` @@ -209,7 +209,8 @@ Execute the following commands rpmbuild -bb --define "_topdir $HOME/cgr_build" SPECS/cgrates.spec -.. _post-install: +.. _post_install: + Post-install ------------ diff --git a/docs/lcr.rst b/docs/lcr.rst deleted file mode 100644 index f803f39b5..000000000 --- a/docs/lcr.rst +++ /dev/null @@ -1,85 +0,0 @@ -LCR System -========== - -In voice telecommunications, least-cost routing (LCR) is the process of selecting the path of outbound communications traffic based on cost. Within a telecoms carrier, an LCR team might periodically (monthly, weekly or even daily) choose between routes from several or even hundreds of carriers for destinations across the world. This function might also be automated by a device or software program known as a "Least Cost Router." [WIKI2015]_ - -Data structures ---------------- -The LCR rule parameters are: Direction, Tenant, Category, Account, Subject, DestinationId, RPCategory, Strategy, StrategyParameters, ActivationTime, Weight. - -The first five are used to match the rule for a specific call descriptor. They can have a value or marked as \*any. - -The DestinationId can be used to filter the LCR rules entries or to make the rule more specific. - -RPCategory is used to indicate the rating profile category. - -Strategy indicates supplier selection algorithm and StrategyParams will be specific to each strategy. Strategy can be one of the following: - -\*static (filter) - Will use the suppliers provided as params. - StrategyParams: suppier1;supplier2;etc - -\*lowest_cost (sorting) - Matching suppliers will be sorted by ascending cost. - StrategyParams: None - -\*highest_cost (sorting) - Matching suppliers will be sorted by descending cost. - StrategyParams: None - -\*qos_with_threshold (filter) - The system will reject the suppliers that have out of bounds average success ratio or average call duration. - StrategyParams: min_asr;max_asr;min_acd;max_acd;min_tcd;max_tcd;min_acc;max_acc;min_tcc;max_tcc - -\*qos (sorting) - The system will sort by metrics in the order of appearance. - StrategyParams: metric1;metric2;etc - -\*load_distribution (sorting/filter) - The system will sort the suppliers in order to achieve the specified load distribution. - - if all have less than ratio return random order - - if some have a cdr count not divisible by ratio return them first and all ordered by cdr times, oldest first - - if all have a multiple of ratio return in the order of cdr times, oldest first - StrategyParams: supplier1:ratio;supplier2:ratio;*default:ratio - -ActivationTime is the date/time when the LCR entry starts to be active. - -Weight is used to sort the rules with the same activation time. - -Example -+++++++ - -:: - - *in, cgrates.org,call,*any,*any,EU_LANDLINE,LCR_STANDARD,*static,ivo;dan;rif,2012-01-01T00:00:00Z,10 - -Code implementation -------------------- -The general process of getting LCRs is this. - -The LCR rules for a specific call descriptor are searched using direction, tenant, category, account and subject of the call descriptor matched as strictly as possible with LCR rules. - -Because a rule can have several entries they will be sorted by activation time. - -Next the system will find out the most recent LCR entry that applies to this call considering entries activation times. - -The LCR entry is processed according to it's strategy. For static strategy the cost is calculated for each supplier found in the parameters and the suppliers are listed as they are found. - -For the QOS strategies the suppliers are searched using call descriptor parameters (direction, tenant, category, account, subject), than the cdrstats module is queried for the QOS values and the suppliers are filtered or sorted according to the StrategyParameters field. The suppliers that have the QOS parameters in the stats queues but did not get the chance to process any calls are favored in the QOS sorting algorithm. If a certain QOS metric is missing from the supplier queues than the metric is ignored and the sorting or filtering is done using the next metrics that are considered. - -For the lowest/highest cost strategies the matched suppliers are sorted ascending/descending on cost. - -:: - - { - "Entry": { - "DestinationId": "*any", - "RPCategory": "LCR_STANDARD", - "Strategy": "*lowest_cost", - "StrategyParams": "", - "Weight": 20 - }, - "SupplierCosts": [{"Supplier":"rif", Cost:"2.0"},{"Supplier":"dan", Cost:"1.0"}] - } - -.. [WIKI2015] http://en.wikipedia.org/wiki/Least-cost_routing diff --git a/docs/overview.rst b/docs/overview.rst index efd1106d9..f391c77d1 100644 --- a/docs/overview.rst +++ b/docs/overview.rst @@ -2,8 +2,8 @@ .. _Go: http://golang.org .. _Docker: https://www.docker.com/ .. _Kafka: https://kafka.apache.org/ -.. _redis: http://redis.io -.. _mongodb: http://www.mongodb.org +.. _redis: https://redis.io/ +.. _mongodb: https://www.mongodb.com/ .. _api docs: https://godoc.org/github.com/cgrates/cgrates/apier .. _SQS: https://aws.amazon.com/de/sqs/ .. _AMQP: https://www.amqp.org/ diff --git a/docs/rals.rst b/docs/rals.rst index e62c283e6..4f8e05089 100644 --- a/docs/rals.rst +++ b/docs/rals.rst @@ -1,8 +1,10 @@ +.. _rals: + RALs ==== -**RALs** is a standalone subsystem within **CGRateS** designed to handle two major tasks: :ref:`Rating` and :ref:`Accounting`. It is accessed via :ref:`CGRateS RPC APIs`. +**RALs** is a standalone subsystem within **CGRateS** designed to handle two major tasks: :ref:`Rating` and :ref:`Accounting`. It is accessed via `CGRateS RPC APIs `_. @@ -377,7 +379,7 @@ LastExecutionTime Action ------ -Actions are routines executed on demand (ie. by one of the three subsystems: :ref:`SchedulerS`, :ref:`ThresholdS` or :ref:`ActionTriggers`) or called by API by external scripts. +Actions are routines executed on demand (ie. by one of the three subsystems: :ref:`SchedulerS`, :ref:`ThresholdS` or :ref:`ActionTriggers `) or called by API by external scripts. An *Action has the following parameters: @@ -424,7 +426,7 @@ ActionType Debit the value from the :ref:`Balance` matching the filters. **\*reset_counters** - Reset the :ref:`Balance` counters (used by :ref:`ActionTriggers ). + Reset the :ref:`Balance` counters (used by :ref:`ActionTriggers `). **\*enable_account** Unset the :ref:`Account` *Disabled* flag. diff --git a/docs/readthedocs/accountLifeCycle.rst b/docs/readthedocs/accountLifeCycle.rst deleted file mode 100644 index a87d9cd59..000000000 --- a/docs/readthedocs/accountLifeCycle.rst +++ /dev/null @@ -1,730 +0,0 @@ -2. User Life Cycle -================== - -Following steps will cover use-case "User Life cycle" - -2.1 User Management -------------------- - -2.1.1 Create User Account -######################### - -:Hint: - cgr> account_set Tenant="cgrates.org" Account="1003" ActionPlanIDs=["PACKAGE_10"] ActionTriggerIDs=["STANDARD_TRIGGERS"] - -*Request* - -:: - - { - "method": "APIerSv2.SetAccount", - "params": [{ - "Tenant": "cgrates.org", - "Account": "1003", - "ActionPlanIDs": ["PACKAGE_10"], - "ActionPlansOverwrite": false, - "ActionTriggerIDs": ["STANDARD_TRIGGERS"], - "ActionTriggerOverwrite": false, - "AllowNegative": null, - "Disabled": null, - "ReloadScheduler": false - }], - "id": 0 - } - -*Response* - -:: - - {"id": 0,"result": "OK","error": null} - -2.1.2 Get User Account -###################### - -:Hint: - cgr> accounts Tenant="cgrates.org" AccountIds=["1003"] - -*Request* - -:: - - { - "method": "APIerSv2.GetAccounts", - "params": [{ - "Tenant": "cgrates.org", - "AccountIds": ["1003"], - "Offset": 0, - "Limit": 0 - }], - "id": 1 - } - -*Response* - -:: - - { - "id": 1, - "result": [{ - "ID": "cgrates.org:1003", - "BalanceMap": { - "*monetary": [{ - "Uuid": "df24bcbd-d0e2-4a67-a188-7c9621ae81d7", - "ID": "", - "Value": 0.15, - "Directions": { - "*out": true - }, - "ExpirationDate": "0001-01-01T00:00:00Z", - "Weight": 10, - "DestinationIDs": {}, - "RatingSubject": "", - "Categories": {}, - "SharedGroups": {}, - "Timings": [], - "TimingIDs": {}, - "Disabled": false, - "Factor": {}, - "Blocker": false - }, { - "Uuid": "9a22f090-a49a-4da6-bdca-5e40810e4b18", - "ID": "23456", - "Value": 12, - "Directions": {}, - "ExpirationDate": "0001-01-01T00:00:00Z", - "Weight": 0, - "DestinationIDs": {}, - "RatingSubject": "", - "Categories": {}, - "SharedGroups": {}, - "Timings": [], - "TimingIDs": {}, - "Disabled": false, - "Factor": {}, - "Blocker": false - }, { - "Uuid": "4da21ba2-d899-49b1-ae60-3e8a237a49bb", - "ID": "123456", - "Value": 0.2, - "Directions": { - "*out": true - }, - "ExpirationDate": "0001-01-01T00:00:00Z", - "Weight": 0, - "DestinationIDs": {}, - "RatingSubject": "", - "Categories": {}, - "SharedGroups": {}, - "Timings": [], - "TimingIDs": {}, - "Disabled": false, - "Factor": {}, - "Blocker": false - }] - }, - "UnitCounters": { - "*monetary": [{ - "CounterType": "*event", - "Counters": [{ - "Value": 0, - "Filter": { - "Uuid": null, - "ID": "df4d286a-445f-40a8-ab84-215153d4f2ac", - "Type": "*monetary", - "Value": null, - "Directions": { - "*out": true - }, - "ExpirationDate": null, - "Weight": null, - "DestinationIDs": { - "FS_USERS": true - }, - "RatingSubject": null, - "Categories": null, - "SharedGroups": null, - "TimingIDs": null, - "Timings": [], - "Disabled": null, - "Factor": null, - "Blocker": null - } - }] - }] - }, - "ActionTriggers": [{ - "ID": "STANDARD_TRIGGERS", - "UniqueID": "621cb77f-c427-445f-8dfc-05b8105a1709", - "ThresholdType": "*min_balance", - "ThresholdValue": 2, - "Recurrent": false, - "MinSleep": 0, - "ExpirationDate": "0001-01-01T00:00:00Z", - "ActivationDate": "0001-01-01T00:00:00Z", - "Balance": { - "Uuid": null, - "ID": null, - "Type": "*monetary", - "Value": null, - "Directions": { - "*out": true - }, - "ExpirationDate": null, - "Weight": null, - "DestinationIDs": null, - "RatingSubject": null, - "Categories": null, - "SharedGroups": null, - "TimingIDs": null, - "Timings": [], - "Disabled": null, - "Factor": null, - "Blocker": null - }, - "Weight": 10, - "ActionsID": "LOG_WARNING", - "MinQueuedItems": 0, - "Executed": true, - "LastExecutionTime": "2017-12-12T15:19:45.742Z" - }, { - "ID": "STANDARD_TRIGGERS", - "UniqueID": "df4d286a-445f-40a8-ab84-215153d4f2ac", - "ThresholdType": "*max_event_counter", - "ThresholdValue": 5, - "Recurrent": false, - "MinSleep": 0, - "ExpirationDate": "0001-01-01T00:00:00Z", - "ActivationDate": "0001-01-01T00:00:00Z", - "Balance": { - "Uuid": null, - "ID": "df4d286a-445f-40a8-ab84-215153d4f2ac", - "Type": "*monetary", - "Value": null, - "Directions": { - "*out": true - }, - "ExpirationDate": null, - "Weight": null, - "DestinationIDs": { - "FS_USERS": true - }, - "RatingSubject": null, - "Categories": null, - "SharedGroups": null, - "TimingIDs": null, - "Timings": [], - "Disabled": null, - "Factor": null, - "Blocker": null - }, - "Weight": 10, - "ActionsID": "LOG_WARNING", - "MinQueuedItems": 0, - "Executed": false, - "LastExecutionTime": "0001-01-01T00:00:00Z" - }, { - "ID": "STANDARD_TRIGGERS", - "UniqueID": "cb60f788-6077-4f3c-b8b2-4d1ba3077abc", - "ThresholdType": "*max_balance", - "ThresholdValue": 20, - "Recurrent": false, - "MinSleep": 0, - "ExpirationDate": "0001-01-01T00:00:00Z", - "ActivationDate": "0001-01-01T00:00:00Z", - "Balance": { - "Uuid": null, - "ID": null, - "Type": "*monetary", - "Value": null, - "Directions": { - "*out": true - }, - "ExpirationDate": null, - "Weight": null, - "DestinationIDs": null, - "RatingSubject": null, - "Categories": null, - "SharedGroups": null, - "TimingIDs": null, - "Timings": [], - "Disabled": null, - "Factor": null, - "Blocker": null - }, - "Weight": 10, - "ActionsID": "LOG_WARNING", - "MinQueuedItems": 0, - "Executed": false, - "LastExecutionTime": "0001-01-01T00:00:00Z" - }, { - "ID": "STANDARD_TRIGGERS", - "UniqueID": "7f7621f4-6074-4502-bbc0-a8aeca7c1008", - "ThresholdType": "*max_balance", - "ThresholdValue": 100, - "Recurrent": false, - "MinSleep": 0, - "ExpirationDate": "0001-01-01T00:00:00Z", - "ActivationDate": "0001-01-01T00:00:00Z", - "Balance": { - "Uuid": null, - "ID": null, - "Type": "*monetary", - "Value": null, - "Directions": { - "*out": true - }, - "ExpirationDate": null, - "Weight": null, - "DestinationIDs": null, - "RatingSubject": null, - "Categories": null, - "SharedGroups": null, - "TimingIDs": null, - "Timings": [], - "Disabled": null, - "Factor": null, - "Blocker": null - }, - "Weight": 10, - "ActionsID": "DISABLE_AND_LOG", - "MinQueuedItems": 0, - "Executed": false, - "LastExecutionTime": "0001-01-01T00:00:00Z" - }], - "AllowNegative": false, - "Disabled": false - }], - "error": null - } - -2.1.3 Remove User Account -######################### - -:Hint: - cgr> account_remove Tenant="cgrates.org" Account="1003" - -*Request* - -:: - - { - "method": "APIerSv1.RemoveAccount", - "params": [{ - "Tenant": "cgrates.org", - "Account": "1003", - "ReloadScheduler": false - }], - "id": 3 - } - -*Response* - -:: - - {"id": 3,"result": "OK","error": null} - -2.1.4 Get Users Profile -####################### - -GetUsers returns list of all users profile: - -:Hint: - cgr> users - -*Request* - -:: - - { - "method": "UsersV1.GetUsers", - "params": [{ - "Tenant": "", - "UserName": "", - "Masked": false, - "Profile": null, - "Weight": 0 - }], - "id": 2 - } - -*Response* - -:: - - { - "id": 2, - "result": [{ - "Tenant": "cgrates.org", - "UserName": "1001", - "Masked": false, - "Profile": { - "Account": "1001", - "Cli": "+4986517174963", - "RequestType": "*prepaid", - "Subject": "1001", - "SubscriberId": "1001", - "SysPassword": "hisPass321", - "SysUserName": "danb", - "Uuid": "388539dfd4f5cefee8f488b78c6c244b9e19138e" - }, - "Weight": 0 - }, - - { - "Tenant": "cgrates.org", - "UserName": "1002", - "Masked": false, - "Profile": { - "Account": "1002", - "RifAttr": "RifVal", - "Subject": "1002", - "SubscriberId": "1002", - "SysUserName": "rif", - "Uuid": "27f37edec0670fa34cf79076b80ef5021e39c5b5" - }, - "Weight": 0 - }, - - { - "Tenant": "cgrates.org", - "UserName": "1004", - "Masked": false, - "Profile": { - "Account": "1004", - "Cli": "+4986517174964", - "RequestType": "*rated", - "Subject": "1004", - "SubscriberId": "1004", - "SysPassword": "hisPass321", - "SysUserName": "danb4" - }, - "Weight": 0 - } - ], - "error": null - } - -2.1.5 Get Profile UserName 1001 -############################### - -Returns a User Profile of user account 1001: - -:Hint: - - cgr> users UserName="1001" - -*Request* - -:: - - { - "method": "UsersV1.GetUsers", - "params": [{ - "Tenant": "", - "UserName": "1001", - "Masked": false, - "Profile": null, - "Weight": 0 - }], - "id": 2 - } - -*Response* - -:: - - { - "id": 2, - "result": [{ - "Tenant": "cgrates.org", - "UserName": "1001", - "Masked": false, - "Profile": { - "Account": "1001", - "Cli": "+4986517174963", - "RequestType": "*prepaid", - "Subject": "1001", - "SubscriberId": "1001", - "SysPassword": "hisPass321", - "SysUserName": "danb", - "Uuid": "388539dfd4f5cefee8f488b78c6c244b9e19138e" - }, - "Weight": 0 - }], - "error": null - } - -2.1.6 Get Action Plans -###################### - -Returns a list of all ActionPlans defined on user accounts: - -:Hint: - - cgr> actionplan_get - -*Request* - -:: - - { - "method": "APIerSv1.GetActionPlan", - "params": [{ - "ID": "" - }], - "id": 3 - } - -*Response* - -:: - - { - "id": 3, - "result": [{ - "Id": "PACKAGE_10_SHARED_A_5", - "AccountIDs": null, - "ActionTimings": [{ - "Uuid": "93e8cb80-7dad-4efc-8d65-1e0e61ce219d", - "Timing": { - "Timing": { - "Years": null, - "Months": null, - "MonthDays": null, - "WeekDays": null, - "StartTime": "*asap", - "EndTime": "" - }, - "Rating": null, - "Weight": 0 - }, - "ActionsID": "TOPUP_RST_5", - "Weight": 10 - }, { - "Uuid": "a4ac319b-144a-49e6-b87f-8878c8adc495", - "Timing": { - "Timing": { - "Years": null, - "Months": null, - "MonthDays": null, - "WeekDays": null, - "StartTime": "*asap", - "EndTime": "" - }, - "Rating": null, - "Weight": 0 - }, - "ActionsID": "TOPUP_RST_SHARED_5", - "Weight": 10 - }] - }, - - { - "Id": "PACKAGE_1001", - "AccountIDs": { - "cgrates.org:1001": true - }, - "ActionTimings": [{ - "Uuid": "8261378b-aa47-45c8-a0ad-6fb4a61358a6", - "Timing": { - "Timing": { - "Years": null, - "Months": null, - "MonthDays": null, - "WeekDays": null, - "StartTime": "*asap", - "EndTime": "" - }, - "Rating": null, - "Weight": 0 - }, - "ActionsID": "TOPUP_RST_5", - "Weight": 10 - }, { - "Uuid": "a1360fae-d9e9-4a6f-9b29-c4dcdd56b266", - "Timing": { - "Timing": { - "Years": null, - "Months": null, - "MonthDays": null, - "WeekDays": null, - "StartTime": "*asap", - "EndTime": "" - }, - "Rating": null, - "Weight": 0 - }, - "ActionsID": "TOPUP_RST_SHARED_5", - "Weight": 10 - }, { - "Uuid": "f3ed64ba-a158-4302-ad46-98646cad8a8f", - "Timing": { - "Timing": { - "Years": null, - "Months": null, - "MonthDays": null, - "WeekDays": null, - "StartTime": "*asap", - "EndTime": "" - }, - "Rating": null, - "Weight": 0 - }, - "ActionsID": "TOPUP_120_DST1003", - "Weight": 10 - }, { - "Uuid": "1a5c69fb-c5f8-4852-8c66-5afd296fa5e4", - "Timing": { - "Timing": { - "Years": null, - "Months": null, - "MonthDays": null, - "WeekDays": null, - "StartTime": "*asap", - "EndTime": "" - }, - "Rating": null, - "Weight": 0 - }, - "ActionsID": "TOPUP_RST_DATA_100", - "Weight": 10 - }] - }, - - { - "Id": "PACKAGE_10", - "AccountIDs": { - "cgrates.org:1002": true, - "cgrates.org:1003": true, - "cgrates.org:1004": true - }, - "ActionTimings": [{ - "Uuid": "6e335f92-ae2e-4253-8809-f124a46eac06", - "Timing": { - "Timing": { - "Years": null, - "Months": null, - "MonthDays": null, - "WeekDays": null, - "StartTime": "*asap", - "EndTime": "" - }, - "Rating": null, - "Weight": 0 - }, - "ActionsID": "TOPUP_RST_10", - "Weight": 10 - }] - }, { - "Id": "USE_SHARED_A", - "AccountIDs": { - "cgrates.org:1007": true - }, - "ActionTimings": [{ - "Uuid": "eee41fa1-aa24-4795-b875-37213473ad3d", - "Timing": { - "Timing": { - "Years": null, - "Months": null, - "MonthDays": null, - "WeekDays": null, - "StartTime": "*asap", - "EndTime": "" - }, - "Rating": null, - "Weight": 0 - }, - "ActionsID": "SHARED_A_0", - "Weight": 10 - }] - } - ], - "error": null - } - - -2.1.7 Get Action Plans of one Package ID -######################################## - -Returns a list of accounts where ActionPlan for "PACKAGE_10" is allocated: - -:Hint: - - cgr> actionplan_get ID="PACKAGE_10" - -*Request* - -:: - - { - "method": "APIerSv1.GetActionPlan", - "params": [{ - "ID": "PACKAGE_10" - }], - "id": 4 - } - -*Response* - -:: - - { - "id": 4, - "result": [{ - "Id": "PACKAGE_10", - "AccountIDs": { - "cgrates.org:1002": true, - "cgrates.org:1003": true, - "cgrates.org:1004": true - }, - "ActionTimings": [{ - "Uuid": "6e335f92-ae2e-4253-8809-f124a46eac06", - "Timing": { - "Timing": { - "Years": null, - "Months": null, - "MonthDays": null, - "WeekDays": null, - "StartTime": "*asap", - "EndTime": "" - }, - "Rating": null, - "Weight": 0 - }, - "ActionsID": "TOPUP_RST_10", - "Weight": 10 - }] - }], - "error": null - } - - -2.1.8 User Indexes -################## - -:Hint: - - cgr> user_indexes - -*Request* - -:: - - { - "method": "UsersV1.GetIndexes", - "params": [""], - "id": 2 - } - -*Response* - -:: - - { - "id": 2, - "result": { - "Uuid:27f37edec0670fa34cf79076b80ef5021e39c5b5": ["cgrates.org:1002"], - "Uuid:388539dfd4f5cefee8f488b78c6c244b9e19138e": ["cgrates.org:1001"] - }, - "error": null - } diff --git a/docs/readthedocs/balanceManagement.rst b/docs/readthedocs/balanceManagement.rst deleted file mode 100644 index 9718bc4aa..000000000 --- a/docs/readthedocs/balanceManagement.rst +++ /dev/null @@ -1,324 +0,0 @@ -3. Balance Management -===================== - -3.1 Balance Set ---------------- - - replaces existing value of BalanceID '23456' with value 12 for account 1003 belongs to tenant 'cgrates.org' - -:Hint: - cgr> balance_set Tenant="cgrates.org" Account="1003" Direction="\*out" Value=12 BalanceID="23456" - -*Request* - -:: - - { - "method": "APIerSv1.SetBalance", - "params": [{ - "Tenant": "cgrates.org", - "Account": "1003", - "BalanceType": "*monetary", - "BalanceUUID": null, - "BalanceID": "23456", - "Directions": null, - "Value": 12, - "ExpiryTime": null, - "RatingSubject": null, - "Categories": null, - "DestinationIds": null, - "TimingIds": null, - "Weight": null, - "SharedGroups": null, - "Blocker": null, - "Disabled": null - }], - "id": 6 - } - - -*Response* - -:: - - {"id":6,"result":"OK","error":null} - -3.2 Balance Add ---------------- - - adds 10 cent to account=1003 where tenant=cgrates.org - -:Hint: - cgr> balance_add Tenant="cgrates.org" Account="1003" BalanceId="123456" Value=10 - -*Request* - -:: - - { - "method": "APIerSv1.AddBalance", - "params": [{ - "Tenant": "cgrates.org", - "Account": "1003", - "BalanceUuid": null, - "BalanceId": "123456", - "BalanceType": "*monetary", - "Directions": null, - "Value": 10, - "ExpiryTime": null, - "RatingSubject": null, - "Categories": null, - "DestinationIds": null, - "TimingIds": null, - "Weight": null, - "SharedGroups": null, - "Overwrite": false, - "Blocker": null, - "Disabled": null - }], - "id": 4 - } - -*Response* - -:: - - {"id":4,"result":"OK","error":null} - - -3.3 Balance Debit ------------------ - - deducts 5 cents from account 1003 of tenant cgrates.org - -:Hint: - cgr> balance_debit Tenant="cgrates.org" Account="1003" BalanceId="23456" Value=5 BalanceType="\*monetary" - -*Request* - -:: - - { - "method": "APIerSv1.DebitBalance", - "params": [{ - "Tenant": "cgrates.org", - "Account": "1003", - "BalanceUuid": null, - "BalanceId": "23456", - "BalanceType": "*monetary", - "Directions": null, - "Value": 5, - "ExpiryTime": null, - "RatingSubject": null, - "Categories": null, - "DestinationIds": null, - "TimingIds": null, - "Weight": null, - "SharedGroups": null, - "Overwrite": false, - "Blocker": null, - "Disabled": null - }], - "id": 5 - } - -*Response* - -:: - - {"id":5,"result":"OK","error":null} - - -3.4 Get Remaining Balance -------------------------- - -Sum of BalanceMap.Value resulted from APIerSv2.GetAccounts request - - -3.5 Debit Air Time (TBV) ------------------------- - -:Hint: - - cgr> debit Tenant="cgrates.org" Account="1001" CallDuration=500 - -*Request* - -:: - - { - "method": "Responder.Debit", - "params": [{ - "Direction": "*out", - "Category": "", - "Tenant": "cgrates.org", - "Subject": "", - "Account": "1001", - "Destination": "", - "TimeStart": "0001-01-01T00:00:00Z", - "TimeEnd": "0001-01-01T00:00:00Z", - "LoopIndex": 0, - "DurationIndex": 0, - "FallbackSubject": "", - "RatingInfos": null, - "Increments": null, - "ToR": "", - "ExtraFields": null, - "MaxRate": 0, - "MaxRateUnit": 0, - "MaxCostSoFar": 0, - "CgrID": "", - "RunID": "", - "ForceDuration": false, - "PerformRounding": false, - "DryRun": false, - "DenyNegativeAccount": false - }], - "id": 16 - } - -*Response* - -:: - - { - "id": 16, - "result": { - "Direction": "*out", - "Category": "", - "Tenant": "cgrates.org", - "Subject": "1001", - "Account": "1001", - "Destination": "", - "ToR": "", - "Cost": 0, - "Timespans": null, - "RatedUsage": 0, - "AccountSummary": { - "Tenant": "cgrates.org", - "ID": "1001", - "BalanceSummaries": [{ - "UUID": "a6fc6e96-de69-445b-8456-cebd78a1b43d", - "ID": "a6fc6e96-de69-445b-8456-cebd78a1b43d", - "Type": "*monetary", - "Value": 5, - "Disabled": false - }, { - "UUID": "9df5d845-e411-4edd-971c-d98dbb926054", - "ID": "9df5d845-e411-4edd-971c-d98dbb926054", - "Type": "*monetary", - "Value": 25, - "Disabled": false - }, { - "UUID": "4a4d07c8-9548-415d-a029-7e369bf02f60", - "ID": "4a4d07c8-9548-415d-a029-7e369bf02f60", - "Type": "*voice", - "Value": 120, - "Disabled": false - }, { - "UUID": "8d867c57-31b4-407d-afc7-fb4dc359ae4d", - "ID": "8d867c57-31b4-407d-afc7-fb4dc359ae4d", - "Type": "*voice", - "Value": 90, - "Disabled": false - }, { - "UUID": "66009d4e-25ed-47d6-8dfa-ef3c501fd1b0", - "ID": "66009d4e-25ed-47d6-8dfa-ef3c501fd1b0", - "Type": "*data", - "Value": 102400, - "Disabled": false - }], - "AllowNegative": false, - "Disabled": false - } - }, - "error": null - } - -3.6 Set Balance for Outbound Calls ----------------------------------- - -:Hint: - - cgr> balance_set Tenant="cgrates.org" Account="1001" BalanceType="\*voice" Directions="\*out" Value=100 BalanceID="8d867c57-31b4-407d-afc7-fb4dc359ae4d" - -*Request* - -:: - - { - "method": "APIerSv1.SetBalance", - "params": [{ - "Tenant": "cgrates.org", - "Account": "1001", - "BalanceType": "*voice", - "BalanceUUID": null, - "BalanceID": "8d867c57-31b4-407d-afc7-fb4dc359ae4d", - "Directions": "*out", - "Value": 100, - "ExpiryTime": null, - "RatingSubject": null, - "Categories": null, - "DestinationIds": null, - "TimingIds": null, - "Weight": null, - "SharedGroups": null, - "Blocker": null, - "Disabled": null - }], - "id": 18 - } - -*Response* - -:: - - { - "id": 18, - "result": "OK", - "error": null - } - -3.7 Set Balance for Inbound Calls ---------------------------------- - -:Hint: - - cgr> balance_set Tenant="cgrates.org" Account="1001" BalanceType="\*voice" Directions="\*in" Value=600 BalanceID="9d867c57-31b4-407d-afc7-fb4dc359ae4d" - -*Request* - -:: - - { - "method": "APIerSv1.SetBalance", - "params": [{ - "Tenant": "cgrates.org", - "Account": "1001", - "BalanceType": "*voice", - "BalanceUUID": null, - "BalanceID": "9d867c57-31b4-407d-afc7-fb4dc359ae4d", - "Directions": "*in", - "Value": 600, - "ExpiryTime": null, - "RatingSubject": null, - "Categories": null, - "DestinationIds": null, - "TimingIds": null, - "Weight": null, - "SharedGroups": null, - "Blocker": null, - "Disabled": null - }], - "id": 28 - } - -*Response* - -:: - - { - "id": 28, - "result": "OK", - "error": null - } diff --git a/docs/readthedocs/cdrManagement.rst b/docs/readthedocs/cdrManagement.rst deleted file mode 100644 index d1e2728b4..000000000 --- a/docs/readthedocs/cdrManagement.rst +++ /dev/null @@ -1,132 +0,0 @@ -4. CDR Management -================= - -4.1 Export CDRs ---------------- - -:Hint: - cgr > cdrs_export CdrFormat="csv" ExportDir="/tmp" - -*Request* - -:: - - { - "method": "APIerSv1.ExportCDRs", - "params": [{ - "ExportTemplate": null, - "ExportFormat": null, - "ExportPath": null, - "Synchronous": null, - "Attempts": null, - "FieldSeparator": null, - "UsageMultiplyFactor": null, - "CostMultiplyFactor": null, - "ExportID": null, - "ExportFileName": null, - "RoundingDecimals": null, - "Verbose": false, - "CGRIDs": null, - "NotCGRIDs": null, - "RunIDs": null, - "NotRunIDs": null, - "OriginHosts": null, - "NotOriginHosts": null, - "Sources": null, - "NotSources": null, - "ToRs": null, - "NotToRs": null, - "RequestTypes": null, - "NotRequestTypes": null, - "Tenants": null, - "NotTenants": null, - "Categories": null, - "NotCategories": null, - "Accounts": null, - "NotAccounts": null, - "Subjects": null, - "NotSubjects": null, - "DestinationPrefixes": null, - "NotDestinationPrefixes": null, - "Costs": null, - "NotCosts": null, - "ExtraFields": null, - "NotExtraFields": null, - "OrderIDStart": null, - "OrderIDEnd": null, - "SetupTimeStart": "", - "SetupTimeEnd": "", - "AnswerTimeStart": "", - "AnswerTimeEnd": "", - "CreatedAtStart": "", - "CreatedAtEnd": "", - "UpdatedAtStart": "", - "UpdatedAtEnd": "", - "MinUsage": "", - "MaxUsage": "", - "MinCost": null, - "MaxCost": null, - "Limit": null, - "Offset": null, - "SearchTerm": "" - }], - "id": 8 - } - -*Response* - -:: - - { - "id": 8, - "result": { - "ExportedPath": "/var/spool/cgrates/cdre/cdre_1513199075.csv", - "TotalRecords": 186, - "TotalCost": 56.4371, - "FirstOrderID": 1513066080275428946, - "LastOrderID": 1513066080275429038, - "ExportedCGRIDs": null, - "UnexportedCGRIDs": null - }, - "error": null - } - - -"/var/spool/cgrates/cdre/cdre_1513199075.csv" is the destination cdr file in csv format. - - -4.2 CDR Stats for Queues ------------------------- - -Return list of Queue IDs - -:Hint: - - cgr> cdrstats_queueids - -*Request* - -:: - - { - "method": "CDRStatsV1.GetQueueIds", - "params": [""], - "id": 8 - } - -*Response* - -:: - - { - "id": 8, - "result": [ - "CDRST_1003", - "CDRST1", - "CDRST_1001", - "CDRST_1002", - "STATS_SUPPL1", - "STATS_SUPPL2" - ], - "error": null - } diff --git a/docs/readthedocs/index.rst b/docs/readthedocs/index.rst deleted file mode 100644 index d9203e070..000000000 --- a/docs/readthedocs/index.rst +++ /dev/null @@ -1,22 +0,0 @@ -.. CGRateS documentation master file, created by - sphinx-quickstart on Mon Mar 5 10:59:27 2012. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -CGRateS API Document! -===================== - -Full contents: -============== - -.. toctree:: - :maxdepth: 2 - - introduction - accountLifeCycle - balanceManagement - cdrManagement - lcrStrategies - tariffPlanManagement - suppliersManagement - misc diff --git a/docs/readthedocs/introduction.rst b/docs/readthedocs/introduction.rst deleted file mode 100644 index 09e229452..000000000 --- a/docs/readthedocs/introduction.rst +++ /dev/null @@ -1,22 +0,0 @@ -1. Introduction -=============== - -`CGRateS` is a *very fast* and *easily scalable* **(charging, rating, accounting, lcr, mediation, billing, authorization)** *ENGINE* targeted especially for ISPs and Telecom Operators. It allow users provisioning and tarif plan management. - -It is written in `Go` programming language and is accessible from any programming language via JSON RPC. - -*Usage example through cgr-console* - -:Hint: - cgr> Accounts Tenant="cgrates.org" AccountIDs=["1001"] - -*Usage example through postman* - -URL: http://your_server_ip:2080/jsonrpc - -*Request* - -:: - - {"method":"APIerSv2.GetAccounts","params":[{"Tenant":"cgrates.org","AccountIds":["1001"],"Offset":0,"Limit":0}],"id":3} - Content-Type: application/json diff --git a/docs/readthedocs/lcrStrategies.rst b/docs/readthedocs/lcrStrategies.rst deleted file mode 100644 index c0e416234..000000000 --- a/docs/readthedocs/lcrStrategies.rst +++ /dev/null @@ -1,42 +0,0 @@ -5. LCR Strategies -================= - -5.1 LCR Strategy: (\*static) ----------------------------- - -Use supplier base on LCR rules - -:Hint: - cgr> lcr Account="1001" Destination="1002" - -5.2 LCR Strategy: (\*lowest_cost) ---------------------------------- - -Use supplier with least cost - -:Hint: - cgr> lcr Account="1005" Destination="1001" - -5.3 LCR Strategy: (\*highest_cost) ----------------------------------- - -Use supplier with highest cost - -:Hint: - cgr> lcr Account="1002" Destination="1002" - -5.4 LCR Strategy: (\*qos_threshold) ------------------------------------ - -Use supplier with lowest cost, matching QoS thresholds min/max ASR, ACD, TCD, ACC, TCC - -:Hint: - cgr> lcr Account="1002" Destination="1002" - -5.5 LCR Strategy: (\*qos) -------------------------- - -Use supplier with best quality, independent of cost - -:Hint: - cgr> lcr Account="1002" Destination="1005" diff --git a/docs/readthedocs/misc.rst b/docs/readthedocs/misc.rst deleted file mode 100644 index ed06e981b..000000000 --- a/docs/readthedocs/misc.rst +++ /dev/null @@ -1,48 +0,0 @@ -8. GetCacheStats -================ - -GetCacheStats returns datadb cache status. Empty params return all stats: - -:Hint: - - cgr> cache_stats - -*Request* - -:: - - { - "method": "APIerSv1.GetCacheStats", - "params": [{}], - "id": 0 - } - -*Response:* - -:: - - { - "id": 0, - "result": { - "Destinations": 0, - "ReverseDestinations": 0, - "RatingPlans": 4, - "RatingProfiles": 0, - "Actions": 0, - "ActionPlans": 4, - "AccountActionPlans": 0, - "SharedGroups": 0, - "DerivedChargers": 0, - "LcrProfiles": 0, - "CdrStats": 6, - "Users": 3, - "ResourceProfiles": 0, - "Resources": 0, - "StatQueues": 0, - "StatQueueProfiles": 0, - "Thresholds": 0, - "ThresholdProfiles": 0, - "Filters": 0 - }, - "error": null - } diff --git a/docs/readthedocs/suppliersManagement.rst b/docs/readthedocs/suppliersManagement.rst deleted file mode 100644 index b0343aa77..000000000 --- a/docs/readthedocs/suppliersManagement.rst +++ /dev/null @@ -1,52 +0,0 @@ -7. Suppliers Management -======================= - -7.1 List Suppliers ------------------- - -:Hint: - suppliers Tenant="cgrates.org" ID="SPP_1" - -*Request* - -:: - - { - "method": "APIerSv1.GetSupplierProfile", - "params": [{ - "Tenant": "cgrates.org", - "ID": "SPP_1" - }], - "id": 6 - } - -*Response* - -:: - - { - "id": 6, - "result": { - "Tenant": "cgrates.org", - "ID": "SPP_1", - "FilterIDs": ["FLTR_ACNT_dan", "FLTR_DST_DE"], - "ActivationInterval": { - "ActivationTime": "2017-07-29T15:00:00Z", - "ExpiryTime": "0001-01-01T00:00:00Z" - }, - "Sorting": "*lowest_cost", - "SortingParams": [], - "Suppliers": [{ - "ID": "supplier1", - "FilterIDs": ["FLTR_ACNT_dan"], - "AccountIDs": [], - "RatingPlanIDs": ["RPL_1"], - "ResourceIDs": ["ResGroup1"], - "StatIDs": ["Stat1"], - "Weight": 10 - }], - "Blocker": false, - "Weight": 10 - }, - "error": null - } diff --git a/docs/readthedocs/tariffPlanManagement.rst b/docs/readthedocs/tariffPlanManagement.rst deleted file mode 100644 index 301d2f143..000000000 --- a/docs/readthedocs/tariffPlanManagement.rst +++ /dev/null @@ -1,139 +0,0 @@ -6. Tariff Plan Management -========================= - -6.1 Create TariffPlan ---------------------- - -6.2 Assign TariffPlan ---------------------- - -6.3 Calculate Cost ------------------- - - Cost simulator calculates call cost (sum of ConnectFee and Cost fields) for a given pair of source(subject) and destination accounts for a specific time interval. This request can provide Pre Call Cost. - -:Hint: - cgr> cost Tenant="cgrates.org" Category="call" Subject="1003" AnswerTime="2014-08-04T13:00:00Z" Destination="1002" Usage="1m25s" - -*Request* - -:: - - { - "method": "APIerSv1.GetCost", - "params": [{ - "Tenant": "cgrates.org", - "Category": "call", - "Subject": "1003", - "AnswerTime": "2014-08-04T13:00:00Z", - "Destination": "1002", - "Usage": "1m25s" - }], - "id": 7 - } - -*Response* - -:: - - { - "id": 7, - "result": { - "CGRID": "", - "RunID": "", - "StartTime": "2014-08-04T13:00:00Z", - "Usage": 90000000000, - "Cost": 0.25, - "Charges": [{ - "RatingID": "81ca386", - "Increments": [{ - "Usage": 60000000000, - "Cost": 0.2, - "AccountingID": "", - "CompressFactor": 1 - }], - "CompressFactor": 1 - }, { - "RatingID": "2ff21f2", - "Increments": [{ - "Usage": 30000000000, - "Cost": 0.05, - "AccountingID": "", - "CompressFactor": 1 - }], - "CompressFactor": 1 - }], - "AccountSummary": null, - "Rating": { - "2ff21f2": { - "ConnectFee": 0.4, - "RoundingMethod": "*up", - "RoundingDecimals": 4, - "MaxCost": 0, - "MaxCostStrategy": "", - "TimingID": "998f4c1", - "RatesID": "7977f71", - "RatingFiltersID": "5165642" - }, - "81ca386": { - "ConnectFee": 0.4, - "RoundingMethod": "*up", - "RoundingDecimals": 4, - "MaxCost": 0, - "MaxCostStrategy": "", - "TimingID": "998f4c1", - "RatesID": "e630781", - "RatingFiltersID": "5165642" - } - }, - "Accounting": {}, - "RatingFilters": { - "5165642": { - "DestinationID": "DST_1002", - "DestinationPrefix": "1002", - "RatingPlanID": "RP_RETAIL2", - "Subject": "*out:cgrates.org:call:*any" - } - }, - "Rates": { - "7977f71": [{ - "GroupIntervalStart": 0, - "Value": 0.2, - "RateIncrement": 60000000000, - "RateUnit": 60000000000 - }, { - "GroupIntervalStart": 60000000000, - "Value": 0.1, - "RateIncrement": 30000000000, - "RateUnit": 60000000000 - }], - "e630781": [{ - "GroupIntervalStart": 0, - "Value": 0.2, - "RateIncrement": 60000000000, - "RateUnit": 60000000000 - }, { - "GroupIntervalStart": 60000000000, - "Value": 0.1, - "RateIncrement": 30000000000, - "RateUnit": 60000000000 - }] - }, - "Timings": { - "998f4c1": { - "Years": [], - "Months": [], - "MonthDays": [], - "WeekDays": [1, 2, 3, 4, 5], - "StartTime": "08:00:00" - } - } - }, - "error": null - } - -Make Test Call -############## - -:Hint: - initiate test call from account 1003 to 1002 diff --git a/docs/resources.rst b/docs/resources.rst index 0a3201d4a..6287eff3d 100644 --- a/docs/resources.rst +++ b/docs/resources.rst @@ -6,7 +6,7 @@ ResourceS **ResourceS** is a standalone subsystem part of the **CGRateS** infrastructure, designed to allocate virtual resources for the generic *Events* (hashmaps) it receives. -Both receiving of *Events* as well as operational commands on the virtual resources is performed via a complete set of :ref:`CGRateS RPC APIs`. +Both receiving of *Events* as well as operational commands on the virtual resources is performed via a complete set of `CGRateS RPC APIs `_. Due it's real-time nature, **ResourceS** are designed towards high throughput being able to process thousands of *Events* per second. This is doable since each *Resource* is a very light object, held in memory and eventually backed up in *DataDB*. @@ -46,7 +46,7 @@ nested_fields ResourceProfile ^^^^^^^^^^^^^^^ -The **ResourceProfile** is the configuration of a *Resource*. This will be performed over :ref:`CGRateS RPC APIs` or *.csv* files. A profile is comprised out of the following parameters: +The **ResourceProfile** is the configuration of a *Resource*. This will be performed over `CGRateS RPC APIs `_ or *.csv* files. A profile is comprised out of the following parameters: Tenant The tenant on the platform (one can see the tenant as partition ID). diff --git a/docs/suppliers.rst b/docs/routes.rst similarity index 65% rename from docs/suppliers.rst rename to docs/routes.rst index 4d4663653..fce41d2ed 100644 --- a/docs/suppliers.rst +++ b/docs/routes.rst @@ -4,13 +4,13 @@ .. _OpenSIPS: https://opensips.org/ -.. _Suppliers: +.. _Routes: -SupplierS +RouteS ========= -**SupplierS** is a standalone subsystem within **CGRateS** responsible to compute a list of suppliers which can be used for a specific event received to process. It is accessed via :ref:`CGRateS RPC APIs`. +**RouteS** is a standalone subsystem within **CGRateS** responsible to compute a list of routes which can be used for a specific event received to process. It is accessed via `CGRateS RPC APIs `_. As most of the other subsystems, it is performance oriented, stored inside *DataDB* but cached inside the *cgr-engine* process. Caching can be done dynamically/on-demand or at start-time/precached and it is configurable within *cache* section in the :ref:`JSON configuration `. @@ -19,7 +19,7 @@ Caching can be done dynamically/on-demand or at start-time/precached and it is c Processing logic ---------------- -When a new *Event* is received, **SupplierS** will pass it to :ref:`FilterS` in order to find all :ref:`SupplierProfiles` matching the *Event*. +When a new *Event* is received, **RouteS** will pass it to :ref:`FilterS` in order to find all :ref:`SupplierProfiles` matching the *Event*. As a result of the selection process we will get a single :ref:`SupplierProfile` matching the *Event*, is active at the *EventTime* and has a higher priority than the other matching :ref:`SupplierProfiles`. @@ -37,20 +37,20 @@ Given the *Event* it will return a list of ordered *SupplierProfiles* matching a This API is useful to test configurations. -GetSuppliers +GetRoutes ^^^^^^^^^^^^ -Will return a list of *Suppliers* from within a *SupplierProfile* ordered based on *Strategy*. +Will return a list of *Routes* from within a *SupplierProfile* ordered based on *Strategy*. Parameters ---------- -SupplierS +RouteS ^^^^^^^^^ -**SupplierS** is the **CGRateS** component responsible for handling the *SupplierProfiles*. +**RouteS** is the **CGRateS** component responsible for handling the *SupplierProfiles*. It is configured within **routes** section from :ref:`JSON configuration ` via the following parameters: @@ -87,7 +87,7 @@ default_ratio SupplierProfile ^^^^^^^^^^^^^^^ -Contains the configuration for a set of suppliers which will be returned in case of match. Following fields can be defined: +Contains the configuration for a set of routes which will be returned in case of match. Following fields can be defined: Tenant The tenant on the platform (one can see the tenant as partition ID). @@ -102,32 +102,32 @@ ActivationInterval The time interval when this profile becomes active. If undefined, the profile is always active. Other options are start time, end time or both. Sorting - Sorting strategy applied when ordering the individual *Suppliers* defined bellow. Possible values are: + Sorting strategy applied when ordering the individual *Routes* defined bellow. Possible values are: **\*weight** - Classic method of statically sorting the suppliers based on their priority. + Classic method of statically sorting the routes based on their priority. **\*lc** - LeastCost will sort the suppliers based on their cost (lowest cost will have higher priority). If two suppliers will be identical as cost, their *Weight* will influence the sorting further. If *AccountIDs* will be specified, bundles can be also used during cost calculation, the only condition is that the bundles should cover complete usage. + LeastCost will sort the routes based on their cost (lowest cost will have higher priority). If two routes will be identical as cost, their *Weight* will influence the sorting further. If *AccountIDs* will be specified, bundles can be also used during cost calculation, the only condition is that the bundles should cover complete usage. The following fields are mandatory for cost calculation: *Account*/*Subject*, *Destination*, *SetupTime*. *Usage* is optional and if present in event, it will be used for the cost calculation. **\*hc** - HighestCost will sort the suppliers based on their cost(higher cost will have higher priority). If two suppliers will be identical as cost, their *Weight* will influence the sorting further. + HighestCost will sort the routes based on their cost(higher cost will have higher priority). If two routes will be identical as cost, their *Weight* will influence the sorting further. The following fields are mandatory for cost calculation: *Account*/*Subject*, *Destination*, *SetupTime*. *Usage* is optional and if present in event, it will be used for the cost calculation. **\*qos** - QualityOfService strategy will sort the suppliers based on their stats. It takes the StatIDs to check from the supplier *StatIDs* definition. The metrics used as part of sorting are to be defined in *SortingParameters* field bellow. If Stats are missing the metrics defined in *SortingParameters* defaults for those will be populated for order (10000000 as PDD and -1 for the rest). + QualityOfService strategy will sort the routes based on their stats. It takes the StatIDs to check from the supplier *StatIDs* definition. The metrics used as part of sorting are to be defined in *SortingParameters* field bellow. If Stats are missing the metrics defined in *SortingParameters* defaults for those will be populated for order (10000000 as PDD and -1 for the rest). **\*reas** - ResourceAscendentSorter will sort the suppliers based on their resource usage, lowest usage giving higher priority. The resources will be queried for each supplier based on it's *ResourceIDs* field and the final usage for each supplier will be given by the sum of all the resource usages queried. + ResourceAscendentSorter will sort the routes based on their resource usage, lowest usage giving higher priority. The resources will be queried for each supplier based on it's *ResourceIDs* field and the final usage for each supplier will be given by the sum of all the resource usages queried. **\*reds** - ResourceDescendentSorter will sort the suppliers based on their resource usage, highest usage giving higher priority. The resources will be queried for each supplier based on it's *ResourceIDs* field and the final usage for each supplier will be given by the sum of all the resource usages queried. + ResourceDescendentSorter will sort the routes based on their resource usage, highest usage giving higher priority. The resources will be queried for each supplier based on it's *ResourceIDs* field and the final usage for each supplier will be given by the sum of all the resource usages queried. **\*load** - LoadDistribution will sort the suppliers based on their load. An important parameter is the *\*ratio* which is defined as *supplierID:Ratio* within the SortingParameters. If no supplierID is present within SortingParameters, the system will look for *\*default* or fallback in the configuration to *default_ratio* within :ref:`JSON configuration `. The *\*ratio* will specify the probability to get traffic on a *Supplier*, the higher the *\*ratio* more chances will a *Supplier* get for traffic. + LoadDistribution will sort the routes based on their load. An important parameter is the *\*ratio* which is defined as *supplierID:Ratio* within the SortingParameters. If no supplierID is present within SortingParameters, the system will look for *\*default* or fallback in the configuration to *default_ratio* within :ref:`JSON configuration `. The *\*ratio* will specify the probability to get traffic on a *Supplier*, the higher the *\*ratio* more chances will a *Supplier* get for traffic. The load will be calculated out of the *StatIDs* parameter of each *Supplier*. It is possible to also specify there directly the metric being used in the format *StatID:MetricID*. If only *StatID* is instead specified, all metrics will be summed to get the final value. @@ -141,7 +141,7 @@ SortingParameters Weight Priority in case of multiple *SupplierProfiles* matching an *Event*. Higher *Weight* will have more priority. -Suppliers +Routes List of :ref:`Supplier` objects which are part of this *SupplierProfile* @@ -174,7 +174,7 @@ Weight Used for sorting in some strategies (ie: *weight, *lc or *hc). Blocker - No more suppliers are provided after this one. + No more routes are provided after this one. SupplierParameters Container which is trasparently passed to the remote client to be used in it's own logic (ie: gateway prefix stripping or other gateway parameters). @@ -184,7 +184,7 @@ SupplierParameters Use cases --------- -* Calculate LCR directly by querying APIs (GetSuppliers). +* Calculate LCR directly by querying APIs (GetRoutes). * LCR system together with Kamailio_ *dispatcher* module where the *SupplierID* whithin *CGRateS* will be used as dispatcher set within Kamailio_. * LCR system together with OpenSIPS_ drouting module where the *SupplierID* whithin *CGRateS* will be used as drouting carrier id. * LCR system together with FreeSWITCH_ or Asterisk_ where the *SupplierID* whithin *CGRateS* will be used as gateway ID within the dialplan of FreesWITCH_ or Asterisk_. \ No newline at end of file diff --git a/docs/schedulers.rst b/docs/schedulers.rst index a77e381d9..4962387b5 100644 --- a/docs/schedulers.rst +++ b/docs/schedulers.rst @@ -1,3 +1,5 @@ +.. _schedulers: + SchedulerS ========== diff --git a/docs/sessions.rst b/docs/sessions.rst index f9479c00e..fb104d766 100644 --- a/docs/sessions.rst +++ b/docs/sessions.rst @@ -4,7 +4,7 @@ SessionS ======== -**SessionS** is a standalone subsystem within **CGRateS** responsible to manage virtual sessions based on events received. It is accessed via :ref:`CGRateS RPC APIs`. +**SessionS** is a standalone subsystem within **CGRateS** responsible to manage virtual sessions based on events received. It is accessed via `CGRateS RPC APIs `_. Parameters @@ -39,8 +39,8 @@ thresholds_conns stats_conns Connections towards :ref:`StatS` component to compute stat metrics for events. -suppliers_conns - Connections towards :ref:`SupplierS` component to compute suppliers for events. +routes_conns + Connections towards :ref:`RouteS` component to compute routes for events. attributes_conns Connections towards :ref:`AttributeS` component for altering the events. @@ -143,14 +143,14 @@ ProcessStats StatIDs Selects only specific stat profiles (instead of discovering them via :ref:`FilterS`). Faster in processing than the discovery mechanism. -GetSuppliers - Sends the event to :ref:`SupplierS` to return the list of suppliers for it as part as authorization. +GetRoutes + Sends the event to :ref:`RouteS` to return the list of routes for it as part as authorization. -SuppliersMaxCost - Mechanism to implement revenue assurance for suppliers coming from :ref:`SupplierS` component. Can be defined as a number or special meta variable: *\*event_cost*, assuring that the supplier cost will never be higher than event cost. +RoutesMaxCost + Mechanism to implement revenue assurance for routes coming from :ref:`RouteS` component. Can be defined as a number or special meta variable: *\*event_cost*, assuring that the route cost will never be higher than event cost. -SuppliersIgnoreErrors - Instructs to ignore suppliers with errors(ie: without price for specific destination in tariff plan). Without this setting the whole query will fail instead of just the supplier being ignored. +RoutesIgnoreErrors + Instructs to ignore routes with errors(ie: without price for specific destination in tariff plan). Without this setting the whole query will fail instead of just the route being ignored. InitiateSession, InitiateSessionWithDigest @@ -283,14 +283,14 @@ ProcessStats StatIDs Selects only specific stat profiles (instead of discovering them via :ref:`FilterS`). Faster in processing than the discovery mechanism. -GetSuppliers - Sends the event to :ref:`SupplierS` to return the list of suppliers for it. +GetRoutes + Sends the event to :ref:`RouteS` to return the list of routes for it. -SuppliersMaxCost - Mechanism to implement revenue assurance for suppliers coming from :ref:`SupplierS` component. Can be a number or special meta variable: *\*event_cost*, assuring that the supplier cost will never be higher than event cost. +RoutesMaxCost + Mechanism to implement revenue assurance for routes coming from :ref:`RouteS` component. Can be a number or special meta variable: *\*event_cost*, assuring that the route cost will never be higher than event cost. -SuppliersIgnoreErrors - Instructs to ignore suppliers with errors(ie: without price for specific destination in tariff plan). Without this setting the whole query will fail instead of just the supplier being ignored. +RoutesIgnoreErrors + Instructs to ignore routes with errors(ie: without price for specific destination in tariff plan). Without this setting the whole query will fail instead of just the route being ignored. @@ -342,7 +342,7 @@ Instead of arguments, the options for enabling various functionaity will come in Terminate a session (or initialize + terminate) out of event. \*routes - Process the event with :ref:`Suppliers`. Auxiliary flags available: + Process the event with :ref:`Routes`. Auxiliary flags available: **\*ignore_errors** Ignore the routes with errors instead of failing the request completely. diff --git a/docs/stats.rst b/docs/stats.rst index 79ab9901c..81d45076d 100644 --- a/docs/stats.rst +++ b/docs/stats.rst @@ -1,10 +1,12 @@ +.. _stats: + StatS ===== **StatS** is a standalone subsystem part of the **CGRateS** infrastructure, designed to aggregate and calculate statistical metrics for the generic *Events* (hashmaps) it receives. -Both receiving of *Events* as well as *Metrics* displaying is performed via a complete set of :ref:`CGRateS RPC APIs`. +Both receiving of *Events* as well as *Metrics* displaying is performed via a complete set of `CGRateS RPC APIs `_. Due it's real-time nature, **StatS** are designed towards high throughput being able to process thousands of *Events* per second. This is doable since each *StatQueue* is a very light object, held in memory and eventually backed up in *DataDB*. diff --git a/docs/stordb.rst b/docs/stordb.rst index cf5423b15..b6dc86ce4 100644 --- a/docs/stordb.rst +++ b/docs/stordb.rst @@ -1,3 +1,5 @@ +.. _stordb: + StorDB ====== diff --git a/docs/tariff_plans.rst b/docs/tariff_plans.rst deleted file mode 100644 index c6f9b3f5d..000000000 --- a/docs/tariff_plans.rst +++ /dev/null @@ -1,883 +0,0 @@ -4.2. Tariff Plans -================= -Major concept within CGRateS architecture, implement mechanisms to load rating as well as account data into CGRateS. -For importing the data into CGRateS database(s) we are using **csv** *files*. -The import process can be started as many times it is desired with one ore more csv files -and the existing values are overwritten. - -.. important:: If **-flushdb** option is used when importing data with cgr-loader, - then the database **is cleaned** before importing. - -For more details see the **cgr-loader** tool from the tutorial chapter. - -The rest of this section we will describe the content of every csv file. - -4.2.1. Destinations -~~~~~~~~~~~~~~~~~~~ -The destinations are binding together various prefixes / caller ids to define a -logical destination group. A prefix can appear in multiple destination groups. - -:: - - "Destinations.csv" - csv - "tp_destinations" - stor_db - -.. csv-table:: - :file: ../data/tariffplans/tutorial/Destinations.csv - :header-rows: 1 - -[0] - Id: - Destination Id, a string by which this destination will be referenced in other places by. - -[1] - Prefix: - Prefix(es) attached to this destination. - The prefix or caller id to be added to the specified destination. - -4.2.2. Timings -~~~~~~~~~~~~~~ -Holds time related definitions. -Describes the time periods that have different rates attached to them. - -:: - - "Timings.csv" - csv - "tp_timings" - stor_db - -.. csv-table:: - :file: ../data/tariffplans/tutorial/Timings.csv - :header-rows: 1 - -[0] - Tag: - String by which this timing will be referenced in other places by. - -[1] - Years: - Integers separated by semicolons (;) specifying the years for this time period. - - **\*any** in case of always. - -[2] - Months: - Integers from 1=January to 12=December separated by semicolons (;) specifying the months for this time period. - - **\*any** in case of always (equivalent to 1;2;3;4;5;6;7;8;9;10;11;12). - -[3] - MonthDays: - Integers from 1 to 31 separated by semicolons (;) specifying the month days for this time period. - - **\*any** in case of always. - -[4] - WeekDays: - Integers from 1=Monday to 7=Sunday separated by semicolons (;) specifying the week days for this time period. - - **\*any** in case of always. - -[5] - Time: - The start time for this time period. - - If you set it to **\*asap** (was **\*now**) it will be replaced with the time of the data importing. - -4.2.3. Rates -~~~~~~~~~~~~ -Defines price groups for various destinations which will be associated to -various timings. - -:: - - "Rates.csv" - csv - "tp_rates" - stor_db - -.. csv-table:: - :file: ../data/tariffplans/tutorial/Rates.csv - :header-rows: 1 - - -[0] - Id: - Rate Id, a string by which this *rate* will be referenced in other places by. - -[1] - ConnectFee: - ConnectFee applied once the call is answered. - The price to be charged once at the beginning of the call to the specified - destination. - -[2] - Rate: - Number of billing units this rate applies to. - The price for the billing unit expressed in cents. - -[3] - RateUnit: - The billing unit expressed in seconds. - -[4] - RateIncrement: - This rate will apply in increments of duration. - The time gap for the rate - -[5] - GroupIntervalStart: - When the rate starts - -.. seealso:: Rateincrement and GroupIntervalStart are when the calls has - different rates in the timeframe. For example, the first 30 seconds of the - calls has a rate of €0.1 and after that €0.2. The rate for this will the same - TAG with two RateIncrements - -4.2.4. Destination Rates -~~~~~~~~~~~~~~~~~~~~~~~ -Attach rates to destinations. - -:: - - "DestinationRates.csv" - csv - "tp_destination_rates" - stor_db - -.. csv-table:: - :file: ../data/tariffplans/tutorial/DestinationRates.csv - :header-rows: 1 - -[0] - Id: - tbd - -[1] - DestinationId: - tbd - -[2] - RatesTag: - tbd - -[3] - RoundingMethod: - tbd - -[4] - RoundingDecimals: - tbd - -[5] - MaxCost: - tbd - -[6] - MaxCostStrategy: - tbd - -4.2.5. Rating Plans -~~~~~~~~~~~~~~~~~~~ - -The *rating plan* makes the links between **Rating Profiles**, **Timings** and **Destination Rates** so each of them can be -described once and various combinations are made possible. - -:: - - "RatingPlans.csv" - csv - "tp_rating_plans" - stor_db - -.. csv-table:: - :file: ../data/tariffplans/tutorial/RatingPlans.csv - :header-rows: 1 - -[0] - Id: - A string by which this *rating plan* will be referenced in other places by. - -[1] - DestinationRatesId: - The rating id/tag described in the **Destination rates** file. (*DestinationRates.csv* - **Id**) - -[2] - TimingTag: - The timing tag described in the **Timings** file. (*Timings.csv* - **Tag**) - -[3] - Weight: - If multiple timings cab be applied to a call the one with the lower weight - wins. An example here can be the Christmas day: we can have a special timing - for this day but the regular day of the week timing can also be applied to - this day. The weight will differentiate between the two timings. - - -4.2.6. Rating profiles -~~~~~~~~~~~~~~~~~~~~~~ -The *rating profile* **describes** the prices to be applied for various calls to -various destinations in various time frames. When a call is made the CGRateS -system will locate the rates to be applied to the call using the rating profiles. - -:: - - "RatingProfiles.csv" - csv - "tp_rating_profiles" - stor_db - -.. csv-table:: - :file: ../data/tariffplans/tutorial/RatingProfiles.csv - :header-rows: 1 - -[0] - Direction: - Can be **\*in** or **\*out** for the INBOUND and OUTBOUND calls. - -[1] - Tenant: - Used to distinguish between carriers if more than one share the same database in the CGRates system. - -[2] - Category: - Type of record specifies the kind of transmission this rate profile applies to. - -[3] - Subject: - The client/user for who this profile is detailing the rates. - -[4] - ActivationTime: - Multiple rates timings/prices can be created for one profile with different - activation times. When a call is made the appropriate profile(s) will be - used to rate the call. So future prices can be defined here and the - activation time can be set as appropriate. - -[5] - RatingPlanId: - The rating plan id/tag described in the **Rating Plans** file. (*RatingPlans.csv* - **Id**) - - This specifies the profile to be used in case the call destination. - -[6] - RatesFallbackSubject: - This specifies another profile to be used in case the call destination will - not be found in the current profile. The same tenant, tor and direction will - be used. - -[7] - CdrStatQueueIds: - The cdr stats id described in the **Cdr Stats** file. (*CdrStats.csv* - **Id**) - - Stat Queue associated with this account. - - -4.2.7. Account actions -~~~~~~~~~~~~~~~~~~~~~~ - -Describes the actions to be applied to the clients/users accounts. There are two -kinds of actions: timed and triggered. For the timed actions there is a -scheduler application that reads them from the database and executes them at the -appropriate timings. The triggered actions are executed when the specified -balance counters reach certain thresholds. - -The accounts hold the various balances and counters to activate the triggered -actions for each the client. - -Balance types are: MONETARY, SMS, INTERNET, INTERNET_TIME, MINUTES. - -:: - - "AccountActions.csv" - csv - "tp_account_actions" - stor_db - -.. csv-table:: - :file: ../data/tariffplans/tutorial/AccountActions.csv - :header-rows: 1 - -[0] - Tenant: - Used to distinguish between carriers if more than one share the same - database in the CGRates system. - -[1] - Account: - The identifier for the user's account. - -[2] - Direction: - Can be **\*in** or **\*out** for the INBOUND and OUTBOUND calls. - -[3] - ActionPlanId: - The action plan id/tag described in the **Action plans** file. (*ActionPlans.csv* - **Id**) - - Forwards to a timed action group that will be used on this account. - -[4] - ActionTriggersId: - The action trigger id/tag described in the **Action triggers** file. (*ActionTriggers.csv* - **Tag**) - - Forwards to a triggered action group that will be applied to this account. - -[5] - AllowNegative: - TBD - -[6] - Disabled: - TBD - -4.2.8 Action triggers -~~~~~~~~~~~~~~~~~~~~~~ -For each account there are counters that record the activity on various -balances. Action triggers allow when a counter reaches a threshold to activate a -group of actions. After the execution the action trigger is marked as used and -will no longer be evaluated until the triggers are reset. See actions for action -trigger resetting. - -:: - - "ActionTriggers.csv" - csv - "tp_action_triggers" - stor_db - -.. csv-table:: - :file: ../data/tariffplans/tutorial/ActionTriggers.csv - :header-rows: 1 - -[0] - Tag: - A string by which this action trigger will be referenced in other places by. - -[1] - UniqueID: - Unique id for the trigger in multiple ActionTriggers - -[2] - ThresholdType: - The threshold type. Can have one of the following: - - + **\*min_counter**: Fire when counter is less than ThresholdValue - + **\*max_counter**: Fire when counter is greater than ThresholdValue - + **\*min_balance**: Fire when balance is less than ThresholdValue - + **\*max_balance**: Fire when balances is greater than ThresholdValue - + **\*min_asr**: Fire when ASR(Average success Ratio) is less than ThresholdValue - + **\*max_asr**: Fire when ASR is greater than ThresholdValue - + **\*min_acd**: Fire when ACD(Average call Duration) is less than ThresholdValue - + **\*max_acd**: Fire when ACD is greater than ThresholdValue - + **\*min_acc**: Fire when ACC(Average call cost) is less than ThresholdValue - + **\*max_acc**: Fire when ACC is greater than ThresholdValue - + **\*min_tcc**: Fire when TCC(Total call cost) is less than ThresholdValue - + **\*max_tcc**: Fire when TCC is greater than ThresholdValue - + **\*min_tcd**: fire when TCD(total call duration) is less than thresholdvalue - + **\*max_tcd**: fire when TCD is greater than thresholdvalue - + **\*min_pdd**: Fire when PDD(Post Dial Delay) is less than ThresholdValue - + **\*max_pdd**: Fire when PDD is greater than ThresholdValue - -[3] - ThresholdValue: - The value of the balance counter that will trigger this action. - -[4] - Recurrent(Boolean): - In case of trigger we can fire recurrent while it's active, or only the - first time. - -[5] - MinSleep: - When Threshold is triggered we can sleep for the time specified. - -[6] - ExpiryTime - TBD - -[7] - ActivationTime - TBD - -[8] - BalanceTag: - Specifies the balance counter by which this action will be triggered. - Can be: - - + **MONETARY** - + **SMS** - + **INTERNET** - + **INTERNET_TIME** - + **MINUTES** - -[9] - BalanceType: - Specifies the balance type for this action: - - + **\*voice**: units of call minutes - + **\*sms**: units of SMS - + **\*data**: units of data - + **\*monetary**: units of money - -[10] - BalanceDirections: - Can be **\*in** or **\*out** for the INBOUND and OUTBOUND calls. - -[11] - BalanceCategories: - Category of the call/trigger - -[12] - BalanceDestinationIds: - The destination id/tag described in the **Destinations** file. (*Destinations.csv* - **Id**) - rinor: need verification - - Destination of the call/trigger - -[13] - BalanceRatingSubject: - TBD - -[14] - BalanceSharedGroup: - Shared Group of the call/trigger - -[15] - BalanceExpiryTime: - TBD - -[16] - BalanceTimingIds: - TBD - -[17] - BalanceWeight: - TBD - -[18] - BalanceBlocker - TBD - -[19] - BalanceDisabled: - TBD - -[20] - StatsMinQueuedItems: - Min of items that need to have a queue to reach this Trigger. - Trigger actions only if this number is hit (stats only). - -[21] - ActionsId: - The actions id/tag described in the **Actions** file. (*Actions.csv* - **ActionsId**) - - Forwards to an action group to be executed when the threshold is reached. - -[22] - Weight: - Specifies the order for these triggers to be evaluated. If there are - multiple triggers are fired in the same time the ones with the lower weight - will be executed first. - -4.2.9. Action Plans -~~~~~~~~~~~~~~~~~~~ -TBD - -:: - - "ActionPlans.csv" - csv - "tp_action_plans" - stor_db - -.. csv-table:: - :file: ../data/tariffplans/tutorial/ActionPlans.csv - :header-rows: 1 - -[0] - Id: - A string by which this action timing will be referenced in other places by. - -[1] - ActionsId: - Forwards to an action group to be executed when the timing is right. - -[2] - TimingId: - A timing (one time or recurrent) at which the action group will be executed - -[3] - Weight: - Specifies the order for these timings to be evaluated. If there are multiple - action timings set to be execute on the same time the ones with the lower - weight will be executed first. - -4.2.10. Actions -~~~~~~~~~~~~~~ -TBD - -:: - - "Actions.csv" - csv - "tp_actions" - stor_db - -.. csv-table:: - :file: ../data/tariffplans/tutorial/Actions.csv - :header-rows: 1 - -[0] - ActionsId: - A string by which this action will be referenced in other places by. - -[1] - Action: - The action type. Can have one of the following: - - + **\*allow_negative**: Allow to the account to have negative balance - + **\*http_post**: Send a http request to the following url - + **\*http_post_async**: Send a http request to the following url Asynchronous - + **\*cdrlog**: Log the current action in the storeDB - + **\*debit**: Debit account balance. - + **\*deny_negative**: Deny to the account to have negative balance - + **\*disable_account**: Disable account in the platform - + **\*enable_account**: Enable account in the platform - + **\*log**: Logs the other action values (for debugging purposes). - + **\*mail_async**: Send a email to the direction - + **\*reset_account**: Sets all counters to 0 - + **\*reset_counter**: Sets the counter for the BalanceTag to 0 - + **\*reset_counters**: Sets *all* the counters for the BalanceTag to 0 - + **\*reset_triggers**: reset all the triggers for this account - + **\*set_recurrent**: (pending) - + **\*topup**: Add account balance. If the specific balance is not defined, define it (example: minutes per destination). - + **\*topup_reset**: Add account balance. If previous balance found of the same type, reset it before adding. - + **\*unset_recurrent**: (pending) - + **\*unlimited**: (pending) - -[2] - ExtraParameters: - In Extra Parameter field you can define an argument for the action. In case - of http_post Action, extraParameter will be the url action. In case of - mail_async the email that you want to receive. - -[3] - Filter - TBD - -[4] - BalanceId: - The balance on which the action will operate - -[5] - BalanceType: - Specifies the balance type for this action: - - + **\*voice**: units of call minutes - + **\*sms**: units of SMS - + **\*data**: units of data - + **\*monetary**: units of money - -[6] - Directions: - Can be **\*in** or **\*out** for the INBOUND and OUTBOUND calls. - -[7] - Categories: - TBD - -[8] - DestinationIds: - The destination id/tag described in the **Destinations** file. (*Destinations.csv* - Id) - - This field is used only if the BalanceId is MINUTES. Specifies the - destination of the minutes to be operated. - -[9] - RatingSubject: - The ratingSubject of the Actions - -[10] - SharedGroup: - In case of the account uses any shared group for the balances. - -[11] - ExpiryTime: - TBD - -[12] - TimingIds: - Timming tag when the action can be executed. Default ALL. - -[13] - Units: - Number of units for decrease the balance. Only use if BalanceType is voice. - -[14] - BalanceWeight: - TBD - -[15] - BalanceBlocker - TBD - -[16] - BalanceDisabled: - TBD - -[17] - Weight: - If there are multiple actions in a group, they will be executed in the order - of their weight (**smaller** first). - -4.2.11. Derived Chargers -~~~~~~~~~~~~~~~~~~~~~~~~~ -For each call we can bill more than one time, for that we need to use the -following options: - -:: - - "DerivedChargers.csv" - csv - "tp_derived_chargers" - stor_db - -.. csv-table:: - :file: ../data/tariffplans/tutorial/DerivedChargers.csv - :header-rows: 1 - -In derived charges we have 2 different kind of options, **FILTERS** and **ACTIONS** : - -**Filters**: With the following fields we filter the calls that need to run a extra -billing parameter. - -[0] - Direction: - TBD -[1] - Tenant: - TBD -[2] - Category: - TBD -[3] - Account: - TBD -[4] - Subject: - TBD -[5] - DestinationIds: - TBD - -**Actions**: In case of the filter options match, platform creates extra runid with -the fields that we want to modify. - -[6] - RunId: - TBD -[7] - RunFilter: - TBD -[8] - ReqTypeField: - TBD -[9] - DirectionField: - TBD -[10] - TenantField: - TBD -[11] - CategoryField: - TBD -[12] - AccountField: - TBD -[13] - SubjectField: - TBD -[14] - DestinationField: - TBD -[15] - SetupTimeField: - TBD -[16] - PddField: - TBD -[17] - AnswerTimeField: - TBD -[18] - UsageField: - TBD -[19] - SupplierField: - TBD -[20] - DisconnectCause: - TBD -[21] - RatedField: - TBD -[22] - CostField: - TBD - -In the example, all the calls with direction=out, tenant=cgrates.org, -category="call" and account and subject equal 1001. Will be created a new cdr in -the table *rated_cdrs* with the runID derived_run1, and the subject 1002. - -This feature it's useful in the case that you want to rated the calls 2 times, -for example rated for different tenants or resellers. - -4.2.12. CDR Stats -~~~~~~~~~~~~~~~~~~ -CDR Stats enables some realtime statistics in your platform for multiple -purposes, you can read more, see :ref:`cdrstats-main` - -:: - - "CdrStats.csv" - csv - "tp_cdr_stats" - stor_db - -.. csv-table:: - :file: ../data/tariffplans/tutorial/CdrStats.csv - :header-rows: 1 - -[0] - Id: - Tag name for the Queue id - -[1] - QueueLength: - Maximum number of calls in this queue - -[2] - TimeWindow: - Window frame to store the calls - -[3] - SaveInterval: - Each interval queue stats will save in the stordb - -[4] - Metric: - Type of metric see :ref:`cdrstats-metrics` - -[5] - SetupInterval: - TBD - -[6] - ToR: - TBD - -[7] - CdrHost - TBD - -[8] - CdrSource: - TBD - -[9] - ReqType: - Filter by reqtype - -[10] - Direction: - TBD - -[11] - Tenant: - Used to distinguish between carriers if more than one share the same - database in the CGRates system. - -[12] - Category: - Type of record specifies the kind of transmission this rate profile applies - to. - -[13] - Account: - The identifier for the user's account. - -[14] - Subject: - The client/user for who this profile is detailing the rates. - -[15] - DestinationIds: - Filter only by destinations prefix. Can be multiple separated with **;** - -[16] - PddInterval: - TBD - -[17] - UsageInterval: - TBD - -[18] - Supplier: - TBD - -[19] - DisconnectCause: - TBD - -[20] - RunIds: - TBD - -[21] - RatedAccount: - Filter by rated account - -[22] - RatedSubject: - Filter by rated subject - -[23] - CostInterval: - Filter by cost - -[24] - ActionTriggers: - ActionTriggers associated with this queue - -4.2.13. Shared groups -~~~~~~~~~~~~~~~~~~~~~ -TBD - -:: - - "SharedGroups.csv" - csv - "tp_shared_groups" - stor_db - -.. csv-table:: - :file: ../data/tariffplans/tutorial/SharedGroups.csv - :header-rows: 1 - -[0] - Id: - TBD - -[1] - Account: - TBD - -[2] - Strategy: - TBD - -[3] - RatingSubject: - TBD - -4.2.14. LCR rules -~~~~~~~~~~~~~~~~~ -TBD - -:: - - "LcrRules.csv" - csv - "tp_lcr_rules" - stor_db - -.. csv-table:: - :file: ../data/tariffplans/tutorial/LcrRules.csv - :header-rows: 1 - -[0] - Direction: - TBD - -[1] - Tenant: - TBD - -[2] - Category: - TBD - -[3] - Account: - TBD - -[4] - Subject: - TBD - -[5] - DestinationTag: - TBD - -[6] - RpCategory: - TBD - -[7] - Strategy: - TBD - -[8] - StrategyParams: - TBD - -[9] - ActivationTime: - TBD - -[10] - Weight: - TBD - -4.2.15. Users -~~~~~~~~~~~~~ -TBD - -:: - - "Users.csv" - csv - "tp_users" - stor_db - -.. csv-table:: - :file: ../data/tariffplans/tutorial/Users.csv - :header-rows: 1 - -[0] - Tenant: - TBD - -[1] - UserName: - TBD - -[2] - Masked: - TBD - -[3] - AttributeName: - TBD - -[4] - AttributeValue: - TBD - -[5] - Weight: - TBD - -4.2.16. Aliases -~~~~~~~~~~~~~~~ -TBD - -:: - - "Aliases.csv" - csv - "tp_aliases" - stor_db - -.. csv-table:: - :file: ../data/tariffplans/tutorial/Aliases.csv - :header-rows: 1 - -[0] - Direction: - TBD - -[1] - Tenant: - TBD - -[2] - Category: - TBD - -[3] - Account: - TBD - -[4] - Subject: - TBD - -[5] - DestinationId: - TBD - -[6] - Context: - TBD - -[7] - Target: - TBD - -[8] - Original: - TBD - -[9] - Alias: - TBD - -[10] - Weight: - TBD - -4.2.17. Resource Limits -~~~~~~~~~~~~~~~~~~~~~~~ -TBD - -:: - - "Resources.csv" - csv - "tp_resources" - stor_db - -.. csv-table:: - :file: ../data/tariffplans/tutorial/ResourceLimits.csv - :header-rows: 1 - -[0] - Tag - TBD - -[1] - Type - TBD - -[2] - Element - TBD - -[3] - Values - TBD - -[4] - ActivationTime - TBD - -[5] - Weight - TBD - -[6] - Limit - TBD - -[7] - ActionTriggerIds - TBD - diff --git a/docs/tariffplans.rst b/docs/tariffplans.rst index 2bda27797..6a4970002 100644 --- a/docs/tariffplans.rst +++ b/docs/tariffplans.rst @@ -1,3 +1,5 @@ +.. _tariffplan: + TariffPlans =========== @@ -14,72 +16,4 @@ Due to complex data definition we have split information necessary on each load Each individual CSV file can have any number of rows starting with comment character (#) which will be ignored on processing. -Depending on CGRateS subsystem, following files are required: - -Rating -~~~~~~ - -.. toctree:: - :maxdepth: 2 - - csv_tptimings - -.. toctree:: - :maxdepth: 2 - - csv_tpdestinations - -.. toctree:: - :maxdepth: 2 - - csv_tprates - -.. toctree:: - :maxdepth: 2 - - csv_tpdestinationrates - -.. toctree:: - :maxdepth: 2 - - csv_tpdestratetimings - -.. toctree:: - :maxdepth: 2 - - csv_tpratingprofiles - -Accounting -~~~~~~~~~~ - -.. toctree:: - :maxdepth: 2 - - csv_tptimings - -.. toctree:: - :maxdepth: 2 - - csv_tpdestinations - -.. toctree:: - :maxdepth: 2 - - csv_tpactions - -.. toctree:: - :maxdepth: 2 - - csv_tpactiontimings - -.. toctree:: - :maxdepth: 2 - - csv_tpactiontriggers - -.. toctree:: - :maxdepth: 2 - - csv_tpaccountactions - - +Examples of TariffPlans as CSVs can be found on the `GitHub repository `_ . \ No newline at end of file diff --git a/docs/thresholds.rst b/docs/thresholds.rst index b3b8ee11b..b7b222423 100644 --- a/docs/thresholds.rst +++ b/docs/thresholds.rst @@ -4,7 +4,7 @@ ThresholdS ========== -**ThresholdS** is a standalone subsystem within **CGRateS** responsible to execute a list of *Actions* for a specific event received to process. It is accessed via :ref:`CGRateS RPC APIs`. +**ThresholdS** is a standalone subsystem within **CGRateS** responsible to execute a list of *Actions* for a specific event received to process. It is accessed via `CGRateS RPC APIs `_. As most of the other subsystems, it is performance oriented, stored inside *DataDB* but cached inside the *cgr-engine* process. Caching can be done dynamically/on-demand or at start-time/precached and it is configurable within *cache* section in the :ref:`JSON configuration `. diff --git a/docs/tut_freeswitch.rst b/docs/tut_freeswitch.rst index fcc293fd7..8b0fcfaf3 100644 --- a/docs/tut_freeswitch.rst +++ b/docs/tut_freeswitch.rst @@ -12,5 +12,5 @@ In these tutorials we exemplify a few cases of integration between FreeSWITCH_ a tut_freeswitch_json tut_cgrates_usage -.. _FreeSWITCH: http://www.freeswitch.org/ +.. _FreeSWITCH: https://freeswitch.com// diff --git a/docs/tut_freeswitch_csv.rst b/docs/tut_freeswitch_csv.rst deleted file mode 100644 index edef28972..000000000 --- a/docs/tut_freeswitch_csv.rst +++ /dev/null @@ -1,79 +0,0 @@ -FreeSWITCH_ generating *.csv* CDRs -================================== - -Scenario --------- - -- FreeSWITCH with *vanilla* configuration, minimal modifications to fit our needs. - - - Modified following users (with configs in *etc/freeswitch/directory/default*): 1001-prepaid, 1002-postpaid, 1003-pseudoprepaid, 1004-rated. - - Have added inside default dialplan CGR own extensions just before routing towards users (*etc/freeswitch/dialplan/default.xml*). - - FreeSWITCH configured to generate default *.csv* CDRs, modified example template to add cgr_reqtype from user variables (*etc/freeswitch/autoload_configs/cdr_csv.conf.xml*). - -- **CGRateS** with following components: - - - CGR-SM started as prepaid controller, with debits taking place at 5s intervals. - - CGR-CDRC component importing FreeSWITCH_ generated *.csv* CDRs into CGR and moving the processed *.csv* files to */tmp* folder. - - CGR-Mediator compoenent attaching costs to the raw CDRs from CGR-CDRC inside CGR StorDB. - - CGR-CDRE exporting mediated CDRs from CGR StorDB (export path: */tmp*). - - CGR-History component keeping the archive of the rates modifications (path browsable with git client at */tmp/cgr_history*). - - -Starting FreeSWITCH_ with custom configuration ----------------------------------------------- - -:: - - /usr/share/cgrates/tutorials/fs_csv/freeswitch/etc/init.d/freeswitch start - -To verify that FreeSWITCH_ is running we run the console command: - -:: - - fs_cli -x status - - -Starting **CGRateS** with custom configuration ----------------------------------------------- - -:: - - /usr/share/cgrates/tutorials/fs_csv/cgrates/etc/init.d/cgrates start - -Check that cgrates is running - -:: - - cgr-console status - -CDR processing --------------- - -For every call FreeSWITCH_ will generate CDR records within the *Master.csv* file. -In order to avoid double-processing we will use the rotate mechanism built in FreeSWITCH_. -Once rotated, we will move the resulted files inside the path considered by **CGRateS** *CDRC* component as inbound. - -These steps are automated in a script provided in the */usr/share/cgrates/scripts* location: - -:: - - /usr/share/cgrates/scripts/freeswitch_cdr_csv_rotate.sh - - -On each rotate CGR-CDRC component will be informed via *inotify* subsystem and will instantly process the CDR file. The records end up in **CGRateS**/StorDB inside *cdrs_primary* table via CGR-CDRS. As soon as the CDR will hit CDRS component, mediation will occur, either considering the costs calculated in case of prepaid and postpaid calls out of *cost_details* table or query it's own one from rater in case of *pseudoprepaid* and *rated* CDRs. - -Once the CDRs are mediated, can be exported as *.csv* format again via remote command offered by *cgr-console* tool: - -:: - - cgr-console 'cdrs_export CdrFormat="csv" ExportDir="/tmp"' - - -**CGRateS** Usage ------------------ - -Since it is common to most of the tutorials, the example for **CGRateS** usage is provided in a separate page `here `_ - - -.. _FreeSWITCH: http://www.freeswitch.org/ -.. _Jitsi: http://www.jitsi.org/ diff --git a/docs/tut_freeswitch_installs.rst b/docs/tut_freeswitch_installs.rst index f20d5f68c..b6d4c4320 100644 --- a/docs/tut_freeswitch_installs.rst +++ b/docs/tut_freeswitch_installs.rst @@ -29,4 +29,4 @@ We will install FreeSWITCH_ via following commands: Once installed, we will proceed with loading the configuration out of specific tutorial cases bellow. -.. _FreeSWITCH: http://www.freeswitch.org/ +.. _FreeSWITCH: https://freeswitch.com// diff --git a/docs/tut_freeswitch_json.rst b/docs/tut_freeswitch_json.rst index e2cec9380..4ead41fe1 100644 --- a/docs/tut_freeswitch_json.rst +++ b/docs/tut_freeswitch_json.rst @@ -62,5 +62,5 @@ At the end of each call FreeSWITCH_ will issue a http post with the CDR. This wi Since it is common to most of the tutorials, the example for **CGRateS** usage is provided in a separate page `here `_ -.. _FreeSWITCH: http://www.freeswitch.org/ -.. _Jitsi: http://www.jitsi.org/ +.. _FreeSWITCH: https://freeswitch.com// +.. _Jitsi: https://jitsi.org/ diff --git a/docs/tut_jitsi_installs.rst b/docs/tut_jitsi_installs.rst index b09801a55..87a484d5c 100644 --- a/docs/tut_jitsi_installs.rst +++ b/docs/tut_jitsi_installs.rst @@ -1,6 +1,6 @@ SIP UA - Jitsi_ --------------- -On our ubuntu desktop host, we have installed Jitsi_ to be used as SIP UA, out of stable provided packages on `Jitsi download `_ and had Jitsi_ configured with 4 accounts: 1001/CGRateS.org, 1002/CGRateS.org, 1003/CGRateS.org and 1004/CGRateS.org. +On our ubuntu desktop host, we have installed Jitsi_ to be used as SIP UA, out of stable provided packages on `Jitsi download `_ and had Jitsi_ configured with 4 accounts: 1001/CGRateS.org, 1002/CGRateS.org, 1003/CGRateS.org and 1004/CGRateS.org. -.. _Jitsi: http://www.jitsi.org/ \ No newline at end of file +.. _Jitsi: https://jitsi.org/ \ No newline at end of file diff --git a/docs/tut_kamailio.rst b/docs/tut_kamailio.rst index bf3ca4947..18efca663 100644 --- a/docs/tut_kamailio.rst +++ b/docs/tut_kamailio.rst @@ -12,6 +12,6 @@ In these tutorials we exemplify a few cases of integration between Kamailio_ and tut_kamailio_evapi tut_cgrates_usage -.. _Kamailio: http://www.kamailio.org/ +.. _Kamailio: https://www.kamailio.org/w/ .. _CGRateS: http://www.cgrates.org/ diff --git a/docs/tut_kamailio_evapi.rst b/docs/tut_kamailio_evapi.rst index 04df505ff..4f4738e52 100644 --- a/docs/tut_kamailio_evapi.rst +++ b/docs/tut_kamailio_evapi.rst @@ -56,4 +56,4 @@ At the end of each call Kamailio_ will generate an CDR event via *evapi* and thi Since it is common to most of the tutorials, the example for **CGRateS** usage is provided in a separate page `here `_ -.. _Kamailio: http://www.kamailio.org/ +.. _Kamailio: https://www.kamailio.org/w/ diff --git a/docs/tut_kamailio_installs.rst b/docs/tut_kamailio_installs.rst index 1a8c50960..7fa99d0f5 100644 --- a/docs/tut_kamailio_installs.rst +++ b/docs/tut_kamailio_installs.rst @@ -23,4 +23,4 @@ We got Kamailio_ installed via following commands: Once installed we proceed with loading the configuration out of specific tutorial cases bellow. -.. _Kamailio: http://www.kamailio.org/ +.. _Kamailio: https://www.kamailio.org/w/ diff --git a/docs/tut_opensips.rst b/docs/tut_opensips.rst index e7c78ff9e..97a1a3b10 100644 --- a/docs/tut_opensips.rst +++ b/docs/tut_opensips.rst @@ -12,6 +12,6 @@ In these tutorials we exemplify a few cases of integration between OpenSIPS_ and tut_opensips_event tut_cgrates_usage -.. _OpenSIPS: http://www.opensips.org/ +.. _OpenSIPS: https://www.opensips.org/ .. _CGRateS: http://www.cgrates.org/ diff --git a/docs/tut_opensips_event.rst b/docs/tut_opensips_event.rst index 4ee61648e..04fae43ce 100644 --- a/docs/tut_opensips_event.rst +++ b/docs/tut_opensips_event.rst @@ -57,4 +57,4 @@ At the end of each call OpenSIPS_ will generate an CDR event and due to automati Since it is common to most of the tutorials, the example for **CGRateS** usage is provided in a separate page `here `_ -.. _OpenSIPS: http://www.opensips.org/ +.. _OpenSIPS: https://www.opensips.org/ diff --git a/docs/tut_opensips_installs.rst b/docs/tut_opensips_installs.rst index 70f193cff..c0e5d88e7 100644 --- a/docs/tut_opensips_installs.rst +++ b/docs/tut_opensips_installs.rst @@ -22,4 +22,4 @@ We got OpenSIPS_ installed via following commands: Once installed we proceed with loading the configuration out of specific tutorial cases bellow. -.. _OpenSIPS: http://www.opensips.org/ +.. _OpenSIPS: https://www.opensips.org/ diff --git a/engine/caches.go b/engine/caches.go index 3454b52ad..80891322b 100644 --- a/engine/caches.go +++ b/engine/caches.go @@ -49,7 +49,7 @@ func init() { gob.Register(new(StatQueueProfileWithOpts)) gob.Register(new(StoredStatQueue)) gob.Register(new(StatQueueProfileWithOpts)) - // Suppliers + // RouteS gob.Register(new(RouteProfile)) gob.Register(new(RouteProfileWithOpts)) // Filters diff --git a/engine/responder.go b/engine/responder.go index 87bf0da31..bed9d17db 100644 --- a/engine/responder.go +++ b/engine/responder.go @@ -109,7 +109,7 @@ func (rs *Responder) GetCost(arg *CallDescriptorWithOpts, reply *CallCost) (err return } -//GetCostOnRatingPlans is used by SupplierS to calculate the cost +// GetCostOnRatingPlans is used by RouteS to calculate the cost // Receive a list of RatingPlans and pick the first without error func (rs *Responder) GetCostOnRatingPlans(arg *utils.GetCostOnRatingPlansArgs, reply *map[string]interface{}) (err error) { for _, rp := range arg.RatingPlanIDs { // loop through RatingPlans until we find one without errors diff --git a/sessions/sessions.go b/sessions/sessions.go index ccc275cf8..eb1c893cd 100644 --- a/sessions/sessions.go +++ b/sessions/sessions.go @@ -3779,7 +3779,7 @@ func (sS *SessionS) getRoutes(cgrEv *utils.CGREvent, pag utils.Paginator, ignore } if err = sS.connMgr.Call(sS.cgrCfg.SessionSCfg().RouteSConns, nil, utils.RouteSv1GetRoutes, sArgs, &routesReply); err != nil { - return routesReply, utils.NewErrSupplierS(err) + return routesReply, utils.NewErrRouteS(err) } return } diff --git a/utils/errors.go b/utils/errors.go index a621774dd..b7af198fa 100644 --- a/utils/errors.go +++ b/utils/errors.go @@ -172,7 +172,7 @@ func NewErrResourceS(err error) error { return fmt.Errorf("RESOURCES_ERROR:%s", err) } -func NewErrSupplierS(err error) error { +func NewErrRouteS(err error) error { return fmt.Errorf("ROUTES_ERROR:%s", err) } diff --git a/utils/errors_test.go b/utils/errors_test.go index c431d4193..f7312143b 100644 --- a/utils/errors_test.go +++ b/utils/errors_test.go @@ -116,7 +116,7 @@ func TestNewErrResourceS(t *testing.T) { func TestNewErrSupplierS(t *testing.T) { cgrError := NewCGRError("context", "apiError", "shortError", "longError") - if rcv := NewErrSupplierS(cgrError); rcv.Error() != "ROUTES_ERROR:shortError" { + if rcv := NewErrRouteS(cgrError); rcv.Error() != "ROUTES_ERROR:shortError" { t.Errorf("Expecting: ROUTES_ERROR:shortError, received: %+v", rcv) } }