diff -urN asterisk-10.5.1.orig/bridges/bridge_softmix.c asterisk-10.5.1/bridges/bridge_softmix.c
--- asterisk-10.5.1.orig/bridges/bridge_softmix.c	2011-07-14 13:25:31.000000000 -0700
+++ asterisk-10.5.1/bridges/bridge_softmix.c	2012-06-22 11:31:56.242758847 -0700
@@ -298,6 +298,7 @@
 {
 	struct softmix_bridge_data *softmix_data = obj;
 	ast_timer_close(softmix_data->timer);
+	softmix_data->timer = NULL;
 }
 
 /*! \brief Function called when a bridge is created */
@@ -882,7 +883,10 @@
 		softmix_translate_helper_cleanup(&trans_helper);
 		/* Wait for the timing source to tell us to wake up and get things done */
 		ast_waitfor_n_fd(&timingfd, 1, &timeout, NULL);
-		ast_timer_ack(timer, 1);
+		if(ast_timer_ack(timer, 1) < 0) {
+			ast_log(LOG_ERROR, "Conference mixing error, timer failure.\n");
+			goto softmix_cleanup;
+		}
 		ao2_lock(bridge);
 
 		/* make sure to detect mixing interval changes if they occur. */
diff -urN asterisk-10.5.1.orig/channels/chan_iax2.c asterisk-10.5.1/channels/chan_iax2.c
--- asterisk-10.5.1.orig/channels/chan_iax2.c	2012-05-30 07:24:20.000000000 -0700
+++ asterisk-10.5.1/channels/chan_iax2.c	2012-06-22 11:33:55.511287445 -0700
@@ -9277,7 +9277,9 @@
 		ast_verbose("Beginning trunk processing. Trunk queue ceiling is %d bytes per host\n", trunkmaxsize);
 
 	if (timer) { 
-		ast_timer_ack(timer, 1);
+		if(ast_timer_ack(timer, 1) < 0) {
+			ast_log(LOG_ERROR,"Timer failed acknowledge\n");
+		}
 	}
 
 	/* For each peer that supports trunking... */
@@ -14512,6 +14514,7 @@
 	ao2_ref(callno_pool_trunk, -1);
 	if (timer) {
 		ast_timer_close(timer);
+		timer = NULL;
 	}
 	transmit_processor = ast_taskprocessor_unreference(transmit_processor);
 	ast_sched_context_destroy(sched);
@@ -14888,6 +14891,7 @@
 	if (set_config(config, 0) == -1) {
 		if (timer) {
 			ast_timer_close(timer);
+			timer = NULL;
 		}
 		return AST_MODULE_LOAD_DECLINE;
 	}
