<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hey Guys,<br>
<br>
We have completed these days the integration between OpenSIPS and
CGRateS.<br>
<br>
I would like to ask your opinion on the approach we took, maybe you
can find lacks or ways to improve.<br>
<br>
General concepts:<br>
<br>
* We use 2 modules in OpenSIPS: event_datagram to generate packets
from OpenSIPS -> CGRateS and mi_datagram to generate packets from
CGRateS -> OpenSIPS.<br>
* 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.<br>
* On OpenSIPS start/restart we have configured a special event,
which will be sent to CGRateS and will reset the subscription loop.<br>
* 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).<br>
* For feeding data back and process it in the script we use
cache_local with keys prefixed by callid+fromtag.<br>
* 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.<br>
<br>
About call flow:<br>
<br>
* 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.<br>
* 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).<br>
<br>
The whole setup works fine for us and we will be able to demo it on
Monday at OpenSIPS Summit in Chicago.<br>
<br>
The basic configuration we have used in our tests is here:<br>
<a class="moz-txt-link-freetext" href="https://github.com/cgrates/cgrates/blob/master/data/opensips/etc/opensips/opensips.cfg">https://github.com/cgrates/cgrates/blob/master/data/opensips/etc/opensips/opensips.cfg</a><br>
<br>
Would be interested to hear your feedback!<br>
<br>
Thanks,<br>
DanB<br>
<span style="color: rgb(51, 51, 51); font-family: Consolas,
'Liberation Mono', Menlo, Courier, monospace; font-size:
12.222222328186035px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height: 18px;
orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: pre; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255); display: inline !important;
float: none;"></span>
</body>
</html>