LICENSE: GPLv2 ### # this is the closer popup of a specific call that grabs the call and allows you to go and fetch info on that caller in the local CRM system. require("dbconnect.php"); $PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; $PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; $PHP_SELF=$_SERVER['PHP_SELF']; $group=$_GET["group"]; if (!$group) {$group=$_POST["group"];} $group_selected=$_GET["group_selected"]; if (!$group_selected) {$group_selected=$_POST["group_selected"];} $dialplan_number=$_GET["dialplan_number"]; if (!$dialplan_number) {$dialplan_number=$_POST["dialplan_number"];} $extension=$_GET["extension"]; if (!$extension) {$extension=$_POST["extension"];} $groupselect=$_GET["groupselect"]; if (!$groupselect) {$groupselect=$_POST["groupselect"];} $PHONE_LOGIN=$_GET["PHONE_LOGIN"]; if (!$PHONE_LOGIN) {$PHONE_LOGIN=$_POST["PHONE_LOGIN"];} $server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];} $DB=$_GET["DB"]; if (!$DB) {$DB=$_POST["DB"];} $user=$_GET["user"]; if (!$user) {$user=$_POST["user"];} $channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];} $parked_time=$_GET["parked_time"]; if (!$parked_time) {$parked_time=$_POST["parked_time"];} $channel_group=$_GET["channel_group"]; if (!$channel_group) {$channel_group=$_POST["channel_group"];} $debugvars=$_GET["debugvars"]; if (!$debugvars) {$debugvars=$_POST["debugvars"];} $parked_by=$_GET["parked_by"]; if (!$parked_by) {$parked_by=$_POST["parked_by"];} $submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} $SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} #$DB=1; $US = '_'; $STARTtime = date("U"); $TODAY = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $REC_TIME = date("Ymd-His"); $FILE_datetime = $STARTtime; $ext_context = 'demo'; $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $auth=$row[0]; $fp = fopen ("./project_auth_entries.txt", "a"); $date = date("r"); $ip = getenv("REMOTE_ADDR"); $browser = getenv("HTTP_USER_AGENT"); if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) { Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); Header("HTTP/1.0 401 Unauthorized"); echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; exit; } else { if($auth>0) { $office_no=strtoupper($PHP_AUTH_USER); $password=strtoupper($PHP_AUTH_PW); $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $LOGfullname=$row[0]; $fullname = $row[0]; fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); fclose($fp); } else { fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); fclose($fp); } } echo "\n"; echo "\n"; echo "VICIDIAL CLOSER: Popup\n"; if (eregi('CL_UNIV',$channel_group)) { ?> \n"; echo "function WaitFirefix() {setTimeout(document.forms[0].search_phone.focus(), 1000)}\n"; echo "\n"; } ?>
0) { $stmt="DELETE from parked_channels where server_ip='$server_ip' and parked_time='$parked_time' and channel='$channel' LIMIT 1"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); #$monitor_channel = eregi_replace('Zap/', "", $channel); $monitor_channel = eregi_replace('-1', "", $channel); $SIPexten = $extension; $filename = "$REC_TIME$US$SIPexten"; $DTqueryCID = "RR$FILE_datetime$PHP_AUTH_USER"; # $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Monitor','$DTqueryCID','Channel: $monitor_channel','File: $filename','Callerid: $DTqueryCID','','','','','','','')"; # if ($DB) {echo "|$stmt|\n";} # $rslt=mysql_query($stmt, $link); # $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$monitor_channel','$server_ip','SIP/$SIPexten','$NOW_TIME','$STARTtime','$filename')"; # if ($DB) {echo "|$stmt|\n";} # $rslt=mysql_query($stmt, $link); # $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; # $rslt=mysql_query($stmt, $link); # if ($DB) {echo "$stmt\n";} # $row=mysql_fetch_row($rslt); # $recording_id = $row[0]; # echo "Recording command sent for channel $channel - $filename - $recording_id
\n"; ### insert a NEW record to the vicidial_manager table to be processed $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$DTqueryCID','Exten: $dialplan_number','Channel: $channel','Context: $ext_context','Priority: 1','Callerid: $DTqueryCID','','','','','')"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); echo "Redirect command sent for channel $channel       $NOW_TIME\n

\n"; $stmt="SELECT full_name from vicidial_users where user='$parked_by'"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); $full_name = $row[0]; echo "Call Referred by: $parked_by - $full_name\n

\n"; $url = "http://10.10.10.196/vicidial/closer_dispo.php?lead_id=$parked_by&channel=$channel&server_ip=$server_ip&extension=$extension&call_began=$STARTtime&parked_time=$parked_time&DB=$DB"; echo "View Customer Info and Disposition Call\n

\n"; $stmt="UPDATE park_log set grab_time='$NOW_TIME',status='TALKING',extension='$extension',user='$PHP_AUTH_USER' where parked_time='$parked_time' and server_ip='$server_ip' and channel='$channel'"; if ($DB) {echo "|$stmt|\n";} $fp = fopen ("./closer_SQL_updates.txt", "a"); fwrite ($fp, "$date|$PHP_AUTH_USER|$stmt|\n"); fclose($fp); $rslt=mysql_query($stmt, $link); ########################################################################################### ####### HERE IS WHERE YOU DEFINE DIFFERENT CONTENTS DEPENDING UPON THE CHANNEL_GROUP PREFIX ########################################################################################### if (eregi('CL_TEST',$channel_group)) { echo "GALLERIA TEST CLOSER GROUP: $channel_group\n"; $stmt="SELECT user,phone_number from vicidial_list where lead_id='$parked_by';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $fronter=$row[0]; $search_phone=$row[1]; ?>
COF MW Customer Search
Phone number


COF MW Customer Search
Phone number


-- INTERNAL CALL GALLERIA FRONT --
\n"; $group_color='#99FF99'; } if (eregi('CL_GALLER2',$channel_group)) { echo "
-- TouchAsia CALL Simple Escapes FRONT --
\n"; $group_color='#FF9999'; } if (eregi('CL_GALLER3',$channel_group)) { echo "
-- DebitSupplies CALL Simple Escapes FRONT --
\n"; $group_color='#FF9999'; } if (eregi('CL_GALLER4',$channel_group)) { echo "
-- Vishnu CALL Simple Escapes FRONT --
\n"; $group_color='#FF9999'; } ?>
COF MW Customer Search
Phone number


New Search
Reservation Number:
Confirmation #:
Phone #:


Back
Close this window\n

\n"; } else { echo "Redirect command FAILED for channel $channel       $NOW_TIME\n

\n"; echo "
\n"; } $ENDtime = date("U"); $RUNtime = ($ENDtime - $STARTtime); echo "\n\n\n


\n\n"; echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; ?>