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 <[email protected]>
Committer: Carlos Ruiz Diaz <[email protected]>
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);


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to