say($result['name']."'s extension is ".$result['extension']." Connecting you now"); $r->dial($number); header ("Content-Type:text/xml"); //ADD THIS TO ANY FUNCTION THAT EXITS OR XML ERROR OCCURS print $r; exit(); } else { $error=true; } } $r = new Services_Twilio_Twiml(); if($error) $r->say("No match found for $digits"); $g = $r->gather(); $g->say("Enter the first several digits of the last name of the party you wish to reach, followed by the pound sign"); $r->say("I did not receive a response from you"); $r->redirect("index.php"); header ("Content-Type:text/xml"); print $r; ?>