Index: chan_iax2.c =================================================================== --- chan_iax2.c (revision 16775) +++ chan_iax2.c (working copy) @@ -1609,19 +1609,14 @@ int res; char iabuf[INET_ADDRSTRLEN]; int callno = f->callno; + + /* Don't send if there was an error, but return error instead */ + if (!callno || !iaxs[callno] || iaxs[callno]->error) + return -1; /* Called with iaxsl held */ - if (!iaxs[callno]) - return -1; if (option_debug > 2 && iaxdebug) ast_log(LOG_DEBUG, "Sending %d on %d/%d to %s:%d\n", f->ts, callno, iaxs[callno]->peercallno, ast_inet_ntoa(iabuf, sizeof(iabuf), iaxs[callno]->addr.sin_addr), ntohs(iaxs[callno]->addr.sin_port)); - /* Don't send if there was an error, but return error instead */ - if (!callno) { - ast_log(LOG_WARNING, "Call number = %d\n", callno); - return -1; - } - if (iaxs[callno]->error) - return -1; if (f->transfer) { if (iaxdebug) iax_showframe(f, NULL, 0, &iaxs[callno]->transfer, f->datalen - sizeof(struct ast_iax2_full_hdr));