From 6729593b13cb4ce708cbd900c25c78881d255552 Mon Sep 17 00:00:00 2001
From: Anthony Minessale <anthm@freeswitch.org>
Date: Wed, 4 Sep 2013 21:00:26 +0500
Subject: [PATCH] FS-5605 --resolve

---
 src/mod/applications/mod_fifo/mod_fifo.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c
index 8081711c12..a2496a193c 100644
--- a/src/mod/applications/mod_fifo/mod_fifo.c
+++ b/src/mod/applications/mod_fifo/mod_fifo.c
@@ -1689,6 +1689,9 @@ static void *SWITCH_THREAD_FUNC o_thread_run(switch_thread_t *thread, void *obj)
 	switch_channel_set_state(channel, CS_EXECUTE);
 	switch_core_session_rwunlock(session);
 
+	sql = switch_mprintf("update fifo_outbound set ring_count=ring_count-1 where uuid='%q' and ring_count > 0", h->uuid);
+	fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_TRUE);
+
   end:
 
 	switch_event_destroy(&ovars);