Skip to content

Commit

Permalink
Fixed Contact and Record-Route header split.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmillan committed Nov 14, 2012
1 parent 07a082c commit 0e8c5cf
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/Parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,14 @@ JsSIP.Parser = (function() {
}
break;
case 'record-route':
header = header_value.split(',');
header = header_value.match(/([^\"\',]*((\'[^\']*\')*||(\"[^\"]*\")*))+/gm);
length = header.length;
parsed = 0;

for(idx=0; idx < length; idx++) {
message.addHeader('record-route', header[idx]);
if (header[idx].length > 0) {
message.addHeader('record-route', header[idx]);
}
}
break;
case 'call-id':
Expand All @@ -105,12 +107,17 @@ JsSIP.Parser = (function() {
break;
case 'contact':
case 'm':
header = header_value.split(',');
header = header_value.match(/([^\"\',]*((\'[^\']*\')*||(\"[^\"]*\")*))+/gm);
length = header.length;

for(idx=0; idx < length; idx++) {
message.addHeader('contact', header[idx]);
parsed = message.parseHeader('contact', idx);
if (header[idx].length > 0) {
message.addHeader('contact', header[idx]);
parsed = message.parseHeader('contact', idx);
if (parsed === undefined) {
break;
}
}
}
break;
case 'content-length':
Expand Down

0 comments on commit 0e8c5cf

Please sign in to comment.