MODAPP-334

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14830 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Mathieu Rene 2009-09-11 16:10:29 +00:00
parent a75c525dcc
commit 9e8848e3d5
1 changed files with 8 additions and 3 deletions

View File

@ -36,6 +36,7 @@
#include <switch.h>
#define LIMIT_EVENT_USAGE "limit::usage"
#define LIMIT_IGNORE_TRANSFER_VARIABLE "limit_ignore_transfer"
SWITCH_MODULE_LOAD_FUNCTION(mod_limit_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_limit_shutdown);
@ -304,8 +305,9 @@ static switch_status_t db_state_handler(switch_core_session_t *session)
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_channel_state_t state = switch_channel_get_state(channel);
char *sql = NULL;
const char *vval = switch_channel_get_variable(channel, LIMIT_IGNORE_TRANSFER_VARIABLE);
if (state >= CS_HANGUP || state == CS_ROUTING) {
if (state >= CS_HANGUP || (state == CS_ROUTING && !switch_true(vval))) {
sql = switch_mprintf("delete from limit_data where uuid='%q';",
switch_core_session_get_uuid(session));
limit_execute_sql(sql, globals.mutex);
@ -322,9 +324,10 @@ static switch_status_t hash_state_handler(switch_core_session_t *session)
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_channel_state_t state = switch_channel_get_state(channel);
limit_hash_private_t *pvt = switch_channel_get_private(channel, "limit_hash");
const char *vval = switch_channel_get_variable(channel, LIMIT_IGNORE_TRANSFER_VARIABLE);
/* The call is either hung up, or is going back into the dialplan, decrement appropriate couters */
if (state >= CS_HANGUP || state == CS_ROUTING) {
if (state >= CS_HANGUP || (state == CS_ROUTING && !switch_true(vval))) {
switch_hash_index_t *hi;
switch_mutex_lock(globals.limit_hash_mutex);
@ -374,12 +377,14 @@ static switch_status_t memcache_state_handler(switch_core_session_t *session)
uint32_t total_usage = 0;
char *cmd = NULL;
switch_stream_handle_t stream = { 0 };
const char *vval = switch_channel_get_variable(channel, LIMIT_IGNORE_TRANSFER_VARIABLE);
SWITCH_STANDARD_STREAM(stream);
switch_assert(pvt);
/* The call is either hung up, or is going back into the dialplan, decrement appropriate couters */
if (state >= CS_HANGUP || state == CS_ROUTING) {
if (state >= CS_HANGUP || (state == CS_ROUTING && !switch_true(vval))) {
/* Loop through the channel's keys which contains mapping to all the limits referenced by that channel */
mydata = switch_core_session_strdup(session, pvt);