INFO request timeout leads to BYE and session termination
Steps to reproduce:
- Send INFO request with
RTCSession::sendInfo - Result of request is one of the following:
- "SIP/2.0 408 Request Timeout" response
- No response after
Timers.TIMER_Ftimeout
Actual Result:
jssip sends BYE request and terminates the session.
Expected Result:
session is not terminated due to INFO request timeout.
According to https://datatracker.ietf.org/doc/html/rfc5057#section-5.1 timeout response or timeout of transaction is considered as "Transaction Only" failure and should not destroy the dialog.
This might be related to fix of the following issue on "Request Timeout" BYE is not sent
Seems like just rewriting the behaviour for timeout for Info.js and DTMF.js would be needed.
Could you test this patch?
diff --git a/lib/RTCSession/Info.js b/lib/RTCSession/Info.js
index c331c35..dd4fedd 100644
--- a/lib/RTCSession/Info.js
+++ b/lib/RTCSession/Info.js
@@ -77,7 +77,10 @@ module.exports = class Info extends EventEmitter
},
onRequestTimeout : () =>
{
- this._session.onRequestTimeout();
+ this.emit('failed', {
+ originator : 'remote',
+ response
+ });
},
onDialogError : () =>
{
~
~
Tested with patch below (set response to null, added cause) and it seems to work - no session termination after timeout, didn't notice other issues.
diff --git a/lib/RTCSession/Info.js b/lib/RTCSession/Info.js
index c331c35..5516f92 100644
--- a/lib/RTCSession/Info.js
+++ b/lib/RTCSession/Info.js
@@ -77,7 +77,11 @@ module.exports = class Info extends EventEmitter
},
onRequestTimeout : () =>
{
- this._session.onRequestTimeout();
+ this.emit('failed', {
+ originator : 'remote',
+ response : null,
+ cause : JsSIP_C.causes.REQUEST_TIMEOUT
+ });
},
onDialogError : () =>
{
I noticed that it will be not possible to handle this timeout on the consumer side. Maybe its worth to add some onTimeout to the options parameter of RTCSession::sendInfo method
I noticed that it will be not possible to handle this timeout on the consumer side.
Can you please be specific here?
Can you please be specific here?
When i, as a user of the jssip library, will use session.sendInfo method then it will be not possible for me to know when this request is considered timed out. As i understand the this.emit('failed' ... part is internal and cannot be handled by user.
But it's just a notice, not relevant to the bug, i think that it will be sufficient to have only changes that directly fix subject bug without adding any functionality like ability to handle timeouts.
this.emit('failed' ... part is internal and cannot be handled by user.
mm, it definitely should. sendInfo() should return the Info instance so the client can handle it's events..
Otherwise those events being emitted in Info are not handled by anyone in reality.
Let's keep this issue open. Feel free to create a PR where RTCSession.sendInfo() returns the Info instance.
Indeed there IS public API for it: https://jssip.net/documentation/api/session/#event_newInfo
RTCSession newInfo will fire with the Info instance. So you can:
session.once('newInfo', (info) => { info.on('failed', console.log)});
session.sendInfo();