Index: channel.c =================================================================== --- channel.c (revision 7472) +++ channel.c (working copy) @@ -1041,7 +1041,20 @@ if (!chan->spies) return; - AST_LIST_REMOVE(&chan->spies->list, spy, list); + /*AST_LIST_REMOVE(&chan->spies->list, spy, list);*/ +/*#define AST_LIST_REMOVE(chan->spies->list, spy, list) do {*/ + if ((&chan->spies->list)->first == (spy)) { + (&chan->spies->list)->first = (spy)->list.next; + if ((&chan->spies->list)->last == (spy)) + (&chan->spies->list)->last = NULL; + } else { + typeof(spy) curspy = (&chan->spies->list)->first; + while (curspy->list.next != (spy)) + curspy = curspy->list.next; + curspy->list.next = (spy)->list.next; + if ((&chan->spies->list)->last == curspy->list.next) + (&chan->spies->list)->last = curspy; + } ast_mutex_lock(&spy->lock);