]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-4867 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Mon, 26 Nov 2012 19:52:06 +0000 (13:52 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Mon, 26 Nov 2012 19:52:06 +0000 (13:52 -0600)
src/include/switch_channel.h
src/switch_channel.c
src/switch_core_io.c

index cd8cbb47f0bc21d3acd8a076b808e7e14ec32118..4225a9bd88ebc26d367a367a8ce8194e34c90653 100644 (file)
@@ -541,6 +541,10 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_chan
   \return number of digits in the queue
 */
 SWITCH_DECLARE(switch_size_t) switch_channel_has_dtmf(_In_ switch_channel_t *channel);
+SWITCH_DECLARE(switch_status_t) switch_channel_dtmf_lock(switch_channel_t *channel); 
+SWITCH_DECLARE(switch_status_t) switch_channel_try_dtmf_lock(switch_channel_t *channel);
+SWITCH_DECLARE(switch_status_t) switch_channel_dtmf_unlock(switch_channel_t *channel); 
+
 
 /*!
   \brief Queue DTMF on a given channel
index 5fa30564d2def07082223c5050b6975caa3a73ab..903bb6be76bacc6ae3ab7b9bd1b4eda1f840818b 100644 (file)
@@ -363,6 +363,21 @@ SWITCH_DECLARE(switch_status_t) switch_channel_alloc(switch_channel_t **channel,
        return SWITCH_STATUS_SUCCESS;
 }
 
+SWITCH_DECLARE(switch_status_t) switch_channel_dtmf_lock(switch_channel_t *channel) 
+{
+       return switch_mutex_lock(channel->dtmf_mutex);
+}
+
+SWITCH_DECLARE(switch_status_t) switch_channel_try_dtmf_lock(switch_channel_t *channel) 
+{
+       return switch_mutex_trylock(channel->dtmf_mutex);
+}
+
+SWITCH_DECLARE(switch_status_t) switch_channel_dtmf_unlock(switch_channel_t *channel) 
+{
+       return switch_mutex_unlock(channel->dtmf_mutex);
+}
+
 SWITCH_DECLARE(switch_size_t) switch_channel_has_dtmf(switch_channel_t *channel)
 {
        switch_size_t has;
index ba4874d81fd965cfd783760209a583eff410959b..8e99fcd47202505ff1f89359c6a19281b22affbb 100644 (file)
@@ -151,7 +151,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
        
        for(i = 0; i < 2; i++) {
                if (session->dmachine[i] && !switch_channel_test_flag(session->channel, CF_BROADCAST)) {
-                       switch_ivr_dmachine_ping(session->dmachine[i], NULL);
+                       if (switch_channel_try_dtmf_lock(session->channel) == SWITCH_STATUS_SUCCESS) {
+                               switch_ivr_dmachine_ping(session->dmachine[i], NULL);
+                               switch_channel_dtmf_unlock(session->channel);
+                       }
                }
        }