From 9e8848e3d5930d77defe34074c1d0221464db3ad Mon Sep 17 00:00:00 2001 From: Mathieu Rene Date: Fri, 11 Sep 2009 16:10:29 +0000 Subject: [PATCH] MODAPP-334 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14830 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/applications/mod_limit/mod_limit.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mod/applications/mod_limit/mod_limit.c b/src/mod/applications/mod_limit/mod_limit.c index d1ca87cfa8..f7bbf5473a 100644 --- a/src/mod/applications/mod_limit/mod_limit.c +++ b/src/mod/applications/mod_limit/mod_limit.c @@ -36,6 +36,7 @@ #include #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);