Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

channel emits 'hangup' event on hangup #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mattdimeo
Copy link

This change causes the agi channel object to emit a hangup event when the channel is hung up.

The use case is when the AGI is waiting for something to happen elsewhere in the system, and needs to handle a hangup event as an exceptional case. For example, the AGI has sent a push notification to a mobile application, and is waiting for an asynchronous reply before continuing. The agi would continue when the asynchronous reply happens, or alternately send a cancellation push notification when the caller hangs up.

Contrived example:

(function waitForHangup(cb) {
    someOtherEmitter.on('somethingElseHappens', cb) ;
    ch.once('hangup', () => {
        sendFailureNotification() ;
        cb() ;
    }) ;
}).sync(null) ;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant