Added more available variables to the Phone NVA call URL feature
git-svn-id: svn://192.168.202.10@2430 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -48,6 +48,7 @@
|
||||
# 141124-2309 - Fixed Fhour variable bug
|
||||
# 150915-1824 - Added recording ID play and filename options
|
||||
# 151211-0932 - Added phone search and phone NVA URL features
|
||||
# 151214-2148 - Added more variables to be used by nva url feature
|
||||
#
|
||||
|
||||
&get_time_now;
|
||||
@@ -316,75 +317,6 @@ if ($search_phone =~ /Y/)
|
||||
if ( ( (length($lead_id)<1) || ($lead_id < 1) ) && ($search_lead_id !~ /NOTFOUND/) )
|
||||
{$lead_id = $search_lead_id;}
|
||||
|
||||
if ( ($phone_url =~ /Y/) && (length($nva_call_url) > 8) )
|
||||
{
|
||||
### first, find curl binary
|
||||
$curlbin = '';
|
||||
if ( -e ('/bin/curl')) {$curlbin = '/bin/curl';}
|
||||
else
|
||||
{
|
||||
if ( -e ('/usr/bin/curl')) {$curlbin = '/usr/bin/curl';}
|
||||
else
|
||||
{
|
||||
if ( -e ('/usr/local/bin/curl')) {$curlbin = '/usr/local/bin/curl';}
|
||||
else
|
||||
{
|
||||
if ($AGILOG) {$agi_string = "ERROR: cannot do nva URL, curl binary not found"; &agi_output;}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( (length($curlbin) > 4) && ($nva_call_url =~ /http/i) )
|
||||
{
|
||||
$nva_call_url =~ s/^VAR|^ //gi;
|
||||
$nva_call_url =~ s/--A--phone_number--B--/$temp_phone/gi;
|
||||
$nva_call_url =~ s/--A--uniqueid--B--/$unique_id/gi;
|
||||
$nva_call_url =~ s/--A--lead_id--B--/$search_lead_id/gi;
|
||||
$nva_call_url =~ s/--A--extension--B--/$accountcode/gi;
|
||||
$nva_call_url =~ s/--A--channel--B--/$channel/gi;
|
||||
$nva_call_url =~ s/--A--server_ip--B--/$VARserver_ip/gi;
|
||||
$nva_call_url =~ s/&/\\&/gi;
|
||||
$nva_call_url =~ s/ /+/gi;
|
||||
|
||||
### insert a new url log entry
|
||||
$SQL_log = "$nva_call_url";
|
||||
$SQL_log =~ s/;|\||\\//gi;
|
||||
$stmtA = "INSERT INTO vicidial_url_log SET uniqueid='$unique_id',url_date=NOW(),url_type='nva_phone',url='$SQL_log',url_response='';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;";
|
||||
$sthA = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$url_id = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
my $secW = time();
|
||||
|
||||
@curl_output = `$curlbin $nva_call_url`;
|
||||
|
||||
my $secY = time();
|
||||
my $response_sec = ($secY - $secW);
|
||||
|
||||
$k=0;
|
||||
$full_output='';
|
||||
foreach (@curl_output)
|
||||
{
|
||||
$full_output_raw .= $curl_output[$k];
|
||||
$k++;
|
||||
}
|
||||
$full_output = $full_output_raw;
|
||||
$full_output =~ s/\D//gi;
|
||||
### update url log entry
|
||||
$full_output_raw =~ s/;|\||\\//gi;
|
||||
$stmtA = "UPDATE vicidial_url_log SET url_response='$full_output_raw|$full_output',response_sec='$response_sec' where url_log_id='$url_id';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
|
||||
if ($AGILOG) {$agi_string = "phone NVA URL response: |$search_lead_id|$full_output|$nva_call_url|$affected_rows|"; &agi_output;}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
### if set to record this call, start recording ###
|
||||
if ($record_call =~ /Y/)
|
||||
@@ -428,9 +360,168 @@ if ($record_call =~ /Y/)
|
||||
{
|
||||
$AGI->exec("Monitor","wav,/var/spool/asterisk/monitor/MIX/$filename");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( ($phone_url =~ /Y/) && (length($nva_call_url) > 8) )
|
||||
{
|
||||
### first, find curl binary
|
||||
$curlbin = '';
|
||||
if ( -e ('/bin/curl')) {$curlbin = '/bin/curl';}
|
||||
else
|
||||
{
|
||||
if ( -e ('/usr/bin/curl')) {$curlbin = '/usr/bin/curl';}
|
||||
else
|
||||
{
|
||||
if ( -e ('/usr/local/bin/curl')) {$curlbin = '/usr/local/bin/curl';}
|
||||
else
|
||||
{
|
||||
if ($AGILOG) {$agi_string = "ERROR: cannot do nva URL, curl binary not found"; &agi_output;}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( (length($curlbin) > 4) && ($nva_call_url =~ /http/i) )
|
||||
{
|
||||
if ( (length($lead_id)> 0) && ($lead_id !~ /NOTFOUND/) )
|
||||
{
|
||||
$stmtA = "SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,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 FROM vicidial_list where lead_id='$lead_id';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$entry_date = $aryA[1];
|
||||
$modify_date = $aryA[2];
|
||||
$status = $aryA[3];
|
||||
$user = $aryA[4];
|
||||
$vendor_lead_code = $aryA[5];
|
||||
$source_id = $aryA[6];
|
||||
$list_id = $aryA[7];
|
||||
$phone_number = $aryA[8];
|
||||
$title = $aryA[9];
|
||||
$first_name = $aryA[10];
|
||||
$middle_initial = $aryA[11];
|
||||
$last_name = $aryA[12];
|
||||
$address1 = $aryA[13];
|
||||
$address2 = $aryA[14];
|
||||
$address3 = $aryA[15];
|
||||
$city = $aryA[16];
|
||||
$state = $aryA[17];
|
||||
$province = $aryA[18];
|
||||
$postal_code = $aryA[19];
|
||||
$country_code = $aryA[20];
|
||||
$gender = $aryA[21];
|
||||
$date_of_birth = $aryA[22];
|
||||
$alt_phone = $aryA[23];
|
||||
$email = $aryA[24];
|
||||
$security_phrase = $aryA[25];
|
||||
$comments = $aryA[26];
|
||||
$called_count = $aryA[27];
|
||||
$last_local_call_time = $aryA[28];
|
||||
$rank = $aryA[29];
|
||||
$owner = $aryA[30];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
$stmtA = "SELECT list_description,campaign_id FROM vicidial_lists where list_id='$list_id';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$list_description = $aryA[0];
|
||||
$campaign_id = $aryA[1];
|
||||
}
|
||||
$sthA->finish();
|
||||
}
|
||||
|
||||
$nva_call_url =~ s/^VAR|^ //gi;
|
||||
$nva_call_url =~ s/--A--phone_number--B--/$temp_phone/gi;
|
||||
$nva_call_url =~ s/--A--uniqueid--B--/$unique_id/gi;
|
||||
$nva_call_url =~ s/--A--lead_id--B--/$search_lead_id/gi;
|
||||
$nva_call_url =~ s/--A--extension--B--/$accountcode/gi;
|
||||
$nva_call_url =~ s/--A--channel--B--/$channel/gi;
|
||||
$nva_call_url =~ s/--A--server_ip--B--/$VARserver_ip/gi;
|
||||
|
||||
$nva_call_url =~ s/--A--lead_id--B--/$lead_id/gi;
|
||||
$nva_call_url =~ s/--A--entry_date--B--/$entry_date/gi;
|
||||
$nva_call_url =~ s/--A--modify_date--B--/$modify_date/gi;
|
||||
$nva_call_url =~ s/--A--status--B--/$status/gi;
|
||||
$nva_call_url =~ s/--A--user--B--/$user/gi;
|
||||
$nva_call_url =~ s/--A--vendor_lead_code--B--/$vendor_lead_code/gi;
|
||||
$nva_call_url =~ s/--A--source_id--B--/$source_id/gi;
|
||||
$nva_call_url =~ s/--A--list_id--B--/$list_id/gi;
|
||||
$nva_call_url =~ s/--A--phone_number--B--/$phone_number/gi;
|
||||
$nva_call_url =~ s/--A--title--B--/$title/gi;
|
||||
$nva_call_url =~ s/--A--first_name--B--/$first_name/gi;
|
||||
$nva_call_url =~ s/--A--middle_initial--B--/$middle_initial/gi;
|
||||
$nva_call_url =~ s/--A--last_name--B--/$last_name/gi;
|
||||
$nva_call_url =~ s/--A--address1--B--/$address1/gi;
|
||||
$nva_call_url =~ s/--A--address2--B--/$address2/gi;
|
||||
$nva_call_url =~ s/--A--address3--B--/$address3/gi;
|
||||
$nva_call_url =~ s/--A--city--B--/$city/gi;
|
||||
$nva_call_url =~ s/--A--state--B--/$state/gi;
|
||||
$nva_call_url =~ s/--A--province--B--/$province/gi;
|
||||
$nva_call_url =~ s/--A--postal_code--B--/$postal_code/gi;
|
||||
$nva_call_url =~ s/--A--country_code--B--/$country_code/gi;
|
||||
$nva_call_url =~ s/--A--gender--B--/$gender/gi;
|
||||
$nva_call_url =~ s/--A--date_of_birth--B--/$date_of_birth/gi;
|
||||
$nva_call_url =~ s/--A--alt_phone--B--/$alt_phone/gi;
|
||||
$nva_call_url =~ s/--A--email--B--/$email/gi;
|
||||
$nva_call_url =~ s/--A--security_phrase--B--/$security_phrase/gi;
|
||||
$nva_call_url =~ s/--A--comments--B--/$comments/gi;
|
||||
$nva_call_url =~ s/--A--called_count--B--/$called_count/gi;
|
||||
$nva_call_url =~ s/--A--last_local_call_time--B--/$last_local_call_time/gi;
|
||||
$nva_call_url =~ s/--A--rank--B--/$rank/gi;
|
||||
$nva_call_url =~ s/--A--owner--B--/$owner/gi;
|
||||
$nva_call_url =~ s/--A--campaign_id--B--/$campaign_id/gi;
|
||||
$nva_call_url =~ s/--A--list_description--B--/$list_description/gi;
|
||||
$nva_call_url =~ s/--A--recording_id--B--/$recording_id/gi;
|
||||
$nva_call_url =~ s/--A--recording_filename--B--/$filename/gi;
|
||||
|
||||
$nva_call_url =~ s/&/\\&/gi;
|
||||
$nva_call_url =~ s/ /+/gi;
|
||||
|
||||
### insert a new url log entry
|
||||
$SQL_log = "$nva_call_url";
|
||||
$SQL_log =~ s/;|\||\\//gi;
|
||||
$stmtA = "INSERT INTO vicidial_url_log SET uniqueid='$unique_id',url_date=NOW(),url_type='nva_phone',url='$SQL_log',url_response='';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;";
|
||||
$sthA = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$url_id = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
my $secW = time();
|
||||
|
||||
@curl_output = `$curlbin $nva_call_url`;
|
||||
|
||||
my $secY = time();
|
||||
my $response_sec = ($secY - $secW);
|
||||
|
||||
$k=0;
|
||||
$full_output='';
|
||||
foreach (@curl_output)
|
||||
{
|
||||
$full_output_raw .= $curl_output[$k];
|
||||
$k++;
|
||||
}
|
||||
$full_output = $full_output_raw;
|
||||
$full_output =~ s/\D//gi;
|
||||
### update url log entry
|
||||
$full_output_raw =~ s/;|\||\\//gi;
|
||||
$stmtA = "UPDATE vicidial_url_log SET url_response='$full_output_raw|$full_output',response_sec='$response_sec' where url_log_id='$url_id';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
|
||||
if ($AGILOG) {$agi_string = "phone NVA URL response: |$search_lead_id|$full_output|$nva_call_url|$affected_rows|"; &agi_output;}
|
||||
}
|
||||
}
|
||||
|
||||
### if set to user log this call, insert user_call_log entry ###
|
||||
if ($log_user_call =~ /Y/)
|
||||
|
||||
@@ -30023,7 +30023,7 @@ if ($ADD==31111111111)
|
||||
echo "<tr bgcolor=#B6D3FC><td align=right>"._QXZ("CallerID URL").": </td><td align=left><input type=text name=local_web_callerID_URL size=40 maxlength=255 value=\"$row[36]\">$NWB#phones-local_web_callerID_URL$NWE</td></tr>\n";
|
||||
echo "<tr bgcolor=#B6D3FC><td align=right>"._QXZ("Agent Default URL").": </td><td align=left><input type=text name=agent_web_URL size=40 maxlength=255 value=\"$row[37]\">$NWB#phones-agent_web_URL$NWE</td></tr>\n";
|
||||
|
||||
echo "<tr bgcolor=#8EBCFD><td align=right>"._QXZ("NVA Call URL").": </td><td align=left><input type=text name=nva_call_url size=40 maxlength=255 value=\"$row[90]\">$NWB#phones-nva_call_url$NWE</td></tr>\n";
|
||||
echo "<tr bgcolor=#8EBCFD><td align=right>"._QXZ("NVA Call URL").": </td><td align=left><input type=text name=nva_call_url size=40 maxlength=2000 value=\"$row[90]\">$NWB#phones-nva_call_url$NWE</td></tr>\n";
|
||||
echo "<tr bgcolor=#8EBCFD><td align=right>"._QXZ("NVA Search Method").": </td><td align=left><input type=text name=nva_search_method size=20 maxlength=40 value=\"$row[91]\">$NWB#phones-nva_search_method$NWE</td></tr>\n";
|
||||
echo "<tr bgcolor=#8EBCFD><td align=right>"._QXZ("NVA Error Filename").": </td><td align=left colspan=3><input type=text name=nva_error_filename id=nva_error_filename size=40 maxlength=255 value=\"$row[92]\"> <a href=\"javascript:launch_chooser('nva_error_filename','date',1200);\">"._QXZ("audio chooser")."</a> $NWB#phones-nva_error_filename$NWE</td></tr>\n";
|
||||
|
||||
|
||||
@@ -4061,7 +4061,7 @@ if ($SSoutbound_autodial_active > 0)
|
||||
<BR>
|
||||
<A NAME="phones-nva_call_url">
|
||||
<BR>
|
||||
<B><?php echo _QXZ("NVA Call URL"); ?> -</B><?php echo _QXZ("This is the optional web URL that can be used together with the NVA agi script in a Call Menu to log phone calls made outside of the agent screen. Variables that can be used with this feature are- phone_number,uniqueid,lead_id,extension,server_ip."); ?>
|
||||
<B><?php echo _QXZ("NVA Call URL"); ?> -</B><?php echo _QXZ("This is the optional web URL that can be used together with the NVA agi script in a Call Menu to log phone calls made outside of the agent screen. Variables that can be used with this feature are- phone_number, uniqueid, lead_id, extension, server_ip, entry_date, modify_date, status, user, vendor_lead_code, source_id, list_id, 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, campaign_id, list_description, recording_id, recording_filename."); ?>
|
||||
|
||||
<BR>
|
||||
<A NAME="phones-nva_search_method">
|
||||
|
||||
Reference in New Issue
Block a user