Requirements:
The IVR system will also need to be attached to the customers billing/credit card section. The way that the IVR wil work is that it will give a limit of 4 minutes per call and if the user goes over the allowed time then they will billed per minute.
When customer calls the IVR system the system will ask them to input the tag ID number, found on the tag, then the system dials all 5 numbers at the same time until the first person picks up the phone.
When user enter tag id then, i have to retrieve 5 contact number form database from corresponding tag id, then transfer call until the first person picks up the phone.
My code:
test.php
Code: Select all
<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
<form>
<field name="tagid" type="digits">
<prompt>
Welcome To my Petcode.
Please enter tag id found on pet collar using your keypad.
</prompt>
<filled>
<assign name="tagid" expr="tagid"/>
<prompt>
You entered <value expr="tagid"/>.
</prompt>
<!-- transfer to premium support -->
</filled>
<noinput>
<prompt>
Sorry, I didn't hear you.
</prompt>
<reprompt/>
</noinput>
</field>
<block>
<prompt>
Please wait while we process your information.
</prompt>
<submit namelist="tagid" next="http://example.com/vxml/submit.php"/>
</block>
</form>
</vxml>
Code: Select all
?php
include('../wp-load.php');
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
$tagid = trim($_GET[tagid]);
global $wpdb;
$customer_petinfo_table_name = $wpdb->prefix . 'XXXXXXX';
$getpetinfo = $wpdb->get_results( "SELECT ownerUserid FROM " . $customer_petinfo_table_name . " where petTagid = ".$tagid." " );
if(count($getpetinfo)){
foreach($getpetinfo as $pet){
$user_id = $pet->ownerUserid;
}
}
$contact1 = get_user_meta($user_id, 'contact1', true);
$contact2 = get_user_meta($user_id, 'contact2', true);
$contact3 = get_user_meta($user_id, 'contact3', true);
$contact4 = get_user_meta($user_id, 'contact4', true);
$contact5 = get_user_meta($user_id, 'contact5', true);
?>
<vxml version="2.0">
<form>
<block>
<prompt>
Your tag id number is <?php echo($tagid); ?>
</prompt>
</block>
<!-- transfer to customer service representative -->
<transfer dest="<?php echo $contact1; ?>" connecttimeout="20s" bridge="true"/>
</form>
</vxml>