diff -urN asterisk-10.5.1.orig/funcs/func_jitterbuffer.c asterisk-10.5.1/funcs/func_jitterbuffer.c
--- asterisk-10.5.1.orig/funcs/func_jitterbuffer.c	2011-10-14 11:23:19.000000000 -0700
+++ asterisk-10.5.1/funcs/func_jitterbuffer.c	2012-06-22 11:29:22.563231882 -0700
@@ -219,7 +219,10 @@
 	}
 
 	if (chan->fdno == AST_JITTERBUFFER_FD && framedata->timer) {
-		ast_timer_ack(framedata->timer, 1);
+		if(ast_timer_ack(framedata->timer, 1) < 0) {
+			ast_log(LOG_ERROR, "Timer failure in jitter buffer\n");
+			return frame;	
+		}
 	}
 
 	if (!frame) {
diff -urN asterisk-10.5.1.orig/include/asterisk/timing.h asterisk-10.5.1/include/asterisk/timing.h
--- asterisk-10.5.1.orig/include/asterisk/timing.h	2010-11-08 14:03:54.000000000 -0800
+++ asterisk-10.5.1/include/asterisk/timing.h	2012-06-21 14:05:31.791391359 -0700
@@ -74,7 +74,7 @@
 	int (*timer_open)(void);
 	void (*timer_close)(int handle);
 	int (*timer_set_rate)(int handle, unsigned int rate);
-	void (*timer_ack)(int handle, unsigned int quantity);
+	int (*timer_ack)(int handle, unsigned int quantity);
 	int (*timer_enable_continuous)(int handle);
 	int (*timer_disable_continuous)(int handle);
 	enum ast_timer_event (*timer_get_event)(int handle);
@@ -163,10 +163,11 @@
  * \note This function should only be called if timer_get_event()
  *       returned AST_TIMING_EVENT_EXPIRED.
  *
- * \return nothing
- * \since 1.6.1
+ * \retval -1 failure, with errno set
+ * \retval 0 success
+ * \since 10.5.2
  */
-void ast_timer_ack(const struct ast_timer *handle, unsigned int quantity);
+int ast_timer_ack(const struct ast_timer *handle, unsigned int quantity);
 
 /*!
  * \brief Enable continuous mode
diff -urN asterisk-10.5.1.orig/main/channel.c asterisk-10.5.1/main/channel.c
--- asterisk-10.5.1.orig/main/channel.c	2012-04-04 09:38:12.000000000 -0700
+++ asterisk-10.5.1/main/channel.c	2012-06-22 11:28:43.408371547 -0700
@@ -2462,6 +2462,7 @@
 		close(fd);
 	if (chan->timer) {
 		ast_timer_close(chan->timer);
+		chan->timer = NULL;
 	}
 #ifdef HAVE_EPOLL
 	for (i = 0; i < AST_MAX_FDS; i++) {
@@ -3854,7 +3855,10 @@
 
 		switch (res) {
 		case AST_TIMING_EVENT_EXPIRED:
-			ast_timer_ack(chan->timer, 1);
+			if(ast_timer_ack(chan->timer, 1) < 0) {
+				ast_log(LOG_ERROR, "Timer failed in ast_read\n");
+				goto done;
+			}
 
 			if (chan->timingfunc) {
 				/* save a copy of func/data before unlocking the channel */
diff -urN asterisk-10.5.1.orig/main/timing.c asterisk-10.5.1/main/timing.c
--- asterisk-10.5.1.orig/main/timing.c	2010-11-08 14:03:54.000000000 -0800
+++ asterisk-10.5.1/main/timing.c	2012-06-22 11:28:30.656742703 -0700
@@ -146,6 +146,7 @@
 void ast_timer_close(struct ast_timer *handle)
 {
 	handle->holder->iface->timer_close(handle->fd);
+	handle->fd = -1;
 	ast_module_unref(handle->holder->mod);
 	ast_free(handle);
 }
@@ -164,9 +165,13 @@
 	return res;
 }
 
-void ast_timer_ack(const struct ast_timer *handle, unsigned int quantity)
+int ast_timer_ack(const struct ast_timer *handle, unsigned int quantity)
 {
-	handle->holder->iface->timer_ack(handle->fd, quantity);
+	int res = -1;
+
+	res = handle->holder->iface->timer_ack(handle->fd, quantity);
+
+	return res;
 }
 
 int ast_timer_enable_continuous(const struct ast_timer *handle)
@@ -265,7 +270,10 @@
 
 		if (res == 1) {
 			count++;
-			ast_timer_ack(timer, 1);
+			if(ast_timer_ack(timer, 1) < 0) {
+				ast_cli(a->fd, "Timer failed to acknowledge.\n");
+				return CLI_FAILURE;
+			}
 		} else if (!res) {
 			ast_cli(a->fd, "poll() timed out!  This is bad.\n");
 		} else if (errno != EAGAIN && errno != EINTR) {
@@ -274,6 +282,7 @@
 	}
 
 	ast_timer_close(timer);
+	timer = NULL;
 
 	ast_cli(a->fd, "It has been %" PRIi64 " milliseconds, and we got %d timer ticks\n", 
 		ast_tvdiff_ms(end, start), count);
diff -urN asterisk-10.5.1.orig/res/res_fax_spandsp.c asterisk-10.5.1/res/res_fax_spandsp.c
--- asterisk-10.5.1.orig/res/res_fax_spandsp.c	2012-04-04 09:38:12.000000000 -0700
+++ asterisk-10.5.1/res/res_fax_spandsp.c	2012-06-22 11:26:17.372620553 -0700
@@ -181,7 +181,7 @@
 	p->isdone = 1;
 
 	ast_timer_close(p->timer);
-
+	p->timer = -1;
 	fax_release(&p->fax_state);
 	t38_terminal_release(&p->t38_state);
 
@@ -611,7 +611,10 @@
 	struct ast_frame *f = &fax_frame;
 	ast_format_set(&fax_frame.subclass.format, AST_FORMAT_SLINEAR, 0);
 
