<?php // Get the PHP helper library from twilio.com/docs/php/install // this line loads the library require 'vendor/autoload.php'; use Twilio\Twiml; $response = new Twiml(); $response->say("Hello! You will get an SMS message soon."); $response->sms("This is the ship that made the Kessel Run in fourteen parsecs?"); print $response;
private function _commandForVoice($question) { $voiceResponse = new Twiml(); $voiceResponse->say($question->body); $voiceResponse->say($this->_messageForVoiceQuestion($question)); $voiceResponse = $this->_registerResponseCommand($voiceResponse, $question); return response($voiceResponse); }
/** * Responds with instructions to mothership * @return Services_Twilio_Twiml */ private function _getReturnInstructions() { $response = new Twiml(); $response->say('To get to your extraction point, get on your bike and go down the' . ' street. Then Left down an alley. Avoid the police cars. Turn left' . ' into an unfinished housing development. Fly over the roadblock. Go' . ' passed the moon. Soon after you will see your mother ship.', ['voice' => 'Alice', 'language' => 'en-GB']); $response->say($this->_thankYouMessage, ['voice' => 'Alice', 'language' => 'en-GB']); $response->hangup(); return $response; }
public function showHangup() { $response = new Twiml(); $response->say('Your recording has been saved. Good bye.', ['voice' => 'alice', 'language' => 'en-GB']); $response->hangup(); return response($response)->header('Content-Type', 'application/xml'); }
/** * Responds with a <Dial> to the caller's planet * * @return \Illuminate\Http\Response */ public function showExtensionConnection(Request $request) { $selectedOption = $request->input('Digits'); try { $agent = $this->_getAgentForDigit($selectedOption); } catch (ModelNotFoundException $e) { return redirect()->route('main-menu-redirect'); } $numberToDial = $agent->phone_number; $response = new Twiml(); $response->say("You'll be connected shortly to your planet. " . $this->_thankYouMessage, ['voice' => 'alice', 'language' => 'en-GB']); $dialCommand = $response->dial(['action' => route('agent-voicemail', ['agent' => $agent->id], false), 'method' => 'POST']); $dialCommand->number($numberToDial, ['url' => route('screen-call', [], false)]); return $response; }
/** * Replies with a call connect xml * * @return \Illuminate\Http\Response */ public function showConnect(Request $request) { $muted = false; $moderator = false; $digits = $request->input('Digits'); if ($digits === '1') { $muted = true; } if ($digits === '3') { $moderator = true; } $response = new Twiml(); $response->say('You have joined the conference.', ['voice' => 'alice', 'language' => 'en-GB']); $dial = $response->dial(); $dial->conference('RapidResponseRoom', ['startConferenceOnEnter' => $moderator, 'endConferenceOnExit' => $moderator, 'muted' => $muted, 'waitUrl' => 'http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient']); return response($response)->header('Content-Type', 'application/xml'); }
<?php // NOTE: This example uses the next generation Twilio helper library - for more // information on how to download and install this version, visit // https://www.twilio.com/docs/libraries/php require_once '/path/to/vendor/autoload.php'; use Twilio\Twiml; $response = new Twiml(); $response->say("You will now be connected to the first caller in the queue."); $dial = $response->dial(); $dial->queue("Queue Demo"); $response->redirect(); echo $response;
<?php // Get the PHP helper library from twilio.com/docs/php/install // this line loads the library require 'vendor/autoload.php'; use Twilio\Twiml; $response = new Twiml(); $response->say("Thanks for calling!"); echo $response;
<?php // Get the PHP helper library from twilio.com/docs/php/install // this line loads the library require_once '/path/to/vendor/autoload.php'; use Twilio\Twiml; $response = new Twiml(); $response->say("hello world!", array('voice' => 'alice')); print $response;
private function _voiceMessageAfterLastQuestion() { $voiceResponse = new Twiml(); $voiceResponse->say('That was the last question'); $voiceResponse->say('Thank you for participating in this survey'); $voiceResponse->say('Good-bye'); $voiceResponse->hangup(); return response($voiceResponse); }
/** * Says message during connection between agent and customer (ET) * * @return \Illuminate\Http\Response */ public function showConnectMessage(Request $request) { $response = new Twiml(); $response->say('Connecting you to the extraterrestrial in distress'); return $response; }
<?php // Create a route that will handle Twilio Gather verb action requests, // sent as an HTTP POST to /gather in our application require_once '/path/to/vendor/autoload.php'; use Twilio\Twiml; // Use the Twilio PHP SDK to build an XML response $response = new Twiml(); // If the user entered digits, process their request if (array_key_exists('Digits', $_POST)) { switch ($_POST['Digits']) { case 1: $response->say('You selected sales. Good for you!'); break; case 2: $response->say('You need support. We will help!'); break; default: $response->say('Sorry, I don\'t understand that choice.'); $response->redirect('/voice'); } } else { // If no input was sent, redirect to the /voice route $response->redirect('/voice'); } // Render the response as XML in reply to the webhook request header('Content-Type: text/xml'); echo $response;