Input

mpermar edited this page Jun 20, 2013 · 3 revisions

The goal of the Media Input API is to offer low level access to the call for those applications that find that the Ask component is insufficient. The Media Input API offers you fine grained access for getting input from the call and many more control options than the Ask component.

This is component is still under active development. Right now the API does look like this:

<iq type='set' to='9f00061@call.rayo.net' from='16577@app.rayo.net/1'>
  <input xmlns='urn:xmpp:rayo:input:1'
      mode='any|dtmf|speech'
      terminator='#'
      recognizer='en-US'
      initial-timeout='2000'
      inter-digit-timeout='2000'
      sensitivity='0.5'
      min-confidence='0.5'
      max-silence='2000'>
    <grammar url="http://grammarserver.com/digits?min=1&amp;max=10" />
    <grammar content-type='application/grammar+voxeo'>
      [4 DIGITS]
    </grammar>
  </input>
</iq>

Commands

<!-- Stop accepting input and completely stop the Input Component -->
<iq type='set' to='9f00061@call.rayo.net/fgh4590' from='16577@app.rayo.net/1'>
  <stop xmlns='urn:xmpp:rayo:ext:1' />    
</iq>

Events

  <!-- Successfull Input -->
  <presence to='16577@app.rayo.net/1' from='9f00061@call.rayo.net/fgh4590'>
    <complete xmlns='urn:xmpp:rayo:ext:1'>
      <match mode="speech" confidence="0.45" xmlns='urn:xmpp:rayo:input:complete:1'>
        <interpretation>1234</interpretation>
        <utterance>one two three four</utterance>
      </match>
    </complete>
  </presence>
  
  <!-- Incorrect Input -->
  <presence to='16577@app.rayo.net/1' from='9f00061@call.rayo.net/fgh4590'>
    <complete xmlns='urn:xmpp:rayo:ext:1'>
      <nomatch xmlns='urn:xmpp:rayo:input:complete:1' />
    </complete>
  </presence>  

  <!-- No Input Provided -->
  <presence to='16577@app.rayo.net/1' from='9f00061@call.rayo.net/fgh4590'>
    <complete xmlns='urn:xmpp:rayo:ext:1'>
      <noinput xmlns='urn:xmpp:rayo:input:complete:1' />
    </complete>
  </presence>  

  <!-- Component was stopped -->
  <presence to='16577@app.rayo.net/1' from='9f00061@call.rayo.net/fgh4590'>
    <complete xmlns='urn:xmpp:rayo:ext:1'>
      <stop xmlns='urn:xmpp:rayo:ext:complete:1' />
    </complete>
  </presence>

  <!-- Component completed because the call was disconnected -->
  <presence to='16577@app.rayo.net/1' from='9f00061@call.rayo.net/fgh4590'>
    <complete xmlns='urn:xmpp:rayo:ext:1'>
      <hangup xmlns='urn:xmpp:rayo:ext:complete:1' />
    </complete>
  </presence>

  <!-- Component completed because the call was disconnected -->
  <presence to='16577@app.rayo.net/1' from='9f00061@call.rayo.net/fgh4590'>
    <complete xmlns='urn:xmpp:rayo:ext:1'>
      <error xmlns='urn:xmpp:rayo:ext:complete:1'>
        Something really bad happened
      </error>
    </complete>
  </presence>