コード例 #1
0
ファイル: TwimlDial.php プロジェクト: rhyselsmore/OpenVBX
 /**
  * If the result of a no-answer is to take a voicemail then
  * we determine if its a user or group voicemail and then prompt for a record
  * 
  * Also, if the result of no-answer is to redirect then that is handled here too.
  * An empty redirect value will cause a hangup.
  *
  * @throws TwimlDialException
  * @return void
  */
 protected function no_answer_object()
 {
     if ($this->no_answer_action === 'voicemail') {
         switch ($this->dial_whom_instance) {
             case 'VBX_User':
                 $voicemail = $this->dial_whom_user_or_group->voicemail;
                 break;
             case 'VBX_Group':
                 $voicemail = $this->no_answer_group_voicemail;
                 break;
             default:
                 $voicemail = null;
         }
         if (!AudioSpeechPickerWidget::setVerbForValue($voicemail, $this->response)) {
             // fallback to default voicemail message
             $this->response->say(self::$default_voicemail_message, array('voice' => $this->voice, 'language' => $this->language));
         }
         $record_params = array('transcribe' => $this->transcribe ? 'true' : 'false');
         if ($this->transcribe) {
             $record_params['transcribeCallback'] = site_url('twiml/transcribe');
         }
         $this->response->record($record_params);
         $this->state = 'recording';
     } else {
         if ($this->no_answer_action === 'redirect') {
             if (empty($this->no_answer_redirect)) {
                 $this->hangup();
             }
             $this->response->redirect($this->no_answer_redirect);
         } else {
             if ($this->no_answer_action === 'hangup') {
                 $this->hangup();
             } else {
                 throw new TwimlDialException("Unexpected no_answer_action");
             }
         }
     }
 }
コード例 #2
0
ファイル: audiofiles.php プロジェクト: Gameonn/OpenVBX
 function prompt_for_recording_twiml()
 {
     validate_rest_request();
     $response = new TwimlResponse();
     $audioFile = VBX_Audio_File::get(array('recording_call_sid' => $this->input->get_post('CallSid')));
     if (!$audioFile->cancelled) {
         $response->say("Re-chord your message after the beep, press the pound key when finished.", $this->say_params);
         $response->record(array('action' => site_url('audiofiles/replay_recording_twiml')));
         $response->say("We didn't get a recording from you, try again.", $this->say_params);
         $response->redirect(site_url('audiofiles/prompt_for_recording_twiml'));
     } else {
         $response->say("The recording was cancelled.", $this->say_params);
         $response->hangup();
     }
     return $response->respond();
 }