diff --git a/src/modules/cnxcc/cnxcc_mod.c b/src/modules/cnxcc/cnxcc_mod.c index 55d9bf00a13..82bcb9e0168 100644 --- a/src/modules/cnxcc/cnxcc_mod.c +++ b/src/modules/cnxcc/cnxcc_mod.c @@ -1578,6 +1578,7 @@ static int ki_set_max_credit(sip_msg_t *msg, str *sclient, str *scredit, { credit_data_t *credit_data = NULL; call_t *call = NULL; + hash_tables_t *hts = NULL; double credit = 0, connect_cost = 0, cost_per_second = 0; @@ -1619,6 +1620,12 @@ static int ki_set_max_credit(sip_msg_t *msg, str *sclient, str *scredit, return -1; } + if(try_get_call_entry(&msg->callid->body, &call, &hts) == 0) { + LM_ERR("call-id[%.*s] already present\n", + msg->callid->body.len, msg->callid->body.s); + return -4; + } + LM_DBG("Setting up new call for client [%.*s], max-credit[%f], " "connect-cost[%f], cost-per-sec[%f], initial-pulse [%d], " "final-pulse [%d], call-id[%.*s]\n", @@ -1796,6 +1803,7 @@ static int ki_set_max_channels(sip_msg_t *msg, str *sclient, int max_chan) { credit_data_t *credit_data = NULL; call_t *call = NULL; + hash_tables_t *hts = NULL; if(parse_headers(msg, HDR_CALLID_F, 0) != 0) { LM_ERR("Error parsing Call-ID"); @@ -1826,6 +1834,12 @@ static int ki_set_max_channels(sip_msg_t *msg, str *sclient, int max_chan) return -1; } + if(try_get_call_entry(&msg->callid->body, &call, &hts) == 0) { + LM_ERR("call-id[%.*s] already present\n", + msg->callid->body.len, msg->callid->body.s); + return -4; + } + LM_DBG("Setting up new call for client [%.*s], max-chan[%d], " "call-id[%.*s]\n", sclient->len, sclient->s, max_chan, msg->callid->body.len, @@ -1882,6 +1896,7 @@ static int ki_set_max_time(sip_msg_t *msg, str *sclient, int max_secs) { credit_data_t *credit_data = NULL; call_t *call = NULL; + hash_tables_t *hts = NULL; if(parse_headers(msg, HDR_CALLID_F, 0) != 0) { LM_ERR("Error parsing Call-ID"); @@ -1913,6 +1928,12 @@ static int ki_set_max_time(sip_msg_t *msg, str *sclient, int max_secs) return -1; } + if(try_get_call_entry(&msg->callid->body, &call, &hts) == 0) { + LM_ERR("call-id[%.*s] already present\n", + msg->callid->body.len, msg->callid->body.s); + return -4; + } + LM_DBG("Setting up new call for client [%.*s], max-secs[%d], " "call-id[%.*s]\n", sclient->len, sclient->s, max_secs, msg->callid->body.len, diff --git a/src/modules/cnxcc/doc/cnxcc.xml b/src/modules/cnxcc/doc/cnxcc.xml index 686583f471f..3fc10feb8d5 100644 --- a/src/modules/cnxcc/doc/cnxcc.xml +++ b/src/modules/cnxcc/doc/cnxcc.xml @@ -23,15 +23,6 @@ carlos.ruizdiaz@gmail.com - - Jose Luis - Verdeguer - verdeguer@zoonsuite.com - Zoon Suite -
- verdeguer@zoonsuite.com -
-
2013 @@ -41,10 +32,6 @@ 2014 Carlos Ruiz Díaz, carlos@latamvoices.com - - 2018 - Jose Luis Verdeguer - diff --git a/src/modules/cnxcc/doc/cnxcc_admin.xml b/src/modules/cnxcc/doc/cnxcc_admin.xml index 0c26cb0a581..dbc4bf20b14 100644 --- a/src/modules/cnxcc/doc/cnxcc_admin.xml +++ b/src/modules/cnxcc/doc/cnxcc_admin.xml @@ -177,7 +177,7 @@ modparam("cnxcc", "credit_check_period", 1) - -2 - failed, credit value is less than initial pulse value + -4 - call-id already present for this client @@ -345,6 +345,12 @@ if (!cnxcc_update_max_time("$var(client)", "$var(update_time)")) { + + + -4 - call-id already present for this client + + + @@ -543,14 +549,21 @@ route[CNXCC] $var(i_pulse) = 30; $var(f_pulse) = 6; - if (!cnxcc_set_max_credit("$var(client)", + + cnxcc_set_max_credit("$var(client)", "$var(credit)", "$var(connect_cost)", "$var(cost_per_sec)", "$var(i_pulse)", - "$var(f_pulse)")) { - xlog("Error setting up credit control"); - } + "$var(f_pulse)"); + + switch ($?) { + case -1: + xerr("Error setting up credit control"); + sl_send_reply("503", "Internal Server Error"); + case -4: + xwarn("$ci already present for client $var(client)"); + }; } event_route[cnxcc:call-shutdown]