Beispiel #1
0
 function accept_or_reject_recording_twiml()
 {
     validate_rest_request();
     $response = new TwimlResponse();
     $digits = clean_digits($this->input->get_post('Digits'));
     $call_sid = $this->input->get_post('CallSid');
     switch ($digits) {
         case 1:
             $audioFile = VBX_Audio_File::get(array('recording_call_sid' => $call_sid));
             if ($audioFile == null) {
                 trigger_error("That's weird - we can't find the place holder audio file that matches this sid (" . $call_sid . ")");
             } else {
                 $audioFile->url = $this->session->userdata('current-recording');
                 $audioFile->save();
             }
             $response->say('Your recording has been saved.', $this->say_params);
             $response->hangup();
             break;
         case 2:
             $response->redirect(site_url('audiofiles/prompt_for_recording_twiml'));
         default:
             $response->redirect(site_url('audiofiles/replay_recording_twiml'));
             break;
     }
     return $response->respond();
 }
Beispiel #2
0
 /**
  * Dial
  * 
  * Callback method that responds to a Twilio request and provides
  * a number for Twilio to dial.
  * 
  * Overloaded by Twilio Client integration - Twilio Client connection
  * requests automatically include the "1" Digit to immediately connect
  * the call
  *
  * @return void
  */
 public function dial()
 {
     validate_rest_request();
     $rest_access = $this->input->get_post('rest_access');
     $to = $this->input->get_post('to');
     $callerid = $this->input->get_post('callerid');
     if (!$this->session->userdata('loggedin') && !$this->login_call($rest_access)) {
         $this->response->say("Unable to authenticate this call.\tGoodbye", $this->say_params);
         $this->response->hangup();
         $this->response->respond();
         return;
     }
     // Response
     $user = VBX_User::get($this->session->userdata('user_id'));
     $name = '';
     if (empty($user)) {
         log_message('error', 'Unable to find user: '******'user_id'));
     } else {
         $name = $user->first_name;
     }
     $digits = clean_digits($this->input->get_post('Digits'));
     if ($digits !== false && $digits == 1) {
         $options = array('action' => site_url("twiml/dial_status") . '?' . http_build_query(compact('to')), 'callerId' => $callerid);
         if (filter_var($this->input->get_post('to'), FILTER_VALIDATE_EMAIL)) {
             $this->dial_user_by_email($this->input->get_post('to'), $options);
         } elseif (preg_match('|client:[0-9]{1,4}|', $this->input->get_post('to'))) {
             $this->dial_user_by_client_id($this->input->get_post('to'), $options);
         } else {
             $to = normalize_phone_to_E164($to);
             $this->response->dial($to, $options);
         }
     } else {
         $gather = $this->response->gather(array('numDigits' => 1));
         $gather->say("Hello {$name}, this is a call from VeeBee Ex, to accept, press 1.", $this->say_params);
     }
     $this->response->respond();
 }
$const['STRIPE_COOKIE'] = 'payment-' . AppletInstance::getInstanceId();
$const['GATHER_CARD'] = 'GatherCard';
$const['GATHER_MONTH'] = 'GatherMonth';
$const['GATHER_YEAR'] = 'GatherYear';
$const['GATHER_CVC'] = 'GatherCvc';
$const['SEND_PAYMENT'] = 'SendPayment';
foreach ($const as $k => $v) {
    define($k, $v);
}
$response = new TwimlResponse();
$state = array(STRIPE_ACTION => GATHER_CARD, 'card' => array());
$ci =& get_instance();
$settings = PluginData::get('settings');
$amount = AppletInstance::getValue('amount');
$description = AppletInstance::getValue('description');
$digits = clean_digits($ci->input->get_post('Digits'));
$finishOnKey = '#';
$timeout = 15;
$card_errors = array('invalid_number' => GATHER_CARD, 'incorrect_number' => GATHER_CARD, 'invalid_expiry_month' => GATHER_MONTH, 'invalid_expiry_year' => GATHER_YEAR, 'expired_card' => GATHER_CARD, 'invalid_cvc' => GATHER_CVC, 'incorrect_cvc' => GATHER_CVC);
if (is_object($settings)) {
    $settings = get_object_vars($settings);
}
if (isset($_COOKIE[STRIPE_COOKIE])) {
    $state = json_decode(str_replace(', $Version=0', '', $_COOKIE[STRIPE_COOKIE]), true);
    if (is_object($state)) {
        $state = get_object_vars($state);
    }
}
if ($digits !== false) {
    switch ($state[STRIPE_ACTION]) {
        case GATHER_CARD: