Ejemplo n.º 1
0
<?php

$sms = AppletInstance::getValue('sms');
$next = AppletInstance::getDropZoneUrl('next');
$response = new TwimlResponse();
$response->sms($sms);
if (!empty($next)) {
    $response->redirect($next);
}
$response->respond();
Ejemplo n.º 2
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->sms($response_text);
$response->Respond();
Ejemplo n.º 3
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->sms('Unable to send sms message');
}
$response->respond();