本文整理汇总了PHP中Response::addSay方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::addSay方法的具体用法?PHP Response::addSay怎么用?PHP Response::addSay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Response
的用法示例。
在下文中一共展示了Response::addSay方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSayConvienceMethod
public function testSayConvienceMethod()
{
$r = new Response();
$r->addSay("Hello Monkey", array("language" => "fr"));
$expected = '<Response><Say language="fr">Hello Monkey</Say></Response>';
$this->assertXmlStringEqualsXmlString($expected, $r->asUrl(False));
}
示例2: callSay
public function callSay($text)
{
$twiml = new Response();
//generate url to the selected flow
$twiml->addSay($text);
$twiml->addPause(array('length' => 60 * 4));
$twiml->addHangup();
$this->startClientCall($twiml);
}
示例3: connect
function connect($number, $ext)
{
header('X-WP-Click2Call: ' . WP_CLICK2CALL_VERSION);
$twilio = new Response();
$greeting = get_option('wpc2c_custom_greeting');
if (!empty($greeting)) {
$twilio->addSay($greeting);
}
$dial = $twilio->addDial();
$dial_options = array();
if (!empty($ext)) {
$dial_options = array('sendDigits' => $ext);
}
$dial->addNumber($number, $dial_options);
$twilio->Respond();
}
示例4: foreach
}
$voicemail = $dial_whom_user_or_group->voicemail;
break;
case 'VBX_Group':
foreach ($dial_whom_user_or_group->users as $user) {
$user = VBX_User::get($user->user_id);
foreach ($user->devices as $device) {
if ($device->is_active == 1) {
$numbers[] = $device->value;
}
}
}
$voicemail = $no_answer_group_voicemail;
break;
default:
$response->addSay('Missing user or group to dial');
break;
}
} else {
if ($dial_whom_selector === 'number') {
$numbers[] = $dial_whom_number;
$voicemail = null;
} else {
error_log("Unexpected dial-whom-selector value of '{$dial_whom_selector}'");
}
}
/* Grab current state of applet */
if (isset($_COOKIE[DIAL_COOKIE])) {
$stateString = str_replace(', $Version=0', '', $_COOKIE[DIAL_COOKIE]);
$state = json_decode($stateString, true);
if (is_object($state)) {
示例5: dirname
<?php
require_once dirname(__FILE__) . '/../../lib/dopplr.php';
$user = OpenVBX::getCurrentUser();
$dopplr_token = PluginData::get("dopplr_token_{$user->id}", "");
$dopplr = new Dopplr($dopplr_token);
$response = new Response();
$response->addSay($dopplr->timezone());
$response->addRedirect(AppletInstance::getDropZoneUrl('next'));
$response->Respond();
示例6: strlen
$numDigits = 1;
foreach ($keys as $key) {
if (strlen($key) > $numDigits) {
$numDigits = strlen($key);
}
}
if ($digits !== false) {
if (!empty($menu_items[$digits])) {
$selected_item = $menu_items[$digits];
} else {
if ($invalid_option) {
$verb = AudioSpeechPickerWidget::getVerbForValue($invalid_option, null);
$response->append($verb);
$response->addRedirect();
} else {
$response->addSay('You selected an incorrect option.');
$response->addRedirect();
}
$response->Respond();
exit;
}
}
if (!empty($selected_item)) {
$response->addRedirect($selected_item);
$response->Respond();
exit;
}
$gather = $response->addGather(compact('numDigits'));
$verb = AudioSpeechPickerWidget::getVerbForValue($prompt, null);
$gather->append($verb);
// Infinite loop
示例7: Response
// Using Say, Dial, and Play
$r = new Response();
$r->append(new Say("Hello World", array("voice" => "man", "language" => "fr", "loop" => "10")));
$r->append(new Dial("4155551212", array("timeLimit" => "45")));
$r->append(new Play("http://www.mp3.com"));
$r->Respond();
/* outputs:
<Response>
<Say voice="man" language="fr" loop="10">Hello World</Say>
<Play>http://www.mp3.com</Play>
<Dial timeLimit="45">4155551212</Dial>
</Response>
*/
// The same XML can be created above using the convencience methods
$r = new Response();
$r->addSay("Hello World", array("voice" => "man", "language" => "fr", "loop" => "10"));
$r->addDial("4155551212", array("timeLimit" => "45"));
$r->addPlay("http://www.mp3.com");
//$r->Respond();
// ========================================================================
// Gather, Redirect
$r = new Response();
$g = $r->append(new Gather(array("numDigits" => "1")));
$g->append(new Say("Press 1"));
$r->append(new Redirect());
//$r->Respond();
/* outputs:
<Response>
<Gather numDigits="1">
<Say>Press 1</Say>
</Gather>
示例8: Response
<?php
$response = new Response();
$url = AppletInstance::getValue('url');
$next = AppletInstance::getDropZoneUrl('next');
$fallback = AppletInstance::getDropZoneUrl('fallback');
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $url);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl_handle);
curl_close($curl_handle);
if (empty($result)) {
$response->addSay('that didnt work');
$response->addRedirect($fallback);
$response->Respond();
} else {
$response->addSay($result);
$response->addRedirect($next);
$response->Respond();
}
示例9: Response
<?php
define('IS_DEV', true);
require_once 'twilio.php';
if (IS_DEV) {
require_once 'twillip.php';
Twillip::Start();
}
$r = new Response();
if (isset($_REQUEST['Caller'])) {
$r->addSay('This app uses Twillip for obviously awesome reasons!');
$r->addPlay('funky-beats.mp3', array('loop' => 3));
$r->addRedirect('/doesntexist.php');
} else {
$r->addSay('Oh no! I didn\'t get sent a phone number! Who in blue blazes are you?');
$r->addSay('This line will generate a PHP warning now: ' . $_REQUEST['Caller']);
}
$r->respond();
if (IS_DEV) {
Twillip::End();
}