diff --git a/res/res_agi.c b/res/res_agi.c index c05701d38e..36397dc1d3 100644 --- a/res/res_agi.c +++ b/res/res_agi.c @@ -1297,9 +1297,9 @@ static enum agi_result launch_asyncagi(struct ast_channel *chan, char *argv[], i setup_env(chan, "async", fds[1], 0, 0, NULL); /* read the environment */ res = read(fds[0], agi_buffer, AGI_BUF_SIZE); - if (!res) { - ast_log(LOG_ERROR, "Failed to read from Async AGI pipe on channel %s\n", - chan->name); + if (res <= 0) { + ast_log(LOG_ERROR, "Failed to read from Async AGI pipe on channel %s: %s\n", + chan->name, res < 0 ? strerror(errno) : "EOF"); returnstatus = AGI_RESULT_FAILURE; goto async_agi_abort; } @@ -1327,9 +1327,9 @@ static enum agi_result launch_asyncagi(struct ast_channel *chan, char *argv[], i * fd (the pipe), let's read the response. */ res = read(fds[0], agi_buffer, AGI_BUF_SIZE); - if (!res) { - ast_log(LOG_ERROR, "Failed to read from Async AGI pipe on channel %s\n", - chan->name); + if (res <= 0) { + ast_log(LOG_ERROR, "Failed to read from Async AGI pipe on channel %s: %s\n", + chan->name, res < 0 ? strerror(errno) : "EOF"); free_agi_cmd(cmd); returnstatus = AGI_RESULT_FAILURE; goto async_agi_done; diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index 76b9bafd9b..34124e9ba1 100644 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -669,7 +669,7 @@ static void *monmp3thread(void *data) ast_log(LOG_WARNING, "Unable to spawn mp3player\n"); /* Try again later */ sleep(500); - pthread_testcancel(); + continue; } } if (class->timer) { diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c index d804d2cb0b..de99acf32c 100644 --- a/res/res_rtp_asterisk.c +++ b/res/res_rtp_asterisk.c @@ -2046,6 +2046,11 @@ static int bridge_p2p_rtp_write(struct ast_rtp_instance *instance, unsigned int /* Otherwise adjust bridged payload to match */ bridged_payload = ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(instance1), payload_type.asterisk_format, &payload_type.format, payload_type.rtp_code); + /* If no codec could be matched between instance and instance1, then somehow things were made incompatible while we were still bridged. Bail. */ + if (bridged_payload < 0) { + return -1; + } + /* If the payload coming in is not one of the negotiated ones then send it to the core, this will cause formats to change and the bridge to break */ if (!(ast_rtp_instance_get_codecs(instance1)->payloads[bridged_payload].rtp_code) && !(ast_rtp_instance_get_codecs(instance1)->payloads[bridged_payload].asterisk_format)) {