Index: channels/chan_local.c =================================================================== --- channels/chan_local.c (revision 124869) +++ channels/chan_local.c (working copy) @@ -186,13 +186,15 @@ while (other && ast_channel_trylock(other)) { ast_mutex_unlock(&p->lock); if (us && us_locked) { - ast_channel_unlock(us); + do { + ast_channel_unlock(us); + usleep(1); + ast_channel_lock(us); + } while (ast_mutex_trylock(&p->lock)); + } else { + usleep(1); + ast_mutex_lock(&p->lock); } - usleep(1); - if (us && us_locked) { - ast_channel_lock(us); - } - ast_mutex_lock(&p->lock); other = isoutbound ? p->owner : p->chan; } @@ -510,7 +512,12 @@ if (!p) return -1; - ast_mutex_lock(&p->lock); + while (ast_mutex_trylock(&p->lock)) { + ast_channel_unlock(ast); + usleep(1); + ast_channel_lock(ast); + } + isoutbound = IS_OUTBOUND(ast, p); if (isoutbound) { const char *status = pbx_builtin_getvar_helper(p->chan, "DIALSTATUS");