Prevent local RTP bridges from sending inappropriate formats to participants.
authorMark Michelson <mmichelson@digium.com>
Fri, 31 Aug 2012 21:15:07 +0000 (21:15 +0000)
committerMark Michelson <mmichelson@digium.com>
Fri, 31 Aug 2012 21:15:07 +0000 (21:15 +0000)
A change for Asterisk 11 caused a check for failure to incorrectly check the return
value. This resulted in the possibility of transmitting media that a party had not
negotiated. If this media happened to be G.729, then this could potentially result
in one-way audio if no G.729 translators are installed.

(closes issue ASTERISK-20296)
reported by NITESH BANSAL
........

Merged revisions 372118 from http://svn.asterisk.org/svn/asterisk/branches/11

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372119 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_rtp_asterisk.c

index aa7895b..fad313c 100644 (file)
@@ -2789,7 +2789,7 @@ static int bridge_p2p_rtp_write(struct ast_rtp_instance *instance, unsigned int
        }
 
        /* 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_codecs_payload_code(ast_rtp_instance_get_codecs(instance1), 0, NULL, bridged_payload) &&
+       if ((ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(instance1), 0, NULL, bridged_payload) == -1) &&
            !ast_rtp_codecs_get_payload_format(ast_rtp_instance_get_codecs(instance1), bridged_payload)) {
                return -1;
        }