public function getFlows() { $flows = array(); foreach (OpenVBX::getFlows() as $flow) { $flows[$flow->values['id']] = $flow->values['name']; } return $flows; }
$user = OpenVBX::getCurrentUser(); $tenant_id = $user->values['tenant_id']; if (isset($_POST['id'])) { $flows = OpenVBX::getFlows(array('id' => $_POST['id'], 'tenant_id' => $tenant_id)); $data = $flows[0]->values['data']; $sms_data = $flows[0]->values['sms_data']; $export = md5($data . $sms_data) . ':' . base64_encode($data) . ':' . base64_encode($sms_data); if (isset($_POST['file'])) { header('Content-type: text/plain'); header('Content-Disposition: attachment; filename=' . preg_replace('/\\W/', '', $flows[0]->values['name']) . '.ovbx'); echo $export; die; } } $flows = OpenVBX::getFlows(array('tenant_id' => $tenant_id)); ?> <style> .vbx-export-flow form { margin-top: 20px; } .vbx-export-flow p { margin: 10px 0; padding: 0 20px; } .vbx-export-flow h3 { font-size: 14px; padding: 0 20px; margin-top: 20px; } </style>
<?php $ci =& get_instance(); $number = AppletInstance::getValue('number'); $id = AppletInstance::getValue('flow'); if (!empty($_REQUEST['From'])) { $recipient = normalize_phone_to_E164(str_replace('%sender%', $_REQUEST['From'], AppletInstance::getValue('recipient'))); require_once APPPATH . 'libraries/Services/Twilio.php'; $service = new Services_Twilio($ci->twilio_sid, $ci->twilio_token); if (($flow = OpenVBX::getFlows(array('id' => $id, 'tenant_id' => $ci->tenant->id))) && $flow[0]->values['data']) { $service->account->calls->create($number, $recipient, site_url('twiml/start/voice/' . $id)); } } $response = new TwimlResponse(); $next = AppletInstance::getDropZoneUrl('next'); if (!empty($next)) { $response->redirect($next); } $response->respond();