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

Merged revisions 89280 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r89280 | oej | 2007-11-15 12:15:09 +0100 (Tor, 15 Nov 2007) | 5 lines

Improve support for multipart messages. Code by gasparz, changes
by me (mostly formatting). Thanks, gasparz!

Closes issue #10947

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89282 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 257b4fb4
No related branches found
No related tags found
No related merge requests found
...@@ -5444,6 +5444,8 @@ static int find_sdp(struct sip_request *req) ...@@ -5444,6 +5444,8 @@ static int find_sdp(struct sip_request *req)
char *boundary; char *boundary;
unsigned int x; unsigned int x;
int boundaryisquoted = FALSE; int boundaryisquoted = FALSE;
int found_application_sdp = FALSE;
int found_end_of_headers = FALSE;
   
content_type = get_header(req, "Content-Type"); content_type = get_header(req, "Content-Type");
   
...@@ -5476,31 +5478,36 @@ static int find_sdp(struct sip_request *req) ...@@ -5476,31 +5478,36 @@ static int find_sdp(struct sip_request *req)
at the beginning */ at the beginning */
boundary = ast_strdupa(search - 2); boundary = ast_strdupa(search - 2);
boundary[0] = boundary[1] = '-'; boundary[0] = boundary[1] = '-';
/* Remove final quote */ /* Remove final quote */
if (boundaryisquoted) if (boundaryisquoted)
boundary[strlen(boundary) - 1] = '\0'; boundary[strlen(boundary) - 1] = '\0';
   
/* search for the boundary marker, but stop when there are not enough /* search for the boundary marker, the empty line delimiting headers from
lines left for it, the Content-Type header and at least one line of sdp part and the end boundry if it exists */
body */
for (x = 0; x < (req->lines - 2); x++) { for (x = 0; x < (req->lines ); x++) {
if (!strncasecmp(req->line[x], boundary, strlen(boundary)) && if(!strncasecmp(req->line[x], boundary, strlen(boundary))){
!strcasecmp(req->line[x + 1], "Content-Type: application/sdp")) { if(found_application_sdp && found_end_of_headers){
x += 2; req->sdp_end = x-1;
req->sdp_start = x; return 1;
}
/* search for the end of the body part */ found_application_sdp = FALSE;
for ( ; x < req->lines; x++) { }
if (!strncasecmp(req->line[x], boundary, strlen(boundary))) if(!strcasecmp(req->line[x], "Content-Type: application/sdp"))
break; found_application_sdp = TRUE;
if(strlen(req->line[x]) == 0 ){
if(found_application_sdp && !found_end_of_headers){
req->sdp_start = x;
found_end_of_headers = TRUE;
} }
req->sdp_end = x;
return 1;
} }
} }
if(found_application_sdp && found_end_of_headers) {
return 0; req->sdp_end = x;
return TRUE;
}
return FALSE;
} }
   
/*! \brief Process SIP SDP offer, select formats and activate RTP channels /*! \brief Process SIP SDP offer, select formats and activate RTP channels
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment