Пример #1
0
 /**
  * Validate that an incoming rest request is from Twilio
  *
  * @param string $failure_message
  * @return void
  */
 function validate_rest_request($failure_message = 'Could not validate this request. Goodbye.')
 {
     $ci =& get_instance();
     if ($ci->tenant->type == VBX_Settings::AUTH_TYPE_CONNECT) {
         return;
     }
     if (!OpenVBX::validateRequest()) {
         $response = new TwimlResponse();
         $response->say($failure_message, array('voice' => $ci->vbx_settings->get('voice', $ci->tenant->id), 'language' => $ci->vbx_settings->get('voice_language', $ci->tenant->id)));
         $response->hangup();
         $response->respond();
         exit;
     }
 }
Пример #2
0
<?php

$response = new TwimlResponse();
$response->hangup();
$response->respond();
Пример #3
0
 function hangup_on_cancel()
 {
     _deprecated_method(__METHOD__, '1.0.4');
     validate_rest_request();
     $response = new TwimlResponse();
     $response->hangup();
     return $response->respond();
 }
Пример #4
0
 /**
  * Send the response
  *
  * @return void
  */
 public function respond()
 {
     $this->response->respond();
 }
Пример #5
0
} else {
    if ($response['count'] > 0) {
        function filterAnon($elem)
        {
            $bool = strpos($elem['name'], "Unknown") === false && strpos($elem['name'], "Anonymous") === false;
            return $bool;
        }
        //filter out unknown and anonymous users
        $known = array_values(array_filter($response['results'], 'filterAnon'));
        if (sizeof($known) > 0) {
            //new ticket with known user as requestor
            $knownUser = $known[0];
            $response = curlWrap("/tickets.json", json_encode(array("ticket" => array("subject" => "New Phone Call From " . $knownUser['name'] . " | " . $phone, "comment" => array("body" => "Call came in at " . date('r')), "requester_id" => $knownUser['id']))), "POST");
        } else {
            //new ticket with existing unknown user as requestor
            $response = curlWrap("/tickets.json", json_encode(array("ticket" => array("subject" => "New Phone Call From " . $phone, "comment" => array("body" => "Call came in at " . date('r')), "requester_id" => $response['results'][0]['id']))), "POST");
        }
    }
}
// openvbx code below
// $primary is getting the url created by what ever applet was put
// into the primary dropzone
$primary = AppletInstance::getDropZoneUrl('primary');
// As long as the primary dropzone is not empty add the redirect
// twiml to $response
if (!empty($primary)) {
    $tResponse->redirect($primary);
}
// This will create the twiml for hellomonkey
$tResponse->respond();