Skip to content

Commit

Permalink
- UA: don't create a NonInviteServerTransaction for CANCEL (fixes #248).
Browse files Browse the repository at this point in the history
- UA: add UA.data={} attribute.
- UA: connect() returns now a Boolean indicating whether the start action takes place or not.
  • Loading branch information
ibc committed Sep 26, 2014
1 parent f9ef522 commit 177f38d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/UA.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ UA = function(configuration) {
ict: {}
};

// Custom UA empty object for high level use
this.data = {};

this.transportRecoverAttempts = 0;
this.transportRecoveryTimer = null;

Expand Down Expand Up @@ -314,7 +317,7 @@ UA.prototype.stop = function() {
/**
* Connect to the WS server if status = STATUS_INIT.
* Resume UA after being closed.
*
* @returns {Boolean} true if the start action takes place, false otherwise
*/
UA.prototype.start = function() {
var server;
Expand All @@ -324,14 +327,18 @@ UA.prototype.start = function() {
if (this.status === C.STATUS_INIT) {
server = this.getNextWsServer();
new JsSIP.Transport(this, server);
return true;
} else if(this.status === C.STATUS_USER_CLOSED) {
this.logger.log('resuming');
this.status = C.STATUS_READY;
this.transport.connect();
return true;
} else if (this.status === C.STATUS_READY) {
this.logger.log('UA is in READY status, not resuming');
return false;
} else {
this.logger.error('Connection is down. Auto-Recovery system is trying to connect');
return false;
}
};

Expand Down Expand Up @@ -508,7 +515,7 @@ UA.prototype.newTransaction = function(transaction) {


/**
* new Transaction
* Transaction destroyed.
* @private
* @param {JsSIP.Transaction} transaction.
*/
Expand Down Expand Up @@ -556,7 +563,7 @@ UA.prototype.receiveRequest = function(request) {
// Create the server transaction
if(method === JsSIP.C.INVITE) {
new JsSIP.Transactions.InviteServerTransaction(request, this);
} else if(method !== JsSIP.C.ACK) {
} else if(method !== JsSIP.C.ACK && method !== JsSIP.C.CANCEL) {
new JsSIP.Transactions.NonInviteServerTransaction(request, this);
}

Expand Down

0 comments on commit 177f38d

Please sign in to comment.