Index: pbx/pbx_spool.c =================================================================== --- pbx/pbx_spool.c (revision 48033) +++ pbx/pbx_spool.c (working copy) @@ -387,8 +387,8 @@ now += o->retrytime; if (o->callingpid && (o->callingpid == ast_mainpid)) { safe_append(o, time(NULL), "DelayedRetry"); + ast_log(LOG_DEBUG, "Delaying retry since we're currently running '%s'\n", o->fn); free_outgoing(o); - ast_log(LOG_DEBUG, "Delaying retry since we're currently running '%s'\n", o->fn); } else { /* Increment retries */ o->retries++; @@ -403,20 +403,20 @@ return now; } else { ast_log(LOG_EVENT, "Queued call to %s/%s expired without completion after %d attempt%s\n", o->tech, o->dest, o->retries - 1, ((o->retries - 1) != 1) ? "s" : ""); + remove_from_queue(o, "Expired"); free_outgoing(o); - remove_from_queue(o, "Expired"); return 0; } } else { - free_outgoing(o); ast_log(LOG_WARNING, "Invalid file contents in %s, deleting\n", fn); fclose(f); remove_from_queue(o, "Failed"); + free_outgoing(o); } } else { - free_outgoing(o); ast_log(LOG_WARNING, "Unable to open %s: %s, deleting\n", fn, strerror(errno)); remove_from_queue(o, "Failed"); + free_outgoing(o); } } else ast_log(LOG_WARNING, "Out of memory :(\n");