Page 1 of 1

DTMF 0 question

Posted: Mon Jan 22, 2018 1:05 pm
by jverweij
I want to allow a caller to press 0 at a boolean field, but I don't see a way to distinguish between pressing 0 and saying "no" because the output from the built-in boolean grammar includes zero.

I'd rather not re-implement a version of the boolean grammar myself to work around this problem. Is there a way I might accept a dtmf "0" at a boolean prompt but still distinguish between pressing "0" vs saying "no"?

The data we get back is either “1” or “0": pressing 1 or saying yes returns a “1”, pressing 2 or saying no returns a “0"

Re: DTMF 0 question

Posted: Mon Jan 22, 2018 3:10 pm
by support
Hi,

It is possible to rewrite the value that is returned whenever you're working with an explicit grammar item. Here's a basic example where pressing 0 will return the string "skip".

Code: Select all

<field name="confirm" type="boolean">
  <grammar type="application/srgs+xml" root="ZERO" mode="dtmf">
    <rule id="ZERO">
      <one-of>
        <item> 0 <tag> SWI_literal='skip' </tag></item>
      </one-of>
    </rule>
  </grammar>

  <prompt> Press 1 or say yes. Press 2 or say no. Press 0 to skip. </prompt>

  <filled>
    <log> <value expr="confirm"/> </log>
  </filled>
</field>
The boolean responses are still the expected values. The value returned within the SWI_literal can be anything you'd like.

Regards,
Plum Support