Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LumenVox CPA support #225

Open
4 tasks
lpradovera opened this issue Jun 26, 2014 · 5 comments
Open
4 tasks

LumenVox CPA support #225

lpradovera opened this issue Jun 26, 2014 · 5 comments

Comments

@lpradovera
Copy link
Member

To add LumenVox CPA support to Punchblock, the following items are required:

  • Handle an Input component whose mode is cpa http://xmpp.org/extensions/xep-0341.html
  • Translate the grammar URLs into LV grammar format
  • Execute the grammar using MRCP (the same way a normal MRCP input component works)
  • Map the response to Rayo CPA complete reason
@lpradovera
Copy link
Member Author

Lumenvox CPA.

Existing stuff

Of course, mod_rayo now has some CPA support, which we use in our adhearsion-cpa plugin... but that's different than Lumenvox's APIs.

Lumenvox provided examples:

Grammers

Example CPA Grammar:
<?xml version='1.0'?>
<grammar xml:lang="en-US" version="1.0" root="root" mode="voice" xmlns="http://www.w3.org/2001/06/grammar" tag-format="semantics/1.0">

  <meta name="STREAM|DETECTION_MODE" content="CPA"/>

  <meta name="STREAM|CPA_HUMAN_RESIDENCE_TIME" content="1800"/>
  <meta name="STREAM|CPA_HUMAN_BUSINESS_TIME" content="1800"/>
  <meta name="STREAM|CPA_UNKNOWN_SILENCE_TIMEOUT" content="1800"/>

  <meta name="HUMAN_RESIDENCE_CUSTOM_INPUT_TEXT" content="HUMAN RESIDENCE"/>
  <meta name="HUMAN_BUSINESS_CUSTOM_INPUT_TEXT" content="HUMAN BUSINESS"/>
  <meta name="UNKNOWN_SPEECH_CUSTOM_INPUT_TEXT" content="UNKNOWN SPEECH"/>
  <meta name="UNKNOWN_SILENCE_CUSTOM_INPUT_TEXT" content="UNKNOWN SILENCE"/>

  <rule id="root" scope="public">
    <one-of>
      <item>HUMAN RESIDENCE<tag>out="HUMAN RESIDENCE"</tag></item>
      <item>HUMAN BUSINESS<tag>out="HUMAN BUSINESS"</tag></item>
      <item>UNKNOWN SPEECH<tag>out="UNKNOWN SPEECH"</tag></item>
      <item>UNKNOWN SILENCE<tag>out="UNKNOWN SILENCE"</tag></item>
    </one-of>
  </rule>
</grammar>
Example Tone Detection Grammer:
<?xml version='1.0'?>
<grammar xml:lang="en-US" version="1.0" root="root" mode="voice" xmlns="http://www.w3.org/2001/06/grammar" tag-format="semantics/1.0.2006">

  <meta name="STREAM|DETECTION_MODE" content="Tone"/>

  <meta name="AMD_CUSTOM_ENABLE" content="true"/>
  <meta name="FAX_CUSTOM_ENABLE" content="true"/>
  <meta name="SIT_CUSTOM_ENABLE" content="true"/>

  <meta name="AMD_CUSTOM_INPUT_TEXT" content="AMD"/>
  <meta name="FAX_CUSTOM_INPUT_TEXT" content="FAX"/>

  <meta name="SIT_REORDER_LOCAL_CUSTOM_INPUT_TEXT" content="SIT REORDER LOCAL"/>
  <meta name="SIT_VACANT_CODE_CUSTOM_INPUT_TEXT" content="SIT VACANT CODE"/>
  <meta name="SIT_NO_CIRCUIT_LOCAL_CUSTOM_INPUT_TEXT" content="SIT NO CIRCUIT LOCAL"/>
  <meta name="SIT_INTERCEPT_CUSTOM_INPUT_TEXT" content="SIT INTERCEPT"/>
  <meta name="SIT_REORDER_DISTANT_CUSTOM_INPUT_TEXT" content="SIT REORDER DISTANT"/>
  <meta name="SIT_NO_CIRCUIT_DISTANT_CUSTOM_INPUT_TEXT" content="SIT NO CIRCUIT DISTANT"/>
  <meta name="SIT_OTHER_CUSTOM_INPUT_TEXT" content="SIT OTHER"/>

  <rule id="root" scope="public">
    <one-of>
      <item>AMD<tag>out="AMD"</tag></item>
      <item>FAX<tag>out="FAX"</tag></item>
      <item>SIT REORDER LOCAL<tag>out="SIT"</tag></item>
      <item>SIT VACANT CODE<tag>out="SIT"</tag></item>
      <item>SIT NO CIRCUIT LOCAL<tag>out="SIT"</tag></item>
      <item>SIT INTERCEPT<tag>out="SIT"</tag></item>
      <item>SIT REORDER DISTANT<tag>out="SIT"</tag></item>
      <item>SIT NO CIRCUIT DISTANT<tag>out="SIT"</tag></item>
      <item>SIT OTHER<tag>out="SIT"</tag></item>
    </one-of>
  </rule>
