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
17 changes: 15 additions & 2 deletions dist/jssip.js
Original file line number Diff line number Diff line change
Expand Up @@ -15728,7 +15728,16 @@ module.exports = /*#__PURE__*/function (_EventEmitter) {
key: "sendRequest",
value: function sendRequest(method, options) {
logger.debug('sendRequest()');
return this._dialog.sendRequest(method, options);
if (this._dialog) {
return this._dialog.sendRequest(method, options);
} else {
var dialogsArray = Object.values(this._earlyDialogs);
if (dialogsArray.length > 0) {
return dialogsArray[0].sendRequest(method, options);
}
logger.warn('No valid early dialog found to send request');
return;
}
}

/**
Expand Down Expand Up @@ -16215,6 +16224,10 @@ module.exports = /*#__PURE__*/function (_EventEmitter) {
if (early_dialog) {
early_dialog.update(message, type);
this._dialog = early_dialog;
// When an early dialog is promoted to a confirmed dialog (e.g., after calling an IVR menu),
// the local CSeq must be synchronized
// with the value from the 200 OK response to keep the dialog sequence in sync.
this._dialog._local_seqnum = message.cseq;
delete this._earlyDialogs[id];
return true;
}
Expand Down Expand Up @@ -17565,7 +17578,7 @@ module.exports = /*#__PURE__*/function (_EventEmitter) {
this._direction = 'outgoing';

// Check RTCSession Status.
if (this._session.status !== this._session.C.STATUS_CONFIRMED && this._session.status !== this._session.C.STATUS_WAITING_FOR_ACK) {
if (this._session.status !== this._session.C.STATUS_CONFIRMED && this._session.status !== this._session.C.STATUS_WAITING_FOR_ACK && this._session.status !== this._session.C.STATUS_1XX_RECEIVED) {
throw new Exceptions.InvalidStateError(this._session.status);
}
var extraHeaders = Utils.cloneArray(options.extraHeaders);
Expand Down
2 changes: 1 addition & 1 deletion dist/jssip.min.js

Large diffs are not rendered by default.

22 changes: 21 additions & 1 deletion lib/RTCSession.js
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,23 @@ module.exports = class RTCSession extends EventEmitter
{
logger.debug('sendRequest()');

return this._dialog.sendRequest(method, options);
if (this._dialog)
{
return this._dialog.sendRequest(method, options);
}
else
{
const dialogsArray = Object.values(this._earlyDialogs);

if (dialogsArray.length > 0)
{
return dialogsArray[0].sendRequest(method, options);
}

logger.warn('No valid early dialog found to send request');

return;
}
}

/**
Expand Down Expand Up @@ -2060,6 +2076,10 @@ module.exports = class RTCSession extends EventEmitter
{
early_dialog.update(message, type);
this._dialog = early_dialog;
// When an early dialog is promoted to a confirmed dialog (e.g., after calling an IVR menu),
// the local CSeq must be synchronized
// with the value from the 200 OK response to keep the dialog sequence in sync.
this._dialog._local_seqnum = message.cseq;
delete this._earlyDialogs[id];

return true;
Expand Down
7 changes: 5 additions & 2 deletions lib/RTCSession/DTMF.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ module.exports = class DTMF extends EventEmitter
this._direction = 'outgoing';

// Check RTCSession Status.
if (this._session.status !== this._session.C.STATUS_CONFIRMED &&
this._session.status !== this._session.C.STATUS_WAITING_FOR_ACK)
if (
this._session.status !== this._session.C.STATUS_CONFIRMED &&
this._session.status !== this._session.C.STATUS_WAITING_FOR_ACK &&
this._session.status !== this._session.C.STATUS_1XX_RECEIVED
)
{
throw new Exceptions.InvalidStateError(this._session.status);
}
Expand Down