update of SPanish and Italian agent builds
git-svn-id: svn://192.168.202.10@1630 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -52,17 +52,22 @@
|
|||||||
# 100109-1337 - Fixed Manual dial live call detection
|
# 100109-1337 - Fixed Manual dial live call detection
|
||||||
# 100527-0957 - Added send_dtmf, transfer_conference and park_call API functions
|
# 100527-0957 - Added send_dtmf, transfer_conference and park_call API functions
|
||||||
# 100727-2209 - Added timer actions for hangup, extension, callmenu and ingroup as well as destination
|
# 100727-2209 - Added timer actions for hangup, extension, callmenu and ingroup as well as destination
|
||||||
|
# 101123-1105 - Added api manual dial queue feature to external_dial function
|
||||||
|
# 101208-0308 - Moved the Calls in Queue count and other counts outside of the autodial section (issue 406)
|
||||||
#
|
#
|
||||||
|
|
||||||
$version = '2.4-27';
|
$version = '2.4-29';
|
||||||
$build = '100727-2209';
|
$build = '101208-0308';
|
||||||
$mel=1; # Mysql Error Log enabled = 1
|
$mel=1; # Mysql Error Log enabled = 1
|
||||||
$mysql_log_count=32;
|
$mysql_log_count=36;
|
||||||
$one_mysql_log=0;
|
$one_mysql_log=0;
|
||||||
|
$DB=0;
|
||||||
|
|
||||||
require("dbconnect.php");
|
require("dbconnect.php");
|
||||||
|
|
||||||
### If you have globals turned off uncomment these lines
|
### If you have globals turned off uncomment these lines
|
||||||
|
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
|
||||||
|
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
|
||||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||||
@@ -215,7 +220,7 @@ echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
|
|||||||
|
|
||||||
if ($Acount > 0)
|
if ($Acount > 0)
|
||||||
{
|
{
|
||||||
$stmt="SELECT status,callerid,agent_log_id,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
$stmt="SELECT status,callerid,agent_log_id,campaign_id,lead_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||||
if ($DB) {echo "|$stmt|\n";}
|
if ($DB) {echo "|$stmt|\n";}
|
||||||
$rslt=mysql_query($stmt, $link);
|
$rslt=mysql_query($stmt, $link);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
@@ -224,6 +229,17 @@ echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
|
|||||||
$Acallerid = $row[1];
|
$Acallerid = $row[1];
|
||||||
$Aagent_log_id = $row[2];
|
$Aagent_log_id = $row[2];
|
||||||
$Acampaign_id = $row[3];
|
$Acampaign_id = $row[3];
|
||||||
|
$Alead_id = $row[4];
|
||||||
|
|
||||||
|
$api_manual_dial='STANDARD';
|
||||||
|
$stmt = "SELECT api_manual_dial FROM vicidial_campaigns where campaign_id='$Acampaign_id';";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
$vcc_conf_ct = mysql_num_rows($rslt);
|
||||||
|
if ($vcc_conf_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$api_manual_dial = $row[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
# ### find out if external table shows agent should be disabled
|
# ### find out if external table shows agent should be disabled
|
||||||
# $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';";
|
# $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';";
|
||||||
@@ -232,6 +248,53 @@ echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
|
|||||||
# $row=mysql_fetch_row($rslt);
|
# $row=mysql_fetch_row($rslt);
|
||||||
# $AexternalDEAD=$row[0];
|
# $AexternalDEAD=$row[0];
|
||||||
|
|
||||||
|
##### BEGIN check en calls in queue, number of active calls in the campaign
|
||||||
|
if ($campagentstdisp == 'YES')
|
||||||
|
{
|
||||||
|
$ADsql='';
|
||||||
|
### grab the status of this agent to display
|
||||||
|
$stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||||
|
if ($DB) {echo "|$stmt|\n";}
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$Alogin=$row[0];
|
||||||
|
$Acampaign=$row[1];
|
||||||
|
$AccampSQL=$row[2];
|
||||||
|
$AccampSQL = ereg_replace(' -','', $AccampSQL);
|
||||||
|
$AccampSQL = ereg_replace(' ',"','", $AccampSQL);
|
||||||
|
if (eregi('AGENTDIRECT', $AccampSQL))
|
||||||
|
{
|
||||||
|
$AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL);
|
||||||
|
$ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )";
|
||||||
|
}
|
||||||
|
|
||||||
|
### grab the number of calls being placed from this server and campaign
|
||||||
|
$stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);";
|
||||||
|
if ($DB) {echo "|$stmt|\n";}
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$RingCalls=$row[0];
|
||||||
|
if ($RingCalls > 0) {$RingCalls = "<font class=\"queue_text_red\">Pide, en la cola: $RingCalls</font>";}
|
||||||
|
else {$RingCalls = "<font class=\"queue_text\">Pide, en la cola: $RingCalls</font>";}
|
||||||
|
|
||||||
|
### grab the number of calls being placed from this server and campaign
|
||||||
|
$stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );";
|
||||||
|
if ($DB) {echo "|$stmt|\n";}
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$DiaLCalls=$row[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$Alogin='N';
|
||||||
|
$RingCalls='N';
|
||||||
|
$DiaLCalls='N';
|
||||||
|
}
|
||||||
|
##### END check en calls in queue, number of active calls in the campaign
|
||||||
|
|
||||||
if ($auto_dial_level > 0)
|
if ($auto_dial_level > 0)
|
||||||
{
|
{
|
||||||
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
||||||
@@ -285,59 +348,9 @@ echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
##### END DEAD logging section #####
|
##### END DEAD logging section #####
|
||||||
|
|
||||||
if ($campagentstdisp == 'YES')
|
|
||||||
{
|
|
||||||
$ADsql='';
|
|
||||||
### grab the status of this agent to display
|
|
||||||
$stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
|
||||||
if ($DB) {echo "|$stmt|\n";}
|
|
||||||
$rslt=mysql_query($stmt, $link);
|
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);}
|
|
||||||
$row=mysql_fetch_row($rslt);
|
|
||||||
$Alogin=$row[0];
|
|
||||||
$Acampaign=$row[1];
|
|
||||||
$AccampSQL=$row[2];
|
|
||||||
$AccampSQL = ereg_replace(' -','', $AccampSQL);
|
|
||||||
$AccampSQL = ereg_replace(' ',"','", $AccampSQL);
|
|
||||||
if (eregi('AGENTDIRECT', $AccampSQL))
|
|
||||||
{
|
|
||||||
$AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL);
|
|
||||||
$ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )";
|
|
||||||
}
|
|
||||||
|
|
||||||
### grab the number of calls being placed from this server and campaign
|
|
||||||
$stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);";
|
|
||||||
if ($DB) {echo "|$stmt|\n";}
|
|
||||||
$rslt=mysql_query($stmt, $link);
|
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);}
|
|
||||||
$row=mysql_fetch_row($rslt);
|
|
||||||
$RingCalls=$row[0];
|
|
||||||
if ($RingCalls > 0) {$RingCalls = "<font class=\"queue_text_red\">Pide, en la cola: $RingCalls</font>";}
|
|
||||||
else {$RingCalls = "<font class=\"queue_text\">Pide, en la cola: $RingCalls</font>";}
|
|
||||||
|
|
||||||
### grab the number of calls being placed from this server and campaign
|
|
||||||
$stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );";
|
|
||||||
if ($DB) {echo "|$stmt|\n";}
|
|
||||||
$rslt=mysql_query($stmt, $link);
|
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);}
|
|
||||||
$row=mysql_fetch_row($rslt);
|
|
||||||
$DiaLCalls=$row[0];
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$Alogin='N';
|
|
||||||
$RingCalls='N';
|
|
||||||
$DiaLCalls='N';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$Alogin='N';
|
|
||||||
$RingCalls='N';
|
|
||||||
$DiaLCalls='N';
|
|
||||||
|
|
||||||
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
||||||
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
|
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
|
||||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||||
@@ -410,6 +423,52 @@ echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
|
|||||||
$external_park = $row[11];
|
$external_park = $row[11];
|
||||||
$timer_action_destination = $row[12];
|
$timer_action_destination = $row[12];
|
||||||
|
|
||||||
|
$MDQ_count=0;
|
||||||
|
if ( ($api_manual_dial=='QUEUE') or ($api_manual_dial=='QUEUE_AND_AUTOCALL') )
|
||||||
|
{
|
||||||
|
$stmt="SELECT count(*) FROM vicidial_manual_dial_queue where user='$user' and status='READY';";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03033',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$mdq_count_record_ct = mysql_num_rows($rslt);
|
||||||
|
if ($mdq_count_record_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$MDQ_count = $row[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ($MDQ_count > 0) and (strlen($external_dial) < 16) and ($Astatus=='PAUSED') and ($Alead_id < 1) )
|
||||||
|
{
|
||||||
|
$stmt="SELECT mdq_id,external_dial FROM vicidial_manual_dial_queue where user='$user' and status='READY' order by entry_time limit 1;";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03034',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$mdq_record_ct = mysql_num_rows($rslt);
|
||||||
|
if ($mdq_record_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$MDQ_mdq_id = $row[0];
|
||||||
|
$MDQ_external_dial = $row[1];
|
||||||
|
$external_dial = $MDQ_external_dial;
|
||||||
|
|
||||||
|
$stmt="UPDATE vicidial_manual_dial_queue SET status='QUEUE' where mdq_id='$MDQ_mdq_id';";
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03035',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$UMDQaffected_rows_update = mysql_affected_rows($link);
|
||||||
|
|
||||||
|
if ($UMDQaffected_rows_update > 0)
|
||||||
|
{
|
||||||
|
$stmt="UPDATE vicidial_live_agents SET external_dial='$MDQ_external_dial' where user='$user' and server_ip='$server_ip';";
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03036',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$VLAMDQaffected_rows_update = mysql_affected_rows($link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (strlen($external_status)<1) {$external_status = '::::::::::';}
|
if (strlen($external_status)<1) {$external_status = '::::::::::';}
|
||||||
|
|
||||||
$web_epoch = date("U");
|
$web_epoch = date("U");
|
||||||
@@ -578,7 +637,7 @@ echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
|
|||||||
if ($Ashift_logout > 0)
|
if ($Ashift_logout > 0)
|
||||||
{$Alogin='SHIFT_LOGOUT';}
|
{$Alogin='SHIFT_LOGOUT';}
|
||||||
|
|
||||||
echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Estado: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . '|APIFields: ' . $external_update_fields . '|APIFieldsData: ' . $external_update_fields_data . '|APITimerAction: ' . $timer_action . '|APITimerMessage: ' . $timer_action_message . '|APITimerSeconds: ' . $timer_action_seconds . '|APIdtmf: ' . $external_dtmf . '|APItransferconf: ' . $external_transferconf . '|APIpark: ' . $external_park . '|APITimerDestination: ' . $timer_action_destination . "\n";
|
echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Estado: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . '|APIFields: ' . $external_update_fields . '|APIFieldsData: ' . $external_update_fields_data . '|APITimerAction: ' . $timer_action . '|APITimerMessage: ' . $timer_action_message . '|APITimerSeconds: ' . $timer_action_seconds . '|APIdtmf: ' . $external_dtmf . '|APItransferconf: ' . $external_transferconf . '|APIpark: ' . $external_park . '|APITimerDestination: ' . $timer_action_destination . '|APIManualDialQueue: ' . $MDQ_count . "\n";
|
||||||
|
|
||||||
if (strlen($timer_action) > 3)
|
if (strlen($timer_action) > 3)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/* /!\ DO NOT EDIT THIS FILE !!! Please edit custom.css to keep your customizations after an upgrade /!\ */
|
||||||
|
|
||||||
|
body { padding:0; margin:0; background: #FFF; }
|
||||||
|
|
||||||
|
div.scroll_list { height: 400px; width: 140px; overflow: scroll; }
|
||||||
|
div.text_input { overflow: auto; font-size: 10px; font-family: sans-serif; }
|
||||||
|
.body_text { font-size: 13px; font-family: sans-serif; }
|
||||||
|
.queue_text_red { font-size: 12px; font-family: sans-serif; font-weight: bold; color: red; }
|
||||||
|
.queue_text { font-size: 12px; font-family: sans-serif; color: black; text-decoration:none; }
|
||||||
|
.preview_text { font-size: 13px; font-family: sans-serif; background: #CCFFCC; }
|
||||||
|
.preview_text_red { font-size: 13px; font-family: sans-serif; background: #FFCCCC; }
|
||||||
|
.body_small { font-size: 11px; font-family: sans-serif; }
|
||||||
|
.body_small_bold { font-size: 11px; font-family: sans-serif; font-weight: bold; }
|
||||||
|
.body_tiny { font-size: 10px; font-family: sans-serif; }
|
||||||
|
.log_text { font-size: 11px; font-family: monospace; }
|
||||||
|
.log_text_red { font-size: 11px; font-family: monospace; font-weight: bold; background: #FF3333; }
|
||||||
|
.log_title { font-size: 12px; font-family: monospace; font-weight: bold; }
|
||||||
|
.sd_text { font-size: 16px; font-family: sans-serif; font-weight: bold; }
|
||||||
|
.sh_text { font-size: 14px; font-family: sans-serif; font-weight: bold; }
|
||||||
|
.sb_text { font-size: 12px; font-family: sans-serif; }
|
||||||
|
.sk_text { font-size: 11px; font-family: sans-serif; }
|
||||||
|
.skb_text { font-size: 13px; font-family: sans-serif; font-weight: bold; }
|
||||||
|
.ON_conf { font-size: 11px; font-family: monospace; color: black; background: #FFFF99; }
|
||||||
|
.OFF_conf { font-size: 11px; font-family: monospace; color: black; background: #FFCC77; }
|
||||||
|
.cust_form { font-family: sans-serif; font-size: 10px; overflow: hidden; }
|
||||||
|
.cust_form_text { font-family: sans-serif; font-size: 10px; overflow: auto; }
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
#
|
#
|
||||||
# CHANGES:
|
# CHANGES:
|
||||||
# 100629-1201 - First Build
|
# 100629-1201 - First Build
|
||||||
|
# 101124-0625 - Added lookup_gmt and dialable_gmt functions
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
@@ -496,6 +497,902 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### LOOKUP GMT, FINDS THE CURRENT GMT OFFSET FOR A PHONE NUMBER #####
|
||||||
|
|
||||||
|
function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code)
|
||||||
|
{
|
||||||
|
require("dbconnect.php");
|
||||||
|
|
||||||
|
$postalgmt_found=0;
|
||||||
|
if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) )
|
||||||
|
{
|
||||||
|
if (preg_match('/^1$/', $phone_code))
|
||||||
|
{
|
||||||
|
$stmt="select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
$pc_recs = mysql_num_rows($rslt);
|
||||||
|
if ($pc_recs > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset);
|
||||||
|
$dst = $row[3];
|
||||||
|
$dst_range = $row[4];
|
||||||
|
$PC_processed++;
|
||||||
|
$postalgmt_found++;
|
||||||
|
$post++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($postalgmt_found < 1)
|
||||||
|
{
|
||||||
|
$PC_processed=0;
|
||||||
|
### UNITED STATES ###
|
||||||
|
if ($phone_code =='1')
|
||||||
|
{
|
||||||
|
$stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
$pc_recs = mysql_num_rows($rslt);
|
||||||
|
if ($pc_recs > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset);
|
||||||
|
$dst = $row[5];
|
||||||
|
$dst_range = $row[6];
|
||||||
|
$PC_processed++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
### MEXICO ###
|
||||||
|
if ($phone_code =='52')
|
||||||
|
{
|
||||||
|
$stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
$pc_recs = mysql_num_rows($rslt);
|
||||||
|
if ($pc_recs > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset);
|
||||||
|
$dst = $row[5];
|
||||||
|
$dst_range = $row[6];
|
||||||
|
$PC_processed++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
### AUSTRALIA ###
|
||||||
|
if ($phone_code =='61')
|
||||||
|
{
|
||||||
|
$stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
$pc_recs = mysql_num_rows($rslt);
|
||||||
|
if ($pc_recs > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset);
|
||||||
|
$dst = $row[5];
|
||||||
|
$dst_range = $row[6];
|
||||||
|
$PC_processed++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
### ALL OTHER COUNTRY CODES ###
|
||||||
|
if (!$PC_processed)
|
||||||
|
{
|
||||||
|
$PC_processed++;
|
||||||
|
$stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
$pc_recs = mysql_num_rows($rslt);
|
||||||
|
if ($pc_recs > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset);
|
||||||
|
$dst = $row[5];
|
||||||
|
$dst_range = $row[6];
|
||||||
|
$PC_processed++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
### Find out if DST to raise the gmt offset ###
|
||||||
|
$AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD);
|
||||||
|
$AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear);
|
||||||
|
$hour = date("H",$AC_localtime);
|
||||||
|
$min = date("i",$AC_localtime);
|
||||||
|
$sec = date("s",$AC_localtime);
|
||||||
|
$mon = date("m",$AC_localtime);
|
||||||
|
$mday = date("d",$AC_localtime);
|
||||||
|
$wday = date("w",$AC_localtime);
|
||||||
|
$year = date("Y",$AC_localtime);
|
||||||
|
$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec );
|
||||||
|
|
||||||
|
$AC_processed=0;
|
||||||
|
if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') )
|
||||||
|
{
|
||||||
|
if ($DBX) {print " Second Sunday March to First Sunday November\n";}
|
||||||
|
#**********************************************************************
|
||||||
|
# SSM-FSN
|
||||||
|
# This is returns 1 if Daylight Savings Time is in effect and 0 if
|
||||||
|
# Standard time is in effect.
|
||||||
|
# Based on Second Sunday March to First Sunday November at 2 am.
|
||||||
|
# INPUTS:
|
||||||
|
# mm INTEGER Month.
|
||||||
|
# dd INTEGER Day of the month.
|
||||||
|
# ns INTEGER Seconds into the day.
|
||||||
|
# dow INTEGER Day of week (0=Sunday, to 6=Saturday)
|
||||||
|
# OPTIONAL INPUT:
|
||||||
|
# timezone INTEGER hour difference UTC - local standard time
|
||||||
|
# (DEFAULT is blank)
|
||||||
|
# make calculations based on UTC time,
|
||||||
|
# which means shift at 10:00 UTC in April
|
||||||
|
# and 9:00 UTC in October
|
||||||
|
# OUTPUT:
|
||||||
|
# INTEGER 1 = DST, 0 = not DST
|
||||||
|
#
|
||||||
|
# S M T W T F S
|
||||||
|
# 1 2 3 4 5 6 7
|
||||||
|
# 8 9 10 11 12 13 14
|
||||||
|
#15 16 17 18 19 20 21
|
||||||
|
#22 23 24 25 26 27 28
|
||||||
|
#29 30 31
|
||||||
|
#
|
||||||
|
# S M T W T F S
|
||||||
|
# 1 2 3 4 5 6
|
||||||
|
# 7 8 9 10 11 12 13
|
||||||
|
#14 15 16 17 18 19 20
|
||||||
|
#21 22 23 24 25 26 27
|
||||||
|
#28 29 30 31
|
||||||
|
#
|
||||||
|
#**********************************************************************
|
||||||
|
|
||||||
|
$USACAN_DST=0;
|
||||||
|
$mm = $mon;
|
||||||
|
$dd = $mday;
|
||||||
|
$ns = $dsec;
|
||||||
|
$dow= $wday;
|
||||||
|
|
||||||
|
if ($mm < 3 || $mm > 11) {
|
||||||
|
$USACAN_DST=0;
|
||||||
|
} elseif ($mm >= 4 and $mm <= 10) {
|
||||||
|
$USACAN_DST=1;
|
||||||
|
} elseif ($mm == 3) {
|
||||||
|
if ($dd > 13) {
|
||||||
|
$USACAN_DST=1;
|
||||||
|
} elseif ($dd >= ($dow+8)) {
|
||||||
|
if ($timezone) {
|
||||||
|
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
|
||||||
|
$USACAN_DST=0;
|
||||||
|
} else {
|
||||||
|
$USACAN_DST=1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($dow == 0 and $ns < 7200) {
|
||||||
|
$USACAN_DST=0;
|
||||||
|
} else {
|
||||||
|
$USACAN_DST=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$USACAN_DST=0;
|
||||||
|
}
|
||||||
|
} elseif ($mm == 11) {
|
||||||
|
if ($dd > 7) {
|
||||||
|
$USACAN_DST=0;
|
||||||
|
} elseif ($dd < ($dow+1)) {
|
||||||
|
$USACAN_DST=1;
|
||||||
|
} elseif ($dow == 0) {
|
||||||
|
if ($timezone) { # UTC calculations
|
||||||
|
if ($ns < (7200+($timezone-1)*3600)) {
|
||||||
|
$USACAN_DST=1;
|
||||||
|
} else {
|
||||||
|
$USACAN_DST=0;
|
||||||
|
}
|
||||||
|
} else { # local time calculations
|
||||||
|
if ($ns < 7200) {
|
||||||
|
$USACAN_DST=1;
|
||||||
|
} else {
|
||||||
|
$USACAN_DST=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$USACAN_DST=0;
|
||||||
|
}
|
||||||
|
} # end of month checks
|
||||||
|
if ($DBX) {print " DST: $USACAN_DST\n";}
|
||||||
|
if ($USACAN_DST) {$gmt_offset++;}
|
||||||
|
$AC_processed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') )
|
||||||
|
{
|
||||||
|
if ($DBX) {print " First Sunday April to Last Sunday October\n";}
|
||||||
|
#**********************************************************************
|
||||||
|
# FSA-LSO
|
||||||
|
# This is returns 1 if Daylight Savings Time is in effect and 0 if
|
||||||
|
# Standard time is in effect.
|
||||||
|
# Based on first Sunday in April and last Sunday in October at 2 am.
|
||||||
|
#**********************************************************************
|
||||||
|
|
||||||
|
$USA_DST=0;
|
||||||
|
$mm = $mon;
|
||||||
|
$dd = $mday;
|
||||||
|
$ns = $dsec;
|
||||||
|
$dow= $wday;
|
||||||
|
|
||||||
|
if ($mm < 4 || $mm > 10) {
|
||||||
|
$USA_DST=0;
|
||||||
|
} elseif ($mm >= 5 and $mm <= 9) {
|
||||||
|
$USA_DST=1;
|
||||||
|
} elseif ($mm == 4) {
|
||||||
|
if ($dd > 7) {
|
||||||
|
$USA_DST=1;
|
||||||
|
} elseif ($dd >= ($dow+1)) {
|
||||||
|
if ($timezone) {
|
||||||
|
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
|
||||||
|
$USA_DST=0;
|
||||||
|
} else {
|
||||||
|
$USA_DST=1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($dow == 0 and $ns < 7200) {
|
||||||
|
$USA_DST=0;
|
||||||
|
} else {
|
||||||
|
$USA_DST=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$USA_DST=0;
|
||||||
|
}
|
||||||
|
} elseif ($mm == 10) {
|
||||||
|
if ($dd < 25) {
|
||||||
|
$USA_DST=1;
|
||||||
|
} elseif ($dd < ($dow+25)) {
|
||||||
|
$USA_DST=1;
|
||||||
|
} elseif ($dow == 0) {
|
||||||
|
if ($timezone) { # UTC calculations
|
||||||
|
if ($ns < (7200+($timezone-1)*3600)) {
|
||||||
|
$USA_DST=1;
|
||||||
|
} else {
|
||||||
|
$USA_DST=0;
|
||||||
|
}
|
||||||
|
} else { # local time calculations
|
||||||
|
if ($ns < 7200) {
|
||||||
|
$USA_DST=1;
|
||||||
|
} else {
|
||||||
|
$USA_DST=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$USA_DST=0;
|
||||||
|
}
|
||||||
|
} # end of month checks
|
||||||
|
|
||||||
|
if ($DBX) {print " DST: $USA_DST\n";}
|
||||||
|
if ($USA_DST) {$gmt_offset++;}
|
||||||
|
$AC_processed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') )
|
||||||
|
{
|
||||||
|
if ($DBX) {print " Last Sunday March to Last Sunday October\n";}
|
||||||
|
#**********************************************************************
|
||||||
|
# This is s 1 if Daylight Savings Time is in effect and 0 if
|
||||||
|
# Standard time is in effect.
|
||||||
|
# Based on last Sunday in March and last Sunday in October at 1 am.
|
||||||
|
#**********************************************************************
|
||||||
|
|
||||||
|
$GBR_DST=0;
|
||||||
|
$mm = $mon;
|
||||||
|
$dd = $mday;
|
||||||
|
$ns = $dsec;
|
||||||
|
$dow= $wday;
|
||||||
|
|
||||||
|
if ($mm < 3 || $mm > 10) {
|
||||||
|
$GBR_DST=0;
|
||||||
|
} elseif ($mm >= 4 and $mm <= 9) {
|
||||||
|
$GBR_DST=1;
|
||||||
|
} elseif ($mm == 3) {
|
||||||
|
if ($dd < 25) {
|
||||||
|
$GBR_DST=0;
|
||||||
|
} elseif ($dd < ($dow+25)) {
|
||||||
|
$GBR_DST=0;
|
||||||
|
} elseif ($dow == 0) {
|
||||||
|
if ($timezone) { # UTC calculations
|
||||||
|
if ($ns < (3600+($timezone-1)*3600)) {
|
||||||
|
$GBR_DST=0;
|
||||||
|
} else {
|
||||||
|
$GBR_DST=1;
|
||||||
|
}
|
||||||
|
} else { # local time calculations
|
||||||
|
if ($ns < 3600) {
|
||||||
|
$GBR_DST=0;
|
||||||
|
} else {
|
||||||
|
$GBR_DST=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$GBR_DST=1;
|
||||||
|
}
|
||||||
|
} elseif ($mm == 10) {
|
||||||
|
if ($dd < 25) {
|
||||||
|
$GBR_DST=1;
|
||||||
|
} elseif ($dd < ($dow+25)) {
|
||||||
|
$GBR_DST=1;
|
||||||
|
} elseif ($dow == 0) {
|
||||||
|
if ($timezone) { # UTC calculations
|
||||||
|
if ($ns < (3600+($timezone-1)*3600)) {
|
||||||
|
$GBR_DST=1;
|
||||||
|
} else {
|
||||||
|
$GBR_DST=0;
|
||||||
|
}
|
||||||
|
} else { # local time calculations
|
||||||
|
if ($ns < 3600) {
|
||||||
|
$GBR_DST=1;
|
||||||
|
} else {
|
||||||
|
$GBR_DST=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$GBR_DST=0;
|
||||||
|
}
|
||||||
|
} # end of month checks
|
||||||
|
if ($DBX) {print " DST: $GBR_DST\n";}
|
||||||
|
if ($GBR_DST) {$gmt_offset++;}
|
||||||
|
$AC_processed++;
|
||||||
|
}
|
||||||
|
if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') )
|
||||||
|
{
|
||||||
|
if ($DBX) {print " Last Sunday October to Last Sunday March\n";}
|
||||||
|
#**********************************************************************
|
||||||
|
# This is s 1 if Daylight Savings Time is in effect and 0 if
|
||||||
|
# Standard time is in effect.
|
||||||
|
# Based on last Sunday in October and last Sunday in March at 1 am.
|
||||||
|
#**********************************************************************
|
||||||
|
|
||||||
|
$AUS_DST=0;
|
||||||
|
$mm = $mon;
|
||||||
|
$dd = $mday;
|
||||||
|
$ns = $dsec;
|
||||||
|
$dow= $wday;
|
||||||
|
|
||||||
|
if ($mm < 3 || $mm > 10) {
|
||||||
|
$AUS_DST=1;
|
||||||
|
} elseif ($mm >= 4 and $mm <= 9) {
|
||||||
|
$AUS_DST=0;
|
||||||
|
} elseif ($mm == 3) {
|
||||||
|
if ($dd < 25) {
|
||||||
|
$AUS_DST=1;
|
||||||
|
} elseif ($dd < ($dow+25)) {
|
||||||
|
$AUS_DST=1;
|
||||||
|
} elseif ($dow == 0) {
|
||||||
|
if ($timezone) { # UTC calculations
|
||||||
|
if ($ns < (3600+($timezone-1)*3600)) {
|
||||||
|
$AUS_DST=1;
|
||||||
|
} else {
|
||||||
|
$AUS_DST=0;
|
||||||
|
}
|
||||||
|
} else { # local time calculations
|
||||||
|
if ($ns < 3600) {
|
||||||
|
$AUS_DST=1;
|
||||||
|
} else {
|
||||||
|
$AUS_DST=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$AUS_DST=0;
|
||||||
|
}
|
||||||
|
} elseif ($mm == 10) {
|
||||||
|
if ($dd < 25) {
|
||||||
|
$AUS_DST=0;
|
||||||
|
} elseif ($dd < ($dow+25)) {
|
||||||
|
$AUS_DST=0;
|
||||||
|
} elseif ($dow == 0) {
|
||||||
|
if ($timezone) { # UTC calculations
|
||||||
|
if ($ns < (3600+($timezone-1)*3600)) {
|
||||||
|
$AUS_DST=0;
|
||||||
|
} else {
|
||||||
|
$AUS_DST=1;
|
||||||
|
}
|
||||||
|
} else { # local time calculations
|
||||||
|
if ($ns < 3600) {
|
||||||
|
$AUS_DST=0;
|
||||||
|
} else {
|
||||||
|
$AUS_DST=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$AUS_DST=1;
|
||||||
|
}
|
||||||
|
} # end of month checks
|
||||||
|
if ($DBX) {print " DST: $AUS_DST\n";}
|
||||||
|
if ($AUS_DST) {$gmt_offset++;}
|
||||||
|
$AC_processed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') )
|
||||||
|
{
|
||||||
|
if ($DBX) {print " First Sunday October to Last Sunday March\n";}
|
||||||
|
#**********************************************************************
|
||||||
|
# TASMANIA ONLY
|
||||||
|
# This is s 1 if Daylight Savings Time is in effect and 0 if
|
||||||
|
# Standard time is in effect.
|
||||||
|
# Based on first Sunday in October and last Sunday in March at 1 am.
|
||||||
|
#**********************************************************************
|
||||||
|
|
||||||
|
$AUST_DST=0;
|
||||||
|
$mm = $mon;
|
||||||
|
$dd = $mday;
|
||||||
|
$ns = $dsec;
|
||||||
|
$dow= $wday;
|
||||||
|
|
||||||
|
if ($mm < 3 || $mm > 10) {
|
||||||
|
$AUST_DST=1;
|
||||||
|
} elseif ($mm >= 4 and $mm <= 9) {
|
||||||
|
$AUST_DST=0;
|
||||||
|
} elseif ($mm == 3) {
|
||||||
|
if ($dd < 25) {
|
||||||
|
$AUST_DST=1;
|
||||||
|
} elseif ($dd < ($dow+25)) {
|
||||||
|
$AUST_DST=1;
|
||||||
|
} elseif ($dow == 0) {
|
||||||
|
if ($timezone) { # UTC calculations
|
||||||
|
if ($ns < (3600+($timezone-1)*3600)) {
|
||||||
|
$AUST_DST=1;
|
||||||
|
} else {
|
||||||
|
$AUST_DST=0;
|
||||||
|
}
|
||||||
|
} else { # local time calculations
|
||||||
|
if ($ns < 3600) {
|
||||||
|
$AUST_DST=1;
|
||||||
|
} else {
|
||||||
|
$AUST_DST=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$AUST_DST=0;
|
||||||
|
}
|
||||||
|
} elseif ($mm == 10) {
|
||||||
|
if ($dd > 7) {
|
||||||
|
$AUST_DST=1;
|
||||||
|
} elseif ($dd >= ($dow+1)) {
|
||||||
|
if ($timezone) {
|
||||||
|
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
|
||||||
|
$AUST_DST=0;
|
||||||
|
} else {
|
||||||
|
$AUST_DST=1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($dow == 0 and $ns < 3600) {
|
||||||
|
$AUST_DST=0;
|
||||||
|
} else {
|
||||||
|
$AUST_DST=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$AUST_DST=0;
|
||||||
|
}
|
||||||
|
} # end of month checks
|
||||||
|
if ($DBX) {print " DST: $AUST_DST\n";}
|
||||||
|
if ($AUST_DST) {$gmt_offset++;}
|
||||||
|
$AC_processed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (!$AC_processed) and ($dst_range == 'FSO-FSA') )
|
||||||
|
{
|
||||||
|
if ($DBX) {print " Sunday in October to First Sunday in April\n";}
|
||||||
|
#**********************************************************************
|
||||||
|
# FSO-FSA
|
||||||
|
# 2008+ AUSTRALIA ONLY (country code 61)
|
||||||
|
# This is returns 1 if Daylight Savings Time is in effect and 0 if
|
||||||
|
# Standard time is in effect.
|
||||||
|
# Based on first Sunday in October and first Sunday in April at 1 am.
|
||||||
|
#**********************************************************************
|
||||||
|
|
||||||
|
$AUSE_DST=0;
|
||||||
|
$mm = $mon;
|
||||||
|
$dd = $mday;
|
||||||
|
$ns = $dsec;
|
||||||
|
$dow= $wday;
|
||||||
|
|
||||||
|
if ($mm < 4 or $mm > 10) {
|
||||||
|
$AUSE_DST=1;
|
||||||
|
} elseif ($mm >= 5 and $mm <= 9) {
|
||||||
|
$AUSE_DST=0;
|
||||||
|
} elseif ($mm == 4) {
|
||||||
|
if ($dd > 7) {
|
||||||
|
$AUSE_DST=0;
|
||||||
|
} elseif ($dd >= ($dow+1)) {
|
||||||
|
if ($timezone) {
|
||||||
|
if ($dow == 0 and $ns < (3600+$timezone*3600)) {
|
||||||
|
$AUSE_DST=1;
|
||||||
|
} else {
|
||||||
|
$AUSE_DST=0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($dow == 0 and $ns < 7200) {
|
||||||
|
$AUSE_DST=1;
|
||||||
|
} else {
|
||||||
|
$AUSE_DST=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$AUSE_DST=1;
|
||||||
|
}
|
||||||
|
} elseif ($mm == 10) {
|
||||||
|
if ($dd >= 8) {
|
||||||
|
$AUSE_DST=1;
|
||||||
|
} elseif ($dd >= ($dow+1)) {
|
||||||
|
if ($timezone) {
|
||||||
|
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
|
||||||
|
$AUSE_DST=0;
|
||||||
|
} else {
|
||||||
|
$AUSE_DST=1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($dow == 0 and $ns < 3600) {
|
||||||
|
$AUSE_DST=0;
|
||||||
|
} else {
|
||||||
|
$AUSE_DST=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$AUSE_DST=0;
|
||||||
|
}
|
||||||
|
} # end of month checks
|
||||||
|
if ($DBX) {print " DST: $AUSE_DST\n";}
|
||||||
|
if ($AUSE_DST) {$gmt_offset++;}
|
||||||
|
$AC_processed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') )
|
||||||
|
{
|
||||||
|
if ($DBX) {print " First Sunday October to Third Sunday March\n";}
|
||||||
|
#**********************************************************************
|
||||||
|
# This is s 1 if Daylight Savings Time is in effect and 0 if
|
||||||
|
# Standard time is in effect.
|
||||||
|
# Based on first Sunday in October and third Sunday in March at 1 am.
|
||||||
|
#**********************************************************************
|
||||||
|
|
||||||
|
$NZL_DST=0;
|
||||||
|
$mm = $mon;
|
||||||
|
$dd = $mday;
|
||||||
|
$ns = $dsec;
|
||||||
|
$dow= $wday;
|
||||||
|
|
||||||
|
if ($mm < 3 || $mm > 10) {
|
||||||
|
$NZL_DST=1;
|
||||||
|
} elseif ($mm >= 4 and $mm <= 9) {
|
||||||
|
$NZL_DST=0;
|
||||||
|
} elseif ($mm == 3) {
|
||||||
|
if ($dd < 14) {
|
||||||
|
$NZL_DST=1;
|
||||||
|
} elseif ($dd < ($dow+14)) {
|
||||||
|
$NZL_DST=1;
|
||||||
|
} elseif ($dow == 0) {
|
||||||
|
if ($timezone) { # UTC calculations
|
||||||
|
if ($ns < (3600+($timezone-1)*3600)) {
|
||||||
|
$NZL_DST=1;
|
||||||
|
} else {
|
||||||
|
$NZL_DST=0;
|
||||||
|
}
|
||||||
|
} else { # local time calculations
|
||||||
|
if ($ns < 3600) {
|
||||||
|
$NZL_DST=1;
|
||||||
|
} else {
|
||||||
|
$NZL_DST=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$NZL_DST=0;
|
||||||
|
}
|
||||||
|
} elseif ($mm == 10) {
|
||||||
|
if ($dd > 7) {
|
||||||
|
$NZL_DST=1;
|
||||||
|
} elseif ($dd >= ($dow+1)) {
|
||||||
|
if ($timezone) {
|
||||||
|
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
|
||||||
|
$NZL_DST=0;
|
||||||
|
} else {
|
||||||
|
$NZL_DST=1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($dow == 0 and $ns < 3600) {
|
||||||
|
$NZL_DST=0;
|
||||||
|
} else {
|
||||||
|
$NZL_DST=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$NZL_DST=0;
|
||||||
|
}
|
||||||
|
} # end of month checks
|
||||||
|
if ($DBX) {print " DST: $NZL_DST\n";}
|
||||||
|
if ($NZL_DST) {$gmt_offset++;}
|
||||||
|
$AC_processed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (!$AC_processed) and ($dst_range == 'LSS-FSA') )
|
||||||
|
{
|
||||||
|
if ($DBX) {print " Last Sunday in September to First Sunday in April\n";}
|
||||||
|
#**********************************************************************
|
||||||
|
# LSS-FSA
|
||||||
|
# 2007+ NEW ZEALAND (country code 64)
|
||||||
|
# This is returns 1 if Daylight Savings Time is in effect and 0 if
|
||||||
|
# Standard time is in effect.
|
||||||
|
# Based on last Sunday in September and first Sunday in April at 1 am.
|
||||||
|
#**********************************************************************
|
||||||
|
|
||||||
|
$NZLN_DST=0;
|
||||||
|
$mm = $mon;
|
||||||
|
$dd = $mday;
|
||||||
|
$ns = $dsec;
|
||||||
|
$dow= $wday;
|
||||||
|
|
||||||
|
if ($mm < 4 || $mm > 9) {
|
||||||
|
$NZLN_DST=1;
|
||||||
|
} elseif ($mm >= 5 && $mm <= 9) {
|
||||||
|
$NZLN_DST=0;
|
||||||
|
} elseif ($mm == 4) {
|
||||||
|
if ($dd > 7) {
|
||||||
|
$NZLN_DST=0;
|
||||||
|
} elseif ($dd >= ($dow+1)) {
|
||||||
|
if ($timezone) {
|
||||||
|
if ($dow == 0 && $ns < (3600+$timezone*3600)) {
|
||||||
|
$NZLN_DST=1;
|
||||||
|
} else {
|
||||||
|
$NZLN_DST=0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($dow == 0 && $ns < 7200) {
|
||||||
|
$NZLN_DST=1;
|
||||||
|
} else {
|
||||||
|
$NZLN_DST=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$NZLN_DST=1;
|
||||||
|
}
|
||||||
|
} elseif ($mm == 9) {
|
||||||
|
if ($dd < 25) {
|
||||||
|
$NZLN_DST=0;
|
||||||
|
} elseif ($dd < ($dow+25)) {
|
||||||
|
$NZLN_DST=0;
|
||||||
|
} elseif ($dow == 0) {
|
||||||
|
if ($timezone) { # UTC calculations
|
||||||
|
if ($ns < (3600+($timezone-1)*3600)) {
|
||||||
|
$NZLN_DST=0;
|
||||||
|
} else {
|
||||||
|
$NZLN_DST=1;
|
||||||
|
}
|
||||||
|
} else { # local time calculations
|
||||||
|
if ($ns < 3600) {
|
||||||
|
$NZLN_DST=0;
|
||||||
|
} else {
|
||||||
|
$NZLN_DST=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$NZLN_DST=1;
|
||||||
|
}
|
||||||
|
} # end of month checks
|
||||||
|
if ($DBX) {print " DST: $NZLN_DST\n";}
|
||||||
|
if ($NZLN_DST) {$gmt_offset++;}
|
||||||
|
$AC_processed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') )
|
||||||
|
{
|
||||||
|
if ($DBX) {print " Third Sunday October to Last Sunday February\n";}
|
||||||
|
#**********************************************************************
|
||||||
|
# TSO-LSF
|
||||||
|
# This is returns 1 if Daylight Savings Time is in effect and 0 if
|
||||||
|
# Standard time is in effect. Brazil
|
||||||
|
# Based on Third Sunday October to Last Sunday February at 1 am.
|
||||||
|
#**********************************************************************
|
||||||
|
|
||||||
|
$BZL_DST=0;
|
||||||
|
$mm = $mon;
|
||||||
|
$dd = $mday;
|
||||||
|
$ns = $dsec;
|
||||||
|
$dow= $wday;
|
||||||
|
|
||||||
|
if ($mm < 2 || $mm > 10) {
|
||||||
|
$BZL_DST=1;
|
||||||
|
} elseif ($mm >= 3 and $mm <= 9) {
|
||||||
|
$BZL_DST=0;
|
||||||
|
} elseif ($mm == 2) {
|
||||||
|
if ($dd < 22) {
|
||||||
|
$BZL_DST=1;
|
||||||
|
} elseif ($dd < ($dow+22)) {
|
||||||
|
$BZL_DST=1;
|
||||||
|
} elseif ($dow == 0) {
|
||||||
|
if ($timezone) { # UTC calculations
|
||||||
|
if ($ns < (3600+($timezone-1)*3600)) {
|
||||||
|
$BZL_DST=1;
|
||||||
|
} else {
|
||||||
|
$BZL_DST=0;
|
||||||
|
}
|
||||||
|
} else { # local time calculations
|
||||||
|
if ($ns < 3600) {
|
||||||
|
$BZL_DST=1;
|
||||||
|
} else {
|
||||||
|
$BZL_DST=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$BZL_DST=0;
|
||||||
|
}
|
||||||
|
} elseif ($mm == 10) {
|
||||||
|
if ($dd < 22) {
|
||||||
|
$BZL_DST=0;
|
||||||
|
} elseif ($dd < ($dow+22)) {
|
||||||
|
$BZL_DST=0;
|
||||||
|
} elseif ($dow == 0) {
|
||||||
|
if ($timezone) { # UTC calculations
|
||||||
|
if ($ns < (3600+($timezone-1)*3600)) {
|
||||||
|
$BZL_DST=0;
|
||||||
|
} else {
|
||||||
|
$BZL_DST=1;
|
||||||
|
}
|
||||||
|
} else { # local time calculations
|
||||||
|
if ($ns < 3600) {
|
||||||
|
$BZL_DST=0;
|
||||||
|
} else {
|
||||||
|
$BZL_DST=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$BZL_DST=1;
|
||||||
|
}
|
||||||
|
} # end of month checks
|
||||||
|
if ($DBX) {print " DST: $BZL_DST\n";}
|
||||||
|
if ($BZL_DST) {$gmt_offset++;}
|
||||||
|
$AC_processed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$AC_processed)
|
||||||
|
{
|
||||||
|
if ($DBX) {print " No DST Method Found\n";}
|
||||||
|
if ($DBX) {print " DST: 0\n";}
|
||||||
|
$AC_processed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $gmt_offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### DETERMINE IF LEAD IS DIALABLE #####
|
||||||
|
function dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state)
|
||||||
|
{
|
||||||
|
require("dbconnect.php");
|
||||||
|
|
||||||
|
$dialable=0;
|
||||||
|
|
||||||
|
$pzone=3600 * $gmt_offset;
|
||||||
|
$pmin=(gmdate("i", time() + $pzone));
|
||||||
|
$phour=( (gmdate("G", time() + $pzone)) * 100);
|
||||||
|
$pday=gmdate("w", time() + $pzone);
|
||||||
|
$tz = sprintf("%.2f", $p);
|
||||||
|
$GMT_gmt = "$tz";
|
||||||
|
$GMT_day = "$pday";
|
||||||
|
$GMT_hour = ($phour + $pmin);
|
||||||
|
|
||||||
|
$stmt="SELECT call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times FROM vicidial_call_times where call_time_id='$local_call_time';";
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
$rowx=mysql_fetch_row($rslt);
|
||||||
|
$Gct_default_start = $rowx[3];
|
||||||
|
$Gct_default_stop = $rowx[4];
|
||||||
|
$Gct_sunday_start = $rowx[5];
|
||||||
|
$Gct_sunday_stop = $rowx[6];
|
||||||
|
$Gct_monday_start = $rowx[7];
|
||||||
|
$Gct_monday_stop = $rowx[8];
|
||||||
|
$Gct_tuesday_start = $rowx[9];
|
||||||
|
$Gct_tuesday_stop = $rowx[10];
|
||||||
|
$Gct_wednesday_start = $rowx[11];
|
||||||
|
$Gct_wednesday_stop = $rowx[12];
|
||||||
|
$Gct_thursday_start = $rowx[13];
|
||||||
|
$Gct_thursday_stop = $rowx[14];
|
||||||
|
$Gct_friday_start = $rowx[15];
|
||||||
|
$Gct_friday_stop = $rowx[16];
|
||||||
|
$Gct_saturday_start = $rowx[17];
|
||||||
|
$Gct_saturday_stop = $rowx[18];
|
||||||
|
$Gct_state_call_times = $rowx[19];
|
||||||
|
|
||||||
|
if ($GMT_day==0) #### Sunday local time
|
||||||
|
{
|
||||||
|
if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0))
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_sunday_start) and ($GMT_hour<$Gct_sunday_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($GMT_day==1) #### Monday local time
|
||||||
|
{
|
||||||
|
if (($Gct_monday_start==0) and ($Gct_monday_stop==0))
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_monday_start) and ($GMT_hour<$Gct_monday_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($GMT_day==2) #### Tuesday local time
|
||||||
|
{
|
||||||
|
if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0))
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_tuesday_start) and ($GMT_hour<$Gct_tuesday_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($GMT_day==3) #### Wednesday local time
|
||||||
|
{
|
||||||
|
if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0))
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_wednesday_start) and ($GMT_hour<$Gct_wednesday_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($GMT_day==4) #### Thursday local time
|
||||||
|
{
|
||||||
|
if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0))
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_thursday_start) and ($GMT_hour<$Gct_thursday_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($GMT_day==5) #### Friday local time
|
||||||
|
{
|
||||||
|
if (($Gct_friday_start==0) and ($Gct_friday_stop==0))
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_friday_start) and ($GMT_hour<$Gct_friday_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($GMT_day==6) #### Saturday local time
|
||||||
|
{
|
||||||
|
if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0))
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_saturday_start) and ($GMT_hour<$Gct_saturday_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $dialable;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##### MySQL Error Logging #####
|
##### MySQL Error Logging #####
|
||||||
function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log)
|
function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
# manager_send.php version 2.4
|
# manager_send.php version 2.4
|
||||||
#
|
#
|
||||||
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||||
#
|
#
|
||||||
# This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server
|
# This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server
|
||||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||||
@@ -43,6 +43,8 @@
|
|||||||
# - $nodeletevdac - ('0','1')
|
# - $nodeletevdac - ('0','1')
|
||||||
# - $alertCID - ('0','1')
|
# - $alertCID - ('0','1')
|
||||||
# - $preset_name = ('TESTING PRESET',...)
|
# - $preset_name = ('TESTING PRESET',...)
|
||||||
|
# - $call_variables = ('Variable: vendor_lead_code=1234|campaign=TESTCAMP|...')
|
||||||
|
# - $log_campaign
|
||||||
#
|
#
|
||||||
# CHANGELOG:
|
# CHANGELOG:
|
||||||
# 50401-1002 - First build of script, Hangup function only
|
# 50401-1002 - First build of script, Hangup function only
|
||||||
@@ -102,12 +104,15 @@
|
|||||||
# 100813-0833 - Added preset_name variable and logging
|
# 100813-0833 - Added preset_name variable and logging
|
||||||
# 101004-1345 - Added Ivr park functions
|
# 101004-1345 - Added Ivr park functions
|
||||||
# 101024-1638 - Added park_log logging for parked calls
|
# 101024-1638 - Added park_log logging for parked calls
|
||||||
|
# 101107-2331 - Added CALLERONHOLD/CALLEROFFHOLD queue_log entries
|
||||||
|
# 101125-1018 - Added call_variables Originate variables
|
||||||
|
# 110224-1710 - Added compatibility with QM phone environment logging
|
||||||
#
|
#
|
||||||
|
|
||||||
$version = '2.4-52';
|
$version = '2.4-55';
|
||||||
$build = '101024-1638';
|
$build = '110224-1710';
|
||||||
$mel=1; # Mysql Error Log enabled = 1
|
$mel=1; # Mysql Error Log enabled = 1
|
||||||
$mysql_log_count=97;
|
$mysql_log_count=116;
|
||||||
$one_mysql_log=0;
|
$one_mysql_log=0;
|
||||||
|
|
||||||
require("dbconnect.php");
|
require("dbconnect.php");
|
||||||
@@ -197,6 +202,10 @@ if (isset($_GET["alertCID"])) {$alertCID=$_GET["alertCID"];}
|
|||||||
elseif (isset($_POST["alertCID"])) {$alertCID=$_POST["alertCID"];}
|
elseif (isset($_POST["alertCID"])) {$alertCID=$_POST["alertCID"];}
|
||||||
if (isset($_GET["preset_name"])) {$preset_name=$_GET["preset_name"];}
|
if (isset($_GET["preset_name"])) {$preset_name=$_GET["preset_name"];}
|
||||||
elseif (isset($_POST["preset_name"])) {$preset_name=$_POST["preset_name"];}
|
elseif (isset($_POST["preset_name"])) {$preset_name=$_POST["preset_name"];}
|
||||||
|
if (isset($_GET["call_variables"])) {$call_variables=$_GET["call_variables"];}
|
||||||
|
elseif (isset($_POST["call_variables"])) {$call_variables=$_POST["call_variables"];}
|
||||||
|
if (isset($_GET["log_campaign"])) {$log_campaign=$_GET["log_campaign"];}
|
||||||
|
elseif (isset($_POST["log_campaign"])) {$log_campaign=$_POST["log_campaign"];}
|
||||||
|
|
||||||
|
|
||||||
header ("Content-type: text/html; charset=utf-8");
|
header ("Content-type: text/html; charset=utf-8");
|
||||||
@@ -437,10 +446,12 @@ if ($ACTION=="Originate")
|
|||||||
{
|
{
|
||||||
$RAWaccount = $account;
|
$RAWaccount = $account;
|
||||||
$account = "Account: $account";
|
$account = "Account: $account";
|
||||||
$variable = "Variable: usegroupalias=1";
|
$variable = "Variable: _usegroupalias=1";
|
||||||
|
if (strlen($call_variables)>9)
|
||||||
|
{$variable = "Variable: _usegroupalias=1";} # |$call_variables
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{$account=''; $variable='';}
|
{$variable=''; $account="Variable: $call_variables";}
|
||||||
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','$account','$variable','','','');";
|
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','$account','$variable','','','');";
|
||||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||||
$rslt=mysql_query($stmt, $link);
|
$rslt=mysql_query($stmt, $link);
|
||||||
@@ -712,8 +723,20 @@ if ($ACTION=="Hangup")
|
|||||||
if ($time_id > 100000)
|
if ($time_id > 100000)
|
||||||
{$secondS = ($StarTtime - $time_id);}
|
{$secondS = ($StarTtime - $time_id);}
|
||||||
|
|
||||||
|
$data4SQL='';
|
||||||
|
$stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$log_campaign' and queuemetrics_phone_environment!='';";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02116',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$cqpe_ct = mysql_num_rows($rslt);
|
||||||
|
if ($cqpe_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$data4SQL = ",data4='$row[0]'";
|
||||||
|
}
|
||||||
|
|
||||||
if ($format=='debug') {echo "\n<!-- $caller_complete|$stmt -->";}
|
if ($format=='debug') {echo "\n<!-- $caller_complete|$stmt -->";}
|
||||||
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id';";
|
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id' $data4SQL;";
|
||||||
$rslt=mysql_query($stmt, $linkB);
|
$rslt=mysql_query($stmt, $linkB);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02019',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02019',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
$affected_rows = mysql_affected_rows($linkB);
|
$affected_rows = mysql_affected_rows($linkB);
|
||||||
@@ -842,7 +865,60 @@ if ($ACTION=="RedirectToPark")
|
|||||||
$stmt = "INSERT INTO park_log SET uniqueid='$uniqueid',status='PARKINGED',channel='$channel',channel_group='$campaign',server_ip='$server_ip',parked_time='$NOW_TIME',parked_sec=0,extension='$CalLCID',user='$user',lead_id='$lead_id';";
|
$stmt = "INSERT INTO park_log SET uniqueid='$uniqueid',status='PARKINGED',channel='$channel',channel_group='$campaign',server_ip='$server_ip',parked_time='$NOW_TIME',parked_sec=0,extension='$CalLCID',user='$user',lead_id='$lead_id';";
|
||||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||||
$rslt=mysql_query($stmt, $link);
|
$rslt=mysql_query($stmt, $link);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02098',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
|
||||||
|
|
||||||
|
#############################################
|
||||||
|
##### START QUEUEMETRICS LOGGING LOOKUP #####
|
||||||
|
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02099',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
if ($format=='debug') {echo "\n<!-- $rowx[0]|$stmt -->";}
|
||||||
|
$qm_conf_ct = mysql_num_rows($rslt);
|
||||||
|
$i=0;
|
||||||
|
while ($i < $qm_conf_ct)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$enable_queuemetrics_logging = $row[0];
|
||||||
|
$queuemetrics_server_ip = $row[1];
|
||||||
|
$queuemetrics_dbname = $row[2];
|
||||||
|
$queuemetrics_login = $row[3];
|
||||||
|
$queuemetrics_pass = $row[4];
|
||||||
|
$queuemetrics_log_id = $row[5];
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
##### END QUEUEMETRICS LOGGING LOOKUP #####
|
||||||
|
###########################################
|
||||||
|
if ($enable_queuemetrics_logging > 0)
|
||||||
|
{
|
||||||
|
$linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass");
|
||||||
|
mysql_select_db("$queuemetrics_dbname", $linkB);
|
||||||
|
|
||||||
|
$time_id=0;
|
||||||
|
$stmt="SELECT time_id,queue,agent from queue_log where call_id='$CalLCID' and verb='CONNECT' order by time_id desc limit 1;";
|
||||||
|
$rslt=mysql_query($stmt, $linkB);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02100',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$VAC_eq_ct = mysql_num_rows($rslt);
|
||||||
|
if ($VAC_eq_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$time_id = $row[0];
|
||||||
|
$queue = $row[1];
|
||||||
|
$agent = $row[2];
|
||||||
|
}
|
||||||
|
$StarTtime = date("U");
|
||||||
|
if ($time_id > 100000)
|
||||||
|
{$secondS = ($StarTtime - $time_id);}
|
||||||
|
|
||||||
|
if ($VAC_eq_ct > 0)
|
||||||
|
{
|
||||||
|
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$queue',agent='Agent/$user',verb='CALLERONHOLD',data1='PARKING',serverid='$queuemetrics_log_id';";
|
||||||
|
$rslt=mysql_query($stmt, $linkB);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02101',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$affected_rows = mysql_affected_rows($linkB);
|
||||||
|
if ($format=='debug') {echo "\n<!-- $affected_rows|$stmt -->";}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# $fp = fopen ("./vicidial_debug.txt", "a");
|
# $fp = fopen ("./vicidial_debug.txt", "a");
|
||||||
# fwrite ($fp, "$NOW_TIME|MS_LOG_0|$queryCID|$stmt|\n");
|
# fwrite ($fp, "$NOW_TIME|MS_LOG_0|$queryCID|$stmt|\n");
|
||||||
@@ -880,7 +956,7 @@ if ($ACTION=="RedirectFromPark")
|
|||||||
$parked_sec=0;
|
$parked_sec=0;
|
||||||
$stmt = "SELECT UNIX_TIMESTAMP(parked_time) FROM park_log where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' and (parked_sec < 1 or grab_time is NULL) order by parked_time desc limit 1;";
|
$stmt = "SELECT UNIX_TIMESTAMP(parked_time) FROM park_log where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' and (parked_sec < 1 or grab_time is NULL) order by parked_time desc limit 1;";
|
||||||
$rslt=mysql_query($stmt, $link);
|
$rslt=mysql_query($stmt, $link);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02102',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
$VAC_pl_ct = mysql_num_rows($rslt);
|
$VAC_pl_ct = mysql_num_rows($rslt);
|
||||||
if ($VAC_pl_ct > 0)
|
if ($VAC_pl_ct > 0)
|
||||||
{
|
{
|
||||||
@@ -890,7 +966,59 @@ if ($ACTION=="RedirectFromPark")
|
|||||||
$stmt = "UPDATE park_log SET status='GRABBED',grab_time='$NOW_TIME',parked_sec='$parked_sec' where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' order by parked_time desc limit 1;";
|
$stmt = "UPDATE park_log SET status='GRABBED',grab_time='$NOW_TIME',parked_sec='$parked_sec' where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' order by parked_time desc limit 1;";
|
||||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||||
$rslt=mysql_query($stmt, $link);
|
$rslt=mysql_query($stmt, $link);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02103',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
|
||||||
|
#############################################
|
||||||
|
##### START QUEUEMETRICS LOGGING LOOKUP #####
|
||||||
|
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02104',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
if ($format=='debug') {echo "\n<!-- $rowx[0]|$stmt -->";}
|
||||||
|
$qm_conf_ct = mysql_num_rows($rslt);
|
||||||
|
$i=0;
|
||||||
|
while ($i < $qm_conf_ct)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$enable_queuemetrics_logging = $row[0];
|
||||||
|
$queuemetrics_server_ip = $row[1];
|
||||||
|
$queuemetrics_dbname = $row[2];
|
||||||
|
$queuemetrics_login = $row[3];
|
||||||
|
$queuemetrics_pass = $row[4];
|
||||||
|
$queuemetrics_log_id = $row[5];
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
##### END QUEUEMETRICS LOGGING LOOKUP #####
|
||||||
|
###########################################
|
||||||
|
if ($enable_queuemetrics_logging > 0)
|
||||||
|
{
|
||||||
|
$linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass");
|
||||||
|
mysql_select_db("$queuemetrics_dbname", $linkB);
|
||||||
|
|
||||||
|
$time_id=0;
|
||||||
|
$stmt="SELECT time_id,queue,agent from queue_log where call_id='$CalLCID' and verb='CONNECT' order by time_id desc limit 1;";
|
||||||
|
$rslt=mysql_query($stmt, $linkB);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02105',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$VAC_eq_ct = mysql_num_rows($rslt);
|
||||||
|
if ($VAC_eq_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$time_id = $row[0];
|
||||||
|
$queue = $row[1];
|
||||||
|
$agent = $row[2];
|
||||||
|
}
|
||||||
|
$StarTtime = date("U");
|
||||||
|
if ($time_id > 100000)
|
||||||
|
{$secondS = ($StarTtime - $time_id);}
|
||||||
|
|
||||||
|
if ($VAC_eq_ct > 0)
|
||||||
|
{
|
||||||
|
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$queue',agent='Agent/$user',verb='CALLEROFFHOLD',data1='$parked_sec',data2='PARKING',serverid='$queuemetrics_log_id';";
|
||||||
|
$rslt=mysql_query($stmt, $linkB);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02106',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$affected_rows = mysql_affected_rows($linkB);
|
||||||
|
if ($format=='debug') {echo "\n<!-- $affected_rows|$stmt -->";}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -932,8 +1060,59 @@ if ($ACTION=="RedirectToParkIVR")
|
|||||||
$stmt = "INSERT INTO park_log SET uniqueid='$uniqueid',status='IVRPARKINGED',channel='$channel',channel_group='$campaign',server_ip='$server_ip',parked_time='$NOW_TIME',parked_sec=0,extension='$CalLCID',user='$user',lead_id='$lead_id';";
|
$stmt = "INSERT INTO park_log SET uniqueid='$uniqueid',status='IVRPARKINGED',channel='$channel',channel_group='$campaign',server_ip='$server_ip',parked_time='$NOW_TIME',parked_sec=0,extension='$CalLCID',user='$user',lead_id='$lead_id';";
|
||||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||||
$rslt=mysql_query($stmt, $link);
|
$rslt=mysql_query($stmt, $link);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02107',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
|
||||||
|
#############################################
|
||||||
|
##### START QUEUEMETRICS LOGGING LOOKUP #####
|
||||||
|
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02108',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
if ($format=='debug') {echo "\n<!-- $rowx[0]|$stmt -->";}
|
||||||
|
$qm_conf_ct = mysql_num_rows($rslt);
|
||||||
|
$i=0;
|
||||||
|
while ($i < $qm_conf_ct)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$enable_queuemetrics_logging = $row[0];
|
||||||
|
$queuemetrics_server_ip = $row[1];
|
||||||
|
$queuemetrics_dbname = $row[2];
|
||||||
|
$queuemetrics_login = $row[3];
|
||||||
|
$queuemetrics_pass = $row[4];
|
||||||
|
$queuemetrics_log_id = $row[5];
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
##### END QUEUEMETRICS LOGGING LOOKUP #####
|
||||||
|
###########################################
|
||||||
|
if ($enable_queuemetrics_logging > 0)
|
||||||
|
{
|
||||||
|
$linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass");
|
||||||
|
mysql_select_db("$queuemetrics_dbname", $linkB);
|
||||||
|
|
||||||
|
$time_id=0;
|
||||||
|
$stmt="SELECT time_id,queue,agent from queue_log where call_id='$CalLCID' and verb='CONNECT' order by time_id desc limit 1;";
|
||||||
|
$rslt=mysql_query($stmt, $linkB);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02109',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$VAC_eq_ct = mysql_num_rows($rslt);
|
||||||
|
if ($VAC_eq_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$time_id = $row[0];
|
||||||
|
$queue = $row[1];
|
||||||
|
$agent = $row[2];
|
||||||
|
}
|
||||||
|
$StarTtime = date("U");
|
||||||
|
if ($time_id > 100000)
|
||||||
|
{$secondS = ($StarTtime - $time_id);}
|
||||||
|
|
||||||
|
if ($VAC_eq_ct > 0)
|
||||||
|
{
|
||||||
|
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$queue',agent='Agent/$user',verb='CALLERONHOLD',data1='IVRPARKING',serverid='$queuemetrics_log_id';";
|
||||||
|
$rslt=mysql_query($stmt, $linkB);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02110',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$affected_rows = mysql_affected_rows($linkB);
|
||||||
|
if ($format=='debug') {echo "\n<!-- $affected_rows|$stmt -->";}
|
||||||
|
}
|
||||||
|
}
|
||||||
# $fp = fopen ("./vicidial_debug.txt", "a");
|
# $fp = fopen ("./vicidial_debug.txt", "a");
|
||||||
# fwrite ($fp, "$NOW_TIME|MS_LOG_0|$queryCID|$stmt|\n");
|
# fwrite ($fp, "$NOW_TIME|MS_LOG_0|$queryCID|$stmt|\n");
|
||||||
# fclose($fp);
|
# fclose($fp);
|
||||||
@@ -975,7 +1154,7 @@ if ($ACTION=="RedirectFromParkIVR")
|
|||||||
$parked_sec=0;
|
$parked_sec=0;
|
||||||
$stmt = "SELECT UNIX_TIMESTAMP(parked_time) FROM park_log where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' and (parked_sec < 1 or grab_time is NULL) order by parked_time desc limit 1;";
|
$stmt = "SELECT UNIX_TIMESTAMP(parked_time) FROM park_log where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' and (parked_sec < 1 or grab_time is NULL) order by parked_time desc limit 1;";
|
||||||
$rslt=mysql_query($stmt, $link);
|
$rslt=mysql_query($stmt, $link);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02111',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
$VAC_pl_ct = mysql_num_rows($rslt);
|
$VAC_pl_ct = mysql_num_rows($rslt);
|
||||||
if ($VAC_pl_ct > 0)
|
if ($VAC_pl_ct > 0)
|
||||||
{
|
{
|
||||||
@@ -985,7 +1164,59 @@ if ($ACTION=="RedirectFromParkIVR")
|
|||||||
$stmt = "UPDATE park_log SET status='GRABBEDIVR',grab_time='$NOW_TIME',parked_sec='$parked_sec' where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' order by parked_time desc limit 1;";
|
$stmt = "UPDATE park_log SET status='GRABBEDIVR',grab_time='$NOW_TIME',parked_sec='$parked_sec' where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' order by parked_time desc limit 1;";
|
||||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||||
$rslt=mysql_query($stmt, $link);
|
$rslt=mysql_query($stmt, $link);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02112',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
|
||||||
|
#############################################
|
||||||
|
##### START QUEUEMETRICS LOGGING LOOKUP #####
|
||||||
|
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02113',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
if ($format=='debug') {echo "\n<!-- $rowx[0]|$stmt -->";}
|
||||||
|
$qm_conf_ct = mysql_num_rows($rslt);
|
||||||
|
$i=0;
|
||||||
|
while ($i < $qm_conf_ct)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$enable_queuemetrics_logging = $row[0];
|
||||||
|
$queuemetrics_server_ip = $row[1];
|
||||||
|
$queuemetrics_dbname = $row[2];
|
||||||
|
$queuemetrics_login = $row[3];
|
||||||
|
$queuemetrics_pass = $row[4];
|
||||||
|
$queuemetrics_log_id = $row[5];
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
##### END QUEUEMETRICS LOGGING LOOKUP #####
|
||||||
|
###########################################
|
||||||
|
if ($enable_queuemetrics_logging > 0)
|
||||||
|
{
|
||||||
|
$linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass");
|
||||||
|
mysql_select_db("$queuemetrics_dbname", $linkB);
|
||||||
|
|
||||||
|
$time_id=0;
|
||||||
|
$stmt="SELECT time_id,queue,agent from queue_log where call_id='$CalLCID' and verb='CONNECT' order by time_id desc limit 1;";
|
||||||
|
$rslt=mysql_query($stmt, $linkB);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02114',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$VAC_eq_ct = mysql_num_rows($rslt);
|
||||||
|
if ($VAC_eq_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$time_id = $row[0];
|
||||||
|
$queue = $row[1];
|
||||||
|
$agent = $row[2];
|
||||||
|
}
|
||||||
|
$StarTtime = date("U");
|
||||||
|
if ($time_id > 100000)
|
||||||
|
{$secondS = ($StarTtime - $time_id);}
|
||||||
|
|
||||||
|
if ($VAC_eq_ct > 0)
|
||||||
|
{
|
||||||
|
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$queue',agent='Agent/$user',verb='CALLEROFFHOLD',data1='$parked_sec',data2='IVRPARKING',serverid='$queuemetrics_log_id';";
|
||||||
|
$rslt=mysql_query($stmt, $linkB);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02115',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$affected_rows = mysql_affected_rows($linkB);
|
||||||
|
if ($format=='debug') {echo "\n<!-- $affected_rows|$stmt -->";}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1494
-202
File diff suppressed because it is too large
Load Diff
+2220
-1155
File diff suppressed because it is too large
Load Diff
@@ -52,17 +52,22 @@
|
|||||||
# 100109-1337 - Fixed Manual dial live call detection
|
# 100109-1337 - Fixed Manual dial live call detection
|
||||||
# 100527-0957 - Added send_dtmf, transfer_conference and park_call API functions
|
# 100527-0957 - Added send_dtmf, transfer_conference and park_call API functions
|
||||||
# 100727-2209 - Added timer actions for hangup, extension, callmenu and ingroup as well as destination
|
# 100727-2209 - Added timer actions for hangup, extension, callmenu and ingroup as well as destination
|
||||||
|
# 101123-1105 - Added api manual dial queue feature to external_dial function
|
||||||
|
# 101208-0308 - Moved the Calls in Queue count and other counts outside of the autodial section (issue 406)
|
||||||
#
|
#
|
||||||
|
|
||||||
$version = '2.4-27';
|
$version = '2.4-29';
|
||||||
$build = '100727-2209';
|
$build = '101208-0308';
|
||||||
$mel=1; # Mysql Error Log enabled = 1
|
$mel=1; # Mysql Error Log enabled = 1
|
||||||
$mysql_log_count=32;
|
$mysql_log_count=36;
|
||||||
$one_mysql_log=0;
|
$one_mysql_log=0;
|
||||||
|
$DB=0;
|
||||||
|
|
||||||
require("dbconnect.php");
|
require("dbconnect.php");
|
||||||
|
|
||||||
### If you have globals turned off uncomment these lines
|
### If you have globals turned off uncomment these lines
|
||||||
|
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
|
||||||
|
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
|
||||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||||
@@ -215,7 +220,7 @@ echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
|
|||||||
|
|
||||||
if ($Acount > 0)
|
if ($Acount > 0)
|
||||||
{
|
{
|
||||||
$stmt="SELECT status,callerid,agent_log_id,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
$stmt="SELECT status,callerid,agent_log_id,campaign_id,lead_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||||
if ($DB) {echo "|$stmt|\n";}
|
if ($DB) {echo "|$stmt|\n";}
|
||||||
$rslt=mysql_query($stmt, $link);
|
$rslt=mysql_query($stmt, $link);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
@@ -224,6 +229,17 @@ echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
|
|||||||
$Acallerid = $row[1];
|
$Acallerid = $row[1];
|
||||||
$Aagent_log_id = $row[2];
|
$Aagent_log_id = $row[2];
|
||||||
$Acampaign_id = $row[3];
|
$Acampaign_id = $row[3];
|
||||||
|
$Alead_id = $row[4];
|
||||||
|
|
||||||
|
$api_manual_dial='STANDARD';
|
||||||
|
$stmt = "SELECT api_manual_dial FROM vicidial_campaigns where campaign_id='$Acampaign_id';";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
$vcc_conf_ct = mysql_num_rows($rslt);
|
||||||
|
if ($vcc_conf_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$api_manual_dial = $row[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
# ### find out if external table shows agent should be disabled
|
# ### find out if external table shows agent should be disabled
|
||||||
# $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';";
|
# $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';";
|
||||||
@@ -232,6 +248,53 @@ echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
|
|||||||
# $row=mysql_fetch_row($rslt);
|
# $row=mysql_fetch_row($rslt);
|
||||||
# $AexternalDEAD=$row[0];
|
# $AexternalDEAD=$row[0];
|
||||||
|
|
||||||
|
##### BEGIN check su calls in queue, number of active calls in the campaign
|
||||||
|
if ($campagentstdisp == 'YES')
|
||||||
|
{
|
||||||
|
$ADsql='';
|
||||||
|
### grab the status of this agent to display
|
||||||
|
$stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||||
|
if ($DB) {echo "|$stmt|\n";}
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$Alogin=$row[0];
|
||||||
|
$Acampaign=$row[1];
|
||||||
|
$AccampSQL=$row[2];
|
||||||
|
$AccampSQL = ereg_replace(' -','', $AccampSQL);
|
||||||
|
$AccampSQL = ereg_replace(' ',"','", $AccampSQL);
|
||||||
|
if (eregi('AGENTDIRECT', $AccampSQL))
|
||||||
|
{
|
||||||
|
$AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL);
|
||||||
|
$ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )";
|
||||||
|
}
|
||||||
|
|
||||||
|
### grab the number of calls being placed from this server and campaign
|
||||||
|
$stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);";
|
||||||
|
if ($DB) {echo "|$stmt|\n";}
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$RingCalls=$row[0];
|
||||||
|
if ($RingCalls > 0) {$RingCalls = "<font class=\"queue_text_red\">Chiamate in coda: $RingCalls</font>";}
|
||||||
|
else {$RingCalls = "<font class=\"queue_text\">Chiamate in coda: $RingCalls</font>";}
|
||||||
|
|
||||||
|
### grab the number of calls being placed from this server and campaign
|
||||||
|
$stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );";
|
||||||
|
if ($DB) {echo "|$stmt|\n";}
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$DiaLCalls=$row[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$Alogin='N';
|
||||||
|
$RingCalls='N';
|
||||||
|
$DiaLCalls='N';
|
||||||
|
}
|
||||||
|
##### END check su calls in queue, number of active calls in the campaign
|
||||||
|
|
||||||
if ($auto_dial_level > 0)
|
if ($auto_dial_level > 0)
|
||||||
{
|
{
|
||||||
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
||||||
@@ -285,59 +348,9 @@ echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
##### END DEAD logging section #####
|
##### END DEAD logging section #####
|
||||||
|
|
||||||
if ($campagentstdisp == 'YES')
|
|
||||||
{
|
|
||||||
$ADsql='';
|
|
||||||
### grab the status of this agent to display
|
|
||||||
$stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
|
||||||
if ($DB) {echo "|$stmt|\n";}
|
|
||||||
$rslt=mysql_query($stmt, $link);
|
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);}
|
|
||||||
$row=mysql_fetch_row($rslt);
|
|
||||||
$Alogin=$row[0];
|
|
||||||
$Acampaign=$row[1];
|
|
||||||
$AccampSQL=$row[2];
|
|
||||||
$AccampSQL = ereg_replace(' -','', $AccampSQL);
|
|
||||||
$AccampSQL = ereg_replace(' ',"','", $AccampSQL);
|
|
||||||
if (eregi('AGENTDIRECT', $AccampSQL))
|
|
||||||
{
|
|
||||||
$AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL);
|
|
||||||
$ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )";
|
|
||||||
}
|
|
||||||
|
|
||||||
### grab the number of calls being placed from this server and campaign
|
|
||||||
$stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);";
|
|
||||||
if ($DB) {echo "|$stmt|\n";}
|
|
||||||
$rslt=mysql_query($stmt, $link);
|
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);}
|
|
||||||
$row=mysql_fetch_row($rslt);
|
|
||||||
$RingCalls=$row[0];
|
|
||||||
if ($RingCalls > 0) {$RingCalls = "<font class=\"queue_text_red\">Chiamate in coda: $RingCalls</font>";}
|
|
||||||
else {$RingCalls = "<font class=\"queue_text\">Chiamate in coda: $RingCalls</font>";}
|
|
||||||
|
|
||||||
### grab the number of calls being placed from this server and campaign
|
|
||||||
$stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );";
|
|
||||||
if ($DB) {echo "|$stmt|\n";}
|
|
||||||
$rslt=mysql_query($stmt, $link);
|
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);}
|
|
||||||
$row=mysql_fetch_row($rslt);
|
|
||||||
$DiaLCalls=$row[0];
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$Alogin='N';
|
|
||||||
$RingCalls='N';
|
|
||||||
$DiaLCalls='N';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$Alogin='N';
|
|
||||||
$RingCalls='N';
|
|
||||||
$DiaLCalls='N';
|
|
||||||
|
|
||||||
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
||||||
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
|
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
|
||||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||||
@@ -410,6 +423,52 @@ echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
|
|||||||
$external_park = $row[11];
|
$external_park = $row[11];
|
||||||
$timer_action_destination = $row[12];
|
$timer_action_destination = $row[12];
|
||||||
|
|
||||||
|
$MDQ_count=0;
|
||||||
|
if ( ($api_manual_dial=='QUEUE') or ($api_manual_dial=='QUEUE_AND_AUTOCALL') )
|
||||||
|
{
|
||||||
|
$stmt="SELECT count(*) FROM vicidial_manual_dial_queue where user='$user' and status='READY';";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03033',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$mdq_count_record_ct = mysql_num_rows($rslt);
|
||||||
|
if ($mdq_count_record_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$MDQ_count = $row[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ($MDQ_count > 0) and (strlen($external_dial) < 16) and ($Astatus=='PAUSED') and ($Alead_id < 1) )
|
||||||
|
{
|
||||||
|
$stmt="SELECT mdq_id,external_dial FROM vicidial_manual_dial_queue where user='$user' and status='READY' order by entry_time limit 1;";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03034',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$mdq_record_ct = mysql_num_rows($rslt);
|
||||||
|
if ($mdq_record_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$MDQ_mdq_id = $row[0];
|
||||||
|
$MDQ_external_dial = $row[1];
|
||||||
|
$external_dial = $MDQ_external_dial;
|
||||||
|
|
||||||
|
$stmt="UPDATE vicidial_manual_dial_queue SET status='QUEUE' where mdq_id='$MDQ_mdq_id';";
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03035',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$UMDQaffected_rows_update = mysql_affected_rows($link);
|
||||||
|
|
||||||
|
if ($UMDQaffected_rows_update > 0)
|
||||||
|
{
|
||||||
|
$stmt="UPDATE vicidial_live_agents SET external_dial='$MDQ_external_dial' where user='$user' and server_ip='$server_ip';";
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03036',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$VLAMDQaffected_rows_update = mysql_affected_rows($link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (strlen($external_status)<1) {$external_status = '::::::::::';}
|
if (strlen($external_status)<1) {$external_status = '::::::::::';}
|
||||||
|
|
||||||
$web_epoch = date("U");
|
$web_epoch = date("U");
|
||||||
@@ -578,7 +637,7 @@ echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
|
|||||||
if ($Ashift_logout > 0)
|
if ($Ashift_logout > 0)
|
||||||
{$Alogin='SHIFT_LOGOUT';}
|
{$Alogin='SHIFT_LOGOUT';}
|
||||||
|
|
||||||
echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Stato: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . '|APIFields: ' . $external_update_fields . '|APIFieldsData: ' . $external_update_fields_data . '|APITimerAction: ' . $timer_action . '|APITimerMessage: ' . $timer_action_message . '|APITimerSeconds: ' . $timer_action_seconds . '|APIdtmf: ' . $external_dtmf . '|APItransferconf: ' . $external_transferconf . '|APIpark: ' . $external_park . '|APITimerDestination: ' . $timer_action_destination . "\n";
|
echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Stato: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . '|APIFields: ' . $external_update_fields . '|APIFieldsData: ' . $external_update_fields_data . '|APITimerAction: ' . $timer_action . '|APITimerMessage: ' . $timer_action_message . '|APITimerSeconds: ' . $timer_action_seconds . '|APIdtmf: ' . $external_dtmf . '|APItransferconf: ' . $external_transferconf . '|APIpark: ' . $external_park . '|APITimerDestination: ' . $timer_action_destination . '|APIManualDialQueue: ' . $MDQ_count . "\n";
|
||||||
|
|
||||||
if (strlen($timer_action) > 3)
|
if (strlen($timer_action) > 3)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/* /!\ DO NOT EDIT THIS FILE !!! Please edit custom.css to keep your customizations after an upgrade /!\ */
|
||||||
|
|
||||||
|
body { padding:0; margin:0; background: #FFF; }
|
||||||
|
|
||||||
|
div.scroll_list { height: 400px; width: 140px; overflow: scroll; }
|
||||||
|
div.text_input { overflow: auto; font-size: 10px; font-family: sans-serif; }
|
||||||
|
.body_text { font-size: 13px; font-family: sans-serif; }
|
||||||
|
.queue_text_red { font-size: 12px; font-family: sans-serif; font-weight: bold; color: red; }
|
||||||
|
.queue_text { font-size: 12px; font-family: sans-serif; color: black; text-decoration:none; }
|
||||||
|
.preview_text { font-size: 13px; font-family: sans-serif; background: #CCFFCC; }
|
||||||
|
.preview_text_red { font-size: 13px; font-family: sans-serif; background: #FFCCCC; }
|
||||||
|
.body_small { font-size: 11px; font-family: sans-serif; }
|
||||||
|
.body_small_bold { font-size: 11px; font-family: sans-serif; font-weight: bold; }
|
||||||
|
.body_tiny { font-size: 10px; font-family: sans-serif; }
|
||||||
|
.log_text { font-size: 11px; font-family: monospace; }
|
||||||
|
.log_text_red { font-size: 11px; font-family: monospace; font-weight: bold; background: #FF3333; }
|
||||||
|
.log_title { font-size: 12px; font-family: monospace; font-weight: bold; }
|
||||||
|
.sd_text { font-size: 16px; font-family: sans-serif; font-weight: bold; }
|
||||||
|
.sh_text { font-size: 14px; font-family: sans-serif; font-weight: bold; }
|
||||||
|
.sb_text { font-size: 12px; font-family: sans-serif; }
|
||||||
|
.sk_text { font-size: 11px; font-family: sans-serif; }
|
||||||
|
.skb_text { font-size: 13px; font-family: sans-serif; font-weight: bold; }
|
||||||
|
.ON_conf { font-size: 11px; font-family: monospace; color: black; background: #FFFF99; }
|
||||||
|
.OFF_conf { font-size: 11px; font-family: monospace; color: black; background: #FFCC77; }
|
||||||
|
.cust_form { font-family: sans-serif; font-size: 10px; overflow: hidden; }
|
||||||
|
.cust_form_text { font-family: sans-serif; font-size: 10px; overflow: auto; }
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
#
|
#
|
||||||
# CHANGES:
|
# CHANGES:
|
||||||
# 100629-1201 - First Build
|
# 100629-1201 - First Build
|
||||||
|
# 101124-0625 - Added lookup_gmt and dialable_gmt functions
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
@@ -496,6 +497,902 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### LOOKUP GMT, FINDS THE CURRENT GMT OFFSET FOR A PHONE NUMBER #####
|
||||||
|
|
||||||
|
function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code)
|
||||||
|
{
|
||||||
|
require("dbconnect.php");
|
||||||
|
|
||||||
|
$postalgmt_found=0;
|
||||||
|
if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) )
|
||||||
|
{
|
||||||
|
if (preg_match('/^1$/', $phone_code))
|
||||||
|
{
|
||||||
|
$stmt="select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
$pc_recs = mysql_num_rows($rslt);
|
||||||
|
if ($pc_recs > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset);
|
||||||
|
$dst = $row[3];
|
||||||
|
$dst_range = $row[4];
|
||||||
|
$PC_processed++;
|
||||||
|
$postalgmt_found++;
|
||||||
|
$post++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($postalgmt_found < 1)
|
||||||
|
{
|
||||||
|
$PC_processed=0;
|
||||||
|
### UNITED STATES ###
|
||||||
|
if ($phone_code =='1')
|
||||||
|
{
|
||||||
|
$stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
$pc_recs = mysql_num_rows($rslt);
|
||||||
|
if ($pc_recs > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset);
|
||||||
|
$dst = $row[5];
|
||||||
|
$dst_range = $row[6];
|
||||||
|
$PC_processed++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
### MEXICO ###
|
||||||
|
if ($phone_code =='52')
|
||||||
|
{
|
||||||
|
$stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
$pc_recs = mysql_num_rows($rslt);
|
||||||
|
if ($pc_recs > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset);
|
||||||
|
$dst = $row[5];
|
||||||
|
$dst_range = $row[6];
|
||||||
|
$PC_processed++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
### AUSTRALIA ###
|
||||||
|
if ($phone_code =='61')
|
||||||
|
{
|
||||||
|
$stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
$pc_recs = mysql_num_rows($rslt);
|
||||||
|
if ($pc_recs > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset);
|
||||||
|
$dst = $row[5];
|
||||||
|
$dst_range = $row[6];
|
||||||
|
$PC_processed++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
### ALL OTHER COUNTRY CODES ###
|
||||||
|
if (!$PC_processed)
|
||||||
|
{
|
||||||
|
$PC_processed++;
|
||||||
|
$stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
$pc_recs = mysql_num_rows($rslt);
|
||||||
|
if ($pc_recs > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset);
|
||||||
|
$dst = $row[5];
|
||||||
|
$dst_range = $row[6];
|
||||||
|
$PC_processed++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
### Find out if DST to raise the gmt offset ###
|
||||||
|
$AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD);
|
||||||
|
$AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear);
|
||||||
|
$hour = date("H",$AC_localtime);
|
||||||
|
$min = date("i",$AC_localtime);
|
||||||
|
$sec = date("s",$AC_localtime);
|
||||||
|
$mon = date("m",$AC_localtime);
|
||||||
|
$mday = date("d",$AC_localtime);
|
||||||
|
$wday = date("w",$AC_localtime);
|
||||||
|
$year = date("Y",$AC_localtime);
|
||||||
|
$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec );
|
||||||
|
|
||||||
|
$AC_processed=0;
|
||||||
|
if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') )
|
||||||
|
{
|
||||||
|
if ($DBX) {print " Second Sunday March to First Sunday November\n";}
|
||||||
|
#**********************************************************************
|
||||||
|
# SSM-FSN
|
||||||
|
# This is returns 1 if Daylight Savings Time is in effect and 0 if
|
||||||
|
# Standard time is in effect.
|
||||||
|
# Based on Second Sunday March to First Sunday November at 2 am.
|
||||||
|
# INPUTS:
|
||||||
|
# mm INTEGER Month.
|
||||||
|
# dd INTEGER Day of the month.
|
||||||
|
# ns INTEGER Seconds into the day.
|
||||||
|
# dow INTEGER Day of week (0=Sunday, to 6=Saturday)
|
||||||
|
# OPTIONAL INPUT:
|
||||||
|
# timezone INTEGER hour difference UTC - local standard time
|
||||||
|
# (DEFAULT is blank)
|
||||||
|
# make calculations based on UTC time,
|
||||||
|
# which means shift at 10:00 UTC in April
|
||||||
|
# and 9:00 UTC in October
|
||||||
|
# OUTPUT:
|
||||||
|
# INTEGER 1 = DST, 0 = not DST
|
||||||
|
#
|
||||||
|
# S M T W T F S
|
||||||
|
# 1 2 3 4 5 6 7
|
||||||
|
# 8 9 10 11 12 13 14
|
||||||
|
#15 16 17 18 19 20 21
|
||||||
|
#22 23 24 25 26 27 28
|
||||||
|
#29 30 31
|
||||||
|
#
|
||||||
|
# S M T W T F S
|
||||||
|
# 1 2 3 4 5 6
|
||||||
|
# 7 8 9 10 11 12 13
|
||||||
|
#14 15 16 17 18 19 20
|
||||||
|
#21 22 23 24 25 26 27
|
||||||
|
#28 29 30 31
|
||||||
|
#
|
||||||
|
#**********************************************************************
|
||||||
|
|
||||||
|
$USACAN_DST=0;
|
||||||
|
$mm = $mon;
|
||||||
|
$dd = $mday;
|
||||||
|
$ns = $dsec;
|
||||||
|
$dow= $wday;
|
||||||
|
|
||||||
|
if ($mm < 3 || $mm > 11) {
|
||||||
|
$USACAN_DST=0;
|
||||||
|
} elseif ($mm >= 4 and $mm <= 10) {
|
||||||
|
$USACAN_DST=1;
|
||||||
|
} elseif ($mm == 3) {
|
||||||
|
if ($dd > 13) {
|
||||||
|
$USACAN_DST=1;
|
||||||
|
} elseif ($dd >= ($dow+8)) {
|
||||||
|
if ($timezone) {
|
||||||
|
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
|
||||||
|
$USACAN_DST=0;
|
||||||
|
} else {
|
||||||
|
$USACAN_DST=1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($dow == 0 and $ns < 7200) {
|
||||||
|
$USACAN_DST=0;
|
||||||
|
} else {
|
||||||
|
$USACAN_DST=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$USACAN_DST=0;
|
||||||
|
}
|
||||||
|
} elseif ($mm == 11) {
|
||||||
|
if ($dd > 7) {
|
||||||
|
$USACAN_DST=0;
|
||||||
|
} elseif ($dd < ($dow+1)) {
|
||||||
|
$USACAN_DST=1;
|
||||||
|
} elseif ($dow == 0) {
|
||||||
|
if ($timezone) { # UTC calculations
|
||||||
|
if ($ns < (7200+($timezone-1)*3600)) {
|
||||||
|
$USACAN_DST=1;
|
||||||
|
} else {
|
||||||
|
$USACAN_DST=0;
|
||||||
|
}
|
||||||
|
} else { # local time calculations
|
||||||
|
if ($ns < 7200) {
|
||||||
|
$USACAN_DST=1;
|
||||||
|
} else {
|
||||||
|
$USACAN_DST=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$USACAN_DST=0;
|
||||||
|
}
|
||||||
|
} # end of month checks
|
||||||
|
if ($DBX) {print " DST: $USACAN_DST\n";}
|
||||||
|
if ($USACAN_DST) {$gmt_offset++;}
|
||||||
|
$AC_processed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') )
|
||||||
|
{
|
||||||
|
if ($DBX) {print " First Sunday April to Last Sunday October\n";}
|
||||||
|
#**********************************************************************
|
||||||
|
# FSA-LSO
|
||||||
|
# This is returns 1 if Daylight Savings Time is in effect and 0 if
|
||||||
|
# Standard time is in effect.
|
||||||
|
# Based on first Sunday in April and last Sunday in October at 2 am.
|
||||||
|
#**********************************************************************
|
||||||
|
|
||||||
|
$USA_DST=0;
|
||||||
|
$mm = $mon;
|
||||||
|
$dd = $mday;
|
||||||
|
$ns = $dsec;
|
||||||
|
$dow= $wday;
|
||||||
|
|
||||||
|
if ($mm < 4 || $mm > 10) {
|
||||||
|
$USA_DST=0;
|
||||||
|
} elseif ($mm >= 5 and $mm <= 9) {
|
||||||
|
$USA_DST=1;
|
||||||
|
} elseif ($mm == 4) {
|
||||||
|
if ($dd > 7) {
|
||||||
|
$USA_DST=1;
|
||||||
|
} elseif ($dd >= ($dow+1)) {
|
||||||
|
if ($timezone) {
|
||||||
|
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
|
||||||
|
$USA_DST=0;
|
||||||
|
} else {
|
||||||
|
$USA_DST=1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($dow == 0 and $ns < 7200) {
|
||||||
|
$USA_DST=0;
|
||||||
|
} else {
|
||||||
|
$USA_DST=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$USA_DST=0;
|
||||||
|
}
|
||||||
|
} elseif ($mm == 10) {
|
||||||
|
if ($dd < 25) {
|
||||||
|
$USA_DST=1;
|
||||||
|
} elseif ($dd < ($dow+25)) {
|
||||||
|
$USA_DST=1;
|
||||||
|
} elseif ($dow == 0) {
|
||||||
|
if ($timezone) { # UTC calculations
|
||||||
|
if ($ns < (7200+($timezone-1)*3600)) {
|
||||||
|
$USA_DST=1;
|
||||||
|
} else {
|
||||||
|
$USA_DST=0;
|
||||||
|
}
|
||||||
|
} else { # local time calculations
|
||||||
|
if ($ns < 7200) {
|
||||||
|
$USA_DST=1;
|
||||||
|
} else {
|
||||||
|
$USA_DST=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$USA_DST=0;
|
||||||
|
}
|
||||||
|
} # end of month checks
|
||||||
|
|
||||||
|
if ($DBX) {print " DST: $USA_DST\n";}
|
||||||
|
if ($USA_DST) {$gmt_offset++;}
|
||||||
|
$AC_processed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') )
|
||||||
|
{
|
||||||
|
if ($DBX) {print " Last Sunday March to Last Sunday October\n";}
|
||||||
|
#**********************************************************************
|
||||||
|
# This is s 1 if Daylight Savings Time is in effect and 0 if
|
||||||
|
# Standard time is in effect.
|
||||||
|
# Based on last Sunday in March and last Sunday in October at 1 am.
|
||||||
|
#**********************************************************************
|
||||||
|
|
||||||
|
$GBR_DST=0;
|
||||||
|
$mm = $mon;
|
||||||
|
$dd = $mday;
|
||||||
|
$ns = $dsec;
|
||||||
|
$dow= $wday;
|
||||||
|
|
||||||
|
if ($mm < 3 || $mm > 10) {
|
||||||
|
$GBR_DST=0;
|
||||||
|
} elseif ($mm >= 4 and $mm <= 9) {
|
||||||
|
$GBR_DST=1;
|
||||||
|
} elseif ($mm == 3) {
|
||||||
|
if ($dd < 25) {
|
||||||
|
$GBR_DST=0;
|
||||||
|
} elseif ($dd < ($dow+25)) {
|
||||||
|
$GBR_DST=0;
|
||||||
|
} elseif ($dow == 0) {
|
||||||
|
if ($timezone) { # UTC calculations
|
||||||
|
if ($ns < (3600+($timezone-1)*3600)) {
|
||||||
|
$GBR_DST=0;
|
||||||
|
} else {
|
||||||
|
$GBR_DST=1;
|
||||||
|
}
|
||||||
|
} else { # local time calculations
|
||||||
|
if ($ns < 3600) {
|
||||||
|
$GBR_DST=0;
|
||||||
|
} else {
|
||||||
|
$GBR_DST=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$GBR_DST=1;
|
||||||
|
}
|
||||||
|
} elseif ($mm == 10) {
|
||||||
|
if ($dd < 25) {
|
||||||
|
$GBR_DST=1;
|
||||||
|
} elseif ($dd < ($dow+25)) {
|
||||||
|
$GBR_DST=1;
|
||||||
|
} elseif ($dow == 0) {
|
||||||
|
if ($timezone) { # UTC calculations
|
||||||
|
if ($ns < (3600+($timezone-1)*3600)) {
|
||||||
|
$GBR_DST=1;
|
||||||
|
} else {
|
||||||
|
$GBR_DST=0;
|
||||||
|
}
|
||||||
|
} else { # local time calculations
|
||||||
|
if ($ns < 3600) {
|
||||||
|
$GBR_DST=1;
|
||||||
|
} else {
|
||||||
|
$GBR_DST=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$GBR_DST=0;
|
||||||
|
}
|
||||||
|
} # end of month checks
|
||||||
|
if ($DBX) {print " DST: $GBR_DST\n";}
|
||||||
|
if ($GBR_DST) {$gmt_offset++;}
|
||||||
|
$AC_processed++;
|
||||||
|
}
|
||||||
|
if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') )
|
||||||
|
{
|
||||||
|
if ($DBX) {print " Last Sunday October to Last Sunday March\n";}
|
||||||
|
#**********************************************************************
|
||||||
|
# This is s 1 if Daylight Savings Time is in effect and 0 if
|
||||||
|
# Standard time is in effect.
|
||||||
|
# Based on last Sunday in October and last Sunday in March at 1 am.
|
||||||
|
#**********************************************************************
|
||||||
|
|
||||||
|
$AUS_DST=0;
|
||||||
|
$mm = $mon;
|
||||||
|
$dd = $mday;
|
||||||
|
$ns = $dsec;
|
||||||
|
$dow= $wday;
|
||||||
|
|
||||||
|
if ($mm < 3 || $mm > 10) {
|
||||||
|
$AUS_DST=1;
|
||||||
|
} elseif ($mm >= 4 and $mm <= 9) {
|
||||||
|
$AUS_DST=0;
|
||||||
|
} elseif ($mm == 3) {
|
||||||
|
if ($dd < 25) {
|
||||||
|
$AUS_DST=1;
|
||||||
|
} elseif ($dd < ($dow+25)) {
|
||||||
|
$AUS_DST=1;
|
||||||
|
} elseif ($dow == 0) {
|
||||||
|
if ($timezone) { # UTC calculations
|
||||||
|
if ($ns < (3600+($timezone-1)*3600)) {
|
||||||
|
$AUS_DST=1;
|
||||||
|
} else {
|
||||||
|
$AUS_DST=0;
|
||||||
|
}
|
||||||
|
} else { # local time calculations
|
||||||
|
if ($ns < 3600) {
|
||||||
|
$AUS_DST=1;
|
||||||
|
} else {
|
||||||
|
$AUS_DST=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$AUS_DST=0;
|
||||||
|
}
|
||||||
|
} elseif ($mm == 10) {
|
||||||
|
if ($dd < 25) {
|
||||||
|
$AUS_DST=0;
|
||||||
|
} elseif ($dd < ($dow+25)) {
|
||||||
|
$AUS_DST=0;
|
||||||
|
} elseif ($dow == 0) {
|
||||||
|
if ($timezone) { # UTC calculations
|
||||||
|
if ($ns < (3600+($timezone-1)*3600)) {
|
||||||
|
$AUS_DST=0;
|
||||||
|
} else {
|
||||||
|
$AUS_DST=1;
|
||||||
|
}
|
||||||
|
} else { # local time calculations
|
||||||
|
if ($ns < 3600) {
|
||||||
|
$AUS_DST=0;
|
||||||
|
} else {
|
||||||
|
$AUS_DST=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$AUS_DST=1;
|
||||||
|
}
|
||||||
|
} # end of month checks
|
||||||
|
if ($DBX) {print " DST: $AUS_DST\n";}
|
||||||
|
if ($AUS_DST) {$gmt_offset++;}
|
||||||
|
$AC_processed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') )
|
||||||
|
{
|
||||||
|
if ($DBX) {print " First Sunday October to Last Sunday March\n";}
|
||||||
|
#**********************************************************************
|
||||||
|
# TASMANIA ONLY
|
||||||
|
# This is s 1 if Daylight Savings Time is in effect and 0 if
|
||||||
|
# Standard time is in effect.
|
||||||
|
# Based on first Sunday in October and last Sunday in March at 1 am.
|
||||||
|
#**********************************************************************
|
||||||
|
|
||||||
|
$AUST_DST=0;
|
||||||
|
$mm = $mon;
|
||||||
|
$dd = $mday;
|
||||||
|
$ns = $dsec;
|
||||||
|
$dow= $wday;
|
||||||
|
|
||||||
|
if ($mm < 3 || $mm > 10) {
|
||||||
|
$AUST_DST=1;
|
||||||
|
} elseif ($mm >= 4 and $mm <= 9) {
|
||||||
|
$AUST_DST=0;
|
||||||
|
} elseif ($mm == 3) {
|
||||||
|
if ($dd < 25) {
|
||||||
|
$AUST_DST=1;
|
||||||
|
} elseif ($dd < ($dow+25)) {
|
||||||
|
$AUST_DST=1;
|
||||||
|
} elseif ($dow == 0) {
|
||||||
|
if ($timezone) { # UTC calculations
|
||||||
|
if ($ns < (3600+($timezone-1)*3600)) {
|
||||||
|
$AUST_DST=1;
|
||||||
|
} else {
|
||||||
|
$AUST_DST=0;
|
||||||
|
}
|
||||||
|
} else { # local time calculations
|
||||||
|
if ($ns < 3600) {
|
||||||
|
$AUST_DST=1;
|
||||||
|
} else {
|
||||||
|
$AUST_DST=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$AUST_DST=0;
|
||||||
|
}
|
||||||
|
} elseif ($mm == 10) {
|
||||||
|
if ($dd > 7) {
|
||||||
|
$AUST_DST=1;
|
||||||
|
} elseif ($dd >= ($dow+1)) {
|
||||||
|
if ($timezone) {
|
||||||
|
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
|
||||||
|
$AUST_DST=0;
|
||||||
|
} else {
|
||||||
|
$AUST_DST=1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($dow == 0 and $ns < 3600) {
|
||||||
|
$AUST_DST=0;
|
||||||
|
} else {
|
||||||
|
$AUST_DST=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$AUST_DST=0;
|
||||||
|
}
|
||||||
|
} # end of month checks
|
||||||
|
if ($DBX) {print " DST: $AUST_DST\n";}
|
||||||
|
if ($AUST_DST) {$gmt_offset++;}
|
||||||
|
$AC_processed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (!$AC_processed) and ($dst_range == 'FSO-FSA') )
|
||||||
|
{
|
||||||
|
if ($DBX) {print " Sunday in October to First Sunday in April\n";}
|
||||||
|
#**********************************************************************
|
||||||
|
# FSO-FSA
|
||||||
|
# 2008+ AUSTRALIA ONLY (country code 61)
|
||||||
|
# This is returns 1 if Daylight Savings Time is in effect and 0 if
|
||||||
|
# Standard time is in effect.
|
||||||
|
# Based on first Sunday in October and first Sunday in April at 1 am.
|
||||||
|
#**********************************************************************
|
||||||
|
|
||||||
|
$AUSE_DST=0;
|
||||||
|
$mm = $mon;
|
||||||
|
$dd = $mday;
|
||||||
|
$ns = $dsec;
|
||||||
|
$dow= $wday;
|
||||||
|
|
||||||
|
if ($mm < 4 or $mm > 10) {
|
||||||
|
$AUSE_DST=1;
|
||||||
|
} elseif ($mm >= 5 and $mm <= 9) {
|
||||||
|
$AUSE_DST=0;
|
||||||
|
} elseif ($mm == 4) {
|
||||||
|
if ($dd > 7) {
|
||||||
|
$AUSE_DST=0;
|
||||||
|
} elseif ($dd >= ($dow+1)) {
|
||||||
|
if ($timezone) {
|
||||||
|
if ($dow == 0 and $ns < (3600+$timezone*3600)) {
|
||||||
|
$AUSE_DST=1;
|
||||||
|
} else {
|
||||||
|
$AUSE_DST=0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($dow == 0 and $ns < 7200) {
|
||||||
|
$AUSE_DST=1;
|
||||||
|
} else {
|
||||||
|
$AUSE_DST=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$AUSE_DST=1;
|
||||||
|
}
|
||||||
|
} elseif ($mm == 10) {
|
||||||
|
if ($dd >= 8) {
|
||||||
|
$AUSE_DST=1;
|
||||||
|
} elseif ($dd >= ($dow+1)) {
|
||||||
|
if ($timezone) {
|
||||||
|
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
|
||||||
|
$AUSE_DST=0;
|
||||||
|
} else {
|
||||||
|
$AUSE_DST=1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($dow == 0 and $ns < 3600) {
|
||||||
|
$AUSE_DST=0;
|
||||||
|
} else {
|
||||||
|
$AUSE_DST=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$AUSE_DST=0;
|
||||||
|
}
|
||||||
|
} # end of month checks
|
||||||
|
if ($DBX) {print " DST: $AUSE_DST\n";}
|
||||||
|
if ($AUSE_DST) {$gmt_offset++;}
|
||||||
|
$AC_processed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') )
|
||||||
|
{
|
||||||
|
if ($DBX) {print " First Sunday October to Third Sunday March\n";}
|
||||||
|
#**********************************************************************
|
||||||
|
# This is s 1 if Daylight Savings Time is in effect and 0 if
|
||||||
|
# Standard time is in effect.
|
||||||
|
# Based on first Sunday in October and third Sunday in March at 1 am.
|
||||||
|
#**********************************************************************
|
||||||
|
|
||||||
|
$NZL_DST=0;
|
||||||
|
$mm = $mon;
|
||||||
|
$dd = $mday;
|
||||||
|
$ns = $dsec;
|
||||||
|
$dow= $wday;
|
||||||
|
|
||||||
|
if ($mm < 3 || $mm > 10) {
|
||||||
|
$NZL_DST=1;
|
||||||
|
} elseif ($mm >= 4 and $mm <= 9) {
|
||||||
|
$NZL_DST=0;
|
||||||
|
} elseif ($mm == 3) {
|
||||||
|
if ($dd < 14) {
|
||||||
|
$NZL_DST=1;
|
||||||
|
} elseif ($dd < ($dow+14)) {
|
||||||
|
$NZL_DST=1;
|
||||||
|
} elseif ($dow == 0) {
|
||||||
|
if ($timezone) { # UTC calculations
|
||||||
|
if ($ns < (3600+($timezone-1)*3600)) {
|
||||||
|
$NZL_DST=1;
|
||||||
|
} else {
|
||||||
|
$NZL_DST=0;
|
||||||
|
}
|
||||||
|
} else { # local time calculations
|
||||||
|
if ($ns < 3600) {
|
||||||
|
$NZL_DST=1;
|
||||||
|
} else {
|
||||||
|
$NZL_DST=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$NZL_DST=0;
|
||||||
|
}
|
||||||
|
} elseif ($mm == 10) {
|
||||||
|
if ($dd > 7) {
|
||||||
|
$NZL_DST=1;
|
||||||
|
} elseif ($dd >= ($dow+1)) {
|
||||||
|
if ($timezone) {
|
||||||
|
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
|
||||||
|
$NZL_DST=0;
|
||||||
|
} else {
|
||||||
|
$NZL_DST=1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($dow == 0 and $ns < 3600) {
|
||||||
|
$NZL_DST=0;
|
||||||
|
} else {
|
||||||
|
$NZL_DST=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$NZL_DST=0;
|
||||||
|
}
|
||||||
|
} # end of month checks
|
||||||
|
if ($DBX) {print " DST: $NZL_DST\n";}
|
||||||
|
if ($NZL_DST) {$gmt_offset++;}
|
||||||
|
$AC_processed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (!$AC_processed) and ($dst_range == 'LSS-FSA') )
|
||||||
|
{
|
||||||
|
if ($DBX) {print " Last Sunday in September to First Sunday in April\n";}
|
||||||
|
#**********************************************************************
|
||||||
|
# LSS-FSA
|
||||||
|
# 2007+ NEW ZEALAND (country code 64)
|
||||||
|
# This is returns 1 if Daylight Savings Time is in effect and 0 if
|
||||||
|
# Standard time is in effect.
|
||||||
|
# Based on last Sunday in September and first Sunday in April at 1 am.
|
||||||
|
#**********************************************************************
|
||||||
|
|
||||||
|
$NZLN_DST=0;
|
||||||
|
$mm = $mon;
|
||||||
|
$dd = $mday;
|
||||||
|
$ns = $dsec;
|
||||||
|
$dow= $wday;
|
||||||
|
|
||||||
|
if ($mm < 4 || $mm > 9) {
|
||||||
|
$NZLN_DST=1;
|
||||||
|
} elseif ($mm >= 5 && $mm <= 9) {
|
||||||
|
$NZLN_DST=0;
|
||||||
|
} elseif ($mm == 4) {
|
||||||
|
if ($dd > 7) {
|
||||||
|
$NZLN_DST=0;
|
||||||
|
} elseif ($dd >= ($dow+1)) {
|
||||||
|
if ($timezone) {
|
||||||
|
if ($dow == 0 && $ns < (3600+$timezone*3600)) {
|
||||||
|
$NZLN_DST=1;
|
||||||
|
} else {
|
||||||
|
$NZLN_DST=0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($dow == 0 && $ns < 7200) {
|
||||||
|
$NZLN_DST=1;
|
||||||
|
} else {
|
||||||
|
$NZLN_DST=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$NZLN_DST=1;
|
||||||
|
}
|
||||||
|
} elseif ($mm == 9) {
|
||||||
|
if ($dd < 25) {
|
||||||
|
$NZLN_DST=0;
|
||||||
|
} elseif ($dd < ($dow+25)) {
|
||||||
|
$NZLN_DST=0;
|
||||||
|
} elseif ($dow == 0) {
|
||||||
|
if ($timezone) { # UTC calculations
|
||||||
|
if ($ns < (3600+($timezone-1)*3600)) {
|
||||||
|
$NZLN_DST=0;
|
||||||
|
} else {
|
||||||
|
$NZLN_DST=1;
|
||||||
|
}
|
||||||
|
} else { # local time calculations
|
||||||
|
if ($ns < 3600) {
|
||||||
|
$NZLN_DST=0;
|
||||||
|
} else {
|
||||||
|
$NZLN_DST=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$NZLN_DST=1;
|
||||||
|
}
|
||||||
|
} # end of month checks
|
||||||
|
if ($DBX) {print " DST: $NZLN_DST\n";}
|
||||||
|
if ($NZLN_DST) {$gmt_offset++;}
|
||||||
|
$AC_processed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') )
|
||||||
|
{
|
||||||
|
if ($DBX) {print " Third Sunday October to Last Sunday February\n";}
|
||||||
|
#**********************************************************************
|
||||||
|
# TSO-LSF
|
||||||
|
# This is returns 1 if Daylight Savings Time is in effect and 0 if
|
||||||
|
# Standard time is in effect. Brazil
|
||||||
|
# Based on Third Sunday October to Last Sunday February at 1 am.
|
||||||
|
#**********************************************************************
|
||||||
|
|
||||||
|
$BZL_DST=0;
|
||||||
|
$mm = $mon;
|
||||||
|
$dd = $mday;
|
||||||
|
$ns = $dsec;
|
||||||
|
$dow= $wday;
|
||||||
|
|
||||||
|
if ($mm < 2 || $mm > 10) {
|
||||||
|
$BZL_DST=1;
|
||||||
|
} elseif ($mm >= 3 and $mm <= 9) {
|
||||||
|
$BZL_DST=0;
|
||||||
|
} elseif ($mm == 2) {
|
||||||
|
if ($dd < 22) {
|
||||||
|
$BZL_DST=1;
|
||||||
|
} elseif ($dd < ($dow+22)) {
|
||||||
|
$BZL_DST=1;
|
||||||
|
} elseif ($dow == 0) {
|
||||||
|
if ($timezone) { # UTC calculations
|
||||||
|
if ($ns < (3600+($timezone-1)*3600)) {
|
||||||
|
$BZL_DST=1;
|
||||||
|
} else {
|
||||||
|
$BZL_DST=0;
|
||||||
|
}
|
||||||
|
} else { # local time calculations
|
||||||
|
if ($ns < 3600) {
|
||||||
|
$BZL_DST=1;
|
||||||
|
} else {
|
||||||
|
$BZL_DST=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$BZL_DST=0;
|
||||||
|
}
|
||||||
|
} elseif ($mm == 10) {
|
||||||
|
if ($dd < 22) {
|
||||||
|
$BZL_DST=0;
|
||||||
|
} elseif ($dd < ($dow+22)) {
|
||||||
|
$BZL_DST=0;
|
||||||
|
} elseif ($dow == 0) {
|
||||||
|
if ($timezone) { # UTC calculations
|
||||||
|
if ($ns < (3600+($timezone-1)*3600)) {
|
||||||
|
$BZL_DST=0;
|
||||||
|
} else {
|
||||||
|
$BZL_DST=1;
|
||||||
|
}
|
||||||
|
} else { # local time calculations
|
||||||
|
if ($ns < 3600) {
|
||||||
|
$BZL_DST=0;
|
||||||
|
} else {
|
||||||
|
$BZL_DST=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$BZL_DST=1;
|
||||||
|
}
|
||||||
|
} # end of month checks
|
||||||
|
if ($DBX) {print " DST: $BZL_DST\n";}
|
||||||
|
if ($BZL_DST) {$gmt_offset++;}
|
||||||
|
$AC_processed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$AC_processed)
|
||||||
|
{
|
||||||
|
if ($DBX) {print " No DST Method Found\n";}
|
||||||
|
if ($DBX) {print " DST: 0\n";}
|
||||||
|
$AC_processed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $gmt_offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### DETERMINE IF LEAD IS DIALABLE #####
|
||||||
|
function dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state)
|
||||||
|
{
|
||||||
|
require("dbconnect.php");
|
||||||
|
|
||||||
|
$dialable=0;
|
||||||
|
|
||||||
|
$pzone=3600 * $gmt_offset;
|
||||||
|
$pmin=(gmdate("i", time() + $pzone));
|
||||||
|
$phour=( (gmdate("G", time() + $pzone)) * 100);
|
||||||
|
$pday=gmdate("w", time() + $pzone);
|
||||||
|
$tz = sprintf("%.2f", $p);
|
||||||
|
$GMT_gmt = "$tz";
|
||||||
|
$GMT_day = "$pday";
|
||||||
|
$GMT_hour = ($phour + $pmin);
|
||||||
|
|
||||||
|
$stmt="SELECT call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times FROM vicidial_call_times where call_time_id='$local_call_time';";
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
$rowx=mysql_fetch_row($rslt);
|
||||||
|
$Gct_default_start = $rowx[3];
|
||||||
|
$Gct_default_stop = $rowx[4];
|
||||||
|
$Gct_sunday_start = $rowx[5];
|
||||||
|
$Gct_sunday_stop = $rowx[6];
|
||||||
|
$Gct_monday_start = $rowx[7];
|
||||||
|
$Gct_monday_stop = $rowx[8];
|
||||||
|
$Gct_tuesday_start = $rowx[9];
|
||||||
|
$Gct_tuesday_stop = $rowx[10];
|
||||||
|
$Gct_wednesday_start = $rowx[11];
|
||||||
|
$Gct_wednesday_stop = $rowx[12];
|
||||||
|
$Gct_thursday_start = $rowx[13];
|
||||||
|
$Gct_thursday_stop = $rowx[14];
|
||||||
|
$Gct_friday_start = $rowx[15];
|
||||||
|
$Gct_friday_stop = $rowx[16];
|
||||||
|
$Gct_saturday_start = $rowx[17];
|
||||||
|
$Gct_saturday_stop = $rowx[18];
|
||||||
|
$Gct_state_call_times = $rowx[19];
|
||||||
|
|
||||||
|
if ($GMT_day==0) #### Sunday local time
|
||||||
|
{
|
||||||
|
if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0))
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_sunday_start) and ($GMT_hour<$Gct_sunday_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($GMT_day==1) #### Monday local time
|
||||||
|
{
|
||||||
|
if (($Gct_monday_start==0) and ($Gct_monday_stop==0))
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_monday_start) and ($GMT_hour<$Gct_monday_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($GMT_day==2) #### Tuesday local time
|
||||||
|
{
|
||||||
|
if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0))
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_tuesday_start) and ($GMT_hour<$Gct_tuesday_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($GMT_day==3) #### Wednesday local time
|
||||||
|
{
|
||||||
|
if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0))
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_wednesday_start) and ($GMT_hour<$Gct_wednesday_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($GMT_day==4) #### Thursday local time
|
||||||
|
{
|
||||||
|
if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0))
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_thursday_start) and ($GMT_hour<$Gct_thursday_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($GMT_day==5) #### Friday local time
|
||||||
|
{
|
||||||
|
if (($Gct_friday_start==0) and ($Gct_friday_stop==0))
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_friday_start) and ($GMT_hour<$Gct_friday_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($GMT_day==6) #### Saturday local time
|
||||||
|
{
|
||||||
|
if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0))
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( ($GMT_hour>=$Gct_saturday_start) and ($GMT_hour<$Gct_saturday_stop) )
|
||||||
|
{$dialable=1;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $dialable;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##### MySQL Error Logging #####
|
##### MySQL Error Logging #####
|
||||||
function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log)
|
function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
# manager_send.php version 2.4
|
# manager_send.php version 2.4
|
||||||
#
|
#
|
||||||
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||||
#
|
#
|
||||||
# This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server
|
# This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server
|
||||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||||
@@ -43,6 +43,8 @@
|
|||||||
# - $nodeletevdac - ('0','1')
|
# - $nodeletevdac - ('0','1')
|
||||||
# - $alertCID - ('0','1')
|
# - $alertCID - ('0','1')
|
||||||
# - $preset_name = ('TESTING PRESET',...)
|
# - $preset_name = ('TESTING PRESET',...)
|
||||||
|
# - $call_variables = ('Variable: vendor_lead_code=1234|campaign=TESTCAMP|...')
|
||||||
|
# - $log_campaign
|
||||||
#
|
#
|
||||||
# CHANGELOG:
|
# CHANGELOG:
|
||||||
# 50401-1002 - First build of script, Hangup function only
|
# 50401-1002 - First build of script, Hangup function only
|
||||||
@@ -102,12 +104,15 @@
|
|||||||
# 100813-0833 - Added preset_name variable and logging
|
# 100813-0833 - Added preset_name variable and logging
|
||||||
# 101004-1345 - Added Ivr park functions
|
# 101004-1345 - Added Ivr park functions
|
||||||
# 101024-1638 - Added park_log logging for parked calls
|
# 101024-1638 - Added park_log logging for parked calls
|
||||||
|
# 101107-2331 - Added CALLERONHOLD/CALLEROFFHOLD queue_log entries
|
||||||
|
# 101125-1018 - Added call_variables Originate variables
|
||||||
|
# 110224-1710 - Added compatibility with QM phone environment logging
|
||||||
#
|
#
|
||||||
|
|
||||||
$version = '2.4-52';
|
$version = '2.4-55';
|
||||||
$build = '101024-1638';
|
$build = '110224-1710';
|
||||||
$mel=1; # Mysql Error Log enabled = 1
|
$mel=1; # Mysql Error Log enabled = 1
|
||||||
$mysql_log_count=97;
|
$mysql_log_count=116;
|
||||||
$one_mysql_log=0;
|
$one_mysql_log=0;
|
||||||
|
|
||||||
require("dbconnect.php");
|
require("dbconnect.php");
|
||||||
@@ -197,6 +202,10 @@ if (isset($_GET["alertCID"])) {$alertCID=$_GET["alertCID"];}
|
|||||||
elseif (isset($_POST["alertCID"])) {$alertCID=$_POST["alertCID"];}
|
elseif (isset($_POST["alertCID"])) {$alertCID=$_POST["alertCID"];}
|
||||||
if (isset($_GET["preset_name"])) {$preset_name=$_GET["preset_name"];}
|
if (isset($_GET["preset_name"])) {$preset_name=$_GET["preset_name"];}
|
||||||
elseif (isset($_POST["preset_name"])) {$preset_name=$_POST["preset_name"];}
|
elseif (isset($_POST["preset_name"])) {$preset_name=$_POST["preset_name"];}
|
||||||
|
if (isset($_GET["call_variables"])) {$call_variables=$_GET["call_variables"];}
|
||||||
|
elseif (isset($_POST["call_variables"])) {$call_variables=$_POST["call_variables"];}
|
||||||
|
if (isset($_GET["log_campaign"])) {$log_campaign=$_GET["log_campaign"];}
|
||||||
|
elseif (isset($_POST["log_campaign"])) {$log_campaign=$_POST["log_campaign"];}
|
||||||
|
|
||||||
|
|
||||||
header ("Content-type: text/html; charset=utf-8");
|
header ("Content-type: text/html; charset=utf-8");
|
||||||
@@ -437,10 +446,12 @@ if ($ACTION=="Originate")
|
|||||||
{
|
{
|
||||||
$RAWaccount = $account;
|
$RAWaccount = $account;
|
||||||
$account = "Account: $account";
|
$account = "Account: $account";
|
||||||
$variable = "Variable: usegroupalias=1";
|
$variable = "Variable: _usegroupalias=1";
|
||||||
|
if (strlen($call_variables)>9)
|
||||||
|
{$variable = "Variable: _usegroupalias=1";} # |$call_variables
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{$account=''; $variable='';}
|
{$variable=''; $account="Variable: $call_variables";}
|
||||||
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','$account','$variable','','','');";
|
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','$account','$variable','','','');";
|
||||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||||
$rslt=mysql_query($stmt, $link);
|
$rslt=mysql_query($stmt, $link);
|
||||||
@@ -712,8 +723,20 @@ if ($ACTION=="Hangup")
|
|||||||
if ($time_id > 100000)
|
if ($time_id > 100000)
|
||||||
{$secondS = ($StarTtime - $time_id);}
|
{$secondS = ($StarTtime - $time_id);}
|
||||||
|
|
||||||
|
$data4SQL='';
|
||||||
|
$stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$log_campaign' and queuemetrics_phone_environment!='';";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02116',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$cqpe_ct = mysql_num_rows($rslt);
|
||||||
|
if ($cqpe_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$data4SQL = ",data4='$row[0]'";
|
||||||
|
}
|
||||||
|
|
||||||
if ($format=='debug') {echo "\n<!-- $caller_complete|$stmt -->";}
|
if ($format=='debug') {echo "\n<!-- $caller_complete|$stmt -->";}
|
||||||
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id';";
|
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id' $data4SQL;";
|
||||||
$rslt=mysql_query($stmt, $linkB);
|
$rslt=mysql_query($stmt, $linkB);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02019',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02019',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
$affected_rows = mysql_affected_rows($linkB);
|
$affected_rows = mysql_affected_rows($linkB);
|
||||||
@@ -842,7 +865,60 @@ if ($ACTION=="RedirectToPark")
|
|||||||
$stmt = "INSERT INTO park_log SET uniqueid='$uniqueid',status='ATTESAED',channel='$channel',channel_group='$campaign',server_ip='$server_ip',parked_time='$NOW_TIME',parked_sec=0,extension='$CalLCID',user='$user',lead_id='$lead_id';";
|
$stmt = "INSERT INTO park_log SET uniqueid='$uniqueid',status='ATTESAED',channel='$channel',channel_group='$campaign',server_ip='$server_ip',parked_time='$NOW_TIME',parked_sec=0,extension='$CalLCID',user='$user',lead_id='$lead_id';";
|
||||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||||
$rslt=mysql_query($stmt, $link);
|
$rslt=mysql_query($stmt, $link);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02098',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
|
||||||
|
|
||||||
|
#############################################
|
||||||
|
##### START QUEUEMETRICS LOGGING LOOKUP #####
|
||||||
|
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02099',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
if ($format=='debug') {echo "\n<!-- $rowx[0]|$stmt -->";}
|
||||||
|
$qm_conf_ct = mysql_num_rows($rslt);
|
||||||
|
$i=0;
|
||||||
|
while ($i < $qm_conf_ct)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$enable_queuemetrics_logging = $row[0];
|
||||||
|
$queuemetrics_server_ip = $row[1];
|
||||||
|
$queuemetrics_dbname = $row[2];
|
||||||
|
$queuemetrics_login = $row[3];
|
||||||
|
$queuemetrics_pass = $row[4];
|
||||||
|
$queuemetrics_log_id = $row[5];
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
##### END QUEUEMETRICS LOGGING LOOKUP #####
|
||||||
|
###########################################
|
||||||
|
if ($enable_queuemetrics_logging > 0)
|
||||||
|
{
|
||||||
|
$linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass");
|
||||||
|
mysql_select_db("$queuemetrics_dbname", $linkB);
|
||||||
|
|
||||||
|
$time_id=0;
|
||||||
|
$stmt="SELECT time_id,queue,agent from queue_log where call_id='$CalLCID' and verb='CONNECT' order by time_id desc limit 1;";
|
||||||
|
$rslt=mysql_query($stmt, $linkB);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02100',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$VAC_eq_ct = mysql_num_rows($rslt);
|
||||||
|
if ($VAC_eq_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$time_id = $row[0];
|
||||||
|
$queue = $row[1];
|
||||||
|
$agent = $row[2];
|
||||||
|
}
|
||||||
|
$StarTtime = date("U");
|
||||||
|
if ($time_id > 100000)
|
||||||
|
{$secondS = ($StarTtime - $time_id);}
|
||||||
|
|
||||||
|
if ($VAC_eq_ct > 0)
|
||||||
|
{
|
||||||
|
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$queue',agent='Agent/$user',verb='CALLERONHOLD',data1='ATTESA',serverid='$queuemetrics_log_id';";
|
||||||
|
$rslt=mysql_query($stmt, $linkB);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02101',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$affected_rows = mysql_affected_rows($linkB);
|
||||||
|
if ($format=='debug') {echo "\n<!-- $affected_rows|$stmt -->";}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# $fp = fopen ("./vicidial_debug.txt", "a");
|
# $fp = fopen ("./vicidial_debug.txt", "a");
|
||||||
# fwrite ($fp, "$NOW_TIME|MS_LOG_0|$queryCID|$stmt|\n");
|
# fwrite ($fp, "$NOW_TIME|MS_LOG_0|$queryCID|$stmt|\n");
|
||||||
@@ -880,7 +956,7 @@ if ($ACTION=="RedirectFromPark")
|
|||||||
$parked_sec=0;
|
$parked_sec=0;
|
||||||
$stmt = "SELECT UNIX_TIMESTAMP(parked_time) FROM park_log where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' and (parked_sec < 1 or grab_time is NULL) order by parked_time desc limit 1;";
|
$stmt = "SELECT UNIX_TIMESTAMP(parked_time) FROM park_log where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' and (parked_sec < 1 or grab_time is NULL) order by parked_time desc limit 1;";
|
||||||
$rslt=mysql_query($stmt, $link);
|
$rslt=mysql_query($stmt, $link);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02102',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
$VAC_pl_ct = mysql_num_rows($rslt);
|
$VAC_pl_ct = mysql_num_rows($rslt);
|
||||||
if ($VAC_pl_ct > 0)
|
if ($VAC_pl_ct > 0)
|
||||||
{
|
{
|
||||||
@@ -890,7 +966,59 @@ if ($ACTION=="RedirectFromPark")
|
|||||||
$stmt = "UPDATE park_log SET status='GRABBED',grab_time='$NOW_TIME',parked_sec='$parked_sec' where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' order by parked_time desc limit 1;";
|
$stmt = "UPDATE park_log SET status='GRABBED',grab_time='$NOW_TIME',parked_sec='$parked_sec' where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' order by parked_time desc limit 1;";
|
||||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||||
$rslt=mysql_query($stmt, $link);
|
$rslt=mysql_query($stmt, $link);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02103',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
|
||||||
|
#############################################
|
||||||
|
##### START QUEUEMETRICS LOGGING LOOKUP #####
|
||||||
|
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02104',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
if ($format=='debug') {echo "\n<!-- $rowx[0]|$stmt -->";}
|
||||||
|
$qm_conf_ct = mysql_num_rows($rslt);
|
||||||
|
$i=0;
|
||||||
|
while ($i < $qm_conf_ct)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$enable_queuemetrics_logging = $row[0];
|
||||||
|
$queuemetrics_server_ip = $row[1];
|
||||||
|
$queuemetrics_dbname = $row[2];
|
||||||
|
$queuemetrics_login = $row[3];
|
||||||
|
$queuemetrics_pass = $row[4];
|
||||||
|
$queuemetrics_log_id = $row[5];
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
##### END QUEUEMETRICS LOGGING LOOKUP #####
|
||||||
|
###########################################
|
||||||
|
if ($enable_queuemetrics_logging > 0)
|
||||||
|
{
|
||||||
|
$linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass");
|
||||||
|
mysql_select_db("$queuemetrics_dbname", $linkB);
|
||||||
|
|
||||||
|
$time_id=0;
|
||||||
|
$stmt="SELECT time_id,queue,agent from queue_log where call_id='$CalLCID' and verb='CONNECT' order by time_id desc limit 1;";
|
||||||
|
$rslt=mysql_query($stmt, $linkB);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02105',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$VAC_eq_ct = mysql_num_rows($rslt);
|
||||||
|
if ($VAC_eq_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$time_id = $row[0];
|
||||||
|
$queue = $row[1];
|
||||||
|
$agent = $row[2];
|
||||||
|
}
|
||||||
|
$StarTtime = date("U");
|
||||||
|
if ($time_id > 100000)
|
||||||
|
{$secondS = ($StarTtime - $time_id);}
|
||||||
|
|
||||||
|
if ($VAC_eq_ct > 0)
|
||||||
|
{
|
||||||
|
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$queue',agent='Agent/$user',verb='CALLEROFFHOLD',data1='$parked_sec',data2='ATTESA',serverid='$queuemetrics_log_id';";
|
||||||
|
$rslt=mysql_query($stmt, $linkB);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02106',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$affected_rows = mysql_affected_rows($linkB);
|
||||||
|
if ($format=='debug') {echo "\n<!-- $affected_rows|$stmt -->";}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -932,8 +1060,59 @@ if ($ACTION=="RedirectToParkIVR")
|
|||||||
$stmt = "INSERT INTO park_log SET uniqueid='$uniqueid',status='IVRATTESAED',channel='$channel',channel_group='$campaign',server_ip='$server_ip',parked_time='$NOW_TIME',parked_sec=0,extension='$CalLCID',user='$user',lead_id='$lead_id';";
|
$stmt = "INSERT INTO park_log SET uniqueid='$uniqueid',status='IVRATTESAED',channel='$channel',channel_group='$campaign',server_ip='$server_ip',parked_time='$NOW_TIME',parked_sec=0,extension='$CalLCID',user='$user',lead_id='$lead_id';";
|
||||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||||
$rslt=mysql_query($stmt, $link);
|
$rslt=mysql_query($stmt, $link);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02107',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
|
||||||
|
#############################################
|
||||||
|
##### START QUEUEMETRICS LOGGING LOOKUP #####
|
||||||
|
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02108',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
if ($format=='debug') {echo "\n<!-- $rowx[0]|$stmt -->";}
|
||||||
|
$qm_conf_ct = mysql_num_rows($rslt);
|
||||||
|
$i=0;
|
||||||
|
while ($i < $qm_conf_ct)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$enable_queuemetrics_logging = $row[0];
|
||||||
|
$queuemetrics_server_ip = $row[1];
|
||||||
|
$queuemetrics_dbname = $row[2];
|
||||||
|
$queuemetrics_login = $row[3];
|
||||||
|
$queuemetrics_pass = $row[4];
|
||||||
|
$queuemetrics_log_id = $row[5];
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
##### END QUEUEMETRICS LOGGING LOOKUP #####
|
||||||
|
###########################################
|
||||||
|
if ($enable_queuemetrics_logging > 0)
|
||||||
|
{
|
||||||
|
$linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass");
|
||||||
|
mysql_select_db("$queuemetrics_dbname", $linkB);
|
||||||
|
|
||||||
|
$time_id=0;
|
||||||
|
$stmt="SELECT time_id,queue,agent from queue_log where call_id='$CalLCID' and verb='CONNECT' order by time_id desc limit 1;";
|
||||||
|
$rslt=mysql_query($stmt, $linkB);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02109',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$VAC_eq_ct = mysql_num_rows($rslt);
|
||||||
|
if ($VAC_eq_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$time_id = $row[0];
|
||||||
|
$queue = $row[1];
|
||||||
|
$agent = $row[2];
|
||||||
|
}
|
||||||
|
$StarTtime = date("U");
|
||||||
|
if ($time_id > 100000)
|
||||||
|
{$secondS = ($StarTtime - $time_id);}
|
||||||
|
|
||||||
|
if ($VAC_eq_ct > 0)
|
||||||
|
{
|
||||||
|
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$queue',agent='Agent/$user',verb='CALLERONHOLD',data1='IVRATTESA',serverid='$queuemetrics_log_id';";
|
||||||
|
$rslt=mysql_query($stmt, $linkB);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02110',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$affected_rows = mysql_affected_rows($linkB);
|
||||||
|
if ($format=='debug') {echo "\n<!-- $affected_rows|$stmt -->";}
|
||||||
|
}
|
||||||
|
}
|
||||||
# $fp = fopen ("./vicidial_debug.txt", "a");
|
# $fp = fopen ("./vicidial_debug.txt", "a");
|
||||||
# fwrite ($fp, "$NOW_TIME|MS_LOG_0|$queryCID|$stmt|\n");
|
# fwrite ($fp, "$NOW_TIME|MS_LOG_0|$queryCID|$stmt|\n");
|
||||||
# fclose($fp);
|
# fclose($fp);
|
||||||
@@ -975,7 +1154,7 @@ if ($ACTION=="RedirectFromParkIVR")
|
|||||||
$parked_sec=0;
|
$parked_sec=0;
|
||||||
$stmt = "SELECT UNIX_TIMESTAMP(parked_time) FROM park_log where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' and (parked_sec < 1 or grab_time is NULL) order by parked_time desc limit 1;";
|
$stmt = "SELECT UNIX_TIMESTAMP(parked_time) FROM park_log where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' and (parked_sec < 1 or grab_time is NULL) order by parked_time desc limit 1;";
|
||||||
$rslt=mysql_query($stmt, $link);
|
$rslt=mysql_query($stmt, $link);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02111',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
$VAC_pl_ct = mysql_num_rows($rslt);
|
$VAC_pl_ct = mysql_num_rows($rslt);
|
||||||
if ($VAC_pl_ct > 0)
|
if ($VAC_pl_ct > 0)
|
||||||
{
|
{
|
||||||
@@ -985,7 +1164,59 @@ if ($ACTION=="RedirectFromParkIVR")
|
|||||||
$stmt = "UPDATE park_log SET status='GRABBEDIVR',grab_time='$NOW_TIME',parked_sec='$parked_sec' where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' order by parked_time desc limit 1;";
|
$stmt = "UPDATE park_log SET status='GRABBEDIVR',grab_time='$NOW_TIME',parked_sec='$parked_sec' where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' order by parked_time desc limit 1;";
|
||||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||||
$rslt=mysql_query($stmt, $link);
|
$rslt=mysql_query($stmt, $link);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02112',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
|
||||||
|
#############################################
|
||||||
|
##### START QUEUEMETRICS LOGGING LOOKUP #####
|
||||||
|
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;";
|
||||||
|
$rslt=mysql_query($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02113',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
if ($format=='debug') {echo "\n<!-- $rowx[0]|$stmt -->";}
|
||||||
|
$qm_conf_ct = mysql_num_rows($rslt);
|
||||||
|
$i=0;
|
||||||
|
while ($i < $qm_conf_ct)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$enable_queuemetrics_logging = $row[0];
|
||||||
|
$queuemetrics_server_ip = $row[1];
|
||||||
|
$queuemetrics_dbname = $row[2];
|
||||||
|
$queuemetrics_login = $row[3];
|
||||||
|
$queuemetrics_pass = $row[4];
|
||||||
|
$queuemetrics_log_id = $row[5];
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
##### END QUEUEMETRICS LOGGING LOOKUP #####
|
||||||
|
###########################################
|
||||||
|
if ($enable_queuemetrics_logging > 0)
|
||||||
|
{
|
||||||
|
$linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass");
|
||||||
|
mysql_select_db("$queuemetrics_dbname", $linkB);
|
||||||
|
|
||||||
|
$time_id=0;
|
||||||
|
$stmt="SELECT time_id,queue,agent from queue_log where call_id='$CalLCID' and verb='CONNECT' order by time_id desc limit 1;";
|
||||||
|
$rslt=mysql_query($stmt, $linkB);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02114',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$VAC_eq_ct = mysql_num_rows($rslt);
|
||||||
|
if ($VAC_eq_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysql_fetch_row($rslt);
|
||||||
|
$time_id = $row[0];
|
||||||
|
$queue = $row[1];
|
||||||
|
$agent = $row[2];
|
||||||
|
}
|
||||||
|
$StarTtime = date("U");
|
||||||
|
if ($time_id > 100000)
|
||||||
|
{$secondS = ($StarTtime - $time_id);}
|
||||||
|
|
||||||
|
if ($VAC_eq_ct > 0)
|
||||||
|
{
|
||||||
|
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$queue',agent='Agent/$user',verb='CALLEROFFHOLD',data1='$parked_sec',data2='IVRATTESA',serverid='$queuemetrics_log_id';";
|
||||||
|
$rslt=mysql_query($stmt, $linkB);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02115',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$affected_rows = mysql_affected_rows($linkB);
|
||||||
|
if ($format=='debug') {echo "\n<!-- $affected_rows|$stmt -->";}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1494
-202
File diff suppressed because it is too large
Load Diff
+2220
-1155
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user