本文整理汇总了PHP中Response::addRecord方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::addRecord方法的具体用法?PHP Response::addRecord怎么用?PHP Response::addRecord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Response
的用法示例。
在下文中一共展示了Response::addRecord方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
$_SESSION['next_goto'] = 'Menu1_CheckInput';
} else {
if ($_REQUEST['event'] == 'GotDTMF' && $_SESSION['next_goto'] == 'Menu1_CheckInput') {
//input will come data param
//print parameter data value
if ($_REQUEST['data'] == '') {
//if value null, caller has not given any dtmf
//no input handled
$r->addPlayText('you have not entered any input');
$_SESSION['next_goto'] = 'Menu1';
} else {
if ($_REQUEST['data'] == '1') {
$_SESSION['next_goto'] = 'Record_Status';
$r->addPlayText('Please enter your location after beep ');
//give unique file name for each recording
$r->addRecord('filename2', 'wav');
} else {
if ($_REQUEST['data'] == '2') {
$_SESSION['next_goto'] = 'DialMenu';
} else {
if ($_REQUEST['data'] == '3') {
$_SESSION['next_goto'] = 'Dial1_Status';
} else {
$r->addPlayText('Thats an invalid input');
}
}
}
}
} else {
if ($_SESSION['next_goto'] == 'DialMenu') {
$r->addPlayText('Place Details');
示例2: Response
<?php
header("Content-type: text/xml\n");
error_reporting(E_NONE);
include "chirbit.php";
$user = AppletInstance::getUserGroupPickerValue('chirbit-controller');
$user_id = $user->values["id"];
$chirbit_username = PluginStore::get("chirbit_username_{$user_id}", "");
$chirbit_password = PluginStore::get("chirbit_password_{$user_id}", "");
$prompt = AppletInstance::getAudioSpeechPickerValue('prompt');
$after = AppletInstance::getAudioSpeechPickerValue('after');
$title = AppletInstance::getValue("title", "");
$response = new Response();
if (isset($_REQUEST['RecordingUrl'])) {
chirbit_post($chirbit_username, $chirbit_password, $_REQUEST['RecordingUrl'], $title);
$verb = AudioSpeechPickerWidget::getVerbForValue($after, null);
$response->append($verb);
$response->addHangup();
} else {
$verb = AudioSpeechPickerWidget::getVerbForValue($prompt, null);
$response->append($verb);
$response->addRecord();
}
$response->Respond();
示例3: dirname
<?php
// Include the PHP Plivo Rest library
require "./plivohelper.php";
$base_http = "http://" . dirname($_SERVER["SERVER_NAME"] . $_SERVER["PHP_SELF"]);
/* Render RESTXML */
$r = new Response();
$r->addRecord(array('timeout' => 5, 'finishOnKey' => "#", 'maxLength' => 30, 'playBeep' => 'true', 'filePath' => '/tmp'));
$r->Respond();
示例4: Say
$keepLooping = true;
}
break;
case DIAL_STATE_HANGUP:
$response->addHangup();
break;
case DIAL_STATE_NO_ANSWER:
if ($dial_whom_selector == 'number') {
if (empty($no_answer_redirect_number)) {
$response->addHangup();
}
$response->addRedirect($no_answer_redirect_number);
} else {
if ($no_answer_action === 'voicemail') {
$response->append(AudioSpeechPickerWidget::getVerbForValue($voicemail, new Say("Please leave a message.")));
$response->addRecord(array('transcribe' => true, 'transcribeCallback' => site_url('twiml/transcribe')));
$state[DIAL_ACTION] = DIAL_STATE_RECORDING;
} else {
if ($no_answer_action === 'redirect') {
if (empty($no_answer_redirect)) {
$response->addHangup();
}
$response->addRedirect($no_answer_redirect);
} else {
if ($no_answer_action === 'hangup') {
$response->addHangup();
} else {
trigger_error("Unexpected no_answer_action");
}
}
}
示例5: testRecordConvienceMethod
public function testRecordConvienceMethod()
{
$r = new Response();
$r->addRecord(array("transcribeCallback" => "example.com"));
$expected = '<Response><Record transcribeCallback="example.com"></Record></Response>';
$this->assertXmlStringEqualsXmlString($expected, $r->asUrl(False));
}
示例6: array
$zendesk_user = $CI->db->get_where('plugin_store', array('key' => 'zendesk_user'))->row();
$zendesk_user = json_decode($zendesk_user->value);
define('ZENDESK_URL', $zendesk_user->url);
define('ZENDESK_EMAIL', $zendesk_user->email);
define('ZENDESK_PASSWORD', $zendesk_user->password);
define('ZENDESK_TIMEZONE', (int) $zendesk_user->timezone);
// create a ticket to zendesk
$xml = '<ticket>' . '<subject>Phone Call from ' . format_phone($_REQUEST['Caller']) . ' on ' . gmdate('M d g:i a', gmmktime() + ZENDESK_TIMEZONE * 60 * 60) . '</subject>' . '<description>' . $_REQUEST['TranscriptionText'] . "\n" . 'Recording: ' . $_REQUEST['RecordingUrl'] . '</description>' . '</ticket>';
$new_ticket = zendesk_client('/tickets.xml', 'POST', $xml);
$params = http_build_query($_REQUEST);
$redirect_url = site_url('twiml/transcribe') . '?' . $params;
header("Location: {$redirect_url}");
} else {
$permissions = AppletInstance::getUserGroupPickerValue('permissions');
// get the prompt that the user configured
$isUser = $permissions instanceof VBX_User ? TRUE : FALSE;
if ($isUser) {
$prompt = $permissions->voicemail;
} else {
$prompt = AppletInstance::getAudioSpeechPickerValue('prompt');
}
$verb = AudioSpeechPickerWidget::getVerbForValue($prompt, new Say("Please leave a message."));
$response->append($verb);
// add a <Record>, and use VBX's default transcription handle$response->addRecord(array('transcribe'=>'TRUE', 'transcribeCallback' => site_url('/twiml/transcribe') ));
$action_url = base_url() . "twiml/applet/voice/{$flow_id}/{$instance_id}?status=save-call";
$transcribe_url = base_url() . "twiml/applet/voice/{$flow_id}/{$instance_id}?status=transcribe-call";
$response->addRecord(array('transcribe' => 'TRUE', 'action' => $action_url, 'transcribeCallback' => $transcribe_url));
}
}
$response->Respond();
// send response
示例7:
$_SESSION['next_goto'] = 'Menu1_CheckInput';
} else {
if ($_REQUEST['event'] == 'GotDTMF' && $_SESSION['next_goto'] == 'Menu1_CheckInput') {
//input will come data param
//print parameter data value
if ($_REQUEST['data'] == '') {
//if value null, caller has not given any dtmf
//no input handled
$r->addPlayText('you have not entered any input');
$_SESSION['next_goto'] = 'Menu1';
} else {
if ($_REQUEST['data'] == '1') {
$_SESSION['next_goto'] = 'Record_Status';
$r->addPlayText('Please record your message after beep ');
//give unique file name for each recording
$r->addRecord('filename1', 'wav', '120');
} else {
if ($_REQUEST['data'] == '2') {
$_SESSION['next_goto'] = 'DialMenu';
} else {
if ($_REQUEST['data'] == '3') {
$r->addPlayText('your conference number is 1 2 3 4 ');
$r->addConference(1234);
$_SESSION['next_goto'] = 'Dial1_Status';
} else {
$r->addPlayText('Thats an invalid input');
}
}
}
}
} else {
示例8: Response
<?php
require_once "./plivo.php";
# Generate a Record XML
$r = new Response();
$record_params = array('action' => 'https://example.com/record_action', 'method' => 'GET', 'callbackUrl' => 'https://example.com/recording_callback', 'callbackMethod' => 'GET');
$r->addRecord($record_params);
Header('Content-type: text/xml');
echo $r->toXML();
?>
<!--record_action.php-->
<?php
# Action URL Example
$record_url = $_REQUEST['RecordUrl'];
$record_duration = $_REQUEST['RecordingDuration'];
$record_id = $_REQUEST['RecordingID'];
print "Record URL : {$record_url}";
print "Recording Duration : {$record_duration}";
print "Recording ID : {$record_id}";
?>
<!--recording_callback.php-->
<?php
# Callback URL Example
$record_url = $_REQUEST['record_url'];
$record_duration = $_REQUEST['recording_duration'];
$record_id = $_REQUEST['recording_id'];
print "Record URL : {$record_url}";
示例9: elseif
exit;
}
$cd->addPlayText("Welcome to audio chat. Press 1 to broadcast your story , 2 to listen to friends .");
// play options
$r->addCollectDtmf($cd);
} elseif (isset($_REQUEST['event']) && $_REQUEST['event'] == 'GotDTMF') {
$no = $_REQUEST['cid'];
$result = mysqli_query($conn, "select * from user where mobile='{$no}' ");
$row = mysqli_fetch_assoc($result);
$userid = $row['id'];
$name = $row['name'];
$choice = $_REQUEST['data'];
if ($choice == "1") {
$r->addPlayText("Record your message after the beep ");
$n = $_REQUEST['cid'];
$r->addRecord($userid . "_" . md5(time()));
//record message
$r->maxduration = 15;
$res = mysqli_query($conn, "SELECT bro_id as ID, status as status FROM friends WHERE user_id = {$userid} UNION SELECT user_id as ID, status FROM friends WHERE bro_id = {$userid} ");
$cnt = $res->num_rows;
if ($cnt != 0) {
while ($row = mysqli_fetch_assoc($res)) {
$q = mysqli_query($conn, "SELECT * FROM user WHERE id = " . $row['ID']);
$bro = mysqli_fetch_assoc($q);
$postdata = "name=Audiochat&no=" . $bro['mobile'] . "&msg=" . $name . " has posted a new story.";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://faltusms.tk/sendSms.php');
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
示例10: Response
<?php
require_once 'lib/plivo.php';
$r = new Response();
$body = 'Hi, Calling from Plivo';
$url = 'http://examples.com/recordaction';
$record_attribute = array('action' => $url, 'maxLength' => 30, 'playBeep' => TRUE);
$r->addSpeak($body);
$r->addRecord($record_attribute);
header('Content-type: text/xml');
echo $r->toXML();
示例11: Response
// The same XML can be created above using the convencience methods
$r = new Response();
$r->addSpeak("Hello World", array("loop" => "10"));
$g = $r->addDial(array("timeLimit" => "45"));
$g->addNumber("4155551212");
$r->addPlay("http://www.mp3.com");
$r->addHangup(array("schedule" => "45"));
$r->Respond();
// ========================================================================
// GetDigits, Redirect
$r = new Response();
$g = $r->addgetDigits(array("numDigits" => "1", "timeout" => "25", "playBeep" => "true"));
$g->addPlay("/usr/local/freeswitch/sounds/en/us/callie/ivr/8000/ivr-hello.wav", array("loop" => "10"));
$r->addWait(array("length" => "5"));
$r->addPlay("/usr/local/freeswitch/sounds/en/us/callie/ivr/8000/ivr-hello.wav", array("loop" => "10"));
$r->addRecord(array("bothLegs" => "true"));
$r->addredirect();
$r->Respond();
/* outputs:
<Response>
<GetDigits numdigits="1">
<Play loop="2">/usr/local/freeswitch/sounds/en/us/callie/ivr/8000/ivr-hello.wav</Play>
</GetDigits>
<Wait length="5"/>
<Play loop="2">/usr/local/freeswitch/sounds/en/us/callie/ivr/8000/ivr-hello.wav</Play>
<Record/>
<Hangup/>
</Response>
*/
// ========================================================================
// Add a Speak verb multiple times
示例12: Response
<?php
require_once 'plivo.php';
$response = new Response();
$response->addSpeak('Record your message at the tone, after you are done, press pound');
$response->addRecord(array('action' => 'http://' . $_SERVER["SERVER_NAME"] . '/plivo-voicemail/confirm-input.php', 'method' => 'GET', 'maxLength' => '60', 'finishOnKey' => '#', 'playBeep' => 'true'));
$response->addSpeak('Recording not received');
$response->addRedirect('http://' . $_SERVER["SERVER_NAME"] . '/plivo-voicemail/get-input.php', array('method' => 'GET'));
header('content-type: text/xml');
echo $response->toXML();
示例13: array
<?php
require 'plivo.php';
//start recording the call after the Dial has been answered.
$record_params = array('action' => 'http://some.domain.com/recordfile/', 'startOnDialAnswer' => 'true');
$dial_params = array('callerId' => '12121212121');
$number = '12222222222';
$response = new Response();
$response->addRecord($record_params);
$dial = $response->addDial($dial_params);
$dial->addNumber($number);
echo $response->toXML();