Comments (2)
The ChannelStateChange
event on a channel is what you need for this.
The callback you provide should have the following signature:
function (event, channel) {
// channel.state will contain the state of the channel
}
Please note that you will have to subscribe to early channel events using the following:
client.applications.subscribe({
applicationName: 'name', // replace with your application name
eventSource: 'channel:id' // replace with your channel ID
})
If you use originate, you can only subscribe after you fire the origination, which means you can potentially miss some early events due to timing issues. It would be better to use client.channels.create
followed by client.channels.dial
for this. Using create+dial will auto subscribe to early channel events as well.
from node-ari-client.
Thank you for solution, i use ari.channels.create() then ari.channels.dial() but it gives type error:
/usr/local/lib/node_modules/ari-client/node_modules/bluebird/js/main/async.js:43
fn = function () { throw arg; };
^
TypeError: client.channels.create is not a function
at clientLoaded (/usr/local/lib/node_modules/sarvIVR/IVR/mahi_callTransfer.js:163:25)
at tryCatcher (/usr/local/lib/node_modules/ari-client/node_modules/bluebird/js/main/util.js:26:23)
at Promise.successAdapter (/usr/local/lib/node_modules/ari-client/node_modules/bluebird/js/main/nodeify.js:23:30)
at Promise._settlePromiseAt (/usr/local/lib/node_modules/ari-client/node_modules/bluebird/js/main/promise.js:582:21)
at Promise._settlePromises (/usr/local/lib/node_modules/ari-client/node_modules/bluebird/js/main/promise.js:700:14)
at Async._drainQueue (/usr/local/lib/node_modules/ari-client/node_modules/bluebird/js/main/async.js:123:16)
at Async._drainQueues (/usr/local/lib/node_modules/ari-client/node_modules/bluebird/js/main/async.js:133:10)
at Immediate.Async.drainQueues [as _onImmediate] (/usr/local/lib/node_modules/ari-client/node_modules/bluebird/js/main/async.js:15:14)
at processImmediate [as _immediateCallback] (timers.js:383:17)
from node-ari-client.
Related Issues (20)
- Playback not found HOT 2
- ARI Feature Request "BackGroundDetect"
- BridgeDestroyed event not captured
- Trying to connect to an unreachable host doesn't always throw an error
- Upgrading swagger HOT 4
- ari.recordings.getStoredFile(): SyntaxError: Unexpected token R in JSON at position 0 HOT 1
- Unable to received dtmf input after certain level
- Final dialstatus of dialed channel
- Client disconnection without warnings
- Can i use originate for outbound call using sip trunk HOT 1
- can't read swagger JSON HOT 4
- Can i add member to queue? HOT 1
- Warnings on deprecated libraries and dependencies when installed on Node V12.22.09 HOT 1
- How to remove sound of connection from person listened with snoopChannel?
- setChannelVar HOT 3
- Error: Channel not found on hangup HOT 4
- EventEmitter(catch like 'StasisStart') HOT 1
- Asterisk ARI Issue HOT 24
- snoopChannel - Channel not in Stasis application
- How can i create an application from FreePBX
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-ari-client.