--- asterisk-18.11.3/apps/app_audiosocket.c 2022-04-26 18:32:12.000000000 +0200 +++ asterisk-18.11.3-patched/apps/app_audiosocket.c 2022-09-14 13:41:36.981532393 +0200 @@ -207,6 +207,12 @@ static int audiosocket_run(struct ast_ch "channel %s\n", chanName); return -1; } + /* horrible hack */ + if (f->src && strcmp(f->src, "AudioSocket_closed") == 0) { + ast_log(LOG_WARNING, "AudioSocket closed remotely on channel %s\n", chanName); + ast_frfree(f); + return 0; + } if (ast_write(chan, f)) { ast_log(LOG_WARNING, "Failed to forward frame to channel %s\n", chanName); ast_frfree(f); --- asterisk-18.11.3/res/res_audiosocket.c 2022-04-26 18:32:12.000000000 +0200 +++ asterisk-18.11.3-patched/res/res_audiosocket.c 2022-09-14 13:37:23.533849654 +0200 @@ -257,7 +257,10 @@ struct ast_frame *ast_audiosocket_receiv } if (kind == 0x00) { /* AudioSocket ended by remote */ - return NULL; + /* horrible hack */ + f.src = "AudioSocket_closed"; + f.mallocd = 0; + return ast_frisolate(&f); } if (kind != 0x10) { /* read but ignore non-audio message */