Skip to content

channel emits 'hangup' event on hangup#12

Open
mattdimeo wants to merge 1 commit into
tcncloud:masterfrom
mattdimeo:emithangup
Open

channel emits 'hangup' event on hangup#12
mattdimeo wants to merge 1 commit into
tcncloud:masterfrom
mattdimeo:emithangup

Conversation

@mattdimeo

Copy link
Copy Markdown

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