Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
davehorton committed Nov 19, 2024
1 parent 1e675d6 commit 88a2503
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
5 changes: 0 additions & 5 deletions lib/session/call-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -1591,10 +1591,6 @@ Duration=${duration} `
}

async _lccMediaPath(desiredPath) {

this.logger.debug(`CallSession:_lccMediaPath - desired path is ${desiredPath}`);

// only valid in a Dial verb
const task = this.currentTask;
if (!task || task.name !== TaskName.Dial) {
return this.logger.info('CallSession:_lccMediaPath - invalid command since we are not in a dial verb');
Expand Down Expand Up @@ -2556,7 +2552,6 @@ Duration=${duration} `
});

if (currentMediaRoute === MediaPath.NoMedia) {
this.logger.debug('CallSession:reAnchorMedia: repoint endpoint after no media');
await this.ep.modify(this.dlg.remote.sdp);
}
}
Expand Down
24 changes: 18 additions & 6 deletions lib/tasks/dial.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@ class TaskDial extends Task {
this.boostAudioSignal = this.data.boostAudioSignal;
this._mediaPath = MediaPath.FullMedia;

if (this.data.anchorMedia && this.data.exitMediaPath) {
this.logger.info('Dial: incompatible anchorMedia and exitMediaPath are both set, will obey anchorMedia');
delete this.data.exitMediaPath;
}
if (!this.canReleaseMedia && this.data.exitMediaPath) {
this.logger.info(
'Dial: Warning: exitMediaPath is set so features such as transcribe and record will be disabled on this call');
}

if (this.dtmfHook) {
const {parentDtmfCollector, childDtmfCollector} = parseDtmfOptions(logger, this.data.dtmfCapture || {});
if (parentDtmfCollector) {
Expand Down Expand Up @@ -885,29 +894,33 @@ class TaskDial extends Task {
async updateMediaPath(desiredPath) {
this.logger.info(`Dial:updateMediaPath - ${this._mediaPath} => ${desiredPath}`);
switch (desiredPath) {
case 'no-media':
case MediaPath.NoMedia:
assert(this._mediaPath !== MediaPath.NoMedia, 'updateMediaPath: already no-media');
await this._releaseMedia(this.cs, this.sd, true);
this._mediaPath = MediaPath.NoMedia;
break;
case 'partial-media':

case MediaPath.PartialMedia:
assert(this._mediaPath !== MediaPath.PartialMedia, 'updateMediaPath: already partial-media');
if (this._mediaPath === MediaPath.FullMedia) {
await this._releaseMedia(this.cs, this.sd, false);
}
else {
// to go from no-media to partial-media we need to go through full-media first
await this.reAnchorMedia(this.cs, this.sd);
await this._releaseMedia(this.cs, this.sd, false);
}
assert(!this.epOther, 'updateMediaPath: epOther should be null');
assert(!this.ep, 'updateMediaPath: ep should be null');
this._mediaPath = MediaPath.PartialMedia;

break;
case 'full-media':
case MediaPath.FullMedia:
assert(this._mediaPath !== MediaPath.FullMedia, 'updateMediaPath: already full-media');
await this.reAnchorMedia(this.cs, this.sd);
this._mediaPath = MediaPath.FullMedia;
break;

default:
assert(false, `updateMediaPath: invalid path request ${desiredPath}`);
}
Expand All @@ -928,9 +941,8 @@ class TaskDial extends Task {
const bLegSdp = sd.dlg.remote.sdp;
await cs.releaseMediaToSBC(bLegSdp, releaseEntirely);
this.epOther = null;
this.logger.info('Dial:_releaseMedia - successfully released media from freewitch');
assert(!this.epOther, 'Dial:_releaseMedia - epOther should be null');
assert(!this.ep, 'Dial:_releaseMedia - ep should be null');
this.logger.info(
`Dial:_releaseMedia - successfully released media from freewitch, media path is now ${this._mediaPath}`);
this._mediaPath = releaseEntirely ? MediaPath.NoMedia : MediaPath.PartialMedia;
} catch (err) {
this.logger.info({err}, 'Dial:_releaseMedia error');
Expand Down

0 comments on commit 88a2503

Please sign in to comment.