Răsfoiți Sursa

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

Carlos Ruiz Diaz 11 ani în urmă
părinte
comite
5ab17c022b
1 a modificat fișierele cu 5 adăugiri și 0 ștergeri
  1. 5 0
      modules/cnxcc/cnxcc_mod.c

+ 5 - 0
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);