diff -Nur asterisk-14.5.0/channels/chan_iax2.c asterisk-14.5.0-patched/channels/chan_iax2.c --- asterisk-14.5.0/channels/chan_iax2.c 2017-05-31 03:50:46.000000000 +1000 +++ asterisk-14.5.0-patched/channels/chan_iax2.c 2018-02-19 09:26:18.332446692 +1000 @@ -12562,6 +12562,7 @@ static void *network_thread(void *ignore) { + int res; if (timer) { ast_io_add(io, ast_timer_fd(timer), timing_read, AST_IO_IN | AST_IO_PRI, NULL); } @@ -12571,9 +12572,12 @@ /* Wake up once a second just in case SIGURG was sent while * we weren't in poll(), to make sure we don't hang when trying * to unload. */ - if (ast_io_wait(io, 1000) <= 0) { - break; - } + res = ast_io_wait(io, 1000); + /* Timeout(=0), and EINTR is not a thread exit condition. We do + * not want to exit the thread loop on these conditions. */ + if (res < 0 && res != -EINTR) + { + ast_log(LOG_ERROR, "Thread exit =%s \n", strerror(errno)); + break; + } } return NULL;