diff --git a/client/imports/app/radio/radio.service.ts b/client/imports/app/radio/radio.service.ts index beb4961..e082041 100644 --- a/client/imports/app/radio/radio.service.ts +++ b/client/imports/app/radio/radio.service.ts @@ -134,6 +134,10 @@ export class AppRadioService implements OnDestroy { this._hold.system = this._hold.system === null ? call.systemData || call.system : null; this._emitHoldEvent(this._hold.system === null ? '-sys' : '+sys'); + + if (this._hold.system !== null) { + this._cleanQueue(); + } } } @@ -144,6 +148,10 @@ export class AppRadioService implements OnDestroy { this._hold.talkgroup = this._hold.talkgroup === null ? call.talkgroupData || call.talkgroup : null; this._emitHoldEvent(this._hold.talkgroup === null ? '-tg' : '+tg'); + + if (this._hold.talkgroup !== null) { + this._cleanQueue(); + } } } @@ -157,6 +165,8 @@ export class AppRadioService implements OnDestroy { this._emitLiveEvent(); this._flushQueue(); + + this.stop(); } this._writeLive(); @@ -256,6 +266,16 @@ export class AppRadioService implements OnDestroy { } } + private _cleanQueue(): void { + const queueLength = this._call.queue.length; + + this._call.queue = this._call.queue.filter((_call: RadioCall) => !this._callFiltered(_call)); + + if (queueLength !== this._call.queue.length) { + this._emitQueueEvent(); + } + } + private _configureAudio(): void { const stopHandler = () => { if (this._call.current) {