示例#1
0
        foreach ($forward->devices as $device) {
            $devices[] = $device;
        }
        $voicemail = $forward->voicemail;
        break;
    case 'VBX_Group':
        foreach ($forward->users as $user) {
            $user = VBX_User::get($user->user_id);
            foreach ($user->devices as $device) {
                $devices[] = $device;
            }
        }
        $voicemail = $groupVoicemail;
        break;
    default:
        break;
}
$required_params = array('SmsSid', 'From', 'To', 'Body');
$sms_found = true;
foreach ($required_params as $param) {
    if (!in_array($param, array_keys($_REQUEST))) {
        $sms_found = false;
    }
}
if ($sms_found) {
    $ci =& get_instance();
    OpenVBX::addSmsMessage($forward, $ci->input->get_post('SmsSid'), $ci->input->get_post('From'), $ci->input->get_post('To'), $ci->input->get_post('Body'));
} else {
    $response->message('Unable to send sms message');
}
$response->respond();
示例#2
0
文件: twiml.php 项目: tjoozey/openvbx
<?php

$sms = AppletInstance::getValue('sms');
$next = AppletInstance::getDropZoneUrl('next');
$response = new TwimlResponse();
$response->message($sms);
if (!empty($next)) {
    $response->redirect($next);
}
$response->respond();
示例#3
0
<?php

$ci =& get_instance();
/* Get the body of the SMS message */
$body = isset($_REQUEST['Body']) ? trim($ci->input->get_post('Body')) : null;
$body = strtolower($body);
$prompt = AppletInstance::getValue('prompt');
$keys = AppletInstance::getValue('keys[]');
$responses = AppletInstance::getValue('responses[]');
$menu_items = AppletInstance::assocKeyValueCombine($keys, $responses, 'strtolower');
$response = new TwimlResponse();
/* Display the menu item if we found a match - case insensitive */
if (array_key_exists($body, $menu_items) && !empty($menu_items[$body])) {
    $response_text = $menu_items[$body];
} else {
    /* Display the prompt if incorrect */
    $response_text = $prompt;
}
$response->message($response_text);
$response->Respond();