mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
adding log for issue freshdesk 1600
This commit is contained in:
@@ -78,7 +78,7 @@ class CallSession extends Emitter {
|
|||||||
this.callGone = false;
|
this.callGone = false;
|
||||||
this.notifiedComplete = false;
|
this.notifiedComplete = false;
|
||||||
this.rootSpan = rootSpan;
|
this.rootSpan = rootSpan;
|
||||||
this.stickyEventEmitter = new StickyEventEmitter();
|
this.stickyEventEmitter = new StickyEventEmitter(logger);
|
||||||
this.stickyEventEmitter.onSuccess = () => {
|
this.stickyEventEmitter.onSuccess = () => {
|
||||||
this.taskInProgress = null;
|
this.taskInProgress = null;
|
||||||
this.stickyEventEmitter.destroy();
|
this.stickyEventEmitter.destroy();
|
||||||
|
|||||||
@@ -67,6 +67,9 @@ class TaskPlay extends Task {
|
|||||||
this.logger.debug(`Play got kill-playback, executing uuid_break, taskId: ${t?.taskId}`);
|
this.logger.debug(`Play got kill-playback, executing uuid_break, taskId: ${t?.taskId}`);
|
||||||
this.ep.api('uuid_break', this.ep.uuid).catch((err) => this.logger.info(err, 'Error killing audio'));
|
this.ep.api('uuid_break', this.ep.uuid).catch((err) => this.logger.info(err, 'Error killing audio'));
|
||||||
this.notifyStatus({event: 'kill-playback'});
|
this.notifyStatus({event: 'kill-playback'});
|
||||||
|
} else {
|
||||||
|
this.logger.debug(
|
||||||
|
`Play received uuid_break for different taskId: ${t?.taskId}, current taskId: ${this.taskId}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -13,10 +13,11 @@ const EventEmitter = require('events');
|
|||||||
* - Maintains compatibility with Node's EventEmitter interface
|
* - Maintains compatibility with Node's EventEmitter interface
|
||||||
*/
|
*/
|
||||||
class StickyEventEmitter extends EventEmitter {
|
class StickyEventEmitter extends EventEmitter {
|
||||||
constructor() {
|
constructor(logger) {
|
||||||
super();
|
super();
|
||||||
this._eventCache = new Map();
|
this._eventCache = new Map();
|
||||||
this._onceListeners = new Map(); // For storing once listeners if needed
|
this._onceListeners = new Map(); // For storing once listeners if needed
|
||||||
|
this.logger = logger;
|
||||||
}
|
}
|
||||||
destroy() {
|
destroy() {
|
||||||
this._eventCache.clear();
|
this._eventCache.clear();
|
||||||
@@ -28,12 +29,14 @@ class StickyEventEmitter extends EventEmitter {
|
|||||||
this._eventCache.set(event, args);
|
this._eventCache.set(event, args);
|
||||||
|
|
||||||
// If there are any 'once' listeners waiting, call them
|
// If there are any 'once' listeners waiting, call them
|
||||||
|
this.logger.debug(`StickyEventEmitter emitting event: ${event} with args: ${JSON.stringify(args)}`);
|
||||||
if (this._onceListeners.has(event)) {
|
if (this._onceListeners.has(event)) {
|
||||||
const listeners = this._onceListeners.get(event);
|
const listeners = this._onceListeners.get(event);
|
||||||
for (const listener of listeners) {
|
for (const listener of listeners) {
|
||||||
listener(...args);
|
listener(...args);
|
||||||
}
|
}
|
||||||
if (this.onSuccess) {
|
if (this.onSuccess) {
|
||||||
|
this.logger.debug(`StickyEventEmitter calling onSuccess for event: ${event}`);
|
||||||
this.onSuccess();
|
this.onSuccess();
|
||||||
}
|
}
|
||||||
this._onceListeners.delete(event);
|
this._onceListeners.delete(event);
|
||||||
|
|||||||
Reference in New Issue
Block a user