mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Docs - updating Diameter and ERs path info
This commit is contained in:
@@ -5,7 +5,7 @@ cgr-engine
|
||||
|
||||
Groups most of functionality from services and components.
|
||||
|
||||
Customisable through the use of *json* :ref:`configuration <engine_configuration>` or command line arguments (higher prio).
|
||||
Customisable through the use of *json* :ref:`JSON configuration <configuration>` or command line arguments (higher prio).
|
||||
|
||||
Able to read the configuration from either a local directory of *.json* files with an unlimited number of subfolders (ordered alphabetically) or a list of http paths (separated by ";").
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ Can be used to:
|
||||
* import TariffPlan data from **csv files** to **StorDB** as offline data. ``-to_stordb -tpid``
|
||||
* import TariffPlan data from **StorDB** to **DataDB**. ``-from_stordb -tpid``
|
||||
|
||||
Customisable through the use of *json* :ref:`configuration <engine_configuration>` or command line arguments (higher prio).
|
||||
Customisable through the use of :ref:`JSON configuration <configuration>` or command line arguments (higher prio).
|
||||
|
||||
|
||||
::
|
||||
|
||||
@@ -5,7 +5,7 @@ cgr-migrator
|
||||
|
||||
Command line migration tool.
|
||||
|
||||
Customisable through the use of *json* :ref:`configuration <engine_configuration>` or command line arguments (higher prio).
|
||||
Customisable through the use of :ref:`JSON configuration <configuration>` or command line arguments (higher prio).
|
||||
|
||||
::
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
|
||||
.. _engine_configuration:
|
||||
|
||||
4.1. cgr-engine configuration file
|
||||
==================================
|
||||
|
||||
Has a *JSON* format with commented lines starting with *//*.
|
||||
|
||||
Organized into configuration sections which offers the advantage of being easily splitable.
|
||||
|
||||
.. hint:: You can split the configuration into any number of *.json* files/directories since the :ref:cgr-engine loads recursively the complete configuration folder, alphabetically ordered
|
||||
|
||||
|
||||
All configuration options come with defaults and we have tried our best to choose the best ones for a minimum of efforts necessary when running.
|
||||
|
||||
Can be loaded from local folders or remotely using HTTP transport.
|
||||
|
||||
The configuration can be loaded at start and reloaded at run time using APIs designed for that. This can be done either as *config pull* (reload from path) or as *config push* (the *JSON BLOB* is sent via API to the engine).
|
||||
|
||||
.. hint:: You can reload from remote HTTP server as well.
|
||||
|
||||
Below is the default configuration file which comes hardcoded into :ref:cgr-engine:
|
||||
|
||||
.. literalinclude:: ../data/conf/cgrates/cgrates.json
|
||||
:language: javascript
|
||||
:linenos:
|
||||
@@ -4,18 +4,26 @@
|
||||
Configuration
|
||||
*************
|
||||
|
||||
The behaviour of **CGRateS** can be externally influenced by following means:
|
||||
Has a *JSON* format with commented lines starting with *//*.
|
||||
|
||||
- **Engine configuration files**: usually located at */etc/cgrates/*.
|
||||
There can be one or multiple file(s)/folder(s) hierarchies behind configuration folder with support for automatic includes.
|
||||
The file(s)/folder(s) will be imported **in alphabetical order** into final configuration object.
|
||||
- **Tariff Plans**: set of files used to import various data used in CGRateS subsystems (eg: Rating, Accounting, LCR, DerivedCharging, etc).
|
||||
- **RPC APIs**: set of JSON/GOB encoded APIs remotely available for various operational/administrative tasks.
|
||||
Organized into configuration sections which offers the advantage of being easily splitable.
|
||||
|
||||
.. hint:: You can split the configuration into any number of *.json* files/directories since the :ref:cgr-engine loads recursively the complete configuration folder, alphabetically ordered
|
||||
|
||||
|
||||
All configuration options come with defaults and we have tried our best to choose the best ones for a minimum of efforts necessary when running.
|
||||
|
||||
Can be loaded from local folders or remotely using HTTP transport.
|
||||
|
||||
The configuration can be loaded at start and reloaded at run time using APIs designed for that. This can be done either as *config pull* (reload from path) or as *config push* (the *JSON BLOB* is sent via API to the engine).
|
||||
|
||||
.. hint:: You can reload from remote HTTP server as well.
|
||||
|
||||
Below is the default configuration file which comes hardcoded into :ref:cgr-engine:
|
||||
|
||||
.. literalinclude:: ../data/conf/cgrates/cgrates.json
|
||||
:language: javascript
|
||||
:linenos:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
cgrates_json
|
||||
tariff_plans
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ DiameterAgent
|
||||
|
||||
**DiameterAgent** translates between Diameter_ and **CGRateS**, sending *RPC* requests towards **CGRateS/SessionS** component and returning replies from it to the *DiameterClient*.
|
||||
|
||||
Implements Diameter_ protocol in a standard agnostic manner, giving users the ability to implement own interfaces by defining simple *processor templates* within the :ref:`configuration <engine_configuration>` files.
|
||||
Implements Diameter_ protocol in a standard agnostic manner, giving users the ability to implement own interfaces by defining simple *processor templates* within the :ref:`JSON configuration <configuration>` files.
|
||||
|
||||
Used mostly in modern mobile networks (LTE/xG).
|
||||
|
||||
@@ -15,7 +15,7 @@ Used mostly in modern mobile networks (LTE/xG).
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
The **DiameterAgent** is configured within *diameter_agent* section from :ref:`JSON configuration <engine_configuration>`.
|
||||
The **DiameterAgent** is configured within *diameter_agent* section from :ref:`JSON configuration <configuration>`.
|
||||
|
||||
|
||||
Sample config
|
||||
@@ -40,104 +40,104 @@ With explanations in the comments:
|
||||
"synced_conn_requests": false, // process one request at the time per connection
|
||||
"asr_template": "*asr", // enable AbortSession message being sent to client
|
||||
// forcing session disconnection from CGRateS side
|
||||
|
||||
"templates":{ // message templates which can be injected within request/replies
|
||||
"*err": [ // *err is used mostly in automatic diameter replies with errors
|
||||
{
|
||||
"tag": "SessionId", "path": "Session-Id",
|
||||
"tag": "SessionId", "path": "*rep.Session-Id",
|
||||
"type": "*variable", "mandatory": true,
|
||||
"value": "~*req.Session-Id"
|
||||
},
|
||||
{
|
||||
"tag": "OriginHost", "path": "Origin-Host",
|
||||
"tag": "OriginHost", "path": "*rep.Origin-Host",
|
||||
"type": "*variable", "mandatory": true,
|
||||
"value": "~*vars.OriginHost"
|
||||
},
|
||||
{
|
||||
"tag": "OriginRealm", "path": "Origin-Realm",
|
||||
"tag": "OriginRealm", "path": "*rep.Origin-Realm",
|
||||
"type": "*variable", "mandatory": true,
|
||||
"value": "~*vars.OriginRealm"
|
||||
},
|
||||
],
|
||||
"*cca": [ // *cca is used into CallControlAnswer messages
|
||||
{
|
||||
"tag": "SessionId", "path": "Session-Id",
|
||||
"tag": "SessionId", "path": "*rep.Session-Id",
|
||||
"type": "*composed", "mandatory": true,
|
||||
"value": "~*req.Session-Id"
|
||||
},
|
||||
{
|
||||
"tag": "ResultCode", "path": "Result-Code",
|
||||
"tag": "ResultCode", "path": "*rep.Result-Code",
|
||||
"type": "*constant", "value": "2001"},
|
||||
{
|
||||
"tag": "OriginHost", "path": "Origin-Host",
|
||||
"tag": "OriginHost", "path": "*rep.Origin-Host",
|
||||
"type": "*variable", "mandatory": true,
|
||||
"value": "~*vars.OriginHost"
|
||||
},
|
||||
{
|
||||
"tag": "OriginRealm", "path": "Origin-Realm",
|
||||
"tag": "OriginRealm", "path": "*rep.Origin-Realm",
|
||||
"type": "*variable", "mandatory": true,
|
||||
"value": "~*vars.OriginRealm"
|
||||
},
|
||||
{
|
||||
"tag": "AuthApplicationId",
|
||||
"path": "Auth-Application-Id",
|
||||
"path": "rep.Auth-Application-Id",
|
||||
"type": "*variable", "mandatory": true,
|
||||
"value": "~*vars.*appid"
|
||||
},
|
||||
{
|
||||
"tag": "CCRequestType",
|
||||
"path": "CC-Request-Type",
|
||||
"path": "*rep.CC-Request-Type",
|
||||
"type": "*variable", "mandatory": true,
|
||||
"value": "~*req.CC-Request-Type"
|
||||
},
|
||||
{
|
||||
"tag": "CCRequestNumber",
|
||||
"path": "CC-Request-Number",
|
||||
"path": "*rep.CC-Request-Number",
|
||||
"type": "*variable", "mandatory": true,
|
||||
"value": "~*req.CC-Request-Number"
|
||||
},
|
||||
],
|
||||
"*asr": [ // *asr is used to build AbortSessionRequest
|
||||
{
|
||||
"tag": "SessionId", "path": "Session-Id",
|
||||
"tag": "SessionId", "path": "*diamreq.Session-Id",
|
||||
"type": "*variable", "mandatory": true,
|
||||
"value": "~*req.Session-Id"
|
||||
},
|
||||
{
|
||||
"tag": "OriginHost", "path": "Origin-Host",
|
||||
"tag": "OriginHost", "path": "diamreq.Origin-Host",
|
||||
"type": "*variable", "mandatory": true,
|
||||
"value": "~*req.Destination-Host"
|
||||
},
|
||||
{
|
||||
"tag": "OriginRealm", "path": "Origin-Realm",
|
||||
"tag": "OriginRealm", "path": "diamreq.Origin-Realm",
|
||||
"type": "*variable", "mandatory": true,
|
||||
"value": "~*req.Destination-Realm"
|
||||
},
|
||||
{
|
||||
"tag": "DestinationRealm",
|
||||
"path": "Destination-Realm",
|
||||
"path": "*diamreq.Destination-Realm",
|
||||
"type": "*variable", "mandatory": true,
|
||||
"value": "~*req.Origin-Realm"
|
||||
},
|
||||
{
|
||||
"tag": "DestinationHost",
|
||||
"path": "Destination-Host",
|
||||
"path": "*diamreq.Destination-Host",
|
||||
"type": "*variable", "mandatory": true,
|
||||
"value": "~*req.Origin-Host"
|
||||
},
|
||||
{
|
||||
"tag": "AuthApplicationId",
|
||||
"path": "Auth-Application-Id",
|
||||
"path": "*diamreq.Auth-Application-Id",
|
||||
"type": "*variable", "mandatory": true,
|
||||
"value": "~*vars.*appid"
|
||||
},
|
||||
{
|
||||
"tag": "UserName", "path": "User-Name",
|
||||
"tag": "UserName", "path": "*diamreq.User-Name",
|
||||
"type": "*variable", "mandatory": true,
|
||||
"value": "~*req.User-Name"
|
||||
},
|
||||
{
|
||||
"tag": "OriginStateID", "path": "Origin-State-Id",
|
||||
"tag": "OriginStateID",
|
||||
"path": "*diamreq.Origin-State-Id",
|
||||
"type": "*constant", "value": "1"
|
||||
}
|
||||
]
|
||||
@@ -154,52 +154,52 @@ With explanations in the comments:
|
||||
"request_fields":[ // data exchanged between Diameter and CGRateS
|
||||
{
|
||||
"tag": "ToR", // tag is used in debug,
|
||||
"path": "ToR", // path is the field on CGRateS side
|
||||
"path": "*cgreq.ToR", // path is the field on CGRateS side
|
||||
"type": "*constant", // type defines the method to provide the value
|
||||
"value": "*sms"}
|
||||
{
|
||||
"tag": "OriginID", // OriginID will identify uniquely
|
||||
"path": "OriginID", // the session on CGRateS side
|
||||
"type": "*variable", // it's value will be taken from Diameter AVP:
|
||||
"mandatory": true, // Multiple-Services-Credit-Control.Service-Identifier
|
||||
"tag": "OriginID", // OriginID will identify uniquely
|
||||
"path": "*cgreq.OriginID", // the session on CGRateS side
|
||||
"type": "*variable", // it's value will be taken from Diameter AVP:
|
||||
"mandatory": true, // Multiple-Services-Credit-Control.Service-Identifier
|
||||
"value": "~*req.Multiple-Services-Credit-Control.Service-Identifier"
|
||||
},
|
||||
{
|
||||
"tag": "OriginHost", // OriginHost combined with OriginID
|
||||
"path": "OriginHost", // is used by CGRateS to build the CGRID
|
||||
"path": "*cgreq.OriginHost",// is used by CGRateS to build the CGRID
|
||||
"mandatory": true,
|
||||
"type": "*variable", // have the value out of special variable: *vars
|
||||
"value": "*vars.OriginHost"
|
||||
},
|
||||
{
|
||||
"tag": "RequestType", // RequestType instructs SessionS
|
||||
"path": "RequestType", // about charging type to apply for the event
|
||||
"tag": "RequestType", // RequestType instructs SessionS
|
||||
"path": "*cgreq.RequestType", // about charging type to apply for the event
|
||||
"type": "*constant",
|
||||
"value": "*prepaid"
|
||||
},
|
||||
{
|
||||
"tag": "Category", // Category serves for ataching Account
|
||||
"path": "Category", // and RatingProfile to the request
|
||||
"path": "*cgreq.Category", // and RatingProfile to the request
|
||||
"type": "*constant",
|
||||
"value": "sms"
|
||||
},
|
||||
{
|
||||
"tag": "Account", // Account is required by charging
|
||||
"path": "Account",
|
||||
"path": "*cgreq.Account",
|
||||
"type": "*variable", // value is taken dynamically from a group AVP
|
||||
"mandatory": true, // where Subscription-Id-Type is 0
|
||||
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"
|
||||
},
|
||||
{
|
||||
"tag": "Destination", // Destination is used for charging
|
||||
"path": "Destination", // value from Diameter will be mediated before sent to CGRateS
|
||||
"tag": "Destination", // Destination is used for charging
|
||||
"path": "*cgreq.Destination", // value from Diameter will be mediated before sent to CGRateS
|
||||
"type": "*variable",
|
||||
"mandatory": true,
|
||||
"value": "~*req.Service-Information.SMS-Information.Recipient-Info.Recipient-Address.Address-Data:s/^\\+49(\\d+)/int${1}/:s/^0049(\\d+)/int${1}/:s/^49(\\d+)/int${1}/:s/^00(\\d+)/+${1}/:s/^[\\+]?(\\d+)/int${1}/:s/int(\\d+)/+49${1}/"
|
||||
},
|
||||
{
|
||||
"tag": "Destination", // Second Destination will overwrite the first if filter matches
|
||||
"path": "Destination",
|
||||
"path": "*cgreq.Destination",
|
||||
"filters":[ // Only overwrite when filters are matching
|
||||
"*notprefix:~*req.Service-Information.SMS-Information.Recipient-Info.Recipient-Address.Address-Data:49",
|
||||
"*notprefix:~*req.Service-Information.SMS-Information.Recipient-Info.Recipient-Address.Address-Data:3312"
|
||||
@@ -210,28 +210,28 @@ With explanations in the comments:
|
||||
},
|
||||
{
|
||||
"tag": "SetupTime", // SetupTime is used by charging
|
||||
"path": "SetupTime",
|
||||
"path": "*cgreq.SetupTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.Event-Timestamp",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "AnswerTime", // AnswerTime is used by charging
|
||||
"path": "AnswerTime",
|
||||
"path": "*cgreq.AnswerTime",
|
||||
"type": "*variable",
|
||||
"mandatory": true,
|
||||
"value": "~*req.Event-Timestamp"
|
||||
},
|
||||
{
|
||||
"tag": "Usage", // Usage is used by charging
|
||||
"path": "Usage",
|
||||
"path": "*cgreq.Usage",
|
||||
"type": "*variable",
|
||||
"mandatory": true,
|
||||
"value": "~*req.Multiple-Services-Credit-Control.Requested-Service-Unit.CC-Service-Specific-Units"
|
||||
},
|
||||
{
|
||||
"tag": "Originator-SCCP-Address", // Originator-SCCP-Address is an extra field which we want in CDR
|
||||
"path": "Originator-SCCP-Address", // not used by CGRateS
|
||||
"tag": "Originator-SCCP-Address", // Originator-SCCP-Address is an extra field which we want in CDR
|
||||
"path": "*cgreq.Originator-SCCP-Address", // not used by CGRateS
|
||||
"type": "*variable", "mandatory": true,
|
||||
"value": "~*req.Service-Information.SMS-Information.Originator-SCCP-Address"
|
||||
},
|
||||
@@ -245,13 +245,13 @@ With explanations in the comments:
|
||||
{
|
||||
"tag": "ResultCode", // Change the ResultCode if the reply received from CGRateS contains a 0 MaxUsage
|
||||
"filters": ["*eq:~*cgrep.MaxUsage:0"],
|
||||
"path": "Result-Code",
|
||||
"path": "*rep.Result-Code",
|
||||
"blocker": true, // do not consider further fields if this one is processed
|
||||
"type": "*constant",
|
||||
"value": "4012"},
|
||||
{"tag": "ResultCode", // Change the ResultCode AVP if there was an error received from CGRateS
|
||||
"filters": ["*notempty:~*cgrep.Error:"],
|
||||
"path": "Result-Code",
|
||||
"path": "*rep.Result-Code",
|
||||
"blocker": true,
|
||||
"type": "*constant",
|
||||
"value": "5030"}
|
||||
@@ -268,7 +268,7 @@ With explanations in the comments:
|
||||
Config params
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
Most of the parameters are explained in :ref:`configuration <engine_configuration>`, hence we mention here only the ones where additional info is necessary or there will be particular implementation for *DiameterAgent*.
|
||||
Most of the parameters are explained in :ref:`JSON configuration <configuration>`, hence we mention here only the ones where additional info is necessary or there will be particular implementation for *DiameterAgent*.
|
||||
|
||||
|
||||
listen_net
|
||||
@@ -313,6 +313,7 @@ filters
|
||||
* **OriginHost**: agent configured *origin_host*
|
||||
* **OriginRealm**: agent configured *origin_realm*
|
||||
* **ProductName**: agent configured *product_name*
|
||||
* **RemoteHost**: the Address of the remote client
|
||||
* **\*app**: current request application name (out of diameter dictionary)
|
||||
* **\*appid**: current request application id (out of diameter dictionary)
|
||||
* **\*cmd**: current command short naming (out of diameter dictionary) plus *R" as suffix - ie: *CCR*
|
||||
@@ -325,14 +326,17 @@ filters
|
||||
Example 1: *~\*req.Multiple-Services-Credit-Control.Rating-Group[1]* translates to: value of the group attribute at path Multiple-Services-Credit-Control.Rating-Group which is located in the second group (groups start at index 0).
|
||||
Example 2: *~\*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(1)]* which translates to: value of the group attribute at path: *Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets* where Multiple-Services-Credit-Control.Used-Service-Unit.Rating-Group has value of "1".
|
||||
|
||||
* **\*rep**
|
||||
Diameter reply going to *DiameterClient*.
|
||||
|
||||
* **\*cgreq**
|
||||
Request which was sent to CGRateS (mostly useful in replies).
|
||||
Request sent to CGRateS.
|
||||
|
||||
* **\*cgrep**
|
||||
Reply coming from CGRateS.
|
||||
|
||||
* **\*cgrareq**
|
||||
Active request in relation to CGRateS side. It can be used in both *request_fields*, referring to CGRRequest object being built, or in *reply_fields*, referring to CGRReply object.
|
||||
* **\*diamreq**
|
||||
Diameter request generated by CGRateS (ie: *ASR*).
|
||||
|
||||
flags
|
||||
Found within processors, special tags enforcing the actions/verbs done on a request. There are two types of flags: **main** and **auxiliary**.
|
||||
@@ -343,7 +347,7 @@ flags
|
||||
|
||||
The **auxiliary** flags only make sense in combination with **main** ones.
|
||||
|
||||
Implemented flags are (in order of priority, and not working simultaneously unless specified):
|
||||
Implemented **main** flags are (in order of priority, and not working simultaneously unless specified):
|
||||
|
||||
* **\*log**
|
||||
Logs the Diameter request/reply. Can be used together with other *main* actions.
|
||||
@@ -357,7 +361,7 @@ flags
|
||||
* **\*auth**
|
||||
Sends the request for authorization on CGRateS.
|
||||
|
||||
Auxiliary flags available: **\*attributes**, **\*thresholds**, **\*stats**, **\*resources**, **\*accounts**, **\*suppliers**, **\*suppliers_ignore_errors**, **\*suppliers_event_cost** which are used to influence the auth behavior on CGRateS side. More info on that can be found on the **SessionS** component APIs behavior.
|
||||
Auxiliary flags available: **\*attributes**, **\*thresholds**, **\*stats**, **\*resources**, **\*accounts**, **\*suppliers**, **\*suppliers_ignore_errors**, **\*suppliers_event_cost** which are used to influence the auth behavior on CGRateS side. More info on that can be found on the **SessionS** component's API behavior.
|
||||
|
||||
* **\*initiate**
|
||||
Initiates a session out of request on CGRateS side.
|
||||
@@ -367,17 +371,17 @@ flags
|
||||
* **\*update**
|
||||
Updates a session with the request on CGRateS side.
|
||||
|
||||
Auxiliary flags available: **\*attributes**, **\*accounts** which are used to influence the auth behavior on CGRateS side.
|
||||
Auxiliary flags available: **\*attributes**, **\*accounts** which are used to influence the behavior on CGRateS side.
|
||||
|
||||
* **\*terminate**
|
||||
Terminates a session using the request on CGRateS side.
|
||||
|
||||
Auxiliary flags available: **\*thresholds**, **\*stats**, **\*resources**, **\*accounts** which are used to influence the auth behavior on CGRateS side.
|
||||
Auxiliary flags available: **\*thresholds**, **\*stats**, **\*resources**, **\*accounts** which are used to influence the behavior on CGRateS side.
|
||||
|
||||
* **\*message**
|
||||
Process the request as individual message charging on CGRateS side.
|
||||
|
||||
Auxiliary flags available: **\*attributes**, **\*thresholds**, **\*stats**, **\*resources**, **\*accounts**, **\*suppliers**, **\*suppliers_ignore_errors**, **\*suppliers_event_cost** which are used to influence the auth behavior on CGRateS side.
|
||||
Auxiliary flags available: **\*attributes**, **\*thresholds**, **\*stats**, **\*resources**, **\*accounts**, **\*suppliers**, **\*suppliers_ignore_errors**, **\*suppliers_event_cost** which are used to influence the behavior on CGRateS side.
|
||||
|
||||
|
||||
* **\*event**
|
||||
@@ -392,15 +396,21 @@ flags
|
||||
path
|
||||
Defined within field, specifies the path where the value will be written. Possible values:
|
||||
|
||||
* **\*vars**
|
||||
Write the value in the special container, *\*vars*, available for the duration of the request.
|
||||
|
||||
* **\*cgreq**
|
||||
Write the value in the request object which will be sent to CGRateS side.
|
||||
|
||||
* **\*req**
|
||||
Write the value to request built by *DiameterAgent* to be sent out on *Diameter* side.
|
||||
* **\*cgrep**
|
||||
Write the value in the reply returned by CGRateS.
|
||||
|
||||
* **\*rep**
|
||||
Write the value to reply going out on *Diameter* side.
|
||||
|
||||
* **\*diamreq**
|
||||
Write the value to request built by *DiameterAgent* to be sent out on *Diameter* side.
|
||||
|
||||
type
|
||||
Defined within field, specifies the logic type to be used when writing the value of the field. Possible values:
|
||||
|
||||
|
||||
134
docs/ers.rst
134
docs/ers.rst
@@ -14,13 +14,13 @@ EventReaderService
|
||||
|
||||
**EventReaderService/ERs** is a subsystem designed to read events coming from external sources and convert them into internal ones. The converted events are then sent to other CGRateS subsystems, like *SessionS* where further processing logic is applied to them.
|
||||
|
||||
The translation between external and internal events is done based on field mapping, defined in :ref:`json configuration <engine_configuration>`.
|
||||
The translation between external and internal events is done based on field mapping, defined in :ref:`JSON configuration <configuration>`.
|
||||
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
The **EventReaderService** is configured within *ers* section from :ref:`JSON configuration <engine_configuration>`.
|
||||
The **EventReaderService** is configured within *ers* section from :ref:`JSON configuration <configuration>`.
|
||||
|
||||
|
||||
Sample config
|
||||
@@ -48,63 +48,63 @@ With explanations in the comments:
|
||||
"content_fields":[ // mapping definition between line index in the file and CGRateS field
|
||||
{
|
||||
"tag": "OriginID", // OriginID together with OriginHost will
|
||||
"path": "OriginID", // uniquely identify the session on CGRateS side
|
||||
"path": "*cgreq.OriginID", // uniquely identify the session on CGRateS side
|
||||
"type": "*variable",
|
||||
"value": "~*req.0",q // take the content from line index 0
|
||||
"mandatory": true // in the request file
|
||||
},
|
||||
{
|
||||
"tag": "RequestType", // RequestType instructs SessionS
|
||||
"path": "RequestType", // about charging type to apply for the event
|
||||
"path": "*cgreq.RequestType",// about charging type to apply for the event
|
||||
"type": "*variable",
|
||||
"value": "~*req.1",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "Category", // Category serves for ataching Account
|
||||
"path": "Category", // and RatingProfile to the request
|
||||
"path": "*cgreq.Category", // and RatingProfile to the request
|
||||
"type": "*constant",
|
||||
"value": "call",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "Account", // Account is required by charging
|
||||
"path": "Account",
|
||||
"path": "*cgreq.Account",
|
||||
"type": "*variable",
|
||||
"value": "~*req.3",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "Subject", // Subject is required by charging
|
||||
"path": "Subject",
|
||||
"path": "*cgreq.Subject",
|
||||
"type": "*variable",
|
||||
"value": "~*req.3",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "Destination", // Destination is required by charging
|
||||
"path": "Destination",
|
||||
"path": "*cgreq.Destination",
|
||||
"type": "*variable",
|
||||
"value": "~*req.4:s/0([1-9]\\d+)/+49${1}/",
|
||||
"mandatory": true // Additional mediation is performed on number format
|
||||
},
|
||||
{
|
||||
"tag": "AnswerTime", // AnswerTime is required by charging
|
||||
"path": "AnswerTime",
|
||||
"path": "*cgreq.AnswerTime",
|
||||
"type": "*variable",
|
||||
"value": "~*req.5",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "Usage", // Usage is required by charging
|
||||
"path": "Usage",
|
||||
"path": "*cgreq.Usage",
|
||||
"type": "*variable",
|
||||
"value": "~*req.6",
|
||||
"mandatory": true
|
||||
},
|
||||
{
|
||||
"tag": "HDRExtra1", // HDRExtra1 is transparently stored into CDR
|
||||
"path": "HDRExtra1", // as extra field not used by CGRateS
|
||||
"path": "*cgreq.HDRExtra1", // as extra field not used by CGRateS
|
||||
"type": "*composed",
|
||||
"value": "~*req.6",
|
||||
"mandatory": true
|
||||
@@ -118,7 +118,7 @@ With explanations in the comments:
|
||||
Config params
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
Most of the parameters are explained in :ref:`JSON configuration <engine_configuration>`, hence we mention here only the ones where additional info is necessary or there will be particular implementation for *EventReaderService*.
|
||||
Most of the parameters are explained in :ref:`JSON configuration <configuration>`, hence we mention here only the ones where additional info is necessary or there will be particular implementation for *EventReaderService*.
|
||||
|
||||
|
||||
readers
|
||||
@@ -173,7 +173,19 @@ timezone
|
||||
Defines the timezone for source content which does not carry that information. If undefined, default one from *general* section will be used.
|
||||
|
||||
filters
|
||||
List of filters to pass for the reader to process the event. In case of file content without field name, the index will be passed instead of field source path.
|
||||
List of filters to pass for the reader to process the event. For the dynamic content (prefixed with *~*) following special variables are available:
|
||||
|
||||
* **\*vars**
|
||||
Request related shared variables between processors, populated especially by core functions. The data put inthere is not automatically transfered into requests sent to CGRateS, unless instructed inside templates.
|
||||
|
||||
* **\*req**
|
||||
Request read from the source. In case of file content without field name, the index will be passed instead of field source path.
|
||||
|
||||
* **\*hdr**
|
||||
Header values (available only in case of *\*file_fwv*). In case of file content without field name, the index will be passed instead of field source path.
|
||||
|
||||
* **\*trl**
|
||||
Trailer values (available only in case of *\*file_fwv*). In case of file content without field name, the index will be passed instead of field source path.
|
||||
|
||||
flags
|
||||
Special tags enforcing the actions/verbs done on an event. There are two types of flags: **main** and **auxiliary**.
|
||||
@@ -184,11 +196,101 @@ flags
|
||||
|
||||
The **auxiliary** flags only make sense in combination with **main** ones.
|
||||
|
||||
Implemented flags are (in order of priority, and not working simultaneously unless specified):
|
||||
Implemented **main** flags are (in order of priority, and not working simultaneously unless specified):
|
||||
|
||||
* **\*log**
|
||||
Logs the Event read. Can be used together with other *main* flags.
|
||||
|
||||
**\*none**
|
||||
Disable transfering the request from *Reader* to *CGRateS* side.
|
||||
|
||||
Disable transfering the Event from *Reader* to *CGRateS* side.
|
||||
|
||||
* **\*dryrun**
|
||||
Together with not transfering the Event on CGRateS side will also log it, useful for troubleshooting.
|
||||
|
||||
* **\*auth**
|
||||
Sends the Event for authorization on CGRateS.
|
||||
|
||||
Auxiliary flags available: **\*attributes**, **\*thresholds**, **\*stats**, **\*resources**, **\*accounts**, **\*suppliers**, **\*suppliers_ignore_errors**, **\*suppliers_event_cost** which are used to influence the auth behavior on CGRateS side. More info on that can be found on the **SessionS** component's API behavior.
|
||||
|
||||
* **\*initiate**
|
||||
Initiates a session out of Event on CGRateS side.
|
||||
|
||||
Auxiliary flags available: **\*attributes**, **\*thresholds**, **\*stats**, **\*resources**, **\*accounts** which are used to influence the behavior on CGRateS side.
|
||||
|
||||
* **\*update**
|
||||
Updates a session with the Event on CGRateS side.
|
||||
|
||||
Auxiliary flags available: **\*attributes**, **\*accounts** which are used to influence the behavior on CGRateS side.
|
||||
|
||||
* **\*terminate**
|
||||
Terminates a session using the Event on CGRateS side.
|
||||
|
||||
Auxiliary flags available: **\*thresholds**, **\*stats**, **\*resources**, **\*accounts** which are used to influence the behavior on CGRateS side.
|
||||
|
||||
* **\*message**
|
||||
Process the Event as individual message charging on CGRateS side.
|
||||
|
||||
Auxiliary flags available: **\*attributes**, **\*thresholds**, **\*stats**, **\*resources**, **\*accounts**, **\*suppliers**, **\*suppliers_ignore_errors**, **\*suppliers_event_cost** which are used to influence the behavior on CGRateS side.
|
||||
|
||||
* **\*event**
|
||||
Process the Event as generic event on CGRateS side.
|
||||
|
||||
Auxiliary flags available: all flags supported by the "SessionSv1.ProcessEvent" generic API
|
||||
|
||||
* **\*cdrs**
|
||||
Build a CDR out of the Event on CGRateS side. Can be used simultaneously with other flags (except *\*dry_run)
|
||||
|
||||
path
|
||||
Defined within field, specifies the path where the value will be written. Possible values:
|
||||
|
||||
* **\*vars**
|
||||
Write the value in the special container, *\*vars*, available for the duration of the request.
|
||||
|
||||
* **\*cgreq**
|
||||
Write the value in the request object which will be sent to CGRateS side.
|
||||
|
||||
* **\*hdr**
|
||||
Header values (available only in case of *\*file_fwv*). In case of file content without field name, the index will be passed instead of field source path.
|
||||
|
||||
* **\*trl**
|
||||
Trailer values (available only in case of *\*file_fwv*). In case of file content without field name, the index will be passed instead of field source path.
|
||||
|
||||
|
||||
type
|
||||
Defined within field, specifies the logic type to be used when writing the value of the field. Possible values:
|
||||
|
||||
* **\*none**
|
||||
Pass
|
||||
|
||||
* **\*filler**
|
||||
Fills the values with an empty string
|
||||
|
||||
* **\*constant**
|
||||
Writes out a constant
|
||||
|
||||
* **\*remote_host**
|
||||
Writes out the Address of the remote host sending us the Event
|
||||
|
||||
* **\*variable**
|
||||
Writes out the variable value, overwriting previous one set
|
||||
|
||||
* **\*composed**
|
||||
Writes out the variable value, postpending to previous value set
|
||||
|
||||
* **\*usage_difference**
|
||||
Calculates the usage difference between two arguments passed in the *value*. Requires 2 arguments: *$stopTime;$startTime*
|
||||
|
||||
* **\*sum**
|
||||
Calculates the sum of all arguments passed within *value*. It supports summing up duration, time, float, int autodetecting them in this order.
|
||||
|
||||
* **\*difference**
|
||||
Calculates the difference between all arguments passed within *value*. Possible value types are (in this order): duration, time, float, int.
|
||||
|
||||
* **\*value_exponent**
|
||||
Calculates the exponent of a value. It requires two values: *$val;$exp*
|
||||
|
||||
* **\*template**
|
||||
Specifies a template of fields to be injected here. Value should be one of the template ids defined.
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 94 KiB |
@@ -24,7 +24,7 @@ Overview
|
||||
|
||||
Starting as a pure **billing engine**, CGRateS has evolved over the years into a reliable **real-time charging framework**, able to accommodate various business cases in a *generic way*.
|
||||
|
||||
Being an *"engine style"* the project focuses on providing best ratio between **functionality** (over 15 daemons/services implemented with a rich number of `features <cgrates_features>`_ and a development team agile in developing new ones) and **performance** (dedicated benchmark tool, asynchronous request processing, own transactional cache component), however not losing focus of **quality** (test driven development policy).
|
||||
Being an *"engine style"* the project focuses on providing best ratio between **functionality** (over 15 daemons/services implemented with a rich number of `features <cgrates-features>`_ and a development team agile in implementing new ones) and **performance** (dedicated benchmark tool, asynchronous request processing, own transactional cache component), however not losing focus of **quality** (test driven development policy).
|
||||
|
||||
It is written in `Go`_ programming language and accessible from any programming language via JSON RPC.
|
||||
The code is well documented (**go doc** compliant `API docs`_) and heavily tested (**5k+** tests are part of the unit test suite).
|
||||
@@ -39,6 +39,7 @@ Modular and flexible, CGRateS provides APIs over a variety of simultaneously acc
|
||||
- **JSON over Websockets** : useful where 2 ways interaction over same TCP socket is required
|
||||
- **GOB over TCP** : slightly faster than JSON one but only accessible for the moment out of Go (`<https://golang.org/>`_).
|
||||
|
||||
.. _charging-modes:
|
||||
|
||||
CGRateS is capable of four charging modes:
|
||||
|
||||
@@ -67,7 +68,7 @@ CGRateS is capable of four charging modes:
|
||||
- Least CPU usage out of the four modes (fastest charging).
|
||||
|
||||
|
||||
.. _cgrates_features:
|
||||
.. _cgrates-features:
|
||||
|
||||
Features
|
||||
--------
|
||||
@@ -196,4 +197,4 @@ Links
|
||||
License
|
||||
-------
|
||||
|
||||
`CGRateS`_ is released under the terms of the `[GNU GENERAL PUBLIC LICENSE Version 3] <http://www.gnu.org/licenses/gpl-3.0.en.html>`_. See **LICENSE.txt** file for details.
|
||||
`CGRateS`_ is released under the terms of the `[GNU GENERAL PUBLIC LICENSE Version 3] <http://www.gnu.org/licenses/gpl-3.0.en.html>`_.
|
||||
Reference in New Issue
Block a user