asterisk / node-ari-client

Node.js client for ARI. This library is best effort with limited support.
Other
249 stars 98 forks source link

Playback not found #140

Open mpbanna opened 4 years ago

mpbanna commented 4 years ago

Hello all, I am using some code to create playback and then i check it using ARI then it shows there is no playback using this created playback. It give error as : 'Error: {"message":"Playback not found"}' I am using following code :

        var commonPlayback1 = ari.Playback();
    logger.log('commonPlayback1::',commonPlayback1.id)
    ari.playbacks.get({
        playbackId: commonPlayback1.id
    }, function(err, playback) {
        if (err) {
            console.log(err);
        }else{
            console.log('valid playback::', commonPlayback1.id);
        }
    }); 
danjenkins commented 4 years ago

I'm guessing the underlying Playback application hasnt been loaded into Asterisk. Can you go into the Asterisk console and do a core show applications and see if Playback is listed?

samuelg commented 4 years ago

From the example above it doesn't look like that playback object was used to play a sound on a channel. What was done was create an object with a placeholder ID but Asterisk doesn't know about it yet. You'll need to use that object to play a sound on a channel or bridge first:

channel.play({ media: 'sound:some-sound' }, playback, function (err, updatedPlayback) {});

The goal of creating the playback object is so you have an ID ahead of time for registering events and controlling the playback.