Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
CHANGELOG
=========

### NEXT


* Dialog/RequestSender: Avoid circular dependency (#788).


### 3.9.3


Expand Down
12 changes: 10 additions & 2 deletions lib/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ const logger = new Logger('Dialog');

const C = {
// Dialog states.
STATUS_EARLY : 1,
STATUS_CONFIRMED : 2
STATUS_EARLY : 1,
STATUS_CONFIRMED : 2,
STATUS_TERMINATED : 3
};

// RFC 3261 12.1.
Expand Down Expand Up @@ -125,6 +126,11 @@ module.exports = class Dialog
return this._uas_pending_reply;
}

isTerminated()
{
return this._status === C.STATUS_TERMINATED;
}

update(message, type)
{
this._state = C.STATUS_CONFIRMED;
Expand All @@ -141,7 +147,9 @@ module.exports = class Dialog
terminate()
{
logger.debug(`dialog ${this._id.toString()} deleted`);

this._ua.destroyDialog(this);
this._state = C.STATUS_TERMINATED;
}

sendRequest(method, options = {})
Expand Down
4 changes: 1 addition & 3 deletions lib/Dialog/RequestSender.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const JsSIP_C = require('../Constants');
const Transactions = require('../Transactions');
const RTCSession = require('../RTCSession');
const RequestSender = require('../RequestSender');

// Default event handlers.
Expand Down Expand Up @@ -114,8 +113,7 @@ module.exports = class DialogRequestSender
this._request.cseq = this._dialog.local_seqnum += 1;
this._reattemptTimer = setTimeout(() =>
{
// TODO: look at dialog state instead.
if (this._dialog.owner.status !== RTCSession.C.STATUS_TERMINATED)
if (!this._dialog.isTerminated())
{
this._reattempt = true;
this.send();
Expand Down