[sr-dev] cnxcc module config example?

Peter Villeneuve petervnv1 at gmail.com
Wed Dec 2 12:53:54 CET 2015


Hi all,

I'm looking into different prepaid modules to work with kamailio for a
simple closed network setup (ie no outbound calls, internal calls only).

I have looked into the cnxcc module which I believe should work nicely with
this setup but I am confused regarding its connection to a db to lookup
credits for each user, max call time, etc.

I see in the module configs that it connects to a redis db on localhost,
but then I also see hardcoded variables in the example config as seen below.

I know the example hardcoded variables are for illustrative purposes only,
but then what is the redis connection there for?

Ideally I'd like to use MySQL to store the cnxcc variables since I already
use it for AUTH and registration purpose since I have the client's auth
info in there  and am already using Siremis to intercat with the DB.

Is this possible or am I going about this the wrong way?

Anyone have a cnxcc config they could share that grabs those values from
MySQL?

Cheers,
Peter


Here's the relevant snippet from cnxcc.cfg with the hardcoded variables:

route[CNXCC]{ # # In real life scenarios, all the authorization values #
are retrieved from a database and calculed on-the-fly. # # This hardcoded
values are just for illustrative purposes # $var(client) = "customer1"; #!ifdef
CNXCC_MONEY xlog("L_INFO", "Setting up money based credit control");
$var(credit)
= "10"; # 10$ of credit $var(cost_per_sec) = "1"; # 1$ per sec
$var(i_pulse) = "1"; # 1$ to establish the call $var(f_pulse) = "1"; # 1$
per second # if only one call is established, that call should last 9
seconds. if (!cnxcc_set_max_credit("$var(client)", "$var(credit)", "
$var(cost_per_sec)", "$var(i_pulse)", "$var(f_pulse)")) { xlog("Error
setting up credit control"); sl_reply_error(); exit; }#!endif
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20151202/037ed19d/attachment.html>


More information about the sr-dev mailing list