Skip to content

Commit

Permalink
JsSIP.URI.toAor() now accepts 'show_port' param. When true the port i…
Browse files Browse the repository at this point in the history
…s added to the resulting string (if there is port).
  • Loading branch information
ibc committed Feb 14, 2013
1 parent eb1f26f commit 7211bde
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions qunitjs/javascript/test-URI.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ test('JsSIP.URI', function() {
deepEqual(uri.headers, {});
strictEqual(uri.toString(), 'sip:[email protected]:6060');
strictEqual(uri.toAor(), 'sip:[email protected]');
strictEqual(uri.toAor(false), 'sip:[email protected]');
strictEqual(uri.toAor(true), 'sip:[email protected]:6060');

uri.scheme = 'SIPS';
strictEqual(uri.scheme, 'sips');
Expand Down
5 changes: 4 additions & 1 deletion src/URI.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,17 @@ JsSIP.URI.prototype = {

return uri;
},
toAor: function(){
toAor: function(show_port){
var aor;

aor = this.scheme + ':';
if (this.user) {
aor += JsSIP.Utils.escapeUser(this.user) + '@';
}
aor += this.host;
if (show_port && (this.port || this.port === 0)) {
aor += ':' + this.port;
}

return aor;
}
Expand Down

0 comments on commit 7211bde

Please sign in to comment.