Merge pull request #1 from fusionpbx/master

test
This commit is contained in:
blackc2004 2015-12-09 14:31:37 -08:00
commit 1e6f7fc090
418 changed files with 11033 additions and 4622 deletions

View File

@ -260,10 +260,10 @@ require_once "resources/header.php";
$phone_1 = preg_replace('{\D}', '', $tmp_value_array[0]);
if ($gateway == "loopback") {
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone_1."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone_1."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
}
else {
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone_1." ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone_1." ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
}
echo $cmd."<br />\n";
cmd_async($cmd);
@ -335,20 +335,20 @@ require_once "resources/header.php";
//make the call
if (strlen($phone_1)> 0) {
if ($gateway == "loopback") {
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone_1."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone_1."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
}
else {
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone_1." ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone_1." ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
}
//echo $cmd."<br />\n";
cmd_async($cmd);
}
if (strlen($phone_2)> 0) {
if ($gateway == "loopback") {
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone_2."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone_2."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
}
else {
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone_2." ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone_2." ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
}
//echo $cmd."<br />\n";
cmd_async($cmd);

View File

@ -129,48 +129,47 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//get and then set the complete agent_contact with the call_timeout and when necessary confirm
//if you change this variable, also change resources/switch.php
$tmp_confirm = "group_confirm_file=custom/press_1_to_accept_this_call.wav,group_confirm_key=1,group_confirm_read_timeout=2000,leg_timeout=".$agent_call_timeout;
$confirm = "group_confirm_file=custom/press_1_to_accept_this_call.wav,group_confirm_key=1,group_confirm_read_timeout=2000,leg_timeout=".$agent_call_timeout;
if(strstr($agent_contact, '}') === FALSE) {
//not found
if(stristr($agent_contact, 'sofia/gateway') === FALSE) {
//add the call_timeout
$tmp_agent_contact = "{call_timeout=".$agent_call_timeout."}".$agent_contact;
$agent_contact = "{call_timeout=".$agent_call_timeout.",sip_invite_domain=".$_SESSION['domain_name']."}".$agent_contact;
}
else {
//add the call_timeout and confirm
$tmp_agent_contact = $tmp_first.',call_timeout='.$agent_call_timeout.$tmp_last;
$tmp_agent_contact = "{".$tmp_confirm.",call_timeout=".$agent_call_timeout."}".$agent_contact;
echo "\n\n".$tmp_agent_contact."\n\n";
$agent_contact = $first.',call_timeout='.$agent_call_timeout.$last;
$agent_contact = "{".$confirm.",call_timeout=".$agent_call_timeout.",sip_invite_domain=".$_SESSION['domain_name']."}".$agent_contact;
echo "\n\n".$agent_contact."\n\n";
}
}
else {
//found
if(stristr($agent_contact, 'sofia/gateway') === FALSE) {
//not found
$position = strrpos($agent_contact, "}");
$first = substr($agent_contact, 0, $position);
$last = substr($agent_contact, $position);
if(stristr($agent_contact, 'call_timeout') === FALSE) {
//add the call_timeout
$tmp_pos = strrpos($agent_contact, "}");
$tmp_first = substr($agent_contact, 0, $tmp_pos);
$tmp_last = substr($agent_contact, $tmp_pos);
$tmp_agent_contact = $tmp_first.',call_timeout='.$agent_call_timeout.$tmp_last;
$call_timeout = ',call_timeout='.$agent_call_timeout;
}
else {
//the string has the call timeout
$tmp_agent_contact = $agent_contact;
$call_timeout = '';
}
$agent_contact = $first.',sip_invite_domain='.$_SESSION['domain_name'].$call_timeout.$last;
}
else {
//found
$tmp_pos = strrpos($agent_contact, "}");
$tmp_first = substr($agent_contact, 0, $tmp_pos);
$tmp_last = substr($agent_contact, $tmp_pos);
$position = strrpos($agent_contact, "}");
$first = substr($agent_contact, 0, $position);
$last = substr($agent_contact, $position);
if(stristr($agent_contact, 'call_timeout') === FALSE) {
//add the call_timeout and confirm
$tmp_agent_contact = $tmp_first.','.$tmp_confirm.',call_timeout='.$agent_call_timeout.$tmp_last;
$agent_contact = $first.','.$confirm.',sip_invite_domain='.$_SESSION['domain_name'].'call_timeout='.$agent_call_timeout.$last;
}
else {
//add confirm
$tmp_agent_contact = $tmp_first.','.$tmp_confirm.$tmp_last;
$agent_contact = $first.',sip_invite_domain='.$_SESSION['domain_name'].','.$confirm.$last;
}
}
}
@ -193,7 +192,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$response = event_socket_request($fp, $cmd);
usleep(200);
//agent set contact
$cmd = "api callcenter_config agent set contact ".$agent_name."@".$_SESSION['domains'][$domain_uuid]['domain_name']." ".$tmp_agent_contact;
$cmd = "api callcenter_config agent set contact ".$agent_name."@".$_SESSION['domains'][$domain_uuid]['domain_name']." ".$agent_contact;
$response = event_socket_request($fp, $cmd);
usleep(200);
//agent set status

View File

@ -43,59 +43,60 @@ else {
$id = check_str($_GET["id"]);
}
if (strlen($id) > 0) {
//delete the data
if (strlen($id) > 0) {
//get the dialplan uuid
$sql = "select * from v_call_center_queues ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_center_queue_uuid = '$id' ";
$prep_statement = $db->prepare($sql);
$prep_statement->execute();
while($row = $prep_statement->fetch(PDO::FETCH_ASSOC)) {
$queue_name = $row['queue_name'];
$dialplan_uuid = $row['dialplan_uuid'];
}
//get the dialplan uuid
$sql = "select * from v_call_center_queues ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_center_queue_uuid = '$id' ";
$prep_statement = $db->prepare($sql);
$prep_statement->execute();
while($row = $prep_statement->fetch(PDO::FETCH_ASSOC)) {
$queue_name = $row['queue_name'];
$dialplan_uuid = $row['dialplan_uuid'];
}
//delete the tier from the database
$sql = "delete from v_call_center_tiers ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and queue_name = '$queue_name' ";
$db->query($sql);
unset($sql);
//delete the tier from the database
$sql = "delete from v_call_center_tiers ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and queue_name = '$queue_name' ";
$db->query($sql);
unset($sql);
//delete the call center queue
$sql = "delete from v_call_center_queues ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
$db->query($sql);
unset($sql);
//delete the call center queue
$sql = "delete from v_call_center_queues ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_center_queue_uuid = '$id' ";
$db->query($sql);
unset($sql);
//delete the dialplan entry
$sql = "delete from v_dialplans ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
$db->query($sql);
unset($sql);
//delete the dialplan entry
$sql = "delete from v_dialplans ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
$db->query($sql);
unset($sql);
//delete the dialplan details
$sql = "delete from v_dialplan_details ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
$db->query($sql);
unset($sql);
//delete the dialplan details
$sql = "delete from v_dialplan_details ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
$db->query($sql);
unset($sql);
//clear the cache
$cache = new cache;
$cache->delete("dialplan:".$_SESSION["context"]);
remove_config_from_cache('configuration:callcenter.conf');
//clear the cache
$cache = new cache;
$cache->delete("dialplan:".$_SESSION["context"]);
remove_config_from_cache('configuration:callcenter.conf');
//synchronize configuration
save_dialplan_xml();
save_call_center_xml();
//synchronize configuration
save_dialplan_xml();
save_call_center_xml();
//apply settings reminder
$_SESSION["reload_xml"] = true;
}
//apply settings reminder
$_SESSION["reload_xml"] = true;
}
//redirect the browser
$_SESSION["message"] = $text['message-delete'];

View File

@ -255,7 +255,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$db->exec(check_sql($sql));
unset($sql);
//syncrhonize the configuration
//synchronize the configuration
save_call_center_xml();
remove_config_from_cache('configuration:callcenter.conf');
@ -311,20 +311,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
}
unset ($prep_statement);
//dialplan add or update
$c = new call_center;
$c->db = $db;
$c->domain_uuid = $_SESSION['domain_uuid'];
$c->call_center_queue_uuid = $call_center_queue_uuid;
$c->dialplan_uuid = $dialplan_uuid;
$c->queue_name = $queue_name;
$c->queue_name = $queue_name;
$c->queue_cid_prefix = $queue_cid_prefix;
$c->queue_timeout_action = $queue_timeout_action;
$c->queue_description = $queue_description;
$c->destination_number = $queue_extension;
$a = $c->dialplan();
//synchronize the configuration
save_call_center_xml();
remove_config_from_cache('configuration:callcenter.conf');
@ -337,6 +323,20 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$_SESSION["message"] = $text['message-update'];
} //if ($action == "update")
//dialplan add or update
$c = new call_center;
$c->db = $db;
$c->domain_uuid = $_SESSION['domain_uuid'];
$c->call_center_queue_uuid = $call_center_queue_uuid;
$c->dialplan_uuid = $dialplan_uuid;
$c->queue_name = $queue_name;
$c->queue_name = $queue_name;
$c->queue_cid_prefix = $queue_cid_prefix;
$c->queue_timeout_action = $queue_timeout_action;
$c->queue_description = $queue_description;
$c->destination_number = $queue_extension;
$a = $c->dialplan();
//add agent/tier to queue
$agent_name = check_str($_POST["agent_name"]);
$tier_level = check_str($_POST["tier_level"]);
@ -399,8 +399,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
}
//redirect
header("Location: call_center_queue_edit.php?id=".$call_center_queue_uuid);
return;
header("Location: call_center_queue_edit.php?id=".$call_center_queue_uuid);
return;
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
@ -739,7 +739,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
$record_ext=($_SESSION['record_ext']=='mp3'?'mp3':'wav');
$record_template = $_SESSION['switch']['recordings']['dir']."/archive/\${strftime(%Y)}/\${strftime(%b)}/\${strftime(%d)}/\${uuid}.".$record_ext;
$record_template = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/\${strftime(%Y)}/\${strftime(%b)}/\${strftime(%d)}/\${uuid}.".$record_ext;
echo " <select class='formfld' name='queue_record_template'>\n";
if (strlen($queue_record_template) > 0) {
echo " <option value='$record_template' selected='selected' >".$text['option-true']."</option>\n";

View File

@ -131,7 +131,7 @@ require_once "resources/footer.php";
}
function get_record_cmd(uuid, prefix, name) {
cmd = \"uuid_record \"+uuid+\" start ".$_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/\"+uuid+\".wav\";
cmd = \"uuid_record \"+uuid+\" start ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/".date("Y")."/".date("M")."/".date("d")."/\"+uuid+\".wav\";
return escape(cmd);
}
*/

View File

@ -205,7 +205,7 @@ else {
//park
echo " <a href='javascript:void(0);' onclick=\"send_cmd('calls_exec.php?cmd='+get_park_cmd(escape('$uuid'), '".$tmp_domain."'));\">".$text['label-park']."</a>&nbsp;\n";
//record start/stop
$tmp_dir = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d");
$tmp_dir = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/".date("Y")."/".date("M")."/".date("d");
mkdir($tmp_dir, 0777, true);
$tmp_file = $tmp_dir."/".$uuid.".wav";
if (file_exists($tmp_file)) {

View File

@ -229,13 +229,13 @@ if (count($_GET)>0) {
$x=0;
while (true) {
if ($x > 0) {
$dest_file = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$_GET["uuid"]."_".$x.".wav";
$dest_file = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$_GET["uuid"]."_".$x.".wav";
}
else {
$dest_file = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$_GET["uuid"].".wav";
$dest_file = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$_GET["uuid"].".wav";
}
if (!file_exists($dest_file)) {
rename($_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$_GET["uuid"].".wav", $dest_file);
rename($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$_GET["uuid"].".wav", $dest_file);
break;
}
$x++;

View File

@ -201,7 +201,7 @@ if (is_array($_REQUEST) && !empty($_REQUEST['src']) && !empty($_REQUEST['dest'])
//use the server's time zone to ensure it matches the time zone used by freeswitch
date_default_timezone_set($_SESSION['time_zone']['system']);
//create the api record command and send it over event socket
$switch_cmd = "api uuid_record ".$uuid." start ".$_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$uuid.".wav";
$switch_cmd = "api uuid_record ".$uuid." start ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$uuid.".wav";
$result2 = trim(event_socket_request($fp, $switch_cmd));
}
}

View File

@ -340,15 +340,15 @@ else {
echo " <select name='conference_center_greeting' class='formfld' ".((permission_exists('conference_center_add') || permission_exists('conference_center_edit')) ? "onchange='changeToInput(this);'" : null).">\n";
echo " <option></option>\n";
//recordings
if($dh = opendir($_SESSION['switch']['recordings']['dir']."/")) {
if($dh = opendir($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/")) {
$tmp_selected = false;
$files = Array();
echo "<optgroup label='Recordings'>\n";
while ($file = readdir($dh)) {
if ($file != "." && $file != ".." && $file[0] != '.') {
if (!is_dir($_SESSION['switch']['recordings']['dir']."/".$file)) {
$selected = ($conference_center_greeting == $_SESSION['switch']['recordings']['dir']."/".$file && strlen($conference_center_greeting) > 0) ? true : false;
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$file."' ".(($selected) ? "selected='selected'" : null).">".$file."</option>\n";
if (!is_dir($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$file)) {
$selected = ($conference_center_greeting == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$file && strlen($conference_center_greeting) > 0) ? true : false;
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$file."' ".(($selected) ? "selected='selected'" : null).">".$file."</option>\n";
if ($selected) { $tmp_selected = true; }
}
}
@ -393,8 +393,8 @@ else {
if (permission_exists('conference_center_add') || permission_exists('conference_center_edit')) {
if (!$tmp_selected) {
echo "<optgroup label='selected'>\n";
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$conference_center_greeting)) {
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$conference_center_greeting."' selected='selected'>".$ivr_menu_greet_long."</option>\n";
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$conference_center_greeting)) {
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$conference_center_greeting."' selected='selected'>".$ivr_menu_greet_long."</option>\n";
}
else if (substr($conference_center_greeting, -3) == "wav" || substr($conference_center_greeting, -3) == "mp3") {
echo " <option value='".$conference_center_greeting."' selected='selected'>".$conference_center_greeting."</option>\n";

View File

@ -77,7 +77,7 @@ else {
echo " <tr>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['title-conference_session_details']."</b></td>\n";
echo " <td width='70%' align='right'>\n";
$tmp_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day;
$tmp_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day;
$tmp_name = '';
if (file_exists($tmp_dir.'/'.$row['conference_session_uuid'].'.mp3')) {
$tmp_name = $row['conference_session_uuid'].".mp3";

View File

@ -146,7 +146,7 @@ else {
echo " <td valign='top' class='".$row_style[$c]."'>".$start_date."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$end_date."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['profile']."&nbsp;</td>\n";
$tmp_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day;
$tmp_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day;
$tmp_name = '';
if (file_exists($tmp_dir.'/'.$row['conference_session_uuid'].'.mp3')) {
$tmp_name = $row['conference_session_uuid'].".mp3";

View File

@ -141,7 +141,7 @@ else {
$switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value);
}
elseif ($data == "record") {
$recording_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.date("Y").'/'.date("M").'/'.date("d");
$recording_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.date("Y").'/'.date("M").'/'.date("d");
$switch_cmd .= $recording_dir."/".$uuid.".wav";
if (!file_exists($recording_dir."/".$uuid.".wav")) {
$switch_result = event_socket_request($fp, "api ".$switch_cmd);
@ -149,7 +149,7 @@ else {
}
elseif ($data == "norecord") {
//stop recording and rename the file
$recording_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.date("Y").'/'.date("M").'/'.date("d");
$recording_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.date("Y").'/'.date("M").'/'.date("d");
$switch_cmd .= $recording_dir."/".$uuid.".wav";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}

View File

@ -104,7 +104,7 @@ else {
echo " </td>\n";
echo "<td align='right'>\n";
$recording_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.date("Y").'/'.date("M").'/'.date("d");
$recording_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.date("Y").'/'.date("M").'/'.date("d");
$recording_name = '';
if (file_exists($recording_dir.'/'.$row['uuid'].'.wav')) {
$recording_name = $session_uuid.".wav";

View File

@ -679,7 +679,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if ($row["dialplan_detail_tag"] != "condition") {
if ($row["dialplan_detail_tag"] == "action" && $row["dialplan_detail_type"] == "set" && strpos($row["dialplan_detail_data"], "accountcode") == 0) { continue; } //exclude set:accountcode actions
echo " <tr>\n";
echo " <td>\n";
echo " <td style='padding-top: 5px; padding-right: 3px; white-space: nowrap;'>\n";
if (strlen($row['dialplan_detail_uuid']) > 0) {
echo " <input name='dialplan_details[".$x."][dialplan_detail_uuid]' type='hidden' value=\"".$row['dialplan_detail_uuid']."\">\n";
}

View File

@ -51,6 +51,10 @@
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'device_files';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = "device_extension_view";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";

View File

@ -789,17 +789,17 @@ $text['label-orbit']['de-at'] = "Park + Orbit";
$text['label-orbit']['ar-eg'] = "";
$text['label-orbit']['he'] = "";
$text['label-normal']['en-us'] = "normal";
$text['label-normal']['es-cl'] = "normal";
$text['label-normal']['pt-pt'] = "normal";
$text['label-normal']['fr-fr'] = "normal";
$text['label-normal']['en-us'] = "Normal";
$text['label-normal']['es-cl'] = "Normal";
$text['label-normal']['pt-pt'] = "Normal";
$text['label-normal']['fr-fr'] = "Normal";
$text['label-normal']['pt-br'] = "Normal";
$text['label-normal']['pl'] = "normalny";
$text['label-normal']['uk'] = "звичайно";
$text['label-normal']['sv-se'] = "normal";
$text['label-normal']['de-at'] = "normal";
$text['label-normal']['ar-eg'] = "";
$text['label-normal']['he'] = "";
$text['label-normal']['pl'] = "Normalny";
$text['label-normal']['uk'] = "Звичайно";
$text['label-normal']['sv-se'] = "Normal";
$text['label-normal']['de-at'] = "Normal";
$text['label-normal']['ar-eg'] = "Normal";
$text['label-normal']['he'] = "Normal";
$text['label-none']['en-us'] = "None";
$text['label-none']['es-cl'] = "Ninguno";
@ -1378,6 +1378,19 @@ $text['label-device_mac_address']['de-at'] = "MAC Adresse";
$text['label-device_mac_address']['ar-eg'] = "";
$text['label-device_mac_address']['he'] = "";
$text['label-download']['en-us'] = "Download";
$text['label-download']['es-cl'] = "";
$text['label-download']['pt-pt'] = "";
$text['label-download']['fr-fr'] = "";
$text['label-download']['pt-br'] = "";
$text['label-download']['pl'] = "";
$text['label-download']['uk'] = "";
$text['label-download']['sv-se'] = "";
$text['label-download']['ro'] = "";
$text['label-download']['de-at'] = "";
$text['label-download']['ar-eg'] = "";
$text['label-download']['he'] = "";
$text['label-device_label']['en-us'] = "Label";
$text['label-device_label']['es-cl'] = "Etiqueta";
$text['label-device_label']['pt-pt'] = "Rótulo";
@ -1715,18 +1728,109 @@ $text['label-xfer']['de-at'] = "";
$text['label-xfer']['ar-eg'] = "";
$text['label-xfer']['he'] = "";
$text['label-automata']['en-us'] = "automata";
$text['label-automata']['es-cl'] = "automata";
$text['label-automata']['pt-pt'] = "automata";
$text['label-automata']['fr-fr'] = "automata";
$text['label-automata']['en-us'] = "Automata";
$text['label-automata']['es-cl'] = "Automata";
$text['label-automata']['pt-pt'] = "Automata";
$text['label-automata']['fr-fr'] = "Automata";
$text['label-automata']['pt-br'] = "Automata";
$text['label-automata']['pl'] = "automaty";
$text['label-automata']['uk'] = "";
$text['label-automata']['pl'] = "Automaty";
$text['label-automata']['uk'] = "Automata";
$text['label-automata']['sv-se'] = "Automata";
$text['label-automata']['ro'] = "";
$text['label-automata']['de-at'] = "automata";
$text['label-automata']['ar-eg'] = "";
$text['label-automata']['he'] = "";
$text['label-automata']['ro'] = "Automata";
$text['label-automata']['de-at'] = "Automata";
$text['label-automata']['ar-eg'] = "Automata";
$text['label-automata']['he'] = "Automata";
$text['label-messages']['en-us'] = "Messages";
$text['label-messages']['es-cl'] = "Messages";
$text['label-messages']['pt-pt'] = "Messages";
$text['label-messages']['fr-fr'] = "Messages";
$text['label-messages']['pt-br'] = "Messages";
$text['label-messages']['pl'] = "Messages";
$text['label-messages']['uk'] = "Messages";
$text['label-messages']['sv-se'] = "Messages";
$text['label-messages']['ro'] = "Messages";
$text['label-messages']['de-at'] = "Messages";
$text['label-messages']['ar-eg'] = "Messages";
$text['label-messages']['he'] = "Messages";
$text['label-micmute']['en-us'] = "MicMute";
$text['label-micmute']['es-cl'] = "MicMute";
$text['label-micmute']['pt-pt'] = "MicMute";
$text['label-micmute']['fr-fr'] = "MicMute";
$text['label-micmute']['pt-br'] = "MicMute";
$text['label-micmute']['pl'] = "MicMute";
$text['label-micmute']['uk'] = "MicMute";
$text['label-micmute']['sv-se'] = "MicMute";
$text['label-micmute']['ro'] = "MicMute";
$text['label-micmute']['de-at'] = "MicMute";
$text['label-micmute']['ar-eg'] = "MicMute";
$text['label-micmute']['he'] = "MicMute";
$text['label-redial']['en-us'] = "Redial";
$text['label-redial']['es-cl'] = "Redial";
$text['label-redial']['pt-pt'] = "Redial";
$text['label-redial']['fr-fr'] = "Redial";
$text['label-redial']['pt-br'] = "Redial";
$text['label-redial']['pl'] = "Redial";
$text['label-redial']['uk'] = "Redial";
$text['label-redial']['sv-se'] = "Redial";
$text['label-redial']['ro'] = "Redial";
$text['label-redial']['de-at'] = "Redial";
$text['label-redial']['ar-eg'] = "Redial";
$text['label-redial']['he'] = "Redial";
$text['label-null']['en-us'] = "Null";
$text['label-null']['es-cl'] = "Null";
$text['label-null']['pt-pt'] = "Null";
$text['label-null']['fr-fr'] = "Null";
$text['label-null']['pt-br'] = "Null";
$text['label-null']['pl'] = "Null";
$text['label-null']['uk'] = "Null";
$text['label-null']['sv-se'] = "Null";
$text['label-null']['ro'] = "Null";
$text['label-null']['de-at'] = "Null";
$text['label-null']['ar-eg'] = "Null";
$text['label-null']['he'] = "Null";
$text['label-speeddial']['en-us'] = "SpeedDial";
$text['label-speeddial']['es-cl'] = "SpeedDial";
$text['label-speeddial']['pt-pt'] = "SpeedDial";
$text['label-speeddial']['fr-fr'] = "SpeedDial";
$text['label-speeddial']['pt-br'] = "SpeedDial";
$text['label-speeddial']['pl'] = "SpeedDial";
$text['label-speeddial']['uk'] = "SpeedDial";
$text['label-speeddial']['sv-se'] = "SpeedDial";
$text['label-speeddial']['ro'] = "SpeedDial";
$text['label-speeddial']['de-at'] = "SpeedDial";
$text['label-speeddial']['ar-eg'] = "SpeedDial";
$text['label-speeddial']['he'] = "SpeedDial";
$text['label-speeddialmenu']['en-us'] = "SpeedDialMenu";
$text['label-speeddialmenu']['es-cl'] = "SpeedDialMenu";
$text['label-speeddialmenu']['pt-pt'] = "SpeedDialMenu";
$text['label-speeddialmenu']['fr-fr'] = "SpeedDialMenu";
$text['label-speeddialmenu']['pt-br'] = "SpeedDialMenu";
$text['label-speeddialmenu']['pl'] = "SpeedDialMenu";
$text['label-speeddialmenu']['uk'] = "SpeedDialMenu";
$text['label-speeddialmenu']['sv-se'] = "SpeedDialMenu";
$text['label-speeddialmenu']['ro'] = "SpeedDialMenu";
$text['label-speeddialmenu']['de-at'] = "SpeedDialMenu";
$text['label-speeddialmenu']['ar-eg'] = "SpeedDialMenu";
$text['label-speeddialmenu']['he'] = "SpeedDialMenu";
$text['label-url']['en-us'] = "URL";
$text['label-url']['es-cl'] = "URL";
$text['label-url']['pt-pt'] = "URL";
$text['label-url']['fr-fr'] = "URL";
$text['label-url']['pt-br'] = "URL";
$text['label-url']['pl'] = "URL";
$text['label-url']['uk'] = "URL";
$text['label-url']['sv-se'] = "URL";
$text['label-url']['ro'] = "URL";
$text['label-url']['de-at'] = "URL";
$text['label-url']['ar-eg'] = "URL";
$text['label-url']['he'] = "URL";
$text['label-auto_answer']['en-us'] = "Auto Answer";
$text['label-auto_answer']['es-cl'] = "Respuesta Automática";
@ -2508,6 +2612,32 @@ $text['button-copy']['de-at'] = "Kopieren";
$text['button-copy']['ar-eg'] = "نسخ";
$text['button-copy']['he'] = "העתקה";
$text['button-files']['en-us'] = "Files";
$text['button-files']['es-cl'] = "";
$text['button-files']['pt-pt'] = "";
$text['button-files']['fr-fr'] = "";
$text['button-files']['pt-br'] = "";
$text['button-files']['pl'] = "";
$text['button-files']['uk'] = "";
$text['button-files']['sv-se'] = "";
$text['button-files']['ro'] = "";
$text['button-files']['de-at'] = "";
$text['button-files']['ar-eg'] = "";
$text['button-files']['he'] = "";
$text['button-download']['en-us'] = "Download";
$text['button-download']['es-cl'] = "";
$text['button-download']['pt-pt'] = "";
$text['button-download']['fr-fr'] = "";
$text['button-download']['pt-br'] = "";
$text['button-download']['pl'] = "";
$text['button-download']['uk'] = "";
$text['button-download']['sv-se'] = "";
$text['button-download']['ro'] = "";
$text['button-download']['de-at'] = "";
$text['button-download']['ar-eg'] = "";
$text['button-download']['he'] = "";
$text['button-back']['en-us'] = "Back";
$text['button-back']['es-cl'] = "Volver";
$text['button-back']['pt-pt'] = "Voltar";

View File

@ -233,6 +233,9 @@ require_once "resources/require.php";
//array cleanup
$x = 0;
//unset($_POST["autocomplete"]);
unset($_POST["target_file"]);
unset($_POST["file_action"]);
foreach ($_POST["device_lines"] as $row) {
//unset the empty row
if (strlen($row["line_number"]) == 0) {
@ -515,10 +518,68 @@ require_once "resources/require.php";
});
}
</script>
<?php
//select file download javascript
if (permission_exists("device_files")) {
echo "<script language='javascript' type='text/javascript'>\n";
echo " var fade_speed = 400;\n";
echo " function show_files() {\n";
echo " document.getElementById('file_action').value = 'files';\n";
echo " $('#button_files').fadeOut(fade_speed, function() {\n";
echo " $('#button_back_location').fadeOut(fade_speed);\n";
echo " $('#button_back').fadeIn(fade_speed);\n";
echo " $('#target_file').fadeIn(fade_speed);\n";
echo " $('#button_download').fadeIn(fade_speed);\n";
echo " });";
echo " }";
echo " function hide_files() {\n";
echo " document.getElementById('file_action').value = '';\n";
echo " $('#button_back_location').fadeIn(fade_speed);\n";
echo " $('#button_back').fadeOut(fade_speed);\n";
echo " $('#target_file').fadeOut(fade_speed);\n";
echo " $('#button_download').fadeOut(fade_speed, function() {\n";
echo " $('#button_files').fadeIn(fade_speed);\n";
echo " document.getElementById('target_file').selectedIndex = 0;\n";
echo " });\n";
echo " }\n";
echo " function download(d) {\n";
echo " if (d == '".$text['label-download']."') return;\n";
if ($_SESSION['provision']['http_domain_filter']['text'] == "false") {
$domain_name = $_SERVER["HTTP_HOST"];
}
else {
$domain_name = $_SESSION['domain_name'];
}
echo " window.location = 'https://".$domain_name."/app/provision?mac=$device_mac_address&file=' + d + '&content_type=application/octet-stream';\n";
echo " }\n";
echo "\n";
echo " $( document ).ready(function() {\n";
echo " $('#default_setting_search').focus();\n";
if ($search == '') {
echo " // scroll to previous category\n";
echo " var category_span_id;\n";
echo " var url = document.location.href;\n";
echo " var hashindex = url.indexOf('#');\n";
echo " if (hashindex == -1) { }\n";
echo " else {\n";
echo " category_span_id = url.substr(hashindex + 1);\n";
echo " }\n";
echo " if (category_span_id) {\n";
echo " $('#page').animate({scrollTop: $('#anchor_'+category_span_id).offset().top - 200}, 'slow');\n";
echo " }\n";
}
echo " });\n";
echo "</script>";
}
//show the content
echo "<form method='post' name='frm' id='frm' action='' onsubmit='check_duplicates(); return false;'>\n";
//echo "<input style='display:none;' type='password' name='autocomplete'>";
echo "<input type='hidden' name='file_action' id='file_action' value=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap='nowrap' valign='top'>";
@ -528,7 +589,27 @@ require_once "resources/require.php";
echo " <br><br>";
echo "</td>\n";
echo "<td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='devices.php'\" value='".$text['button-back']."'>\n";
echo " <input type='button' class='btn' id='button_back_location' name='' alt='".$text['button-back']."' onclick=\"window.location='devices.php'\" value='".$text['button-back']."'>\n";
if (permission_exists("device_files")) {
//get the template directory
$prov = new provision;
$prov->domain_uuid = $domain_uuid;
$template_dir = $prov->template_dir;
$files = glob($template_dir.'/'.$device_template.'/*');
//add file buttons and the file list
echo " <input type='button' class='btn' id='button_files' name='' alt='".$text['button-files']."' onclick='show_files();' value='".$text['button-files']."'>";
echo " <input type='button' class='btn' style='display: none;' id='button_back' name='' alt='".$text['button-back']."' onclick='hide_files();' value='".$text['button-back']."'> ";
echo " <select class='formfld' style='display: none; width: auto;' name='target_file' id='target_file' onchange='download(this.value)'>\n";
echo " <option value=''>".$text['label-download']."</option>\n";
foreach ($files as $file) {
//render the file name
$file_name = str_replace("{\$mac}",$device_mac_address,basename($file));
//add the select option
echo " <option value='".basename($file)."'>".$file_name."</option>\n";
}
echo " </select>\n";
//echo " <input type='button' class='btn' id='button_download' style='display: none;' alt='".$text['button-download']."' value='".$text['button-download']."' onclick='document.forms.frm.submit();'>";
}
if (permission_exists('device_add') && $action != "add") {
echo " <input type='button' class='btn' name='' alt='".$text['button-copy']."' onclick=\"var new_mac = prompt('".$text['message_device']."'); if (new_mac != null) { window.location='device_copy.php?id=".$device_uuid."&mac=' + new_mac; }\" value='".$text['button-copy']."'>\n";
}
@ -964,6 +1045,13 @@ require_once "resources/require.php";
<option value='line' <?php if ($row['device_key_type'] == "line") { echo $selected;$found=true; } ?>><?php echo $text['label-line'] ?></option>
<option value='automata' <?php if ($row['device_key_type'] == "automata") { echo $selected;$found=true; } ?>><?php echo $text['label-automata'] ?></option>
<option value='normal' <?php if ($row['device_key_type'] == "normal") { echo $selected;$found=true; } ?>><?php echo $text['label-normal'] ?></option>
<option value='Messages' <?php if ($row['device_key_type'] == "Messages") { echo $selected;$found=true; } ?>><?php echo $text['label-messages'] ?></option>
<option value='MicMute' <?php if ($row['device_key_type'] == "MicMute") { echo $selected;$found=true; } ?>><?php echo $text['label-micmute'] ?></option>
<option value='Redial' <?php if ($row['device_key_type'] == "Redial") { echo $selected;$found=true; } ?>><?php echo $text['label-redial'] ?></option>
<option value='Null' <?php if ($row['device_key_type'] == "Null") { echo $selected;$found=true; } ?>><?php echo $text['label-null'] ?></option>
<option value='SpeedDial' <?php if ($row['device_key_type'] == "SpeedDial") { echo $selected;$found=true; } ?>><?php echo $text['label-speeddial'] ?></option>
<option value='SpeedDialMenu' <?php if ($row['device_key_type'] == "SpeedDialMenu") { echo $selected;$found=true; } ?>><?php echo $text['label-speeddialmenu'] ?></option>
<option value='URL' <?php if ($row['device_key_type'] == "URL") { echo $selected;$found=true; } ?>><?php echo $text['label-url'] ?></option>
<?php
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
}

View File

@ -454,6 +454,13 @@ require_once "resources/require.php";
<option value='line' <?php if ($row['device_key_type'] == "line") { echo $selected;$found=true; } ?>><?php echo $text['label-line'] ?></option>
<option value='automata' <?php if ($row['device_key_type'] == "automata") { echo $selected;$found=true; } ?>><?php echo $text['label-automata'] ?></option>
<option value='normal' <?php if ($row['device_key_type'] == "normal") { echo $selected;$found=true; } ?>><?php echo $text['label-normal'] ?></option>
<option value='Messages' <?php if ($row['device_key_type'] == "Messages") { echo $selected;$found=true; } ?>><?php echo $text['label-messages'] ?></option>
<option value='MicMute' <?php if ($row['device_key_type'] == "MicMute") { echo $selected;$found=true; } ?>><?php echo $text['label-micmute'] ?></option>
<option value='Redial' <?php if ($row['device_key_type'] == "Redial") { echo $selected;$found=true; } ?>><?php echo $text['label-redial'] ?></option>
<option value='Null' <?php if ($row['device_key_type'] == "Null") { echo $selected;$found=true; } ?>><?php echo $text['label-null'] ?></option>
<option value='SpeedDial' <?php if ($row['device_key_type'] == "SpeedDial") { echo $selected;$found=true; } ?>><?php echo $text['label-speeddial'] ?></option>
<option value='SpeedDialMenu' <?php if ($row['device_key_type'] == "SpeedDialMenu") { echo $selected;$found=true; } ?>><?php echo $text['label-speeddialmenu'] ?></option>
<option value='URL' <?php if ($row['device_key_type'] == "URL") { echo $selected;$found=true; } ?>><?php echo $text['label-url'] ?></option>
<?php
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
}

View File

@ -77,6 +77,15 @@ else {
}
unset ($prep_statement);
//create a new app_uuid when copying a dialplan except for these exceptions
switch ($app_uuid) {
case "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4": //inbound routes
case "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3": //outbound routes
case "4b821450-926b-175a-af93-a03c441818b1": //time conditions
default:
$app_uuid = uuid();
}
//copy the dialplan
$dialplan_uuid = uuid();
$sql = "insert into v_dialplans ";

View File

@ -381,7 +381,11 @@ include "root.php";
if (!is_array($_SESSION[$_SESSION['domain_uuid']]['outbound_routes'])) {
//get the outbound routes from the database
$sql = "select * from v_dialplans as d, v_dialplan_details as s ";
$sql .= "where d.domain_uuid = '".$this->domain_uuid."' ";
$sql .= "where ";
$sql .= "( ";
$sql .= "d.domain_uuid = '".$this->domain_uuid."' ";
$sql .= "or d.domain_uuid is null ";
$sql .= ") ";
$sql .= "and d.app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3' ";
$sql .= "and d.dialplan_enabled = 'true' ";
$sql .= "and d.dialplan_uuid = s.dialplan_uuid ";

View File

@ -1,9 +1,9 @@
<context name="{v_context}">
<extension name="local_extension" number="[ext]" continue="false" app_uuid="71cf1310-b6e3-415b-8745-3cbdc8e15212">
<condition field="destination_number" expression="(^\d{2,7}$)">
<condition field="${user_exists}" expression="true">
<!--<action application="pre_answer"/>-->
<action application="export" data="dialed_extension=$1" inline="true"/>
<action application="limit" data="hash ${domain_name} $1 ${limit_max} ${limit_destination}" inline="false" />
<action application="export" data="dialed_extension=${destination_number}" inline="true"/>
<action application="limit" data="hash ${domain_name} ${destination_number} ${limit_max} ${limit_destination}" inline="false" />
</condition>
<!--Allow transfer/record only for internal users-->

View File

@ -145,12 +145,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$dialplan_name = str_replace("/", "", $dialplan_name);
//set the context
if (count($_SESSION["domains"]) > 1) {
$context = 'default';
}
else {
$context = '$${domain_name}';
}
$context = '$${domain_name}';
//start the atomic transaction
$count = $db->exec("BEGIN;"); //returns affected rows

View File

@ -207,7 +207,7 @@ else {
$label = $text['label-11d'];
$abbrv = "11d";
break;
case "^\+?1?(\d{10})$":
case "^(?:\+1|1)?([2-9]\d\d[2-9]\d{6})$":
$label = $text['label-north-america'];
$abbrv = "10-11d";
break;

View File

@ -72,6 +72,15 @@ $text['label-type_voicemail']['pl'] = "Poczta głosowa";
$text['label-type_voicemail']['sv-se'] = "Röstbrevlåda";
$text['label-type_voicemail']['de-at'] = "Mailbox";
$text['label-type_email2fax']['en-us'] = "Email to fax report";
$text['label-type_email2fax']['es-cl'] = "";
$text['label-type_email2fax']['pt-pt'] = "";
$text['label-type_email2fax']['fr-fr'] = "";
$text['label-type_email2fax']['pt-br'] = "";
$text['label-type_email2fax']['pl'] = "";
$text['label-type_email2fax']['sv-se'] = "";
$text['label-type_email2fax']['de-at'] = "";
$text['label-type']['en-us'] = "Type";
$text['label-type']['es-cl'] = "Tipo";
$text['label-type']['pt-pt'] = "Tipo";

View File

@ -277,6 +277,14 @@
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "fax_send_greeting";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "fax_send_channels";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
//$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "fax_keep_local";
//$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "fax_local";
//$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
@ -499,4 +507,79 @@
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$y = 4; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_fax_tasks';
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_task_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_fax';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'fax_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'FAX server primary key';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_next_time';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'timestamp';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_lock_time';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'timestamp';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_fax_file';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_wav_file';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_uri';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_dial_string';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_dtmf';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_reply_address';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_interrupted';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_status';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_no_answer_counter';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_no_answer_retry_counter';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_retry_counter';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_description';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
?>

View File

@ -12,6 +12,13 @@ if ($domains_processed == 1) {
$array[$x]['default_setting_description'] = 'Path to image/logo file displayed in the header of the cover sheet.';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'cover_font';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = 'times';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Font used to generate cover page. Can be full path to .ttf file or font name alredy installed.';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'cover_footer';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = "The information contained in this facsimile is intended for the sole confidential use of the recipient(s) designated above, and may contain confidential and legally privileged information. If you are not the intended recipient, you are hereby notified that the review, disclosure, dissemination, distribution, copying, duplication in any form, and taking of any action in regards to the contents of this document - except with respect to its direct delivery to the intended recipient - is strictly prohibited. Please notify the sender immediately and destroy this cover sheet and all attachments. If stored or viewed electronically, please permanently delete it from your system.";
@ -60,6 +67,55 @@ if ($domains_processed == 1) {
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Keep the file after sending or receiving the fax.';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'send_mode';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = 'queue';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'send_retry_limit';
$array[$x]['default_setting_name'] = 'numeric';
$array[$x]['default_setting_value'] = '5';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Number of attempts to send fax (count only calls with answer)';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'send_retry_interval';
$array[$x]['default_setting_name'] = 'numeric';
$array[$x]['default_setting_value'] = '15';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Delay before we make next call after answered call';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'send_no_answer_retry_limit';
$array[$x]['default_setting_name'] = 'numeric';
$array[$x]['default_setting_value'] = '3';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Number of unanswered attempts in sequence';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'send_no_answer_retry_interval';
$array[$x]['default_setting_name'] = 'numeric';
$array[$x]['default_setting_value'] = '30';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Delay before we make next call after no answered call';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'send_no_answer_limit';
$array[$x]['default_setting_name'] = 'numeric';
$array[$x]['default_setting_value'] = '3';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Giveup reach the destination after this number of sequences';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'send_no_answer_interval';
$array[$x]['default_setting_name'] = 'numeric';
$array[$x]['default_setting_value'] = '300';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Delay before next call sequence';
$x++;
//get an array of the default settings
$sql = "select * from v_default_settings ";
$prep_statement = $db->prepare($sql);

View File

@ -1111,6 +1111,28 @@ $text['label-accountcode']['de-at'] = "Account Code";
$text['label-accountcode']['ro'] = "Cod cont";
$text['label-accountcode']['he'] = "קוד חשבון";
$text['label-fax_send_greeting']['en-us'] = "Greeting";
$text['label-fax_send_greeting']['es-cl'] = "";
$text['label-fax_send_greeting']['pt-pt'] = "";
$text['label-fax_send_greeting']['fr-fr'] = "";
$text['label-fax_send_greeting']['pt-br'] = "";
$text['label-fax_send_greeting']['pl'] = "";
$text['label-fax_send_greeting']['sv-se'] = "";
$text['label-fax_send_greeting']['de-at'] = "";
$text['label-fax_send_greeting']['ro'] = "";
$text['label-fax_send_greeting']['he'] = "";
$text['label-fax_send_channels']['en-us'] = "Number of channels";
$text['label-fax_send_channels']['es-cl'] = "";
$text['label-fax_send_channels']['pt-pt'] = "";
$text['label-fax_send_channels']['fr-fr'] = "";
$text['label-fax_send_channels']['pt-br'] = "";
$text['label-fax_send_channels']['pl'] = "";
$text['label-fax_send_channels']['sv-se'] = "";
$text['label-fax_send_channels']['de-at'] = "";
$text['label-fax_send_channels']['ro'] = "";
$text['label-fax_send_channels']['he'] = "";
$text['header-sent']['en-us'] = "Sent Faxes";
$text['header-sent']['es-cl'] = "Los Faxes Enviados";
$text['header-sent']['pt-pt'] = "Faxes Enviados";

View File

@ -53,12 +53,7 @@ else {
}
//set the fax directory
if (count($_SESSION["domains"]) > 1) {
$fax_dir = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'];
}
else {
$fax_dir = $_SESSION['switch']['storage']['dir'].'/fax';
}
$fax_dir = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'];
//get the fax extension
if (strlen($fax_extension) > 0) {
@ -135,8 +130,10 @@ else {
} else {
$forward_prefix = $forward_prefix.$fax_forward_number.'#'; //found
}
$fax_local = check_str($_POST["fax_local"]);
$fax_local = check_str($_POST["fax_local"]); //! @todo check in database
$fax_description = check_str($_POST["fax_description"]);
$fax_send_greeting = check_str($_POST["fax_send_greeting"]);
$fax_send_channels = check_str($_POST["fax_send_channels"]);
}
//delete the user from the fax users
@ -274,6 +271,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
if (strlen($fax_forward_number) > 0) {
$sql .= "fax_forward_number, ";
}
$sql .= "fax_send_greeting,";
$sql .= "fax_send_channels,";
$sql .= "fax_description ";
$sql .= ")";
$sql .= "values ";
@ -305,6 +304,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
if (strlen($fax_forward_number) > 0) {
$sql .= "'$fax_forward_number', ";
}
$sql .= (strlen($fax_send_greeting)==0?'NULL':"'$fax_send_greeting'") . ",";
$sql .= (strlen($fax_send_channels)==0?'NULL':"'$fax_send_channels'") . ",";
$sql .= "'$fax_description' ";
$sql .= ")";
$db->exec(check_sql($sql));
@ -345,9 +347,16 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
else {
$sql .= "fax_forward_number = null, ";
}
$tmp = strlen($fax_send_greeting)==0?'NULL':"'$fax_send_greeting'";
$sql .= "fax_send_greeting = $tmp,";
$tmp = strlen($fax_send_channels)==0?'NULL':"'$fax_send_channels'";
$sql .= "fax_send_channels = $tmp,";
$sql .= "fax_description = '$fax_description' ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and fax_uuid = '$fax_uuid' ";
$db->exec(check_sql($sql));
unset($sql);
}
@ -426,9 +435,14 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$fax_caller_id_number = $row["fax_caller_id_number"];
$fax_forward_number = $row["fax_forward_number"];
$fax_description = $row["fax_description"];
$fax_send_greeting = $row["fax_send_greeting"];
$fax_send_channels = $row["fax_send_channels"];
}
unset ($prep_statement);
}
else{
$fax_send_channels = 10;
}
//replace the dash with a space
$fax_name = str_replace("-", " ", $fax_name);
@ -667,6 +681,28 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
}
}
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-fax_send_greeting']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='fax_send_greeting' maxlength='255' value=\"$fax_send_greeting\">\n";
echo "<br />\n";
echo " ".$text['description-fax_send_greeting']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-fax_send_channels']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='fax_send_channels' maxlength='255' value=\"$fax_send_channels\">\n";
echo "<br />\n";
echo " ".$text['description-fax_send_channels']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-description']."\n";
@ -677,7 +713,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "".$text['description-info']."\n";
echo "</td>\n";
echo "</tr>\n";
}
echo " <tr>\n";
@ -896,7 +931,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "</table>";
echo "<br>";
echo "</div>\n";
}
echo "</form>";

View File

@ -29,6 +29,8 @@ include "root.php";
require_once "resources/require.php";
require_once "resources/functions/object_to_array.php";
require_once "resources/functions/parse_attachments.php";
require_once "resources/functions/parse_message.php";
require_once "resources/classes/text.php";
//get accounts to monitor
$sql = "select * from v_fax ";
@ -54,6 +56,12 @@ if (sizeof($result) != 0) {
$event_socket['password'] = $record['event_socket_password'];
unset($sql, $prep_statement, $record);
$fax_send_mode_default = $_SESSION['fax']['send_mode']['text'];
if(strlen($fax_send_mode_default) == 0){
$fax_send_mode_default = 'direct';
}
$fax_cover_font_default = $_SESSION['fax']['cover_font']['text'];
foreach ($result as $row) {
//get fax server and account connection details
$fax_uuid = $row["fax_uuid"];
@ -73,12 +81,23 @@ if (sizeof($result) != 0) {
$fax_email_connection_mailbox = $row["fax_email_connection_mailbox"];
$fax_email_outbound_subject_tag = $row["fax_email_outbound_subject_tag"];
$fax_email_outbound_authorized_senders = $row["fax_email_outbound_authorized_senders"];
$fax_send_greeting = $row["fax_send_greeting"];
//load default settings, then domain settings over top
unset($_SESSION);
$_SESSION = $default_settings;
load_domain_settings($domain_uuid);
$fax_send_mode = $_SESSION['fax']['send_mode']['text'];
if(strlen($fax_send_mode) == 0){
$fax_send_mode = $fax_send_mode_default;
}
$fax_cover_font = $_SESSION['fax']['cover_font']['text'];
if(strlen($fax_cover_font) == 0){
$fax_cover_font = $fax_cover_font_default;
}
//load event socket connection parameters
$_SESSION['event_socket_ip_address'] = $event_socket['ip_address'];
$_SESSION['event_socket_port'] = $event_socket['port'];
@ -158,22 +177,14 @@ if (sizeof($result) != 0) {
else {
$fax_numbers[] = $tmp;
}
foreach ($fax_numbers as $index => $fax_number) {
$fax_numbers[$index] = preg_replace("~[^0-9]~", "", $fax_number);
if ($fax_numbers[$index] == '') { unset($fax_numbers[$index]); }
}
unset($fax_subject); //clear so not on cover page
//get email body (if any) for cover page
$fax_message = imap_fetchbody($connection, $email_id, '1.1', FT_UID);
$fax_message = strip_tags($fax_message);
$fax_message = trim($fax_message);
$fax_message = parse_message($connection, $email_id, FT_UID);
if ($fax_message == '') {
$fax_message = imap_fetchbody($connection, $email_id, '1', FT_UID);
$fax_message = strip_tags($fax_message);
$fax_message = trim($fax_message);
$fax_message = str_replace("\r\n\r\n","\r\n", $fax_message);
}
$fax_message = str_replace("\r\n\r\n","\r\n", $fax_message);
// set fax directory (used for pdf creation - cover and/or attachments)
$fax_dir = $_SESSION['switch']['storage']['dir'].'/fax'.(($domain_name != '') ? '/'.$domain_name : null);
@ -199,8 +210,12 @@ if (sizeof($result) != 0) {
}
//send fax
$cwd = getcwd();
$included = true;
require("fax_send.php");
if($cwd){
chdir($cwd);
}
//reset variables
unset($fax_numbers);

View File

@ -86,7 +86,7 @@ else {
}
//set the fax directory
$fax_dir = $_SESSION['switch']['storage']['dir'].'/fax'.((count($_SESSION["domains"]) > 1) ? '/'.$_SESSION['domain_name'] : null);
$fax_dir = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'];
//download the fax
if ($_GET['a'] == "download") {

View File

@ -135,7 +135,7 @@ else {
if (imap_delete($connection, $email_id, FT_UID)) {
if (imap_expunge($connection)) {
//clean up local inbox copy
$fax_dir = $_SESSION['switch']['storage']['dir'].'/fax'.((count($_SESSION["domains"]) > 1) ? '/'.$_SESSION['domain_name'] : null);
$fax_dir = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'];
@unlink($fax_dir.'/'.$fax_extension.'/inbox/'.$attachment[0]['filename']);
//redirect user
$_SESSION["message"] = $text['message-delete'];

View File

@ -58,13 +58,17 @@ if (!$included) {
$fax_uuid = check_str($_REQUEST["id"]);
if (if_group("superadmin") || if_group("admin")) {
//show all fax extensions
$sql = "select * from v_fax ";
$sql = "select fax_uuid, fax_extension, fax_caller_id_name, fax_caller_id_number, ";
$sql .= "accountcode, fax_send_greeting ";
$sql .= "from v_fax ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and fax_uuid = '$fax_uuid' ";
}
else {
//show only assigned fax extensions
$sql = "select * from v_fax as f, v_fax_users as u ";
$sql = "select f.fax_uuid, f.fax_extension, f.fax_caller_id_name, f.fax_caller_id_number, ";
$sql .= "f.accountcode, f.fax_send_greeting ";
$sql .= "from v_fax as f, v_fax_users as u ";
$sql .= "where f.fax_uuid = u.fax_uuid ";
$sql .= "and f.domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and f.fax_uuid = '$fax_uuid' ";
@ -84,35 +88,113 @@ if (!$included) {
}
foreach ($result as &$row) {
//set database fields as variables
$fax_uuid = $row["fax_uuid"];
$fax_extension = $row["fax_extension"];
$fax_caller_id_name = $row["fax_caller_id_name"];
$fax_caller_id_number = $row["fax_caller_id_number"];
$fax_accountcode = $row["accountcode"];
$fax_send_greeting = $row["fax_send_greeting"];
//limit to one row
break;
}
unset ($prep_statement);
$fax_send_mode = $_SESSION['fax']['send_mode']['text'];
if(strlen($fax_send_mode) == 0){
$fax_send_mode = 'direct';
}
}
//set the fax directory
$fax_dir = $_SESSION['switch']['storage']['dir'].'/fax'.((count($_SESSION["domains"]) > 1) ? '/'.$_SESSION['domain_name'] : null);
$fax_dir = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'];
// set fax cover font to generate pdf
$fax_cover_font = $_SESSION['fax']['cover_font']['text'];
}
else{
require_once "resources/classes/EventSocket.php";
}
function correct_path($p) {
global $IS_WINDOWS;
if ($IS_WINDOWS) {
return str_replace('/', '\\', $p);
if(!function_exists('correct_path')) {
function correct_path($p) {
global $IS_WINDOWS;
if ($IS_WINDOWS) {
return str_replace('/', '\\', $p);
}
return $p;
}
return $p;
}
function gs_cmd($args) {
global $IS_WINDOWS;
if ($IS_WINDOWS) {
return 'gswin32c '.$args;
if(!function_exists('gs_cmd')) {
function gs_cmd($args) {
global $IS_WINDOWS;
if ($IS_WINDOWS) {
return 'gswin32c '.$args;
}
return 'gs '.$args;
}
return 'gs '.$args;
}
if(!function_exists('fax_enqueue')) {
function fax_enqueue($fax_uuid, $fax_file, $wav_file, $reply_address, $fax_uri, $fax_dtmf, $dial_string){
global $db, $db_type;
$fax_task_uuid = uuid();
$dial_string .= "fax_task_uuid='" . $fax_task_uuid . "',";
$description = ''; //! @todo add description
if ($db_type == "pgsql") {
$date_utc_now_sql = "NOW() at time zone 'utc'";
}
if ($db_type == "mysql") {
$date_utc_now_sql = "UTC_TIMESTAMP()";
}
if ($db_type == "sqlite") {
$date_utc_now_sql = "datetime('now')";
}
$sql = <<<HERE
INSERT INTO v_fax_tasks( fax_task_uuid, fax_uuid,
task_next_time, task_lock_time,
task_fax_file, task_wav_file, task_uri, task_dial_string, task_dtmf,
task_interrupted, task_status, task_no_answer_counter, task_no_answer_retry_counter, task_retry_counter,
task_reply_address, task_description)
VALUES (?, ?,
$date_utc_now_sql, NULL,
?, ?, ?, ?, ?,
'false', 0, 0, 0, 0,
?, ?);
HERE;
$stmt = $db->prepare($sql);
$i = 0;
$stmt->bindValue(++$i, $fax_task_uuid);
$stmt->bindValue(++$i, $fax_uuid);
$stmt->bindValue(++$i, $fax_file);
$stmt->bindValue(++$i, $wav_file);
$stmt->bindValue(++$i, $fax_uri);
$stmt->bindValue(++$i, $dial_string);
$stmt->bindValue(++$i, $fax_dtmf);
$stmt->bindValue(++$i, $reply_address);
$stmt->bindValue(++$i, $description);
if ($stmt->execute()) {
$response = 'Enqueued';
}
else{
//! @todo log error
$response = 'Fail enqueue';
var_dump($db->errorInfo());
}
unset($stmt);
return $response;
}
}
if(!function_exists('fax_split_dtmf')) {
function fax_split_dtmf(&$fax_number, &$fax_dtmf){
$tmp = array();
$fax_dtmf = '';
if(preg_match('/^\s*(.*?)\s*\((.*)\)\s*$/', $fax_number, $tmp)){
$fax_number = $tmp[1];
$fax_dtmf = $tmp[2];
}
}
}
//get the fax extension
@ -131,7 +213,7 @@ function gs_cmd($args) {
mkdir($_SESSION['switch']['storage']['dir'].'/fax');
chmod($_SESSION['switch']['storage']['dir'].'/fax',0774);
}
if (count($_SESSION["domains"]) > 1 && !is_dir($_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'])) {
if (!is_dir($_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'])) {
mkdir($_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name']);
chmod($_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'],0774);
}
@ -156,7 +238,6 @@ function gs_cmd($args) {
//clear file status cache
clearstatcache();
//send the fax
$continue = false;
@ -164,14 +245,6 @@ function gs_cmd($args) {
if (($_POST['action'] == "send")) {
$fax_numbers = $_POST['fax_numbers'];
if (sizeof($fax_numbers) > 0) {
foreach ($fax_numbers as $index => $fax_number) {
$fax_numbers[$index] = preg_replace("~[^0-9]~", "", $fax_number);
if ($fax_numbers[$index] == '') { unset($fax_numbers[$index]); }
}
sort($fax_numbers);
}
$fax_uuid = check_str($_POST["id"]);
$fax_caller_id_name = check_str($_POST['fax_caller_id_name']);
$fax_caller_id_number = check_str($_POST['fax_caller_id_number']);
@ -193,6 +266,23 @@ function gs_cmd($args) {
$continue = true;
}
// cleanup numbers
if (isset($fax_numbers)) {
foreach ($fax_numbers as $index => $fax_number) {
fax_split_dtmf($fax_number, $fax_dtmf);
$fax_number = preg_replace("~[^0-9]~", "", $fax_number);
$fax_dtmf = preg_replace("~[^0-9Pp*#]~", "", $fax_dtmf);
if ($fax_number != ''){
if ($fax_dtmf != '') {$fax_number .= " (" . $fax_dtmf . ")";}
$fax_numbers[$index] = $fax_number;
}
else{
unset($fax_numbers[$index]);
}
}
sort($fax_numbers);
}
if ($continue) {
//determine page size
switch ($fax_page_size) {
@ -315,6 +405,19 @@ function gs_cmd($args) {
$pdf -> setPrintFooter(false);
$pdf -> SetMargins(0, 0, 0, true);
if(strlen($fax_cover_font) > 0){
if(substr($fax_cover_font, -4) == '.ttf'){
$pdf_font = TCPDF_FONTS::addTTFfont($fax_cover_font);
}
else{
$pdf_font = $fax_cover_font;
}
}
if(!$pdf_font){
$pdf_font = 'times';
}
//add blank page
$pdf -> AddPage('P', array($page_width, $page_height));
@ -322,9 +425,6 @@ function gs_cmd($args) {
$x = 0;
$y = 0;
// output grid
//showgrid($pdf);
//logo
$display_logo = false;
if (!isset($_SESSION['fax']['cover_logo']['text'])) {
@ -368,23 +468,23 @@ function gs_cmd($args) {
//header
if ($fax_header != '') {
$pdf -> SetLeftMargin(0.5);
$pdf -> SetFont("times", "", 10);
$pdf -> SetFont($pdf_font, "", 10);
$pdf -> Write(0.3, $fax_header);
}
//fax, cover sheet
$pdf -> SetTextColor(0,0,0);
$pdf -> SetFont("times", "B", 55);
$pdf -> SetFont($pdf_font, "B", 55);
$pdf -> SetXY($x + 4.55, $y + 0.25);
$pdf -> Cell($x + 3.50, $y + 0.4, $text['label-fax-fax'], 0, 0, 'R', false, null, 0, false, 'T', 'T');
$pdf -> SetFont("times", "", 12);
$pdf -> SetFont($pdf_font, "", 12);
$pdf -> SetFontSpacing(0.0425);
$pdf -> SetXY($x + 4.55, $y + 1.0);
$pdf -> Cell($x + 3.50, $y + 0.4, $text['label-fax-cover-sheet'], 0, 0, 'R', false, null, 0, false, 'T', 'T');
$pdf -> SetFontSpacing(0);
//field labels
$pdf -> SetFont("times", "B", 12);
$pdf -> SetFont($pdf_font, "B", 12);
if ($fax_recipient != '' || sizeof($fax_numbers) > 0) {
$pdf -> Text($x + 0.5, $y + 2.0, strtoupper($text['label-fax-recipient']).":");
}
@ -399,7 +499,7 @@ function gs_cmd($args) {
}
//field values
$pdf -> SetFont("times", "", 12);
$pdf -> SetFont($pdf_font, "", 12);
$pdf -> SetXY($x + 2.0, $y + 1.95);
if ($fax_recipient != '') {
$pdf -> Write(0.3, $fax_recipient);
@ -439,7 +539,7 @@ function gs_cmd($args) {
//message
$pdf -> Rect($x + 0.5, $y + 3.4, 7.5, 6.25, 'D');
if ($fax_message != '') {
$pdf -> SetFont("times", "", 12);
$pdf -> SetFont($pdf_font, "", 12);
$pdf -> SetXY($x + 0.75, $y + 3.65);
$pdf -> MultiCell(7, 5.75, $fax_message, 0, 'L', false);
}
@ -527,7 +627,7 @@ function gs_cmd($args) {
}
//preview, if requested
if ($_REQUEST['submit'] == $text['button-preview']) {
if (($_REQUEST['submit'] != '') && ($_REQUEST['submit'] == $text['button-preview'])) {
unset($file_type);
if (file_exists($dir_fax_temp.'/'.$fax_instance_uuid.'.pdf')) {
$file_type = 'pdf';
@ -592,29 +692,64 @@ function gs_cmd($args) {
}
//send the fax
$fax_file = $dir_fax_temp."/".$fax_instance_uuid.".tif";
$common_dial_string = "for_fax=1,";
$common_dial_string .= "accountcode='" . $fax_accountcode . "',";
$common_dial_string .= "sip_h_X-accountcode='" . $fax_accountcode . "',";
$common_dial_string .= "domain_uuid=" . $_SESSION["domain_uuid"] . ",";
$common_dial_string .= "domain_name=" . $_SESSION["domain_name"] . ",";
$common_dial_string .= "origination_caller_id_name='" . $fax_caller_id_name . "',";
$common_dial_string .= "origination_caller_id_number='" . $fax_caller_id_number . "',";
$common_dial_string .= "fax_ident='" . $fax_caller_id_number . "',";
$common_dial_string .= "fax_header='" . $fax_caller_id_name . "',";
$common_dial_string .= "fax_file='" . $fax_file . "',";
foreach ($fax_numbers as $fax_number) {
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
//prepare the fax command
$route_array = outbound_route_to_bridge($_SESSION['domain_uuid'], $fax_prefix.$fax_number);
$fax_file = $dir_fax_temp."/".$fax_instance_uuid.".tif";
if (count($route_array) == 0) {
//send the internal call to the registered extension
$fax_uri = "user/".$fax_number."@".$_SESSION['domain_name'];
$t38 = "";
$dial_string = $common_dial_string;
fax_split_dtmf($fax_number, $fax_dtmf);
//prepare the fax command
$route_array = outbound_route_to_bridge($_SESSION['domain_uuid'], $fax_prefix . $fax_number);
if (count($route_array) == 0) {
//send the internal call to the registered extension
$fax_uri = "user/".$fax_number."@".$_SESSION['domain_name'];
$t38 = "";
}
else {
//send the external call
$fax_uri = $route_array[0];
$t38 = "fax_enable_t38=true,fax_enable_t38_request=true,";
}
if ($fax_send_mode != 'queue') {
$dial_string .= $t38;
$dial_string .= "mailto_address='" . $mailto_address . "',";
$dial_string .= "mailfrom_address='" . $mailfrom_address . "',";
$dial_string .= "fax_uri=" . $fax_uri . ",";
$dial_string .= "fax_retry_attempts=1" . ",";
$dial_string .= "fax_retry_limit=20" . ",";
$dial_string .= "fax_retry_sleep=180" . ",";
$dial_string .= "fax_verbose=true" . ",";
$dial_string .= "fax_use_ecm=off" . ",";
$dial_string .= "api_hangup_hook='lua fax_retry.lua'";
$dial_string = "{" . $dial_string . "}" . $fax_uri." &txfax('".$fax_file."')";
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$cmd = "api originate " . $dial_string;
// echo($cmd . "<br/>\n");
//send the command to event socket
$response = event_socket_request($fp, $cmd);
$response = str_replace("\n", "", $response);
$uuid = str_replace("+OK ", "", $response);
}
else {
//send the external call
$fax_uri = $route_array[0];
$t38 = "fax_enable_t38=true,fax_enable_t38_request=true,";
}
$cmd = "api originate {for_fax=1,accountcode='".$fax_accountcode."',sip_h_X-accountcode='".$fax_accountcode."',domain_uuid=".$_SESSION["domain_uuid"].",domain_name=".$_SESSION["domain_name"].",mailto_address='".$mailto_address."',mailfrom_address='".$mailfrom_address."',origination_caller_id_name='".$fax_caller_id_name."',origination_caller_id_number='".$fax_caller_id_number."',fax_ident='".$fax_caller_id_number."',fax_header='".$fax_caller_id_name."',fax_uri=".$fax_uri.",fax_file='".$fax_file."',fax_retry_attempts=1,fax_retry_limit=20,fax_retry_sleep=180,fax_verbose=true,fax_use_ecm=off,".$t38."api_hangup_hook='lua fax_retry.lua'}".$fax_uri." &txfax('".$fax_file."')";
//send the command to event socket
$response = event_socket_request($fp, $cmd);
$response = str_replace("\n", "", $response);
$uuid = str_replace("+OK ", "", $response);
fclose($fp);
}
else{ // enqueue
$wav_file = ''; //! @todo add custom message
$response = fax_enqueue($fax_uuid, $fax_file, $wav_file, $mailto_address, $fax_uri, $fax_dtmf, $dial_string);
}
}
//wait for a few seconds

View File

@ -174,12 +174,7 @@
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "rxfax";
if (count($_SESSION["domains"]) > 1) {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'].'/'.$this->fax_extension.'/inbox/'.$this->forward_prefix.'${last_fax}.tif';
}
else {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $_SESSION['switch']['storage']['dir'].'/fax/'.$this->fax_extension.'/inbox/'.$this->forward_prefix.'${last_fax}.tif';
}
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'].'/'.$this->fax_extension.'/inbox/'.$this->forward_prefix.'${last_fax}.tif';
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;

View File

@ -1,48 +1,48 @@
<?php
function parse_attachments($connection, $message_number, $option = '') {
$attachments = array();
$structure = imap_fetchstructure($connection, $message_number, $option);
$attachments = array();
$structure = imap_fetchstructure($connection, $message_number, $option);
if(isset($structure->parts) && count($structure->parts)) {
if(isset($structure->parts) && count($structure->parts)) {
for($i = 0; $i < count($structure->parts); $i++) {
for($i = 0; $i < count($structure->parts); $i++) {
if($structure->parts[$i]->ifdparameters) {
foreach($structure->parts[$i]->dparameters as $object) {
if(strtolower($object->attribute) == 'filename') {
$attachments[$i]['is_attachment'] = true;
$attachments[$i]['filename'] = $object->value;
}
}
}
if($structure->parts[$i]->ifdparameters) {
foreach($structure->parts[$i]->dparameters as $object) {
if(strtolower($object->attribute) == 'filename') {
$attachments[$i]['is_attachment'] = true;
$attachments[$i]['filename'] = $object->value;
}
}
}
if($structure->parts[$i]->ifparameters) {
foreach($structure->parts[$i]->parameters as $object) {
if(strtolower($object->attribute) == 'name') {
$attachments[$i]['is_attachment'] = true;
$attachments[$i]['name'] = $object->value;
}
}
}
if($structure->parts[$i]->ifparameters) {
foreach($structure->parts[$i]->parameters as $object) {
if(strtolower($object->attribute) == 'name') {
$attachments[$i]['is_attachment'] = true;
$attachments[$i]['name'] = $object->value;
}
}
}
if($attachments[$i]['is_attachment']) {
$attachments[$i]['attachment'] = imap_fetchbody($connection, $message_number, $i+1, $option);
if($structure->parts[$i]->encoding == 3) { // 3 = BASE64
$attachments[$i]['attachment'] = base64_decode($attachments[$i]['attachment']);
$attachments[$i]['size'] = strlen($attachments[$i]['attachment']);
}
elseif($structure->parts[$i]->encoding == 4) { // 4 = QUOTED-PRINTABLE
$attachments[$i]['attachment'] = quoted_printable_decode($attachments[$i]['attachment']);
$attachments[$i]['size'] = strlen($attachments[$i]['attachment']);
}
}
if($attachments[$i]['is_attachment']) {
$attachments[$i]['attachment'] = imap_fetchbody($connection, $message_number, $i+1, $option);
if($structure->parts[$i]->encoding == 3) { // 3 = BASE64
$attachments[$i]['attachment'] = base64_decode($attachments[$i]['attachment']);
$attachments[$i]['size'] = strlen($attachments[$i]['attachment']);
}
elseif($structure->parts[$i]->encoding == 4) { // 4 = QUOTED-PRINTABLE
$attachments[$i]['attachment'] = quoted_printable_decode($attachments[$i]['attachment']);
$attachments[$i]['size'] = strlen($attachments[$i]['attachment']);
}
}
unset($attachments[$i]['is_attachment']);
}
}
}
return array_values($attachments); //reindex
}
return array_values($attachments); //reindex
}
?>

View File

@ -0,0 +1,38 @@
<?php
function parse_message($connection, $message_number, $option = '', $to_charset = 'UTF-8') {
$structure = imap_fetchstructure($connection, $message_number, $option);
if(isset($structure->parts) && count($structure->parts)) {
for($i = 0; $i < count($structure->parts); $i++) {
$msg = '';
$part = $structure->parts[$i];
if($part->type == TYPETEXT){
$msg = imap_fetchbody($connection, $message_number, $i+1, $option);
if($part->encoding == ENCBASE64){
$msg = base64_decode($msg);
}
else if($part->encoding == ENCQUOTEDPRINTABLE){
$msg = quoted_printable_decode($msg);
}
if($msg && $to_charset){
$charset = '';
if(isset($part->parameters) && count($part->parameters)) {
foreach($part->parameters as &$parameter){
if($parameter->attribute == 'CHARSET') {
$charset = $parameter->value;
break;
}
}
}
if($charset){
$msg = mb_convert_encoding($msg, $to_charset, $charset);
}
}
if($msg){
return $msg;
}
}
}
}
}

View File

@ -440,9 +440,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
foreach ($recordings as &$row) {
$recording_name = $row["recording_name"];
$recording_filename = $row["recording_filename"];
if ($ivr_menu_greet_long == $_SESSION['switch']['recordings']['dir']."/".$recording_filename && strlen($ivr_menu_greet_long) > 0) {
if ($ivr_menu_greet_long == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename && strlen($ivr_menu_greet_long) > 0) {
$tmp_selected = true;
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$recording_filename."' selected='selected'>".$recording_name."</option>\n";
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename."' selected='selected'>".$recording_name."</option>\n";
}
else if ($ivr_menu_greet_long == $recording_filename && strlen($ivr_menu_greet_long) > 0) {
$tmp_selected = true;
@ -500,8 +500,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (if_group("superadmin")) {
if (!$tmp_selected) {
echo "<optgroup label='Selected'>\n";
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$ivr_menu_greet_long)) {
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$ivr_menu_greet_long."' selected='selected'>".$ivr_menu_greet_long."</option>\n";
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_greet_long)) {
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_greet_long."' selected='selected'>".$ivr_menu_greet_long."</option>\n";
}
else if (substr($ivr_menu_greet_long, -3) == "wav" || substr($ivr_menu_greet_long, -3) == "mp3") {
echo " <option value='".$ivr_menu_greet_long."' selected='selected'>".$ivr_menu_greet_long."</option>\n";
@ -538,9 +538,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
foreach ($recordings as &$row) {
$recording_name = $row["recording_name"];
$recording_filename = $row["recording_filename"];
if ($ivr_menu_greet_short == $_SESSION['switch']['recordings']['dir']."/".$recording_filename && strlen($ivr_menu_greet_short) > 0) {
if ($ivr_menu_greet_short == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename && strlen($ivr_menu_greet_short) > 0) {
$tmp_selected = true;
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$recording_filename."' selected='selected'>".$recording_name."</option>\n";
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename."' selected='selected'>".$recording_name."</option>\n";
}
else if ($ivr_menu_greet_short == $recording_filename && strlen($ivr_menu_greet_short) > 0) {
$tmp_selected = true;
@ -599,8 +599,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (if_group("superadmin")) {
if (!$tmp_selected && strlen($ivr_menu_greet_short) > 0) {
echo "<optgroup label='Selected'>\n";
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$ivr_menu_greet_short)) {
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$ivr_menu_greet_short."' selected='selected'>".$ivr_menu_greet_short."</option>\n";
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_greet_short)) {
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_greet_short."' selected='selected'>".$ivr_menu_greet_short."</option>\n";
}
else if (substr($ivr_menu_greet_short, -3) == "wav" || substr($ivr_menu_greet_short, -3) == "mp3") {
echo " <option value='".$ivr_menu_greet_short."' selected='selected'>".$ivr_menu_greet_short."</option>\n";
@ -877,9 +877,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
foreach ($recordings as &$row) {
$recording_name = $row["recording_name"];
$recording_filename = $row["recording_filename"];
if ($ivr_menu_invalid_sound == $_SESSION['switch']['recordings']['dir']."/".$recording_filename && strlen($ivr_menu_invalid_sound) > 0) {
if ($ivr_menu_invalid_sound == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename && strlen($ivr_menu_invalid_sound) > 0) {
$tmp_selected = true;
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$recording_filename."' selected='selected'>".$recording_name."</option>\n";
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename."' selected='selected'>".$recording_name."</option>\n";
}
else if ($ivr_menu_invalid_sound == $recording_filename && strlen($ivr_menu_invalid_sound) > 0) {
$tmp_selected = true;
@ -935,8 +935,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (if_group("superadmin")) {
if (!$tmp_selected) {
echo "<optgroup label='Selected'>\n";
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$ivr_menu_invalid_sound)) {
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$ivr_menu_invalid_sound."' selected='selected'>".$ivr_menu_invalid_sound."</option>\n";
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_invalid_sound)) {
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_invalid_sound."' selected='selected'>".$ivr_menu_invalid_sound."</option>\n";
}
else if (substr($ivr_menu_invalid_sound, -3) == "wav" || substr($ivr_menu_invalid_sound, -3) == "mp3") {
echo " <option value='".$ivr_menu_invalid_sound."' selected='selected'>".$ivr_menu_invalid_sound."</option>\n";
@ -973,9 +973,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
foreach ($recordings as &$row) {
$recording_name = $row["recording_name"];
$recording_filename = $row["recording_filename"];
if ($ivr_menu_exit_sound == $_SESSION['switch']['recordings']['dir']."/".$recording_filename && strlen($ivr_menu_exit_sound) > 0) {
if ($ivr_menu_exit_sound == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename && strlen($ivr_menu_exit_sound) > 0) {
$tmp_selected = true;
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$recording_filename."' selected='selected'>".$recording_name."</option>\n";
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename."' selected='selected'>".$recording_name."</option>\n";
}
else if ($ivr_menu_exit_sound == $recording_filename && strlen($ivr_menu_exit_sound) > 0) {
$tmp_selected = true;
@ -1031,8 +1031,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (if_group("superadmin")) {
if (!$tmp_selected) {
echo "<optgroup label='Selected'>\n";
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$ivr_menu_exit_sound)) {
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$ivr_menu_exit_sound."' selected='selected'>".$ivr_menu_exit_sound."</option>\n";
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_exit_sound)) {
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_exit_sound."' selected='selected'>".$ivr_menu_exit_sound."</option>\n";
}
else if (substr($ivr_menu_exit_sound, -3) == "wav" || substr($ivr_menu_exit_sound, -3) == "mp3") {
echo " <option value='".$ivr_menu_exit_sound."' selected='selected'>".$ivr_menu_exit_sound."</option>\n";

View File

@ -575,23 +575,6 @@ include "root.php";
$database->fields['dialplan_detail_order'] = '030';
$database->add();
/*
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'ivr';
if (count($_SESSION["domains"]) > 1) {
$database->fields['dialplan_detail_data'] = $_SESSION['domain_name'].'-'.$this->ivr_menu_name;
}
else {
$database->fields['dialplan_detail_data'] = $this->ivr_menu_name;
}
$database->fields['dialplan_detail_order'] = '035';
$database->add();
*/
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;

View File

@ -90,7 +90,7 @@ include "root.php";
}
}
//recordings
if($dh = opendir($_SESSION['switch']['recordings']['dir']."/")) {
if($dh = opendir($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/")) {
$tmp_selected = false;
$files = Array();
//$select .= "<optgroup label='recordings'>\n";

View File

@ -357,7 +357,7 @@ require_once "resources/header.php";
}
function get_record_cmd(uuid) {
cmd = "uuid_record " + uuid + " start <?php echo $_SESSION['switch']['recordings']['dir']?>/archive/<?php echo date('Y')?>/<?php echo date('M')?>/<?php echo date('d')?>/" + uuid + ".wav";
cmd = "uuid_record " + uuid + " start <?php echo $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']; ?>/archive/<?php echo date('Y')?>/<?php echo date('M')?>/<?php echo date('d')?>/" + uuid + ".wav";
return cmd;
}

View File

@ -109,8 +109,8 @@ if ($domains_processed == 1) {
foreach ($result as &$row) {
$phrase_detail_uuid = $row['phrase_detail_uuid'];
$phrase_detail_data = $row['phrase_detail_data'];
if (substr_count($phrase_detail_data, $_SESSION['switch']['recordings']['dir']) > 0) {
$phrase_detail_data = str_replace($_SESSION['switch']['recordings']['dir'].'/', '', $phrase_detail_data);
if (substr_count($phrase_detail_data, $_SESSION['switch']['recordings']['dir'].'/'.$domain_name) > 0) {
$phrase_detail_data = str_replace($_SESSION['switch']['recordings']['dir'].'/'.$domain_name.'/', '', $phrase_detail_data);
}
//update function and data to be base64 compatible
$phrase_detail_data = "lua(streamfile.lua ".$phrase_detail_data.")";
@ -141,7 +141,7 @@ if ($domains_processed == 1) {
$phrase_detail_data = str_replace('lua(streamfile.lua ', '', $phrase_detail_data);
$phrase_detail_data = str_replace(')', '', $phrase_detail_data);
if (substr_count($phrase_detail_data, '/') === 0) {
$phrase_detail_data = $_SESSION['switch']['recordings']['dir'].'/'.$phrase_detail_data;
$phrase_detail_data = $_SESSION['switch']['recordings']['dir'].'/'.$domain_name.'/'.$phrase_detail_data;
}
$sql = "update v_phrase_details set ";
$sql .= "phrase_detail_function = 'play-file', ";

View File

@ -305,7 +305,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "opt_group.appendChild(new Option(\"".$row["recording_name"]."\", \"lua(streamfile.lua ".$row["recording_filename"].")\"));\n";
}
else {
echo "opt_group.appendChild(new Option(\"".$row["recording_name"]."\", \"".$_SESSION['switch']['recordings']['dir'].'/'.$row["recording_filename"]."\"));\n";
echo "opt_group.appendChild(new Option(\"".$row["recording_name"]."\", \"".$_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$row["recording_filename"]."\"));\n";
}
}
echo "obj_action.appendChild(opt_group);\n";
@ -470,7 +470,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
if ($field['phrase_detail_function'] == 'play-file') {
$phrase_detail_function = $text['label-play'];
$phrase_detail_data = str_replace($_SESSION['switch']['recordings']['dir'].'/', '', $field['phrase_detail_data']);
$phrase_detail_data = str_replace($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/', '', $field['phrase_detail_data']);
}
echo "<tr>\n";
echo " <td class='vtable'>".$phrase_detail_function."&nbsp;</td>\n";

View File

@ -179,6 +179,13 @@
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'provision';
$array[$x]['default_setting_subcategory'] = 'directory_extensions';
$array[$x]['default_setting_name'] = 'boolean';
$array[$x]['default_setting_value'] = 'true';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'allow extensions to be provisioned as contacts as $extensions in provision templates';
$x++;
$array[$x]['default_setting_category'] = 'ntp_server_primary';
$array[$x]['default_setting_subcategory'] = 'directory';
$array[$x]['default_setting_name'] = 'text';

View File

@ -42,6 +42,15 @@ openlog("fusion-provisioning", LOG_PID | LOG_PERROR, LOG_LOCAL0);
// $device_template = check_str($_REQUEST['template']);
//}
//get the mac address for Cisco 79xx in the URL as &name=SEP000000000000
if (empty($mac)){
$name = check_str($_REQUEST['name']);
if (substr($name, 0, 3) == "SEP") {
$mac = strtolower(substr($name, 3, 12));
unset($name);
}
}
//check alternate MAC source
if (empty($mac)){
//set the http user agent
@ -283,20 +292,33 @@ openlog("fusion-provisioning", LOG_PID | LOG_PERROR, LOG_LOCAL0);
//deliver the customized config over HTTP/HTTPS
//need to make sure content-type is correct
$cfg_ext = ".cfg";
if ($device_vendor === "aastra" && strrpos($file, $cfg_ext, 0) === strlen($file) - strlen($cfg_ext)) {
header("Content-Type: text/plain");
header("Content-Length: ".strlen($file_contents));
} else if ($device_vendor === "yealink") {
header("Content-Type: text/plain");
header("Content-Length: ".strval(strlen($file_contents)));
} else if ($device_vendor === "snom" && $device_template === "snom/m3") {
$file_contents = utf8_decode($file_contents);
header("Content-Type: text/plain; charset=iso-8859-1");
header("Content-Length: ".strlen($file_contents));
} else {
header("Content-Type: text/xml; charset=utf-8");
header("Content-Length: ".strlen($file_contents));
if ($_REQUEST['content_type'] == 'application/octet-stream') {
$file_name = str_replace("{\$mac}",$mac,$file);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.basename($file_name).'"');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file_contents));
}
else {
$cfg_ext = ".cfg";
if ($device_vendor === "aastra" && strrpos($file, $cfg_ext, 0) === strlen($file) - strlen($cfg_ext)) {
header("Content-Type: text/plain");
header("Content-Length: ".strlen($file_contents));
} else if ($device_vendor === "yealink") {
header("Content-Type: text/plain");
header("Content-Length: ".strval(strlen($file_contents)));
} else if ($device_vendor === "snom" && $device_template === "snom/m3") {
$file_contents = utf8_decode($file_contents);
header("Content-Type: text/plain; charset=iso-8859-1");
header("Content-Length: ".strlen($file_contents));
} else {
header("Content-Type: text/xml; charset=utf-8");
header("Content-Length: ".strlen($file_contents));
}
}
echo $file_contents;
closelog();

View File

@ -180,11 +180,17 @@ include "root.php";
if (strlen($device_template) == 0) {
$sql = "SELECT * FROM v_devices ";
$sql .= "WHERE device_mac_address=:mac ";
if($provision['http_domain_filter'] == "true") {
$sql .= "AND domain_uuid=:domain_uuid ";
}
//$sql .= "WHERE device_mac_address= '$mac' ";
$prep_statement_2 = $this->db->prepare(check_sql($sql));
if ($prep_statement_2) {
//use the prepared statement
$prep_statement_2->bindParam(':mac', $mac);
if($provision['http_domain_filter'] == "true") {
$prep_statement_2->bindParam(':domain_uuid', $domain_uuid);
}
$prep_statement_2->execute();
$row = $prep_statement_2->fetch();
//set the variables from values in the database
@ -300,8 +306,14 @@ include "root.php";
if (strlen($device_uuid) > 0) {
$sql = "SELECT * FROM v_devices ";
$sql .= "WHERE device_uuid = '".$device_uuid."' ";
if($provision['http_domain_filter'] == "true") {
$sql .= "AND domain_uuid=:domain_uuid ";
}
$prep_statement_3 = $this->db->prepare(check_sql($sql));
if ($prep_statement_3) {
if($provision['http_domain_filter'] == "true") {
$prep_statement_3->bindParam(':domain_uuid', $domain_uuid);
}
$prep_statement_3->execute();
$row = $prep_statement_3->fetch();
$device_uuid_alternate = $row["device_uuid_alternate"];
@ -311,8 +323,14 @@ include "root.php";
//get the new devices information
$sql = "SELECT * FROM v_devices ";
$sql .= "WHERE device_uuid = '".$device_uuid."' ";
if($provision['http_domain_filter'] == "true") {
$sql .= "AND domain_uuid=:domain_uuid ";
}
$prep_statement_4 = $this->db->prepare(check_sql($sql));
if ($prep_statement_4) {
if($provision['http_domain_filter'] == "true") {
$prep_statement_4->bindParam(':domain_uuid', $domain_uuid);
}
$prep_statement_4->execute();
$row = $prep_statement_4->fetch();
$device_label = $row["device_label"];
@ -384,7 +402,7 @@ include "root.php";
//get the contacts array and add to the template engine
if (strlen($device_uuid) > 0 and strlen($domain_uuid) > 0 and $_SESSION['provision']['directory']['boolean'] == "true") {
//get contacts from the database
$sql = "select c.contact_organization, c.contact_name_given, c.contact_name_family, p.phone_number, p.phone_extension ";
$sql = "select c.contact_category, c.contact_organization, c.contact_name_given, c.contact_name_family, p.phone_number, p.phone_extension ";
$sql .= "from v_contacts as c, v_contact_phones as p ";
$sql .= "where c.domain_uuid = '".$domain_uuid."' ";
$sql .= "and c.contact_uuid = p.contact_uuid ";
@ -455,6 +473,29 @@ include "root.php";
unset ($prep_statement);
}
//get the extensions array and add to the template engine
if (strlen($device_uuid) > 0 and strlen($domain_uuid) > 0 and $_SESSION['provision']['directory_extensions']['boolean'] == "true") {
//get contacts from the database
$sql = "select c.contact_organization, c.contact_name_given, c.contact_name_family, e.extension ";
$sql .= "from v_contacts as c, v_extension_users as cte, v_extensions as e, v_users as u ";
$sql .= "where c.domain_uuid = '".$domain_uuid."' ";
$sql .= "and c.contact_uuid = u.contact_uuid ";
$sql .= "and u.user_uuid = cte.user_uuid ";
$sql .= "and cte.extension_uuid = e.extension_uuid ";
$sql .= "and e.directory_visible = 'true' ";
foreach ($lines as $line){
$sql .= "and e.extension != '" . $line['user_id']. "' ";
}
$sql .= "order by c.contact_organization desc, c.contact_name_given asc, c.contact_name_family asc ";
$prep_statement = $this->db->prepare(check_sql($sql));
$prep_statement->execute();
$extensions = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset ($prep_statement, $sql);
//assign the contacts array
$view->assign("extensions", $extensions);
}
//get the provisioning information from device keys
if (strlen($device_uuid) > 0) {
//get the device keys array
@ -623,21 +664,21 @@ include "root.php";
case "ldap search": $device_key_type = "21"; break;
}
}
if ($device_key_category == "memory") {
switch ($device_key_type) {
case "speed dial": $device_key_type = "0"; break;
case "blf": $device_key_type = "1"; break;
case "presence watcher": $device_key_type = "2"; break;
case "eventlist blf": $device_key_type = "3"; break;
case "speed dial active": $device_key_type = "4"; break;
case "dial dtmf": $device_key_type = "5"; break;
case "voicemail": $device_key_type = "6"; break;
case "call return": $device_key_type = "7"; break;
case "transfer": $device_key_type = "8"; break;
case "call park": $device_key_type = "9"; break;
case "intercom": $device_key_type = "10"; break;
case "ldap search": $device_key_type = "11"; break;
}
if ($device_key_category == "memory" || $device_key_category == "expansion") {
switch ($device_key_type) {
case "speed dial": $device_key_type = "0"; break;
case "blf": $device_key_type = "1"; break;
case "presence watcher": $device_key_type = "2"; break;
case "eventlist blf": $device_key_type = "3"; break;
case "speed dial active": $device_key_type = "4"; break;
case "dial dtmf": $device_key_type = "5"; break;
case "voicemail": $device_key_type = "6"; break;
case "call return": $device_key_type = "7"; break;
case "transfer": $device_key_type = "8"; break;
case "call park": $device_key_type = "9"; break;
case "intercom": $device_key_type = "10"; break;
case "ldap search": $device_key_type = "11"; break;
}
}
}
@ -760,6 +801,13 @@ include "root.php";
$tmp_array = '';
$i = 0;
//build the provision array
foreach($_SESSION['provision'] as $key=>$val) {
if (strlen($val['var']) > 0) { $value = $val['var']; }
if (strlen($val['text']) > 0) { $value = $val['text']; }
$provision[$key] = $value;
}
//get the devices
$sql = "select * from v_devices ";
//$sql .= "where domain_uuid = '".$this->domain_uuid."' ";

View File

@ -25,8 +25,8 @@
*/
//if the recordings directory doesn't exist then create it
if (strlen($_SESSION['switch']['recordings']['dir']) > 0) {
if (!is_readable($_SESSION['switch']['recordings']['dir'])) { mkdir($_SESSION['switch']['recordings']['dir'],0777,true); }
if (strlen($_SESSION['switch']['recordings']['dir']."/".$domain_name) > 0) {
if (!is_readable($_SESSION['switch']['recordings']['dir']."/".$domain_name)) { mkdir($_SESSION['switch']['recordings']['dir']."/".$domain_name,0777,true); }
}
if ($domains_processed == 1) {
@ -45,7 +45,7 @@ if ($domains_processed == 1) {
$recording_domain_uuid = $row['domain_uuid'];
$recording_filename = $row['recording_filename'];
//set recording directory
$recording_directory = $_SESSION['switch']['recordings']['dir'];
$recording_directory = $_SESSION['switch']['recordings']['dir'].'/'.$domain_name;
//encode recording file (if exists)
if (file_exists($recording_directory.'/'.$recording_filename)) {
$recording_base64 = base64_encode(file_get_contents($recording_directory.'/'.$recording_filename));
@ -78,7 +78,7 @@ if ($domains_processed == 1) {
$recording_filename = $row['recording_filename'];
$recording_base64 = $row['recording_base64'];
//set recording directory
$recording_directory = $_SESSION['switch']['recordings']['dir'];
$recording_directory = $_SESSION['switch']['recordings']['dir'].'/'.$domain_name;
//remove local file, if any
if (file_exists($recording_directory.'/'.$recording_filename)) {
@unlink($recording_directory.'/'.$recording_filename);

View File

@ -66,8 +66,8 @@ if (strlen($id)>0) {
unset($sql);
//delete the recording
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$filename)) {
@unlink($_SESSION['switch']['recordings']['dir']."/".$filename);
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$filename)) {
@unlink($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$filename);
}
}

View File

@ -83,7 +83,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (permission_exists('recording_edit')) {
//if file name is not the same then rename the file
if ($recording_filename != $recording_filename_original) {
rename($_SESSION['switch']['recordings']['dir'].'/'.$recording_filename_original, $_SESSION['switch']['recordings']['dir'].'/'.$recording_filename);
rename($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$recording_filename_original, $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$recording_filename);
}
//update the database with the new data

View File

@ -49,7 +49,7 @@ require_once "resources/check_auth.php";
if ($_GET['a'] == "download" && (permission_exists('recording_play') || permission_exists('recording_download'))) {
session_cache_limiter('public');
if ($_GET['type'] = "rec") {
$path = $_SESSION['switch']['recordings']['dir'];
$path = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'];
//if from recordings, get recording details from db
$recording_uuid = check_str($_GET['id']); //recordings
@ -115,7 +115,7 @@ require_once "resources/check_auth.php";
if ($_POST['submit'] == $text['button-upload'] && $_POST['type'] == 'rec' && is_uploaded_file($_FILES['ulfile']['tmp_name'])) {
$recording_filename = str_replace(" ", "_", $_FILES['ulfile']['name']);
$recording_filename = str_replace("'", "", $recording_filename);
move_uploaded_file($_FILES['ulfile']['tmp_name'], $_SESSION['switch']['recordings']['dir'].'/'.$recording_filename);
move_uploaded_file($_FILES['ulfile']['tmp_name'], $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$recording_filename);
$_SESSION['message'] = $text['message-uploaded'].": ".htmlentities($recording_filename);
@ -146,9 +146,9 @@ require_once "resources/check_auth.php";
$array_base64_exists[$row['recording_uuid']] = ($row['recording_base64'] != '') ? true : false;
//if not base64, convert back to local files and remove base64 from db
if ($_SESSION['recordings']['storage_type']['text'] != 'base64' && $row['recording_base64'] != '') {
if (!file_exists($_SESSION['switch']['recordings']['dir'].'/'.$row['recording_filename'])) {
if (!file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$row['recording_filename'])) {
$recording_decoded = base64_decode($row['recording_base64']);
file_put_contents($_SESSION['switch']['recordings']['dir'].'/'.$row['recording_filename'], $recording_decoded);
file_put_contents($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$row['recording_filename'], $recording_decoded);
$sql = "update v_recordings set recording_base64 = null where domain_uuid = '".$domain_uuid."' and recording_uuid = '".$row['recording_uuid']."' ";
$db->exec(check_sql($sql));
unset($sql);
@ -158,10 +158,10 @@ require_once "resources/check_auth.php";
unset ($prep_statement);
//add recordings to the database
if (is_dir($_SESSION['switch']['recordings']['dir'].'/')) {
if ($dh = opendir($_SESSION['switch']['recordings']['dir'].'/')) {
if (is_dir($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/')) {
if ($dh = opendir($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/')) {
while (($recording_filename = readdir($dh)) !== false) {
if (filetype($_SESSION['switch']['recordings']['dir']."/".$recording_filename) == "file") {
if (filetype($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename) == "file") {
if (!in_array($recording_filename, $array_recordings)) {
//file not found in db, add it
@ -187,7 +187,7 @@ require_once "resources/check_auth.php";
$sql .= "'".$recording_name."', ";
$sql .= "'".$recording_description."' ";
if ($_SESSION['recordings']['storage_type']['text'] == 'base64') {
$recording_base64 = base64_encode(file_get_contents($_SESSION['switch']['recordings']['dir'].'/'.$recording_filename));
$recording_base64 = base64_encode(file_get_contents($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$recording_filename));
$sql .= ", '".$recording_base64."' ";
}
$sql .= ")";
@ -199,7 +199,7 @@ require_once "resources/check_auth.php";
if ($_SESSION['recordings']['storage_type']['text'] == 'base64') {
$found_recording_uuid = array_search($recording_filename, $array_recordings);
if (!$array_base64_exists[$found_recording_uuid]) {
$recording_base64 = base64_encode(file_get_contents($_SESSION['switch']['recordings']['dir'].'/'.$recording_filename));
$recording_base64 = base64_encode(file_get_contents($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$recording_filename));
$sql = "update v_recordings set ";
$sql .= "recording_base64 = '".$recording_base64."' ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
@ -211,8 +211,8 @@ require_once "resources/check_auth.php";
}
//if base64, remove local file
if ($_SESSION['recordings']['storage_type']['text'] == 'base64' && file_exists($_SESSION['switch']['recordings']['dir'].'/'.$recording_filename)) {
@unlink($_SESSION['switch']['recordings']['dir'].'/'.$recording_filename);
if ($_SESSION['recordings']['storage_type']['text'] == 'base64' && file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$recording_filename)) {
@unlink($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$recording_filename);
}
}
@ -307,7 +307,7 @@ require_once "resources/check_auth.php";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['recording_name']."</td>\n";
if ($_SESSION['recordings']['storage_type']['text'] != 'base64') {
echo " <td valign='top' class='".$row_style[$c]."'>".$row['recording_filename']."</td>\n";
$tmp_filesize = filesize($_SESSION['switch']['recordings']['dir'].'/'.$row['recording_filename']);
$tmp_filesize = filesize($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$row['recording_filename']);
$tmp_filesize = byte_convert($tmp_filesize);
echo " <td class='".$row_style[$c]."' style='text-align: center;'>".$tmp_filesize."</td>\n";
}

View File

@ -54,9 +54,15 @@ else {
if (preg_replace('/^.*?(cisco).*$/i', '$1', strtolower($agent)) == "cisco") {
$vendor = "cisco";
}
if (preg_replace('/^.*?(cisco\/spa).*$/i', '$1', strtolower($agent)) == "cisco/spa") {
$vendor = "cisco-spa";
}
if (preg_replace('/^.*?(grandstream).*$/i', '$1', strtolower($agent)) == "grandstream") {
$vendor = "grandstream";
}
if (preg_replace('/^.*?(linksys).*$/i', '$1', strtolower($agent)) == "linksys") {
$vendor = "linksys";
}
if (preg_replace('/^.*?(polycom).*$/i', '$1', strtolower($agent)) == "polycom") {
$vendor = "polycom";
}

View File

@ -76,6 +76,18 @@ if ($domains_processed == 1) {
$db->exec(check_sql($sql));
unset($sql);
}
if(isset($_SESSION['event_socket_ip_address'])) {
$event_socket_ip_address = $_SESSION['event_socket_ip_address'];
if(isset($_SESSION['event_socket_port'])) { $event_socket_port = $_SESSION['event_socket_port']; }
if(isset($_SESSION['event_socket_password'])) { $event_socket_password = $_SESSION['event_socket_password']; }
$sql = "update v_settings ";
$sql .= "set event_socket_ip_address = '$event_socket_ip_address' ";
$sql .= "set event_socket_port = '$event_socket_port' ";
$sql .= "set event_socket_password = '$event_socket_password' ";
$db->exec(check_sql($sql));
unset($sql);
}
}
?>

View File

@ -92,15 +92,18 @@
$sip_profile_description = "The Internal IPV6 profile binds to the IP version 6 address and is similar to the Internal profile.\n";
break;
case "external":
$sip_profile_description .= "The External profile external provides anonymous calling in the public context. ";
$sip_profile_description = "The External profile external provides anonymous calling in the public context. ";
$sip_profile_description .= "By default the External profile binds to port 5080. ";
$sip_profile_description .= "Calls can be sent using a SIP URL \"voip.domain.com:5080\" ";
break;
case "external-ipv6":
$sip_profile_description = "The External IPV6 profile binds to the IP version 6 address and is similar to the External profile.\n";
break;
case "lan":
$sip_profile_description = "The LAN profile is the same as the Internal profile except that it is bound to the LAN IP.\n";
break;
default:
$sip_profile_description .= '';
$sip_profile_description = '';
}
//add the sip profile if it is not false

View File

@ -0,0 +1,23 @@
<profile name="{v_sip_profile_name}">
<!-- http://wiki.freeswitch.org/wiki/Sofia_Configuration_Files -->
<!--aliases are other names that will work as a valid profile name for this profile-->
<aliases>
<!--
<alias name="outbound"/>
<alias name="nat"/>
-->
</aliases>
<!-- Outbound Registrations -->
<gateways>
<X-PRE-PROCESS cmd="include" data="{v_sip_profile_name}/*.xml"/>
</gateways>
<domains>
<domain name="all" alias="false" parse="true"/>
</domains>
<settings>
{v_sip_profile_settings}
</settings>
</profile>

View File

@ -80,6 +80,66 @@ $text['label-os']['sv-se'] = "Operativsystem";
$text['label-os']['uk'] = "Операційна система ";
$text['label-os']['de-at'] = "Betriebssystem";
$text['label-version']['en-us'] = "Version";
$text['label-version']['es-cl'] = "";
$text['label-version']['pt-pt'] = "";
$text['label-version']['fr-fr'] = "";
$text['label-version']['pt-br'] = "";
$text['label-version']['pl'] = "";
$text['label-version']['sv-se'] = "";
$text['label-version']['uk'] = "";
$text['label-version']['de-at'] = "";
$text['label-git_info']['en-us'] = "Git Information";
$text['label-git_info']['es-cl'] = "";
$text['label-git_info']['pt-pt'] = "";
$text['label-git_info']['fr-fr'] = "";
$text['label-git_info']['pt-br'] = "";
$text['label-git_info']['pl'] = "";
$text['label-git_info']['sv-se'] = "";
$text['label-git_info']['uk'] = "";
$text['label-git_info']['de-at'] = "";
$text['label-switch_version']['en-us'] = "Switch Version";
$text['label-switch_version']['es-cl'] = "";
$text['label-switch_version']['pt-pt'] = "";
$text['label-switch_version']['fr-fr'] = "";
$text['label-switch_version']['pt-br'] = "";
$text['label-switch_version']['pl'] = "";
$text['label-switch_version']['sv-se'] = "";
$text['label-switch_version']['uk'] = "";
$text['label-switch_version']['de-at'] = "";
$text['label-git_branch']['en-us'] = "Branch:";
$text['label-git_branch']['es-cl'] = "";
$text['label-git_branch']['pt-pt'] = "";
$text['label-git_branch']['fr-fr'] = "";
$text['label-git_branch']['pt-br'] = "";
$text['label-git_branch']['pl'] = "";
$text['label-git_branch']['sv-se'] = "";
$text['label-git_branch']['uk'] = "";
$text['label-git_branch']['de-at'] = "";
$text['label-git_commit']['en-us'] = "Commit:";
$text['label-git_commit']['es-cl'] = "";
$text['label-git_commit']['pt-pt'] = "";
$text['label-git_commit']['fr-fr'] = "";
$text['label-git_commit']['pt-br'] = "";
$text['label-git_commit']['pl'] = "";
$text['label-git_commit']['sv-se'] = "";
$text['label-git_commit']['uk'] = "";
$text['label-git_commit']['de-at'] = "";
$text['label-git_origin']['en-us'] = "Origin:";
$text['label-git_origin']['es-cl'] = "";
$text['label-git_origin']['pt-pt'] = "";
$text['label-git_origin']['fr-fr'] = "";
$text['label-git_origin']['pt-br'] = "";
$text['label-git_origin']['pl'] = "";
$text['label-git_origin']['sv-se'] = "";
$text['label-git_origin']['uk'] = "";
$text['label-git_origin']['de-at'] = "";
$text['label-memcache_status']['en-us'] = "Memcache Status";
$text['label-memcache_status']['es-cl'] = "Estado de Memcache";
$text['label-memcache_status']['pt-pt'] = "Estado da Memcache";

View File

@ -78,13 +78,47 @@ $document['title'] = $text['title-sys-status'];
if (permission_exists('system_view_info')) {
echo "<tr>\n";
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
echo " Version\n";
echo " ".$text['label-version']."\n";
echo " </td>\n";
echo " <td class=\"row_style1\">\n";
echo " ".software_version()."\n";
echo " </td>\n";
echo "</tr>\n";
$git_path = normalize_path_to_os($_SERVER["DOCUMENT_ROOT"]."/.git");
if(file_exists($git_path)){
$git_branch = shell_exec('git --git-dir='.$git_path.' name-rev --name-only HEAD');
rtrim($git_branch);
$git_commit = shell_exec('git --git-dir='.$git_path.' rev-parse HEAD');
rtrim($git_commit);
$git_origin = shell_exec('git --git-dir='.$git_path.' config --get remote.origin.url');
rtrim($git_commit);
echo "<tr>\n";
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
echo " ".$text['label-git_info']."\n";
echo " </td>\n";
echo " <td class=\"row_style1\">\n";
echo " ".$text['label-git_branch']." ".$git_branch."<br>\n";
echo " ".$text['label-git_commit']." ".$git_commit."<br>\n";
echo " ".$text['label-git_origin']." ".$git_origin."<br>\n";
echo " </td>\n";
echo "</tr>\n";
}
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$switch_version = event_socket_request($fp, 'api version');
preg_match("/FreeSWITCH Version (\d+\.\d+\.\d+(?:\.\d+)?).*\(\s*(\d+\w+)\s*\)/", $switch_version, $matches);
$switch_version = $matches[1];
$switch_bits = $matches[2];
echo "<tr>\n";
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
echo " ".$text['label-switch_version']."\n";
echo " </td>\n";
echo " <td class=\"row_style1\">$switch_version ($switch_bits)</td>\n";
echo "</tr>\n";
}
echo "<!--\n";
$tmp_result = shell_exec('uname -a');
echo "-->\n";
@ -320,37 +354,37 @@ $document['title'] = $text['title-sys-status'];
echo " <th class='th' colspan='2' align='left'>".$text['title-memcache']."</th>\n";
echo " </tr>\n";
$mc_fail = false;
$memcache_fail = false;
$mod = new modules;
if ($mod -> active("mod_memcache")) {
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$switch_cmd = "memcache status verbose";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
$mc_lines = preg_split('/\n/', $switch_result);
foreach($mc_lines as $mc_line) {
if (strlen(trim($mc_line)) > 0 && substr_count($mc_line, ': ') > 0) {
$mc_temp = explode(': ', $mc_line);
$mc_status[$mc_temp[0]] = $mc_temp[1];
$memcache_lines = preg_split('/\n/', $switch_result);
foreach($memcache_lines as $memcache_line) {
if (strlen(trim($memcache_line)) > 0 && substr_count($memcache_line, ': ') > 0) {
$memcache_temp = explode(': ', $memcache_line);
$memcache_status[$memcache_temp[0]] = $memcache_temp[1];
}
}
if (is_array($mc_status) && sizeof($mc_status) > 0) {
foreach($mc_status as $mc_field => $mc_value) {
if (is_array($memcache_status) && sizeof($memcache_status) > 0) {
foreach($memcache_status as $memcache_field => $memcache_value) {
echo "<tr>\n";
echo " <td width='20%' class='vncell' style='text-align: left;'>".$mc_field."</td>\n";
echo " <td class='row_style1'>".$mc_value."</td>\n";
echo " <td width='20%' class='vncell' style='text-align: left;'>".$memcache_field."</td>\n";
echo " <td class='row_style1'>".$memcache_value."</td>\n";
echo "</tr>\n";
}
}
else { $mc_fail = true; }
else { $memcache_fail = true; }
}
else { $mc_fail = true; }
else { $memcache_fail = true; }
}
else { $mc_fail = true; }
else { $memcache_fail = true; }
if ($mc_fail) {
if ($memcache_fail) {
echo "<tr>\n";
echo " <td width='20%' class='vncell' style='text-align: left;'>".$text['label-memcache_status']."</td>\n";
echo " <td class='row_style1'>".$text['message-unavailable']."</td>\n";

View File

@ -860,7 +860,7 @@ function add_custom_condition($destination, $group_id, $dialplan_action = '') {
echo " <td colspan='2' class='vtable'>".$text['label-group']."</td>\n";
echo " </tr>";
echo " <tr>";
echo " <td colspan='2' style='padding-top: 3px;'>";
echo " <td colspan='2' style='padding-top: 3px; padding-right: 3px; white-space: nowrap;'>";
//$destination = new destinations;
echo $destination->select('dialplan', 'dialplan_action['.$group_id.']', $dialplan_action);
echo " </td>";

View File

@ -43,12 +43,34 @@ $vars = <<<EOD
{"var_name":"call_debug","var_value":"false","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"console_loglevel","var_value":"info","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"default_areacode","var_value":"208","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"uk-ring","var_value":"%(400,200,400,450);%(400,2200,400,450)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"us-ring","var_value":"%(2000, 4000, 440.0, 480.0)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"pt-ring","var_value":"%(1000, 5000, 400.0, 0.0)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"fr-ring","var_value":"%(1500, 3500, 440.0, 0.0)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"rs-ring","var_value":"%(1000, 4000, 425.0, 0.0)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"it-ring","var_value":"%(1000, 4000, 425.0, 0.0)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"be-ring","var_value":"%(1000,3000,425)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"ca-ring","var_value":"%(2000,4000,440,480)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"cn-ring","var_value":"%(1000,4000,450)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"cy-ring","var_value":"%(1500,3000,425)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"cz-ring","var_value":"%(1000,4000,425)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"de-ring","var_value":"%(1000,4000,425)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"dk-ring","var_value":"%(1000,4000,425)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"dz-ring","var_value":"%(1500,3500,425)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"eg-ring","var_value":"%(2000,1000,475,375)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"fi-ring","var_value":"%(1000,4000,425)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"fr-ring","var_value":"%(1500,3500,440)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"pt-ring","var_value":"%(1000,5000,400)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"hk-ring","var_value":"%(400,200,440,480);%(400,3000,440,480)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"hu-ring","var_value":"%(1250,3750,425)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"il-ring","var_value":"%(1000,3000,400)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"in-ring","var_value":"%(400,200,425,375);%(400,2000,425,375)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"jp-ring","var_value":"%(1000,2000,420,380)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"ko-ring","var_value":"%(1000,2000,440,480)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"pk-ring","var_value":"%(1000,2000,400)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"pl-ring","var_value":"%(1000,4000,425)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"ro-ring","var_value":"%(1850,4150,475,425)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"rs-ring","var_value":"%(1000,4000,425)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"it-ring","var_value":"%(1000,4000,425)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"ru-ring","var_value":"%(800,3200,425)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"sa-ring","var_value":"%(1200,4600,425)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"tr-ring","var_value":"%(2000,4000,450)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"uk-ring","var_value":"%(400,200,400,450);%(400,2000,400,450)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"us-ring","var_value":"%(2000,4000,440,480)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"bong-ring","var_value":"v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"sit","var_value":"%(274,0,913.8);%(274,0,1370.6);%(380,0,1776.7)","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"sip_tls_version","var_value":"tlsv1","var_cat":"SIP","var_enabled":"true","var_description":"U0lQIGFuZCBUTFMgc2V0dGluZ3Mu"},
@ -56,12 +78,12 @@ $vars = <<<EOD
{"var_name":"internal_sip_port","var_value":"5060","var_cat":"SIP Profile: Internal","var_enabled":"true","var_description":""},
{"var_name":"internal_tls_port","var_value":"5061","var_cat":"SIP Profile: Internal","var_enabled":"true","var_description":""},
{"var_name":"internal_ssl_enable","var_value":"false","var_cat":"SIP Profile: Internal","var_enabled":"true","var_description":""},
{"var_name":"internal_ssl_dir","var_value":"\$\${base_dir}/conf/ssl","var_cat":"SIP Profile: Internal","var_enabled":"true","var_description":""},
{"var_name":"internal_ssl_dir","var_value":"\$\${conf_dir}/ssl","var_cat":"SIP Profile: Internal","var_enabled":"true","var_description":""},
{"var_name":"external_auth_calls","var_value":"false","var_cat":"SIP Profile: External","var_enabled":"true","var_description":""},
{"var_name":"external_sip_port","var_value":"5080","var_cat":"SIP Profile: External","var_enabled":"true","var_description":""},
{"var_name":"external_tls_port","var_value":"5081","var_cat":"SIP Profile: External","var_enabled":"true","var_description":""},
{"var_name":"external_ssl_enable","var_value":"false","var_cat":"SIP Profile: External","var_enabled":"true","var_description":""},
{"var_name":"external_ssl_dir","var_value":"\$\${base_dir}/conf/ssl","var_cat":"SIP Profile: External","var_enabled":"true","var_description":""},
{"var_name":"external_ssl_dir","var_value":"\$\${conf_dir}/ssl","var_cat":"SIP Profile: External","var_enabled":"true","var_description":""},
{"var_name":"use_profile","var_value":"internal","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"default_language","var_value":"en","var_cat":"Defaults","var_enabled":"true","var_description":""},
{"var_name":"default_dialect","var_value":"us","var_cat":"Defaults","var_enabled":"true","var_description":""},
@ -77,239 +99,7 @@ EOD;
// Set country depend variables as country code and international direct dialing code (exit code)
if (!function_exists('set_country_vars')) {
function set_country_vars($db, $x) {
$country_list = <<<EOD
[
{"country":"Afghanistan","countrycode":"93","exitcode":"00","isocode":"AF"}
,{"country":"Albania","countrycode":"355","exitcode":"00","isocode":"AL"}
,{"country":"Algeria","countrycode":"213","exitcode":"00","isocode":"DZ"}
,{"country":"American Samoa","countrycode":"1","exitcode":"011","isocode":"AS"}
,{"country":"Andorra","countrycode":"376","exitcode":"00","isocode":"AD"}
,{"country":"Angola","countrycode":"244","exitcode":"00","isocode":"AO"}
,{"country":"Anguilla","countrycode":"1","exitcode":"011","isocode":"AI"}
,{"country":"Antigua and Barbuda","countrycode":"1","exitcode":"011","isocode":"AG"}
,{"country":"Argentina","countrycode":"54","exitcode":"00","isocode":"AR"}
,{"country":"Armenia","countrycode":"374","exitcode":"00","isocode":"AM"}
,{"country":"Aruba","countrycode":"297","exitcode":"00","isocode":"AW"}
,{"country":"Ascension","countrycode":"247","exitcode":"00","isocode":"AC"}
,{"country":"Australia","countrycode":"61","exitcode":"0011","isocode":"AU"}
,{"country":"Austria","countrycode":"43","exitcode":"00","isocode":"AT"}
,{"country":"Azerbaijan","countrycode":"994","exitcode":"00","isocode":"AZ"}
,{"country":"Bahamas","countrycode":"1","exitcode":"011","isocode":"BS"}
,{"country":"Bahrain","countrycode":"973","exitcode":"00","isocode":"BH"}
,{"country":"Bangladesh","countrycode":"880","exitcode":"00","isocode":"BD"}
,{"country":"Barbados","countrycode":"1","exitcode":"011","isocode":"BB"}
,{"country":"Belarus","countrycode":"375","exitcode":"810","isocode":"BY"}
,{"country":"Belgium","countrycode":"32","exitcode":"00","isocode":"BE"}
,{"country":"Belize","countrycode":"501","exitcode":"00","isocode":"BZ"}
,{"country":"Benin","countrycode":"229","exitcode":"00","isocode":"BJ"}
,{"country":"Bermuda","countrycode":"1","exitcode":"011","isocode":"BM"}
,{"country":"Bhutan","countrycode":"975","exitcode":"00","isocode":"BT"}
,{"country":"Bolivia","countrycode":"591","exitcode":"00","isocode":"BO"}
,{"country":"Bosnia and Herzegovina","countrycode":"387","exitcode":"00","isocode":"BA"}
,{"country":"Botswana","countrycode":"267","exitcode":"00","isocode":"BW"}
,{"country":"Brazil","countrycode":"55","exitcode":"0014","isocode":"BR"}
,{"country":"British Virgin Islands","countrycode":"1","exitcode":"011","isocode":"VG"}
,{"country":"Brunei","countrycode":"673","exitcode":"00","isocode":"BN"}
,{"country":"Bulgaria","countrycode":"359","exitcode":"00","isocode":"BG"}
,{"country":"Burkina Faso","countrycode":"226","exitcode":"00","isocode":"BF"}
,{"country":"Burundi","countrycode":"257","exitcode":"00","isocode":"BI"}
,{"country":"Cambodia","countrycode":"855","exitcode":"001, 007, 008","isocode":"KH"}
,{"country":"Cameroon","countrycode":"237","exitcode":"00","isocode":"CM"}
,{"country":"Canada","countrycode":"1","exitcode":"011","isocode":"CA"}
,{"country":"Cape Verde","countrycode":"238","exitcode":"00","isocode":"CV"}
,{"country":"Cayman Islands","countrycode":"1","exitcode":"011","isocode":"KY"}
,{"country":"Central African Republic","countrycode":"236","exitcode":"00","isocode":"CF"}
,{"country":"Chad","countrycode":"235","exitcode":"00","isocode":"TD"}
,{"country":"Chile","countrycode":"56","exitcode":"1230","isocode":"CL"}
,{"country":"China","countrycode":"86","exitcode":"00","isocode":"CN"}
,{"country":"Colombia","countrycode":"57","exitcode":"005","isocode":"CO"}
,{"country":"Comoros","countrycode":"269","exitcode":"00","isocode":"KM"}
,{"country":"Congo","countrycode":"242","exitcode":"00","isocode":"CD"}
,{"country":"Cook Islands","countrycode":"682","exitcode":"00","isocode":"CK"}
,{"country":"Costa Rica","countrycode":"506","exitcode":"00","isocode":"CR"}
,{"country":"Croatia","countrycode":"385","exitcode":"00","isocode":"HR"}
,{"country":"Cuba","countrycode":"53","exitcode":"119","isocode":"CU"}
,{"country":"Cyprus","countrycode":"357","exitcode":"00","isocode":"CY"}
,{"country":"Czech Republic","countrycode":"420","exitcode":"00","isocode":"CZ"}
,{"country":"Democratic Republic of Congo","countrycode":"243","exitcode":"00","isocode":"CD"}
,{"country":"Denmark","countrycode":"45","exitcode":"00","isocode":"DK"}
,{"country":"Djibouti","countrycode":"253","exitcode":"00","isocode":"DJ"}
,{"country":"Dominica","countrycode":"1","exitcode":"011","isocode":"DM"}
,{"country":"Dominican Republic","countrycode":"1","exitcode":"011","isocode":"DO"}
,{"country":"East Timor","countrycode":"670","exitcode":"00","isocode":"TL"}
,{"country":"Ecuador","countrycode":"593","exitcode":"00","isocode":"EC"}
,{"country":"Egypt","countrycode":"20","exitcode":"00","isocode":"EG"}
,{"country":"El Salvador","countrycode":"503","exitcode":"00","isocode":"SV"}
,{"country":"Equatorial Guinea","countrycode":"240","exitcode":"00","isocode":"GQ"}
,{"country":"Eritrea","countrycode":"291","exitcode":"00","isocode":"ER"}
,{"country":"Estonia","countrycode":"372","exitcode":"00","isocode":"EE"}
,{"country":"Ethiopia","countrycode":"251","exitcode":"00","isocode":"ET"}
,{"country":"Falkland (Malvinas) Islands","countrycode":"500","exitcode":"00","isocode":"FK"}
,{"country":"Faroe Islands","countrycode":"298","exitcode":"00","isocode":"FO"}
,{"country":"Fiji","countrycode":"679","exitcode":"00","isocode":"FJ"}
,{"country":"Finland","countrycode":"358","exitcode":"00, 990, 994, 999","isocode":"FI"}
,{"country":"France","countrycode":"33","exitcode":"00","isocode":"FR"}
,{"country":"French Guiana","countrycode":"594","exitcode":"00","isocode":"GF"}
,{"country":"French Polynesia","countrycode":"689","exitcode":"00","isocode":"PF"}
,{"country":"Gabon","countrycode":"241","exitcode":"00","isocode":"GA"}
,{"country":"Gambia","countrycode":"220","exitcode":"00","isocode":"GM"}
,{"country":"Georgia","countrycode":"995","exitcode":"00","isocode":"GE"}
,{"country":"Germany","countrycode":"49","exitcode":"00","isocode":"DE"}
,{"country":"Ghana","countrycode":"233","exitcode":"00","isocode":"GH"}
,{"country":"Gibraltar","countrycode":"350","exitcode":"00","isocode":"GI"}
,{"country":"Greece","countrycode":"30","exitcode":"00","isocode":"GR"}
,{"country":"Greenland","countrycode":"299","exitcode":"00","isocode":"GL"}
,{"country":"Grenada","countrycode":"1","exitcode":"011","isocode":"GD"}
,{"country":"Guadeloupe","countrycode":"590","exitcode":"00","isocode":"GP"}
,{"country":"Guam","countrycode":"1","exitcode":"011","isocode":"GU"}
,{"country":"Guatemala","countrycode":"502","exitcode":"00","isocode":"GT"}
,{"country":"Guinea","countrycode":"224","exitcode":"00","isocode":"GN"}
,{"country":"Guinea-Bissau","countrycode":"245","exitcode":"00","isocode":"GW"}
,{"country":"Guyana","countrycode":"592","exitcode":"001","isocode":"GY"}
,{"country":"Haiti","countrycode":"509","exitcode":"00","isocode":"HT"}
,{"country":"Honduras","countrycode":"504","exitcode":"00","isocode":"HN"}
,{"country":"Hong Kong","countrycode":"852","exitcode":"001","isocode":"HK"}
,{"country":"Hungary","countrycode":"36","exitcode":"00","isocode":"HU"}
,{"country":"Iceland","countrycode":"354","exitcode":"00","isocode":"IS"}
,{"country":"India","countrycode":"91","exitcode":"00","isocode":"IN"}
,{"country":"Indonesia","countrycode":"62","exitcode":"001","isocode":"ID"}
,{"country":"Iran","countrycode":"98","exitcode":"00","isocode":"IR"}
,{"country":"Iraq","countrycode":"964","exitcode":"00","isocode":"IQ"}
,{"country":"Ireland","countrycode":"353","exitcode":"00","isocode":"IE"}
,{"country":"Israel","countrycode":"972","exitcode":"00, 012, 013, 014, 018","isocode":"IL"}
,{"country":"Italy","countrycode":"39","exitcode":"00","isocode":"IT"}
,{"country":"Ivory Coast","countrycode":"225","exitcode":"00","isocode":"CI"}
,{"country":"Jamaica","countrycode":"1","exitcode":"011","isocode":"JM"}
,{"country":"Japan","countrycode":"81","exitcode":"010","isocode":"JP"}
,{"country":"Jordan","countrycode":"962","exitcode":"00","isocode":"JO"}
,{"country":"Kazakhstan","countrycode":"7","exitcode":"810","isocode":"KZ"}
,{"country":"Kenya","countrycode":"254","exitcode":"000","isocode":"KE"}
,{"country":"Kiribati","countrycode":"686","exitcode":"00","isocode":"KI"}
,{"country":"Kuwait","countrycode":"965","exitcode":"00","isocode":"KW"}
,{"country":"Kyrgyzstan","countrycode":"996","exitcode":"00","isocode":"KG"}
,{"country":"Laos","countrycode":"856","exitcode":"00","isocode":"LA"}
,{"country":"Latvia","countrycode":"371","exitcode":"00","isocode":"LV"}
,{"country":"Lebanon","countrycode":"961","exitcode":"00","isocode":"LB"}
,{"country":"Lesotho","countrycode":"266","exitcode":"00","isocode":"LS"}
,{"country":"Liberia","countrycode":"231","exitcode":"00","isocode":"LR"}
,{"country":"Libya","countrycode":"218","exitcode":"00","isocode":"LY"}
,{"country":"Liechtenstein","countrycode":"423","exitcode":"00","isocode":"LI"}
,{"country":"Lithuania","countrycode":"370","exitcode":"00","isocode":"LT"}
,{"country":"Luxembourg","countrycode":"352","exitcode":"00","isocode":"LU"}
,{"country":"Macau","countrycode":"853","exitcode":"00","isocode":"MO"}
,{"country":"Macedonia","countrycode":"389","exitcode":"00","isocode":"MK"}
,{"country":"Madagascar","countrycode":"261","exitcode":"00","isocode":"MG"}
,{"country":"Malawi","countrycode":"265","exitcode":"00","isocode":"MW"}
,{"country":"Malaysia","countrycode":"60","exitcode":"00","isocode":"MY"}
,{"country":"Maldives","countrycode":"960","exitcode":"00","isocode":"MV"}
,{"country":"Mali","countrycode":"223","exitcode":"00","isocode":"ML"}
,{"country":"Malta","countrycode":"356","exitcode":"00","isocode":"MT"}
,{"country":"Marshall Islands","countrycode":"692","exitcode":"011","isocode":"MH"}
,{"country":"Martinique","countrycode":"596","exitcode":"00","isocode":"MQ"}
,{"country":"Mauritania","countrycode":"222","exitcode":"00","isocode":"MR"}
,{"country":"Mauritius","countrycode":"230","exitcode":"00","isocode":"MU"}
,{"country":"Mayotte","countrycode":"262","exitcode":"00","isocode":"YT"}
,{"country":"Mexico","countrycode":"52","exitcode":"00","isocode":"MX"}
,{"country":"Micronesia","countrycode":"691","exitcode":"011","isocode":"FM"}
,{"country":"Moldova","countrycode":"373","exitcode":"00","isocode":"MD"}
,{"country":"Monaco","countrycode":"377","exitcode":"00","isocode":"MC"}
,{"country":"Mongolia","countrycode":"976","exitcode":"001","isocode":"MN"}
,{"country":"Montenegro","countrycode":"382","exitcode":"00","isocode":"ME"}
,{"country":"Montserrat","countrycode":"1","exitcode":"011","isocode":"MS"}
,{"country":"Morocco","countrycode":"212","exitcode":"00","isocode":"MA"}
,{"country":"Mozambique","countrycode":"258","exitcode":"00","isocode":"MZ"}
,{"country":"Myanmar","countrycode":"95","exitcode":"00","isocode":"MM"}
,{"country":"Namibia","countrycode":"264","exitcode":"00","isocode":"NA"}
,{"country":"Nauru","countrycode":"674","exitcode":"00","isocode":"NR"}
,{"country":"Nepal","countrycode":"977","exitcode":"00","isocode":"NP"}
,{"country":"Netherlands","countrycode":"31","exitcode":"00","isocode":"NL"}
,{"country":"Netherlands Antilles","countrycode":"599","exitcode":"00","isocode":"AN"}
,{"country":"New Caledonia","countrycode":"687","exitcode":"00","isocode":"NC"}
,{"country":"New Zealand","countrycode":"64","exitcode":"00","isocode":"NZ"}
,{"country":"Nicaragua","countrycode":"505","exitcode":"00","isocode":"NI"}
,{"country":"Niger","countrycode":"227","exitcode":"00","isocode":"NE"}
,{"country":"Nigeria","countrycode":"234","exitcode":"009","isocode":"NG"}
,{"country":"Niue","countrycode":"683","exitcode":"00","isocode":"NU"}
,{"country":"Norfolk Island","countrycode":"6723","exitcode":"00","isocode":"NF"}
,{"country":"North Korea","countrycode":"850","exitcode":"99","isocode":"KP"}
,{"country":"Norway","countrycode":"47","exitcode":"00","isocode":"NO"}
,{"country":"Oman","countrycode":"968","exitcode":"00","isocode":"OM"}
,{"country":"Pakistan","countrycode":"92","exitcode":"00","isocode":"PK"}
,{"country":"Palau","countrycode":"680","exitcode":"011","isocode":"PW"}
,{"country":"Panama","countrycode":"507","exitcode":"00","isocode":"PA"}
,{"country":"Papua New Guinea","countrycode":"675","exitcode":"00","isocode":"PG"}
,{"country":"Paraguay","countrycode":"595","exitcode":"00","isocode":"PY"}
,{"country":"Peru","countrycode":"51","exitcode":"00","isocode":"PE"}
,{"country":"Philippines","countrycode":"63","exitcode":"00","isocode":"PH"}
,{"country":"Poland","countrycode":"48","exitcode":"00","isocode":"PL"}
,{"country":"Portugal","countrycode":"351","exitcode":"00","isocode":"PT"}
,{"country":"Puerto Rico","countrycode":"1","exitcode":"011","isocode":"PR"}
,{"country":"Qatar","countrycode":"974","exitcode":"00","isocode":"QA"}
,{"country":"Reunion","countrycode":"262","exitcode":"00","isocode":"RE"}
,{"country":"Romania","countrycode":"40","exitcode":"00","isocode":"RO"}
,{"country":"Russian Federation","countrycode":"7","exitcode":"810","isocode":"RU"}
,{"country":"Rwanda","countrycode":"250","exitcode":"00","isocode":"RW"}
,{"country":"Saint Helena","countrycode":"290","exitcode":"00","isocode":"SH"}
,{"country":"Saint Kitts and Nevis","countrycode":"1","exitcode":"011","isocode":"KN"}
,{"country":"Saint Lucia","countrycode":"1","exitcode":"011","isocode":"LC"}
,{"country":"Saint Barthelemy","countrycode":"590","exitcode":"00","isocode":"GP"}
,{"country":"Saint Pierre and Miquelon","countrycode":"508","exitcode":"00","isocode":"PM"}
,{"country":"Saint Vincent and the Grenadines","countrycode":"1","exitcode":"011","isocode":"VC"}
,{"country":"Samoa","countrycode":"685","exitcode":"0","isocode":"WS"}
,{"country":"San Marino","countrycode":"378","exitcode":"00","isocode":"SM"}
,{"country":"Sao Tome and Principe","countrycode":"239","exitcode":"00","isocode":"ST"}
,{"country":"Saudi Arabia","countrycode":"966","exitcode":"00","isocode":"SA"}
,{"country":"Senegal","countrycode":"221","exitcode":"00","isocode":"SN"}
,{"country":"Serbia","countrycode":"381","exitcode":"00","isocode":"RS"}
,{"country":"Seychelles","countrycode":"248","exitcode":"00","isocode":"SC"}
,{"country":"Sierra Leone","countrycode":"232","exitcode":"00","isocode":"SL"}
,{"country":"Singapore","countrycode":"65","exitcode":"001, 008","isocode":"SG"}
,{"country":"Slovakia","countrycode":"421","exitcode":"00","isocode":"SK"}
,{"country":"Slovenia","countrycode":"386","exitcode":"00","isocode":"SI"}
,{"country":"Solomon Islands","countrycode":"677","exitcode":"00","isocode":"SB"}
,{"country":"Somalia","countrycode":"252","exitcode":"00","isocode":"SO"}
,{"country":"South Africa","countrycode":"27","exitcode":"00","isocode":"ZA"}
,{"country":"South Korea","countrycode":"82","exitcode":"001, 002","isocode":"KR"}
,{"country":"Spain","countrycode":"34","exitcode":"00","isocode":"ES"}
,{"country":"Sri Lanka","countrycode":"94","exitcode":"00","isocode":"LK"}
,{"country":"Sudan","countrycode":"249","exitcode":"00","isocode":"SD"}
,{"country":"Suriname","countrycode":"597","exitcode":"00","isocode":"SR"}
,{"country":"Swaziland","countrycode":"268","exitcode":"00","isocode":"SZ"}
,{"country":"Sweden","countrycode":"46","exitcode":"00","isocode":"SE"}
,{"country":"Switzerland","countrycode":"41","exitcode":"00","isocode":"CH"}
,{"country":"Syria","countrycode":"963","exitcode":"00","isocode":"SY"}
,{"country":"Taiwan","countrycode":"886","exitcode":"002","isocode":"TW"}
,{"country":"Tajikistan","countrycode":"992","exitcode":"810","isocode":"TJ"}
,{"country":"Tanzania","countrycode":"255","exitcode":"000","isocode":"TZ"}
,{"country":"Thailand","countrycode":"66","exitcode":"001","isocode":"TH"}
,{"country":"Togo","countrycode":"228","exitcode":"00","isocode":"TG"}
,{"country":"Tokelau","countrycode":"690","exitcode":"00","isocode":"TK"}
,{"country":"Tonga","countrycode":"676","exitcode":"00","isocode":"TO"}
,{"country":"Trinidad and Tobago","countrycode":"1","exitcode":"011","isocode":"TT"}
,{"country":"Tunisia","countrycode":"216","exitcode":"00","isocode":"TN"}
,{"country":"Turkey","countrycode":"90","exitcode":"00","isocode":"TR"}
,{"country":"Turkmenistan","countrycode":"993","exitcode":"810","isocode":"TM"}
,{"country":"Turks and Caicos Islands","countrycode":"1","exitcode":"0","isocode":"TC"}
,{"country":"Tuvalu","countrycode":"688","exitcode":"00","isocode":"TV"}
,{"country":"Uganda","countrycode":"256","exitcode":"000","isocode":"UG"}
,{"country":"Ukraine","countrycode":"380","exitcode":"00","isocode":"UA"}
,{"country":"United Arab Emirates","countrycode":"971","exitcode":"00","isocode":"AE"}
,{"country":"United Kingdom","countrycode":"44","exitcode":"00","isocode":"GB"}
,{"country":"United States","countrycode":"1","exitcode":"011","isocode":"US"}
,{"country":"U.S. Virgin Islands","countrycode":"1","exitcode":"011","isocode":"VI"}
,{"country":"Uruguay","countrycode":"598","exitcode":"00","isocode":"UY"}
,{"country":"Uzbekistan","countrycode":"998","exitcode":"8 - wait for dial tone - 10","isocode":"UZ"}
,{"country":"Vanuatu","countrycode":"678","exitcode":"00","isocode":"VU"}
,{"country":"Vatican City","countrycode":"379, 39","exitcode":"00","isocode":"VA"}
,{"country":"Venezuela","countrycode":"58","exitcode":"00","isocode":"VE"}
,{"country":"Vietnam","countrycode":"84","exitcode":"00","isocode":"VN"}
,{"country":"Wallis and Futuna","countrycode":"681","exitcode":"00","isocode":"WF"}
,{"country":"Yemen","countrycode":"967","exitcode":"00","isocode":"YE"}
,{"country":"Zambia","countrycode":"260","exitcode":"00","isocode":"ZM"}
,{"country":"Zimbabwe","countrycode":"263","exitcode":"00","isocode":"ZW"}
]
EOD;
require "resources/countries.php";
// $country_iso=$_SESSION['domain']['country']['iso_code'];
@ -331,131 +121,121 @@ EOD;
if ( $country_iso===NULL ) {
return;
}
if(isset($countries[$country_iso])){
$country = $countries[$country_iso];
$countries = json_decode($country_list, true);
$found = false;
foreach($countries as $country) {
if ( $country["isocode"]==$country_iso ) {
$found = true;
break;
// Set default Country ISO code
$sql = "select count(*) as num_rows from v_vars ";
$sql .= "where var_name = 'default_country' ";
$sql .= "and var_cat = 'Defaults' ";
$prep_statement = $db->prepare(check_sql($sql));
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] == 0) {
$sql = "insert into v_vars ";
$sql .= "(";
$sql .= "var_uuid, ";
$sql .= "var_name, ";
$sql .= "var_value, ";
$sql .= "var_cat, ";
$sql .= "var_enabled, ";
$sql .= "var_order, ";
$sql .= "var_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'default_country', ";
$sql .= "'".$country["isocode"]."', ";
$sql .= "'Defaults', ";
$sql .= "'true', ";
$sql .= "'".$x."', ";
$sql .= "'' ";
$sql .= ");";
$db->exec(check_sql($sql));
unset($sql, $row);
$x++;
}
}
}
if ( !$found ) {
return;
}
// Set default Country ISO code
$sql = "select count(*) as num_rows from v_vars ";
$sql .= "where var_name = 'default_country' ";
$sql .= "and var_cat = 'Defaults' ";
$prep_statement = $db->prepare(check_sql($sql));
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] == 0) {
$sql = "insert into v_vars ";
$sql .= "(";
$sql .= "var_uuid, ";
$sql .= "var_name, ";
$sql .= "var_value, ";
$sql .= "var_cat, ";
$sql .= "var_enabled, ";
$sql .= "var_order, ";
$sql .= "var_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'default_country', ";
$sql .= "'".$country["isocode"]."', ";
$sql .= "'Defaults', ";
$sql .= "'true', ";
$sql .= "'".$x."', ";
$sql .= "'' ";
$sql .= ");";
$db->exec(check_sql($sql));
unset($sql, $row);
$x++;
unset($prep_statement, $sql);
// Set default Country code
$sql = "select count(*) as num_rows from v_vars ";
$sql .= "where var_name = 'default_countrycode' ";
$sql .= "and var_cat = 'Defaults' ";
$prep_statement = $db->prepare(check_sql($sql));
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] == 0) {
$sql = "insert into v_vars ";
$sql .= "(";
$sql .= "var_uuid, ";
$sql .= "var_name, ";
$sql .= "var_value, ";
$sql .= "var_cat, ";
$sql .= "var_enabled, ";
$sql .= "var_order, ";
$sql .= "var_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'default_countrycode', ";
$sql .= "'".$country["countrycode"]."', ";
$sql .= "'Defaults', ";
$sql .= "'true', ";
$sql .= "'".$x."', ";
$sql .= "'' ";
$sql .= ");";
$db->exec(check_sql($sql));
unset($sql, $row);
$x++;
}
}
}
unset($prep_statement, $sql);
// Set default Country code
$sql = "select count(*) as num_rows from v_vars ";
$sql .= "where var_name = 'default_countrycode' ";
$sql .= "and var_cat = 'Defaults' ";
$prep_statement = $db->prepare(check_sql($sql));
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] == 0) {
$sql = "insert into v_vars ";
$sql .= "(";
$sql .= "var_uuid, ";
$sql .= "var_name, ";
$sql .= "var_value, ";
$sql .= "var_cat, ";
$sql .= "var_enabled, ";
$sql .= "var_order, ";
$sql .= "var_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'default_countrycode', ";
$sql .= "'".$country["countrycode"]."', ";
$sql .= "'Defaults', ";
$sql .= "'true', ";
$sql .= "'".$x."', ";
$sql .= "'' ";
$sql .= ");";
$db->exec(check_sql($sql));
unset($sql, $row);
$x++;
unset($prep_statement, $sql);
// Set default International Direct Dialing code
$sql = "select count(*) as num_rows from v_vars ";
$sql .= "where var_name = 'default_exitcode' ";
$sql .= "and var_cat = 'Defaults' ";
$prep_statement = $db->prepare(check_sql($sql));
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] == 0) {
$sql = "insert into v_vars ";
$sql .= "(";
$sql .= "var_uuid, ";
$sql .= "var_name, ";
$sql .= "var_value, ";
$sql .= "var_cat, ";
$sql .= "var_enabled, ";
$sql .= "var_order, ";
$sql .= "var_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'default_exitcode', ";
$sql .= "'".$country["exitcode"]."', ";
$sql .= "'Defaults', ";
$sql .= "'true', ";
$sql .= "'".$x."', ";
$sql .= "'' ";
$sql .= ");";
$db->exec(check_sql($sql));
unset($sql, $row);
$x++;
}
}
unset($prep_statement, $sql);
unset($countries);
}
unset($prep_statement, $sql);
// Set default International Direct Dialing code
$sql = "select count(*) as num_rows from v_vars ";
$sql .= "where var_name = 'default_exitcode' ";
$sql .= "and var_cat = 'Defaults' ";
$prep_statement = $db->prepare(check_sql($sql));
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] == 0) {
$sql = "insert into v_vars ";
$sql .= "(";
$sql .= "var_uuid, ";
$sql .= "var_name, ";
$sql .= "var_value, ";
$sql .= "var_cat, ";
$sql .= "var_enabled, ";
$sql .= "var_order, ";
$sql .= "var_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'default_exitcode', ";
$sql .= "'".$country["exitcode"]."', ";
$sql .= "'Defaults', ";
$sql .= "'true', ";
$sql .= "'".$x."', ";
$sql .= "'' ";
$sql .= ");";
$db->exec(check_sql($sql));
unset($sql, $row);
$x++;
}
}
unset($prep_statement, $sql);
unset($countries);
}
}

View File

@ -219,7 +219,7 @@
$database->fields['domain_name'] = $domain_name;
//check whether a recording exists
$recording_relative_path = '/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day;
$recording_relative_path = '/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day;
if (file_exists($_SESSION['switch']['recordings']['dir'].$recording_relative_path.'/'.$uuid.'.wav')) {
$recording_file = $recording_relative_path.'/'.$uuid.'.wav';
}

View File

@ -396,7 +396,7 @@ else {
//handle recordings
if (permission_exists('recording_play') || permission_exists('recording_download')) {
$tmp_dir = $_SESSION['switch']['recordings']['dir'].'/'.$path_mod.'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day;
$tmp_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$path_mod.'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day;
$tmp_name = '';
if(!empty($row['recording_file']) && file_exists($row['recording_file'])){
$tmp_name=$row['recording_file'];

View File

@ -54,8 +54,8 @@ if (sizeof($_REQUEST) > 0) {
$prep_statement->execute();
unset($sql, $prep_statement);
//delete recording, if any
if ($recording_file_path[$index] != '' && file_exists($_SESSION['switch']['recordings']['dir'].base64_decode($recording_file_path[$index]))) {
@unlink($_SESSION['switch']['recordings']['dir'].base64_decode($recording_file_path[$index]));
if ($recording_file_path[$index] != '' && file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].base64_decode($recording_file_path[$index]))) {
@unlink($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].base64_decode($recording_file_path[$index]));
}
}
}

View File

@ -194,7 +194,7 @@ else {
//echo " <td valign='top' class='".$row_style[$c]."'>".$language."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$context."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
if (file_exists($_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$uuid.'.wav')) {
if (file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$uuid.'.wav')) {
//echo " <a href=\"../recordings/v_recordings.php?a=download&type=rec&t=bin&filename=".base64_encode('archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$uuid.'.wav')."\">\n";
//echo " </a>";
@ -208,7 +208,7 @@ else {
}
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
if (file_exists($_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$uuid.'.wav')) {
if (file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$uuid.'.wav')) {
echo " <a href=\"../recordings/v_recordings.php?a=download&type=rec&t=bin&filename=".base64_encode('archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$uuid.'.wav')."\">\n";
echo $caller_id_number.' ';
echo " </a>";
@ -276,7 +276,7 @@ else {
if ($key == "bridge_uuid" || $key == "signal_bond") {
echo " <td valign='top' align='left' class='".$row_style[$c]."'>\n";
echo " <a href='xml_cdr_details.php?uuid=$value'>".$value."</a>&nbsp;\n";
$tmp_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day;
$tmp_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day;
$tmp_name = '';
if (file_exists($tmp_dir.'/'.$value.'.wav')) {
$tmp_name = $value.".wav";
@ -290,12 +290,12 @@ else {
elseif (file_exists($tmp_dir.'/'.$value.'_1.mp3')) {
$tmp_name = $value."_1.mp3";
}
if (strlen($tmp_name) > 0 && file_exists($_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)) {
if (strlen($tmp_name) > 0 && file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)) {
echo " <a href=\"javascript:void(0);\" onclick=\"window.open('../recordings/v_recording_play.php?a=download&type=moh&filename=".base64_encode('archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)."', 'play',' width=420,height=150,menubar=no,status=no,toolbar=no')\">\n";
echo " play";
echo " </a>&nbsp;";
}
if (strlen($tmp_name) > 0 && file_exists($_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)) {
if (strlen($tmp_name) > 0 && file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)) {
echo " <a href=\"../recordings/v_recordings.php?a=download&type=rec&t=bin&filename=".base64_encode("archive/".$tmp_year."/".$tmp_month."/".$tmp_day."/".$tmp_name)."\">\n";
echo " download";
echo " </a>";

18
core/app_languages.php Normal file
View File

@ -0,0 +1,18 @@
<?php
// Fill in the value in the native language
// rename the corerct flag in /theme/flags/*.png
$language_name['en-us'] = "English - United States";
$language_name['es-cl'] = "Español - Chile";
$language_name['pt-pt'] = "Português - Portugal";
$language_name['fr-fr'] = "Français - France";
$language_name['nl-nl'] = "Nederlands - De Nederland";
$language_name['pt-br'] = "Brasileiro - Português";
$language_name['pl'] = "Polski - Polska";
$language_name['sv-se'] = "Svenska - Sverige";
$language_name['uk'] = "Українська - Україна";
$language_name['de-at'] = "Deutsch - Österreich";
$language_name['ar-eg'] = "العربية - مصر";
?>

View File

@ -24,22 +24,6 @@
Mark J Crane <markjcrane@fusionpbx.com>
*/
global $IS_WINDOWS;
if ($IS_WINDOWS == null) {
if (stristr(PHP_OS, 'WIN')) { $IS_WINDOWS = true; } else { $IS_WINDOWS = false; }
}
if (!function_exists('correct_path')) {
function correct_path($p) {
global $IS_WINDOWS;
if ($IS_WINDOWS) {
return str_replace('/', '\\', $p);
}
return $p;
}
}
//proccess this only one time
if ($domains_processed == 1) {
@ -66,163 +50,5 @@ if ($domains_processed == 1) {
unset($sql);
}
unset($prep_statement, $result);
//replace the backslash with a forward slash
$db_path = str_replace("\\", "/", $db_path);
if (strlen($_SESSION['switch']['scripts']['dir']) > 0) {
//get the odbc information
$sql = "select count(*) as num_rows from v_databases ";
$sql .= "where database_driver = 'odbc' ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
unset($prep_statement);
if ($row['num_rows'] > 0) {
$odbc_num_rows = $row['num_rows'];
$sql = "select * from v_databases ";
$sql .= "where database_driver = 'odbc' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$dsn_name = $row["database_name"];
$dsn_username = $row["database_username"];
$dsn_password = $row["database_password"];
break; //limit to 1 row
}
unset ($prep_statement);
}
else {
$odbc_num_rows = '0';
}
}
//get the recordings directory
if (strlen($_SESSION['switch']['recordings']['dir']) > 0) {
$sql = "select * from v_default_settings ";
$sql .= "where default_setting_category = 'switch' ";
$sql .= "and default_setting_subcategory = 'recordings' ";
$sql .= "and default_setting_name = 'dir' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$recordings_dir = $row["default_setting_value"];
}
unset($prep_statement, $result);
}
//config.lua
if (is_dir("/etc/fusionpbx")){
$config = "/etc/fusionpbx/config.lua";
} elseif (is_dir("/usr/local/etc/fusionpbx")){
$config = "/usr/local/etc/fusionpbx/config.lua";
}
else {
$config = $_SESSION['switch']['scripts']['dir']."/resources/config.lua";
}
$fout = fopen($config,"w");
$tmp = "\n";
$tmp .= "--set the variables\n";
if (strlen($_SESSION['switch']['sounds']['dir']) > 0) {
$tmp .= correct_path(" sounds_dir = [[".$_SESSION['switch']['sounds']['dir']."]];\n");
}
if (strlen($_SESSION['switch']['phrases']['dir']) > 0) {
$tmp .= correct_path(" phrases_dir = [[".$_SESSION['switch']['phrases']['dir']."]];\n");
}
if (strlen($_SESSION['switch']['db']['dir']) > 0) {
$tmp .= correct_path(" database_dir = [[".$_SESSION['switch']['db']['dir']."]];\n");
}
if (strlen($_SESSION['switch']['recordings']['dir']) > 0) {
$tmp .= correct_path(" recordings_dir = [[".$recordings_dir."]];\n");
}
if (strlen($_SESSION['switch']['storage']['dir']) > 0) {
$tmp .= correct_path(" storage_dir = [[".$_SESSION['switch']['storage']['dir']."]];\n");
}
if (strlen($_SESSION['switch']['voicemail']['dir']) > 0) {
$tmp .= correct_path(" voicemail_dir = [[".$_SESSION['switch']['voicemail']['dir']."]];\n");
}
if (strlen($_SESSION['switch']['scripts']['dir']) > 0) {
$tmp .= correct_path(" scripts_dir = [[".$_SESSION['switch']['scripts']['dir']."]];\n");
}
$tmp .= correct_path(" php_dir = [[".PHP_BINDIR."]];\n");
if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") {
$tmp .= " php_bin = \"php.exe\";\n";
}
else {
$tmp .= " php_bin = \"php\";\n";
}
$tmp .= correct_path(" document_root = [[".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."]];\n");
$tmp .= "\n";
if ((strlen($db_type) > 0) || (strlen($dsn_name) > 0)) {
$tmp .= "--database information\n";
$tmp .= " database = {}\n";
$tmp .= " database[\"type\"] = \"".$db_type."\";\n";
$tmp .= " database[\"name\"] = \"".$db_name."\";\n";
$tmp .= correct_path(" database[\"path\"] = [[".$db_path."]];\n");
if (strlen($dsn_name) > 0) {
$tmp .= " database[\"system\"] = \"odbc://".$dsn_name.":".$dsn_username.":".$dsn_password."\";\n";
$tmp .= " database[\"switch\"] = \"odbc://freeswitch:".$dsn_username.":".$dsn_password."\";\n";
}
elseif ($db_type == "pgsql") {
if ($db_host == "localhost") { $db_host = "127.0.0.1"; }
$tmp .= " database[\"system\"] = \"pgsql://hostaddr=".$db_host." port=".$db_port." dbname=".$db_name." user=".$db_username." password=".$db_password." options='' application_name='".$db_name."'\";\n";
$tmp .= " database[\"switch\"] = \"pgsql://hostaddr=".$db_host." port=".$db_port." dbname=freeswitch user=".$db_username." password=".$db_password." options='' application_name='freeswitch'\";\n";
}
elseif ($db_type == "sqlite") {
$tmp .= " database[\"system\"] = \"sqlite://".$db_path."/".$db_name."\";\n";
$tmp .= " database[\"switch\"] = \"sqlite://".$_SESSION['switch']['db']['dir']."\";\n";
}
elseif ($db_type == "mysql") {
$tmp .= " database[\"system\"] = \"\";\n";
$tmp .= " database[\"switch\"] = \"\";\n";
}
$tmp .= "\n";
}
$tmp .= "--set defaults\n";
$tmp .= " expire = {}\n";
$tmp .= " expire[\"directory\"] = \"3600\";\n";
$tmp .= " expire[\"dialplan\"] = \"3600\";\n";
$tmp .= " expire[\"languages\"] = \"3600\";\n";
$tmp .= " expire[\"sofia.conf\"] = \"3600\";\n";
$tmp .= " expire[\"acl.conf\"] = \"3600\";\n";
$tmp .= "\n";
$tmp .= "--set xml_handler\n";
$tmp .= " xml_handler = {}\n";
$tmp .= " xml_handler[\"fs_path\"] = false;\n";
$tmp .= "\n";
$tmp .= "--set the debug options\n";
$tmp .= " debug[\"params\"] = false;\n";
$tmp .= " debug[\"sql\"] = false;\n";
$tmp .= " debug[\"xml_request\"] = false;\n";
$tmp .= " debug[\"xml_string\"] = false;\n";
$tmp .= " debug[\"cache\"] = false;\n";
$tmp .= "\n";
$tmp .= "--additional info\n";
$tmp .= " domain_count = ".count($_SESSION["domains"]).";\n";
$tmp .= correct_path(" temp_dir = [[".$_SESSION['server']['temp']['dir']."]];\n");
if (isset($_SESSION['domain']['dial_string']['text'])) {
$tmp .= " dial_string = \"".$_SESSION['domain']['dial_string']['text']."\";\n";
}
$tmp .= "\n";
$tmp .= "--include local.lua\n";
$tmp .= " require(\"resources.functions.file_exists\");\n";
$tmp .= " if (file_exists(\"/etc/fusionpbx/local.lua\")) then\n";
$tmp .= " dofile(\"/etc/fusionpbx/local.lua\");\n";
$tmp .= " elseif (file_exists(\"/usr/local/etc/fusionpbx/local.lua\")) then\n";
$tmp .= " dofile(\"/usr/local/etc/fusionpbx/local.lua\");\n";
$tmp .= " elseif (file_exists(scripts_dir..\"/resources/local.lua\")) then\n";
$tmp .= " require(\"resources.local\");\n";
$tmp .= " end\n";
fwrite($fout, $tmp);
unset($tmp);
fclose($fout);
}
}
?>

View File

@ -176,7 +176,7 @@ if (strlen($id) > 0) {
//delete the recordings
if (strlen($_SESSION['switch'][recordings]['dir']) > 0) {
system('rm -rf '.$_SESSION['switch']['recordings']['dir'].'/'.$domain_name);
system('rm -rf '.$_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$domain_name);
}
//delete voicemail

View File

@ -234,8 +234,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
// rename switch/recordings/[domain] (folder)
if ( isset($_SESSION['switch']['recordings']['dir']) ) {
$switch_recordings_dir = str_replace("/".$_SESSION["domain_name"], "", $_SESSION['switch']['recordings']['dir']);
if ( file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']) ) {
$switch_recordings_dir = str_replace("/".$_SESSION["domain_name"], "", $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']);
if ( file_exists($switch_recordings_dir."/".$original_domain_name) ) {
@rename($switch_recordings_dir."/".$original_domain_name, $switch_recordings_dir."/".$domain_name); // folder
}

View File

@ -0,0 +1,28 @@
<?php
//application details
$apps[$x]['name'] = "Install";
$apps[$x]['uuid'] = "75507e6e-891e-11e5-af63-feff819cdc9f";
$apps[$x]['category'] = "Core";
$apps[$x]['subcategory'] = "";
$apps[$x]['version'] = "";
$apps[$x]['url'] = "http://www.fusionpbx.com";
$apps[$x]['description']['en-us'] = "Install the fuisionPBX system or add new switches";
$apps[$x]['description']['es-cl'] = "";
$apps[$x]['description']['de-de'] = "";
$apps[$x]['description']['de-ch'] = "";
$apps[$x]['description']['de-at'] = "";
$apps[$x]['description']['fr-fr'] = "";
$apps[$x]['description']['fr-ca'] = "";
$apps[$x]['description']['fr-ch'] = "";
$apps[$x]['description']['pt-pt'] = "";
$apps[$x]['description']['pt-br'] = "";
//permission details
//$y = 0;
//$apps[$x]['permissions'][$y]['name'] = "install";
//$apps[$x]['permissions'][$y]['menu']['uuid'] = "75507e6e-891e-11e5-af63-feff819cdc9f";
//$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
//$y++;
?>

View File

@ -0,0 +1,606 @@
<?php
$text['title-install_first_time']['en-us'] = "First Time Install";
$text['title-install_first_time']['es-cl'] = "Instale Primera Vez";
$text['title-install_first_time']['pt-pt'] = "Première installation";
$text['title-install_first_time']['fr-fr'] = "";
$text['title-install_first_time']['pt-br'] = "";
$text['title-install_first_time']['pl'] = "";
$text['title-install_first_time']['sv-se'] = "";
$text['title-install_first_time']['uk'] = "";
$text['title-install_first_time']['de-at'] = "";
$text['title-install_first_time']['ar-eg'] = "";
$text['title-detected_configuration']['en-us'] = "Detected Configuration";
$text['title-detected_configuration']['es-cl'] = "";
$text['title-detected_configuration']['pt-pt'] = "";
$text['title-detected_configuration']['fr-fr'] = "";
$text['title-detected_configuration']['pt-br'] = "";
$text['title-detected_configuration']['pl'] = "";
$text['title-detected_configuration']['sv-se'] = "";
$text['title-detected_configuration']['uk'] = "";
$text['title-detected_configuration']['de-at'] = "";
$text['title-detected_configuration']['ar-eg'] = "";
$text['title-assumed_configuration']['en-us'] = "Assumed Configuration";
$text['title-assumed_configuration']['es-cl'] = "";
$text['title-assumed_configuration']['pt-pt'] = "";
$text['title-assumed_configuration']['fr-fr'] = "";
$text['title-assumed_configuration']['pt-br'] = "";
$text['title-assumed_configuration']['pl'] = "";
$text['title-assumed_configuration']['sv-se'] = "";
$text['title-assumed_configuration']['uk'] = "";
$text['title-assumed_configuration']['de-at'] = "";
$text['title-assumed_configuration']['ar-eg'] = "";
$text['message-update']['en-us'] = "Update Completed";
$text['message-update']['es-cl'] = "Actualización Completada";
$text['message-update']['pt-pt'] = "Actualização Efectuada";
$text['message-update']['fr-fr'] = "Mis à jour";
$text['message-update']['pt-br'] = "Atualização Efetuada";
$text['message-update']['pl'] = "Zaktualizowano poprawnie";
$text['message-update']['sv-se'] = "Uppdatering Klar";
$text['message-update']['uk'] = "Оновлення завершено";
$text['message-update']['de-at'] = "Aktualisierung durchgeführt";
$text['message-update']['ar-eg'] = "اكتمال التحديث";
$text['message-required']['en-us'] = "Please provide: ";
$text['message-required']['es-cl'] = "Por favor indique: ";
$text['message-required']['pt-pt'] = "Por favor indique: ";
$text['message-required']['fr-fr'] = "Merci d'indiquer: ";
$text['message-required']['pt-br'] = "Por favor Indique:";
$text['message-required']['pl'] = "Wpisz:";
$text['message-required']['sv-se'] = "Var god uppge:";
$text['message-required']['uk'] = "Будь ласка, вкажіть:";
$text['message-required']['de-at'] = "Bitte geben Sie folgendes an:";
$text['message-required']['ar-eg'] = "من فضلك أدخل";
$text['message-message']['en-us'] = "Message";
$text['message-message']['es-cl'] = "Mensaje";
$text['message-message']['pt-pt'] = "Mensagem";
$text['message-message']['fr-fr'] = "Message";
$text['message-message']['pt-br'] = "Mensagem";
$text['message-message']['pl'] = "Wiadomość";
$text['message-message']['sv-se'] = "Meddelande";
$text['message-message']['uk'] = "Повідомлення";
$text['message-message']['de-at'] = "Nachricht";
$text['message-message']['ar-eg'] = "رسالة";
$text['message-delete']['en-us'] = "Delete Completed";
$text['message-delete']['es-cl'] = "Eliminación Completada";
$text['message-delete']['pt-pt'] = "Remoção Efectuada";
$text['message-delete']['fr-fr'] = "Supprimé";
$text['message-delete']['pt-br'] = "Remoção Efetuada";
$text['message-delete']['pl'] = "Usunięto poprawnie";
$text['message-delete']['sv-se'] = "Borttagning Klar";
$text['message-delete']['uk'] = "Видалено";
$text['message-delete']['de-at'] = "Erfolgreich gelöscht";
$text['message-delete']['ar-eg'] = "تم المسح";
$text['label-ft-install']['en-us'] = "First Time Install";
$text['label-ft-install']['es-cl'] = "";
$text['label-ft-install']['pt-pt'] = "";
$text['label-ft-install']['fr-fr'] = "";
$text['label-ft-install']['pt-br'] = "";
$text['label-ft-install']['pl'] = "";
$text['label-ft-install']['sv-se'] = "";
$text['label-ft-install']['uk'] = "";
$text['label-ft-install']['de-at'] = "";
$text['label-ft-install']['ar-eg'] = "";
$text['description-ft-install']['en-us'] = "Perform all actions for a First Time Install";
$text['description-ft-install']['es-cl'] = "";
$text['description-ft-install']['pt-pt'] = "";
$text['description-ft-install']['fr-fr'] = "";
$text['description-ft-install']['pt-br'] = "";
$text['description-ft-install']['pl'] = "";
$text['description-ft-install']['sv-se'] = "";
$text['description-ft-install']['uk'] = "";
$text['description-ft-install']['de-at'] = "";
$text['description-ft-install']['ar-eg'] = "";
$text['label-add-switch']['en-us'] = "Add a new switch";
$text['label-add-switch']['es-cl'] = "";
$text['label-add-switch']['pt-pt'] = "";
$text['label-add-switch']['fr-fr'] = "";
$text['label-add-switch']['pt-br'] = "";
$text['label-add-switch']['pl'] = "";
$text['label-add-switch']['sv-se'] = "";
$text['label-add-switch']['uk'] = "";
$text['label-add-switch']['de-at'] = "";
$text['label-add-switch']['ar-eg'] = "";
$text['label-select_language']['en-us'] = "Language";
$text['label-select_language']['es-cl'] = "";
$text['label-select_language']['pt-pt'] = "";
$text['label-select_language']['fr-fr'] = "";
$text['label-select_language']['pt-br'] = "";
$text['label-select_language']['pl'] = "";
$text['label-select_language']['sv-se'] = "";
$text['label-select_language']['uk'] = "";
$text['label-select_language']['de-at'] = "";
$text['label-select_language']['ar-eg'] = "";
$text['label-event_host']['en-us'] = "Host/IP";
$text['label-event_host']['es-cl'] = "";
$text['label-event_host']['pt-pt'] = "";
$text['label-event_host']['fr-fr'] = "";
$text['label-event_host']['pt-br'] = "";
$text['label-event_host']['pl'] = "";
$text['label-event_host']['sv-se'] = "";
$text['label-event_host']['uk'] = "";
$text['label-event_host']['de-at'] = "";
$text['label-event_host']['ar-eg'] = "";
$text['label-event_port']['en-us'] = "Port";
$text['label-event_port']['es-cl'] = "Puerto";
$text['label-event_port']['pt-pt'] = "Porto";
$text['label-event_port']['fr-fr'] = "Port";
$text['label-event_port']['pt-br'] = "Porta";
$text['label-event_port']['pl'] = "Port";
$text['label-event_port']['sv-se'] = "Port";
$text['label-event_port']['uk'] = "Порт";
$text['label-event_port']['de-at'] = "Port";
$text['label-event_port']['ar-eg'] = "منفذ";
$text['label-event_password']['en-us'] = "Password";
$text['label-event_password']['es-cl'] = "Contreseña";
$text['label-event_password']['pt-pt'] = "Palavra-Chave";
$text['label-event_password']['fr-fr'] = "Mot de Passe";
$text['label-event_password']['pt-br'] = "Senha";
$text['label-event_password']['pl'] = "Hasło";
$text['label-event_password']['sv-se'] = "Lösenord";
$text['label-event_password']['uk'] = "Пароль";
$text['label-event_password']['de-at'] = "Passwort";
$text['label-event_password']['ar-eg'] = "كلمة السر";
$text['label-username']['en-us'] = "Username";
$text['label-username']['es-cl'] = "Nombre de usuario";
$text['label-username']['pt-pt'] = "Utilizador";
$text['label-username']['fr-fr'] = "Utilisateur";
$text['label-username']['pt-br'] = "Nome do Usuário";
$text['label-username']['pl'] = "Użytkownik";
$text['label-username']['sv-se'] = "Användarnamn";
$text['label-username']['uk'] = "Ім’я користувача";
$text['label-username']['de-at'] = "Benutzername";
$text['label-username']['ar-eg'] = "اسم المستخدم";
$text['label-type']['en-us'] = "Type";
$text['label-type']['es-cl'] = "Tipo";
$text['label-type']['pt-pt'] = "Tipo";
$text['label-type']['fr-fr'] = "Type";
$text['label-type']['pt-br'] = "Tipo";
$text['label-type']['pl'] = "Typ";
$text['label-type']['sv-se'] = "Typ";
$text['label-type']['uk'] = "Тип";
$text['label-type']['de-at'] = "Typ";
$text['label-type']['ar-eg'] = "النوع";
$text['label-port']['en-us'] = "Port";
$text['label-port']['es-cl'] = "Puerto";
$text['label-port']['pt-pt'] = "Porto";
$text['label-port']['fr-fr'] = "Port";
$text['label-port']['pt-br'] = "Porta";
$text['label-port']['pl'] = "Port";
$text['label-port']['sv-se'] = "Port";
$text['label-port']['uk'] = "Порт";
$text['label-port']['de-at'] = "Port";
$text['label-port']['ar-eg'] = "منفذ";
$text['label-path']['en-us'] = "Path";
$text['label-path']['es-cl'] = "Ruta";
$text['label-path']['pt-pt'] = "Caminho";
$text['label-path']['fr-fr'] = "Chemin";
$text['label-path']['pt-br'] = "Caminho";
$text['label-path']['pl'] = "Ścieżka";
$text['label-path']['sv-se'] = "Sökväg";
$text['label-path']['uk'] = "Шлях";
$text['label-path']['de-at'] = "Pfad";
$text['label-path']['ar-eg'] = "";
$text['label-password']['en-us'] = "Password";
$text['label-password']['es-cl'] = "Contreseña";
$text['label-password']['pt-pt'] = "Palavra-Chave";
$text['label-password']['fr-fr'] = "Mot de Passe";
$text['label-password']['pt-br'] = "Senha";
$text['label-password']['pl'] = "Hasło";
$text['label-password']['sv-se'] = "Lösenord";
$text['label-password']['uk'] = "Пароль";
$text['label-password']['de-at'] = "Passwort";
$text['label-password']['ar-eg'] = "كلمة السر";
$text['label-name']['en-us'] = "Name";
$text['label-name']['es-cl'] = "Nombre";
$text['label-name']['pt-pt'] = "Nome";
$text['label-name']['fr-fr'] = "Nom";
$text['label-name']['pt-br'] = "Nome";
$text['label-name']['pl'] = "Nazwa";
$text['label-name']['sv-se'] = "Namn";
$text['label-name']['uk'] = "Назва";
$text['label-name']['de-at'] = "Name";
$text['label-name']['ar-eg'] = "الأسم";
$text['label-host']['en-us'] = "Host";
$text['label-host']['es-cl'] = "Host";
$text['label-host']['pt-pt'] = "Máquina";
$text['label-host']['fr-fr'] = "Hôte";
$text['label-host']['pt-br'] = "Máquina";
$text['label-host']['pl'] = "Host";
$text['label-host']['sv-se'] = "Värd";
$text['label-host']['uk'] = "Хост";
$text['label-host']['de-at'] = "Host";
$text['label-host']['ar-eg'] = "مضيف";
$text['label-driver']['en-us'] = "Driver";
$text['label-driver']['es-cl'] = "Controlador";
$text['label-driver']['pt-pt'] = "Driver";
$text['label-driver']['fr-fr'] = "Driver";
$text['label-driver']['pt-br'] = "Driver";
$text['label-driver']['pl'] = "Sterownik";
$text['label-driver']['sv-se'] = "Drivrutin";
$text['label-driver']['uk'] = "Драйвер";
$text['label-driver']['de-at'] = "Treiber";
$text['label-driver']['ar-eg'] = "";
$text['label-description']['en-us'] = "Description";
$text['label-description']['es-cl'] = "Descripción";
$text['label-description']['pt-pt'] = "Descrição";
$text['label-description']['fr-fr'] = "Description";
$text['label-description']['pt-br'] = "Descrição";
$text['label-description']['pl'] = "Opis";
$text['label-description']['sv-se'] = "Beskrivning";
$text['label-description']['uk'] = "Опис";
$text['label-description']['de-at'] = "Beschreibung";
$text['label-description']['ar-eg'] = "الوصف";
$text['header-install']['en-us'] = "Install";
$text['header-install']['es-cl'] = "";
$text['header-install']['pt-pt'] = "";
$text['header-install']['fr-fr'] = "";
$text['header-install']['pt-br'] = "";
$text['header-install']['pl'] = "";
$text['header-install']['sv-se'] = "";
$text['header-install']['uk'] = "";
$text['header-install']['de-at'] = "";
$text['header-install']['ar-eg'] = "";
$text['header-select_language']['en-us'] = "Select Language";
$text['header-select_language']['es-cl'] = "";
$text['header-select_language']['pt-pt'] = "";
$text['header-select_language']['fr-fr'] = "";
$text['header-select_language']['pt-br'] = "";
$text['header-select_language']['pl'] = "";
$text['header-select_language']['sv-se'] = "";
$text['header-select_language']['uk'] = "";
$text['header-select_language']['de-at'] = "";
$text['header-select_language']['ar-eg'] = "";
$text['header-event_socket']['en-us'] = "Event Socket Configuration";
$text['header-event_socket']['es-cl'] = "";
$text['header-event_socket']['pt-pt'] = "";
$text['header-event_socket']['fr-fr'] = "";
$text['header-event_socket']['pt-br'] = "";
$text['header-event_socket']['pl'] = "";
$text['header-event_socket']['sv-se'] = "";
$text['header-event_socket']['uk'] = "";
$text['header-event_socket']['de-at'] = "";
$text['header-event_socket']['ar-eg'] = "";
$text['header-config_detail']['en-us'] = "Admin Configuration";
$text['header-config_detail']['es-cl'] = "";
$text['header-config_detail']['pt-pt'] = "";
$text['header-config_detail']['fr-fr'] = "";
$text['header-config_detail']['pt-br'] = "";
$text['header-config_detail']['pl'] = "";
$text['header-config_detail']['sv-se'] = "";
$text['header-config_detail']['uk'] = "";
$text['header-config_detail']['de-at'] = "";
$text['header-config_detail']['ar-eg'] = "";
$text['header-config_database']['en-us'] = "Database Configuration";
$text['header-config_database']['es-cl'] = "";
$text['header-config_database']['pt-pt'] = "";
$text['header-config_database']['fr-fr'] = "";
$text['header-config_database']['pt-br'] = "";
$text['header-config_database']['pl'] = "";
$text['header-config_database']['sv-se'] = "";
$text['header-config_database']['uk'] = "";
$text['header-config_database']['de-at'] = "";
$text['header-config_database']['ar-eg'] = "";
$text['header-installing']['en-us'] = "Executing Install";
$text['header-installing']['es-cl'] = "";
$text['header-installing']['pt-pt'] = "";
$text['header-installing']['fr-fr'] = "";
$text['header-installing']['pt-br'] = "";
$text['header-installing']['pl'] = "";
$text['header-installing']['sv-se'] = "";
$text['header-installing']['uk'] = "";
$text['header-installing']['de-at'] = "";
$text['header-installing']['ar-eg'] = "";
$text['description-event_host']['en-us'] = "Enter the event socket host name/IP.";
$text['description-event_host']['es-cl'] = "";
$text['description-event_host']['pt-pt'] = "";
$text['description-event_host']['fr-fr'] = "";
$text['description-event_host']['pt-br'] = "";
$text['description-event_host']['pl'] = "";
$text['description-event_host']['sv-se'] = "";
$text['description-event_host']['uk'] = "";
$text['description-event_host']['de-at'] = "";
$text['description-event_host']['ar-eg'] = "";
$text['description-event_port']['en-us'] = "Enter the event socket port number.";
$text['description-event_port']['es-cl'] = "";
$text['description-event_port']['pt-pt'] = "";
$text['description-event_port']['fr-fr'] = "";
$text['description-event_port']['pt-br'] = "";
$text['description-event_port']['pl'] = "";
$text['description-event_port']['sv-se'] = "";
$text['description-event_port']['uk'] = "";
$text['description-event_port']['de-at'] = "";
$text['description-event_port']['ar-eg'] = "";
$text['description-event_password']['en-us'] = "Enter the event socket password.";
$text['description-event_password']['es-cl'] = "";
$text['description-event_password']['pt-pt'] = "";
$text['description-event_password']['fr-fr'] = "";
$text['description-event_password']['pt-br'] = "";
$text['description-event_password']['pl'] = "";
$text['description-event_password']['sv-se'] = "";
$text['description-event_password']['uk'] = "";
$text['description-event_password']['de-at'] = "";
$text['description-event_password']['ar-eg'] = "";
$text['description-username']['en-us'] = "Enter the database username.";
$text['description-username']['es-cl'] = "Ingrese el nombre de usuario de la base de datos.";
$text['description-username']['pt-pt'] = "Introduza o utilizador da base de dados.";
$text['description-username']['fr-fr'] = "Entrer le nom d'utilisateur de la Base de données.";
$text['description-username']['pt-br'] = "Insira o nome do usuário";
$text['description-username']['pl'] = "Wprowadź nazwę użytkownika";
$text['description-username']['sv-se'] = "Ange databasen användarnamn här.";
$text['description-username']['uk'] = "Введіть ім’я користувача бази даних";
$text['description-username']['de-at'] = "Geben Sie den Datenbank Benutzernamen an.";
$text['description-username']['ar-eg'] = "أدخل اسم المستخدم هنا";
$text['description-type']['en-us'] = "Select the database type.";
$text['description-type']['es-cl'] = "Seleccione el tipo de base de datos";
$text['description-type']['pt-pt'] = "Escolha o tipo de base de dados.";
$text['description-type']['fr-fr'] = "Choisir le type de Base de données.";
$text['description-type']['pt-br'] = "Introduza o tipo de definição.";
$text['description-type']['pl'] = "Wprowadź rodzaj bazy danych";
$text['description-type']['sv-se'] = "Välj databastyp";
$text['description-type']['uk'] = "Виберіть тип бази даних";
$text['description-type']['de-at'] = "Wählen Sie den Datenbank Typ.";
$text['description-type']['ar-eg'] = "إختر نوع قاعدة البيانات";
$text['description-port']['en-us'] = "Enter the port number.";
$text['description-port']['es-cl'] = "Ingrese el número del puerto.";
$text['description-port']['pt-pt'] = "Introduza o número do porto.";
$text['description-port']['fr-fr'] = "Entrer le numéro de port.";
$text['description-port']['pt-br'] = "Insira o número da porta";
$text['description-port']['pl'] = "Wprowadź numer portu";
$text['description-port']['sv-se'] = "Ange portnummer";
$text['description-port']['uk'] = "Введіть номер порта";
$text['description-port']['de-at'] = "Geben Sie die Port Nummer an.";
$text['description-port']['ar-eg'] = "أدخل رقم المنفذ";
$text['description-path']['en-us'] = "Enter the database file path (SQLite only).";
$text['description-path']['es-cl'] = "Ingrese la ruta al archivo de datos (solo SQLite).";
$text['description-path']['pt-pt'] = "Introduza o caminho da base de dados (apenas SQLite)";
$text['description-path']['fr-fr'] = "Entrer le chemin du fichier Base de données (Spécifique SQLite).";
$text['description-path']['pt-br'] = "Insira o caminho da base de dados (SQLite)";
$text['description-path']['pl'] = "Wprowadź ścieżkę do pliku bazy danych (tylko SQLite)";
$text['description-path']['sv-se'] = "Ange databasens sökväg (gäller endast SQLite).";
$text['description-path']['uk'] = "Вкажіть шлях до файлу бази даних (тільки SQLite).";
$text['description-path']['de-at'] = "Geben Sie den Datenbank Pfad an (nur für SQLite).";
$text['description-path']['ar-eg'] = "";
$text['description-password']['en-us'] = "Enter the database password.";
$text['description-password']['es-cl'] = "Ingrese la contraseña de la base de datos.";
$text['description-password']['pt-pt'] = "Introduza a palavra-chave da base de dados.";
$text['description-password']['fr-fr'] = "Entrer le mot de passe pour la Base de données.";
$text['description-password']['pt-br'] = "Introduza a senha";
$text['description-password']['pl'] = "Wpisz hasło";
$text['description-password']['sv-se'] = "Ange databasens lösenord.";
$text['description-password']['uk'] = "Введіть пароль бази даних.";
$text['description-password']['de-at'] = "Geben Sie das Datenbank Passwort ein.";
$text['description-password']['ar-eg'] = "أدخل الرقم السري الخاص بقاعدة البيانات";
$text['description-name']['en-us'] = "Enter the database name.";
$text['description-name']['es-cl'] = "Ingrese el nombre de la base de datos.";
$text['description-name']['pt-pt'] = "Introduza o nome da base de dados.";
$text['description-name']['fr-fr'] = "Entrer le nom de la Base de données.";
$text['description-name']['pt-br'] = "Insira o nome do menu";
$text['description-name']['pl'] = "Wprowadź nazwę bazy danych.";
$text['description-name']['sv-se'] = "Ange databasens namn.";
$text['description-name']['uk'] = "Введіть ім'я бази даних.";
$text['description-name']['de-at'] = "Geben Sie den Namen der Datenbank an";
$text['description-name']['ar-eg'] = "أدخل إسم قاعدة البيانات";
$text['description-host']['en-us'] = "Enter the host name.";
$text['description-host']['es-cl'] = "Ingrese el nombre de host";
$text['description-host']['pt-pt'] = "Introduza o nome da máquina.";
$text['description-host']['fr-fr'] = "Entrer le nom de l'hôte.";
$text['description-host']['pt-br'] = "Insira o nome da máquina ";
$text['description-host']['pl'] = "Wprowadź nazwę hosta.";
$text['description-host']['sv-se'] = "Ange värdnamnet";
$text['description-host']['uk'] = "Введіть ім'я хоста.";
$text['description-host']['de-at'] = "Geben Sie den Host Namen ein.";
$text['description-host']['ar-eg'] = "أدخل إسم المضيف";
$text['description-driver']['en-us'] = "Select the database driver.";
$text['description-driver']['es-cl'] = "Seleccione un controlador de base de datos.";
$text['description-driver']['pt-pt'] = "Escolha o driver da base de dados";
$text['description-driver']['fr-fr'] = "Choisir le driver de la Base de données.";
$text['description-driver']['pt-br'] = "Escolha o driver da base de dados";
$text['description-driver']['pl'] = "Wybierz sterownik bazy danych.";
$text['description-driver']['sv-se'] = "Välj databas drivrutin.";
$text['description-driver']['uk'] = "Виберіть драйвер бази даних.";
$text['description-driver']['de-at'] = "Wählen Sie den Datenbank Treiber.";
$text['description-driver']['ar-eg'] = "";
$text['description-description']['en-us'] = "Enter a description for this database, if desired.";
$text['description-description']['es-cl'] = "Ingrese una descripción para esta base de datos, opcional.";
$text['description-description']['pt-pt'] = "Introduza a descrição para a base de dados (opcional).";
$text['description-description']['fr-fr'] = "Entrer une description pour cette Base de données. (optionnel)";
$text['description-description']['pt-br'] = "Insira a descrição, caso desejar";
$text['description-description']['pl'] = "Wprowadź opis bazy danych (opcjonalne)";
$text['description-description']['sv-se'] = "Fyll i en beskrivning för denna databas, om nödvändigt.";
$text['description-description']['uk'] = "Введіть опис, якщо це необхідно.";
$text['description-description']['de-at'] = "Falls gewünscht, geben Sie eine Beschreibung an.";
$text['description-description']['ar-eg'] = "";
$text['description-install']['en-us'] = "Select the action below you wish to perform.";
$text['description-install']['es-cl'] = "Seleccione las accion a continuación que desea realizar.";
$text['description-install']['pt-pt'] = "Selecione as ações abaixo você deseja executar."; //action signular needed
$text['description-install']['fr-fr'] = "Sélectionnez les action ci-dessous que vous souhaitez effectuer.";
$text['description-install']['pt-br'] = "Seleciona as ações abaixo que deseja executar "; //action signular needed
$text['description-install']['pl'] = "Wybierz opcje, które chcesz wykonać."; //action signular needed
$text['description-install']['sv-se'] = "Välj de åtgärder nedan som du vill utföra."; //action signular needed
$text['description-install']['uk'] = "Виберіть об’єкти для оновлення"; //action signular needed
$text['description-install']['de-at'] = "Wählen Sie eine Aktion."; //action signular needed
$text['description-database-edit']['en-us'] = "Database connection information.";
$text['description-database-edit']['es-cl'] = "Información de conexión a base de datos.";
$text['description-database-edit']['pt-pt'] = "Informação da ligação à base de dados.";
$text['description-database-edit']['fr-fr'] = "Informations de connexion à la Base";
$text['description-database-edit']['pt-br'] = "Informações da ligação na base de dados";
$text['description-database-edit']['pl'] = "Informacje o połączeniach z bazą danych.";
$text['description-database-edit']['sv-se'] = "Information om Databasanslutning";
$text['description-database-edit']['uk'] = "інформація про підключення до бази даних.";
$text['description-database-edit']['de-at'] = "Datenbank Verbindungs Information.";
$text['description-database-edit']['ar-eg'] = "بيانات الإتصال الخاص بقاعدة البيانات";
$text['description-database-add']['en-us'] = "Database connection information.";
$text['description-database-add']['es-cl'] = "Información de conexión a base de datos.";
$text['description-database-add']['pt-pt'] = "Informação da ligação à base de dados.";
$text['description-database-add']['fr-fr'] = "Informations de connexion à la Base.";
$text['description-database-add']['pt-br'] = "Informações da ligação na base de dados";
$text['description-database-add']['pl'] = "Informacje o połączeniach z bazą danych.";
$text['description-database-add']['sv-se'] = "Information om Databasanslutning";
$text['description-database-add']['uk'] = "інформація про підключення до бази даних.";
$text['description-database-add']['de-at'] = "Datenbank Verbindungs Information.";
$text['description-database-add']['ar-eg'] = "بيانات الإتصال الخاص بقاعدة البيانات";
$text['description-select_language']['en-us'] = "Please select the language you want to use";
$text['description-select_language']['es-cl'] = "";
$text['description-select_language']['pt-pt'] = "";
$text['description-select_language']['fr-fr'] = "";
$text['description-select_language']['pt-br'] = "";
$text['description-select_language']['pl'] = "";
$text['description-select_language']['sv-se'] = "";
$text['description-select_language']['uk'] = "";
$text['description-select_language']['de-at'] = "";
$text['description-select_language']['ar-eg'] = "";
$text['confirm-delete']['en-us'] = "Do you really want to delete this?";
$text['confirm-delete']['es-cl'] = "¿Realmente desea eliminar esto?";
$text['confirm-delete']['pt-pt'] = "Deseja realmente remover isto?";
$text['confirm-delete']['fr-fr'] = "Voulez-vous vraiment supprimer cela?";
$text['confirm-delete']['pt-br'] = "Deseja realmente remover isto?";
$text['confirm-delete']['pl'] = "Czy na pewno chcesz to usunąć?";
$text['confirm-delete']['sv-se'] = "Vill du verkligen ta bort detta?";
$text['confirm-delete']['uk'] = "Ви дійсно бажаєте це видалити?";
$text['confirm-delete']['de-at'] = "Wollen Sie das wirklich löschen?";
$text['confirm-delete']['ar-eg'] = "هل تريد حقا مسح هذا؟";
$text['button-save']['en-us'] = "Save";
$text['button-save']['es-cl'] = "Guardar";
$text['button-save']['pt-pt'] = "Guardar";
$text['button-save']['fr-fr'] = "Sauvegarder";
$text['button-save']['pt-br'] = "Salvar";
$text['button-save']['pl'] = "Zachowaj";
$text['button-save']['sv-se'] = "Spara";
$text['button-save']['uk'] = "Зберегти";
$text['button-save']['de-at'] = "Speichern";
$text['button-save']['ar-eg'] = "حفظ";
$text['button-next']['en-us'] = "Next";
$text['button-next']['es-cl'] = "";
$text['button-next']['pt-pt'] = "";
$text['button-next']['fr-fr'] = "";
$text['button-next']['pt-br'] = "";
$text['button-next']['pl'] = "";
$text['button-next']['sv-se'] = "";
$text['button-next']['uk'] = "";
$text['button-next']['de-at'] = "";
$text['button-next']['ar-eg'] = "";
$text['button-detect']['en-us'] = "Detect Configuration";
$text['button-detect']['es-cl'] = "";
$text['button-detect']['pt-pt'] = "";
$text['button-detect']['fr-fr'] = "";
$text['button-detect']['pt-br'] = "";
$text['button-detect']['pl'] = "";
$text['button-detect']['sv-se'] = "";
$text['button-detect']['uk'] = "";
$text['button-detect']['de-at'] = "";
$text['button-detect']['ar-eg'] = "";
$text['button-select']['en-us'] = "Select";
$text['button-select']['es-cl'] = "";
$text['button-select']['pt-pt'] = "";
$text['button-select']['fr-fr'] = "";
$text['button-select']['pt-br'] = "";
$text['button-select']['pl'] = "";
$text['button-select']['sv-se'] = "";
$text['button-select']['uk'] = "";
$text['button-select']['de-at'] = "";
$text['button-select']['ar-eg'] = "";
$text['button-edit']['en-us'] = "Edit";
$text['button-edit']['es-cl'] = "Editar";
$text['button-edit']['pt-pt'] = "Editar";
$text['button-edit']['fr-fr'] = "Editer";
$text['button-edit']['pt-br'] = "Editar";
$text['button-edit']['pl'] = "Edytuj";
$text['button-edit']['sv-se'] = "Editera";
$text['button-edit']['uk'] = "Редагувати";
$text['button-edit']['de-at'] = "Bearbeiten";
$text['button-edit']['ar-eg'] = "تعديل";
$text['button-delete']['en-us'] = "Delete";
$text['button-delete']['es-cl'] = "Eliminar";
$text['button-delete']['pt-pt'] = "Remover";
$text['button-delete']['fr-fr'] = "Supprimé";
$text['button-delete']['pt-br'] = "Remover";
$text['button-delete']['pl'] = "Usuń";
$text['button-delete']['sv-se'] = "Ta Bort";
$text['button-delete']['uk'] = "Видалити";
$text['button-delete']['de-at'] = "Löschen";
$text['button-delete']['ar-eg'] = "مسح";
$text['button-back']['en-us'] = "Back";
$text['button-back']['es-cl'] = "Volver";
$text['button-back']['pt-pt'] = "Voltar";
$text['button-back']['fr-fr'] = "Retour";
$text['button-back']['pt-br'] = "Voltar";
$text['button-back']['pl'] = "Wróć";
$text['button-back']['sv-se'] = "Tillbaka";
$text['button-back']['uk'] = "Назад";
$text['button-back']['de-at'] = "Zurück";
$text['button-back']['ar-eg'] = "رجوع";
$text['button-add']['en-us'] = "Add";
$text['button-add']['es-cl'] = "Agregar";
$text['button-add']['pt-pt'] = "Adicionar";
$text['button-add']['fr-fr'] = "Ajouter";
$text['button-add']['pt-br'] = "Adicionar";
$text['button-add']['pl'] = "Dodaj";
$text['button-add']['sv-se'] = "Lägg Till";
$text['button-add']['uk'] = "Додати";
$text['button-add']['de-at'] = "Hinzufügen";
$text['button-add']['ar-eg'] = "اضافة";
$text['button-install_execute']['en-us'] = "Execute";
$text['button-install_execute']['es-cl'] = "Ejecutar";
$text['button-install_execute']['pt-pt'] = "Executar";
$text['button-install_execute']['fr-fr'] = "Exécuter";
$text['button-install_execute']['pt-br'] = "Executar";
$text['button-install_execute']['pl'] = "Wykonaj";
$text['button-install_execute']['sv-se'] = "Kör";
$text['button-install_execute']['uk'] = "Виконати";
$text['button-install_execute']['de-at'] = "Ausführen";
?>

10
core/install/app_menu.php Normal file
View File

@ -0,0 +1,10 @@
<?php
//$apps[$x]['menu'][0]['title']['en-us'] = "Install";
//$apps[$x]['menu'][0]['uuid'] = "75507e6e-891e-11e5-af63-feff819cdc9f";
//$apps[$x]['menu'][0]['parent_uuid'] = "594d99c5-6128-9c88-ca35-4b33392cec0f";
//$apps[$x]['menu'][0]['category'] = "internal";
//$apps[$x]['menu'][0]['path'] = "/core/install/index.php";
//$apps[$x]['menu'][0]['groups'][] = "superadmin";
?>

83
core/install/index.php Normal file
View File

@ -0,0 +1,83 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
Matthew Vale <github@mafoo.org>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
//detect install state
$first_time_install = true;
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
$first_time_install = false;
} elseif (file_exists("/etc/fusionpbx/config.php")) {
//linux
$first_time_install = false;
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
$first_time_install = false;
}
if($first_time_install) {
header("Location: ".PROJECT_PATH."/core/install/install_first_time.php");
exit;
}
require_once "resources/check_auth.php";
if (!if_group("superadmin")) {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//includes and title
require_once "resources/header.php";
$document['title'] = $text['title-install'];
echo "<b>".$text['header-install']."</b>";
echo "<br><br>";
echo $text['description-install'];
echo "<br><br>";
echo "<form name='frm' method='post' action='/core/install/install_first_time.php'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo " <td width='30%' class='vncell'>\n";
echo " <input id='do_ft-install' type='submit' class='btn' value='".$text['label-ft-install']."'/>";
echo " </td>\n";
echo " <td width='70%' class='vtable' style='height: 50px;'>\n";
echo " <label for='do_ft-install'>";
echo " ".$text['description-ft-install'];
echo " </label>\n";
echo " </td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</form>\n";
//include the footer
require_once "resources/footer.php";
?>

View File

@ -0,0 +1,390 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
Matthew Vale <github@mafoo.org>
*/
require_once "root.php";
require_once "resources/functions.php";
require_once "resources/classes/text.php";
//initialize variables we are going to use
$event_host = '';
$event_port = '';
$event_password = '';
$install_language = 'en-us';
$admin_username = '';
$admin_password = '';
$install_default_country = 'US';
$install_template_name = '';
$domain_name = '';
$db_type = '';
$db_path = '';
$db_host = '';
$db_port = '';
$db_name = '';
$db_username = '';
$db_password = '';
$db_create = '';
$db_create_username = '';
$db_create_password = '';
//detect the iso country code from the locale
//TBD $locale = Locale::getDefault();
$timezone = 'UTC';
if (is_link('/etc/localtime')) {
// Mac OS X (and older Linuxes)
// /etc/localtime is a symlink to the
// timezone in /usr/share/zoneinfo.
$filename = readlink('/etc/localtime');
if (strpos($filename, '/usr/share/zoneinfo/') === 0) {
$timezone = substr($filename, 20);
}
} elseif (file_exists('/etc/timezone')) {
// Ubuntu / Debian.
$data = file_get_contents('/etc/timezone');
if ($data) {
$timezone = rtrim($data);
}
} elseif (file_exists('/etc/sysconfig/clock')) {
// RHEL / CentOS
$data = parse_ini_file('/etc/sysconfig/clock');
if (!empty($data['ZONE'])) {
$timezone = $data['ZONE'];
}
}
date_default_timezone_set($timezone);
//detect install state
$first_time_install = true;
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
$first_time_install = false;
} elseif (file_exists("/etc/fusionpbx/config.php")) {
$first_time_install = false;
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
$first_time_install = false;
}
if(!$first_time_install) {
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (!if_group("superadmin")) {
echo "access denied";
exit;
}
}
$install_step = '';
$return_install_step = '';
if (count($_POST) > 0) {
$install_language = check_str($_POST["install_language"]);
$install_step = check_str($_POST["install_step"]);
$return_install_step = check_str($_POST["return_install_step"]);
if(isset($_POST["event_host"])){
$event_host = check_str($_POST["event_host"]);
$event_port = check_str($_POST["event_port"]);
$event_password = check_str($_POST["event_password"]);
}
if(isset($_POST["db_type"])){
$db_type = $_POST["db_type"];
$admin_username = $_POST["admin_username"];
$admin_password = $_POST["admin_password"];
$install_default_country = $_POST["install_default_country"];
$install_template_name = $_POST["install_template_name"];
$domain_name = $_POST["domain_name"];
}
}
if(!$install_step) { $install_step = 'select_language'; }
$_SESSION['domain']['language']['code'] = $install_language;
//add multi-lingual support
$language = new text;
$text = $language->get();
//set a default template
$default_template = 'enhanced';
if (isset($_SESSION['domain']['template']['name']) and strlen($_SESSION['domain']['template']['name']) != 0) {
$default_template = $_SESSION['domain']['template']['name'];
}
//set a default enviroment if first_time
if($first_time_install){
//initialize some varibles to cut down on warnings
$_SESSION['message'] = '';
$v_link_label_play = '';
$v_link_label_pause = '';
$default_login = 0;
$onload = '';
}
//get the contents of the template and save it to the template variable
$template = file_get_contents($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes/'.$default_template.'/template.php');
//buffer the content
ob_end_clean(); //clean the buffer
ob_start();
$messages = array();
if (!extension_loaded('PDO')) {
$messages[] = "<b>PHP PDO was not detected</b>. Please install it before proceeding";
}
echo "<div align='center'>\n";
$msg = '';
//make sure the includes directory is writable so the config.php file can be written.
if (!is_writable($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/pdo.php")) {
$messages[] = "<b>Write access to ".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."</b> and its sub-directories are required during the install.";
}
//test for selinux
if (file_exists('/usr/sbin/getenforce')) {
$enforcing;
exec('getenforce', $enforcing);
if($enforcing[0] == 'Enforcing'){
$messages[] = "<b>SELinux is enabled and enforcing</b> you must have a policy installed to let the webserver connect to the switch event socket<br/>".
"<sm>You can use the following to find what ports are allowed<pre>semanage port -l | grep '^http_port_t'</pre></sm>";
}
}
//test for windows and non sqlite
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' and strlen($db_type) > 0 and $db_type !='sqlite') {
$messages[] = "<b>Windows requires a system DSN ODBC connection</b> this must be configured.";
}
//action code
if($return_install_step == 'config_detail'){
//check for all required data
$existing_errors = count($messages);
if (strlen($admin_username) == 0) { $messages[] = "Please provide the Admin Username"; }
if (strlen($admin_password) == 0) { $messages[] = "Please provide the Admin Password"; }
elseif (strlen($admin_password) < 5) { $messages[] = "Please provide an Admin Password that is 5 or more characters.<br>\n"; }
if ( count($messages) > $existing_errors) { $install_step = 'config_detail'; }
}
if($install_step =='execute')
{
//start the rocket launch!
//set the max execution time to 1 hour
ini_set('max_execution_time',3600);
}
//display messages
if (count($messages)>0) {
echo "<br />\n";
echo "<div align='center'>\n";
echo "<table width='75%'>\n";
echo "<tr>\n";
echo "<th align='left'>Messages</th>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='row_style1'><strong><ul>\n";
foreach ($messages as $message){
echo "<li>$message</li>\n";
}
echo "</ul></strong></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
}
//includes and title
$document['title'] = $text['title-install_first_time'];
//view code
if($install_step == 'select_language'){
include "resources/page_parts/install_select_language.php";
echo "<form method='post' name='frm' action=''>\n";
echo " <input type='hidden' name='install_language' value='".$_SESSION['domain']['language']['code']."'/>\n";
echo " <input type='hidden' name='return_install_step' value='select_language'/>\n";
echo " <input type='hidden' name='install_step' value='detect_config'/>\n";
echo " <div style='text-align:right'>\n";
echo " <button type='submit' id='next'>".$text['button-next']."</button>\n";
echo " </div>\n";
echo "</form>\n";
}elseif($install_step == 'detect_config'){
if(!($event_host == '' || $event_host == 'localhost' || $event_host == '::1' || $event_host == '127.0.0.1' )){
echo "<p><b>Warning</b> you have choosen a value other than localhost for event_host, this is unsoported at present</p>\n";
}
include "resources/page_parts/install_event_socket.php";
if($detect_ok){
echo "<form method='post' name='frm' action=''>\n";
echo " <input type='hidden' name='install_language' value='".$_SESSION['domain']['language']['code']."'/>\n";
echo " <input type='hidden' name='return_install_step' value='detect_config'/>\n";
echo " <input type='hidden' name='install_step' value='config_detail'/>\n";
echo " <input type='hidden' name='event_host' value='$event_host'/>\n";
echo " <input type='hidden' name='event_port' value='$event_port'/>\n";
echo " <input type='hidden' name='event_password' value='$event_password'/>\n";
echo " <div style='text-align:right'>\n";
echo " <button type='button' onclick=\"history.go(-1);\">".$text['button-back']."</button>\n";
echo " <button type='submit' id='next'>".$text['button-next']."</button>\n";
echo " </div>\n";
echo "</form>\n";
}else{
echo "<form method='post' name='frm' action=''>\n";
echo " <div style='text-align:right'>\n";
echo " <button type='button' onclick=\"history.go(-1);\">".$text['button-back']."</button>\n";
echo " </div>\n";
echo "</form>\n";
}
}
elseif($install_step == 'config_detail'){
if(!$domain_name){
//get the domain
$domain_array = explode(":", $_SERVER["HTTP_HOST"]);
$domain_name = $domain_array[0];
}
include "resources/page_parts/install_config_detail.php";
}
elseif($install_step == 'config_database'){
include "resources/page_parts/install_config_database.php";
}
elseif($install_step == 'execute'){
echo "<p><b>".$text['header-installing']."</b></p>\n";
//$protocol = 'http';
//if($_SERVER['HTTPS']) { $protocol = 'https'; }
//echo "<iframe src='$protocol://$domain_name/core/install/install_first_time.php' style='border:solid 1px #000;width:100%;height:auto'></iframe>";
require_once "core/install/resources/classes/detect_switch.php";
$detect_switch = new detect_switch($event_host, $event_port, $event_password);
$detect_ok = true;
try {
$detect_switch->detect();
} catch(Exception $e){
echo "<p>Failed to detect configuration detect_switch reported: " . $e->getMessage() . "</p>\n";
$detect_ok = false;
}
if($detect_ok){
$install_ok = true;
echo "<pre style='text-align:left;'>\n";
function error_handler($err_severity, $errstr, $errfile, $errline ) {
if (0 === error_reporting()) { return false;}
switch($err_severity)
{
case E_ERROR: throw new Exception ($errstr . " in $errfile line: $errline");
case E_PARSE: throw new Exception ($errstr . " in $errfile line: $errline");
case E_CORE_ERROR: throw new Exception ($errstr . " in $errfile line: $errline");
case E_COMPILE_ERROR: throw new Exception ($errstr . " in $errfile line: $errline");
case E_USER_ERROR: throw new Exception ($errstr . " in $errfile line: $errline");
case E_STRICT: throw new Exception ($errstr . " in $errfile line: $errline");
case E_RECOVERABLE_ERROR: throw new Exception ($errstr . " in $errfile line: $errline");
default: return false;
}
}
#set_error_handler("error_handler");
try {
require_once "resources/classes/global_settings.php";
$global_settings = new global_settings($detect_switch, $domain_name);
if(is_null($global_settings)){ throw new Exception("Error global_settings came back with null"); }
require_once "resources/classes/install_fusionpbx.php";
$system = new install_fusionpbx($global_settings);
$system->admin_username = $admin_username;
$system->admin_password = $admin_password;
$system->default_country = $install_default_country;
$system->install_language = $install_language;
$system->template_name = $install_template_name;
require_once "resources/classes/install_switch.php";
$switch = new install_switch($global_settings);
//$switch->debug = true;
//$system->debug = true;
$switch->echo_progress = true;
$system->echo_progress = true;
$system->install_phase_1();
$switch->install_phase_1();
$system->install_phase_2();
$switch->install_phase_2();
}catch(Exception $e){
echo "</pre>\n";
echo "<p><b>Failed to install</b><br/>" . $e->getMessage() . "</p>\n";
try {
require_once "resources/classes/install_fusionpbx.php";
$system = new install_fusionpbx($global_settings);
$system->remove_config();
}catch(Exception $e){
echo "<p><b>Failed to remove config:</b> " . $e->getMessage() . "</p>\n";
}
$install_ok = false;
}
restore_error_handler();
if($install_ok){
echo "</pre>\n";
header("Location: ".PROJECT_PATH."/logout.php");
$_SESSION['message'] = 'Install complete';
}else{
echo "<form method='post' name='frm' action=''>\n";
echo " <div style='text-align:right'>\n";
echo " <button type='button' onclick=\"history.go(-1);\">".$text['button-back']."</button>\n";
echo " <button type='button' onclick=\"location.reload(true);\">".$text['button-install_execute']."</button>\n";
echo " </div>\n";
echo "</form>\n";
}
}
}else{
echo "<p>Unkown install_step '$install_step'</p>\n";
}
if($first_time_install){
//grab the default theme
$set_session_theme = 1;
$domains_processed = 1;
include "themes/enhanced/app_defaults.php";
unset($set_session_theme, $domains_processed);
//initialize some defaults so we can be 'logged in'
$_SESSION['username'] = 'first_time_install';
$_SESSION['permissions'][]['permission_name'] = 'superadmin';
$_SESSION['menu'] = '';
}
// add the content to the template and then send output
$body = ob_get_contents(); //get the output from the buffer
ob_end_clean(); //clean the buffer
//replace known used constants
$body = str_replace ("<!--{project_path}-->", PROJECT_PATH, $body); //defined in /resources/menu.php
ob_start();
eval('?>' . $template . '<?php ');
$template = ob_get_contents(); //get the output from the buffer
ob_end_clean(); //clean the buffer
$custom_head = '';
$output = str_replace ("<!--{title}-->", $document['title'], $template); //<!--{title}--> defined in each individual page
$output = str_replace ("<!--{head}-->", $custom_head, $output); //<!--{head}--> defined in each individual page
$output = str_replace ("<!--{menu}-->", $_SESSION["menu"], $output); //defined in /resources/menu.php
$output = str_replace ("<!--{project_path}-->", PROJECT_PATH, $output); //defined in /resources/menu.php
$pos = strrpos($output, "<!--{body}-->");
if ($pos === false) {
$output = $body; //if tag not found just show the body
}
else {
//replace the body
$output = str_replace ("<!--{body}-->", $body, $output);
}
echo $output;
unset($output);
?>

View File

@ -0,0 +1,173 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010-2015
All Rights Reserved.
Contributor(s):
Matthew Vale <github@mafoo.org>
*/
require_once "root.php";
require_once "resources/classes/EventSocket.php";
//define the install class
class detect_switch {
// cached data
protected $_dirs;
protected $_vdirs;
public function get_dirs() { return $this->_dirs; }
public function get_vdirs() { return $this->_vdirs; }
// version information
protected $_major;
protected $_minor;
protected $_build;
public function major() { return $this->_major; }
public function minor() { return $this->_minor; }
public function build() { return $this->_build; }
public function version() { return $this->_major.".".$this->_minor.".".$this->_build; }
// dirs - detected by from the switch
protected $_base_dir = '';
protected $_cache_dir = '';
protected $_certs_dir = '';
protected $_conf_dir = '';
protected $_db_dir = '';
protected $_external_ssl_dir = '';
protected $_grammar_dir = '';
protected $_htdocs_dir = '';
protected $_internal_ssl_dir = '';
protected $_log_dir = '';
protected $_mod_dir = '';
protected $_recordings_dir = '';
protected $_run_dir = '';
protected $_script_dir = '';
protected $_sounds_dir = '';
protected $_storage_dir = '';
protected $_temp_dir = '';
public function base_dir() { return $this->_base_dir; }
public function cache_dir() { return $this->_cache_dir; }
public function certs_dir() { return $this->_certs_dir; }
public function conf_dir() { return $this->_conf_dir; }
public function db_dir() { return $this->_db_dir; }
public function external_ssl_dir() { return $this->_external_ssl_dir; }
public function grammar_dir() { return $this->_grammar_dir; }
public function htdocs_dir() { return $this->_htdocs_dir; }
public function internal_ssl_dir() { return $this->_internal_ssl_dir; }
public function log_dir() { return $this->_log_dir; }
public function mod_dir() { return $this->_mod_dir; }
public function recordings_dir() { return $this->_recordings_dir; }
public function run_dir() { return $this->_run_dir; }
public function script_dir() { return $this->_script_dir; }
public function sounds_dir() { return $this->_sounds_dir; }
public function storage_dir() { return $this->_storage_dir; }
public function temp_dir() { return $this->_temp_dir; }
// virtual dirs - assumed based on the detected dirs
protected $_voicemail_vdir = '';
protected $_phrases_vdir = '';
protected $_extensions_vdir = '';
protected $_sip_profiles_vdir = '';
protected $_dialplan_vdir = '';
protected $_backup_vdir = '';
public function voicemail_vdir() { return $this->_voicemail_vdir; }
public function phrases_vdir() { return $this->_phrases_vdir; }
public function extensions_vdir() { return $this->_extensions_vdir; }
public function sip_profiles_vdir() { return $this->_sip_profiles_vdir; }
public function dialplan_vdir() { return $this->_dialplan_vdir; }
public function backup_vdir() { return $this->_backup_vdir; }
// event socket
public $event_host = 'localhost';
public $event_port = '8021';
public $event_password = 'ClueCon';
protected $event_socket;
public function __construct($event_host, $event_port, $event_password) {
//do not take these settings from session as they be detecting a new switch
if($event_host){ $this->event_host = $event_host; }
if($event_port){ $this->event_port = $event_port; }
if($event_password){ $this->event_password = $event_password; }
$this->connect_event_socket();
if(!$this->event_socket){
$this->detect_event_socket();
}
$this->_dirs = preg_grep ('/.*_dir$/', get_class_methods('detect_switch') );
sort( $this->_dirs );
$this->_vdirs = preg_grep ('/.*_vdir$/', get_class_methods('detect_switch') );
sort( $this->_vdirs );
}
protected function detect_event_socket() {
//perform searches for user's config here
}
public function detect() {
$this->connect_event_socket();
if(!$this->event_socket){
throw new Exception('Failed to use event socket');
}
$FS_Version = $this->event_socket_request('api version');
preg_match("/FreeSWITCH Version (\d+)\.(\d+)\.(\d+(?:\.\d+)?)/", $FS_Version, $matches);
$this->_major = $matches[1];
$this->_minor = $matches[2];
$this->_build = $matches[3];
$FS_Vars = $this->event_socket_request('api global_getvar');
foreach (explode("\n",$FS_Vars) as $FS_Var){
preg_match("/(\w+_dir)=(.*)/", $FS_Var, $matches);
if(count($matches) > 0 and property_exists($this, "_" . $matches[1])){
$field = "_" . $matches[1];
$this->$field = normalize_path($matches[2]);
}
}
$this->_voicemail_vdir = normalize_path($this->_storage_dir . DIRECTORY_SEPARATOR . "voicemail");
$this->_phrases_vdir = normalize_path($this->_conf_dir . DIRECTORY_SEPARATOR . "lang");
$this->_extensions_vdir = normalize_path($this->_conf_dir . DIRECTORY_SEPARATOR . "directory");
$this->_sip_profiles_vdir = normalize_path($this->_conf_dir . DIRECTORY_SEPARATOR . "sip_profiles");
$this->_dialplan_vdir = normalize_path($this->_conf_dir . DIRECTORY_SEPARATOR . "dialplan");
$this->_backup_vdir = normalize_path(sys_get_temp_dir());
}
protected function connect_event_socket(){
$esl = new EventSocket;
if ($esl->connect($this->event_host, $this->event_port, $this->event_password)) {
$this->event_socket = $esl->reset_fp();
return true;
}
return false;
}
protected function event_socket_request($cmd) {
$esl = new EventSocket($this->event_socket);
$result = $esl->request($cmd);
$esl->reset_fp();
return $result;
}
public function restart_switch() {
$this->connect_event_socket();
if(!$this->event_socket){
throw new Exception('Failed to use event socket');
}
$this->event_socket_request('api fsctl shutdown restart elegant');
}
}
?>

View File

@ -0,0 +1,223 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010-2015
All Rights Reserved.
Contributor(s):
Matthew Vale <github@mafoo.org>
*/
require_once "root.php";
//define the install class
class global_settings {
// cached data
protected $_switch_dirs;
protected $_switch_vdirs;
public function get_switch_dirs() { return $this->_switch_dirs; }
public function get_switch_vdirs() { return $this->_switch_vdirs; }
// dirs - detected from the switch
protected $_switch_base_dir = '';
protected $_switch_cache_dir = '';
protected $_switch_certs_dir = '';
protected $_switch_conf_dir = '';
protected $_switch_db_dir = '';
protected $_switch_external_ssl_dir = '';
protected $_switch_grammar_dir = '';
protected $_switch_htdocs_dir = '';
protected $_switch_internal_ssl_dir = '';
protected $_switch_log_dir = '';
protected $_switch_mod_dir = '';
protected $_switch_recordings_dir = '';
protected $_switch_run_dir = '';
protected $_switch_script_dir = '';
protected $_switch_sounds_dir = '';
protected $_switch_storage_dir = '';
protected $_switch_temp_dir = '';
public function switch_base_dir() { return $this->_switch_base_dir; }
public function switch_cache_dir() { return $this->_switch_cache_dir; }
public function switch_certs_dir() { return $this->_switch_certs_dir; }
public function switch_conf_dir() { return $this->_switch_conf_dir; }
public function switch_db_dir() { return $this->_switch_db_dir; }
public function switch_external_ssl_dir() { return $this->_switch_external_ssl_dir; }
public function switch_grammar_dir() { return $this->_switch_grammar_dir; }
public function switch_htdocs_dir() { return $this->_switch_htdocs_dir; }
public function switch_internal_ssl_dir() { return $this->_switch_internal_ssl_dir; }
public function switch_log_dir() { return $this->_switch_log_dir; }
public function switch_mod_dir() { return $this->_switch_mod_dir; }
public function switch_recordings_dir() { return $this->_switch_recordings_dir; }
public function switch_run_dir() { return $this->_switch_run_dir; }
public function switch_script_dir() { return $this->_switch_script_dir; }
public function switch_sounds_dir() { return $this->_switch_sounds_dir; }
public function switch_storage_dir() { return $this->_switch_storage_dir; }
public function switch_temp_dir() { return $this->_switch_temp_dir; }
// virtual dirs - assumed based on the detected dirs
protected $_switch_voicemail_vdir = '';
protected $_switch_phrases_vdir = '';
protected $_switch_extensions_vdir = '';
protected $_switch_sip_profiles_vdir = '';
protected $_switch_dialplan_vdir = '';
protected $_switch_backup_vdir = '';
public function switch_voicemail_vdir() { return $this->_switch_voicemail_vdir; }
public function switch_phrases_vdir() { return $this->_switch_phrases_vdir; }
public function switch_extensions_vdir() { return $this->_switch_extensions_vdir; }
public function switch_sip_profiles_vdir() { return $this->_switch_sip_profiles_vdir; }
public function switch_dialplan_vdir() { return $this->_switch_dialplan_vdir; }
public function switch_backup_vdir() { return $this->_switch_backup_vdir; }
// event socket
protected $_switch_event_host;
protected $_switch_event_port;
protected $_switch_event_password;
public function switch_event_host() { return $this->_switch_event_host; }
public function switch_event_port() { return $this->_switch_event_port; }
public function switch_event_password() { return $this->_switch_event_password; }
// database information
protected $_db_type;
protected $_db_path;
protected $_db_host;
protected $_db_port;
protected $_db_name;
protected $_db_username;
protected $_db_password;
protected $_db_create;
protected $_db_create_username;
protected $_db_create_password;
public function db_type() { return $this->_db_type; }
public function db_path() { return $this->_db_path; }
public function db_host() { return $this->_db_host; }
public function db_port() { return $this->_db_port; }
public function db_name() { return $this->_db_name; }
public function db_username() { return $this->_db_username; }
public function db_password() { return $this->_db_password; }
public function db_create() { return $this->_db_create; }
public function db_create_username() { return $this->_db_create_username; }
public function db_create_password() { return $this->_db_create_password; }
//misc information
protected $_domain_uuid;
protected $_domain_name;
protected $_domain_count;
public function domain_uuid() { return $this->_domain_uuid; }
public function domain_name() { return $this->_domain_name; }
public function domain_count() { return $this->_domain_count; }
public function set_domain_uuid($domain_uuid) {
$e = new Exception();
$trace = $e->getTrace();
if($trace[1]['function'] != 'create_domain'){
throw new Exception('Only create_domain is allowed to update the domain_uuid');
}
$this->_domain_uuid = $domain_uuid;
}
public function __construct($detect_switch = null, $domain_name = null, $domain_uuid = null) {
$this->_switch_dirs = preg_grep ('/^switch_.*_dir$/', get_class_methods('global_settings') );
sort( $this->_switch_dirs );
$this->_switch_vdirs = preg_grep ('/^switch_.*_vdir$/', get_class_methods('global_settings') );
sort( $this->_switch_vdirs );
if(is_null($detect_switch)){
//take settings from session
if(!isset($_SESSION['switch'])){
throw new Exception("No detect_switch was passed to me but \$_SESSION['switch'] is empty!");
}
foreach ($this->_switch_dirs as $dir){
$category = 'switch';
$session_var;
preg_match( '/^switch_(.*)_dir$/', $dir, $session_var);
$dir = "_$dir";
if($session_var[1] == 'script'){ $session_var[1] = 'scripts'; }
if($session_var[1] == 'temp'){ $category = 'server'; }
$this->$dir = $_SESSION[$category][$session_var[1]]['dir'];
}
foreach ($this->_switch_vdirs as $vdir){
$category = 'switch';
$session_var;
preg_match( '/^switch_(.*)_vdir$/', $vdir, $session_var);
$vdir = "_$vdir";
if($session_var[1] == 'backup'){ $category = 'server'; }
$this->$vdir = $_SESSION[$category][$session_var[1]]['dir'];
}
$this->_switch_event_host = $_SESSION['event_socket_ip_address'];
$this->_switch_event_port = $_SESSION['event_socket_port'];
$this->_switch_event_password = $_SESSION['event_socket_password'];
// domain info
$this->_domain_name = $_SESSION['domain_name'];
$this->_domain_uuid = $_SESSION['domain_uuid'];
// collect misc info
$this->_domain_count = count($_SESSION["domains"]);
// collect db_info
global $db_type, $db_path, $db_host, $db_port, $db_name, $db_username, $db_password;
$this->_db_type = $db_type;
$this->_db_path = $db_path;
$this->_db_host = $db_host;
$this->_db_port = $db_port;
$this->_db_name = $db_name;
$this->_db_username = $db_username;
$this->_db_password = $db_password;
}elseif(!is_a($detect_switch, 'detect_switch')){
throw new Exception('The parameter $detect_switch must be a detect_switch object (or a subclass of)');
}else{
//copy from detect_switch
foreach($detect_switch->get_dirs() as $dir){
$t_dir = "_switch_$dir";
$this->$t_dir = $detect_switch->$dir();
}
foreach($detect_switch->get_vdirs() as $vdir){
$t_vdir = "_switch_$vdir";
$this->$t_vdir = $detect_switch->$vdir();
}
$this->_switch_event_host = $detect_switch->event_host;
$this->_switch_event_port = $detect_switch->event_port;
$this->_switch_event_password = $detect_switch->event_password;
//copy from _POST
foreach($_POST as $key=>$value){
if(substr($key,0,3) == "db_"){
$o_key = "_$key";
$this->$o_key = $value;
}
}
if($this->_db_create and strlen($this->_db_create_username) == 0)
{
$this->_db_create_username = $this->_db_username;
$this->_db_create_password = $this->_db_password;
}
if (strlen($this->_db_port) == 0) { $this->_db_port = "5432"; }
// domain info
if(strlen($domain_uuid) == 0){ $domain_uuid = uuid(); }
$this->_domain_name = $domain_name;
$this->_domain_uuid = $domain_uuid;
//collect misc info
$this->_domain_count = 1; //assumed to be one
}
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,455 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010-2015
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
//define the install class
class install_switch {
protected $global_settings;
protected $config_lua;
protected $dbh;
public $debug = false;
public $echo_progress = false;
function __construct($global_settings) {
if(is_null($global_settings)){
require_once "core/install/resources/classes/global_settings.php";
$global_settings = new global_settings();
}elseif(!is_a($global_settings, 'global_settings')){
throw new Exception('The parameter $global_settings must be a global_settings object (or a subclass of)');
}
$this->global_settings = $global_settings;
if (is_dir("/etc/fusionpbx")){
$this->config_lua = "/etc/fusionpbx/config.lua";
}elseif (is_dir("/usr/local/etc/fusionpbx")){
$this->config_lua = "/usr/local/etc/fusionpbx/config.lua";
}elseif(strlen($this->global_settings->switch_script_dir()) > 0) {
$this->config_lua = $this->global_settings->switch_script_dir()."/resources/config.lua";
}else{
throw new Exception("Could not work out where to put the config.lua");
}
$this->config_lua = normalize_path_to_os($this->config_lua);
}
//utility Functions
function write_debug($message) {
if($this->debug){
echo "$message\n";
}
}
function write_progress($message) {
if($this->echo_progress){
echo "$message\n";
}
}
//$options '-n' --no-clobber
protected function recursive_copy($src, $dst, $options = '') {
if (file_exists('/bin/cp')) {
if (strtoupper(substr(PHP_OS, 0, 3)) === 'SUN') {
//copy -R recursive, preserve attributes for SUN
$cmd = 'cp -Rp '.$src.'/* '.$dst;
} else {
//copy -R recursive, -L follow symbolic links, -p preserve attributes for other Posix systemss
$cmd = 'cp -RLp '.$options.' '.$src.'/* '.$dst;
}
$this->write_debug($cmd);
exec ($cmd);
}
elseif(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'){
$src = normalize_path_to_os($src);
$dst = normalize_path_to_os($dst);
exec("xcopy /E /Y \"$src\" \"$dst\"");
}
else {
throw new Exception('Could not perform copy operation on this platform, implementation missing');
$dir = opendir($src);
if (!$dir) {
if (!mkdir($src, 0755, true)) {
throw new Exception("recursive_copy() source directory '".$src."' does not exist.");
}
}
if (!is_dir($dst)) {
if (!mkdir($dst, 0755, true)) {
throw new Exception("recursive_copy() failed to create destination directory '".$dst."'");
}
}
//This looks wrong, essentially if we can't use /bin/cp it manually fils dirs, not correct
$script_dir_target = $_SESSION['switch']['scripts']['dir'];
$script_dir_source = realpath($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts');
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($src)) as $file_path_source) {
if (
substr_count($file_path_source, '/..') == 0 &&
substr_count($file_path_source, '/.') == 0 &&
substr_count($file_path_source, '/.svn') == 0 &&
substr_count($file_path_source, '/.git') == 0
) {
if ($dst != $src.'/resources/config.lua') {
$this->write_debug($file_path_source.' ---> '.$dst);
copy($file_path_source, $dst);
chmod($dst, 0755);
}
}
}
while(false !== ($file = readdir($dir))) {
if (($file != '.') && ($file != '..')) {
if (is_dir($src.'/'.$file)) {
$this->recursive_copy($src.'/'.$file, $dst.'/'.$file);
}
else {
//copy only missing files -n --no-clobber
if (strpos($options,'-n') !== false) {
if (!file_exists($dst.'/'.$file)) {
$this->write_debug("copy(".$src."/".$file.", ".$dst."/".$file.")");
copy($src.'/'.$file, $dst.'/'.$file);
}
}
else {
copy($src.'/'.$file, $dst.'/'.$file);
}
}
}
}
closedir($dir);
}
}
protected function recursive_delete($dir) {
if (file_exists('/bin/rm')) {
$this->write_debug('rm -Rf '.$dir.'/*');
exec ('rm -Rf '.$dir.'/*');
}
elseif(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'){
$dst = normalize_path_to_os($dst);
$this->write_debug("del /S /F /Q \"$dir\"");
exec("del /S /F /Q \"$dir\"");
}
else {
foreach (glob($dir) as $file) {
if (is_dir($file)) {
$this->write_debug("rm dir: ".$file);
$this->recursive_delete("$file/*");
rmdir($file);
} else {
$this->write_debug("delete file: ".$file);
unlink($file);
}
}
}
clearstatcache();
}
protected function backup_dir($dir, $backup_name){
if (!is_readable($dir)) {
throw new Exception("backup_dir() source directory '".$dir."' does not exist.");
}
$dst_tar = join( DIRECTORY_SEPARATOR, array(sys_get_temp_dir(), "$backup_name.tar"));
//pharData is the correct ay to do it, but it keeps creating incomplete archives
//$tar = new PharData($dst_tar);
//$tar->buildFromDirectory($dir);
$this->write_debug("backing up to $dst_tar");
if (file_exists('/bin/tar')) {
exec('tar -cvf ' .$dst_tar. ' -C '.$dir .' .');
}else{
$this->write_debug('WARN: old config could not be compressed');
$dst_dir = join( DIRECTORY_SEPARATOR, array(sys_get_temp_dir(), "$backup_name"));
recursive_copy($dir, $dst_dir);
}
}
function install_phase_1() {
$this->write_progress("Install phase 1 started for switch");
$this->copy_conf();
$this->copy_scripts();
$this->write_progress("Install phase 1 completed for switch");
}
function install_phase_2() {
$this->write_progress("Install phase 2 started for switch");
$this->create_config_lua();
$this->restart_switch();
$this->write_progress("Install phase 2 completed for switch");
}
function upgrade() {
$this->copy_scripts();
$this->create_config_lua();
}
protected function copy_conf() {
$this->write_progress("\tCopying Config");
//make a backup of the config
if (file_exists($this->global_settings->switch_conf_dir())) {
$this->backup_dir($this->global_settings->switch_conf_dir(), 'fusionpbx_switch_config');
$this->recursive_delete($this->global_settings->switch_conf_dir());
}
//make sure the conf directory exists
if (!is_dir($this->global_settings->switch_conf_dir())) {
if (!mkdir($this->global_settings->switch_conf_dir(), 0774, true)) {
throw new Exception("Failed to create the switch conf directory '".$this->global_settings->switch_conf_dir()."'. ");
}
}
//copy resources/templates/conf to the freeswitch conf dir
if (file_exists('/usr/share/examples/fusionpbx/resources/templates/conf')){
$src_dir = "/usr/share/examples/fusionpbx/resources/templates/conf";
}
else {
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/conf";
}
$dst_dir = $this->global_settings->switch_conf_dir();
if (is_readable($dst_dir)) {
$this->recursive_copy($src_dir, $dst_dir);
unset($src_dir, $dst_dir);
}
$fax_dir = join( DIRECTORY_SEPARATOR, array($this->global_settings->switch_storage_dir(), 'fax'));
if (!is_readable($fax_dir)) { mkdir($fax_dir,0777,true); }
$voicemail_dir = join( DIRECTORY_SEPARATOR, array($this->global_settings->switch_storage_dir(), 'voicemail'));
if (!is_readable($voicemail_dir)) { mkdir($voicemail_dir,0777,true); }
//create the dialplan/default.xml for single tenant or dialplan/domain.xml
if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/dialplan")) {
$dialplan = new dialplan;
$dialplan->domain_uuid = $this->domain_uuid;
$dialplan->domain = $this->domain_name;
$dialplan->switch_dialplan_dir = join( DIRECTORY_SEPARATOR, array($this->global_settings->switch_conf_dir(), "/dialplan"));
$dialplan->restore_advanced_xml();
if($this->_debug){
print_r($dialplan->result, $message);
$this->write_debug($message);
}
}
//write the xml_cdr.conf.xml file
if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/xml_cdr")) {
xml_cdr_conf_xml();
}
//write the switch.conf.xml file
if (file_exists($this->global_settings->switch_conf_dir())) {
switch_conf_xml();
}
}
protected function copy_scripts() {
$this->write_progress("\tCopying Scripts");
$script_dir = $this->global_settings->switch_script_dir();
if(strlen($script_dir) == 0) {
throw new Exception("Cannot copy scripts the 'script_dir' is empty");
}
if (file_exists($script_dir)) {
if (file_exists('/usr/share/examples/fusionpbx/resources/install/scripts')){
$src_dir = '/usr/share/examples/fusionpbx/resources/install/scripts';
}
else {
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts';
}
$dst_dir = $script_dir;
if (is_readable($script_dir)) {
$this->recursive_copy($src_dir, $dst_dir, $_SESSION['scripts']['options']['text']);
unset($src_dir, $dst_dir);
}else{
throw new Exception("Cannot read from '$src_dir' to get the scripts");
}
chmod($dst_dir, 0774);
}else{
$this->write_progress("\tSkipping scripts, script_dir is unset");
}
}
public function create_config_lua() {
//define the database connection as global
global $db;
//send progress
$this->write_progress("\tCreating " . $this->config_lua);
//set the directories
$path = dirname($this->config_lua);
$parent_dir = basename($path);
if ($parent_dir == 'resources' and !file_exists($path)){
$this->write_progress("\t... creating missing '$path'");
if (!mkdir($path, 0755, true)) {
throw new Exception("Failed to create the missing resources directory '$path'");
}
}
//get the odbc information
$sql = "select count(*) as num_rows from v_databases ";
$sql .= "where database_driver = 'odbc' ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
unset($prep_statement);
if ($row['num_rows'] > 0) {
$odbc_num_rows = $row['num_rows'];
$sql = "select * from v_databases ";
$sql .= "where database_driver = 'odbc' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$dsn_name = $row["database_name"];
$dsn_username = $row["database_username"];
$dsn_password = $row["database_password"];
break; //limit to 1 row
}
unset ($prep_statement);
}
else {
$odbc_num_rows = '0';
}
}
//config.lua
$fout = fopen($this->config_lua,"w");
if(!$fout){
throw new Exception("Failed to open '".$this->config_lua."' for writing");
}
$tmp = "\n";
$tmp .= "--set the variables\n";
if (strlen($this->global_settings->switch_sounds_dir()) > 0) {
$tmp .= normalize_path_to_os(" sounds_dir = [[".$this->global_settings->switch_sounds_dir()."]];\n");
}
if (strlen($this->global_settings->switch_phrases_vdir()) > 0) {
$tmp .= normalize_path_to_os(" phrases_dir = [[".$this->global_settings->switch_phrases_vdir()."]];\n");
}
if (strlen($this->global_settings->switch_db_dir()) > 0) {
$tmp .= normalize_path_to_os(" database_dir = [[".$this->global_settings->switch_db_dir()."]];\n");
}
if (strlen($this->global_settings->switch_recordings_dir()) > 0) {
$tmp .= normalize_path_to_os(" recordings_dir = [[".$this->global_settings->switch_recordings_dir()."]];\n");
}
if (strlen($this->global_settings->switch_storage_dir()) > 0) {
$tmp .= normalize_path_to_os(" storage_dir = [[".$this->global_settings->switch_storage_dir()."]];\n");
}
if (strlen($this->global_settings->switch_voicemail_vdir()) > 0) {
$tmp .= normalize_path_to_os(" voicemail_dir = [[".$this->global_settings->switch_voicemail_vdir()."]];\n");
}
if (strlen($this->global_settings->switch_script_dir()) > 0) {
$tmp .= normalize_path_to_os(" scripts_dir = [[".$this->global_settings->switch_script_dir()."]];\n");
}
$tmp .= normalize_path_to_os(" php_dir = [[".PHP_BINDIR."]];\n");
if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") {
$tmp .= " php_bin = \"php.exe\";\n";
}
else {
$tmp .= " php_bin = \"php\";\n";
}
$tmp .= normalize_path_to_os(" document_root = [[".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."]];\n");
$tmp .= "\n";
if ((strlen($this->global_settings->db_type()) > 0) || (strlen($dsn_name) > 0)) {
$tmp .= "--database information\n";
$tmp .= " database = {}\n";
$tmp .= " database[\"type\"] = \"".$this->global_settings->db_type()."\";\n";
$tmp .= " database[\"name\"] = \"".$this->global_settings->db_name()."\";\n";
$tmp .= normalize_path_to_os(" database[\"path\"] = [[".$this->global_settings->db_path()."]];\n");
if (strlen($dsn_name) > 0) {
$tmp .= " database[\"system\"] = \"odbc://".$dsn_name.":".$dsn_username.":".$dsn_password."\";\n";
$tmp .= " database[\"switch\"] = \"odbc://freeswitch:".$dsn_username.":".$dsn_password."\";\n";
}
elseif ($this->global_settings->db_type() == "pgsql") {
$db_host = $this->global_settings->db_host();
if($db_host == 'localhost') { $db_host = '127.0.0.1'; } // lua cannot resolve localhost
if (filter_var($db_host, FILTER_VALIDATE_IP)) {
$host_type = "hostaddr";
}
else {
$host_type = "host";
}
$tmp .= " database[\"system\"] = \"pgsql://".$host_type."=".$db_host." port=".$this->global_settings->db_port()." dbname=".$this->global_settings->db_name()." user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='".$this->global_settings->db_name()."'\";\n";
$tmp .= " database[\"switch\"] = \"pgsql://".$host_type."=".$db_host." port=".$this->global_settings->db_port()." dbname=freeswitch user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='freeswitch'\";\n";
}
elseif ($this->global_settings->db_type() == "sqlite") {
$tmp .= " database[\"system\"] = \"sqlite://".$this->global_settings->db_path()."/".$this->global_settings->db_name()."\";\n";
$tmp .= " database[\"switch\"] = \"sqlite://".$_SESSION['switch']['db']['dir']."\";\n";
}
elseif ($this->global_settings->db_type() == "mysql") {
$tmp .= " database[\"system\"] = \"\";\n";
$tmp .= " database[\"switch\"] = \"\";\n";
}
$tmp .= "\n";
}
$tmp .= "--set defaults\n";
$tmp .= " expire = {}\n";
$tmp .= " expire[\"directory\"] = \"3600\";\n";
$tmp .= " expire[\"dialplan\"] = \"3600\";\n";
$tmp .= " expire[\"languages\"] = \"3600\";\n";
$tmp .= " expire[\"sofia.conf\"] = \"3600\";\n";
$tmp .= " expire[\"acl.conf\"] = \"3600\";\n";
$tmp .= "\n";
$tmp .= "--set xml_handler\n";
$tmp .= " xml_handler = {}\n";
$tmp .= " xml_handler[\"fs_path\"] = false;\n";
$tmp .= "\n";
$tmp .= "--set the debug options\n";
$tmp .= " debug[\"params\"] = false;\n";
$tmp .= " debug[\"sql\"] = false;\n";
$tmp .= " debug[\"xml_request\"] = false;\n";
$tmp .= " debug[\"xml_string\"] = false;\n";
$tmp .= " debug[\"cache\"] = false;\n";
$tmp .= "\n";
$tmp .= "--additional info\n";
$tmp .= " domain_count = ".$this->global_settings->domain_count().";\n";
$tmp .= normalize_path_to_os(" temp_dir = [[".$this->global_settings->switch_temp_dir()."]];\n");
if (isset($_SESSION['domain']['dial_string']['text'])) {
$tmp .= " dial_string = \"".$_SESSION['domain']['dial_string']['text']."\";\n";
}
$tmp .= "\n";
$tmp .= "--include local.lua\n";
$tmp .= " require(\"resources.functions.file_exists\");\n";
$tmp .= " if (file_exists(\"/etc/fusionpbx/local.lua\")) then\n";
$tmp .= " dofile(\"/etc/fusionpbx/local.lua\");\n";
$tmp .= " elseif (file_exists(\"/usr/local/etc/fusionpbx/local.lua\")) then\n";
$tmp .= " dofile(\"/usr/local/etc/fusionpbx/local.lua\");\n";
$tmp .= " elseif (file_exists(scripts_dir..\"/resources/local.lua\")) then\n";
$tmp .= " require(\"resources.local\");\n";
$tmp .= " end\n";
fwrite($fout, $tmp);
unset($tmp);
fclose($fout);
}
protected function restart_switch() {
$esl = new EventSocket;
if(!$esl->connect($this->global_settings->switch_event_host(), $this->global_settings->switch_event_port(), $this->global_settings->switch_event_password())) {
throw new Exception("Failed to connect to switch");
}
if (!$esl->request('api fsctl shutdown restart elegant')){
throw new Exception("Failed to send switch restart");
}
$esl->reset_fp();
}
}
?>

View File

@ -0,0 +1,250 @@
<?php
$iso_countries = array
(
'AF' => 'Afghanistan',
'AX' => 'Aland Islands',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
'AO' => 'Angola',
'AI' => 'Anguilla',
'AQ' => 'Antarctica',
'AG' => 'Antigua And Barbuda',
'AR' => 'Argentina',
'AM' => 'Armenia',
'AW' => 'Aruba',
'AU' => 'Australia',
'AT' => 'Austria',
'AZ' => 'Azerbaijan',
'BS' => 'Bahamas',
'BH' => 'Bahrain',
'BD' => 'Bangladesh',
'BB' => 'Barbados',
'BY' => 'Belarus',
'BE' => 'Belgium',
'BZ' => 'Belize',
'BJ' => 'Benin',
'BM' => 'Bermuda',
'BT' => 'Bhutan',
'BO' => 'Bolivia',
'BA' => 'Bosnia And Herzegovina',
'BW' => 'Botswana',
'BV' => 'Bouvet Island',
'BR' => 'Brazil',
'IO' => 'British Indian Ocean Territory',
'BN' => 'Brunei Darussalam',
'BG' => 'Bulgaria',
'BF' => 'Burkina Faso',
'BI' => 'Burundi',
'KH' => 'Cambodia',
'CM' => 'Cameroon',
'CA' => 'Canada',
'CV' => 'Cape Verde',
'KY' => 'Cayman Islands',
'CF' => 'Central African Republic',
'TD' => 'Chad',
'CL' => 'Chile',
'CN' => 'China',
'CX' => 'Christmas Island',
'CC' => 'Cocos (Keeling) Islands',
'CO' => 'Colombia',
'KM' => 'Comoros',
'CG' => 'Congo',
'CD' => 'Congo, Democratic Republic',
'CK' => 'Cook Islands',
'CR' => 'Costa Rica',
'CI' => 'Cote D\'Ivoire',
'HR' => 'Croatia',
'CU' => 'Cuba',
'CY' => 'Cyprus',
'CZ' => 'Czech Republic',
'DK' => 'Denmark',
'DJ' => 'Djibouti',
'DM' => 'Dominica',
'DO' => 'Dominican Republic',
'EC' => 'Ecuador',
'EG' => 'Egypt',
'SV' => 'El Salvador',
'GQ' => 'Equatorial Guinea',
'ER' => 'Eritrea',
'EE' => 'Estonia',
'ET' => 'Ethiopia',
'FK' => 'Falkland Islands (Malvinas)',
'FO' => 'Faroe Islands',
'FJ' => 'Fiji',
'FI' => 'Finland',
'FR' => 'France',
'GF' => 'French Guiana',
'PF' => 'French Polynesia',
'TF' => 'French Southern Territories',
'GA' => 'Gabon',
'GM' => 'Gambia',
'GE' => 'Georgia',
'DE' => 'Germany',
'GH' => 'Ghana',
'GI' => 'Gibraltar',
'GR' => 'Greece',
'GL' => 'Greenland',
'GD' => 'Grenada',
'GP' => 'Guadeloupe',
'GU' => 'Guam',
'GT' => 'Guatemala',
'GG' => 'Guernsey',
'GN' => 'Guinea',
'GW' => 'Guinea-Bissau',
'GY' => 'Guyana',
'HT' => 'Haiti',
'HM' => 'Heard Island & Mcdonald Islands',
'VA' => 'Holy See (Vatican City State)',
'HN' => 'Honduras',
'HK' => 'Hong Kong',
'HU' => 'Hungary',
'IS' => 'Iceland',
'IN' => 'India',
'ID' => 'Indonesia',
'IR' => 'Iran, Islamic Republic Of',
'IQ' => 'Iraq',
'IE' => 'Ireland',
'IM' => 'Isle Of Man',
'IL' => 'Israel',
'IT' => 'Italy',
'JM' => 'Jamaica',
'JP' => 'Japan',
'JE' => 'Jersey',
'JO' => 'Jordan',
'KZ' => 'Kazakhstan',
'KE' => 'Kenya',
'KI' => 'Kiribati',
'KR' => 'Korea',
'KW' => 'Kuwait',
'KG' => 'Kyrgyzstan',
'LA' => 'Lao People\'s Democratic Republic',
'LV' => 'Latvia',
'LB' => 'Lebanon',
'LS' => 'Lesotho',
'LR' => 'Liberia',
'LY' => 'Libyan Arab Jamahiriya',
'LI' => 'Liechtenstein',
'LT' => 'Lithuania',
'LU' => 'Luxembourg',
'MO' => 'Macao',
'MK' => 'Macedonia',
'MG' => 'Madagascar',
'MW' => 'Malawi',
'MY' => 'Malaysia',
'MV' => 'Maldives',
'ML' => 'Mali',
'MT' => 'Malta',
'MH' => 'Marshall Islands',
'MQ' => 'Martinique',
'MR' => 'Mauritania',
'MU' => 'Mauritius',
'YT' => 'Mayotte',
'MX' => 'Mexico',
'FM' => 'Micronesia, Federated States Of',
'MD' => 'Moldova',
'MC' => 'Monaco',
'MN' => 'Mongolia',
'ME' => 'Montenegro',
'MS' => 'Montserrat',
'MA' => 'Morocco',
'MZ' => 'Mozambique',
'MM' => 'Myanmar',
'NA' => 'Namibia',
'NR' => 'Nauru',
'NP' => 'Nepal',
'NL' => 'Netherlands',
'AN' => 'Netherlands Antilles',
'NC' => 'New Caledonia',
'NZ' => 'New Zealand',
'NI' => 'Nicaragua',
'NE' => 'Niger',
'NG' => 'Nigeria',
'NU' => 'Niue',
'NF' => 'Norfolk Island',
'MP' => 'Northern Mariana Islands',
'NO' => 'Norway',
'OM' => 'Oman',
'PK' => 'Pakistan',
'PW' => 'Palau',
'PS' => 'Palestinian Territory, Occupied',
'PA' => 'Panama',
'PG' => 'Papua New Guinea',
'PY' => 'Paraguay',
'PE' => 'Peru',
'PH' => 'Philippines',
'PN' => 'Pitcairn',
'PL' => 'Poland',
'PT' => 'Portugal',
'PR' => 'Puerto Rico',
'QA' => 'Qatar',
'RE' => 'Reunion',
'RO' => 'Romania',
'RU' => 'Russian Federation',
'RW' => 'Rwanda',
'BL' => 'Saint Barthelemy',
'SH' => 'Saint Helena',
'KN' => 'Saint Kitts And Nevis',
'LC' => 'Saint Lucia',
'MF' => 'Saint Martin',
'PM' => 'Saint Pierre And Miquelon',
'VC' => 'Saint Vincent And Grenadines',
'WS' => 'Samoa',
'SM' => 'San Marino',
'ST' => 'Sao Tome And Principe',
'SA' => 'Saudi Arabia',
'SN' => 'Senegal',
'RS' => 'Serbia',
'SC' => 'Seychelles',
'SL' => 'Sierra Leone',
'SG' => 'Singapore',
'SK' => 'Slovakia',
'SI' => 'Slovenia',
'SB' => 'Solomon Islands',
'SO' => 'Somalia',
'ZA' => 'South Africa',
'GS' => 'South Georgia And Sandwich Isl.',
'ES' => 'Spain',
'LK' => 'Sri Lanka',
'SD' => 'Sudan',
'SR' => 'Suriname',
'SJ' => 'Svalbard And Jan Mayen',
'SZ' => 'Swaziland',
'SE' => 'Sweden',
'CH' => 'Switzerland',
'SY' => 'Syrian Arab Republic',
'TW' => 'Taiwan',
'TJ' => 'Tajikistan',
'TZ' => 'Tanzania',
'TH' => 'Thailand',
'TL' => 'Timor-Leste',
'TG' => 'Togo',
'TK' => 'Tokelau',
'TO' => 'Tonga',
'TT' => 'Trinidad And Tobago',
'TN' => 'Tunisia',
'TR' => 'Turkey',
'TM' => 'Turkmenistan',
'TC' => 'Turks And Caicos Islands',
'TV' => 'Tuvalu',
'UG' => 'Uganda',
'UA' => 'Ukraine',
'AE' => 'United Arab Emirates',
'GB' => 'United Kingdom',
'US' => 'United States',
'UM' => 'United States Outlying Islands',
'UY' => 'Uruguay',
'UZ' => 'Uzbekistan',
'VU' => 'Vanuatu',
'VE' => 'Venezuela',
'VN' => 'Viet Nam',
'VG' => 'Virgin Islands, British',
'VI' => 'Virgin Islands, U.S.',
'WF' => 'Wallis And Futuna',
'EH' => 'Western Sahara',
'YE' => 'Yemen',
'ZM' => 'Zambia',
'ZW' => 'Zimbabwe',
);
?>

View File

@ -0,0 +1,281 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
Matthew Vale <github@mafoo.org>
*/
echo "<form method='post' name='frm' action=''>\n";
echo "<input type='hidden' name='install_language' value='".$_SESSION['domain']['language']['code']."'/>\n";
echo "<input type='hidden' name='return_install_step' value='config_database'/>\n";
echo "<input type='hidden' name='install_step' value='execute'/>\n";
echo "<input type='hidden' name='event_host' value='$event_host'/>\n";
echo "<input type='hidden' name='event_port' value='$event_port'/>\n";
echo "<input type='hidden' name='event_password' value='$event_password'/>\n";
echo "<input type='hidden' name='db_type' value='$db_type'/>\n";
echo "<input type='hidden' name='admin_username' value='$admin_username'/>\n";
echo "<input type='hidden' name='admin_password' value='$admin_password'/>\n";
echo "<input type='hidden' name='install_default_country' value='$install_default_country'/>\n";
echo "<input type='hidden' name='install_template_name' value='$install_template_name'/>\n";
echo "<input type='hidden' name='domain_name' value='$domain_name'/>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap><b>".$text['header-config_database']."</b></td>\n";
echo "<td width='70%' align='right'>&nbsp;</td>\n";
echo "</tr>\n";
if ($db_type == "sqlite") {
echo "<tr>\n";
echo "<td class='vncell' 'valign='top' align='left' nowrap>\n";
echo " Database Filename\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_name' maxlength='255' value=\"$db_name\"><br />\n";
echo " Set the database filename. The file extension should be '.db'.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' 'valign='top' align='left' nowrap>\n";
echo " Database Directory\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_path' maxlength='255' value=\"$db_path\"><br />\n";
echo " Set the path to the database directory.\n";
echo "</td>\n";
echo "</tr>\n";
}
if ($db_type == "mysql") {
//set defaults
if (strlen($db_host) == 0) { $db_host = 'localhost'; }
if (strlen($db_port) == 0) { $db_port = '3306'; }
//if (strlen($db_name) == 0) { $db_name = 'fusionpbx'; }
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Database Host\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_host' maxlength='255' value=\"$db_host\"><br />\n";
echo " Enter the host address for the database server.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Database Port\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_port' maxlength='255' value=\"$db_port\"><br />\n";
echo " Enter the port number. It is optional if the database is using the default port.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Database Name\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_name' maxlength='255' value=\"$db_name\"><br />\n";
echo " Enter the name of the database.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Database Username\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_username' maxlength='255' value=\"$db_username\"><br />\n";
echo " Enter the database username. \n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Database Password\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_password' maxlength='255' value=\"$db_password\"><br />\n";
echo " Enter the database password.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Create Database Options\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <label class='radio'><input type='radio' name='create_db_option' value='none'";
if($db_create_option=='none') { echo " checked='checked'"; }
echo "/>Do not create database</label>\n";
echo " <label class='radio'><input type='radio' name='create_db_option' value='same'";
if($db_create_option=='same') { echo " checked='checked'"; }
echo "/>Create database using above username/password</label>\n";
echo " <label class='radio'><input type='radio' name='create_db_option' value='user'";
if($db_create_option=='user') { echo " checked='checked'"; }
echo "/>Create database using below username/password</label>\n";
echo "<br />\n";
echo "Choose whether to create the database\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Create Database Username\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_create_username' maxlength='255' value=\"$db_create_username\"><br />\n";
echo " Optional, this username is used to create the database, a database user and set the permissions. \n";
echo " By default this username is 'root' however it can be any account with permission to add a database, user, and grant permissions. \n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Create Database Password\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_create_password' maxlength='255' value=\"$db_create_password\"><br />\n";
echo " Enter the create database password.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
}
if ($db_type == "pgsql") {
if (strlen($db_host) == 0) { $db_host = 'localhost'; }
if (strlen($db_port) == 0) { $db_port = '5432'; }
if (strlen($db_name) == 0) { $db_name = 'fusionpbx'; }
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Database Host\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_host' maxlength='255' value=\"$db_host\"><br />\n";
echo " Enter the host address for the database server.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Database Port\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_port' maxlength='255' value=\"$db_port\"><br />\n";
echo " Enter the port number. It is optional if the database is using the default port.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Database Name\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_name' maxlength='255' value=\"$db_name\"><br />\n";
echo " Enter the name of the database.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Database Username\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_username' maxlength='255' value=\"$db_username\"><br />\n";
echo " Enter the database username.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Database Password\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_password' maxlength='255' value=\"$db_password\"><br />\n";
echo " Enter the database password.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Create Database Options\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <label class='radio'><input type='checkbox' name='db_create' value='1'";
if($db_create=='1') { echo " checked='checked'"; }
echo "/>Create the database</label>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Create Database Username\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_create_username' maxlength='255' value=\"$db_create_username\"><br />\n";
echo " Optional, this username is used to create the database, a database user and set the permissions. \n";
echo " By default this username is 'pgsql' however it can be any account with permission to add a database, user, and grant permissions. \n";
echo " Leave blank to use the details above. \n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Create Database Password\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_create_password' maxlength='255' value=\"$db_create_password\"><br />\n";
echo " Enter the create database password.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
}
echo "</table>";
echo " <div style='text-align:right'>\n";
echo " <button type='button' onclick=\"history.go(-1);\">".$text['button-back']."</button>\n";
echo " <button type='submit'>".$text['button-install_execute']."</button>\n";
echo " </div>\n";
echo "</form>\n";
?>

View File

@ -0,0 +1,147 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
Matthew Vale <github@mafoo.org>
*/
echo "<form method='post' name='frm' action=''>\n";
echo "<input type='hidden' name='install_language' value='".$_SESSION['domain']['language']['code']."'/>\n";
echo "<input type='hidden' name='return_install_step' value='config_detail'/>\n";
echo "<input type='hidden' name='install_step' value='config_database'/>\n";
echo "<input type='hidden' name='event_host' value='$event_host'/>\n";
echo "<input type='hidden' name='event_port' value='$event_port'/>\n";
echo "<input type='hidden' name='event_password' value='$event_password'/>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap><b>".$text['header-config_detail']."</b></td>\n";
echo "<td width='70%' align='right'>&nbsp;</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " Username\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='admin_username' maxlength='255' value=\"$admin_username\"><br />\n";
echo " Enter the username to use when logging in with the browser.<br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " Password\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='admin_password' maxlength='255' value=\"$admin_password\"><br />\n";
echo " Enter the password to use when logging in with the browser.<br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " Country\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select id='install_default_country' name='install_default_country' class='formfld' style=''>\n";
require "resources/countries.php";
foreach ($countries as $iso_code => $country ){
if($iso_code == $install_default_country){
echo " <option value='$iso_code' selected='selected'>".$country['country']."</option>\n";
}else{
echo " <option value='$iso_code'>".$country['country']."</option>\n";
}
}
echo " </select>\n";
echo " <br />\n";
echo " Select ISO country code used to initialize calling contry code variables.<br />\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td width='20%' class=\"vncellreq\" align='left' nowrap='nowrap'>\n";
echo " Theme: \n";
echo " </td>\n";
echo " <td class=\"vtable\" align='left'>\n";
echo " <select id='install_template_name' name='install_template_name' class='formfld' style=''>\n";
echo " <option value=''></option>\n";
//add all the themes to the list
$theme_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes';
if ($handle = opendir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes')) {
while (false !== ($dir_name = readdir($handle))) {
if ($dir_name != "." && $dir_name != ".." && $dir_name != ".svn" && $dir_name != ".git" && $dir_name != "flags" && is_readable($theme_dir.'/'.$dir_name)) {
$dir_label = str_replace('_', ' ', $dir_name);
$dir_label = str_replace('-', ' ', $dir_label);
if ($dir_name == 'enhanced') {
echo " <option value='$dir_name' selected='selected'>$dir_label</option>\n";
}
else {
echo " <option value='$dir_name'>$dir_label</option>\n";
}
}
}
closedir($handle);
}
echo " </select>\n";
echo " <br />\n";
echo " Select a theme to set as the default.<br />\n";
echo " </td>\n";
echo " </tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Domain name\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='domain_name' maxlength='255' value=\"$domain_name\"><br />\n";
echo " Enter the default domain name. \n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Database Type\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select name='db_type' id='db_type' class='formfld' id='form_tag' onchange='db_type_onchange();'>\n";
if (extension_loaded('pdo_pgsql')) { echo " <option value='pgsql'>postgresql</option>\n"; }
if (extension_loaded('pdo_mysql')) { echo " <option value='mysql'>mysql</option>\n"; }
if (extension_loaded('pdo_sqlite')) { echo " <option value='sqlite' selected='selected'>sqlite</option>\n"; } //set sqlite as the default
echo " </select><br />\n";
echo " Select the database type.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo " <div style='text-align:right'>\n";
echo " <button type='button' onclick=\"history.go(-1);\">".$text['button-back']."</button>\n";
echo " <button type='submit' id='next'>".$text['button-next']."</button>\n";
echo " </div>\n";
echo "</form>\n";
?>

View File

@ -0,0 +1,144 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Matthew Vale <github@mafoo.org>
*/
//fetch the values
require_once "core/install/resources/classes/detect_switch.php";
$switch_detect = new detect_switch($event_host, $event_port, $event_password);
//$switch_detect->event_port = 2021;
$detect_ok = true;
try {
$switch_detect->detect();
} catch(Exception $e){
echo "<p><b>Failed to detect configuration</b> detect_switch reported: " . $e->getMessage() ."</p>\n";
$detect_ok = false;
}
echo "<form method='post' name='detect_switch' action=''>\n";
echo "<input type='hidden' name='install_language' value='".$_SESSION['domain']['language']['code']."'/>\n";
echo "<input type='hidden' name='install_step' value='detect_config'/>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td width='30%' align='left' nowrap><b>".$text['header-event_socket']."</b><br><br></td>\n";
echo "<td width='70%' align='right'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-detect']."'/>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " ".$text['label-event_host']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='event_host' maxlength='255' value=\"".$switch_detect->event_host."\" onchange='JavaScript:disable_next()'/>\n";
echo "<br />\n";
echo $text['description-event_host']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " ".$text['label-event_port']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='event_port' maxlength='255' value=\"".$switch_detect->event_port."\" onchange='JavaScript:disable_next()'/>\n";
echo "<br />\n";
echo $text['description-event_port']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " ".$text['label-event_password']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='password' name='event_password' maxlength='255' value=\"".$switch_detect->event_password."\" onchange='JavaScript:disable_next()'/>\n";
echo "<br />\n";
echo $text['description-event_password']."\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <br>";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
if($detect_ok){
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td colspan='4' align='left' nowrap><b>".$text['title-detected_configuration']."</b></td>\n";
echo "</tr>\n";
$id = 1;
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap' width='15%'>\n";
echo "Switch version\n";
echo "</td>\n";
echo "<td class='vtable' width='35%' align='left'>\n";
echo " ".$switch_detect->version()."\n";
echo "</td>\n";
foreach ($switch_detect->get_dirs() as $folder)
{
if($id % 2 == 0){ echo "<tr>\n"; }
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap' width='15%'>\n";
echo $folder."\n";
echo "</td>\n";
echo "<td class='vtable' width='35%' align='left'>\n";
echo " ".$switch_detect->$folder()."\n";
echo "</td>\n";
if($id % 2 == 1){ echo "</tr>\n"; }
$id++;
}
if($id % 2 == 1){ echo "</tr>\n"; }
echo "<tr>\n";
echo "<td colspan='4' align='left' nowrap><br/><b>".$text['title-assumed_configuration']."</b></td>\n";
echo "</tr>\n";
$id=0;
foreach ($switch_detect->get_vdirs() as $folder)
{
if($id % 2 == 0){ echo "<tr>\n"; }
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap' width='15%'>\n";
echo $folder."\n";
echo "</td>\n";
echo "<td class='vtable' width='35%' align='left'>\n";
echo " ".$switch_detect->$folder()."\n";
echo "</td>\n";
if($id % 2 == 1){ echo "</tr>\n"; }
$id++;
}
echo "</table>";
}
?><script type='text/javascript'>
function disable_next() {
document.getElementById("next").style.display = 'none';
}
</script>

View File

@ -0,0 +1,69 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Matthew Vale <github@mafoo.org>
*/
echo "<form method='post' name='frm' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td width='30%' align='left' nowrap><b>".$text['header-select_language']."</b><br><br></td>\n";
echo "<td width='70%' align='right'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-select']."'/>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " ".$text['label-select_language']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo "<fieldset class='container'>";
foreach($_SESSION['app']['languages'] as $lang_code){
echo "<fieldset class='container'>";
echo " <label class='radio' style='width:200px;'>";
echo "<input type='radio' name='install_language' value='$lang_code' id='lang_$lang_code' onchange='JavaScript:disable_next()'";
if($lang_code == $_SESSION['domain']['language']['code'])
{
echo " checked='checked'";
}
echo "/>";
echo "<img src='<!--{project_path}-->/themes/flags/$lang_code.png' alt='$lang_code'/>&nbsp;".$text["language-$lang_code"];
echo "</label>\n";
echo "</fieldset>";
}
echo "</fieldset>";
echo "<br />\n";
echo $text['description-select_language']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br><br>";
echo "</form>";
?><script type='text/javascript'>
function disable_next() {
document.getElementById("next").style.display = 'none';
}
</script>

50
core/install/root.php Normal file
View File

@ -0,0 +1,50 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
if (!defined("PATH_SEPARATOR")) {
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
}
// make sure the document_root is set
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
// if the project directory exists then add it to the include path otherwise add the document root to the include path
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
}
else {
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
}
?>

View File

@ -0,0 +1,59 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// set included, if not
if (!isset($included)) { $included = false; }
//check the permission
if(defined('STDIN')) {
$document_root = str_replace("\\", "/", $_SERVER["PHP_SELF"]);
preg_match("/^(.*)\/core\/.*$/", $document_root, $matches);
$document_root = $matches[1];
set_include_path($document_root);
require_once "resources/require.php";
$_SERVER["DOCUMENT_ROOT"] = $document_root;
$format = 'text'; //html, text
}
else if (!$included) {
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('upgrade_switch') || if_group("superadmin")) {
//echo "access granted";
}
else {
echo "access denied";
exit;
}
$format = 'html'; //html, text
}
//run switch upgrade
require_once "resources/classes/install_switch.php";
$switch = new install_switch();
$switch->upgrade();
?>

View File

@ -32,6 +32,9 @@
$apps[$x]['permissions'][$y]['menu']['uuid'] = "e7bb1296-3141-48c9-a95a-82d2768d0ae4";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "upgrade_switch";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
//schema details
$y = 0; //table array index

View File

@ -26,19 +26,6 @@
if ($domains_processed == 1) {
//process if the scripts directory exists
if (strlen($_SESSION['switch']['scripts']['dir']) > 0) {
//if the resource scripts resource directory does not exist then create it
if (!is_dir($_SESSION['switch']['scripts']['dir']."/resources")) {
mkdir($_SESSION['switch']['scripts']['dir']."/resources",0755,true);
}
//copy the files and directories from resources/install
$install = new install;
$install->domain_uuid = $domain_uuid;
$install->switch_scripts_dir = $_SESSION['switch']['scripts']['dir'];
$install->copy_scripts();
}
//update the software table
$sql = "select count(*) as num_rows from v_software ";

View File

@ -180,6 +180,16 @@ $text['label-upgrade_apps']['sv-se'] = "App Standard";
$text['label-upgrade_apps']['uk'] = "Типові значення додатків";
$text['label-upgrade_apps']['de-at'] = "Applikationen zurücksetzen";
$text['label-upgrade_switch']['en-us'] = "Switch Upgrade";
$text['label-upgrade_switch']['es-cl'] = "";
$text['label-upgrade_switch']['pt-pt'] = "";
$text['label-upgrade_switch']['fr-fr'] = "";
$text['label-upgrade_switch']['pt-br'] = "";
$text['label-upgrade_switch']['pl'] = "";
$text['label-upgrade_switch']['sv-se'] = "";
$text['label-upgrade_switch']['uk'] = "";
$text['label-upgrade_switch']['de-at'] = "";
$text['label-upgrade']['en-us'] = "Upgrade";
$text['label-upgrade']['es-cl'] = "Actualizar";
$text['label-upgrade']['pt-pt'] = "Actualizar";
@ -390,6 +400,16 @@ $text['description-upgrade_apps']['sv-se'] = "Återställer standardinställning
$text['description-upgrade_apps']['uk'] = "Встановлює типові значення для додатків";
$text['description-upgrade_apps']['de-at'] = "Setzt alle Applikationen auf die Standardeinstellungen zurück.";
$text['description-upgrade_switch']['en-us'] = "Runs the upgrade switch routine.";
$text['description-upgrade_switch']['es-cl'] = "";
$text['description-upgrade_switch']['pt-pt'] = "";
$text['description-upgrade_switch']['fr-fr'] = "";
$text['description-upgrade_switch']['pt-br'] = "";
$text['description-upgrade_switch']['pl'] = "";
$text['description-upgrade_switch']['sv-se'] = "";
$text['description-upgrade_switch']['uk'] = "";
$text['description-upgrade_switch']['de-at'] = "";
$text['description-upgrade']['en-us'] = "Select the actions below you wish to perform.";
$text['description-upgrade']['es-cl'] = "Seleccione las acciones a continuación que desea realizar.";
$text['description-upgrade']['pt-pt'] = "Selecione as ações abaixo você deseja executar.";

View File

@ -35,6 +35,7 @@ if (
!permission_exists('upgrade_source') &&
!permission_exists('upgrade_schema') &&
!permission_exists('upgrade_apps') &&
!permission_exists('upgrade_switch') &&
!permission_exists('menu_restore') &&
!permission_exists('group_edit')
) {
@ -52,7 +53,7 @@ if (sizeof($_POST) > 0) {
// run source update
if ($do["source"] && permission_exists("upgrade_source") && !is_dir("/usr/share/examples/fusionpbx")) {
chdir("/var/www/fusionpbx/");
chdir($_SERVER["DOCUMENT_ROOT"]);
exec("git pull", $response_source_update);
$update_failed = true;
if (sizeof($response_source_update) > 0) {
@ -72,10 +73,8 @@ if (sizeof($_POST) > 0) {
//update scripts folder, if allowed (default)
if ($_SESSION['switch']['scripts']['dir'] != '') {
//copy the files and directories from resources/install
$install = new install;
$install->domain_uuid = $domain_uuid;
$install->switch_scripts_dir = $_SESSION['switch']['scripts']['dir'];
$install->copy_scripts();
$obj = new install_switch;
$obj->upgrade();
//set the message
$response_message = $text['message-upgrade_source_scripts'];
}
@ -123,6 +122,13 @@ if (sizeof($_POST) > 0) {
$response_message = "Permission Defaults Restored";
}
// upgrade switch
if ($do["switch"] && permission_exists("upgrade_switch")) {
$included = true;
require_once("core/install/upgrade_switch.php");
$response_message = "Switch Upgraded";
}
if (sizeof($_POST['do']) > 1) {
$response_message = $text['message-upgrade'];
}
@ -252,6 +258,22 @@ if (permission_exists("group_edit")) {
echo "</table>\n";
}
if (permission_exists("upgrade_switch")) {
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo " <td width='30%' class='vncell'>\n";
echo " ".$text['label-upgrade_switch'];
echo " </td>\n";
echo " <td width='70%' class='vtable' style='height: 50px;'>\n";
echo " <label for='do_switch'>";
echo " <input type='checkbox' class='formfld' name='do[switch]' id='do_switch' value='1'>";
echo " ".$text['description-upgrade_switch'];
echo " </label>\n";
echo " </td>\n";
echo "</tr>\n";
echo "</table>\n";
}
echo "<br>";
echo "<div style='text-align: right;'><input type='submit' class='btn' value='".$text['button-upgrade_execute']."'></div>";
echo "<br><br>";

View File

@ -67,7 +67,10 @@
$obj = new schema;
echo $obj->schema("text");
//run all app_defaults.php files
//request the switch to perform upgrade functions
$obj = new install_switch;
$obj->upgrade();
require_once "resources/classes/domains.php";
$domain = new domains;
$domain->upgrade();

View File

@ -41,7 +41,7 @@ include "root.php";
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
//bsd
} else {
header("Location: ".PROJECT_PATH."/resources/install.php");
header("Location: ".PROJECT_PATH."/core/install/install_first_time.php");
exit;
}

View File

@ -0,0 +1,127 @@
<?php
/**
* config
*
* @method get config.php
* @method find find the path to the config.php file
* @method exists determin if the the config.php file exists
*/
class config {
/**
* database variables and config path
*/
public $db_type;
public $db_name;
public $db_username;
public $db_password;
public $db_host;
public $db_path;
public $db_port;
public $config_path;
/**
* Called when the object is created
*/
public function __construct() {
//place holder
}
/**
* Called when there are no references to a particular object
* unset the variables used in the class
*/
public function __destruct() {
foreach ($this as $key => $value) {
unset($this->$key);
}
}
/**
* Determine whether the config.php exists
* @var string $db_type - type of database
* @var string $db_name - name of the database
* @var string $db_username - username to access the database
* @var string $db_password - password to access the database
* @var string $db_host - hostname of the database server
* @var string $db_path - path of the database file
* @var string $db_port - network port to connect to the database
*/
public function get() {
$this->find();
if ($this->exists()) {
require $this->config_path;
$this->db_type = $db_type;
$this->db_name = $db_name;
$this->db_username = $db_username;
$this->db_password = $db_password;
$this->db_host = $db_host;
$this->db_path = $db_path;
$this->db_port = $db_port;
}
}
/**
* Find the path to the config.php
* @var string $config_path - full path to the config.php file
*/
public function find() {
//get the PROJECT PATH
include "root.php";
// find the file
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
$this->config_path = $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php";
} elseif (file_exists("/etc/fusionpbx/config.php")) {
$this->config_path = "/etc/fusionpbx/config.php";
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
$this->config_path = "/usr/local/etc/fusionpbx/config.php";
}
else {
$this->config_path = '';
}
//return the path
return $this->config_path;
}
/**
* Determine whether the config.php exists
*/
public function exists() {
$this->find();
if (strlen($this->config_path) > 0) {
return true;
}
else {
return false;
}
}
}
/*
$config = new config;
$config_exists = $config->exists();
$config_path = $config->find();
$config->get();
$db_type = $config->db_type;
$db_name = $config->db_name;
$db_username = $config->db_username;
$db_password = $config->db_password;
$db_host = $config->db_host;
$db_path = $config->db_path;
$db_port = $config->db_port;
echo "config_path: ".$config_path."\n";
if ($config_exists) {
echo "config_exists: true\n";
} else {
echo "config_exists: false\n";
}
echo "db_type: ".$db_type."\n";
echo "db_name: ".$db_name."\n";
echo "db_username: ".$db_username."\n";
echo "db_password: ".$db_password."\n";
echo "db_host: ".$db_host."\n";
echo "db_path: ".$db_path."\n";
echo "db_port: ".$db_port."\n";
*/
?>

View File

@ -186,36 +186,25 @@
//set the context
$_SESSION["context"] = $_SESSION["domain_name"];
//recordings add the domain to the path if there is more than one domains
if (count($_SESSION["domains"]) > 1) {
if (strlen($_SESSION['switch']['recordings']['dir']) > 0) {
if (substr($_SESSION['switch']['recordings']['dir'], -strlen($_SESSION["domain_name"])) != $_SESSION["domain_name"]) {
//get the default recordings directory
$sql = "select * from v_default_settings ";
$sql .= "where default_setting_enabled = 'true' ";
$sql .= "and default_setting_category = 'switch' ";
$sql .= "and default_setting_subcategory = 'recordings' ";
$sql .= "and default_setting_name = 'dir' ";
$prep_statement = $db->prepare($sql);
$prep_statement->execute();
$result_default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result_default_settings as $row) {
$name = $row['default_setting_name'];
$category = $row['default_setting_category'];
$subcategory = $row['default_setting_subcategory'];
$switch_recordings_dir = $row['default_setting_value'];
}
//add the domain
$_SESSION['switch']['recordings']['dir'] = $switch_recordings_dir . '/' . $_SESSION["domain_name"];
}
}
}
}
public function upgrade() {
//set the global variable
global $db, $db_type, $db_name, $db_username, $db_password, $db_host, $db_path, $db_port;
global $db;
//get the db variables
$config = new config;
$config_exists = $config->exists();
$config_path = $config->find();
$config->get();
$db_type = $config->db_type;
$db_name = $config->db_name;
$db_username = $config->db_username;
$db_password = $config->db_password;
$db_host = $config->db_host;
$db_path = $config->db_path;
$db_port = $config->db_port;
//get the PROJECT PATH
include "root.php";
@ -259,16 +248,6 @@
$prep_statement->execute();
$result_default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get the default recordings directory
foreach($result_default_settings as $row) {
$name = $row['default_setting_name'];
$category = $row['default_setting_category'];
$subcategory = $row['default_setting_subcategory'];
if ($category == 'switch' && $subcategory == 'recordings' && $name == 'dir') {
$switch_recordings_dir = $row['default_setting_value'];
}
}
//loop through all domains
$sql = "select * from v_domains ";
$v_prep_statement = $db->prepare(check_sql($sql));
@ -336,11 +315,6 @@
}
}
//set the recordings directory
if (strlen($switch_recordings_dir) > 1 && count($_SESSION["domains"]) > 1) {
$_SESSION['switch']['recordings']['dir'] = $switch_recordings_dir."/".$domain_name;
}
//get the list of installed apps from the core and mod directories and execute the php code in app_defaults.php
$default_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_defaults.php");
foreach ($default_list as &$default_path) {
@ -356,6 +330,10 @@
if (function_exists('save_dialplan_xml')) {
save_dialplan_xml();
}
//update config.lua
require_once "core/install/resources/classes/install_switch.php";
$switch = new install_switch;
$switch->create_config_lua();
//clear the session variables
unset($_SESSION['domain']);

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010
Copyright (C) 2010-2015
All Rights Reserved.
Contributor(s):
@ -89,6 +89,7 @@ include "root.php";
//add the fax
if (strlen($this->fax_extension) > 0) {
//add the dialplan
$database = new database;
$database->table = "v_dialplans";
@ -190,12 +191,7 @@ include "root.php";
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'rxfax';
if (count($_SESSION["domains"]) > 1) {
$dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domains'][$row['domain_uuid']]['domain_name'].'/'.$this->fax_extension.'/inbox/${last_fax}.tif';
}
else {
$dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$this->fax_extension.'/inbox/${last_fax}.tif';
}
$dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domains'][$this->domain_uuid]['domain_name'].'/'.$this->fax_extension.'/inbox/${last_fax}.tif';
$database->fields['dialplan_detail_data'] = $dialplan_detail_data;
$database->fields['dialplan_detail_order'] = '040';
$database->add();
@ -322,7 +318,6 @@ include "root.php";
$database->update();
}
else {
// $this->dialplan_uuid = uuid();
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->add();
@ -427,12 +422,7 @@ include "root.php";
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'rxfax';
if (count($_SESSION["domains"]) > 1) {
$dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domains'][$row['domain_uuid']]['domain_name'].'/'.$this->fax_extension.'/inbox/${last_fax}.tif';
}
else {
$dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$this->fax_extension.'/inbox/${last_fax}.tif';
}
$dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domains'][$this->domain_uuid]['domain_name'].'/'.$this->fax_extension.'/inbox/${last_fax}.tif';
$database->fields['dialplan_detail_data'] = $dialplan_detail_data;
$database->fields['dialplan_detail_order'] = '040';
$database->add();

View File

@ -1,207 +0,0 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010-2015
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
//define the install class
class install {
var $result;
var $domain_uuid;
var $domain;
var $switch_conf_dir;
var $switch_scripts_dir;
var $switch_sounds_dir;
//$options '-n' --no-clobber
public function recursive_copy($src, $dst, $options = '') {
if (file_exists('/bin/cp')) {
if (strtoupper(substr(PHP_OS, 0, 3)) === 'SUN') {
//copy -R recursive, preserve attributes for SUN
$cmd = 'cp -Rp '.$src.'/* '.$dst;
} else {
//copy -R recursive, -L follow symbolic links, -p preserve attributes for other Posix systemss
$cmd = 'cp -RLp '.$options.' '.$src.'/* '.$dst;
}
exec ($cmd);
//echo $cmd."\n";
}
else {
$dir = opendir($src);
if (!$dir) {
if (!mkdir($src, 0755, true)) {
throw new Exception("recursive_copy() source directory '".$src."' does not exist.");
}
}
if (!is_dir($dst)) {
if (!mkdir($dst, 0755, true)) {
throw new Exception("recursive_copy() failed to create destination directory '".$dst."'");
}
}
$scripts_dir_target = $_SESSION['switch']['scripts']['dir'];
$scripts_dir_source = realpath($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts');
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($src)) as $file_path_source) {
if (
substr_count($file_path_source, '/..') == 0 &&
substr_count($file_path_source, '/.') == 0 &&
substr_count($file_path_source, '/.svn') == 0 &&
substr_count($file_path_source, '/.git') == 0
) {
if ($dst != $src.'/resources/config.lua') {
//echo $file_path_source.' ---> '.$dst.'<br>';
copy($file_path_source, $dst);
chmod($dst, 0755);
}
}
}
while(false !== ($file = readdir($dir))) {
if (($file != '.') && ($file != '..')) {
if (is_dir($src.'/'.$file)) {
$this->recursive_copy($src.'/'.$file, $dst.'/'.$file);
}
else {
//copy only missing files -n --no-clobber
if (strpos($options,'-n') !== false) {
if (!file_exists($dst.'/'.$file)) {
copy($src.'/'.$file, $dst.'/'.$file);
//echo "copy(".$src."/".$file.", ".$dst."/".$file.");<br />\n";
}
}
else {
copy($src.'/'.$file, $dst.'/'.$file);
}
}
}
}
closedir($dir);
}
}
function recursive_delete($dir) {
if (file_exists('/bin/rm')) {
exec ('rm -Rf '.$dir.'/*');
}
else {
foreach (glob($dir) as $file) {
if (is_dir($file)) {
$this->recursive_delete("$file/*");
rmdir($file);
//echo "rm dir: ".$file."\n";
} else {
//echo "delete file: ".$file."\n";
unlink($file);
}
}
}
clearstatcache();
}
function copy() {
$this->copy_scripts();
//$this->copy_sounds();
}
function copy_conf() {
if (file_exists($this->switch_conf_dir)) {
//make a backup copy of the conf directory
$src_dir = $this->switch_conf_dir;
$dst_dir = $this->switch_conf_dir.'.orig';
if (is_readable($src_dir)) {
$this->recursive_copy($src_dir, $dst_dir);
$this->recursive_delete($src_dir);
}
else {
if ($src_dir != "/conf") {
mkdir($src_dir, 0774, true);
}
}
//make sure the conf directory exists
if (!is_dir($this->switch_conf_dir)) {
if (!mkdir($this->switch_conf_dir, 0774, true)) {
throw new Exception("Failed to create the switch conf directory '".$this->switch_conf_dir."'. ");
}
}
//copy resources/templates/conf to the freeswitch conf dir
if (file_exists('/usr/share/examples/fusionpbx/resources/templates/conf')){
$src_dir = "/usr/share/examples/fusionpbx/resources/templates/conf";
}
else {
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/conf";
}
$dst_dir = $this->switch_conf_dir;
if (is_readable($dst_dir)) {
$this->recursive_copy($src_dir, $dst_dir);
}
//print_r($install->result);
}
}
// added /examples/ into the string
function copy_scripts() {
if (file_exists($this->switch_scripts_dir)) {
if (file_exists('/usr/share/examples/fusionpbx/resources/install/scripts')){
$src_dir = '/usr/share/examples/fusionpbx/resources/install/scripts';
}
else {
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts';
}
$dst_dir = $this->switch_scripts_dir;
if (is_readable($this->switch_scripts_dir)) {
$this->recursive_copy($src_dir, $dst_dir, $_SESSION['scripts']['options']['text']);
unset($src_dir, $dst_dir);
}
chmod($dst_dir, 0774);
}
}
//function copy_sounds() {
// if (file_exists($this->switch_sounds_dir)) {
// if (file_exists('/usr/share/examples/fusionpbx/resources/install/sounds/en/us/callie/custom/')){
// $src_dir = '/usr/share/examples/fusionpbx/resources/install/sounds/en/us/callie/custom/';
// changes the output dir for testing
// $dst_dir = $this->switch_sounds_dir.'/en/us/fusionpbx/custom/';
// }
// else {
// $src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sounds/en/us/callie/custom/';
// $dst_dir = $this->switch_sounds_dir.'/en/us/callie/custom/';
// }
// $this->recursive_copy($src_dir, $dst_dir, "-n");
// if (is_readable($this->switch_sounds_dir)) {
// $this->recursive_copy($src_dir, $dst_dir);
// chmod($dst_dir, 0664);
// }
// }
//}
}
//how to use the class
//$install = new install;
//$install->domain_uuid = $domain_uuid;
//$install->switch_conf_dir = $switch_conf_dir;
//$install->switch_scripts_dir = $switch_scripts_dir;
//$install->switch_sounds_dir = $switch_sounds_dir;
//$install->copy();
//print_r($install->result);
?>

View File

@ -448,8 +448,20 @@ include "root.php";
public function schema ($format) {
//set the global variable
global $db, $db_type, $db_name, $db_username, $db_password;
global $db_host, $db_path, $db_port, $upgrade_data_types, $text;
global $db, $upgrade_data_types, $text;
//get the db variables
$config = new config;
$config_exists = $config->exists();
$config_path = $config->find();
$config->get();
$db_type = $config->db_type;
$db_name = $config->db_name;
$db_username = $config->db_username;
$db_password = $config->db_password;
$db_host = $config->db_host;
$db_path = $config->db_path;
$db_port = $config->db_port;
//get the PROJECT PATH
include "root.php";

View File

@ -1,19 +1,16 @@
<?php
/**
* Get the text for the correct translation
*
* @method array get
*/
class text {
/**
* Called when the object is created
*/
public function __construct() {
//place holder
}
/**
* Called when there are no references to a particular object
* unset the variables used in the class
@ -23,13 +20,14 @@ class text {
unset($this->$key);
}
}
/**
* Get a specific item from the cache
* @var string $language_code examples: en-us, es-cl, fr-fr, pt-pt
* @var string $app_path examples: app/exec or core/domains
*/
public function get($language_code = null, $app_path = null) {
//get the global app_languages.php
include $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/core/app_languages.php";
//get the app_languages.php
if ($app_path != null) {
include $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/".$app_path."/app_languages.php";
@ -37,7 +35,6 @@ class text {
else {
include getcwd().'/app_languages.php';
}
//get the available languages
krsort($text);
foreach ($text as $lang_label => $lang_codes) {
@ -48,24 +45,32 @@ class text {
}
}
$_SESSION['app']['languages'] = array_unique($app_languages);
//check the session language
if(isset($_SESSION['domain'])){
$language_code = $_SESSION['domain']['language']['code'];
}elseif($language_code == null){
$language_code = 'en-us';
}
//reduce to specific language
if ($language_code != 'all') {
foreach($text as $key => $value) {
if ($language_code == null) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
else {
$text[$key] = $value[$language_code];
$text[$key] = $value[$language_code];
}
}
if ($language_code != 'all') {
foreach($language_name as $code => $value) {
$text["language-$code"] = $value;
}
}else{
foreach($language_name as $code => $value) {
foreach($language_name as $c_code => $value) {
$text["language-$code"][$c_code] = $value;
}
}
}
//return the array of translations
return $text;
}
}
?>

916
resources/countries.php Normal file
View File

@ -0,0 +1,916 @@
<?php
$countries['AF']['country'] = 'Afghanistan';
$countries['AF']['countrycode'] = '93';
$countries['AF']['exitcode'] = '00';
$countries['AF']['isocode'] = 'AF';
$countries['AL']['country'] = 'Albania';
$countries['AL']['countrycode'] = '355';
$countries['AL']['exitcode'] = '00';
$countries['AL']['isocode'] = 'AL';
$countries['DZ']['country'] = 'Algeria';
$countries['DZ']['countrycode'] = '213';
$countries['DZ']['exitcode'] = '00';
$countries['DZ']['isocode'] = 'DZ';
$countries['AS']['country'] = 'American Samoa';
$countries['AS']['countrycode'] = '1';
$countries['AS']['exitcode'] = '011';
$countries['AS']['isocode'] = 'AS';
$countries['AD']['country'] = 'Andorra';
$countries['AD']['countrycode'] = '376';
$countries['AD']['exitcode'] = '00';
$countries['AD']['isocode'] = 'AD';
$countries['AO']['country'] = 'Angola';
$countries['AO']['countrycode'] = '244';
$countries['AO']['exitcode'] = '00';
$countries['AO']['isocode'] = 'AO';
$countries['AI']['country'] = 'Anguilla';
$countries['AI']['countrycode'] = '1';
$countries['AI']['exitcode'] = '011';
$countries['AI']['isocode'] = 'AI';
$countries['AG']['country'] = 'Antigua and Barbuda';
$countries['AG']['countrycode'] = '1';
$countries['AG']['exitcode'] = '011';
$countries['AG']['isocode'] = 'AG';
$countries['AR']['country'] = 'Argentina';
$countries['AR']['countrycode'] = '54';
$countries['AR']['exitcode'] = '00';
$countries['AR']['isocode'] = 'AR';
$countries['AM']['country'] = 'Armenia';
$countries['AM']['countrycode'] = '374';
$countries['AM']['exitcode'] = '00';
$countries['AM']['isocode'] = 'AM';
$countries['AW']['country'] = 'Aruba';
$countries['AW']['countrycode'] = '297';
$countries['AW']['exitcode'] = '00';
$countries['AW']['isocode'] = 'AW';
$countries['AC']['country'] = 'Ascension';
$countries['AC']['countrycode'] = '247';
$countries['AC']['exitcode'] = '00';
$countries['AC']['isocode'] = 'AC';
$countries['AU']['country'] = 'Australia';
$countries['AU']['countrycode'] = '61';
$countries['AU']['exitcode'] = '0011';
$countries['AU']['isocode'] = 'AU';
$countries['AT']['country'] = 'Austria';
$countries['AT']['countrycode'] = '43';
$countries['AT']['exitcode'] = '00';
$countries['AT']['isocode'] = 'AT';
$countries['AZ']['country'] = 'Azerbaijan';
$countries['AZ']['countrycode'] = '994';
$countries['AZ']['exitcode'] = '00';
$countries['AZ']['isocode'] = 'AZ';
$countries['BS']['country'] = 'Bahamas';
$countries['BS']['countrycode'] = '1';
$countries['BS']['exitcode'] = '011';
$countries['BS']['isocode'] = 'BS';
$countries['BH']['country'] = 'Bahrain';
$countries['BH']['countrycode'] = '973';
$countries['BH']['exitcode'] = '00';
$countries['BH']['isocode'] = 'BH';
$countries['BD']['country'] = 'Bangladesh';
$countries['BD']['countrycode'] = '880';
$countries['BD']['exitcode'] = '00';
$countries['BD']['isocode'] = 'BD';
$countries['BB']['country'] = 'Barbados';
$countries['BB']['countrycode'] = '1';
$countries['BB']['exitcode'] = '011';
$countries['BB']['isocode'] = 'BB';
$countries['BY']['country'] = 'Belarus';
$countries['BY']['countrycode'] = '375';
$countries['BY']['exitcode'] = '810';
$countries['BY']['isocode'] = 'BY';
$countries['BE']['country'] = 'Belgium';
$countries['BE']['countrycode'] = '32';
$countries['BE']['exitcode'] = '00';
$countries['BE']['isocode'] = 'BE';
$countries['BZ']['country'] = 'Belize';
$countries['BZ']['countrycode'] = '501';
$countries['BZ']['exitcode'] = '00';
$countries['BZ']['isocode'] = 'BZ';
$countries['BJ']['country'] = 'Benin';
$countries['BJ']['countrycode'] = '229';
$countries['BJ']['exitcode'] = '00';
$countries['BJ']['isocode'] = 'BJ';
$countries['BM']['country'] = 'Bermuda';
$countries['BM']['countrycode'] = '1';
$countries['BM']['exitcode'] = '011';
$countries['BM']['isocode'] = 'BM';
$countries['BT']['country'] = 'Bhutan';
$countries['BT']['countrycode'] = '975';
$countries['BT']['exitcode'] = '00';
$countries['BT']['isocode'] = 'BT';
$countries['BO']['country'] = 'Bolivia';
$countries['BO']['countrycode'] = '591';
$countries['BO']['exitcode'] = '00';
$countries['BO']['isocode'] = 'BO';
$countries['BA']['country'] = 'Bosnia and Herzegovina';
$countries['BA']['countrycode'] = '387';
$countries['BA']['exitcode'] = '00';
$countries['BA']['isocode'] = 'BA';
$countries['BW']['country'] = 'Botswana';
$countries['BW']['countrycode'] = '267';
$countries['BW']['exitcode'] = '00';
$countries['BW']['isocode'] = 'BW';
$countries['BR']['country'] = 'Brazil';
$countries['BR']['countrycode'] = '55';
$countries['BR']['exitcode'] = '0014';
$countries['BR']['isocode'] = 'BR';
$countries['VG']['country'] = 'British Virgin Islands';
$countries['VG']['countrycode'] = '1';
$countries['VG']['exitcode'] = '011';
$countries['VG']['isocode'] = 'VG';
$countries['BN']['country'] = 'Brunei';
$countries['BN']['countrycode'] = '673';
$countries['BN']['exitcode'] = '00';
$countries['BN']['isocode'] = 'BN';
$countries['BG']['country'] = 'Bulgaria';
$countries['BG']['countrycode'] = '359';
$countries['BG']['exitcode'] = '00';
$countries['BG']['isocode'] = 'BG';
$countries['BF']['country'] = 'Burkina Faso';
$countries['BF']['countrycode'] = '226';
$countries['BF']['exitcode'] = '00';
$countries['BF']['isocode'] = 'BF';
$countries['BI']['country'] = 'Burundi';
$countries['BI']['countrycode'] = '257';
$countries['BI']['exitcode'] = '00';
$countries['BI']['isocode'] = 'BI';
$countries['KH']['country'] = 'Cambodia';
$countries['KH']['countrycode'] = '855';
$countries['KH']['exitcode'] = '001, 007, 008';
$countries['KH']['isocode'] = 'KH';
$countries['CM']['country'] = 'Cameroon';
$countries['CM']['countrycode'] = '237';
$countries['CM']['exitcode'] = '00';
$countries['CM']['isocode'] = 'CM';
$countries['CA']['country'] = 'Canada';
$countries['CA']['countrycode'] = '1';
$countries['CA']['exitcode'] = '011';
$countries['CA']['isocode'] = 'CA';
$countries['CV']['country'] = 'Cape Verde';
$countries['CV']['countrycode'] = '238';
$countries['CV']['exitcode'] = '00';
$countries['CV']['isocode'] = 'CV';
$countries['KY']['country'] = 'Cayman Islands';
$countries['KY']['countrycode'] = '1';
$countries['KY']['exitcode'] = '011';
$countries['KY']['isocode'] = 'KY';
$countries['CF']['country'] = 'Central African Republic';
$countries['CF']['countrycode'] = '236';
$countries['CF']['exitcode'] = '00';
$countries['CF']['isocode'] = 'CF';
$countries['TD']['country'] = 'Chad';
$countries['TD']['countrycode'] = '235';
$countries['TD']['exitcode'] = '00';
$countries['TD']['isocode'] = 'TD';
$countries['CL']['country'] = 'Chile';
$countries['CL']['countrycode'] = '56';
$countries['CL']['exitcode'] = '1230';
$countries['CL']['isocode'] = 'CL';
$countries['CN']['country'] = 'China';
$countries['CN']['countrycode'] = '86';
$countries['CN']['exitcode'] = '00';
$countries['CN']['isocode'] = 'CN';
$countries['CO']['country'] = 'Colombia';
$countries['CO']['countrycode'] = '57';
$countries['CO']['exitcode'] = '005';
$countries['CO']['isocode'] = 'CO';
$countries['KM']['country'] = 'Comoros';
$countries['KM']['countrycode'] = '269';
$countries['KM']['exitcode'] = '00';
$countries['KM']['isocode'] = 'KM';
$countries['CD']['country'] = 'Congo';
$countries['CD']['countrycode'] = '242';
$countries['CD']['exitcode'] = '00';
$countries['CD']['isocode'] = 'CD';
$countries['CK']['country'] = 'Cook Islands';
$countries['CK']['countrycode'] = '682';
$countries['CK']['exitcode'] = '00';
$countries['CK']['isocode'] = 'CK';
$countries['CR']['country'] = 'Costa Rica';
$countries['CR']['countrycode'] = '506';
$countries['CR']['exitcode'] = '00';
$countries['CR']['isocode'] = 'CR';
$countries['HR']['country'] = 'Croatia';
$countries['HR']['countrycode'] = '385';
$countries['HR']['exitcode'] = '00';
$countries['HR']['isocode'] = 'HR';
$countries['CU']['country'] = 'Cuba';
$countries['CU']['countrycode'] = '53';
$countries['CU']['exitcode'] = '119';
$countries['CU']['isocode'] = 'CU';
$countries['CY']['country'] = 'Cyprus';
$countries['CY']['countrycode'] = '357';
$countries['CY']['exitcode'] = '00';
$countries['CY']['isocode'] = 'CY';
$countries['CZ']['country'] = 'Czech Republic';
$countries['CZ']['countrycode'] = '420';
$countries['CZ']['exitcode'] = '00';
$countries['CZ']['isocode'] = 'CZ';
$countries['CD']['country'] = 'Democratic Republic of Congo';
$countries['CD']['countrycode'] = '243';
$countries['CD']['exitcode'] = '00';
$countries['CD']['isocode'] = 'CD';
$countries['DK']['country'] = 'Denmark';
$countries['DK']['countrycode'] = '45';
$countries['DK']['exitcode'] = '00';
$countries['DK']['isocode'] = 'DK';
$countries['DJ']['country'] = 'Djibouti';
$countries['DJ']['countrycode'] = '253';
$countries['DJ']['exitcode'] = '00';
$countries['DJ']['isocode'] = 'DJ';
$countries['DM']['country'] = 'Dominica';
$countries['DM']['countrycode'] = '1';
$countries['DM']['exitcode'] = '011';
$countries['DM']['isocode'] = 'DM';
$countries['DO']['country'] = 'Dominican Republic';
$countries['DO']['countrycode'] = '1';
$countries['DO']['exitcode'] = '011';
$countries['DO']['isocode'] = 'DO';
$countries['TL']['country'] = 'East Timor';
$countries['TL']['countrycode'] = '670';
$countries['TL']['exitcode'] = '00';
$countries['TL']['isocode'] = 'TL';
$countries['EC']['country'] = 'Ecuador';
$countries['EC']['countrycode'] = '593';
$countries['EC']['exitcode'] = '00';
$countries['EC']['isocode'] = 'EC';
$countries['EG']['country'] = 'Egypt';
$countries['EG']['countrycode'] = '20';
$countries['EG']['exitcode'] = '00';
$countries['EG']['isocode'] = 'EG';
$countries['SV']['country'] = 'El Salvador';
$countries['SV']['countrycode'] = '503';
$countries['SV']['exitcode'] = '00';
$countries['SV']['isocode'] = 'SV';
$countries['GQ']['country'] = 'Equatorial Guinea';
$countries['GQ']['countrycode'] = '240';
$countries['GQ']['exitcode'] = '00';
$countries['GQ']['isocode'] = 'GQ';
$countries['ER']['country'] = 'Eritrea';
$countries['ER']['countrycode'] = '291';
$countries['ER']['exitcode'] = '00';
$countries['ER']['isocode'] = 'ER';
$countries['EE']['country'] = 'Estonia';
$countries['EE']['countrycode'] = '372';
$countries['EE']['exitcode'] = '00';
$countries['EE']['isocode'] = 'EE';
$countries['ET']['country'] = 'Ethiopia';
$countries['ET']['countrycode'] = '251';
$countries['ET']['exitcode'] = '00';
$countries['ET']['isocode'] = 'ET';
$countries['FK']['country'] = 'Falkland (Malvinas) Islands';
$countries['FK']['countrycode'] = '500';
$countries['FK']['exitcode'] = '00';
$countries['FK']['isocode'] = 'FK';
$countries['FO']['country'] = 'Faroe Islands';
$countries['FO']['countrycode'] = '298';
$countries['FO']['exitcode'] = '00';
$countries['FO']['isocode'] = 'FO';
$countries['FJ']['country'] = 'Fiji';
$countries['FJ']['countrycode'] = '679';
$countries['FJ']['exitcode'] = '00';
$countries['FJ']['isocode'] = 'FJ';
$countries['FI']['country'] = 'Finland';
$countries['FI']['countrycode'] = '358';
$countries['FI']['exitcode'] = '00, 990, 994, 999';
$countries['FI']['isocode'] = 'FI';
$countries['FR']['country'] = 'France';
$countries['FR']['countrycode'] = '33';
$countries['FR']['exitcode'] = '00';
$countries['FR']['isocode'] = 'FR';
$countries['GF']['country'] = 'French Guiana';
$countries['GF']['countrycode'] = '594';
$countries['GF']['exitcode'] = '00';
$countries['GF']['isocode'] = 'GF';
$countries['PF']['country'] = 'French Polynesia';
$countries['PF']['countrycode'] = '689';
$countries['PF']['exitcode'] = '00';
$countries['PF']['isocode'] = 'PF';
$countries['GA']['country'] = 'Gabon';
$countries['GA']['countrycode'] = '241';
$countries['GA']['exitcode'] = '00';
$countries['GA']['isocode'] = 'GA';
$countries['GM']['country'] = 'Gambia';
$countries['GM']['countrycode'] = '220';
$countries['GM']['exitcode'] = '00';
$countries['GM']['isocode'] = 'GM';
$countries['GE']['country'] = 'Georgia';
$countries['GE']['countrycode'] = '995';
$countries['GE']['exitcode'] = '00';
$countries['GE']['isocode'] = 'GE';
$countries['DE']['country'] = 'Germany';
$countries['DE']['countrycode'] = '49';
$countries['DE']['exitcode'] = '00';
$countries['DE']['isocode'] = 'DE';
$countries['GH']['country'] = 'Ghana';
$countries['GH']['countrycode'] = '233';
$countries['GH']['exitcode'] = '00';
$countries['GH']['isocode'] = 'GH';
$countries['GI']['country'] = 'Gibraltar';
$countries['GI']['countrycode'] = '350';
$countries['GI']['exitcode'] = '00';
$countries['GI']['isocode'] = 'GI';
$countries['GR']['country'] = 'Greece';
$countries['GR']['countrycode'] = '30';
$countries['GR']['exitcode'] = '00';
$countries['GR']['isocode'] = 'GR';
$countries['GL']['country'] = 'Greenland';
$countries['GL']['countrycode'] = '299';
$countries['GL']['exitcode'] = '00';
$countries['GL']['isocode'] = 'GL';
$countries['GD']['country'] = 'Grenada';
$countries['GD']['countrycode'] = '1';
$countries['GD']['exitcode'] = '011';
$countries['GD']['isocode'] = 'GD';
$countries['GP']['country'] = 'Guadeloupe';
$countries['GP']['countrycode'] = '590';
$countries['GP']['exitcode'] = '00';
$countries['GP']['isocode'] = 'GP';
$countries['GU']['country'] = 'Guam';
$countries['GU']['countrycode'] = '1';
$countries['GU']['exitcode'] = '011';
$countries['GU']['isocode'] = 'GU';
$countries['GT']['country'] = 'Guatemala';
$countries['GT']['countrycode'] = '502';
$countries['GT']['exitcode'] = '00';
$countries['GT']['isocode'] = 'GT';
$countries['GN']['country'] = 'Guinea';
$countries['GN']['countrycode'] = '224';
$countries['GN']['exitcode'] = '00';
$countries['GN']['isocode'] = 'GN';
$countries['GW']['country'] = 'Guinea-Bissau';
$countries['GW']['countrycode'] = '245';
$countries['GW']['exitcode'] = '00';
$countries['GW']['isocode'] = 'GW';
$countries['GY']['country'] = 'Guyana';
$countries['GY']['countrycode'] = '592';
$countries['GY']['exitcode'] = '001';
$countries['GY']['isocode'] = 'GY';
$countries['HT']['country'] = 'Haiti';
$countries['HT']['countrycode'] = '509';
$countries['HT']['exitcode'] = '00';
$countries['HT']['isocode'] = 'HT';
$countries['HN']['country'] = 'Honduras';
$countries['HN']['countrycode'] = '504';
$countries['HN']['exitcode'] = '00';
$countries['HN']['isocode'] = 'HN';
$countries['HK']['country'] = 'Hong Kong';
$countries['HK']['countrycode'] = '852';
$countries['HK']['exitcode'] = '001';
$countries['HK']['isocode'] = 'HK';
$countries['HU']['country'] = 'Hungary';
$countries['HU']['countrycode'] = '36';
$countries['HU']['exitcode'] = '00';
$countries['HU']['isocode'] = 'HU';
$countries['IS']['country'] = 'Iceland';
$countries['IS']['countrycode'] = '354';
$countries['IS']['exitcode'] = '00';
$countries['IS']['isocode'] = 'IS';
$countries['IN']['country'] = 'India';
$countries['IN']['countrycode'] = '91';
$countries['IN']['exitcode'] = '00';
$countries['IN']['isocode'] = 'IN';
$countries['ID']['country'] = 'Indonesia';
$countries['ID']['countrycode'] = '62';
$countries['ID']['exitcode'] = '001';
$countries['ID']['isocode'] = 'ID';
$countries['IR']['country'] = 'Iran';
$countries['IR']['countrycode'] = '98';
$countries['IR']['exitcode'] = '00';
$countries['IR']['isocode'] = 'IR';
$countries['IQ']['country'] = 'Iraq';
$countries['IQ']['countrycode'] = '964';
$countries['IQ']['exitcode'] = '00';
$countries['IQ']['isocode'] = 'IQ';
$countries['IE']['country'] = 'Ireland';
$countries['IE']['countrycode'] = '353';
$countries['IE']['exitcode'] = '00';
$countries['IE']['isocode'] = 'IE';
$countries['IL']['country'] = 'Israel';
$countries['IL']['countrycode'] = '972';
$countries['IL']['exitcode'] = '00, 012, 013, 014, 018';
$countries['IL']['isocode'] = 'IL';
$countries['IT']['country'] = 'Italy';
$countries['IT']['countrycode'] = '39';
$countries['IT']['exitcode'] = '00';
$countries['IT']['isocode'] = 'IT';
$countries['CI']['country'] = 'Ivory Coast';
$countries['CI']['countrycode'] = '225';
$countries['CI']['exitcode'] = '00';
$countries['CI']['isocode'] = 'CI';
$countries['JM']['country'] = 'Jamaica';
$countries['JM']['countrycode'] = '1';
$countries['JM']['exitcode'] = '011';
$countries['JM']['isocode'] = 'JM';
$countries['JP']['country'] = 'Japan';
$countries['JP']['countrycode'] = '81';
$countries['JP']['exitcode'] = '010';
$countries['JP']['isocode'] = 'JP';
$countries['JO']['country'] = 'Jordan';
$countries['JO']['countrycode'] = '962';
$countries['JO']['exitcode'] = '00';
$countries['JO']['isocode'] = 'JO';
$countries['KZ']['country'] = 'Kazakhstan';
$countries['KZ']['countrycode'] = '7';
$countries['KZ']['exitcode'] = '810';
$countries['KZ']['isocode'] = 'KZ';
$countries['KE']['country'] = 'Kenya';
$countries['KE']['countrycode'] = '254';
$countries['KE']['exitcode'] = '000';
$countries['KE']['isocode'] = 'KE';
$countries['KI']['country'] = 'Kiribati';
$countries['KI']['countrycode'] = '686';
$countries['KI']['exitcode'] = '00';
$countries['KI']['isocode'] = 'KI';
$countries['KW']['country'] = 'Kuwait';
$countries['KW']['countrycode'] = '965';
$countries['KW']['exitcode'] = '00';
$countries['KW']['isocode'] = 'KW';
$countries['KG']['country'] = 'Kyrgyzstan';
$countries['KG']['countrycode'] = '996';
$countries['KG']['exitcode'] = '00';
$countries['KG']['isocode'] = 'KG';
$countries['LA']['country'] = 'Laos';
$countries['LA']['countrycode'] = '856';
$countries['LA']['exitcode'] = '00';
$countries['LA']['isocode'] = 'LA';
$countries['LV']['country'] = 'Latvia';
$countries['LV']['countrycode'] = '371';
$countries['LV']['exitcode'] = '00';
$countries['LV']['isocode'] = 'LV';
$countries['LB']['country'] = 'Lebanon';
$countries['LB']['countrycode'] = '961';
$countries['LB']['exitcode'] = '00';
$countries['LB']['isocode'] = 'LB';
$countries['LS']['country'] = 'Lesotho';
$countries['LS']['countrycode'] = '266';
$countries['LS']['exitcode'] = '00';
$countries['LS']['isocode'] = 'LS';
$countries['LR']['country'] = 'Liberia';
$countries['LR']['countrycode'] = '231';
$countries['LR']['exitcode'] = '00';
$countries['LR']['isocode'] = 'LR';
$countries['LY']['country'] = 'Libya';
$countries['LY']['countrycode'] = '218';
$countries['LY']['exitcode'] = '00';
$countries['LY']['isocode'] = 'LY';
$countries['LI']['country'] = 'Liechtenstein';
$countries['LI']['countrycode'] = '423';
$countries['LI']['exitcode'] = '00';
$countries['LI']['isocode'] = 'LI';
$countries['LT']['country'] = 'Lithuania';
$countries['LT']['countrycode'] = '370';
$countries['LT']['exitcode'] = '00';
$countries['LT']['isocode'] = 'LT';
$countries['LU']['country'] = 'Luxembourg';
$countries['LU']['countrycode'] = '352';
$countries['LU']['exitcode'] = '00';
$countries['LU']['isocode'] = 'LU';
$countries['MO']['country'] = 'Macau';
$countries['MO']['countrycode'] = '853';
$countries['MO']['exitcode'] = '00';
$countries['MO']['isocode'] = 'MO';
$countries['MK']['country'] = 'Macedonia';
$countries['MK']['countrycode'] = '389';
$countries['MK']['exitcode'] = '00';
$countries['MK']['isocode'] = 'MK';
$countries['MG']['country'] = 'Madagascar';
$countries['MG']['countrycode'] = '261';
$countries['MG']['exitcode'] = '00';
$countries['MG']['isocode'] = 'MG';
$countries['MW']['country'] = 'Malawi';
$countries['MW']['countrycode'] = '265';
$countries['MW']['exitcode'] = '00';
$countries['MW']['isocode'] = 'MW';
$countries['MY']['country'] = 'Malaysia';
$countries['MY']['countrycode'] = '60';
$countries['MY']['exitcode'] = '00';
$countries['MY']['isocode'] = 'MY';
$countries['MV']['country'] = 'Maldives';
$countries['MV']['countrycode'] = '960';
$countries['MV']['exitcode'] = '00';
$countries['MV']['isocode'] = 'MV';
$countries['ML']['country'] = 'Mali';
$countries['ML']['countrycode'] = '223';
$countries['ML']['exitcode'] = '00';
$countries['ML']['isocode'] = 'ML';
$countries['MT']['country'] = 'Malta';
$countries['MT']['countrycode'] = '356';
$countries['MT']['exitcode'] = '00';
$countries['MT']['isocode'] = 'MT';
$countries['MH']['country'] = 'Marshall Islands';
$countries['MH']['countrycode'] = '692';
$countries['MH']['exitcode'] = '011';
$countries['MH']['isocode'] = 'MH';
$countries['MQ']['country'] = 'Martinique';
$countries['MQ']['countrycode'] = '596';
$countries['MQ']['exitcode'] = '00';
$countries['MQ']['isocode'] = 'MQ';
$countries['MR']['country'] = 'Mauritania';
$countries['MR']['countrycode'] = '222';
$countries['MR']['exitcode'] = '00';
$countries['MR']['isocode'] = 'MR';
$countries['MU']['country'] = 'Mauritius';
$countries['MU']['countrycode'] = '230';
$countries['MU']['exitcode'] = '00';
$countries['MU']['isocode'] = 'MU';
$countries['YT']['country'] = 'Mayotte';
$countries['YT']['countrycode'] = '262';
$countries['YT']['exitcode'] = '00';
$countries['YT']['isocode'] = 'YT';
$countries['MX']['country'] = 'Mexico';
$countries['MX']['countrycode'] = '52';
$countries['MX']['exitcode'] = '00';
$countries['MX']['isocode'] = 'MX';
$countries['FM']['country'] = 'Micronesia';
$countries['FM']['countrycode'] = '691';
$countries['FM']['exitcode'] = '011';
$countries['FM']['isocode'] = 'FM';
$countries['MD']['country'] = 'Moldova';
$countries['MD']['countrycode'] = '373';
$countries['MD']['exitcode'] = '00';
$countries['MD']['isocode'] = 'MD';
$countries['MC']['country'] = 'Monaco';
$countries['MC']['countrycode'] = '377';
$countries['MC']['exitcode'] = '00';
$countries['MC']['isocode'] = 'MC';
$countries['MN']['country'] = 'Mongolia';
$countries['MN']['countrycode'] = '976';
$countries['MN']['exitcode'] = '001';
$countries['MN']['isocode'] = 'MN';
$countries['ME']['country'] = 'Montenegro';
$countries['ME']['countrycode'] = '382';
$countries['ME']['exitcode'] = '00';
$countries['ME']['isocode'] = 'ME';
$countries['MS']['country'] = 'Montserrat';
$countries['MS']['countrycode'] = '1';
$countries['MS']['exitcode'] = '011';
$countries['MS']['isocode'] = 'MS';
$countries['MA']['country'] = 'Morocco';
$countries['MA']['countrycode'] = '212';
$countries['MA']['exitcode'] = '00';
$countries['MA']['isocode'] = 'MA';
$countries['MZ']['country'] = 'Mozambique';
$countries['MZ']['countrycode'] = '258';
$countries['MZ']['exitcode'] = '00';
$countries['MZ']['isocode'] = 'MZ';
$countries['MM']['country'] = 'Myanmar';
$countries['MM']['countrycode'] = '95';
$countries['MM']['exitcode'] = '00';
$countries['MM']['isocode'] = 'MM';
$countries['NA']['country'] = 'Namibia';
$countries['NA']['countrycode'] = '264';
$countries['NA']['exitcode'] = '00';
$countries['NA']['isocode'] = 'NA';
$countries['NR']['country'] = 'Nauru';
$countries['NR']['countrycode'] = '674';
$countries['NR']['exitcode'] = '00';
$countries['NR']['isocode'] = 'NR';
$countries['NP']['country'] = 'Nepal';
$countries['NP']['countrycode'] = '977';
$countries['NP']['exitcode'] = '00';
$countries['NP']['isocode'] = 'NP';
$countries['NL']['country'] = 'Netherlands';
$countries['NL']['countrycode'] = '31';
$countries['NL']['exitcode'] = '00';
$countries['NL']['isocode'] = 'NL';
$countries['AN']['country'] = 'Netherlands Antilles';
$countries['AN']['countrycode'] = '599';
$countries['AN']['exitcode'] = '00';
$countries['AN']['isocode'] = 'AN';
$countries['NC']['country'] = 'New Caledonia';
$countries['NC']['countrycode'] = '687';
$countries['NC']['exitcode'] = '00';
$countries['NC']['isocode'] = 'NC';
$countries['NZ']['country'] = 'New Zealand';
$countries['NZ']['countrycode'] = '64';
$countries['NZ']['exitcode'] = '00';
$countries['NZ']['isocode'] = 'NZ';
$countries['NI']['country'] = 'Nicaragua';
$countries['NI']['countrycode'] = '505';
$countries['NI']['exitcode'] = '00';
$countries['NI']['isocode'] = 'NI';
$countries['NE']['country'] = 'Niger';
$countries['NE']['countrycode'] = '227';
$countries['NE']['exitcode'] = '00';
$countries['NE']['isocode'] = 'NE';
$countries['NG']['country'] = 'Nigeria';
$countries['NG']['countrycode'] = '234';
$countries['NG']['exitcode'] = '009';
$countries['NG']['isocode'] = 'NG';
$countries['NU']['country'] = 'Niue';
$countries['NU']['countrycode'] = '683';
$countries['NU']['exitcode'] = '00';
$countries['NU']['isocode'] = 'NU';
$countries['NF']['country'] = 'Norfolk Island';
$countries['NF']['countrycode'] = '6723';
$countries['NF']['exitcode'] = '00';
$countries['NF']['isocode'] = 'NF';
$countries['KP']['country'] = 'North Korea';
$countries['KP']['countrycode'] = '850';
$countries['KP']['exitcode'] = '99';
$countries['KP']['isocode'] = 'KP';
$countries['NO']['country'] = 'Norway';
$countries['NO']['countrycode'] = '47';
$countries['NO']['exitcode'] = '00';
$countries['NO']['isocode'] = 'NO';
$countries['OM']['country'] = 'Oman';
$countries['OM']['countrycode'] = '968';
$countries['OM']['exitcode'] = '00';
$countries['OM']['isocode'] = 'OM';
$countries['PK']['country'] = 'Pakistan';
$countries['PK']['countrycode'] = '92';
$countries['PK']['exitcode'] = '00';
$countries['PK']['isocode'] = 'PK';
$countries['PW']['country'] = 'Palau';
$countries['PW']['countrycode'] = '680';
$countries['PW']['exitcode'] = '011';
$countries['PW']['isocode'] = 'PW';
$countries['PA']['country'] = 'Panama';
$countries['PA']['countrycode'] = '507';
$countries['PA']['exitcode'] = '00';
$countries['PA']['isocode'] = 'PA';
$countries['PG']['country'] = 'Papua New Guinea';
$countries['PG']['countrycode'] = '675';
$countries['PG']['exitcode'] = '00';
$countries['PG']['isocode'] = 'PG';
$countries['PY']['country'] = 'Paraguay';
$countries['PY']['countrycode'] = '595';
$countries['PY']['exitcode'] = '00';
$countries['PY']['isocode'] = 'PY';
$countries['PE']['country'] = 'Peru';
$countries['PE']['countrycode'] = '51';
$countries['PE']['exitcode'] = '00';
$countries['PE']['isocode'] = 'PE';
$countries['PH']['country'] = 'Philippines';
$countries['PH']['countrycode'] = '63';
$countries['PH']['exitcode'] = '00';
$countries['PH']['isocode'] = 'PH';
$countries['PL']['country'] = 'Poland';
$countries['PL']['countrycode'] = '48';
$countries['PL']['exitcode'] = '00';
$countries['PL']['isocode'] = 'PL';
$countries['PT']['country'] = 'Portugal';
$countries['PT']['countrycode'] = '351';
$countries['PT']['exitcode'] = '00';
$countries['PT']['isocode'] = 'PT';
$countries['PR']['country'] = 'Puerto Rico';
$countries['PR']['countrycode'] = '1';
$countries['PR']['exitcode'] = '011';
$countries['PR']['isocode'] = 'PR';
$countries['QA']['country'] = 'Qatar';
$countries['QA']['countrycode'] = '974';
$countries['QA']['exitcode'] = '00';
$countries['QA']['isocode'] = 'QA';
$countries['RE']['country'] = 'Reunion';
$countries['RE']['countrycode'] = '262';
$countries['RE']['exitcode'] = '00';
$countries['RE']['isocode'] = 'RE';
$countries['RO']['country'] = 'Romania';
$countries['RO']['countrycode'] = '40';
$countries['RO']['exitcode'] = '00';
$countries['RO']['isocode'] = 'RO';
$countries['RU']['country'] = 'Russian Federation';
$countries['RU']['countrycode'] = '7';
$countries['RU']['exitcode'] = '810';
$countries['RU']['isocode'] = 'RU';
$countries['RW']['country'] = 'Rwanda';
$countries['RW']['countrycode'] = '250';
$countries['RW']['exitcode'] = '00';
$countries['RW']['isocode'] = 'RW';
$countries['SH']['country'] = 'Saint Helena';
$countries['SH']['countrycode'] = '290';
$countries['SH']['exitcode'] = '00';
$countries['SH']['isocode'] = 'SH';
$countries['KN']['country'] = 'Saint Kitts and Nevis';
$countries['KN']['countrycode'] = '1';
$countries['KN']['exitcode'] = '011';
$countries['KN']['isocode'] = 'KN';
$countries['LC']['country'] = 'Saint Lucia';
$countries['LC']['countrycode'] = '1';
$countries['LC']['exitcode'] = '011';
$countries['LC']['isocode'] = 'LC';
$countries['GP']['country'] = 'Saint Barthelemy';
$countries['GP']['countrycode'] = '590';
$countries['GP']['exitcode'] = '00';
$countries['GP']['isocode'] = 'GP';
$countries['PM']['country'] = 'Saint Pierre and Miquelon';
$countries['PM']['countrycode'] = '508';
$countries['PM']['exitcode'] = '00';
$countries['PM']['isocode'] = 'PM';
$countries['VC']['country'] = 'Saint Vincent and the Grenadines';
$countries['VC']['countrycode'] = '1';
$countries['VC']['exitcode'] = '011';
$countries['VC']['isocode'] = 'VC';
$countries['WS']['country'] = 'Samoa';
$countries['WS']['countrycode'] = '685';
$countries['WS']['exitcode'] = '0';
$countries['WS']['isocode'] = 'WS';
$countries['SM']['country'] = 'San Marino';
$countries['SM']['countrycode'] = '378';
$countries['SM']['exitcode'] = '00';
$countries['SM']['isocode'] = 'SM';
$countries['ST']['country'] = 'Sao Tome and Principe';
$countries['ST']['countrycode'] = '239';
$countries['ST']['exitcode'] = '00';
$countries['ST']['isocode'] = 'ST';
$countries['SA']['country'] = 'Saudi Arabia';
$countries['SA']['countrycode'] = '966';
$countries['SA']['exitcode'] = '00';
$countries['SA']['isocode'] = 'SA';
$countries['SN']['country'] = 'Senegal';
$countries['SN']['countrycode'] = '221';
$countries['SN']['exitcode'] = '00';
$countries['SN']['isocode'] = 'SN';
$countries['RS']['country'] = 'Serbia';
$countries['RS']['countrycode'] = '381';
$countries['RS']['exitcode'] = '00';
$countries['RS']['isocode'] = 'RS';
$countries['SC']['country'] = 'Seychelles';
$countries['SC']['countrycode'] = '248';
$countries['SC']['exitcode'] = '00';
$countries['SC']['isocode'] = 'SC';
$countries['SL']['country'] = 'Sierra Leone';
$countries['SL']['countrycode'] = '232';
$countries['SL']['exitcode'] = '00';
$countries['SL']['isocode'] = 'SL';
$countries['SG']['country'] = 'Singapore';
$countries['SG']['countrycode'] = '65';
$countries['SG']['exitcode'] = '001, 008';
$countries['SG']['isocode'] = 'SG';
$countries['SK']['country'] = 'Slovakia';
$countries['SK']['countrycode'] = '421';
$countries['SK']['exitcode'] = '00';
$countries['SK']['isocode'] = 'SK';
$countries['SI']['country'] = 'Slovenia';
$countries['SI']['countrycode'] = '386';
$countries['SI']['exitcode'] = '00';
$countries['SI']['isocode'] = 'SI';
$countries['SB']['country'] = 'Solomon Islands';
$countries['SB']['countrycode'] = '677';
$countries['SB']['exitcode'] = '00';
$countries['SB']['isocode'] = 'SB';
$countries['SO']['country'] = 'Somalia';
$countries['SO']['countrycode'] = '252';
$countries['SO']['exitcode'] = '00';
$countries['SO']['isocode'] = 'SO';
$countries['ZA']['country'] = 'South Africa';
$countries['ZA']['countrycode'] = '27';
$countries['ZA']['exitcode'] = '00';
$countries['ZA']['isocode'] = 'ZA';
$countries['KR']['country'] = 'South Korea';
$countries['KR']['countrycode'] = '82';
$countries['KR']['exitcode'] = '001, 002';
$countries['KR']['isocode'] = 'KR';
$countries['ES']['country'] = 'Spain';
$countries['ES']['countrycode'] = '34';
$countries['ES']['exitcode'] = '00';
$countries['ES']['isocode'] = 'ES';
$countries['LK']['country'] = 'Sri Lanka';
$countries['LK']['countrycode'] = '94';
$countries['LK']['exitcode'] = '00';
$countries['LK']['isocode'] = 'LK';
$countries['SD']['country'] = 'Sudan';
$countries['SD']['countrycode'] = '249';
$countries['SD']['exitcode'] = '00';
$countries['SD']['isocode'] = 'SD';
$countries['SR']['country'] = 'Suriname';
$countries['SR']['countrycode'] = '597';
$countries['SR']['exitcode'] = '00';
$countries['SR']['isocode'] = 'SR';
$countries['SZ']['country'] = 'Swaziland';
$countries['SZ']['countrycode'] = '268';
$countries['SZ']['exitcode'] = '00';
$countries['SZ']['isocode'] = 'SZ';
$countries['SE']['country'] = 'Sweden';
$countries['SE']['countrycode'] = '46';
$countries['SE']['exitcode'] = '00';
$countries['SE']['isocode'] = 'SE';
$countries['CH']['country'] = 'Switzerland';
$countries['CH']['countrycode'] = '41';
$countries['CH']['exitcode'] = '00';
$countries['CH']['isocode'] = 'CH';
$countries['SY']['country'] = 'Syria';
$countries['SY']['countrycode'] = '963';
$countries['SY']['exitcode'] = '00';
$countries['SY']['isocode'] = 'SY';
$countries['TW']['country'] = 'Taiwan';
$countries['TW']['countrycode'] = '886';
$countries['TW']['exitcode'] = '002';
$countries['TW']['isocode'] = 'TW';
$countries['TJ']['country'] = 'Tajikistan';
$countries['TJ']['countrycode'] = '992';
$countries['TJ']['exitcode'] = '810';
$countries['TJ']['isocode'] = 'TJ';
$countries['TZ']['country'] = 'Tanzania';
$countries['TZ']['countrycode'] = '255';
$countries['TZ']['exitcode'] = '000';
$countries['TZ']['isocode'] = 'TZ';
$countries['TH']['country'] = 'Thailand';
$countries['TH']['countrycode'] = '66';
$countries['TH']['exitcode'] = '001';
$countries['TH']['isocode'] = 'TH';
$countries['TG']['country'] = 'Togo';
$countries['TG']['countrycode'] = '228';
$countries['TG']['exitcode'] = '00';
$countries['TG']['isocode'] = 'TG';
$countries['TK']['country'] = 'Tokelau';
$countries['TK']['countrycode'] = '690';
$countries['TK']['exitcode'] = '00';
$countries['TK']['isocode'] = 'TK';
$countries['TO']['country'] = 'Tonga';
$countries['TO']['countrycode'] = '676';
$countries['TO']['exitcode'] = '00';
$countries['TO']['isocode'] = 'TO';
$countries['TT']['country'] = 'Trinidad and Tobago';
$countries['TT']['countrycode'] = '1';
$countries['TT']['exitcode'] = '011';
$countries['TT']['isocode'] = 'TT';
$countries['TN']['country'] = 'Tunisia';
$countries['TN']['countrycode'] = '216';
$countries['TN']['exitcode'] = '00';
$countries['TN']['isocode'] = 'TN';
$countries['TR']['country'] = 'Turkey';
$countries['TR']['countrycode'] = '90';
$countries['TR']['exitcode'] = '00';
$countries['TR']['isocode'] = 'TR';
$countries['TM']['country'] = 'Turkmenistan';
$countries['TM']['countrycode'] = '993';
$countries['TM']['exitcode'] = '810';
$countries['TM']['isocode'] = 'TM';
$countries['TC']['country'] = 'Turks and Caicos Islands';
$countries['TC']['countrycode'] = '1';
$countries['TC']['exitcode'] = '0';
$countries['TC']['isocode'] = 'TC';
$countries['TV']['country'] = 'Tuvalu';
$countries['TV']['countrycode'] = '688';
$countries['TV']['exitcode'] = '00';
$countries['TV']['isocode'] = 'TV';
$countries['UG']['country'] = 'Uganda';
$countries['UG']['countrycode'] = '256';
$countries['UG']['exitcode'] = '000';
$countries['UG']['isocode'] = 'UG';
$countries['UA']['country'] = 'Ukraine';
$countries['UA']['countrycode'] = '380';
$countries['UA']['exitcode'] = '00';
$countries['UA']['isocode'] = 'UA';
$countries['AE']['country'] = 'United Arab Emirates';
$countries['AE']['countrycode'] = '971';
$countries['AE']['exitcode'] = '00';
$countries['AE']['isocode'] = 'AE';
$countries['GB']['country'] = 'United Kingdom';
$countries['GB']['countrycode'] = '44';
$countries['GB']['exitcode'] = '00';
$countries['GB']['isocode'] = 'GB';
$countries['US']['country'] = 'United States';
$countries['US']['countrycode'] = '1';
$countries['US']['exitcode'] = '011';
$countries['US']['isocode'] = 'US';
$countries['VI']['country'] = 'U.S. Virgin Islands';
$countries['VI']['countrycode'] = '1';
$countries['VI']['exitcode'] = '011';
$countries['VI']['isocode'] = 'VI';
$countries['UY']['country'] = 'Uruguay';
$countries['UY']['countrycode'] = '598';
$countries['UY']['exitcode'] = '00';
$countries['UY']['isocode'] = 'UY';
$countries['UZ']['country'] = 'Uzbekistan';
$countries['UZ']['countrycode'] = '998';
$countries['UZ']['exitcode'] = '8 - wait for dial tone - 10';
$countries['UZ']['isocode'] = 'UZ';
$countries['VU']['country'] = 'Vanuatu';
$countries['VU']['countrycode'] = '678';
$countries['VU']['exitcode'] = '00';
$countries['VU']['isocode'] = 'VU';
$countries['VA']['country'] = 'Vatican City';
$countries['VA']['countrycode'] = '379, 39';
$countries['VA']['exitcode'] = '00';
$countries['VA']['isocode'] = 'VA';
$countries['VE']['country'] = 'Venezuela';
$countries['VE']['countrycode'] = '58';
$countries['VE']['exitcode'] = '00';
$countries['VE']['isocode'] = 'VE';
$countries['VN']['country'] = 'Vietnam';
$countries['VN']['countrycode'] = '84';
$countries['VN']['exitcode'] = '00';
$countries['VN']['isocode'] = 'VN';
$countries['WF']['country'] = 'Wallis and Futuna';
$countries['WF']['countrycode'] = '681';
$countries['WF']['exitcode'] = '00';
$countries['WF']['isocode'] = 'WF';
$countries['YE']['country'] = 'Yemen';
$countries['YE']['countrycode'] = '967';
$countries['YE']['exitcode'] = '00';
$countries['YE']['isocode'] = 'YE';
$countries['ZM']['country'] = 'Zambia';
$countries['ZM']['countrycode'] = '260';
$countries['ZM']['exitcode'] = '00';
$countries['ZM']['isocode'] = 'ZM';
$countries['ZW']['country'] = 'Zimbabwe';
$countries['ZW']['countrycode'] = '263';
$countries['ZW']['exitcode'] = '00';
$countries['ZW']['isocode'] = 'ZW';
?>

View File

@ -600,6 +600,19 @@
}
//echo realpath(sys_get_temp_dir());
if ( !function_exists('normalize_path')) {
//don't use DIRECTORY_SEPARATOR as it will change on a per platform basis and we need consistency
function normalize_path($path) {
return str_replace(array('/','\\'), '/', $path);
}
}
if ( !function_exists('normalize_path_to_os')) {
function normalize_path_to_os($path) {
return str_replace(array('/','\\'), DIRECTORY_SEPARATOR, $path);
}
}
if (!function_exists('username_exists')) {
function username_exists($username) {
global $db, $domain_uuid;

File diff suppressed because it is too large Load Diff

View File

@ -148,6 +148,7 @@
default_language = session:getVariable("default_language");
default_dialect = session:getVariable("default_dialect");
--recording = session:getVariable("recording");
domain_name = session:getVariable("domain_name");
--set the end epoch
end_epoch = os.time();
@ -339,6 +340,9 @@
--freeswitch.consoleLog("notice", "[conference center] destination_number: " .. destination_number .. "\n");
--freeswitch.consoleLog("notice", "[conference center] caller_id_number: " .. caller_id_number .. "\n");
--add the domain name to the recordings directory
recordings_dir = recordings_dir .. "/"..domain_name;
--set the sounds path for the language, dialect and voice
default_language = session:getVariable("default_language");
default_dialect = session:getVariable("default_dialect");
@ -411,10 +415,6 @@
--add the domain to the recording directory
freeswitch.consoleLog("notice", "[conference center] domain_count: " .. domain_count .. "\n");
if (domain_count > 1) then
recordings_dir = recordings_dir.."/"..domain_name;
freeswitch.consoleLog("notice", "[conference center] recordings_dir: " .. recordings_dir .. "\n");
end
--sounds
enter_sound = "tone_stream://v=-20;%(100,1000,100);v=-20;%(90,60,440);%(90,60,620)";
@ -707,7 +707,7 @@
--there is one other member in this conference
session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/conference/conf-one_other_member_conference.wav");
elseif (member_count == "0") then
session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/conference/conf-alone.wav");
--conference profile defines the alone sound file
else
--say the count
session:execute("say", default_language.." number pronounced "..member_count);

View File

@ -36,10 +36,8 @@
--get the current time
start_epoch = os.time();
--set the recording variable
if (domain_count > 1) then
recordings_dir = recordings_dir.."/"..domain_name;
end
--add the domain name to the recordings directory
recordings_dir = recordings_dir .. "/"..domain_name;
recordings_dir = recordings_dir.."/archive/"..os.date("%Y", start_epoch).."/"..os.date("%b", start_epoch).."/"..os.date("%d", start_epoch);
mkdir(recordings_dir);
recording = recordings_dir.."/"..conference_session_uuid;

View File

@ -36,7 +36,6 @@
destination_number = session:getVariable("destination_number");
call_direction = session:getVariable("call_direction");
domain_name = session:getVariable("domain_name");
recordings_dir = session:getVariable("recordings_dir");
--determine the call direction
if (call_direction == nil) then

View File

@ -67,6 +67,16 @@
--cisco
if (vendor == "cisco") then
if (command == "reboot") then
event:addHeader('event-string', 'check-sync');
end
if (command == "check_sync") then
event:addHeader('event-string', 'check-sync');
end
end
--cisco-spa
if (vendor == "cisco-spa") then
if (command == "reboot") then
event:addHeader('event-string', 'reboot=true');
end
@ -85,6 +95,16 @@
end
end
--linksys
if (vendor == "linksys") then
if (command == "reboot") then
event:addHeader('event-string', 'reboot=true');
end
if (command == "check_sync") then
event:addHeader('event-string', 'reboot=true');
end
end
--polycom
if (vendor == "polycom") then
if (command == "reboot") then

View File

@ -41,6 +41,16 @@
--array count
require "resources.functions.count";
local IS_WINDOWS = (package.config:sub(1,1) == '\\')
local function quote(s)
local q = IS_WINDOWS and '"' or "'"
if s:find('%s') or s:find(q, nil, true) then
s = q .. s:gsub(q, q..q) .. q
end
return s
end
-- set channel variables to lua variables
domain_uuid = env:getHeader("domain_uuid");
domain_name = env:getHeader("domain_name");
@ -181,23 +191,17 @@
end
--fax to email
cmd = "'"..php_dir.."/"..php_bin.."' '"..document_root.."/secure/fax_to_email.php' ";
cmd = cmd .. "email='"..fax_email.."' ";
cmd = cmd .. "extension="..fax_extension.." ";
cmd = cmd .. "name='"..fax_file.."' ";
cmd = cmd .. "messages='result:"..fax_result_text.." sender:"..fax_remote_station_id.." pages:"..fax_document_total_pages.."' ";
cmd = cmd .. "domain="..domain_name.." ";
cmd = cmd .. "caller_id_name='";
if (caller_id_name ~= nil) then
cmd = cmd .. caller_id_name;
end
cmd = cmd .. "' ";
cmd = cmd .. "caller_id_number=";
if (caller_id_number ~= nil) then
cmd = cmd .. caller_id_number;
end
cmd = cmd .. " ";
if (string.len(fax_forward_number) > 0) then
-- cmd = "lua" .. " " .. quote(scripts_dir .. "/fax_to_email.lua") .. " ";
cmd = quote(php_dir.."/"..php_bin).." "..quote(document_root.."/secure/fax_to_email.php").." ";
cmd = cmd .. "email="..quote(fax_email).." ";
cmd = cmd .. "extension="..quote(fax_extension).." ";
cmd = cmd .. "name="..quote(fax_file).." ";
cmd = cmd .. "messages=" .. quote("result:"..fax_result_text.." sender:"..fax_remote_station_id.." pages:"..fax_document_total_pages).." ";
cmd = cmd .. "domain="..quote(domain_name).." ";
cmd = cmd .. "caller_id_name=" .. quote(caller_id_name or '') .. " ";
cmd = cmd .. "caller_id_number=" .. quote(caller_id_number or '') .. " ";
if #fax_forward_number > 0 then
cmd = cmd .. "fax_relay=true ";
end
freeswitch.consoleLog("notice", "[fax] command: " .. cmd .. "\n");

Some files were not shown because too many files have changed in this diff Show More