Skip to content

Commit

Permalink
ReferNotifier sendRequest ignored
Browse files Browse the repository at this point in the history
Scenario to be solved:
A is on communication with B
B transfers the call to C (blind transfer)
B hangups the call with A, when trying is received
C answers the call and the exception is triggered, killing the call

The exception is triggered whenever A is trying to notify B about the refer status.
  • Loading branch information
Miguel Nogueira committed Oct 22, 2024
1 parent fff94c5 commit d3dbde8
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions lib/RTCSession/ReferNotifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,23 @@ module.exports = class ReferNotifier
state = `active;expires=${this._expires}`;
}

// Put this in a try/catch block.
this._session.sendRequest(JsSIP_C.NOTIFY, {
extraHeaders : [
`Event: ${C.event_type};id=${this._id}`,
`Subscription-State: ${state}`,
`Content-Type: ${C.body_type}`
],
body : `SIP/2.0 ${code} ${reason}`,
eventHandlers : {
// If a negative response is received, subscription is canceled.
onErrorResponse() { this._active = false; }
}
});
try
{
this._session.sendRequest(JsSIP_C.NOTIFY, {
extraHeaders : [
`Event: ${C.event_type};id=${this._id}`,
`Subscription-State: ${state}`,
`Content-Type: ${C.body_type}`
],
body : `SIP/2.0 ${code} ${reason}`,
eventHandlers : {
// If a negative response is received, subscription is canceled.
onErrorResponse() { this._active = false; }
}
});
}
catch (e) {
logger.debug('sendRequest exception ignored', e);
}
}
};

0 comments on commit d3dbde8

Please sign in to comment.