--- app_chanspy.c.orig 2007-01-31 20:07:09.000000000 -0500 +++ app_chanspy.c 2007-01-31 20:13:51.000000000 -0500 @@ -332,11 +332,14 @@ ast_mutex_lock(&csth.spy.lock); if (csth.spy.chan) { csth.spy.status = CHANSPY_DONE; + ast_mutex_unlock(&csth.spy.lock); ast_mutex_lock(&csth.spy.chan->lock); ast_channel_spy_remove(csth.spy.chan, &csth.spy); ast_mutex_unlock(&csth.spy.chan->lock); } - ast_mutex_unlock(&csth.spy.lock); + else { + ast_mutex_unlock(&csth.spy.lock); + } if (option_verbose > 1) ast_verbose(VERBOSE_PREFIX_2 "Done Spying on channel %s\n", name);