Index: channels/chan_iax2.c =================================================================== --- channels/chan_iax2.c (revision 160296) +++ channels/chan_iax2.c (working copy) @@ -4401,7 +4401,7 @@ frb.fr2.afdatalen = sizeof(frb.buffer); if (!pvt) { - ast_log(LOG_WARNING, "No private structure for packet?\n"); + ast_log(LOG_WARNING, "No private structure for packet? (frametype %d/subtype %d)\n", f->frametype, f->subclass); return -1; } @@ -5114,9 +5114,10 @@ res = 0; else if (!ast_test_flag(&iaxs[callno]->state, IAX_STATE_STARTED)) res = 0; - else + else { /* Simple, just queue for transmission */ res = iax2_send(iaxs[callno], f, 0, -1, 0, 0, 0); + } } else { if (option_debug) ast_log(LOG_DEBUG, "Write error: %s\n", strerror(errno)); @@ -5150,7 +5151,12 @@ { int res; ast_mutex_lock(&iaxsl[callno]); - res = send_command(iaxs[callno], type, command, ts, data, datalen, seqno); + if (!iaxs[callno]) { + ast_log(LOG_WARNING, "Call %d no longer exists. Cannot send (type %hhd/cmd %d/ts %u)\n", type, command, ts); + res = -1; + } else { + res = send_command(iaxs[callno], type, command, ts, data, datalen, seqno); + } ast_mutex_unlock(&iaxsl[callno]); return res; }