-	ast_timer_ack(p->timer, 1);
+	if(ast_timer_ack(p->timer, 1) < 0) {
+		ast_log(LOG_ERROR,"spandsp timer failed\n");
+		return NULL;
+	}
 
 	/* XXX do we need to lock here? */
 	if (p->isdone) {
diff -urN asterisk-10.5.1.orig/res/res_musiconhold.c asterisk-10.5.1/res/res_musiconhold.c
--- asterisk-10.5.1.orig/res/res_musiconhold.c	2012-04-17 14:11:25.000000000 -0700
+++ asterisk-10.5.1/res/res_musiconhold.c	2012-06-21 16:23:05.631500725 -0700
@@ -680,7 +680,10 @@
 #endif
 			/* Pause some amount of time */
 			if (ast_poll(&pfd, 1, -1) > 0) {
-				ast_timer_ack(class->timer, 1);
+				if(ast_timer_ack(class->timer, 1) < 0) {
+					ast_log(LOG_ERROR,"mp3 thread timer failed\n");
+					return NULL;
+				}
 				res = 320;
 			} else {
 				ast_log(LOG_WARNING, "poll() failed: %s\n", strerror(errno));
diff -urN asterisk-10.5.1.orig/res/res_timing_dahdi.c asterisk-10.5.1/res/res_timing_dahdi.c
--- asterisk-10.5.1.orig/res/res_timing_dahdi.c	2011-12-27 12:53:46.000000000 -0800
+++ asterisk-10.5.1/res/res_timing_dahdi.c	2012-06-21 14:04:21.325441971 -0700
@@ -48,7 +48,7 @@
 static int dahdi_timer_open(void);
 static void dahdi_timer_close(int handle);
 static int dahdi_timer_set_rate(int handle, unsigned int rate);
-static void dahdi_timer_ack(int handle, unsigned int quantity);
+static int dahdi_timer_ack(int handle, unsigned int quantity);
 static int dahdi_timer_enable_continuous(int handle);
 static int dahdi_timer_disable_continuous(int handle);
 static enum ast_timer_event dahdi_timer_get_event(int handle);
@@ -94,9 +94,9 @@
 	return 0;
 }
 
-static void dahdi_timer_ack(int handle, unsigned int quantity)
+static int dahdi_timer_ack(int handle, unsigned int quantity)
 {
-	ioctl(handle, DAHDI_TIMERACK, &quantity);
+	return ioctl(handle, DAHDI_TIMERACK, &quantity) ? -1 : 0;
 }
 
 static int dahdi_timer_enable_continuous(int handle)
diff -urN asterisk-10.5.1.orig/res/res_timing_kqueue.c asterisk-10.5.1/res/res_timing_kqueue.c
--- asterisk-10.5.1.orig/res/res_timing_kqueue.c	2011-07-14 13:25:31.000000000 -0700
+++ asterisk-10.5.1/res/res_timing_kqueue.c	2012-06-21 14:04:16.685576995 -0700
@@ -49,7 +49,7 @@
 static int kqueue_timer_open(void);
 static void kqueue_timer_close(int handle);
 static int kqueue_timer_set_rate(int handle, unsigned int rate);
-static void kqueue_timer_ack(int handle, unsigned int quantity);
+static int kqueue_timer_ack(int handle, unsigned int quantity);
 static int kqueue_timer_enable_continuous(int handle);
 static int kqueue_timer_disable_continuous(int handle);
 static enum ast_timer_event kqueue_timer_get_event(int handle);
@@ -195,20 +195,22 @@
 	return 0;
 }
 
-static void kqueue_timer_ack(int handle, unsigned int quantity)
+static int kqueue_timer_ack(int handle, unsigned int quantity)
 {
 	struct kqueue_timer *our_timer;
 
 	if (!(our_timer = lookup_timer(handle))) {
-		return;
+		return -1;
 	}
 
 	if (our_timer->unacked < quantity) {
 		ast_debug(1, "Acking more events than have expired?!!\n");
 		our_timer->unacked = 0;
+		return -1;
 	} else {
 		our_timer->unacked -= quantity;
 	}
+	return 0;
 }
 
 static int kqueue_timer_enable_continuous(int handle)
