[svn-commits] trunk r27479 - /trunk/channels/chan_sip.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue May 16 13:13:11 MST 2006


Author: oej
Date: Tue May 16 15:13:10 2006
New Revision: 27479

URL: http://svn.digium.com/view/asterisk?rev=27479&view=rev
Log:
Send a=recvonly when put on hold, otherwise a=sendrecv to indicate that we want two streams.

Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=27479&r1=27478&r2=27479&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue May 16 15:13:10 2006
@@ -4743,6 +4743,7 @@
 	char c[256];
 	char t[256];
 	char b[256];
+	char hold[256];
 	char m_audio[256];
 	char m_video[256];
 	char a_audio[1024];
@@ -4822,6 +4823,11 @@
 	ast_build_string(&m_audio_next, &m_audio_left, "m=audio %d RTP/AVP", ntohs(dest.sin_port));
 	ast_build_string(&m_video_next, &m_video_left, "m=video %d RTP/AVP", ntohs(vdest.sin_port));
 
+	if (ast_test_flag(&p->flags[0], SIP_CALL_ONHOLD))
+		sprintf(hold, "a=recvonly");
+	else
+		sprintf(hold, "a=sendrecv");
+
 	/* Prefer the codec we were requested to use, first, no matter what */
 	if (capability & p->prefcodec) {
 		if (p->prefcodec <= AST_FORMAT_MAX_AUDIO)
@@ -4902,11 +4908,11 @@
 	ast_build_string(&m_audio_next, &m_audio_left, "\r\n");
 	ast_build_string(&m_video_next, &m_video_left, "\r\n");
 
-	len = strlen(v) + strlen(s) + strlen(o) + strlen(c) + strlen(t) + strlen(m_audio) + strlen(a_audio);
+	len = strlen(v) + strlen(s) + strlen(o) + strlen(c) + strlen(t) + strlen(m_audio) + strlen(a_audio) + strlen(hold);
 	if ((p->vrtp) &&
 	    (!ast_test_flag(&p->flags[0], SIP_NOVIDEO)) &&
 	    (capability & VIDEO_CODEC_MASK)) /* only if video response is appropriate */
-		len += strlen(m_video) + strlen(a_video) + strlen(b);
+		len += strlen(m_video) + strlen(a_video) + strlen(b) + strlen(hold);
 
 	add_header(resp, "Content-Type", "application/sdp");
 	add_header_contentLength(resp, len);
@@ -4921,11 +4927,13 @@
 	add_line(resp, t);
 	add_line(resp, m_audio);
 	add_line(resp, a_audio);
+	add_line(resp, hold);
 	if ((p->vrtp) &&
 	    (!ast_test_flag(&p->flags[0], SIP_NOVIDEO)) &&
 	    (capability & VIDEO_CODEC_MASK)) { /* only if video response is appropriate */
 		add_line(resp, m_video);
 		add_line(resp, a_video);
+		add_line(resp, hold);
 	}
 
 	/* Update lastrtprx when we send our SDP */



More information about the svn-commits mailing list