</grammar>

Results

  • CPA
    • HUMAN RESIDENCE: The called party was likely a live human with a short greeting.
    • HUMAN BUSINESS: The called party was likely a live human with a medium-length greeting.
    • UNKNOWN SPEECH: The called party was likely an answering machine (a long greeting was detected).
    • UNKNOWN SILENCE: No greeting at all was detected.
  • AMD
    • AMD: An answering machine or voicemail tone was detected.
    • FAX: A fax machine was detected.
    • SIT: A SIT was detected.

(There's no examples of an actual response, just what the interpertations provide)

Dialplans

Lumenvox provides examples with both MRCPRecog and SpeechBackground.

Example of CPA and Tone Detection with MRCPRecog:
[MRCPRecog CPA]
exten => s,n,MRCPRecog(/etc/grammars/cpa.grxml)

[MRCPRecog Tone Detection]
exten => s,n,MRCPRecog(/etc/grammars/tone_detection.grxml)
Example of CPA and Tone Detection with SpeechBackground:
[simple-cpa-plus-tone-detection-example]
exten => s,n,SpeechCreate()

; Load our grammars
exten => s,n,SpeechLoadGrammar(cpa,/etc/grammars/cpa.gram)
exten => s,n,SpeechLoadGrammar(tone_detect,/etc/grammars/tone_detect.gram)

; We are going to use both for the initial prompt
exten => s,n,SpeechActivateGrammar(cpa)
exten => s,n,SpeechActivateGrammar(tone_detect)

; We want to play silence at first as we listen to the initial greeting
exten => s,n,SpeechBackground(silence,10)
; SpeechBackground returns and we deactivate both grammars
exten => s,n,SpeechDeactivateGrammar(cpa)
exten => s,n,SpeechDectivateGrammar(tone_detect)

; We now evaluate the result

; If we got a tone, act accordingly
exten => s,n(toneDetected),GotoIf($[ ${SPEECH_TEXT(0) = "AMD"]?AMD)
exten => s,n,GotoIf($[ ${SPEECH_TEXT(0) = "FAX"]?Fax)
exten => s,n,GotoIf($[ ${SPEECH_TEXT(0) = "SIT"]?SIT)

; If it's a live human, we act accordingly
exten => s,n,GotoIf($[ ${SPEECH_TEXT(0) = "Human Residence"]?Live)
exten => s,n,GotoIf($[ ${SPEECH_TEXT(0) = "Human Business"]?Live)

; If it's not a live human, we're going to wait for a tone to be detected
exten => s,n,GotoIf($[ ${SPEECH_TEXT(0) = "Unknown Silence"]?WaitForMachine)
exten => s,n,GotoIf($[ ${SPEECH_TEXT(0) = "Unknown Speech"]?WaitForMachine)

; This is our WaitForMachine area. Here we're just going to wait for a tone while playing silence
exten => s,n,SpeechActivateGrammar(tone_detect)
exten => s,n,SpeechBackground(silence,120)
exten => s,n,DeactivateGrammar(tone_detect)
exten => s,n,Goto(toneDetected)

; Here's where we would do something for a human ; Start writing your custom application here:
exten => s,n(Live),Playback(you-are-a-human) exten => s,n,Hangup

; Here we can leave a customized message for an answering machine
exten => s,n(AMD),Playback(you-are-a-machine)
exten => s,n,Hangup

; Just hangup on a Fax or SIT
exten => s,n(Fax),Hangup
exten => s,n(SIT),Hangup

@lpradovera
Copy link
Member Author

The first synchronous detection would be easily implemented atop our existing UniMRCP stuff in Punchblock. This would make use ofMRCPRecog(), given that it is stand-alone recognition.

@benlangfeld
Copy link
Member

Also see adhearsion/adhearsion#493

@benlangfeld
Copy link
Member

More notes for @polysics:

When PB receives an Input component of 'cpa' type, it will need to start up an appropriate component in place of a DTMF event listener one. Such an implementation will need to be similar to MRCPPrompt, without any of the output stuff, and with grammar conversion from URIs to Lumenvox grammars.

@benlangfeld
Copy link
Member

@polysics If there is anything else you need to move forward, please be specific and thorough about what's stopping you, and I'll fix it first thing in the morning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants