Dynamic VoiceXML in entreprise – Maintenance messages

As a continuation of the Dynamic VoiceXML in entreprise articles, I’ve talked about php error messages in the last post and how we could optimize our application to send voice message such “Sorry, service currently not available please try again later.” when database connection failed.

The idea is to replace the die() message with a voice message for example in the service.php :

$link = @mysql_connect($host, $user, $pass) or die("Could not connect");

will be replaced with something like

$link = @mysql_connect($host, $user, $pass) or VoiceXML_Debug::die("Could not connect");

I was going to add it as a PHP VoiceXML module, but I’ve found this way more easy, specially if the message module is really enough to solve the problem.

/**
* VoiceXML Debug class
*
* @Licence PHP version 3
* @Author Ben Yacoub Hatem
*/
class VoiceXML_Debug {
/*
* VoiceXML Die
*
* @param message
*/
function die ($message) {
$v = new gonx_vxml();
$v->start_vxml("", "", "", "", "", "2.0");
$v->load("message",array("error",$message));
$v->end_vxml();
$v->generate();
exit;
}
}

With this small class we replaced the text error messages on database connection or anything else with a vocal message that will be played to the enduser. You have just to personalize the message from the code and you’re done.

So I have almost finished the Entreprise VoiceXML application. I’ll talk in the next posts about how to test your VoiceXML application using Open source solutions. This was a simple approach to develop dynamic VoiceXML application, I have more applications to talk about in the future. If you have any comments or idea you want me talk about don’t hesitate to send your messages.

One Comment on "Dynamic VoiceXML in entreprise – Maintenance messages"

  1. rupa November 14, 2008 at 11:28 am · Reply

    Respected Sir,
    Can you please send us the sample codes as to how to connect to the database using php with voicexml programs.
    please do revert back ASAP.
    Thanks,
    Rupa.

Leave a Comment