Am I missing something here? I see if (needvideo) { /* only if video response is appropriate */ add_line(resp, m_video->str); add_line(resp, a_video->str); add_line(resp, hold); /* Repeat hold for the video stream */ } else if (p->offered_media[SDP_VIDEO].offered) { snprintf(dummy_answer, sizeof(dummy_answer), "m=video 0 RTP/AVP\ %s\r\n", p->offered_media[SDP_VIDEO].text); add_line(resp, dummy_answer); But "len", which was used to set Content-Length, isn't updated to onclide that dummy. Doesn't it need to be? I think this may be a problem with a connection to my Polycom VSX.
I can confirm that the following fixes my problem: --- chan_sip.c (revision 261450) +++ chan_sip.c (working copy) @@ -10357,12 +10357,22 @@ strlen(connection) + strlen(session_time); if (needaudio) len += m_audio->used + a_audio->used + strlen(hold); + else if (p->offered_media[SDP_AUDIO].offered) + len += strlen("m=audio 0 RTP/AVP \r\n") + strlen(p->offered_media[SDP_AUDIO].text); + if (needvideo) /* only if video response is appropriate */ len += m_video->used + a_video->used + strlen(bandwidth) + strlen(hold); + else if (p->offered_media[SDP_VIDEO].offered) + len += strlen("m=video 0 RTP/AVP \r\n") + strlen(p->offered_media[SDP_VIDEO].text); + if (needtext) /* only if text response is appropriate */ len += m_text->used + a_text->used + strlen(hold); + else if (p->offered_media[SDP_TEXT].offered) + len += strlen("m=text 0 RTP/AVP \r\n") + strlen(p->offered_media[SDP_TEXT].text); if (add_t38) len += m_modem->used + a_modem->used; + else if (p->offered_media[SDP_IMAGE].offered) + len += strlen("m=image 0 udptl t38\r\n"); add_header(resp, "Content-Type", "application/sdp"); add_header_contentLength(resp, len);
This code is really ugly und hard to verify. Please file a bug report at https://issues.asterisk.org/ thanks klaus Am 06.05.2010 23:54, schrieb Richard Kenner:> I can confirm that the following fixes my problem: > > --- chan_sip.c (revision 261450) > +++ chan_sip.c (working copy) > @@ -10357,12 +10357,22 @@ > strlen(connection) + strlen(session_time); > if (needaudio) > len += m_audio->used + a_audio->used + strlen(hold); > + else if (p->offered_media[SDP_AUDIO].offered) > + len += strlen("m=audio 0 RTP/AVP \r\n") + strlen(p->offered_media[SDP_AUDIO].text); > + > if (needvideo) /* only if video response is appropriate */ > len += m_video->used + a_video->used + strlen(bandwidth) + strlen(hold); > + else if (p->offered_media[SDP_VIDEO].offered) > + len += strlen("m=video 0 RTP/AVP \r\n") + strlen(p->offered_media[SDP_VIDEO].text); > + > if (needtext) /* only if text response is appropriate */ > len += m_text->used + a_text->used + strlen(hold); > + else if (p->offered_media[SDP_TEXT].offered) > + len += strlen("m=text 0 RTP/AVP \r\n") + strlen(p->offered_media[SDP_TEXT].text); > if (add_t38) > len += m_modem->used + a_modem->used; > + else if (p->offered_media[SDP_IMAGE].offered) > + len += strlen("m=image 0 udptl t38\r\n"); > > add_header(resp, "Content-Type", "application/sdp"); > add_header_contentLength(resp, len); >
> This code is really ugly und hard to verify.Since the computation of the is being done with separate code from the actual output, the code in that part of the module is indeed ugly. But I wanted to make the smallest possible change. However, I do suggest that the full output string be built up and the output as once.> Please file a bug report at https://issues.asterisk.org/Will do.