Index: channels/chan_iax2.c =================================================================== --- channels/chan_iax2.c (revision 152921) +++ channels/chan_iax2.c (working copy) @@ -1558,12 +1558,21 @@ /* This will occur on the first response to a message that we initiated, * such as a PING. */ + if (dcallno) { + ast_mutex_lock(&iaxsl[dcallno]); + } if (callno && dcallno && iaxs[dcallno] && !iaxs[dcallno]->peercallno && match(sin, callno, dcallno, iaxs[dcallno], check_dcallno)) { iaxs[dcallno]->peercallno = callno; res = dcallno; store_by_peercallno(iaxs[dcallno]); + if (!res || !return_locked) { + ast_mutex_unlock(&iaxsl[dcallno]); + } return res; } + if (dcallno) { + ast_mutex_unlock(&iaxsl[dcallno]); + } #ifdef IAX_OLD_FIND /* If we get here, we SHOULD NOT find a call structure for this