Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.
Ben Langfeld edited this page Oct 1, 2013 · 10 revisions

Call Progress Analysis is built on top of the Input component. To start a CPA request we use a special SRGS based grammar with a 'cpa' mode:

<iq type='set' to='9f00061@call.rayo.net' from='16577@app.rayo.net/1'>
  <input xmlns='urn:xmpp:rayo:input:1' mode='cpa'>
    <grammar content-type='application/srgs+xml'>
      <![CDATA[
        <?xml version="1.0"?>
        <grammar mode="dtmf" version="1.0"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://www.w3.org/2001/06/grammar
                                     http://www.w3.org/TR/speech-grammar/grammar.xsd"
                 xmlns="http://www.w3.org/2001/06/grammar">

          <meta name="maxTime" content="4000"/>
          <meta name="minSpeechDuration" content="4000"/>
          <meta name="minVolume" content="10"/>
          <meta name="finalSilence" content="2000"/>
          <meta name="terminate" content="true"/>
  
          <ruleref uri="urn:xmpp:rayo:cpa:dtmf:1"/>
          <ruleref uri="urn:xmpp:rayo:cpa:modem:1"/>
        </grammar>
      ]]>
    </grammar>
  </input>
</iq>

The grammar sets which signals are we interested in and passes attributes to the CPA module using meta elements.

Commands

<!-- Stop accepting input and completely stop the CPA 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>

As with a regular input component, we can stop the CPA detection.

Events

<!-- Signal Received -->
<presence to='16577@app.rayo.net/1' from='9f00061@call.rayo.net/fgh4590'>
  <signal type="beep" duration="2000"/>
  <signal type="dtmf" tone="1"/>
  <signal type="speech" source="human|machine"/>
  <signal type="fax" duration="2000"/>
  <signal type="fax-cng" duration="2000"/>
  <signal type="ring" duration="2000"/>
  <signal type="sit" duration="2000"/>
  <signal type="modem" duration="2000"/>
  <signal type="offhook" duration="2000"/>
</presence>

We use the signal element to report CPA occurrences. Signal in this case is not wrapped by complete as we will keep getting occurrences until we stop the CPA input component.

Termination

The termination meta attribute tells the Rayo server whether the Input component should be completed upon receiving any of the specified signals or not. When termination is set to true and any of the expected signals is received your Rayo client will receive a complete event as usual, but in this case it will have the signal that triggered termination inside:

<presence to='16577@app.rayo.net/1' from='9f00061@call.rayo.net/fgh4590'>
  <complete xmlns="urn:xmpp:rayo:ext:1">
    <signal xmlns="urn:xmpp:rayo:input:1" duration="4690" source="machine" type="speech"/>
  </complete>
</presence>