[asterisk-commits] oej: trunk r89282 - in /trunk: ./ channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Nov 15 05:27:20 CST 2007
Author: oej
Date: Thu Nov 15 05:27:19 2007
New Revision: 89282
URL: http://svn.digium.com/view/asterisk?view=rev&rev=89282
Log:
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
........
Modified:
trunk/ (props changed)
trunk/channels/chan_sip.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=89282&r1=89281&r2=89282
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu Nov 15 05:27:19 2007
@@ -5444,6 +5444,8 @@
char *boundary;
unsigned int x;
int boundaryisquoted = FALSE;
+ int found_application_sdp = FALSE;
+ int found_end_of_headers = FALSE;
content_type = get_header(req, "Content-Type");
@@ -5476,31 +5478,36 @@
at the beginning */
boundary = ast_strdupa(search - 2);
boundary[0] = boundary[1] = '-';
-
/* Remove final quote */
if (boundaryisquoted)
boundary[strlen(boundary) - 1] = '\0';
- /* search for the boundary marker, but stop when there are not enough
- lines left for it, the Content-Type header and at least one line of
- body */
- for (x = 0; x < (req->lines - 2); x++) {
- if (!strncasecmp(req->line[x], boundary, strlen(boundary)) &&
- !strcasecmp(req->line[x + 1], "Content-Type: application/sdp")) {
- x += 2;
- req->sdp_start = x;
-
- /* search for the end of the body part */
- for ( ; x < req->lines; x++) {
- if (!strncasecmp(req->line[x], boundary, strlen(boundary)))
- break;
+ /* search for the boundary marker, the empty line delimiting headers from
+ sdp part and the end boundry if it exists */
+
+ for (x = 0; x < (req->lines ); x++) {
+ if(!strncasecmp(req->line[x], boundary, strlen(boundary))){
+ if(found_application_sdp && found_end_of_headers){
+ req->sdp_end = x-1;
+ return 1;
}
- req->sdp_end = x;
- return 1;
- }
- }
-
- return 0;
+ found_application_sdp = FALSE;
+ }
+ if(!strcasecmp(req->line[x], "Content-Type: application/sdp"))
+ 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;
+ }
+ }
+ }
+ if(found_application_sdp && found_end_of_headers) {
+ req->sdp_end = x;
+ return TRUE;
+ }
+ return FALSE;
}
/*! \brief Process SIP SDP offer, select formats and activate RTP channels
More information about the asterisk-commits
mailing list