@ipcom/asterisk-ari 0.0.106 → 0.0.108

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -997,7 +997,9 @@ var ChannelInstance = class extends import_events2.EventEmitter {
997
997
  `Nenhum WebSocket conectado dispon\xEDvel para '${this.app}'.`
998
998
  );
999
999
  }
1000
+ wsClient.removeWildcardListeners(this.id, event, "Channel");
1000
1001
  const scopedEvent = `${this.app}:Channel:${this.id}:${event}`;
1002
+ console.log({ scopedEvent });
1001
1003
  const listener = (data) => {
1002
1004
  callback(data);
1003
1005
  wsClient.off(scopedEvent, listener);
@@ -1516,6 +1518,7 @@ var PlaybackInstance = class extends import_events3.EventEmitter {
1516
1518
  `Nenhum WebSocket conectado dispon\xEDvel para '${this.app}'.`
1517
1519
  );
1518
1520
  }
1521
+ wsClient.removeWildcardListeners(this.id, event, "Playback");
1519
1522
  const scopedEvent = `${this.app}:Playback:${this.id}:${event}`;
1520
1523
  const listener = (data) => {
1521
1524
  callback(data);
@@ -1856,6 +1859,20 @@ var WebSocketClient = class extends import_events4.EventEmitter {
1856
1859
  super.off(event, callback);
1857
1860
  return this;
1858
1861
  }
1862
+ removeWildcardListeners(id, event, type) {
1863
+ console.log(
1864
+ `Removendo listeners para '${type}:${id}:${event}' com wildcard no app`
1865
+ );
1866
+ for (const eventName of this.eventNames()) {
1867
+ if (typeof eventName === "string") {
1868
+ const eventString = String(eventName);
1869
+ if (eventString.includes(`:${type}:${id}:${event}`)) {
1870
+ console.log(`Removendo listener para o evento: ${eventString}`);
1871
+ this.removeAllListeners(eventName);
1872
+ }
1873
+ }
1874
+ }
1875
+ }
1859
1876
  /**
1860
1877
  * Removes all listeners for a specific event, or all events if no event is specified.
1861
1878
  * @param event - Optional. The event to remove all listeners from.