From 1ab6df38df92aa14f66eae2a20a894651f41c513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Baz=20Castillo?= Date: Thu, 14 Feb 2013 20:59:23 +0100 Subject: [PATCH] New method JsSIP.NameAddrHeader.parse() which returns a JsSIP.NameAddrHeader instance. --- src/NameAddrHeader.js | 17 +++++++++++++++++ src/URI.js | 2 ++ 2 files changed, 19 insertions(+) diff --git a/src/NameAddrHeader.js b/src/NameAddrHeader.js index b2caf83a8..58c13c576 100644 --- a/src/NameAddrHeader.js +++ b/src/NameAddrHeader.js @@ -86,4 +86,21 @@ JsSIP.NameAddrHeader.prototype = { return body; } +}; + + +/** + * Parse the given string and returns a JsSIP.NameAddrHeader instance or undefined if + * it is an invalid NameAddrHeader. + * @public + * @param {String} name_addr_header + */ +JsSIP.NameAddrHeader.parse = function(name_addr_header) { + name_addr_header = JsSIP.Grammar.parse(name_addr_header,'Name_Addr_Header'); + + if (name_addr_header !== -1) { + return name_addr_header; + } else { + return undefined; + } }; \ No newline at end of file diff --git a/src/URI.js b/src/URI.js index 578880e30..2432debff 100644 --- a/src/URI.js +++ b/src/URI.js @@ -52,6 +52,7 @@ JsSIP.URI = function(scheme, user, host, port, parameters, headers) { host = value.toLowerCase(); } }, + port: { get: function(){ return port; }, set: function(value){ @@ -163,6 +164,7 @@ JsSIP.URI.prototype = { return uri; }, + toAor: function(show_port){ var aor;