diff --git a/UPGRADE b/UPGRADE index 6f6250b4..da20e352 100644 --- a/UPGRADE +++ b/UPGRADE @@ -336,6 +336,9 @@ OTHER CHANGES: not a calling report. This report will show statistics for all of the lists in the selected campaigns. +74. Added ability to use Custom List Fields in Web Forms, Scripts and Dispo + Call URL entries used by the agent interface. + diff --git a/docs/conf_examples/extensions.conf.sample b/docs/conf_examples/extensions.conf.sample index 4af943dd..7aabeeb5 100644 --- a/docs/conf_examples/extensions.conf.sample +++ b/docs/conf_examples/extensions.conf.sample @@ -41,9 +41,6 @@ exten => _999XX11112,5,Hangup [default] include => vicidial-auto -; VICI-GROUP DIRECT SUPPORT LINE (VICIHELP[84244357]) -exten => _84244XXX,1,Dial(IAX2/vicihelp/${EXTEN:5}) - ; Local agent alert extensions exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi) exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi) @@ -68,31 +65,15 @@ exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG--- ; Example phone extensions - -; Extension 2000 Sipura/Linksys ATA line 1 -exten => 2000,1,Dial(sip/spa2000,30,to) ; Ring, 30 secs max -exten => 2000,2,Voicemail,u2000 ; Send to voicemail... -; Extension 2001 Sipura/Linksys ATA line 2 -exten => 2001,1,Dial(sip/spa2001,30,to) ; Ring, 30 secs max -exten => 2001,2,Voicemail,u2001 ; Send to voicemail... -; Extension 2102 rings Grandstream phone -exten => 2102,1,Dial(sip/gs102,30,to) ; Ring, 30 secs max -exten => 2102,2,Voicemail,u2102 ; Send to voicemail... -; Extension 401 rings the firefly softphone -exten => 401,1,Dial((IAX2/firefly01@firefly01/s||t) -exten => 401,2,Hangup - -; 100-350 phone extensions now auto-generated +; 100-350 phone extensions now auto-generated, so no need to uncommend them ; extensions for other SIP and IAX call center phones ; cc100-cc150 SIP Phones ;exten => _1[0-5]X,1,Dial(sip/cc${EXTEN},20,to) ; cc300-cc350 IAX Phones ;exten => _3[0-5]X,1,Dial(IAX2/cc${EXTEN},20,to) - ; extensions if using a T1 channelbank ;exten => _19XX,1,Dial(Zap/${EXTEN:2},30,o) ;exten => _19XX,2,Hangup - ; Extension 4001 rings Zap phone (this example for FXS on Zap port 1) ;exten => 4001,1,Dial(Zap/1,30,o) ; ring Zap device 1 ;exten => 4001,2,Voicemail,u4001 ; Send to voicemail... diff --git a/docs/conf_examples/extensions.conf.sample-1.4 b/docs/conf_examples/extensions.conf.sample-1.4 index ef84a5d4..d1d2e266 100644 --- a/docs/conf_examples/extensions.conf.sample-1.4 +++ b/docs/conf_examples/extensions.conf.sample-1.4 @@ -46,9 +46,6 @@ exten => _999XX11112,n,Hangup [default] include => vicidial-auto -; VICI-GROUP DIRECT SUPPORT LINE (VICIHELP[84244357]) -exten => _84244XXX,1,Dial(IAX2/vicihelp/${EXTEN:5}) - ; Local agent alert extensions exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi) exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi) @@ -73,31 +70,15 @@ exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG--- ; Example phone extensions - -; Extension 2000 Sipura/Linksys ATA line 1 -exten => 2000,1,Dial(sip/spa2000,30,to) ; Ring, 30 secs max -exten => 2000,2,Voicemail,u2000 ; Send to voicemail... -; Extension 2001 Sipura/Linksys ATA line 2 -exten => 2001,1,Dial(sip/spa2001,30,to) ; Ring, 30 secs max -exten => 2001,2,Voicemail,u2001 ; Send to voicemail... -; Extension 2102 rings Grandstream phone -exten => 2102,1,Dial(sip/gs102,30,to) ; Ring, 30 secs max -exten => 2102,2,Voicemail,u2102 ; Send to voicemail... -; Extension 401 rings the firefly softphone -exten => 401,1,Dial((IAX2/firefly01@firefly01/s||t) -exten => 401,2,Hangup - -; 100-350 phone extensions now auto-generated +; 100-350 phone extensions now auto-generated, so no need to uncommend them ; extensions for other SIP and IAX call center phones ; cc100-cc150 SIP Phones ;exten => _1[0-5]X,1,Dial(sip/cc${EXTEN},20,to) ; cc300-cc350 IAX Phones ;exten => _3[0-5]X,1,Dial(IAX2/cc${EXTEN},20,to) - ; extensions if using a T1 channelbank ;exten => _19XX,1,Dial(Zap/${EXTEN:2},30,o) ;exten => _19XX,2,Hangup - ; Extension 4001 rings Zap phone (this example for FXS on Zap port 1) ;exten => 4001,1,Dial(Zap/1,30,o) ; ring Zap device 1 ;exten => 4001,2,Voicemail,u4001 ; Send to voicemail... diff --git a/docs/conf_examples/iax.conf.sample b/docs/conf_examples/iax.conf.sample index 5d4a68f4..7f2561f0 100644 --- a/docs/conf_examples/iax.conf.sample +++ b/docs/conf_examples/iax.conf.sample @@ -11,25 +11,3 @@ context=trunkinbound #include iax-vicidial.conf -;register => 1112223333:PASSWORD@iax.binfone.com -;ASTloop/ASTblind removed and now included in iax-vicidial.conf - - -[vicihelp] -host=67.134.219.20 ;voip.vicidial-group.com -type=friend -context=opengateway -disallow=all -allow=gsm -allow=ulaw -permit=67.134.219.20/255.255.255.255 -insecure=very - - -[1112223333] -auth=md5 -type=friend -username=1112223333 -secret=PASSWORD -host=iax.binfone.com -context=trunkinbound diff --git a/docs/conf_examples/iax.conf.sample-1.4 b/docs/conf_examples/iax.conf.sample-1.4 index 9fa58ed5..93b0a574 100644 --- a/docs/conf_examples/iax.conf.sample-1.4 +++ b/docs/conf_examples/iax.conf.sample-1.4 @@ -42,25 +42,4 @@ context=trunkinbound #include iax-vicidial.conf -;register => 1112223333:PASSWORD@iax.binfone.com ;ASTloop/ASTblind removed and now included in iax-vicidial.conf - - -[vicihelp] -host=67.134.219.20 ;voip.vicidial-group.com -type=friend -requirecalltoken=no -context=opengateway -disallow=all -allow=gsm -allow=ulaw -permit=67.134.219.20/255.255.255.255 -insecure=very - -[1112223333] -auth=md5 -type=friend -username=1112223333 -secret=PASSWORD -host=iax.binfone.com -context=trunkinbound diff --git a/www/agc/functions.php b/www/agc/functions.php index 376b2f01..9af6831b 100644 --- a/www/agc/functions.php +++ b/www/agc/functions.php @@ -96,12 +96,16 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) $last_rank = $o; $select_SQL = preg_replace("/.$/",'',$select_SQL); - ##### BEGIN grab the data from custom table for the lead_id - $stmt="SELECT $select_SQL FROM custom_$list_id where lead_id='$lead_id' LIMIT 1;"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05005',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $list_lead_ct = mysql_num_rows($rslt); + $list_lead_ct=0; + if (strlen($select_SQL)>0) + { + ##### BEGIN grab the data from custom table for the lead_id + $stmt="SELECT $select_SQL FROM custom_$list_id where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05005',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + } if ($list_lead_ct > 0) { $row=mysql_fetch_row($rslt); @@ -457,6 +461,20 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) $CFoutput = eregi_replace('--A--user_custom_three--B--',"$user_custom_three",$CFoutput); $CFoutput = eregi_replace('--A--user_custom_four--B--',"$user_custom_four",$CFoutput); $CFoutput = eregi_replace('--A--user_custom_five--B--',"$user_custom_five",$CFoutput); + $CFoutput = eregi_replace('--A--preset_number_a--B--',"$preset_number_a",$CFoutput); + $CFoutput = eregi_replace('--A--preset_number_b--B--',"$preset_number_b",$CFoutput); + $CFoutput = eregi_replace('--A--preset_number_c--B--',"$preset_number_c",$CFoutput); + $CFoutput = eregi_replace('--A--preset_number_d--B--',"$preset_number_d",$CFoutput); + $CFoutput = eregi_replace('--A--preset_number_e--B--',"$preset_number_e",$CFoutput); + $CFoutput = eregi_replace('--A--preset_dtmf_a--B--',"$preset_dtmf_a",$CFoutput); + $CFoutput = eregi_replace('--A--preset_dtmf_b--B--',"$preset_dtmf_b",$CFoutput); + $CFoutput = eregi_replace('--A--did_id--B--',"$did_id",$CFoutput); + $CFoutput = eregi_replace('--A--did_extension--B--',"$did_extension",$CFoutput); + $CFoutput = eregi_replace('--A--did_pattern--B--',"$did_pattern",$CFoutput); + $CFoutput = eregi_replace('--A--did_description--B--',"$did_description",$CFoutput); + $CFoutput = eregi_replace('--A--closecallid--B--',"$closecallid",$CFoutput); + $CFoutput = eregi_replace('--A--xfercallid--B--',"$xfercallid",$CFoutput); + $CFoutput = eregi_replace('--A--agent_log_id--B--',"$agent_log_id",$CFoutput); # custom fields replacement $o=0; diff --git a/www/agc/vdc_db_query.php b/www/agc/vdc_db_query.php index d2260647..5eed6179 100644 --- a/www/agc/vdc_db_query.php +++ b/www/agc/vdc_db_query.php @@ -88,6 +88,7 @@ # - $alt_num_status - ('0','1') # - $DiaL_SecondS - ('0','1','2',...) # - $date - ('2010-02-19') +# - $custom_field_names - ('|start_date|finish_date|favorite_color|') # # CHANGELOG: # 50629-1044 - First build of script @@ -255,12 +256,14 @@ # 100902-1348 - Added closecallid and xfercallid variables # 100903-0041 - Changed lead_id max length to 10 digits # 100908-1102 - Added customer_3way_hangup_process function +# 100916-2144 - Added custom list names export with lead data +# 100927-1618 - Added ability to use custom fields in web form and dispo_call_url # -$version = '2.4-162'; -$build = '100908-1102'; +$version = '2.4-164'; +$build = '100927-1618'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=333; +$mysql_log_count=345; $one_mysql_log=0; require("dbconnect.php"); @@ -442,6 +445,8 @@ if (isset($_GET["DiaL_SecondS"])) {$DiaL_SecondS=$_GET["DiaL_SecondS"];} elseif (isset($_POST["DiaL_SecondS"])) {$DiaL_SecondS=$_POST["DiaL_SecondS"];} if (isset($_GET["date"])) {$date=$_GET["date"];} elseif (isset($_POST["date"])) {$date=$_POST["date"];} +if (isset($_GET["custom_field_names"])) {$FORMcustom_field_names=$_GET["custom_field_names"];} + elseif (isset($_POST["custom_field_names"])) {$FORMcustom_field_names=$_POST["custom_field_names"];} header ("Content-type: text/html; charset=utf-8"); @@ -1776,6 +1781,7 @@ if ($ACTION == 'manDiaLnextCaLL') $rank = trim("$row[32]"); $owner = trim("$row[33]"); $entry_list_id = trim("$row[34]"); + if ($entry_list_id < 100) {$entry_list_id = $list_id;} } $called_count++; @@ -2156,6 +2162,50 @@ if ($ACTION == 'manDiaLnextCaLL') if (strlen($row[4]) > 0) {$VDCL_xferconf_e_number = $row[4];} } + + $custom_field_names='|'; + $custom_field_names_SQL=''; + $custom_field_values='----------'; + $custom_field_types='|'; + ### find the names of all custom fields, if any + $stmt = "SELECT field_label,field_type FROM vicidial_lists_fields where list_id='$entry_list_id' and field_type NOT IN('SCRIPT','DISPLAY') and field_label NOT IN('vendor_lead_code','source_id','list_id','gmt_offset_now','called_since_last_reset','phone_code','phone_number','title','first_name','middle_initial','last_name','address1','address2','address3','city','state','province','postal_code','country_code','gender','date_of_birth','alt_phone','email','security_phrase','comments','called_count','last_local_call_time','rank','owner');"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00334',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cffn_ct = mysql_num_rows($rslt); + $d=0; + while ($cffn_ct > $d) + { + $row=mysql_fetch_row($rslt); + $custom_field_names .= "$row[0]|"; + $custom_field_names_SQL .= "$row[0],"; + $custom_field_types .= "$row[1]|"; + $custom_field_values .= "----------"; + $d++; + } + if ($cffn_ct > 0) + { + $custom_field_names_SQL = eregi_replace(".$","",$custom_field_names_SQL); + ### find the values of the named custom fields + $stmt = "SELECT $custom_field_names_SQL FROM custom_$entry_list_id where lead_id='$lead_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00335',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cffv_ct = mysql_num_rows($rslt); + if ($cffv_ct > 0) + { + $custom_field_values='----------'; + $row=mysql_fetch_row($rslt); + $d=0; + while ($cffn_ct > $d) + { + $custom_field_values .= "$row[$d]----------"; + $d++; + } + $custom_field_values = preg_replace("/\n/"," ",$custom_field_values); + $custom_field_values = preg_replace("/\r/","",$custom_field_values); + } + } } @@ -2207,6 +2257,9 @@ if ($ACTION == 'manDiaLnextCaLL') $LeaD_InfO .= $VDCL_xferconf_d_number . "\n"; $LeaD_InfO .= $VDCL_xferconf_e_number . "\n"; $LeaD_InfO .= $entry_list_id . "\n"; + $LeaD_InfO .= $custom_field_names . "\n"; + $LeaD_InfO .= $custom_field_values . "\n"; + $LeaD_InfO .= $custom_field_types . "\n"; echo $LeaD_InfO; } @@ -4032,6 +4085,7 @@ if ($ACTION == 'VDADcheckINCOMING') $rank = trim("$row[32]"); $owner = trim("$row[33]"); $entry_list_id = trim("$row[34]"); + if ($entry_list_id < 100) {$entry_list_id = $list_id;} } ##### if lead is a callback, grab the callback comments @@ -4288,7 +4342,7 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "SELECT closecallid,xfercallid from vicidial_closer_log where lead_id='$lead_id' and user='$user' and list_id='$list_id' order by call_date desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00336',$user,$server_ip,$session_name,$one_mysql_log);} $VDCL_mvac_ct = mysql_num_rows($rslt); if ($VDCL_mvac_ct > 0) { @@ -4545,7 +4599,7 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "SELECT did_id,extension from vicidial_did_log where uniqueid='$uniqueid' order by call_date desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00337',$user,$server_ip,$session_name,$one_mysql_log);} $VDIDL_ct = mysql_num_rows($rslt); if ($VDIDL_ct > 0) { @@ -4556,7 +4610,7 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "SELECT did_pattern,did_description from vicidial_inbound_dids where did_id='$DID_id' limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00338',$user,$server_ip,$session_name,$one_mysql_log);} $VDIDL_ct = mysql_num_rows($rslt); if ($VDIDL_ct > 0) { @@ -4610,6 +4664,51 @@ if ($ACTION == 'VDADcheckINCOMING') } } + $custom_field_names='|'; + $custom_field_names_SQL=''; + $custom_field_values='----------'; + $custom_field_types='|'; + ### find the names of all custom fields, if any + $stmt = "SELECT field_label,field_type FROM vicidial_lists_fields where list_id='$entry_list_id' and field_type NOT IN('SCRIPT','DISPLAY') and field_label NOT IN('vendor_lead_code','source_id','list_id','gmt_offset_now','called_since_last_reset','phone_code','phone_number','title','first_name','middle_initial','last_name','address1','address2','address3','city','state','province','postal_code','country_code','gender','date_of_birth','alt_phone','email','security_phrase','comments','called_count','last_local_call_time','rank','owner');"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00339',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cffn_ct = mysql_num_rows($rslt); + $d=0; + while ($cffn_ct > $d) + { + $row=mysql_fetch_row($rslt); + $custom_field_names .= "$row[0]|"; + $custom_field_names_SQL .= "$row[0],"; + $custom_field_types .= "$row[1]|"; + $custom_field_values .= "----------"; + $d++; + } + if ($cffn_ct > 0) + { + $custom_field_names_SQL = eregi_replace(".$","",$custom_field_names_SQL); + ### find the values of the named custom fields + $stmt = "SELECT $custom_field_names_SQL FROM custom_$entry_list_id where lead_id='$lead_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00340',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cffv_ct = mysql_num_rows($rslt); + if ($cffv_ct > 0) + { + $custom_field_values='----------'; + $row=mysql_fetch_row($rslt); + $d=0; + while ($cffn_ct > $d) + { + $custom_field_values .= "$row[$d]----------"; + $d++; + } + $custom_field_values = preg_replace("/\n/"," ",$custom_field_values); + $custom_field_values = preg_replace("/\r/","",$custom_field_values); + } + } + + $comments = eregi_replace("\r",'',$comments); $comments = eregi_replace("\n",'!N',$comments); @@ -4657,6 +4756,9 @@ if ($ACTION == 'VDADcheckINCOMING') $LeaD_InfO .= $owner . "\n"; $LeaD_InfO .= $script_recording_delay . "\n"; $LeaD_InfO .= $entry_list_id . "\n"; + $LeaD_InfO .= $custom_field_names . "\n"; + $LeaD_InfO .= $custom_field_values . "\n"; + $LeaD_InfO .= $custom_field_types . "\n"; echo $LeaD_InfO; @@ -4791,6 +4893,37 @@ if ($ACTION == 'VDADcheckINCOMING') $VDCL_start_call_url = eregi_replace('--A--user_custom_five--B--',urlencode(trim($user_custom_five)),$VDCL_start_call_url); $VDCL_start_call_url = eregi_replace('--A--talk_time--B--',"0",$VDCL_start_call_url); $VDCL_start_call_url = eregi_replace('--A--talk_time_min--B--',"0",$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--entry_list_id--B--',"$entry_list_id",$VDCL_start_call_url); + + if (strlen($custom_field_names)>2) + { + $custom_field_names = preg_replace("/^\||\|$/",'',$custom_field_names); + $custom_field_names = preg_replace("/\|/",",",$custom_field_names); + $custom_field_names_ARY = explode(',',$custom_field_names); + $custom_field_names_ct = count($custom_field_names_ARY); + $custom_field_names_SQL = $custom_field_names; + + ##### BEGIN grab the data from custom table for the lead_id + $stmt="SELECT $custom_field_names_SQL FROM custom_$entry_list_id where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00344',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + $o=0; + while ($custom_field_names_ct > $o) + { + $form_field_value = trim("$row[$o]"); + $field_name_id = $custom_field_names_ARY[$o]; + $field_name_tag = "--A--" . $field_name_id . "--B--"; + $VDCL_start_call_url = eregi_replace("$field_name_tag","$form_field_value",$VDCL_start_call_url); + $o++; + } + } + } + if ($DB > 0) {echo "$VDCL_start_call_url
\n";} $SCUfile = file("$VDCL_start_call_url"); if ($DB > 0) {echo "$SCUfile[0]
\n";} @@ -6079,7 +6212,7 @@ if ($ACTION == 'updateDISPO') $stmt = "SELECT phone_number,alt_dial from vicidial_log where uniqueid='$uniqueid';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00341',$user,$server_ip,$session_name,$one_mysql_log);} $vl_dialed_ct = mysql_num_rows($rslt); if ($vl_dialed_ct > 0) { @@ -6091,7 +6224,6 @@ if ($ACTION == 'updateDISPO') } - ##### grab the data from vicidial_list for the lead_id $stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; $rslt=mysql_query($stmt, $link); @@ -6199,6 +6331,37 @@ if ($ACTION == 'updateDISPO') $dispo_call_url = eregi_replace('--A--talk_time_ms--B--',"$talk_time_ms",$dispo_call_url); $dispo_call_url = eregi_replace('--A--talk_time_min--B--',"$talk_time_min",$dispo_call_url); $dispo_call_url = eregi_replace('--A--agent_log_id--B--',"$CALL_agent_log_id",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--entry_list_id--B--',"$entry_list_id",$dispo_call_url); + + if (strlen($FORMcustom_field_names)>2) + { + $custom_field_names = preg_replace("/^\||\|$/",'',$FORMcustom_field_names); + $custom_field_names = preg_replace("/\|/",",",$custom_field_names); + $custom_field_names_ARY = explode(',',$custom_field_names); + $custom_field_names_ct = count($custom_field_names_ARY); + $custom_field_names_SQL = $custom_field_names; + + ##### BEGIN grab the data from custom table for the lead_id + $stmt="SELECT $custom_field_names_SQL FROM custom_$entry_list_id where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00345',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + $o=0; + while ($custom_field_names_ct > $o) + { + $form_field_value = trim("$row[$o]"); + $field_name_id = $custom_field_names_ARY[$o]; + $field_name_tag = "--A--" . $field_name_id . "--B--"; + $dispo_call_url = eregi_replace("$field_name_tag","$form_field_value",$dispo_call_url); + $o++; + } + } + } + if ($DB > 0) {echo "$dispo_call_url
\n";} $SCUfile = file("$dispo_call_url"); if ($DB > 0) {echo "$SCUfile[0]
\n";} @@ -7556,7 +7719,7 @@ if ($ACTION == 'customer_3way_hangup_process') $stmt="UPDATE user_call_log SET customer_hungup='$status',customer_hungup_seconds='$stage' where lead_id='$lead_id' and user='$user' and call_type LIKE \"%3WAY%\" order by user_call_log_id desc limit 1;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00342',$user,$server_ip,$session_name,$one_mysql_log);} echo "DONE: $stage|$lead_id|$status"; } @@ -7592,7 +7755,7 @@ if ($ACTION == 'Clear_API_Field') $stmt="UPDATE vicidial_live_agents SET $comments='' where user='$user';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00343',$user,$server_ip,$session_name,$one_mysql_log);} echo "DONE: $comments"; } diff --git a/www/agc/vdc_form_display.php b/www/agc/vdc_form_display.php index 3f0e6ca7..dc51eb31 100644 --- a/www/agc/vdc_form_display.php +++ b/www/agc/vdc_form_display.php @@ -11,10 +11,11 @@ # 100630-1119 - First build of script # 100703-1124 - Added submit_button,admin_submit fields, which will log to admin log # 100712-2322 - Added code to log vicidial_list.entry_list_id field if data altered +# 100916-1749 - Added non-lead variable parsing # -$version = '2.4-3'; -$build = '100712-2322'; +$version = '2.4-4'; +$build = '100916-1749'; require("dbconnect.php"); require("functions.php"); @@ -43,10 +44,108 @@ if (isset($_GET["admin_submit"])) {$admin_submit=$_GET["admin_submit"];} if (isset($_GET["bgcolor"])) {$bgcolor=$_GET["bgcolor"];} elseif (isset($_POST["bgcolor"])) {$bgcolor=$_POST["bgcolor"];} +if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];} +if (isset($_GET["original_phone_login"])) {$original_phone_login=$_GET["original_phone_login"];} + elseif (isset($_POST["original_phone_login"])) {$original_phone_login=$_POST["original_phone_login"];} +if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];} + elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];} +if (isset($_GET["fronter"])) {$fronter=$_GET["fronter"];} + elseif (isset($_POST["fronter"])) {$fronter=$_POST["fronter"];} +if (isset($_GET["closer"])) {$closer=$_GET["closer"];} + elseif (isset($_POST["closer"])) {$closer=$_POST["closer"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} + elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} +if (isset($_GET["SQLdate"])) {$SQLdate=$_GET["SQLdate"];} + elseif (isset($_POST["SQLdate"])) {$SQLdate=$_POST["SQLdate"];} +if (isset($_GET["epoch"])) {$epoch=$_GET["epoch"];} + elseif (isset($_POST["epoch"])) {$epoch=$_POST["epoch"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["customer_zap_channel"])) {$customer_zap_channel=$_GET["customer_zap_channel"];} + elseif (isset($_POST["customer_zap_channel"])) {$customer_zap_channel=$_POST["customer_zap_channel"];} +if (isset($_GET["customer_server_ip"])) {$customer_server_ip=$_GET["customer_server_ip"];} + elseif (isset($_POST["customer_server_ip"])) {$customer_server_ip=$_POST["customer_server_ip"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["SIPexten"])) {$SIPexten=$_GET["SIPexten"];} + elseif (isset($_POST["SIPexten"])) {$SIPexten=$_POST["SIPexten"];} +if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +if (isset($_GET["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];} + elseif (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];} +if (isset($_GET["dialed_number"])) {$dialed_number=$_GET["dialed_number"];} + elseif (isset($_POST["dialed_number"])) {$dialed_number=$_POST["dialed_number"];} +if (isset($_GET["dialed_label"])) {$dialed_label=$_GET["dialed_label"];} + elseif (isset($_POST["dialed_label"])) {$dialed_label=$_POST["dialed_label"];} +if (isset($_GET["camp_script"])) {$camp_script=$_GET["camp_script"];} + elseif (isset($_POST["camp_script"])) {$camp_script=$_POST["camp_script"];} +if (isset($_GET["in_script"])) {$in_script=$_GET["in_script"];} + elseif (isset($_POST["in_script"])) {$in_script=$_POST["in_script"];} +if (isset($_GET["script_width"])) {$script_width=$_GET["script_width"];} + elseif (isset($_POST["script_width"])) {$script_width=$_POST["script_width"];} +if (isset($_GET["script_height"])) {$script_height=$_GET["script_height"];} + elseif (isset($_POST["script_height"])) {$script_height=$_POST["script_height"];} +if (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];} + elseif (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];} +if (isset($_GET["recording_filename"])) {$recording_filename=$_GET["recording_filename"];} + elseif (isset($_POST["recording_filename"])) {$recording_filename=$_POST["recording_filename"];} +if (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];} + elseif (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];} +if (isset($_GET["user_custom_one"])) {$user_custom_one=$_GET["user_custom_one"];} + elseif (isset($_POST["user_custom_one"])) {$user_custom_one=$_POST["user_custom_one"];} +if (isset($_GET["user_custom_two"])) {$user_custom_two=$_GET["user_custom_two"];} + elseif (isset($_POST["user_custom_two"])) {$user_custom_two=$_POST["user_custom_two"];} +if (isset($_GET["user_custom_three"])) {$user_custom_three=$_GET["user_custom_three"];} + elseif (isset($_POST["user_custom_three"])) {$user_custom_three=$_POST["user_custom_three"];} +if (isset($_GET["user_custom_four"])) {$user_custom_four=$_GET["user_custom_four"];} + elseif (isset($_POST["user_custom_four"])) {$user_custom_four=$_POST["user_custom_four"];} +if (isset($_GET["user_custom_five"])) {$user_custom_five=$_GET["user_custom_five"];} + elseif (isset($_POST["user_custom_five"])) {$user_custom_five=$_POST["user_custom_five"];} +if (isset($_GET["preset_number_a"])) {$preset_number_a=$_GET["preset_number_a"];} + elseif (isset($_POST["preset_number_a"])) {$preset_number_a=$_POST["preset_number_a"];} +if (isset($_GET["preset_number_b"])) {$preset_number_b=$_GET["preset_number_b"];} + elseif (isset($_POST["preset_number_b"])) {$preset_number_b=$_POST["preset_number_b"];} +if (isset($_GET["preset_number_c"])) {$preset_number_c=$_GET["preset_number_c"];} + elseif (isset($_POST["preset_number_c"])) {$preset_number_c=$_POST["preset_number_c"];} +if (isset($_GET["preset_number_d"])) {$preset_number_d=$_GET["preset_number_d"];} + elseif (isset($_POST["preset_number_d"])) {$preset_number_d=$_POST["preset_number_d"];} +if (isset($_GET["preset_number_e"])) {$preset_number_e=$_GET["preset_number_e"];} + elseif (isset($_POST["preset_number_e"])) {$preset_number_e=$_POST["preset_number_e"];} +if (isset($_GET["preset_number_f"])) {$preset_number_f=$_GET["preset_number_f"];} + elseif (isset($_POST["preset_number_f"])) {$preset_number_f=$_POST["preset_number_f"];} +if (isset($_GET["preset_dtmf_a"])) {$preset_dtmf_a=$_GET["preset_dtmf_a"];} + elseif (isset($_POST["preset_dtmf_a"])) {$preset_dtmf_a=$_POST["preset_dtmf_a"];} +if (isset($_GET["preset_dtmf_b"])) {$preset_dtmf_b=$_GET["preset_dtmf_b"];} + elseif (isset($_POST["preset_dtmf_b"])) {$preset_dtmf_b=$_POST["preset_dtmf_b"];} +if (isset($_GET["did_id"])) {$did_id=$_GET["did_id"];} + elseif (isset($_POST["did_id"])) {$did_id=$_POST["did_id"];} +if (isset($_GET["did_extension"])) {$did_extension=$_GET["did_extension"];} + elseif (isset($_POST["did_extension"])) {$did_extension=$_POST["did_extension"];} +if (isset($_GET["did_pattern"])) {$did_pattern=$_GET["did_pattern"];} + elseif (isset($_POST["did_pattern"])) {$did_pattern=$_POST["did_pattern"];} +if (isset($_GET["did_description"])) {$did_description=$_GET["did_description"];} + elseif (isset($_POST["did_description"])) {$did_description=$_POST["did_description"];} +if (isset($_GET["closecallid"])) {$closecallid=$_GET["closecallid"];} + elseif (isset($_POST["closecallid"])) {$closecallid=$_POST["closecallid"];} +if (isset($_GET["xfercallid"])) {$xfercallid=$_GET["xfercallid"];} + elseif (isset($_POST["xfercallid"])) {$xfercallid=$_POST["xfercallid"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 +if ($stage=='WELCOME') + {echo "FORM"; exit;} + $txt = '.txt'; $StarTtime = date("U"); $NOW_DATE = date("Y-m-d"); @@ -328,7 +427,7 @@ else echo " \n"; echo " \n"; echo "\n"; - echo ''; + echo ""; echo "\n"; echo "
\n"; echo "\n"; diff --git a/www/agc/vdc_script_display.php b/www/agc/vdc_script_display.php index 19073ca2..fb63caf6 100644 --- a/www/agc/vdc_script_display.php +++ b/www/agc/vdc_script_display.php @@ -177,10 +177,15 @@ if (isset($_GET["xfercallid"])) {$xfercallid=$_GET["xfercallid"];} elseif (isset($_POST["xfercallid"])) {$xfercallid=$_POST["xfercallid"];} if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} -if (isset($_GET["ScrollDIV"])) {$ScrollDIV=$_GET["ScrollDIV"];} +if (isset($_GET["ScrollDIV"])) {$ScrollDIV=$_GET["ScrollDIV"];} elseif (isset($_POST["ScrollDIV"])) {$ScrollDIV=$_POST["ScrollDIV"];} -if (isset($_GET["ignore_list_script"])) {$ignore_list_script=$_GET["ignore_list_script"];} +if (isset($_GET["ignore_list_script"])) {$ignore_list_script=$_GET["ignore_list_script"];} elseif (isset($_POST["ignore_list_script"])) {$ignore_list_script=$_POST["ignore_list_script"];} +if (isset($_GET["CF_uses_custom_fields"])) {$CF_uses_custom_fields=$_GET["CF_uses_custom_fields"];} + elseif (isset($_POST["CF_uses_custom_fields"])) {$CF_uses_custom_fields=$_POST["CF_uses_custom_fields"];} +if (isset($_GET["entry_list_id"])) {$entry_list_id=$_GET["entry_list_id"];} + elseif (isset($_POST["entry_list_id"])) {$entry_list_id=$_POST["entry_list_id"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -465,6 +470,29 @@ $script_text = eregi_replace('--A--did_description--B--',"$did_description",$scr $script_text = eregi_replace('--A--closecallid--B--',"$closecallid",$script_text); $script_text = eregi_replace('--A--xfercallid--B--',"$xfercallid",$script_text); $script_text = eregi_replace('--A--agent_log_id--B--',"$agent_log_id",$script_text); +$script_text = eregi_replace('--A--entry_list_id--B--',"$entry_list_id",$script_text); + +if ($CF_uses_custom_fields=='Y') + { + ### find the names of all custom fields, if any + $stmt = "SELECT field_label,field_type FROM vicidial_lists_fields where list_id='$entry_list_id' and field_type NOT IN('SCRIPT','DISPLAY') and field_label NOT IN('vendor_lead_code','source_id','list_id','gmt_offset_now','called_since_last_reset','phone_code','phone_number','title','first_name','middle_initial','last_name','address1','address2','address3','city','state','province','postal_code','country_code','gender','date_of_birth','alt_phone','email','security_phrase','comments','called_count','last_local_call_time','rank','owner');"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cffn_ct = mysql_num_rows($rslt); + $d=0; + while ($cffn_ct > $d) + { + $row=mysql_fetch_row($rslt); + $field_name_id = $row[0]; + $field_name_tag = "--A--" . $field_name_id . "--B--"; + if (isset($_GET["$field_name_id"])) {$form_field_value=$_GET["$field_name_id"];} + elseif (isset($_POST["$field_name_id"])) {$form_field_value=$_POST["$field_name_id"];} + $script_text = eregi_replace("$field_name_tag","$form_field_value",$script_text); + if ($DB) {echo "$d|$field_name_id|$field_name_tag|$form_field_value|
\n";} + $d++; + } + } + $script_text = eregi_replace("\n","
",$script_text); $script_text = stripslashes($script_text); diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php index ae3d41f5..2f8d56f0 100644 --- a/www/agc/vicidial.php +++ b/www/agc/vicidial.php @@ -313,12 +313,13 @@ # 100902-1349 - Added closecallid, xfercallid, agent_log_id as webform and script variables # 100908-0955 - Added customer 3way hangup # 100912-1304 - Changed Dispo screen phone number display to dialed_number +# 100927-1616 - Added custom fields ability to web forms and optimized related code # -$version = '2.4-291'; -$build = '100912-1304'; +$version = '2.4-292'; +$build = '100927-1616'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=66; +$mysql_log_count=68; $one_mysql_log=0; require("dbconnect.php"); @@ -1421,7 +1422,7 @@ else ##### grab the presets for this campaign $stmt="SELECT preset_name,preset_number,preset_dtmf,preset_hide_number FROM vicidial_xfer_presets WHERE campaign_id='$VD_campaign' order by preset_name limit 500;"; $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01XXX',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01067',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $VD_presets = mysql_num_rows($rslt); $j=0; @@ -2192,7 +2193,7 @@ else ##### find system_key in system_settings if populated ##### $stmt="SELECT webphone_systemkey FROM system_settings LIMIT 1;"; $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01XXX',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01068',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $wsk_ct = mysql_num_rows($rslt); if ($wsk_ct > 0) @@ -2671,7 +2672,8 @@ $CCAL_OUT .= ""; ?> -