Added DID Filter URL logging to url log, and added variables for uniqueid, channel and server_ip
git-svn-id: svn://192.168.202.10@2367 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
#
|
#
|
||||||
# agi-DID_route.agi version 2.10
|
# agi-DID_route.agi version 2.12
|
||||||
#
|
#
|
||||||
# runs when a call comes into an inbound context on a trunk. This script will
|
# runs when a call comes into an inbound context on a trunk. This script will
|
||||||
# send the calls to various places depending on the settings for each DID.
|
# send the calls to various places depending on the settings for each DID.
|
||||||
@@ -39,6 +39,7 @@
|
|||||||
# 141110-1417 - Fixed issue with multiple filtering options enabled
|
# 141110-1417 - Fixed issue with multiple filtering options enabled
|
||||||
# 150112-1426 - Added no-agent last_update_time check to match in-group queries
|
# 150112-1426 - Added no-agent last_update_time check to match in-group queries
|
||||||
# 150708-2252 - Added max_queue_ingroup_ DID options
|
# 150708-2252 - Added max_queue_ingroup_ DID options
|
||||||
|
# 150806-1316 - Added Filter URL logging to url log, and added variables for uniqueid, channel and server_ip
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
@@ -575,18 +576,42 @@ if ( ($filter_inbound_number =~ /GROUP|URL|DNC_INTERNAL|DNC_CAMPAIGN/) && ($pre_
|
|||||||
$filter_url =~ s/^VAR|^ //gi;
|
$filter_url =~ s/^VAR|^ //gi;
|
||||||
$filter_url =~ s/--A--phone_number--B--/$callerid/gi;
|
$filter_url =~ s/--A--phone_number--B--/$callerid/gi;
|
||||||
$filter_url =~ s/--A--did_pattern--B--/$did_pattern/gi;
|
$filter_url =~ s/--A--did_pattern--B--/$did_pattern/gi;
|
||||||
|
$filter_url =~ s/--A--uniqueid--B--/$uniqueid/gi;
|
||||||
|
$filter_url =~ s/--A--channel--B--/$channel/gi;
|
||||||
|
$filter_url =~ s/--A--server_ip--B--/$VARserver_ip/gi;
|
||||||
$filter_url =~ s/&/\\&/gi;
|
$filter_url =~ s/&/\\&/gi;
|
||||||
$filter_url =~ s/ /+/gi;
|
$filter_url =~ s/ /+/gi;
|
||||||
|
|
||||||
|
### insert a new url log entry
|
||||||
|
$SQL_log = "$filter_url";
|
||||||
|
$SQL_log =~ s/;|\||\\//gi;
|
||||||
|
$stmtA = "INSERT INTO vicidial_url_log SET uniqueid='$uniqueid',url_date=NOW(),url_type='DID_FILTER',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 $filter_url`;
|
@curl_output = `$curlbin $filter_url`;
|
||||||
|
|
||||||
|
my $secY = time();
|
||||||
|
my $response_sec = ($secY - $secW);
|
||||||
|
|
||||||
$k=0;
|
$k=0;
|
||||||
$full_output='';
|
$full_output='';
|
||||||
foreach (@curl_output)
|
foreach (@curl_output)
|
||||||
{
|
{
|
||||||
$full_output .= $curl_output[$k];
|
$full_output_raw .= $curl_output[$k];
|
||||||
$k++;
|
$k++;
|
||||||
}
|
}
|
||||||
|
$full_output = $full_output_raw;
|
||||||
$full_output =~ s/\D//gi;
|
$full_output =~ s/\D//gi;
|
||||||
if ($full_output > 0)
|
if ($full_output > 0)
|
||||||
{
|
{
|
||||||
@@ -597,7 +622,12 @@ if ( ($filter_inbound_number =~ /GROUP|URL|DNC_INTERNAL|DNC_CAMPAIGN/) && ($pre_
|
|||||||
if ($AGILOG) {$agi_string = "Filter URL DID Redirect found: |$filter_match_found|$filter_url_did_redirect|$did_route|"; &agi_output;}
|
if ($AGILOG) {$agi_string = "Filter URL DID Redirect found: |$filter_match_found|$filter_url_did_redirect|$did_route|"; &agi_output;}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($AGILOG) {$agi_string = "URL filter search response: |$filter_match_found|$full_output|$filter_url|"; &agi_output;}
|
### 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 = "URL filter search response: |$filter_match_found|$full_output|$filter_url|$affected_rows|"; &agi_output;}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($filter_match_found > 0)
|
if ($filter_match_found > 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user