--- chan_sip.c.orig 2003-12-18 21:09:56.000000000 -0500 +++ chan_sip.c 2003-12-18 21:14:52.000000000 -0500 @@ -52,6 +52,7 @@ #include #include +#define VIDEO_CODEC_MASK 0x1fc0000 // Video codecs from H.261 thru AST_FORMAT_MAX_VIDEO #ifndef IPTOS_MINCOST #define IPTOS_MINCOST 0x02 #endif @@ -1889,10 +1890,12 @@ while(*codecs && (*codecs < 33)) codecs++; } } + if (p->vrtp) + ast_rtp_pt_clear(p->vrtp); // Must be cleared in case no m=video line exists + if (p->vrtp && (sscanf(m, "video %d RTP/AVP %n", &x, &len) == 1)) { vportno = x; // Scan through the RTP payload types specified in a "m=" line: - ast_rtp_pt_clear(p->vrtp); codecs = m + len; while(strlen(codecs)) { if (sscanf(codecs, "%d%n", &codec, &len) != 1) { @@ -2584,7 +2587,7 @@ strcat(m, "\r\n"); strcat(m2, "\r\n"); len = strlen(v) + strlen(s) + strlen(o) + strlen(c) + strlen(t) + strlen(m) + strlen(a); - if (p->vrtp) + if ((p->vrtp) && (p->jointcapability & VIDEO_CODEC_MASK)) // only if video response is appropriate len += strlen(m2) + strlen(a2); snprintf(costr, sizeof(costr), "%d", len); add_header(resp, "Content-Type", "application/sdp"); @@ -2596,7 +2599,7 @@ add_line(resp, t); add_line(resp, m); add_line(resp, a); - if (p->vrtp) { + if ((p->vrtp) && (p->jointcapability & VIDEO_CODEC_MASK)) { // only if video response is appropriate add_line(resp, m2); add_line(resp, a2); }