@ipcom/asterisk-ari 0.0.148 → 0.0.149

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.
@@ -1217,31 +1217,18 @@ var ChannelInstance = class {
1217
1217
  }
1218
1218
  console.log("Channel state:", this.channelData.state);
1219
1219
  const playback = this.client.Playback(playbackId || v4_default());
1220
- const payload = {
1221
- media: options.media,
1222
- ...options.lang && { lang: options.lang }
1223
- };
1224
- console.log("Sending playback request:", {
1225
- channelId: this.id,
1226
- playbackId: playback.id,
1227
- payload
1228
- });
1229
- await this.baseClient.post(
1230
- `/channels/${this.id}/play/${playback.id}`,
1231
- payload
1232
- );
1233
- try {
1234
- const playbackStatus = await playback.get();
1235
- if (playbackStatus.state !== "playing") {
1236
- console.warn("Playback not in playing state:", playbackStatus);
1237
- }
1220
+ return new Promise((resolve, reject) => {
1238
1221
  playback.once("PlaybackFinished", (event) => {
1239
- console.log("Playback finished", event);
1222
+ console.log("Playback finished: ", event);
1240
1223
  });
1241
- } catch (error) {
1242
- console.warn("Could not verify playback status:", error);
1243
- }
1244
- return playback;
1224
+ this.baseClient.post(`/channels/${this.id}/play/${playback.id}`, options).then(() => {
1225
+ console.log("Playback request successful");
1226
+ resolve(playback);
1227
+ }).catch((error) => {
1228
+ console.error("Error starting playback:", error);
1229
+ reject(error);
1230
+ });
1231
+ });
1245
1232
  } catch (error) {
1246
1233
  const message = getErrorMessage(error);
1247
1234
  console.error(`Error playing media on channel ${this.id}:`, {