Skip to content

Commit 3f84b30

Browse files
committed
Make RTCSession local_identity and remote_identity NameAddrHeader instances
1 parent ffb4aab commit 3f84b30

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/RTCSession.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ RTCSession.prototype.connect = function(target, options) {
540540
//Save the session into the ua sessions collection.
541541
this.ua.sessions[this.id] = this;
542542

543-
this.newRTCSession('local', this.request, target);
543+
this.newRTCSession('local', this.request);
544544

545545
if (invalidTarget) {
546546
this.failed('local', null, JsSIP.C.causes.INVALID_TARGET);
@@ -968,18 +968,18 @@ RTCSession.prototype.onRequestTimeout = function() {
968968
/**
969969
* @private
970970
*/
971-
RTCSession.prototype.newRTCSession = function(originator, request, target) {
971+
RTCSession.prototype.newRTCSession = function(originator, request) {
972972
var session = this,
973973
event_name = 'newRTCSession';
974974

975-
session.direction = (originator === 'local') ? 'outgoing' : 'incoming';
976-
977975
if (originator === 'remote') {
978-
session.local_identity = request.to.uri;
979-
session.remote_identity = request.from.uri;
976+
session.direction = 'incoming';
977+
session.local_identity = request.to;
978+
session.remote_identity = request.from;
980979
} else if (originator === 'local'){
981-
session.local_identity = session.ua.configuration.uri;
982-
session.remote_identity = target;
980+
session.direction = 'outgoing';
981+
session.local_identity = request.from;
982+
session.remote_identity = request.to;
983983
}
984984

985985
session.ua.emit(event_name, session.ua, {

src/SIPMessage.js

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ OutgoingRequest = function(method, ruri, ua, params, extraHeaders, body) {
6262
to = (params.to_display_name || params.to_display_name === 0) ? '"' + params.to_display_name + '" ' : '';
6363
to += '<' + (params.to_uri || ruri) + '>';
6464
to += params.to_tag ? ';tag=' + params.to_tag : '';
65+
this.to = new JsSIP.NameAddrHeader.parse(to);
6566
this.setHeader('to', to);
6667

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

7981
// Call-ID

0 commit comments

Comments
 (0)