[OpenSIPS-Users] OpenSIPS-CGRateS Integration
Dan Christian Bogos
danb.lists at gmail.com
Thu Jul 31 11:44:03 CEST 2014
We have completed these days the integration between OpenSIPS and CGRateS.
I would like to ask your opinion on the approach we took, maybe you can
find lacks or ways to improve.
* We use 2 modules in OpenSIPS: event_datagram to generate packets
from OpenSIPS -> CGRateS and mi_datagram to generate packets from
CGRateS -> OpenSIPS.
* In order to detect OpenSIPS being up, we dynamically subscribe
events handled by CGRateS every x interval (configurable to nanoseconds
if required). On subscriptions not replied after a configurable number
of attempts, we shut down CGRateS SM component.
* On OpenSIPS start/restart we have configured a special event, which
will be sent to CGRateS and will reset the subscription loop.
* We make use of 2 events: E_CGR_AUTHORIZE (custom made using
raise_event, serving the purpose of authorizing the INVITEs considering
credit control) and E_ACC_CDR (which will generate CDR and process it
further in CGRateS for storing/charging purposes).
* For feeding data back and process it in the script we use
cache_local with keys prefixed by callid+fromtag.
* We are able to handle 3 different charging modes out of 4 supported
by CGRateS: pseudoprepaid (prepaid out of CDRs), postpaid (keeping the
account balances), rated (rate CDRs only, not involving accounting
subsystem/balances). Full prepaid support (with debit loops) is planned
in the near future and maybe there we can agree about the best approach.
About call flow:
* On INVITE, for pseudoprepaid/prepaid accounts, we will raise the
E_CGR_AUTHORIZE event and process it inside CGRateS. On insufficient
balance or controller errors, we will set a variable
(accid+fromtag+cgr_notify) inside cache_local. We block the INVITE in
the script using while+usleep function until we are able to read an
answer or timeout. In case of no errors, we will set the $DLG_timeout
variable to the accid+fromtag+cgr_maxdur value received from CGRateS
again via local cache.
* On call completion/BYE an automated E_ACC_CDR is being raised by
OpenSIPS and due to our automatic subscriptions this will reach CGRateS
SessionManager which will process it (store, rate, debit balances in
case of pseudoprepaid/postpaid accounts).
The whole setup works fine for us and we will be able to demo it on
Monday at OpenSIPS Summit in Chicago.
The basic configuration we have used in our tests is here:
Would be interested to hear your feedback!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Users