mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
bugfix #30 - outdial race condition for quick caller cancel scenario
This commit is contained in:
@@ -109,6 +109,16 @@ class SingleDialer extends Emitter {
|
||||
this.ep = await ms.createEndpoint();
|
||||
this.logger.debug(`SingleDialer:exec - created endpoint ${this.ep.uuid}`);
|
||||
|
||||
/**
|
||||
* were we killed whilst we were off getting an endpoint ?
|
||||
* https://github.com/jambonz/jambonz-feature-server/issues/30
|
||||
*/
|
||||
if (this.killed) {
|
||||
this.logger.info('SingleDialer:exec got quick CANCEL from caller, abort outdial');
|
||||
this.ep.destroy()
|
||||
.catch((err) => this.logger.error({err}, 'Error destroying endpoint'));
|
||||
return;
|
||||
}
|
||||
let lastSdp;
|
||||
const connectStream = async(remoteSdp) => {
|
||||
if (remoteSdp === lastSdp) return;
|
||||
@@ -210,6 +220,7 @@ class SingleDialer extends Emitter {
|
||||
* kill the call in progress or the stable dialog, whichever we have
|
||||
*/
|
||||
async kill() {
|
||||
this.killed = true;
|
||||
if (this.inviteInProgress) await this.inviteInProgress.cancel();
|
||||
else if (this.dlg && this.dlg.connected) {
|
||||
const duration = moment().diff(this.dlg.connectTime, 'seconds');
|
||||
|
||||
Reference in New Issue
Block a user