From 351ca06a9830afa9349f4ab5d02250f138665325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Mill=C3=A1n?= Date: Fri, 23 Nov 2012 11:41:10 +0100 Subject: [PATCH] Fix Contact header aggregation for incoming messages --- src/Parser.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Parser.js b/src/Parser.js index e0a76e810..3897c46d2 100644 --- a/src/Parser.js +++ b/src/Parser.js @@ -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(); @@ -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; }