diff -urN asterisk-10.5.1.orig/res/res_timing_pthread.c asterisk-10.5.1/res/res_timing_pthread.c
--- asterisk-10.5.1.orig/res/res_timing_pthread.c	2011-12-27 12:53:46.000000000 -0800
+++ asterisk-10.5.1/res/res_timing_pthread.c	2012-06-21 14:13:52.108832707 -0700
@@ -47,7 +47,7 @@
 static int pthread_timer_open(void);
 static void pthread_timer_close(int handle);
 static int pthread_timer_set_rate(int handle, unsigned int rate);
-static void pthread_timer_ack(int handle, unsigned int quantity);
+static int pthread_timer_ack(int handle, unsigned int quantity);
 static int pthread_timer_enable_continuous(int handle);
 static int pthread_timer_disable_continuous(int handle);
 static enum ast_timer_event pthread_timer_get_event(int handle);
@@ -97,7 +97,7 @@
 static void pthread_timer_destructor(void *obj);
 static struct pthread_timer *find_timer(int handle, int unlinkobj);
 static void write_byte(struct pthread_timer *timer);
-static void read_pipe(struct pthread_timer *timer, unsigned int num);
+static int read_pipe(struct pthread_timer *timer, unsigned int num);
 
 /*!
  * \brief Data for the timing thread
@@ -190,21 +190,22 @@
 	return 0;
 }
 
-static void pthread_timer_ack(int handle, unsigned int quantity)
+static int pthread_timer_ack(int handle, unsigned int quantity)
 {
 	struct pthread_timer *timer;
 
 	ast_assert(quantity > 0);
 
 	if (!(timer = find_timer(handle, 0))) {
-		return;
+		return -1;
 	}
 
 	ao2_lock(timer);
-	read_pipe(timer, quantity);
+	int res = read_pipe(timer, quantity);
 	ao2_unlock(timer);
 
 	ao2_ref(timer, -1);
+	return res;
 }
 
 static int pthread_timer_enable_continuous(int handle)
@@ -240,7 +241,10 @@
 	ao2_lock(timer);
 	if (timer->continuous) {
 		timer->continuous = 0;
-		read_pipe(timer, 1);
+		if(read_pipe(timer, 1) != 0) {
+			errno = EINVAL;
+			return -1;
+		}
 	}
 	ao2_unlock(timer);
 
@@ -359,7 +363,7 @@
  * \internal
  * \pre timer is locked
  */
-static void read_pipe(struct pthread_timer *timer, unsigned int quantity)
+static int read_pipe(struct pthread_timer *timer, unsigned int quantity)
 {
 	int rd_fd = timer->pipe[PIPE_READ];
 	int pending_ticks = timer->pending_ticks;
@@ -375,7 +379,7 @@
 	}
 
 	if (!quantity) {
-		return;
+		return 0;
 	}
 
 	do {
@@ -389,7 +393,7 @@
 		if (ast_poll(&pfd, 1, 0) != 1) {
 			ast_debug(1, "Reading not available on timing pipe, "
 					"quantity: %u\n", quantity);
-			break;
+			return -1;
 		}
 
 		res = read(rd_fd, buf,
@@ -401,12 +405,13 @@
 			}
 			ast_log(LOG_ERROR, "read failed on timing pipe: %s\n",
 					strerror(errno));
-			break;
+			return -1;
 		}
 
 		quantity -= res;
 		timer->pending_ticks -= res;
 	} while (quantity);
