implement release-media and anchor-media operations

This commit is contained in:
Dave Horton
2021-10-10 12:56:44 -04:00
parent 9f158a8cf7
commit 4627c0fa54
7 changed files with 137 additions and 4801 deletions

View File

@@ -927,14 +927,25 @@ class CallSession extends Emitter {
}
async releaseMediaToSBC(remoteSdp) {
assert(this.dlg);
assert(this.dlg.connected);
assert(this.ep);
assert(typeof remoteSdp === 'string');
await this.dlg.modify(remoteSdp);
assert(this.dlg && this.dlg.connected && this.ep && typeof remoteSdp === 'string');
await this.dlg.modify(remoteSdp, {
headers: {
'X-Reason': 'release-media'
}
});
this.ep.destroy()
.then(() => this.ep = null)
.catch((err) => this.logger.error({err}, 'releaseMediaToSBC: Error destroying endpoint'));
.catch((err) => this.logger.error({err}, 'CallSession:releaseMediaToSBC: Error destroying endpoint'));
}
async reAnchorMedia() {
assert(this.dlg && this.dlg.connected && !this.ep);
this.ep = await this.ms.createEndpoint({remoteSdp: this.dlg.remote.sdp});
await this.dlg.modify(this.ep.local.sdp, {
headers: {
'X-Reason': 'anchor-media'
}
});
}
/**