private function _messageAfterLastQuestion()
 {
     $voiceResponse = new \Services_Twilio_Twiml();
     $voiceResponse->say('That was the last question');
     $voiceResponse->say('Thank you for participating in this survey');
     $voiceResponse->say('Good-bye');
     $voiceResponse->hangup();
     return $voiceResponse;
 }
예제 #2
0
 public function afterCallHook(Request $request)
 {
     $this->saveRecording($request);
     $this->notifyOwnerOfRecording($request);
     $this->notifyFriendsOfRecording($request);
     $response = new TwimlGenerator();
     $response->say('Sorry, but we can\'t record more than an hour.');
     $response->hangup();
     event(new CallRecordingWasCompleted($request->all()));
     return $response;
 }
예제 #3
0
 public function process(Application $app, Request $request)
 {
     $pollDigits = $app['request']->get('Digits');
     $Product = $app['eccube.repository.product']->get($pollDigits);
     $name = $Product->getName();
     $say = $name . "に投票されました。ありがとうございました。";
     $twiml = new \Services_Twilio_Twiml();
     $twiml->say($say, array('language' => 'ja-jp'));
     $twiml->hangup();
     $xml = strval($twiml);
     $response = new Response($app['twig']->render('TwilioPoll/Resource/template/xml.twig', array('xml' => $xml)), 200, array('Content-Type' => 'text/xml'));
     return $response;
 }
예제 #4
0
<?php

require_once 'vendor/autoload.php';
require 'db.php';
require_once 'speechtotext.php';
$response = new Services_Twilio_Twiml();
$say_str = "ご利用ありがとうございました";
$recording_url = $_REQUEST['RecordingUrl'];
$id = $_REQUEST['id'];
$data = json_decode(getDocument($id), true);
$data['recording_url'] = $recording_url;
$speechtext = speechtotext($recording_url);
$data['speechtext'] = $speechtext['results'][0]['alternatives'][0]['transcript'];
update($data);
$response = new Services_Twilio_Twiml();
$response->say($say_str, array('language' => 'ja-jp'));
$response->hangup();
header("Content-type: text/xml");
print $response;
<?php

require __DIR__ . '/../vendor/autoload.php';
if (isset($_POST['CallSid'])) {
    session_id($_POST['CallSid']);
}
session_start();
// What language should Twilio use?
$language = getenv('TWILIO_LANGUAGE');
$attributes = array('voice' => 'alice', 'language' => $language);
$twilio = new Services_Twilio_Twiml();
if (isset($_POST['DialCallStatus'])) {
    if ($_POST['DialCallStatus'] == 'completed') {
        if ($_SESSION['engineer_accepted_call']) {
            error_log("engineer_accepted_call is true");
            $twilio->hangup();
        }
    }
}
$twilio->redirect('voicemail.php');
// send response
if (!headers_sent()) {
    header('Content-type: text/xml');
}
echo $twilio;
예제 #6
0
 public function process_poll($randomid, $sch_id)
 {
     $this->load->model(array('reply_status_model', 'schedule_model'));
     $digit = isset($_REQUEST['Digits']) ? $_REQUEST['Digits'] : null;
     $reply_rows = $this->reply_status_model->get_rows(array());
     foreach ($reply_rows as $reply_row) {
         if ($reply_row->number == $digit) {
             $flag = true;
             $this->reply_status_model->updateReplyStatus($digit, $randomid);
             $this->schedule_model->set_reply_status_id($digit, $sch_id);
             $this->schedule_model->set_onsite_status_id($digit, $sch_id);
             break;
         } else {
             $flag = false;
         }
     }
     if ($flag == false) {
         $say = "Sorry, You have choosen incorrect availability";
     } else {
         $say = "Thank you. We have marked your availability";
     }
     $response = new Services_Twilio_Twiml();
     $response->say($say);
     $response->hangup();
     header('Content-Type: text/xml');
     print $response;
 }
 public function testHangupAddAttribute()
 {
     $r = new Services_Twilio_Twiml();
     $r->hangup(array("foo" => "bar"));
     $expected = '<Response><Hangup foo="bar"></Hangup></Response>';
     $this->assertXmlStringEqualsXmlString($expected, $r);
 }