Phone Systems - how to set a phone system up to send ITFlow what happens on it: the * lines to put in its configuration, with this system's addresses and key in them, each with Copy. * Nothing in ITFlow connects to it - it sends, to api/phone/ (functions/phone.php). */ require_once '../../includes/modal_header.php'; $row = phoneSystemRow($_GET['id'] ?? 0); if (!$row || !phoneKind($row)) { echo json_encode(['error' => $row ? 'This ITFlow doesn\'t know that phone system\'s kind.' : 'That phone system no longer exists.']); exit; } $phone_system_id = intval($row['phone_system_id']); $name = phoneSystemName($row); $kind = phoneKind($row); $heard = $row['phone_system_heard_at']; // What goes in FreeSWITCH's XML - & written as & there $xml = function (string $url) { return htmlspecialchars($url, ENT_QUOTES | ENT_XML1, 'UTF-8'); }; $cdr_url = phoneUrl($row, 'cdr'); $cid_url = phoneUrl($row, 'cid', 'number=${caller_id_number}&domain=${domain_name}'); $hook_url = phoneUrl($row, 'hook'); // Yealink action URLs - the phone fills in its own $variables $account = 'line=$active_user&domain=$active_host'; $yealink = [ 'setup_completed' => 'e=setup&mac=$mac&ip=$ip&model=$model&fw=$firmware', 'registered' => "e=registered&mac=\$mac&ip=\$ip&model=\$model&fw=\$firmware&$account", 'unregistered' => "e=unregistered&mac=\$mac&$account", 'register_failed' => "e=failed&mac=\$mac&$account", 'incoming_call' => "e=ringing&mac=\$mac&$account&number=\$remote&name=\$display_remote&call=\$call_id", 'outgoing_call' => "e=outgoing&mac=\$mac&$account&number=\$remote&name=\$display_remote&call=\$call_id", 'call_established' => "e=answered&mac=\$mac&$account&number=\$remote&call=\$call_id", 'call_terminated' => "e=ended&mac=\$mac&$account&number=\$remote&call=\$call_id", ]; $yealink_lines = []; foreach ($yealink as $event => $query) { $yealink_lines[] = "action_url.$event = $hook_url&$query"; } $snippets = [ 'cdr' => '\n\n\n", 'cid' => '\n", 'yealink' => implode("\n", $yealink_lines), 'polycom' => '", 'dialplan' => "\n \n \n \n \n \n \n", ]; $copy_block = function (string $id, string $text) { return '
' . '
' . escapeHtml($text) . '
' . '' . '
'; }; ob_start(); ?>