Index: channels/chan_iax2.c =================================================================== --- channels/chan_iax2.c (revision 128639) +++ channels/chan_iax2.c (working copy) @@ -3766,11 +3766,12 @@ ast_mutex_unlock(&iaxsl[callno]); tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, i->amaflags, "IAX2/%s-%d", i->host, i->callno); ast_mutex_lock(&iaxsl[callno]); - if (!iaxs[callno]) { + if (i != iaxs[callno]) { + ast_log(LOG_WARNING, "IAX2 pvt for callno %d was %s while not locked\n", + callno, iaxs[callno] ? "replaced" : "destroyed"); if (tmp) { ast_channel_free(tmp); } - ast_mutex_unlock(&iaxsl[callno]); return NULL; }