@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.
package/dist/esm/index.js
CHANGED
|
@@ -1197,31 +1197,18 @@ var ChannelInstance = class {
|
|
|
1197
1197
|
}
|
|
1198
1198
|
console.log("Channel state:", this.channelData.state);
|
|
1199
1199
|
const playback = this.client.Playback(playbackId || v4_default());
|
|
1200
|
-
|
|
1201
|
-
media: options.media,
|
|
1202
|
-
...options.lang && { lang: options.lang }
|
|
1203
|
-
};
|
|
1204
|
-
console.log("Sending playback request:", {
|
|
1205
|
-
channelId: this.id,
|
|
1206
|
-
playbackId: playback.id,
|
|
1207
|
-
payload
|
|
1208
|
-
});
|
|
1209
|
-
await this.baseClient.post(
|
|
1210
|
-
`/channels/${this.id}/play/${playback.id}`,
|
|
1211
|
-
payload
|
|
1212
|
-
);
|
|
1213
|
-
try {
|
|
1214
|
-
const playbackStatus = await playback.get();
|
|
1215
|
-
if (playbackStatus.state !== "playing") {
|
|
1216
|
-
console.warn("Playback not in playing state:", playbackStatus);
|
|
1217
|
-
}
|
|
1200
|
+
return new Promise((resolve, reject) => {
|
|
1218
1201
|
playback.once("PlaybackFinished", (event) => {
|
|
1219
|
-
console.log("Playback finished", event);
|
|
1202
|
+
console.log("Playback finished: ", event);
|
|
1220
1203
|
});
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1204
|
+
this.baseClient.post(`/channels/${this.id}/play/${playback.id}`, options).then(() => {
|
|
1205
|
+
console.log("Playback request successful");
|
|
1206
|
+
resolve(playback);
|
|
1207
|
+
}).catch((error) => {
|
|
1208
|
+
console.error("Error starting playback:", error);
|
|
1209
|
+
reject(error);
|
|
1210
|
+
});
|
|
1211
|
+
});
|
|
1225
1212
|
} catch (error) {
|
|
1226
1213
|
const message = getErrorMessage(error);
|
|
1227
1214
|
console.error(`Error playing media on channel ${this.id}:`, {
|