more queue fixes

This commit is contained in:
Dave Horton
2020-05-07 13:28:41 -04:00
parent a0508a2494
commit 1d9658905f
7 changed files with 72 additions and 25 deletions

View File

@@ -1,7 +1,7 @@
const Task = require('./task');
const Emitter = require('events');
const ConfirmCallSession = require('../session/confirm-call-session');
const {TaskName, TaskPreconditions} = require('../utils/constants');
const {TaskName, TaskPreconditions, BONG_TONE} = require('../utils/constants');
const normalizeJambones = require('../utils/normalize-jambones');
const makeTask = require('./make_task');
const bent = require('bent');
@@ -58,6 +58,11 @@ class Conference extends Task {
this.emitter = new Emitter();
this.results = {};
// transferred from another server in order to bridge to a local caller?
if (this.data._ && this.data._.connectTime) {
this.connectTime = this.data._.connectTime;
}
}
get name() { return TaskName.Conference; }
@@ -66,6 +71,11 @@ class Conference extends Task {
await super.exec(cs);
this.ep = ep;
const dlg = cs.dlg;
// reset answer time if we were transferred from another feature server
if (this.this.connectTime) dlg.connectTime = this.connectTime;
this.ep.on('destroy', this._kicked.bind(this, cs, dlg));
try {
@@ -238,7 +248,9 @@ class Conference extends Task {
localServer: cs.srf.locals.localSipAddress,
confServer: this.joinDetails.conferenceSipAddress
}, `Conference:_doJoin: conference ${this.confName} is hosted elsewhere`);
const success = await this.transferCallToFeatureServer(cs, this.joinDetails.conferenceSipAddress);
const success = await this.transferCallToFeatureServer(cs, this.joinDetails.conferenceSipAddress, {
connectTime: dlg.connectTime.valueOf()
});
/**
* If the REFER succeeded, we will get a BYE from the SBC
@@ -334,7 +346,7 @@ class Conference extends Task {
// optionally play beep to conference on entry
if (this.beep === true) {
this.ep.api('conference',
[this.confName, 'play', 'tone_stream://v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)'])
[this.confName, 'play', BONG_TONE])
.catch((err) => {});
}