[asterisk-commits] rizzo: branch rizzo/astobj2 r48524 - /team/rizzo/astobj2/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Dec 16 14:13:10 MST 2006


Author: rizzo
Date: Sat Dec 16 15:13:09 2006
New Revision: 48524

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48524
Log:
fix for bug #8600,
improper computation of Content-Length in add_t38_sdp()

both 1.4 and trunk candidate.
(the fix is different in 1.4 because we don't have ast_str_append()).


Modified:
    team/rizzo/astobj2/channels/chan_sip.c

Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=48524&r1=48523&r2=48524
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Sat Dec 16 15:13:09 2006
@@ -6375,12 +6375,7 @@
 	int len = 0;
 	int x = 0;
 	struct sockaddr_in udptlsin;
-	char v[256] = "";
-	char s[256] = "";
-	char o[256] = "";
-	char c[256] = "";
-	char t[256] = "";
-	struct ast_str *m_modem = ast_str_alloca(256);
+	struct ast_str *m_modem = ast_str_alloca(1024);
 	struct ast_str *a_modem = ast_str_alloca(1024);
 	struct sockaddr_in udptldest = { 0, };
 	int debug;
@@ -6422,11 +6417,12 @@
 			p->t38.peercapability,
 			p->t38.jointcapability);
 	}
-	snprintf(v, sizeof(v), "v=0\r\n");
-	snprintf(o, sizeof(o), "o=root %d %d IN IP4 %s\r\n", p->sessionid, p->sessionversion, ast_inet_ntoa(udptldest.sin_addr));
-	snprintf(s, sizeof(s), "s=session\r\n");
-	snprintf(c, sizeof(c), "c=IN IP4 %s\r\n", ast_inet_ntoa(udptldest.sin_addr));
-	snprintf(t, sizeof(t), "t=0 0\r\n");
+	ast_str_append(&m_modem, 0, "v=0\r\n");
+	ast_str_append(&m_modem, 0, "o=root %d %d IN IP4 %s\r\n", p->sessionid, p->sessionversion, ast_inet_ntoa(udptldest.sin_addr));
+	ast_str_append(&m_modem, 0, "s=session\r\n");
+	ast_str_append(&m_modem, 0, "c=IN IP4 %s\r\n", ast_inet_ntoa(udptldest.sin_addr));
+	ast_str_append(&m_modem, 0, "t=0 0\r\n");
+
 	ast_str_append(&m_modem, 0, "m=image %d udptl t38\r\n", ntohs(udptldest.sin_port));
 	
 	if ((p->t38.jointcapability & T38FAX_VERSION) == T38FAX_VERSION_0)
@@ -6444,15 +6440,9 @@
 	ast_str_append(&a_modem, 0, "a=T38FaxMaxDatagram:%d\r\n",x);
 	if (p->t38.jointcapability != T38FAX_UDP_EC_NONE)
 		ast_str_append(&a_modem, 0, "a=T38FaxUdpEC:%s\r\n", (p->t38.jointcapability & T38FAX_UDP_EC_REDUNDANCY) ? "t38UDPRedundancy" : "t38UDPFEC");
-	if (p->udptl)	/* XXX not sure, maybe unconditional ? */
-		len = m_modem->used + a_modem->used;
+	len = m_modem->used + a_modem->used;
 	add_header(resp, "Content-Type", "application/sdp");
 	add_header_contentLength(resp, len);
-	add_line(resp, v);
-	add_line(resp, o);
-	add_line(resp, s);
-	add_line(resp, c);
-	add_line(resp, t);
 	add_line(resp, m_modem->str);
 	add_line(resp, a_modem->str);
 	



More information about the asterisk-commits mailing list