+	return 0;
 }
 
 /*!
diff -urN asterisk-10.5.1.orig/res/res_timing_timerfd.c asterisk-10.5.1/res/res_timing_timerfd.c
--- asterisk-10.5.1.orig/res/res_timing_timerfd.c	2011-12-27 12:53:46.000000000 -0800
+++ asterisk-10.5.1/res/res_timing_timerfd.c	2012-06-21 15:56:10.046427839 -0700
@@ -44,7 +44,7 @@
 static int timerfd_timer_open(void);
 static void timerfd_timer_close(int handle);
 static int timerfd_timer_set_rate(int handle, unsigned int rate);
-static void timerfd_timer_ack(int handle, unsigned int quantity);
+static int timerfd_timer_ack(int handle, unsigned int quantity);
 static int timerfd_timer_enable_continuous(int handle);
 static int timerfd_timer_disable_continuous(int handle);
 static enum ast_timer_event timerfd_timer_get_event(int handle);
@@ -91,6 +91,7 @@
 {
 	struct timerfd_timer *timer = obj;
 	close(timer->handle);
+	timer->handle = -1;
 }
 
 static int timerfd_timer_open(void)
@@ -121,6 +122,11 @@
 		.handle = handle,
 	};
 
+        if(handle == -1) {
+                ast_log(LOG_ERROR, "Attempting to close timerfd handle -1");
+                return;
+        }
+
 	if (!(our_timer = ao2_find(timerfd_timers, &find_helper, OBJ_POINTER))) {
 		ast_log(LOG_ERROR, "Couldn't find timer with handle %d\n", handle);
 		return;
@@ -137,6 +143,11 @@
 	};
 	int res = 0;
 
+        if(handle == -1) {
+                ast_log(LOG_ERROR, "Attempting to use timerfd handle -1");
+                return -1;
+        }
+
 	if (!(our_timer = ao2_find(timerfd_timers, &find_helper, OBJ_POINTER))) {
 		ast_log(LOG_ERROR, "Couldn't find timer with handle %d\n", handle);
 		return -1;
@@ -158,7 +169,7 @@
 	return res;
 }
 
-static void timerfd_timer_ack(int handle, unsigned int quantity)
+static int timerfd_timer_ack(int handle, unsigned int quantity)
 {
 	uint64_t expirations;
 	int read_result = 0;
@@ -166,9 +177,14 @@
 		.handle = handle,
 	};
 
+        if(handle == -1) {
+		ast_log(LOG_ERROR, "Attempting to use timerfd handle -1");
+		return -1;
+	}
+
 	if (!(our_timer = ao2_find(timerfd_timers, &find_helper, OBJ_POINTER))) {
 		ast_log(LOG_ERROR, "Couldn't find a timer with handle %d\n", handle);
-		return;
+		return -1;
 	}
 
 	ao2_lock(our_timer);
@@ -177,9 +193,11 @@
 		struct itimerspec timer_status;
 
 		if (timerfd_gettime(handle, &timer_status)) {
-			ast_log(LOG_ERROR, "Call to timerfd_gettime() error: %s\n", strerror(errno));
+			ast_log(LOG_ERROR, "Call to timerfd_gettime() using handle %d error: %s\n", handle, strerror(errno));
 			expirations = 0;
-			break;
+		        ao2_unlock(our_timer);
+		        ao2_ref(our_timer, -1);
+			return -1;
 		}
 
 		if (timer_status.it_value.tv_sec == 0 && timer_status.it_value.tv_nsec == 0) {
@@ -194,7 +212,9 @@
 				continue;
 			} else {
 				ast_log(LOG_ERROR, "Read error: %s\n", strerror(errno));
-				break;
+			        ao2_unlock(our_timer);
+			        ao2_ref(our_timer, -1);
+				return -1;
 			}
 		}
 	} while (read_result != sizeof(expirations));
@@ -205,6 +225,7 @@
 	if (expirations != quantity) {
 		ast_debug(2, "Expected to acknowledge %u ticks but got %llu instead\n", quantity, (unsigned long long) expirations);
 	}
+	return 0;
 }
 
 static int timerfd_timer_enable_continuous(int handle)
@@ -217,6 +238,11 @@
 		.handle = handle,
 	};
 
+        if(handle == -1) {
+                ast_log(LOG_ERROR, "Attempting to use timerfd handle -1");
+                return -1;
+        }
+
 	if (!(our_timer = ao2_find(timerfd_timers, &find_helper, OBJ_POINTER))) {
 		ast_log(LOG_ERROR, "Couldn't find timer with handle %d\n", handle);
 		return -1;
@@ -246,6 +272,11 @@
 		.handle = handle,
 	};
 
+        if(handle == -1) {
+                ast_log(LOG_ERROR, "Attempting to use timerfd handle -1");
+                return -1;
+        }
+
 	if (!(our_timer = ao2_find(timerfd_timers, &find_helper, OBJ_POINTER))) {
 		ast_log(LOG_ERROR, "Couldn't find timer with handle %d\n", handle);
 		return -1;
@@ -276,6 +307,11 @@
 		.handle = handle,
 	};
 
+        if(handle == -1) {
+                ast_log(LOG_ERROR, "Attempting to use timerfd handle -1");
+                return -1;
+        }
+
 	if (!(our_timer = ao2_find(timerfd_timers, &find_helper, OBJ_POINTER))) {
 		ast_log(LOG_ERROR, "Couldn't find timer with handle %d\n", handle);
 		return -1;
