Exemple #1
0
$CI =& get_instance();
$transcribe = (bool) $CI->vbx_settings->get('transcriptions', $CI->tenant->id);
$response = new TwimlResponse();
// start a new Twiml response
if (!empty($_REQUEST['RecordingUrl'])) {
    // add a voice message
    OpenVBX::addVoiceMessage(AppletInstance::getUserGroupPickerValue('permissions'), $CI->input->get_post('CallSid'), $CI->input->get_post('From'), $CI->input->get_post('To'), $CI->input->get_post('RecordingUrl'), $CI->input->get_post('RecordingDuration'), $transcribe == false);
} 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');
    }
    if (!AudioSpeechPickerWidget::setVerbForValue($prompt, $response)) {
        // fallback to default voicemail message
        $response->say('Please leave a message. Press the pound key when you are finished.', array('voice' => $CI->vbx_settings->get('voice', $CI->tenant->id), 'language' => $CI->vbx_settings->get('voice_language', $CI->tenant->id)));
    }
    // add a <Record>, and use VBX's default transcription handler
    $record_params = array('transcribe' => 'false');
    if ($transcribe) {
        $record_params['transcribe'] = 'true';
        $record_params['transcribeCallback'] = site_url('/twiml/transcribe');
    }
    $response->record($record_params);
}
$response->respond();
// send response
Exemple #2
0
 /**
  * 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.
  *
  * @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();
         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");
             }
         }
     }
 }
Exemple #3
0
            $response->say('You selected an incorrect option.', array('voice' => $ci->vbx_settings->get('voice', $ci->tenant->id), 'language' => $ci->vbx_settings->get('voice_language', $ci->tenant->id)));
            $response->redirect();
        }
        $response->respond();
        exit;
    }
}
if (!empty($selected_item)) {
    $response->redirect($selected_item);
    $response->respond();
    exit;
}
$gather = $response->gather(compact('numDigits'));
// $verb = AudioSpeechPickerWidget::getVerbForValue($prompt, null);
AudioSpeechPickerWidget::setVerbForValue($prompt, $gather);
// $gather->append($verb);
// Infinite loop
if ($repeat_count == -1) {
    $response->redirect();
    // Specified repeat count
} else {
    for ($i = 1; $i < $repeat_count; $i++) {
        $gather->pause(array('length' => 5));
        AudioSpeechPickerWidget::setVerbForValue($prompt, $gather);
        // $gather->append($verb);
    }
}
if (!empty($next)) {
    $response->redirect($next);
}
$response->respond();