Пример #1
0
 function replay_recording_twiml()
 {
     validate_rest_request();
     $response = new TwimlResponse();
     if ($this->input->get_post('RecordingUrl')) {
         // Stuff this in our session.  We'll come get it later when it's time to save!
         $recording = $this->input->get_post('RecordingUrl') . '.mp3';
         $this->session->set_userdata('current-recording', $recording);
     }
     $response->pause(array('length' => 1));
     $response->say('Recorded the following: ', $this->say_params);
     $gather = $response->gather(array('numDigits' => 1, 'method' => 'POST', 'action' => site_url('audiofiles/accept_or_reject_recording_twiml')));
     $gather->play($this->session->userdata('current-recording'));
     $gather->say('If you like this message, press 1. ... To record a different message, press 2.', $this->say_params);
     // If they don't enter anything at the prompt, do the replay again.
     $response->redirect(site_url('audiofiles/replay_recording_twiml'));
     return $response->respond();
 }
Пример #2
0
if (!empty($orderid)) {
    $settings = PluginData::get('orders', array('keys' => array(), 'status' => array()));
    $statusArray = array('shipped' => 'Shipped', 'fullfillment' => 'Sent to Fullfillment', 'processing' => 'Processing');
    $s = '';
    $keys = $settings->keys;
    $status = $settings->status;
    foreach ($keys as $i => $key) {
        if ($key == $orderid) {
            $s = $statusArray[$status[$i]];
            break;
        }
    }
    if ($s != '') {
        $response->say("Your order is marked as {$s}.", $prefs);
        if (AppletInstance::getFlowType() == 'voice') {
            $next = AppletInstance::getDropZoneUrl('next');
            if (!empty($next)) {
                $response->redirect($next);
            }
        }
    } else {
        $response->say("We could not find your order.", $prefs);
    }
} elseif ($flow_type == 'voice') {
    $gather = $response->gather(array('numDigits' => 5));
    $gather->say(AppletInstance::getValue('prompt-text'), $prefs);
    $response->redirect();
} elseif ($flow_type != 'voice') {
    $response->say(AppletInstance::getValue('prompt-text'));
}
$response->respond();
Пример #3
0
            $state[STRIPE_ACTION] = GATHER_YEAR;
            break;
        case GATHER_YEAR:
            $state['card']['exp_year'] = $digits;
            $state[STRIPE_ACTION] = $settings['require_cvc'] ? GATHER_CVC : SEND_PAYMENT;
            break;
        case GATHER_CVC:
            $state['card']['cvc'] = $digits;
            $state[STRIPE_ACTION] = SEND_PAYMENT;
            break;
    }
}
switch ($state[STRIPE_ACTION]) {
    case GATHER_CARD:
    default:
        $gather = $response->gather(compact('finishOnKey', 'timeout'));
        $gather->addSay($settings['card_prompt']);
        break;
    case GATHER_MONTH:
        $gather = $response->gather(compact('finishOnKey', 'timeout'));
        $gather->addSay($settings['month_prompt']);
        break;
    case GATHER_YEAR:
        $gather = $response->gather(compact('finishOnKey', 'timeout'));
        $gather->addSay($settings['year_prompt']);
        break;
    case GATHER_CVC:
        $gather = $response->gather(compact('finishOnKey', 'timeout'));
        $gather->addSay($settings['cvc_prompt']);
        break;
    case SEND_PAYMENT:
Пример #4
0
                $response->addHangup();
                break;
            case 'Say':
            default:
                $response->Say($json['msg']);
                $response->Redirect($next);
                break;
        }
    } elseif ($json && $json['status'] != 'success') {
        switch ($json['type']) {
            case 'Play':
                $response->Gather(array('numDigits' => $numDigits, 'timeout' => 60))->Play($json['msg']);
                break;
            case 'Hangup':
                $response->Hangup();
                break;
            case 'Say':
            default:
                $response->Gather(array('numDigits' => $numDigits, 'timeout' => 60))->Say($json['msg']);
                break;
        }
    } else {
        $response->redirect();
    }
} else {
    $gather = $response->gather(array('numDigits' => $numDigits, 'timeout' => 60));
    // $verb = AudioSpeechPickerWidget::getVerbForValue($prompt, null);
    AudioSpeechPickerWidget::setVerbForValue($prompt, $gather);
    // $gather->append($verb);
}
$response->Respond();