diff --git a/README.md b/README.md index 8addc06..fbc6c4a 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,11 @@ Plays the specified `file`. Playback can be stopped using one of the (optional) Hangs up the current channel. +#### 2.3 Channel events + +* 'hangup' + +Emitted when the current channel is hung up. ## LICENSE diff --git a/lib/agi-channel.js b/lib/agi-channel.js index 91fc74b..d3f217a 100644 --- a/lib/agi-channel.js +++ b/lib/agi-channel.js @@ -81,6 +81,9 @@ var AGIChannel = function(request, mapper) { util.inherits(AGIChannel, events.EventEmitter); AGIChannel.prototype.handleReply = function(reply) { + if (reply == 'hangup') { + this.emit('hangup') ; + } if (this.callback) { if (reply == 'hangup') { this.callback('hangup');