当前位置: 首页>>代码示例>>PHP>>正文


PHP Response::addSay方法代码示例

本文整理汇总了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));
 }
开发者ID:hellobhanu,项目名称:TxtConnect,代码行数:7,代码来源:test_twiml.php

示例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);
 }
开发者ID:netconstructor,项目名称:FlowTest,代码行数:9,代码来源:FlowTest.php

示例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();
 }
开发者ID:Clutterbug,项目名称:Tortie,代码行数:16,代码来源:wp-click2call.php

示例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)) {
开发者ID:benrasmusen,项目名称:OpenVBX,代码行数:31,代码来源:twiml.php

示例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();
开发者ID:johndbritton,项目名称:DopplrVBX,代码行数:10,代码来源:twiml.php

示例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
开发者ID:JeffaCubed,项目名称:OpenVBX,代码行数:31,代码来源:twiml.php

示例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>
开发者ID:hellobhanu,项目名称:TxtConnect,代码行数:31,代码来源:example_twiml.php

示例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();
}
开发者ID:kressaty,项目名称:OpenVBX-Plugin-Curling,代码行数:21,代码来源:twiml.php

示例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();
}
开发者ID:jmhobbs,项目名称:Twillip,代码行数:21,代码来源:example.php


注:本文中的Response::addSay方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。