say("Thank you, dialing now"); $r->dial($phone_number); header ("Content-Type:text/xml"); print $r; exit(); } } //If this is the first time we visit this page, //or the extension lookup failed, play the intro message $r = new Services_Twilio_Twiml(); $g = $r->gather(); //if this is the first time this menu was hit, play a greeting //otherwise explain that the extension was not found if($first) $g->say("Thank you for calling Example Incorporated."); else $g->say('I\'m sorry, we could not find the extension ' . $_REQUEST['Digits']); $g->say(" If you know your party's extension, please enter the extension now, followed by the pound sign. To search the directory, press star. Otherwise, stay on the line for the receptionist."); $r->say("Connecting you to the operator, please stay on the line."); $r->dial($receptionist_phone_number); header ("Content-Type:text/xml"); print $r; ?>