release 1.1.12
git-svn-id: svn://192.168.202.10@10 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
+25
-22
@@ -22,6 +22,7 @@
|
||||
#
|
||||
# 60311-1309 - Fixed CallerID/name for VICIDIAL calls
|
||||
# 60315-1020 - Added MySQL query fail debug print output
|
||||
# 60622-0956 - Altered log for Zap client phones for consistent output
|
||||
#
|
||||
|
||||
$V = 0; # set to 1 for verbose mode
|
||||
@@ -173,6 +174,12 @@ else {$stage = 'START';}
|
||||
### call start stage
|
||||
if ($stage =~ /START/)
|
||||
{
|
||||
use Net::MySQL;
|
||||
|
||||
if (!$DB_port) {$DB_port='3306';}
|
||||
|
||||
my $dbh = Net::MySQL->new(hostname=>"$DB_server", database=>"$DB_database", user=>"$DB_user", password=>"$DB_pass", port => "$DB_port") or die "Couldn't connect to database: $DB_server - $DB_database\n";
|
||||
|
||||
|
||||
if ($V) {print STDERR "\nCALL STARTED\n";}
|
||||
if ($M) {print STDERR "+++++ CALL LOG START : |$unique_id|$channel|$extension|$type|$callerid|$now_date\n";}
|
||||
@@ -182,22 +189,24 @@ if ($stage =~ /START/)
|
||||
if ($channel =~ /^Zap\//)
|
||||
{
|
||||
$channel_line = $channel;
|
||||
$channel_line =~ s/^Zap\/|-\d$//gi;
|
||||
if ($V) {print STDERR "|$channel_line|";}
|
||||
### you will need to customize this to your configuration in terms of how you want the Zap lines described
|
||||
if ($channel_line <= 72)
|
||||
$channel_line =~ s/^Zap\///gi;
|
||||
|
||||
$dbh->query("SELECT count(*) FROM phones where server_ip='$server_ip' and extension='$channel_line' and protocol='Zap';");
|
||||
if ($dbh->has_selected_record) {
|
||||
$iter=$dbh->create_record_iterator;
|
||||
while ( $record = $iter->each) {
|
||||
$is_client_phone = "$record->[0]";
|
||||
if ($V) {print STDERR "$is_client_phone|$channel_line|\n";}
|
||||
}
|
||||
}
|
||||
if ($is_client_phone < 1)
|
||||
{
|
||||
$channel_group = 'Inbound Local T1-1';
|
||||
$number_dialed = $callerid;
|
||||
}
|
||||
if ( ($channel_line >= 73) && ($channel_line <= 96) )
|
||||
{
|
||||
$channel_group = 'Inbound 800 T1-2';
|
||||
$channel_group = 'Zap Trunk Line';
|
||||
$number_dialed = $callerid;
|
||||
}
|
||||
}
|
||||
### This section breaks the outbound dialed number down(or builds it up) to a 10 digit number and gives it a description
|
||||
if ($channel =~ /^SIP|^IAX2/)
|
||||
if ( ($channel =~ /^SIP|^IAX2/) or ($is_client_phone > 0) )
|
||||
{
|
||||
if ( ($extension =~ /^901144/) && (length($extension)==16) ) #test 207 608 6400
|
||||
{$extension =~ s/^9//gi; $channel_group = 'Outbound Intl UK';}
|
||||
@@ -211,27 +220,21 @@ if ($stage =~ /START/)
|
||||
{$extension =~ s/^9//gi; $channel_group = 'Outbound Local';}
|
||||
if ( ($extension =~ /^91/) && (length($extension)==12) )
|
||||
{$extension =~ s/^91//gi; $channel_group = 'Outbound Long Distance';}
|
||||
if ($is_client_phone > 0)
|
||||
{$channel_group = 'Zap Client Phone';}
|
||||
|
||||
$SIP_ext = $channel; $SIP_ext =~ s/SIP\/|IAX2\///gi;
|
||||
$SIP_ext = $channel; $SIP_ext =~ s/SIP\/|IAX2\/|Zap\///gi;
|
||||
|
||||
$number_dialed = $extension;
|
||||
$extension = $SIP_ext;
|
||||
}
|
||||
|
||||
use Net::MySQL;
|
||||
|
||||
if (!$DB_port) {$DB_port='3306';}
|
||||
|
||||
my $mysql = Net::MySQL->new(hostname=>"$DB_server", database=>"$DB_database", user=>"$DB_user", password=>"$DB_pass", port => "$DB_port") or die "Couldn't connect to database: $DB_server - $DB_database\n";
|
||||
|
||||
|
||||
|
||||
$stmtA = "INSERT INTO call_log (uniqueid,channel,channel_group,type,server_ip,extension,number_dialed,start_time,start_epoch,end_time,end_epoch,length_in_sec,length_in_min,caller_code) values('$unique_id','$channel','$channel_group','$type','$server_ip','$extension','$number_dialed','$now_date','$now_date_epoch','','','','','$callerid')";
|
||||
|
||||
if ($V) {print STDERR "\n|$stmtA|\n";}
|
||||
$mysql->query($stmtA) or die "Couldn't execute query: |$stmtA|\n";
|
||||
$dbh->query($stmtA) or die "Couldn't execute query: |$stmtA|\n";
|
||||
|
||||
$mysql->close;
|
||||
$dbh->close;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user