[svn-commits] oej: trunk r116240 - /trunk/channels/chan_sip.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed May 14 09:16:52 CDT 2008


Author: oej
Date: Wed May 14 09:16:51 2008
New Revision: 116240

URL: http://svn.digium.com/view/asterisk?view=rev&rev=116240
Log:
Don't add linefeed on received MESSAGE

Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=116240&r1=116239&r2=116240
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Wed May 14 09:16:51 2008
@@ -2093,7 +2093,7 @@
 static int get_rpid_num(const char *input, char *output, int maxlen);
 static int get_rdnis(struct sip_pvt *p, struct sip_request *oreq);
 static int get_destination(struct sip_pvt *p, struct sip_request *oreq);
-static int get_msg_text(char *buf, int len, struct sip_request *req);
+static int get_msg_text(char *buf, int len, struct sip_request *req, int addnewline);
 static int transmit_state_notify(struct sip_pvt *p, int state, int full, int timeout);
 
 /*--- Constructing requests and responses */
@@ -11997,7 +11997,7 @@
 }
 
 /*! \brief  Get text out of a SIP MESSAGE packet */
-static int get_msg_text(char *buf, int len, struct sip_request *req)
+static int get_msg_text(char *buf, int len, struct sip_request *req, int addnewline)
 {
 	int x;
 	int y;
@@ -12006,12 +12006,12 @@
 	y = len - strlen(buf) - 5;
 	if (y < 0)
 		y = 0;
-	for (x=0;x<req->lines;x++) {
+	for (x=0; x < req->lines; x++) {
 		strncat(buf, req->line[x], y); /* safe */
 		y -= strlen(req->line[x]) + 1;
 		if (y < 0)
 			y = 0;
-		if (y != 0)
+		if (y != 0 && addnewline)
 			strcat(buf, "\n"); /* safe */
 	}
 	return 0;
@@ -12034,7 +12034,7 @@
 		return;
 	}
 
-	if (get_msg_text(buf, sizeof(buf), req)) {
+	if (get_msg_text(buf, sizeof(buf), req, FALSE)) {
 		ast_log(LOG_WARNING, "Unable to retrieve text from %s\n", p->callid);
 		transmit_response(p, "202 Accepted", req);
 		if (!p->owner)
@@ -14654,7 +14654,7 @@
 			return;
 		}
 
-		get_msg_text(buf, sizeof(buf), req);
+		get_msg_text(buf, sizeof(buf), req, TRUE);
 		duration = 100; /* 100 ms */
 
 		if (ast_strlen_zero(buf)) {
@@ -16936,7 +16936,7 @@
 		}
 
 		/* Get the text of the attachment */
-		if (get_msg_text(buf, sizeof(buf), req)) {
+		if (get_msg_text(buf, sizeof(buf), req, TRUE)) {
 			ast_log(LOG_WARNING, "Unable to retrieve attachment from NOTIFY %s\n", p->callid);
 			transmit_response(p, "400 Bad request", req);
 			sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);




More information about the svn-commits mailing list