Skip to content

Commit

Permalink
changes to go from no-media to full-media
Browse files Browse the repository at this point in the history
  • Loading branch information
davehorton committed Nov 18, 2024
1 parent 04e7be2 commit e6c7a7a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/call-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const {
makeFullMediaReleaseKey,
makePartnerFullMediaReleaseKey
} = require('./utils');
const { MediaPath } = require('./constants.json');
const {forwardInDialogRequests} = require('drachtio-fn-b2b-sugar');
const {SipError, stringifyUri, parseUri} = require('drachtio-srf');
const debug = require('debug')('jambonz:sbc-outbound');
Expand Down Expand Up @@ -132,7 +133,8 @@ class CallSession extends Emitter {
this.lookupSipGatewaysByCarrier = lookupSipGatewaysByCarrier;
this.lookupCarrierByAccountLcr = lookupCarrierByAccountLcr;

this._mediaReleased = false;
this._mediaPath = MediaPath.FullMedia;

this.recordingNoAnswerTimeout = (process.env.JAMBONES_RECORDING_NO_ANSWER_TIMEOUT || 2) * 1000;
}

Expand All @@ -153,7 +155,7 @@ class CallSession extends Emitter {
}

get isMediaReleased() {
return this._mediaReleased;
return this._mediaPath !== MediaPath.FullMedia;
}

subscribeForDTMF(dlg) {
Expand Down Expand Up @@ -847,7 +849,7 @@ Duration=${payload.duration} `
this.rtpEngineResource.destroy().catch((err) => {
this.logger.info({err}, 'Error destroying rtpengine resource after full media release');
});
this._fullMediaReleased = true;
this._mediaPath = MediaPath.NoMedia;
return;
}

Expand Down Expand Up @@ -878,7 +880,9 @@ Duration=${payload.duration} `
let sdp;
//HL 2024-11-13: previously forwarded re-invites to webrtc clients but further testing has shown to be unnecessary
//if (isReleasingMedia && !this.calleeIsUsingSrtp) {
if (isReleasingMedia) {

//DH 2024-11- 18: if we are going from no-media to either partial or full media, we need reinvite the far end
if (isReleasingMedia && this._mediaPath !== MediaPath.NoMedia) {
this.logger.info(`got a reinvite from FS to ${reason}`);
sdp = dlg.other.remote.sdp;
if (!answerMedia.flags.includes('port latching')) answerMedia.flags.push('port latching');
Expand Down
7 changes: 7 additions & 0 deletions lib/constants.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"MediaPath": {
"NoMedia": "no-media",
"PartialMedia": "partial-media",
"FullMedia": "full-media"
}
}

0 comments on commit e6c7a7a

Please sign in to comment.