Skip to content

Commit

Permalink
Make RTCSession local_identity and remote_identity NameAddrHeader ins…
Browse files Browse the repository at this point in the history
…tances
  • Loading branch information
jmillan committed Mar 18, 2013
1 parent ffb4aab commit 3f84b30
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/RTCSession.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ RTCSession.prototype.connect = function(target, options) {
//Save the session into the ua sessions collection.
this.ua.sessions[this.id] = this;

this.newRTCSession('local', this.request, target);
this.newRTCSession('local', this.request);

if (invalidTarget) {
this.failed('local', null, JsSIP.C.causes.INVALID_TARGET);
Expand Down Expand Up @@ -968,18 +968,18 @@ RTCSession.prototype.onRequestTimeout = function() {
/**
* @private
*/
RTCSession.prototype.newRTCSession = function(originator, request, target) {
RTCSession.prototype.newRTCSession = function(originator, request) {
var session = this,
event_name = 'newRTCSession';

session.direction = (originator === 'local') ? 'outgoing' : 'incoming';

if (originator === 'remote') {
session.local_identity = request.to.uri;
session.remote_identity = request.from.uri;
session.direction = 'incoming';
session.local_identity = request.to;
session.remote_identity = request.from;
} else if (originator === 'local'){
session.local_identity = session.ua.configuration.uri;
session.remote_identity = target;
session.direction = 'outgoing';
session.local_identity = request.from;
session.remote_identity = request.to;
}

session.ua.emit(event_name, session.ua, {
Expand Down
2 changes: 2 additions & 0 deletions src/SIPMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ OutgoingRequest = function(method, ruri, ua, params, extraHeaders, body) {
to = (params.to_display_name || params.to_display_name === 0) ? '"' + params.to_display_name + '" ' : '';
to += '<' + (params.to_uri || ruri) + '>';
to += params.to_tag ? ';tag=' + params.to_tag : '';
this.to = new JsSIP.NameAddrHeader.parse(to);
this.setHeader('to', to);

// From
Expand All @@ -74,6 +75,7 @@ OutgoingRequest = function(method, ruri, ua, params, extraHeaders, body) {
}
from += '<' + (params.from_uri || ua.configuration.uri) + '>;tag=';
from += params.from_tag || JsSIP.Utils.newTag();
this.from = new JsSIP.NameAddrHeader.parse(from);
this.setHeader('from', from);

// Call-ID
Expand Down

0 comments on commit 3f84b30

Please sign in to comment.