adhearsion / adhearsion-asr

Adds speech recognition support to Adhearsion as a plugin.
http://adhearsion.com
MIT License
6 stars 6 forks source link

#ask should raise Adhearsion::Call::Hangup upon hangup #28

Open sfgeorge opened 9 years ago

sfgeorge commented 9 years ago

Issue

Using adhearsion-asr 1.5.0, I noticed that hanging up during an #ask prompt does not trigger the expected Adhearsion::Call::Hangup. Rather, it returns an AdhearsionASR::Result with the following state:

<AdhearsionASR::Result status=:hangup, confidence=nil, utterance=nil, interpretation=nil, nlsml=nil>

This is true, despite other welcome fixes like dfc03b9, which raise Hangup for expired call conditions.

Suggestion

If a telephony engine supports returning partial interpretation in the midst of hang-up, I could see status=:hangup being potentially useful. I am not aware of such a case (if someone is, then please do mention!). In lieu of info on usefulness for status=:hangup, I recommend that adhearsion-asr raise Adhearsion::Call::Hangup instead.

Workaround

For the time being, those who wish to have the traditional Hangup exception behavior can do the following:

result = ask
raise Adhearsion::Call::Hangup if result.status.eql? :hangup
benlangfeld commented 9 years ago

Thanks for the suggestion, @sfgeorge. I agree entirely. I'd definitely accept this against adhearsion/adhearsion. I'd have to review more carefully the backward compatibility arguments in this project.