Portions created by the Initial Developer are Copyright (C) 2008-2012 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane */ include "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; if (permission_exists('var_add') || permission_exists('var_edit')) { //access granted } else { echo "access denied"; exit; } //add multi-lingual support $language = new text; $text = $language->get(); //set the action as an add or an update if (isset($_REQUEST["id"])) { $action = "update"; $var_uuid = check_str($_REQUEST["id"]); } else { $action = "add"; } //set http values as php variables if (count($_POST)>0) { $var_name = check_str($_POST["var_name"]); $var_hostname = check_str($_POST["var_hostname"]); $var_value = check_str($_POST["var_value"]); $var_cat = check_str($_POST["var_cat"]); if (strlen($_POST["var_cat_other"]) > 0) { $var_cat = check_str($_POST["var_cat_other"]); } $var_enabled = check_str($_POST["var_enabled"]); $var_order = check_str($_POST["var_order"]); $var_description = $_POST["var_description"]; $var_description = str_replace("''", "'", $var_description); } if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $msg = ''; if ($action == "update") { $var_uuid = check_str($_POST["var_uuid"]); } //check for all required data if (strlen($var_name) == 0) { $msg .= $text['message-required'].$text['label-name']."
\n"; } //if (strlen($var_value) == 0) { $msg .= $text['message-required'].$text['label-value']."
\n"; } //if (strlen($var_cat) == 0) { $msg .= $text['message-required'].$text['label-category']."
\n"; } if (strlen($var_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."
\n"; } if (strlen($var_order) == 0) { $msg .= $text['message-required'].$text['label-order']."
\n"; } if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo "
\n"; echo "
\n"; echo $msg."
"; echo "
\n"; persistformvar($_POST); echo "
\n"; require_once "resources/footer.php"; return; } //add or update the database if ($_POST["persistformvar"] != "true") { if ($action == "add" && permission_exists('var_add')) { $var_uuid = uuid(); $sql = "insert into v_vars "; $sql .= "("; $sql .= "var_uuid, "; $sql .= "var_name, "; $sql .= "var_hostname, "; $sql .= "var_value, "; $sql .= "var_cat, "; $sql .= "var_enabled, "; $sql .= "var_order, "; $sql .= "var_description "; $sql .= ")"; $sql .= "values "; $sql .= "("; $sql .= "'$var_uuid', "; $sql .= "'$var_name', "; if (strlen($var_hostname) > 0) { $sql .= "'$var_hostname', "; } else { $sql .= "null, "; } $sql .= "'$var_value', "; $sql .= "'$var_cat', "; $sql .= "'$var_enabled', "; $sql .= "'$var_order', "; $sql .= "'".base64_encode($var_description)."' "; $sql .= ")"; $db->exec(check_sql($sql)); unset($sql); //unset the user defined variables $_SESSION["user_defined_variables"] = ""; //synchronize the configuration save_var_xml(); $_SESSION["message"] = $text['message-add']; header("Location: vars.php"); return; } //if ($action == "add") if ($action == "update" && permission_exists('var_edit')) { //update the variables $sql = "update v_vars set "; $sql .= "var_name = '$var_name', "; if (strlen($var_hostname) > 0) { $sql .= "var_hostname = '$var_hostname', "; } else { $sql .= "var_hostname = null, "; } $sql .= "var_value = '$var_value', "; $sql .= "var_cat = '$var_cat', "; $sql .= "var_enabled = '$var_enabled', "; $sql .= "var_order = '$var_order', "; $sql .= "var_description = '".base64_encode($var_description)."' "; $sql .= "where var_uuid = '$var_uuid' "; $db->exec(check_sql($sql)); unset($sql); //unset the user defined variables $_SESSION["user_defined_variables"] = ""; //synchronize the configuration save_var_xml(); $_SESSION["message"] = $text['message-update']; header("Location: vars.php"); return; } //if ($action == "update") } //if ($_POST["persistformvar"] != "true") } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) //pre-populate the form if (count($_GET)>0 && $_POST["persistformvar"] != "true") { $var_uuid = $_GET["id"]; $sql = "select * from v_vars "; $sql .= "where var_uuid = '$var_uuid' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); foreach ($result as &$row) { $var_name = $row["var_name"]; $var_hostname = $row["var_hostname"]; $var_value = $row["var_value"]; $var_cat = $row["var_cat"]; $var_enabled = $row["var_enabled"]; $var_order = $row["var_order"]; $var_description = base64_decode($row["var_description"]); } unset ($prep_statement); } //include header require_once "resources/header.php"; if ($action == "add") { $document['title'] = $text['title-var_add']; } if ($action == "update") { $document['title'] = $text['title-var_edit']; } //show contents echo "
\n"; echo "\n"; echo "\n"; if ($action == "add") { echo "\n"; } if ($action == "update") { echo "\n"; } echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo " \n"; echo " \n"; echo " "; //if variable is a code then show the codec info if ($var_name == "global_codec_prefs" || $var_name == "outbound_codec_prefs") { echo "\n"; echo ""; echo ""; } echo "
".$text['header-variable_add']."

