]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
lower token freq to 5, put it in a define and have more obvious warning about full...
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 26 Oct 2011 17:57:54 +0000 (12:57 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 26 Oct 2011 17:57:59 +0000 (12:57 -0500)
src/mod/applications/mod_valet_parking/mod_valet_parking.c
src/switch_ivr_play_say.c

index 1cea589127707c0d3a355ecd9d220a10cba815ff..8b5db58962dacc1a1405573c50b4eb2989ff6f66 100644 (file)
@@ -31,7 +31,7 @@
 #include <switch.h>
 #define VALET_EVENT "valet_parking::info"
 #define VALET_PROTO "park"
-
+#define TOKEN_FREQ 5
 
 /* Prototypes */
 SWITCH_MODULE_LOAD_FUNCTION(mod_valet_parking_load);
@@ -112,7 +112,7 @@ static void check_timeouts(void)
        now = switch_epoch_time_now(NULL);
 
        switch_mutex_lock(globals.mutex);
-       if (now - globals.last_timeout_check < 30) {
+       if (now - globals.last_timeout_check < TOKEN_FREQ) {
                switch_mutex_unlock(globals.mutex);
                return;
        }
@@ -137,6 +137,7 @@ static void check_timeouts(void)
                                switch_hash_this(i_hi, &i_var, NULL, &i_val);
                                i_ext = (char *) i_var;
                                token = (valet_token_t *) i_val;
+
                                if (token->timeout > 0 && (token->timeout < now || token->timeout == 1)) {
                                        switch_core_hash_delete(lot->hash, i_ext);
                                        switch_safe_free(token);
@@ -393,6 +394,7 @@ SWITCH_STANDARD_APP(valet_parking_function)
 
                        if (!(token = next_id(session, lot, min_i, max_i, in))) {
                                switch_ivr_phrase_macro(session, in ? "valet_lot_full" : "valet_lot_empty", "", NULL, NULL);
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s lot is %s.\n", switch_channel_get_name(channel), in ? "full" : "empty");
                                return;
                        }
 
@@ -520,7 +522,7 @@ SWITCH_STANDARD_APP(valet_parking_function)
                                switch_core_session_t *b_session;
 
                                if ((b_session = switch_core_session_locate(uuid))) {
-                                       token->timeout = switch_epoch_time_now(NULL) + 10;              
+                                       token->timeout = switch_epoch_time_now(NULL) + TOKEN_FREQ;              
                                        if (play_announce) {
                                                switch_ivr_sleep(session, 1500, SWITCH_TRUE, NULL);
                                                switch_ivr_phrase_macro(session, "valet_announce_ext", tmp, NULL, NULL);
@@ -554,8 +556,6 @@ SWITCH_STANDARD_APP(valet_parking_function)
                args.buf = dbuf;
                args.buflen = sizeof(dbuf);
 
-
-               
                while(switch_channel_ready(channel)) {
                        switch_status_t pstatus = switch_ivr_play_file(session, NULL, music, &args);
                        if (pstatus == SWITCH_STATUS_BREAK || pstatus == SWITCH_STATUS_TIMEOUT) {
index f3d554faeba435e17ae3da25f08da673d3386e2a..5a1702ec6d998361e44935ef275c610af21ec508 100644 (file)
@@ -1669,7 +1669,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
                        }
                }
 
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "done playing file\n");
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "done playing file %s\n", file);
 
                if (read_impl.samples_per_second) {
                        switch_channel_set_variable_printf(channel, "playback_seconds", "%d", fh->samples_in / read_impl.samples_per_second);