[sr-dev] cnxcc module config example?

Daniel-Constantin Mierla miconda at gmail.com
Thu Dec 3 20:26:55 CET 2015


Iirc, Carlos (the author of the cnxcc module) had a
presentation/workshop at one of the Kamailio World editions. Not time to
see if there is a video recording uploaded on youtube (check Kamailio
World channel).

Also, slides could be at kamailio.org/events/

Cheers,
Daniel

On 03/12/15 13:12, Peter Villeneuve wrote:
> Bump. Anyone?
>
> On Wed, Dec 2, 2015 at 11:53 AM, Peter Villeneuve <petervnv1 at gmail.com
> <mailto:petervnv1 at gmail.com>> wrote:
>
>     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
>
>
>
>
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Book: SIP Routing With Kamailio - http://www.asipto.com
http://miconda.eu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20151203/b1143464/attachment-0001.html>


More information about the sr-dev mailing list