asterisk / node-ari-client

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

snoopChannel - Channel not in Stasis application #161

Open davidvoisonics opened 6 months ago

davidvoisonics commented 6 months ago

First, apologies for my code. I'm not a real JS programmer and am trying to create a solution anyway.

We are trying to snoop on a channel like this:

                try {
                        console.log( 'Snooping on "' + asteriskID + '"' );
                        await this.ari.channels.snoopChannel({
                                app: "externalMedia", channelId: asteriskID, snoopId: asteriskID + '_snoop', spy: 'both', whisper: 'out',
                        });
                } catch (error) {
                        console.log('snoopChannel::', error)
                        this.close();
                }

However it fails with an error as follows. Does this mean that we can't snoopChannel on a channel that isn't using ARI?

Thanks in advance for any advice.

Unhandled rejection Error: {"message":"Channel not in Stasis application"} at SwaggerRequest.swaggerError [as errorCallback] (/opt/asterisk-external-media/node_modules/ari-client/lib/resources.js:949:19) at Object.error (/opt/asterisk-external-media/node_modules/swagger-client/lib/swagger.js:1077:24) at EventEmitter.error (/opt/asterisk-external-media/node_modules/swagger-client/lib/swagger.js:1296:19) at EventEmitter.emit (node:events:513:28) at emit (/opt/asterisk-external-media/node_modules/shred/lib/shred/request.js:454:21) at /opt/asterisk-external-media/node_modules/shred/lib/shred/request.js:473:9 at setBodyAndFinish (/opt/asterisk-external-media/node_modules/shred/lib/shred/response.js:103:7) at IncomingMessage. (/opt/asterisk-external-media/node_modules/shred/lib/shred/response.js:120:7) at IncomingMessage.emit (node:events:525:35) at endReadableNT (node:internal/streams/readable:1358:12) at processTicksAndRejections (node:internal/process/task_queues:83:21)