Code Monkey home page Code Monkey logo

Comments (2)

samuelg avatar samuelg commented on September 26, 2024

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.

mpbanna avatar mpbanna commented on September 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.