initial WIP to remove freeswitch from media path when not recording or transcribing dial calls

This commit is contained in:
Dave Horton
2021-10-08 16:21:47 -04:00
parent bedf25c6a2
commit 9f158a8cf7
4 changed files with 55 additions and 8 deletions

View File

@@ -62,6 +62,7 @@ class SingleDialer extends Emitter {
opts = opts || {};
opts.headers = opts.headers || {};
opts.headers = {...opts.headers, 'X-Call-Sid': this.callSid};
this.ms = ms;
let uri, to;
try {
switch (this.target.type) {
@@ -313,6 +314,17 @@ class SingleDialer extends Emitter {
return cs;
}
async releaseMediaToSBC(remoteSdp) {
assert(this.dlg);
assert(this.dlg.connected);
assert(this.ep);
assert(typeof remoteSdp === 'string');
await this.dlg.modify(remoteSdp);
this.ep.destroy()
.then(() => this.ep = null)
.catch((err) => this.logger.error({err}, 'releaseMediaToSBC: Error destroying endpoint'));
}
_notifyCallStatusChange({callStatus, sipStatus, duration}) {
assert((typeof duration === 'number' && callStatus === CallStatus.Completed) ||
(!duration && callStatus !== CallStatus.Completed),