".$text['header-variable_edit']."

"; echo " "; echo " \n"; echo "
\n"; echo " ".$text['label-name']."\n"; echo "\n"; echo " \n"; echo "
\n"; echo $text['description-name']."\n"; echo "
\n"; echo " ".$text['label-value']."\n"; echo "\n"; echo " \n"; echo "
\n"; echo $text['description-value']."\n"; echo "
\n"; echo " ".$text['label-hostname']."\n"; echo "\n"; echo " \n"; echo "
\n"; echo $text['description-hostname']."\n"; echo "
\n"; echo " ".$text['label-category']."\n"; echo "\n"; $table_name = 'v_vars';$field_name = 'var_cat';$sql_where_optional = "";$field_current_value = $var_cat; echo html_select_other($db, $table_name, $field_name, $sql_where_optional, $field_current_value); echo "
\n"; echo $text['description-category']."\n"; echo "
\n"; echo " ".$text['label-enabled']."\n"; echo "\n"; echo " \n"; echo "
\n"; echo "\n"; echo "
\n"; echo " ".$text['label-order']."\n"; echo "\n"; echo " \n"; echo "
\n"; echo "
\n"; echo " ".$text['label-description']."\n"; echo "\n"; echo " \n"; echo "
\n"; echo "\n"; echo "
\n"; if ($action == "update") { echo " \n"; } echo "
"; echo " \n"; echo "
\n"; echo "
\n"; echo "".$text['label-codec_information']."

\n"; echo "Module must be compiled and loaded.     codecname[@8000h|16000h|32000h[@XXi]]
\n"; echo "
\n"; echo "XX is the frame size must be multples allowed for the codec
\n"; echo "10-120ms is supported on some codecs.
\n"; echo "We do not support exceeding the MTU of the RTP packet.
\n"; echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " "; echo " \n"; echo " \n"; echo "
iLBC@30iiLBC using mode=30 which will win in all cases.
DVI4@8000h@20iIMA ADPCM 8kHz using 20ms ptime. (multiples of 10)
DVI4@16000h@40iIMA ADPCM 16kHz using 40ms ptime. (multiples of 10)
speex@8000h@20iSpeex 8kHz using 20ms ptime.
speex@16000h@20iSpeex 16kHz using 20ms ptime.
speex@32000h@20iSpeex 32kHz using 20ms ptime.
G7221@16000hG722.1 16kHz (aka Siren 7)
G7221@32000hG722.1C 32kHz (aka Siren 14)
CELT@32000hCELT 32kHz, only 10ms supported
CELT@48000hCELT 48kHz, only 10ms supported
GSM@40iGSM 8kHz using 40ms ptime. (GSM is done in multiples of 20, Default is 20ms)
G722G722 16kHz using default 20ms ptime. (multiples of 10)
PCMUG711 8kHz ulaw using default 20ms ptime. (multiples of 10)
PCMAG711 8kHz alaw using default 20ms ptime. (multiples of 10)
G726-16G726 16kbit adpcm using default 20ms ptime. (multiples of 10)
G726-24G726 24kbit adpcm using default 20ms ptime. (multiples of 10)
G726-32G726 32kbit adpcm using default 20ms ptime. (multiples of 10)
G726-40G726 40kbit adpcm using default 20ms ptime. (multiples of 10)
AAL2-G726-16Same as G726-16 but using AAL2 packing. (multiples of 10)
AAL2-G726-24Same as G726-24 but using AAL2 packing. (multiples of 10)
AAL2-G726-32Same as G726-32 but using AAL2 packing. (multiples of 10)
AAL2-G726-40Same as G726-40 but using AAL2 packing. (multiples of 10)
LPCLPC10 using 90ms ptime (only supports 90ms at this time)
L16L16 isn't recommended for VoIP but you can do it. L16 can exceed the MTU rather quickly.

These are the passthru audio codecs:
G729G729 in passthru mode. (mod_g729)
G723G723.1 in passthru mode. (mod_g723_1)
AMRAMR in passthru mode. (mod_amr)

These are the passthru video codecs: (mod_h26x)
H261H.261 Video
H263H.263 Video
H263-1998H.263-1998 Video
H263-2000H.263-2000 Video
H264H.264 Video
\n"; echo "
"; echo "

"; echo "
"; //include header require_once "resources/footer.php"; ?>