Asterisk LumenVox Via PHPAGI

Asterisk LumenVox via the PHPAGI

The PHPAGI is a PHP class for the Asterisk Gateway Interface. LumenVox is a company that creates a voice recognition add-on for Asterisk.

Below is a quick example PHP script that loads the PHPAGI class and then uses it to accept speech input. You must create a grammar before loading it with the example below. I could not find ANY documentation about using LumenVox from the AGI. You may want to try a simple test through the DialPlan, to make sure you have everything working, before you jump into the AGI.

#!/usr/bin/php -q
<?php

  // Include the agi class
  require('./phpagi-2.14/phpagi.php');

  // Create an instance of the agi class
  $agi = new AGI();

  // Answer
  $agi->answer();

  // Lumenvox Test
  $agi->exec('SpeechCreate');
  $agi->exec('SpeechActivateGrammar hipReport');
  $agi->exec('SpeechStart');
  $result = $agi->exec('SpeechBackground beep|5');
  $score = $agi->get_variable('SPEECH_SCORE(0)');
  $text = $agi->get_variable('SPEECH_TEXT(0)');
  $agi->exec('SpeechDeactivateGrammar');

  $agi->exec('NoOp "Speech score = ' . $score['data'] . '"');
  $agi->exec('NoOp "Speech result = ' . $text['data'] . '"');

?>


The result from the grammar will be stored in the variable $text['data']. The score will be stored in $score['data'].
Asterisk LumenVox via the PHPAGI

The PHPAGI is a PHP class for the Asterisk Gateway Interface. LumenVox is a company that creates a voice recognition add-on for Asterisk.

Below is a quick example PHP script that loads the PHPAGI class and then uses it to accept speech input. You must create a grammar before loading it with the example below. I could not find ANY documentation about using LumenVox from the AGI. You may want to try a simple test through the DialPlan, to make sure you have everything working, before you jump into the AGI.

#!/usr/bin/php -q
<?php

  // Include the agi class
  require('./phpagi-2.14/phpagi.php');

  // Create an instance of the agi class
  $agi = new AGI();

  // Answer
  $agi->answer();

  // Lumenvox Test
  $agi->exec('SpeechCreate');
  $agi->exec('SpeechActivateGrammar hipReport');
  $agi->exec('SpeechStart');
  $result = $agi->exec('SpeechBackground beep|5');
  $score = $agi->get_variable('SPEECH_SCORE(0)');
  $text = $agi->get_variable('SPEECH_TEXT(0)');
  $agi->exec('SpeechDeactivateGrammar');

  $agi->exec('NoOp "Speech score = ' . $score['data'] . '"');
  $agi->exec('NoOp "Speech result = ' . $text['data'] . '"');

?>


The result from the grammar will be stored in the variable $text['data']. The score will be stored in $score['data'].
Created by: codazoda, Last modification: Wed 06 of Jun, 2012 (06:42 UTC) by admin
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+