Skip to content

Commit

Permalink
Fix Contact header aggregation for incoming messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jmillan committed Nov 23, 2012
1 parent f7e66da commit 351ca06
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ JsSIP.Parser = (function() {

/** @private */
function parseHeader(message, msg, header_start, header_end) {
var header, length, idx, parsed,
var header, length, idx, parsed, count,
hcolonIndex = msg.indexOf(':', header_start),
header_name = msg.substring(header_start, hcolonIndex).trim(),
header_value = msg.substring(hcolonIndex + 1, header_end).trim();
Expand Down Expand Up @@ -103,11 +103,13 @@ JsSIP.Parser = (function() {
case 'm':
header = header_value.match(/([^\"\',]*((\'[^\']*\')*||(\"[^\"]*\")*))+/gm);
length = header.length;
count = 0;

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

0 comments on commit 351ca06

Please sign in to comment.