login | register
Tue 02 of Dec, 2008 [02:57 UTC]

voip-info.org

Asterisk LumenVox Via PHPAGI

Created by: codazoda,Last modification on Fri 17 of Aug, 2007 [15:10 UTC]
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 = ' . $scoredata>'data' . '"');
 $agi->exec('NoOp "Speech result = ' . $textdata>'data' . '"');

?>

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

Comments