[sr-dev] git:master: cnxcc: Added credit vs cost per second check *before* starting the call

Carlos Ruiz Diaz carlos.ruizdiaz at gmail.com
Mon May 12 05:10:41 CEST 2014


Module: sip-router
Branch: master
Commit: 5ab17c022b5bab6dfd3749dee71961cad14cbe83
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5ab17c022b5bab6dfd3749dee71961cad14cbe83

Author: Carlos Ruiz Diaz <carlos.ruizdiaz at gmail.com>
Committer: Carlos Ruiz Diaz <carlos.ruizdiaz at gmail.com>
Date:   Sun May 11 22:08:43 2014 -0500

cnxcc: Added credit vs cost per second check *before* starting the call

---

 modules/cnxcc/cnxcc_mod.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/modules/cnxcc/cnxcc_mod.c b/modules/cnxcc/cnxcc_mod.c
index 22330cc..bad2f84 100644
--- a/modules/cnxcc/cnxcc_mod.c
+++ b/modules/cnxcc/cnxcc_mod.c
@@ -1460,6 +1460,11 @@ static int set_max_credit(struct sip_msg* msg,
 			return -1;
 		}
 
+		if (credit < cost_per_second) {
+			LM_ERR("Not enough credit to start the call: credit=[%f] < cost_per_sec=[%f]", credit, cost_per_second);
+			return -1;
+		}
+
 		if (client_id_val.rs.len == 0 || client_id_val.rs.s == NULL)
 		{
 			LM_ERR("[%.*s]: client ID cannot be null\n", msg->callid->body.len, msg->callid->body.s);




More information about the sr-dev mailing list