]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
MODAPP-334
authorMathieu Rene <mrene@avgs.ca>
Fri, 11 Sep 2009 16:10:29 +0000 (16:10 +0000)
committerMathieu Rene <mrene@avgs.ca>
Fri, 11 Sep 2009 16:10:29 +0000 (16:10 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14830 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_limit/mod_limit.c

index d1ca87cfa89dfd77897895a6f26490cd6d2b1c72..f7bbf5473a2b19043c6438ea17227654ae7dce75 100644 (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);