adhearsion / adhearsion

A Ruby framework for building telephony applications
http://adhearsion.com
MIT License
609 stars 128 forks source link

Input always interrupting on DTMF even if the digit is not part of the grammar #242

Open lpradovera opened 11 years ago

lpradovera commented 11 years ago

The Input component accepts a grammar that specifies which digits are valid. Any other digit should be ignored and not interrupt the component. Instead, any digit stops the Input, then nil is returned if it is not an accepted one.

Logs at trace here: https://gist.github.com/6d833516d6cd1710f682 Reproduction controller here: https://gist.github.com/1ddc8caa12807ffee2d9

In the above controller, any digit results in the call being immediately hung up because the controller finished execution, implying that the component is being stopped.

benlangfeld commented 11 years ago

Related to https://www.pivotaltracker.com/story/show/29461159. This is essentially hotword detection.

benlangfeld commented 10 years ago

Imagine a scenario where we only want to interrupt on the digit '7'. The user presses '1' for some unrelated reason, and then presses '7'. Currently, we'll interrupt on the '1', since it'll be a nomatch. The appropriate solution to this is to use a grammar like so:

<grammar root='only-seven'>
  <rule id="only-seven">
    <ruleref special="GARBAGE"/>
    <item>7</item>
  </rule>
</grammar>

In this case, no match will be triggered by anything except a '7' (or of course a timeout).

Unfortunately neither mod_rayo's nor Punchblock's DTMF detectors support the GARBAGE rule. Those platforms will have to gain support before we can proceed with this fix.