<?php
 
 
    ////////////////////////////////////////////////////////////////////
 
    ///
 
    ///             Sample usage of vxml.class.php
 
    ///            To calculate the factorial value of a number
 
    ///
 
    ////////////////////////////////////////////////////////////////////
 
    
 
    include ("vxml.class.php");
 
    
 
    $vxml_object=new voicexml;
 
    
 
    $vxml_object->start_vxml_header($lang="fr");
 
    
 
    $vxml_object->vxml_start_script();
 
    
 
    $vxml_object->addscript( "
 
       function factorial(n)\n
 
       {
 
       \treturn (n <= 1)? 1 : n * factorial(n-1);\n
 
       }\n";
 
       
 
    $vxml_object->end_vxml_script();
 
    
 
    $vxml_object->vxml_start_form("form");
 
    
 
        $vxml_object->vxml_start_field("fact","","","number");
 
    
 
            $vxml_object->vxml_prompt("Tell me a number and I'll tell you its factorial.");
 
    
 
            $vxml_object->vxml_start_filled();
 
    
 
                $vxml_object->vxml_start_prompt();
 
                
 
                $vxml_object->vxml_start_value("fact");
 
                
 
                $vxml_object->addtext(" factorial is ");
 
                
 
                $vxml_object->vxml_start_value("factorial(fact)");
 
                
 
            $vxml_object->end_vxml_prompt();
 
    
 
            $vxml_object->end_vxml_filled();
 
    
 
        $vxml_object->end_vxml_field();
 
        
 
    $vxml_object->end_vxml_form();
 
    
 
    $vxml_object->end_vxml();
 
 
    $vxml_object->generate();
 
        
 
?>
 
 |