@ipcom/asterisk-ari 0.0.133 → 0.0.135

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.
package/dist/esm/index.js CHANGED
@@ -931,7 +931,9 @@ var ChannelInstance = class extends EventEmitter {
931
931
  );
932
932
  const wsClient2 = this.client.getWebSocketClients().get(this.app);
933
933
  if (wsClient2) {
934
- wsClient2.removeScopedChannelListeners(this.id, this.app);
934
+ setTimeout(() => {
935
+ wsClient2.removeScopedChannelListeners(this.id, this.app);
936
+ }, 5e3);
935
937
  } else {
936
938
  console.warn(
937
939
  `WebSocketClient n\xE3o encontrado para o app '${this.app}'.`
@@ -999,6 +1001,7 @@ var ChannelInstance = class extends EventEmitter {
999
1001
  }
1000
1002
  const scopedEvent = `${this.app}:Channel:${this.id}:${event}`;
1001
1003
  wsClient.off(scopedEvent, callback);
1004
+ wsClient.removeScopedChannelListeners(this.id, this.app);
1002
1005
  return this;
1003
1006
  }
1004
1007
  async answer() {
@@ -1082,8 +1085,11 @@ var ChannelInstance = class extends EventEmitter {
1082
1085
  console.log(
1083
1086
  `Canal '${this.id}' foi destru\xEDdo. Removendo listeners associados.`
1084
1087
  );
1085
- wsClient.removeScopedChannelListeners(this.id, this.app);
1086
- wsClient.removeScopedPlaybackListeners(playback.id, this.app);
1088
+ setTimeout(() => {
1089
+ console.log(`Removendo listeners associados ao canal '${this.id}'.`);
1090
+ wsClient.removeScopedChannelListeners(this.id, this.app);
1091
+ wsClient.removeScopedPlaybackListeners(playback.id, this.app);
1092
+ }, 5e3);
1087
1093
  });
1088
1094
  return playback;
1089
1095
  }