Collect Response
Collect users response to build the IVR, or transfer the call to right person based on users input.
Collect Response
<?php
// contacts array will List everyone your contacts
$contacts = array(
"9495797676"=>"John",
"9495776878"=>"Lily",
"3102168544"=>"Bob",
"8587771234"=>"Wendy",
"6058393817"=>"Amanda"
);
// if the caller is known, then greet them by name
// otherwise, just identify them as another caller
if(!$name = $contacts[$_REQUEST['From']])
$name = "there";
// now greet the caller
header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<Response>
<Say>Hello <?php echo $name; ?>.</Say>
<Gather numDigits="1" action="hello-world-handle-key.php" method="POST">
<Say>
Press 1 To speak with Support.
Press 2 to record your message.
Press any other key to start over.
</Say>
</Gather>
</Response>Last updated