@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/cjs/index.cjs
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
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}:`, {
|