aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authoroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-27 15:23:17 +0000
committeroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-27 15:23:17 +0000
commit9d77e3fc14c6cc24c2e2c2163380f83dd756a716 (patch)
tree33a8ef0233ced53bf2d5a11031097e5e5c5ea070 /channels
parentc86e11cebcee0ef6b28b59dfda0003c58317094c (diff)
If we get a codec offer using a well-known payload type, but using it for another
codec that we don't know, Asterisk did not remove that codec from the list. With this patch, we remove the codec from audio and video rtp objects and deny it ever existed. Thanks to lasse for testing. (closes issue #11376) Reported by: lasse Patches: bug11376.txt uploaded by oej (license 306) Tested by: lasse git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@89630 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 9023d0939..c9281c75f 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -5203,16 +5203,37 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
continue;
} else if (sscanf(a, "rtpmap: %u %[^/]/", &codec, mimeSubtype) == 2) {
/* We have a rtpmap to handle */
- if (debug)
- ast_verbose("Found description format %s for ID %d\n", mimeSubtype, codec);
- found_rtpmap_codecs[last_rtpmap_codec] = codec;
- last_rtpmap_codec++;
+ int found = FALSE;
+ /* We should propably check if this is an audio or video codec
+ so we know where to look */
/* Note: should really look at the 'freq' and '#chans' params too */
- ast_rtp_set_rtpmap_type(newaudiortp, codec, "audio", mimeSubtype,
- ast_test_flag(&p->flags[0], SIP_G726_NONSTANDARD) ? AST_RTP_OPT_G726_NONSTANDARD : 0);
- if (p->vrtp)
- ast_rtp_set_rtpmap_type(newvideortp, codec, "video", mimeSubtype, 0);
+ if(ast_rtp_set_rtpmap_type(newaudiortp, codec, "audio", mimeSubtype,
+ ast_test_flag(&p->flags[0], SIP_G726_NONSTANDARD) ? AST_RTP_OPT_G726_NONSTANDARD : 0) != -1) {
+ if (debug)
+ ast_verbose("Found audio description format %s for ID %d\n", mimeSubtype, codec);
+ found_rtpmap_codecs[last_rtpmap_codec] = codec;
+ last_rtpmap_codec++;
+ found = TRUE;
+
+ } else if (p->vrtp) {
+ if(ast_rtp_set_rtpmap_type(newvideortp, codec, "video", mimeSubtype, 0) != -1) {
+ if (debug)
+ ast_verbose("Found video description format %s for ID %d\n", mimeSubtype, codec);
+ found_rtpmap_codecs[last_rtpmap_codec] = codec;
+ last_rtpmap_codec++;
+ found = TRUE;
+ }
+ }
+ if (!found) {
+ /* Remove this codec since it's an unknown media type for us */
+ /* XXX This is buggy since the media line for audio and video can have the
+ same numbers. We need to check as described above, but for testing this works... */
+ ast_rtp_unset_m_type(newaudiortp, codec);
+ ast_rtp_unset_m_type(newvideortp, codec);
+ if (debug)
+ ast_verbose("Found unknown media description format %s for ID %d\n", mimeSubtype, codec);
+ }
}
}