*** asterisk-1.4.17.orig/main/rtp.c 2007-12-10 17:36:15.000000000 +0100 --- asterisk-1.4.17/main/rtp.c 2008-01-03 16:49:04.000000000 +0100 *************** *** 1062,1067 **** --- 1062,1078 ---- /* Check what the payload value should be */ rtpPT = ast_rtp_lookup_pt(rtp, payload); + if(payload < 0 || payload > MAX_RTP_PT) + return -1; /* bogus payload type */ + + /* If the payload isn't of a negotiated codec, send it to the core */ + if(!bridged->current_RTP_PT[payload].code) + { + ast_log(LOG_WARNING, "unsupported payload, passing to core!"); + return -1; + } + + /* If the payload is DTMF, and we are listening for DTMF - then feed it into the core */ if (ast_test_flag(rtp, FLAG_P2P_NEED_DTMF) && !rtpPT.isAstFormat && rtpPT.code == AST_RTP_DTMF) return -1; *************** *** 3142,3147 **** --- 3153,3165 ---- cs[1] = c1; cs[2] = NULL; for (;;) { + /* Get codecs from both sides */ + if (c0->rawreadformat != c1->rawwriteformat || c1->rawreadformat != c0->rawwriteformat) + { + ast_log(LOG_WARNING, "Formats have changed and are no longer compatible, shutting down the bridge\n"); + res = AST_BRIDGE_FAILED_NOWARN; + break; + } /* Check if anything changed */ if ((c0->tech_pvt != pvt0) || (c1->tech_pvt != pvt1) ||