This commit is contained in:
Dave Horton
2025-01-09 16:06:01 -05:00
parent 6bad1a22f3
commit f3690ef5ce
3 changed files with 14 additions and 5 deletions

View File

@@ -2814,14 +2814,15 @@ Duration=${duration} `
} }
} }
_configMsEndpoint() { _configMsEndpoint(sendSilenceOnIdle = true) {
this._enableInbandDtmfIfRequired(this.ep); this._enableInbandDtmfIfRequired(this.ep);
this.ep.once('destroy', this._handleMediaTimeout.bind(this)); this.ep.once('destroy', this._handleMediaTimeout.bind(this));
const opts = { const opts = {
...(this.onHoldMusic && {holdMusic: `shout://${this.onHoldMusic.replace(/^https?:\/\//, '')}`}), ...(this.onHoldMusic && {holdMusic: `shout://${this.onHoldMusic.replace(/^https?:\/\//, '')}`}),
...(JAMBONES_USE_FREESWITCH_TIMER_FD && {timer_name: 'timerfd'}), ...(JAMBONES_USE_FREESWITCH_TIMER_FD && {timer_name: 'timerfd'}),
...(JAMBONES_MEDIA_TIMEOUT_MS && {media_timeout: JAMBONES_MEDIA_TIMEOUT_MS}), ...(JAMBONES_MEDIA_TIMEOUT_MS && {media_timeout: JAMBONES_MEDIA_TIMEOUT_MS}),
...(JAMBONES_MEDIA_HOLD_TIMEOUT_MS && {media_hold_timeout: JAMBONES_MEDIA_HOLD_TIMEOUT_MS}) ...(JAMBONES_MEDIA_HOLD_TIMEOUT_MS && {media_hold_timeout: JAMBONES_MEDIA_HOLD_TIMEOUT_MS}),
...(sendSilenceOnIdle && {send_silence_when_idle: -1})
}; };
if (Object.keys(opts).length > 0) { if (Object.keys(opts).length > 0) {
this.ep.set(opts); this.ep.set(opts);

View File

@@ -748,6 +748,13 @@ class TaskDial extends Task {
if (this.epOther) { if (this.epOther) {
this.epOther.api('uuid_break', this.epOther.uuid); this.epOther.api('uuid_break', this.epOther.uuid);
this.epOther.bridge(sd.ep); this.epOther.bridge(sd.ep);
/**
* wait until the endpoints are bridged before apply the send_silence_when_idle
* audiocodes webrtc client somehow inserts massive latency if we send silence
* and then bridge A and B.
*/
this.ep.set('send_silence_when_idle', -1);
} }
this.bridged = true; this.bridged = true;
} }

View File

@@ -138,7 +138,7 @@ class SingleDialer extends Emitter {
this.serviceUrl = srf.locals.serviceUrl; this.serviceUrl = srf.locals.serviceUrl;
this.ep = await ms.createEndpoint(); this.ep = await ms.createEndpoint();
this._configMsEndpoint(); this._configMsEndpoint(false);
this.logger.debug(`SingleDialer:exec - created endpoint ${this.ep.uuid}`); this.logger.debug(`SingleDialer:exec - created endpoint ${this.ep.uuid}`);
/** /**
@@ -339,12 +339,13 @@ class SingleDialer extends Emitter {
} }
} }
_configMsEndpoint() { _configMsEndpoint(sendSilenceOnIdle = true) {
const opts = { const opts = {
...(this.onHoldMusic && {holdMusic: `shout://${this.onHoldMusic.replace(/^https?:\/\//, '')}`}), ...(this.onHoldMusic && {holdMusic: `shout://${this.onHoldMusic.replace(/^https?:\/\//, '')}`}),
...(JAMBONES_USE_FREESWITCH_TIMER_FD && {timer_name: 'timerfd'}), ...(JAMBONES_USE_FREESWITCH_TIMER_FD && {timer_name: 'timerfd'}),
...(JAMBONES_MEDIA_TIMEOUT_MS && {media_timeout: JAMBONES_MEDIA_TIMEOUT_MS}), ...(JAMBONES_MEDIA_TIMEOUT_MS && {media_timeout: JAMBONES_MEDIA_TIMEOUT_MS}),
...(JAMBONES_MEDIA_HOLD_TIMEOUT_MS && {media_hold_timeout: JAMBONES_MEDIA_HOLD_TIMEOUT_MS}) ...(JAMBONES_MEDIA_HOLD_TIMEOUT_MS && {media_hold_timeout: JAMBONES_MEDIA_HOLD_TIMEOUT_MS}),
...(sendSilenceOnIdle && {send_silence_when_idle: -1})
}; };
if (Object.keys(opts).length > 0) { if (Object.keys(opts).length > 0) {
this.ep.set(opts); this.ep.set(opts);