Skip to content
Snippets Groups Projects
Commit eecea326 authored by Olle Johansson's avatar Olle Johansson
Browse files

Don't add linefeed on received MESSAGE

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@116240 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent f07454f2
No related branches found
No related tags found
No related merge requests found
...@@ -2093,7 +2093,7 @@ static char *get_calleridname(const char *input, char *output, size_t outputsize ...@@ -2093,7 +2093,7 @@ static char *get_calleridname(const char *input, char *output, size_t outputsize
static int get_rpid_num(const char *input, char *output, int maxlen); 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_rdnis(struct sip_pvt *p, struct sip_request *oreq);
static int get_destination(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); static int transmit_state_notify(struct sip_pvt *p, int state, int full, int timeout);
   
/*--- Constructing requests and responses */ /*--- Constructing requests and responses */
...@@ -11997,7 +11997,7 @@ static int check_user(struct sip_pvt *p, struct sip_request *req, int sipmethod, ...@@ -11997,7 +11997,7 @@ static int check_user(struct sip_pvt *p, struct sip_request *req, int sipmethod,
} }
   
/*! \brief Get text out of a SIP MESSAGE packet */ /*! \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 x;
int y; int y;
...@@ -12006,12 +12006,12 @@ static int get_msg_text(char *buf, int len, struct sip_request *req) ...@@ -12006,12 +12006,12 @@ static int get_msg_text(char *buf, int len, struct sip_request *req)
y = len - strlen(buf) - 5; y = len - strlen(buf) - 5;
if (y < 0) if (y < 0)
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 */ strncat(buf, req->line[x], y); /* safe */
y -= strlen(req->line[x]) + 1; y -= strlen(req->line[x]) + 1;
if (y < 0) if (y < 0)
y = 0; y = 0;
if (y != 0) if (y != 0 && addnewline)
strcat(buf, "\n"); /* safe */ strcat(buf, "\n"); /* safe */
} }
return 0; return 0;
...@@ -12034,7 +12034,7 @@ static void receive_message(struct sip_pvt *p, struct sip_request *req) ...@@ -12034,7 +12034,7 @@ static void receive_message(struct sip_pvt *p, struct sip_request *req)
return; 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); ast_log(LOG_WARNING, "Unable to retrieve text from %s\n", p->callid);
transmit_response(p, "202 Accepted", req); transmit_response(p, "202 Accepted", req);
if (!p->owner) if (!p->owner)
...@@ -14654,7 +14654,7 @@ static void handle_request_info(struct sip_pvt *p, struct sip_request *req) ...@@ -14654,7 +14654,7 @@ static void handle_request_info(struct sip_pvt *p, struct sip_request *req)
return; return;
} }
   
get_msg_text(buf, sizeof(buf), req); get_msg_text(buf, sizeof(buf), req, TRUE);
duration = 100; /* 100 ms */ duration = 100; /* 100 ms */
   
if (ast_strlen_zero(buf)) { if (ast_strlen_zero(buf)) {
...@@ -16936,7 +16936,7 @@ static int handle_request_notify(struct sip_pvt *p, struct sip_request *req, str ...@@ -16936,7 +16936,7 @@ static int handle_request_notify(struct sip_pvt *p, struct sip_request *req, str
} }
   
/* Get the text of the attachment */ /* 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); ast_log(LOG_WARNING, "Unable to retrieve attachment from NOTIFY %s\n", p->callid);
transmit_response(p, "400 Bad request", req); transmit_response(p, "400 Bad request", req);
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT); sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment