Skip to content
Permalink
Browse files

Make RTCSession local_identity and remote_identity NameAddrHeader ins…

…tances
  • Loading branch information
jmillan committed Mar 18, 2013
1 parent ffb4aab commit 3f84b30ac2702cce2e259158851189f7c7bc87c8
Showing with 10 additions and 8 deletions.
  1. +8 −8 src/RTCSession.js
  2. +2 −0 src/SIPMessage.js
@@ -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);
@@ -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, {
@@ -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
@@ -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

0 comments on commit 3f84b30

Please sign in to comment.
You can’t perform that action at this time.