Thread: [Astpp-commit] SF.net SVN: astpp:[2247] trunk (Page 2)
Brought to you by:
darrenkw
|
From: <dar...@us...> - 2009-04-29 15:29:51
|
Revision: 2247
http://astpp.svn.sourceforge.net/astpp/?rev=2247&view=rev
Author: darrenkw
Date: 2009-04-29 15:29:46 +0000 (Wed, 29 Apr 2009)
Log Message:
-----------
Updated FreeSwitch DID handling support.
Modified Paths:
--------------
trunk/freeswitch/astpp-fs-xml.pl
trunk/modules/ASTPP/lib/ASTPP.pm
Modified: trunk/freeswitch/astpp-fs-xml.pl
===================================================================
--- trunk/freeswitch/astpp-fs-xml.pl 2009-04-18 17:25:14 UTC (rev 2246)
+++ trunk/freeswitch/astpp-fs-xml.pl 2009-04-29 15:29:46 UTC (rev 2247)
@@ -68,9 +68,6 @@
DID => $didinfo->{number}
);
-
-
-
if ( !$params->{variable_accountcode} ) {
# First we strip off X digits to see if this account is prepending numbers
Modified: trunk/modules/ASTPP/lib/ASTPP.pm
===================================================================
--- trunk/modules/ASTPP/lib/ASTPP.pm 2009-04-18 17:25:14 UTC (rev 2246)
+++ trunk/modules/ASTPP/lib/ASTPP.pm 2009-04-29 15:29:46 UTC (rev 2247)
@@ -133,7 +133,7 @@
# Return the dialplan code for an incoming call to a DID.
{
my ($self, %arg) = @_;
- my ( $sql, $trunkdata, $dialstring,$data );
+ my ( $xml,$sql, $trunkdata, $dialstring,$data );
my $tmp = "SELECT * FROM dids WHERE number = "
. $self->{_astpp_db}->quote( $arg{did} ) .
" LIMIT 1";
@@ -142,7 +142,21 @@
$sql->execute;
my $diddata = $sql->fetchrow_hashref;
$sql->finish;
- return $diddata->{variables};
+ my @variables = split /,(?!(?:[^",]|[^"],[^"])+")/, $diddata->{variables};
+ foreach my $variable (@variables) {
+ $xml .= "<action application=\"set\" data=\"" . $variable . "\"/>\n";
+ }
+ if ($diddata->{extensions} =~ m/^("|)(L|l)ocal.*/m) {
+ my ($junk,$ext,$context) = split /,(?!(?:[^",]|[^"],[^"])+")/, $diddata->{extensions};
+ #jump to local dialplan
+$ext =~ s/"//mg;
+$context =~ s/"//mg;
+ $xml .= "<action application=\"execute_extension\" data=\"" . $ext ." XML " .$context . "\"/>\n";
+ } else {
+ $xml .= "<action application=\"bridge\" data=\"" . $diddata->{extensions} . "\"/>\n";
+ }
+
+ return $xml;
}
sub fs_dialplan_xml_bridge
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dar...@us...> - 2009-05-16 00:39:10
|
Revision: 2250
http://astpp.svn.sourceforge.net/astpp/?rev=2250&view=rev
Author: darrenkw
Date: 2009-05-16 00:38:57 +0000 (Sat, 16 May 2009)
Log Message:
-----------
Fixed the code that emails out account details on account/device creation.
Modified Paths:
--------------
trunk/scripts/astpp-common.pl
trunk/web_interface/astpp-admin.cgi
Modified: trunk/scripts/astpp-common.pl
===================================================================
--- trunk/scripts/astpp-common.pl 2009-05-15 23:57:25 UTC (rev 2249)
+++ trunk/scripts/astpp-common.pl 2009-05-16 00:38:57 UTC (rev 2250)
@@ -541,13 +541,15 @@
To => $vars->{email},
From => $config->{company_email},
Bcc => $config->{company_email},
- Subject => 'VOIP Account Created',
+ Subject => 'VOIP Device Account Created',
'X-Mailer' => "Mail::Sendmail version $Mail::Sendmail::VERSION",
);
$mail{'Message : '} =
"Attention: $vars->{title} $vars->{first} $vars->{last}\n"
. "A new device has been enabled on your account. Here\n"
. "is the necessary configuration information.\n\n"
+ . "Username: $vars->{extension}\n"
+ . "Password: $vars->{secret}\n\n"
. "------- $config->{company_name} Configuration Info --------\n";
if ( $vars->{type} eq "SIP" ) {
@@ -628,6 +630,7 @@
if ( sendmail %mail ) { print STDERR "Mail sent OK.\n" }
else { print STDERR "Error sending mail: $Mail::Sendmail::error \n" }
print STDERR "\n\$Mail::Sendmail::log says:\n", $Mail::Sendmail::log;
+ print STDERR $mail{'Message : '};
}
# Send an email when on calling card creation. This needs to be updated and moved to templates which reside in the database and can be
Modified: trunk/web_interface/astpp-admin.cgi
===================================================================
--- trunk/web_interface/astpp-admin.cgi 2009-05-15 23:57:25 UTC (rev 2249)
+++ trunk/web_interface/astpp-admin.cgi 2009-05-16 00:38:57 UTC (rev 2250)
@@ -2310,6 +2310,8 @@
$params->{posttoexternal} );
}
if ( $config->{email} == 1 && $params->{accounttype} == 0 ) {
+ $params->{extension} = $params->{number};
+ $params->{secret} = $params->{accountpassword};
&email_add_user( $astpp_db, '', $config, $params );
}
my $timestamp = &prettytimestamp;
@@ -2408,6 +2410,12 @@
$params, $accountinfo->{cc}
);
$status .= "<br>";
+ if ( $config->{email} == 1 && $params->{accounttype} == 0 ) {
+ $params->{extension} = $name;
+ $params->{secret} = $params->{accountpassword};
+ &email_add_device( $astpp_db, '', $config, $params );
+ print STDERR "Sent Device Generation Email\n";
+ }
}
if ( $config->{users_dids_amp} == 1 ) {
my $name =
@@ -2420,6 +2428,12 @@
$params, $accountinfo->{cc}
);
$status .= "<br>";
+ if ( $config->{email} == 1 && $params->{accounttype} == 0 ) {
+ $params->{extension} = $name;
+ $params->{secret} = $params->{accountpassword};
+ &email_add_device( $astpp_db, '', $config, $params );
+ print STDERR "Sent Device Generation Email\n";
+ }
}
if ( $config->{openser} == 1 ) {
$status .= $status .=
@@ -2427,6 +2441,12 @@
$params->{accountpassword},
$params->{context}, $params->{number}, $params );
$status .= "<br>";
+ if ( $config->{email} == 1 && $params->{accounttype} == 0 ) {
+ $params->{extension} = $name;
+ $params->{secret} = $params->{accountpassword};
+ &email_add_device( $astpp_db, '', $config, $params );
+ print STDERR "Sent Device Generation Email\n";
+ }
}
if ( $config->{users_dids_freeswitch} == 1 ) {
my $name =
@@ -2437,6 +2457,12 @@
$params->{accountpassword},
$params->{number}, $params, $accountinfo->{cc} );
$status .= "<br>";
+ if ( $config->{email} == 1 && $params->{accounttype} == 0 ) {
+ $params->{extension} = $name;
+ $params->{secret} = $params->{accountpassword};
+ &email_add_device( $astpp_db, '', $config, $params );
+ print STDERR "Sent Device Generation Email\n";
+ }
}
}
if ( $params->{IAX2} ) {
@@ -2453,6 +2479,12 @@
$params, $accountinfo->{cc}
);
$status .= "<br>";
+ if ( $config->{email} == 1 && $params->{accounttype} == 0 ) {
+ $params->{extension} = $name;
+ $params->{secret} = $params->{accountpassword};
+ &email_add_device( $astpp_db, '', $config, $params );
+ print STDERR "Sent Device Generation Email\n";
+ }
}
if ( $config->{users_dids_rt} == 1 ) {
my $name = &finduniqueiax_rt( $params->{number} );
@@ -2463,6 +2495,12 @@
$params, $accountinfo->{cc}
);
$status .= "<br>";
+ if ( $config->{email} == 1 && $params->{accounttype} == 0 ) {
+ $params->{extension} = $name;
+ $params->{secret} = $params->{accountpassword};
+ &email_add_device( $astpp_db, '', $config, $params );
+ print STDERR "Sent Device Generation Email\n";
+ }
}
}
### End of Device creation support
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dar...@us...> - 2009-09-19 23:53:53
|
Revision: 2253
http://astpp.svn.sourceforge.net/astpp/?rev=2253&view=rev
Author: darrenkw
Date: 2009-09-19 23:53:41 +0000 (Sat, 19 Sep 2009)
Log Message:
-----------
This adds support for internal invoice generation. This upgrade will require a few manual database upgrades. I am not committing invoice presentation yet.
Modified Paths:
--------------
trunk/modules/ASTPP/lib/ASTPP.pm
trunk/scripts/astpp-common.pl
trunk/scripts/astpp-generate-invoices.pl
trunk/sql/astpp-2009-09-19.sql
Modified: trunk/modules/ASTPP/lib/ASTPP.pm
===================================================================
--- trunk/modules/ASTPP/lib/ASTPP.pm 2009-09-19 18:53:05 UTC (rev 2252)
+++ trunk/modules/ASTPP/lib/ASTPP.pm 2009-09-19 23:53:41 UTC (rev 2253)
@@ -517,7 +517,217 @@
return @pricelistlist;
}
+sub invoice_cdrs
+# Function 1 = count cdrs
+# Function 2 = return crds
+# Function 3 = Internal Invoices, Post CDRs.
+{
+ my ($self, %arg) = @_; #Count the cdrs billable on a specific account
+ my $tmp;
+ if ($arg{function} == 1) {
+ $tmp = "SELECT COUNT(*) FROM cdrs WHERE cardnum = ";
+ }
+ elsif ($arg{function} == 2) {
+ $tmp = "SELECT * FROM cdrs WHERE cardnum = ";
+ }
+ elsif ($arg{function} == 3) {
+ $tmp = "UPDATE cdrs SET invoiceid = "
+ . $self->{_astpp_db}->quote($arg{invoiceid})
+ . ",status = 1 "
+ . " WHERE cardnum = ";
+ }
+ if ($arg{startdate} && $arg{enddate}) {
+ $tmp .= $self->{_astpp_db}->quote($arg{cardnum})
+ . " AND status = 0"
+ . " AND callstart >= DATE(" . $self->{_astpp_db}->quote($arg{startdate}) . ")"
+ . " AND callstart <= DATE(" . $self->{_astpp_db}->quote($arg{enddate}) . ")";
+ } elsif ($arg{startdate}) {
+ $tmp .= $self->{_astpp_db}->quote($arg{cardnum})
+ . " AND status = 0"
+ . " AND callstart >= DATE(" . $self->{_astpp_db}->quote($arg{startdate}) . ")";
+ } elsif ($arg{enddate}) {
+ $tmp .= $self->{_astpp_db}->quote($arg{cardnum})
+ . " AND status = 0"
+ . " AND callstart <= DATE(" . $self->{_astpp_db}->quote($arg{enddate}) . ")";
+ } else {
+ $tmp .= $self->{_astpp_db}->quote($arg{cardnum})
+ . " AND status = 0";
+ }
+ if ($arg{function} == 2) {
+ $tmp .= " GROUP BY type ORDER BY callstart";
+ }
+ print STDERR "$tmp \n";
+ my $sql = $self->{_astpp_db}->prepare($tmp);
+ $sql->execute;
+
+ if ($arg{function} == 1) {
+ my $row = $sql->fetchrow_hashref;
+ $sql->finish;
+ return(
+ $row->{"COUNT(*)"}
+ );
+ }
+ elsif ($arg{function} == 2) {
+ my @cdrs;
+ while ( my $record = $sql->fetchrow_hashref ) {
+ push @cdrs, $record;
+ }
+ $sql->finish;
+ return(
+ @cdrs
+ );
+ }
+}
+
+sub invoice_create_internal
+{
+ my ($self, %arg) = @_; # Create invoice in ASTPP Internally and return the invoice number.
+ my $tmp = "INSERT into invoices (accountid,date) VALUES("
+ . $self->{_astpp_db}->quote($arg{accountid})
+ . ",curdate())";
+ my $sql = $self->{_astpp_db}->prepare($tmp);
+ $sql->execute;
+ my $invoice = $sql->{'mysql_insertid'};
+ $sql->finish;
+ return (
+ $invoice
+ );
+}
+
+sub invoice_cdrs_subtotal_internal
+{
+ my ($self, %arg) = @_; # Create invoice in ASTPP Internally and return the invoice number.
+ my ($tmp,$row,$sql,$credit,$debit,$total);
+ $tmp = "SELECT SUM(debit) FROM cdrs WHERE invoiceid = "
+ . $self->{_astpp_db}->quote($arg{invoiceid});
+ $sql = $self->{_astpp_db}->prepare($tmp);
+ $sql->execute;
+ $row = $sql->fetchrow_hashref;
+ $debit = $row->{"SUM(debit)"};
+ $sql->finish;
+ $tmp = "SELECT SUM(credit) FROM cdrs WHERE invoiceid = "
+ . $self->{_astpp_db}->quote($arg{invoiceid});
+ $sql = $self->{_astpp_db}->prepare($tmp);
+ $sql->execute;
+ $row = $sql->fetchrow_hashref;
+ $credit = $row->{"SUM(credit)"};
+ $sql->finish;
+ if ( !$credit ) { $credit = 0; }
+ if ( !$debit ) { $debit = 0; }
+ $total = ( $debit - $credit );
+ return ($total/10000);
+
+# $tmp = "INSERT into invoices_total (invoiceid,title,text,value,class,sort_order) VALUES("
+# . $self->{_astpp_db}->quote($arg{invoiceid})
+# . ",'Subtotal','',"
+# . $self->{_astpp_db}->quote($total/10000)
+# . ",1,"
+# . $self->{_astpp_db}->quote($arg{sort_order})
+# . ")";
+# $sql = $ $self->{_astpp_db}->prepare($tmp);
+# $sql->execute;
+# return $arg{sort_order}++;
+}
+
+sub invoice_subtotal_post_internal
+{
+ my ($self, %arg) = @_;
+ $arg{value} = sprintf( "%." . $arg{decimalpoints_total} . "f", $arg{value} );
+ my $tmp = "INSERT into invoices_total (invoices_id,title,text,value,class,sort_order) VALUES("
+ . $self->{_astpp_db}->quote($arg{invoiceid})
+ . ","
+ . $self->{_astpp_db}->quote($arg{title})
+ . ","
+ . $self->{_astpp_db}->quote($arg{text})
+ . ","
+ . $self->{_astpp_db}->quote($arg{value})
+ . ","
+ . $self->{_astpp_db}->quote($arg{class})
+ . ","
+ . $self->{_astpp_db}->quote($arg{sort_order})
+ . ")";
+ my $sql = $self->{_astpp_db}->prepare($tmp);
+ $sql->execute;
+ return $arg{sort_order}++;
+}
+
+sub invoice_subtotal_internal
+{
+ my ($self, %arg) = @_;
+ my $tmp = "SELECT SUM(value) FROM invoices_total WHERE invoices_id = "
+ . $self->{_astpp_db}->quote($arg{invoiceid});
+ my $sql = $self->{_astpp_db}->prepare($tmp);
+ $sql->execute;
+ my $row = $sql->fetchrow_hashref;
+ my $value = $row->{"SUM(value)"};
+ $sql->finish;
+ return $value;
+}
+
+sub invoice_taxes_internal
+# function 1 = list
+# function 2 = post
+{
+ my ($self, %arg) = @_; # Create invoice in ASTPP Internally and return the invoice number.
+ my (@taxes,$row,$tmp,$sql);
+ $tmp = "SELECT * FROM taxes_to_accounts_view WHERE accountid = "
+ . $self->{_astpp_db}->quote($arg{accountid})
+ . " ORDER BY taxes_priority ASC";
+ $sql = $self->{_astpp_db}->prepare($tmp);
+ print STDERR $tmp . "/n";
+ $sql->execute;
+ while ( $row = $sql->fetchrow_hashref ) {
+ push @taxes, $row;
+ }
+ $sql->finish;
+ if ($arg{function} == 1) {
+ return @taxes;
+ }
+ my $tax_count = 1;
+ my $sort = 1;
+ my $tax_priority = "";
+ my $subtotal = $arg{invoice_subtotal};
+ foreach my $tax (@taxes) {
+ my ($tax_amount);
+ if ($tax_priority eq "") {
+ $tax_priority = $tax->{taxes_priority};
+ } elsif($tax->{taxes_priority} > $tax_priority) {
+ $tax_priority = $tax->{taxes_priority};
+ my $tmp = "SELECT SUM(value) FROM invoices_total WHERE invoices_id = "
+ . $self->{_astpp_db}->quote($arg{invoiceid});
+ print STDERR $tmp . "\n";
+ my $sql = $self->{_astpp_db}->prepare($tmp);
+ $sql->execute;
+ my $row = $sql->fetchrow_hashref;
+ $subtotal = $row->{"SUM(value)"};
+ $sql->finish;
+ }
+ print STDERR "Subtotal: $subtotal \n";
+ print STDERR "Tax_rate: $tax->{taxes_rate} \n";
+ my $tax_total = (($subtotal * ( $tax->{taxes_rate} / 100 )) + $tax->{taxes_amount} );
+ print STDERR "Tax Total: $tax_total \n";
+ print STDERR "Round to: $arg{decimalpoints_tax} \n";
+ $tax_total = sprintf( "%." . $arg{decimalpoints_tax} . "f", $tax_total );
+ print STDERR "Tax Total: $tax_total \n";
+ my $tmp = "INSERT INTO invoices_total (invoices_id,title,text,value,class,sort_order) VALUES("
+ . $self->{_astpp_db}->quote($arg{invoiceid})
+ . ",'TAX',"
+ . $self->{_astpp_db}->quote($tax->{taxes_description})
+ . ","
+ . $self->{_astpp_db}->quote($tax_total)
+ . ",2,"
+ . $self->{_astpp_db}->quote($arg{sort_order})
+ . ")";
+ print STDERR $tmp . "\n";
+ my $sql = $self->{_astpp_db}->prepare($tmp);
+ $sql->execute;
+
+ $arg{sort_order}++;
+ }
+ return $arg{sort_order};
+}
+
# Preloaded methods go here.
1;
Modified: trunk/scripts/astpp-common.pl
===================================================================
--- trunk/scripts/astpp-common.pl 2009-09-19 18:53:05 UTC (rev 2252)
+++ trunk/scripts/astpp-common.pl 2009-09-19 23:53:41 UTC (rev 2253)
@@ -999,7 +999,7 @@
$dsn =
"DBI:Pg:database=$config->{cdr_dbname};host=$config->{cdr_dbhost}";
}
- print STDERR $dsn if $config->{debug} == 1;
+ print STDERR $dsn . "\n" if $config->{debug} == 1;
$dbh = DBI->connect( $dsn, $config->{cdr_dbuser}, $config->{cdr_dbpass} );
if ( !$dbh ) {
print STDERR "CDR DATABASE IS DOWN\n";
@@ -3999,6 +3999,7 @@
else {
$outfile = $config->{csv_dir} . $reseller . ".csv";
}
+ $outfile = "/var/log/astpp/astpp.csv" if !$outfile;
my $notes = "Notes: " . $cdrinfo->{accountcode};
open( OUTFILE, ">>$outfile" )
|| die "CSV Error - could not open $outfile for writing\n";
Modified: trunk/scripts/astpp-generate-invoices.pl
===================================================================
--- trunk/scripts/astpp-generate-invoices.pl 2009-09-19 18:53:05 UTC (rev 2252)
+++ trunk/scripts/astpp-generate-invoices.pl 2009-09-19 23:53:41 UTC (rev 2253)
@@ -33,6 +33,7 @@
use Locale::Country;
use Locale::gettext_pp qw(:locale_h);
use Data::Dumper;
+use ASTPP;
#use strict;
use lib './lib', '../lib';
@@ -44,7 +45,10 @@
use vars qw($config $astpp_db $osc_db $agile_db $cdr_db
@output @cardlist $config $params);
@output = ( "STDOUT", "LOGFILE" );
+$ASTPP = ASTPP->new;
+$ASTPP->set_verbosity(4); #Tell ASTPP debugging how verbose we want to be.
+
sub initialize() {
$config = &load_config();
$astpp_db = &connect_db( $config, @output );
@@ -54,6 +58,7 @@
if $config->{externalbill} eq "oscommerce";
open( LOGFILE, ">>$config->{log_file}" )
|| die "Error - could not open $config->{log_file} for writing\n";
+ $ASTPP->set_astpp_db($astpp_db);
}
sub shutdown() {
@@ -84,6 +89,73 @@
}
}
}
+elsif ( $config->{externalbill} eq "internal" ) {
+ my @cardlist;
+ if ( $params->{sweep} ) {
+ @cardlist = &update_list_cards($astpp_db, $config, $params->{sweep} );
+ }
+ foreach (@cardlist) {
+ my $cardno = $_;
+ my $carddata = &get_account( $astpp_db, $cardno );
+ if ( $carddata->{posttoexternal} == 1 ) {
+ foreach my $handle (@output) {
+ print $handle "Card: $cardno \n";
+ }
+ my $cdr_count = $ASTPP->invoice_cdrs(
+ accountid => $carddata->{accountid},
+ cardnum => $carddata->{number},
+ function => 1
+ );
+ if ($cdr_count > 0) {
+ my $invoice = $ASTPP->invoice_create_internal(
+ accountid => $carddata->{accountid}
+ );
+ $ASTPP->invoice_cdrs(
+ accountid => $carddata->{accountid},
+ cardnum => $carddata->{number},
+ invoiceid => $invoice,
+ function => 3
+ );
+
+ my $sort_order = 1;
+
+ my $subtotal = $ASTPP->invoice_cdrs_subtotal_internal(
+ invoiceid => $invoice
+ );
+ $sort_order = $ASTPP->invoice_subtotal_post_internal(
+ decimalpoints_total => $config->{decimalpoints_total},
+ invoiceid => $invoice,
+ sort_order => $sort_order,
+ value => $subtotal,
+ title => "Sub Total",
+ text => "Sub Total",
+ class => "1"
+ );
+ $sort_order = $ASTPP->invoice_taxes_internal(
+ accountid => $carddata->{accountid},
+ invoiceid => $invoice,
+ sort_order => $sort_order,
+ function => 2,
+ decimalpoints_tax => $config->{decimalpoints_tax},
+ decimalpoints_total => $config->{decimalpoints_total},
+ invoice_subtotal => $subtotal
+ );
+ $subtotal = $ASTPP->invoice_subtotal_internal(
+ invoiceid => $invoice
+ );
+ $sort_order = $ASTPP->invoice_subtotal_post_internal(
+ decimalpoints_total => $config->{decimalpoints_total},
+ invoiceid => $invoice,
+ sort_order => $sort_order,
+ value => $subtotal,
+ title => "Total",
+ text => "Total",
+ class => "1"
+ );
+ }
+ }
+ }
+}
elsif ( $config->{externalbill} eq "agile" ) {
my @cardlist = &list_cards($astpp_db);
foreach my $cardno (@cardlist) {
Modified: trunk/sql/astpp-2009-09-19.sql
===================================================================
--- trunk/sql/astpp-2009-09-19.sql 2009-09-19 18:53:05 UTC (rev 2252)
+++ trunk/sql/astpp-2009-09-19.sql 2009-09-19 23:53:41 UTC (rev 2253)
@@ -172,7 +172,8 @@
dialed_modify TEXT NOT NULL DEFAULT '',
type INTEGER DEFAULT 0,
tz CHAR(40) NOT NULL DEFAULT '',
-PRIMARY KEY (`number`),
+PRIMARY KEY (`accountid`),
+ KEY `pricelist` (`number`),
KEY `pricelist` (`pricelist`),
KEY `reseller` (`reseller`)
);
@@ -348,6 +349,9 @@
INSERT INTO system (name, value, comment) VALUES (
+'log_file','/var/log/astpp/astpp.log','Where do I log to?');
+
+INSERT INTO system (name, value, comment) VALUES (
'callout_accountcode','admin','Call Files: What accountcode should we use?');
INSERT INTO system (name, value, comment) VALUES (
@@ -1369,3 +1373,16 @@
`taxes_id` VARCHAR( 11 ) NOT NULL
) ENGINE = MYISAM ;
+
+;;;; Create Views Here
+;
+CREATE VIEW taxes_to_accounts_view AS SELECT
+taxes_to_accounts.id,
+taxes_to_accounts.accountid,
+taxes.taxes_id,
+taxes.taxes_priority,
+taxes.taxes_amount,
+taxes.taxes_rate,
+taxes.taxes_description
+FROM taxes_to_accounts, taxes
+WHERE taxes.taxes_id = taxes_to_accounts.taxes_id;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dar...@us...> - 2009-09-20 01:22:35
|
Revision: 2254
http://astpp.svn.sourceforge.net/astpp/?rev=2254&view=rev
Author: darrenkw
Date: 2009-09-20 00:18:28 +0000 (Sun, 20 Sep 2009)
Log Message:
-----------
Add another view to show invoice totals.
Modified Paths:
--------------
trunk/scripts/astpp-generate-invoices.pl
trunk/sql/astpp-2009-09-19.sql
trunk/templates/account-info.tpl
Modified: trunk/scripts/astpp-generate-invoices.pl
===================================================================
--- trunk/scripts/astpp-generate-invoices.pl 2009-09-19 23:53:41 UTC (rev 2253)
+++ trunk/scripts/astpp-generate-invoices.pl 2009-09-20 00:18:28 UTC (rev 2254)
@@ -150,7 +150,7 @@
value => $subtotal,
title => "Total",
text => "Total",
- class => "1"
+ class => "9" #class 9 = total
);
}
}
Modified: trunk/sql/astpp-2009-09-19.sql
===================================================================
--- trunk/sql/astpp-2009-09-19.sql 2009-09-19 23:53:41 UTC (rev 2253)
+++ trunk/sql/astpp-2009-09-19.sql 2009-09-20 00:18:28 UTC (rev 2254)
@@ -1386,3 +1386,15 @@
taxes.taxes_description
FROM taxes_to_accounts, taxes
WHERE taxes.taxes_id = taxes_to_accounts.taxes_id;
+
+
+CREATE VIEW invoice_list_view AS SELECT
+invoices.invoiceid,
+invoices.accountid,
+invoices.date,
+invoices.status,
+invoices_total.value,
+invoices_total.class
+FROM invoices, invoices_total
+WHERE invoices_total.class = 9
+AND invoices.invoiceid = invoices_total.invoices_id;
Modified: trunk/templates/account-info.tpl
===================================================================
--- trunk/templates/account-info.tpl 2009-09-19 23:53:41 UTC (rev 2253)
+++ trunk/templates/account-info.tpl 2009-09-20 00:18:28 UTC (rev 2254)
@@ -197,6 +197,24 @@
<td><TMPL_VAR NAME="context"></td>
</tr>
</TMPL_LOOP>
+</table>
+<table class="default">
+ <tr class="header">
+ <td>Invoice Number</td>
+ <td>Invoice Date</td>
+ <td>Invoice Total</td>
+ <td>HTML View</td>
+ <td>PDF View</td>
+ </tr>
+ <TMPL_LOOP NAME="account_invoice_list">
+ <tr>
+ <td><TMPL_VAR NAME="invoiceid"></td>
+ <td><TMPL_VAR NAME="date"></td>
+ <td><TMPL_VAR NAME="total"></td>
+ <td><a href="astpp-admin.cgi?mode=View Invoice&format=html&invoiceid=<TMPL_VAR NAME="invoiceid">">View</a></td>
+ <td><a href="astpp-admin.cgi?mode=View Invoice&format=pdf&invoiceid=<TMPL_VAR NAME="invoiceid">">View</a></td>
+ </tr>
+ </TMPL_LOOP>
</table>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dar...@us...> - 2009-09-20 03:31:37
|
Revision: 2255
http://astpp.svn.sourceforge.net/astpp/?rev=2255&view=rev
Author: darrenkw
Date: 2009-09-20 03:31:28 +0000 (Sun, 20 Sep 2009)
Log Message:
-----------
More work towards invoice presentation
Modified Paths:
--------------
trunk/modules/ASTPP/lib/ASTPP.pm
trunk/templates/account-info.tpl
trunk/web_interface/astpp-admin.cgi
Added Paths:
-----------
trunk/templates/invoice.tpl
Modified: trunk/modules/ASTPP/lib/ASTPP.pm
===================================================================
--- trunk/modules/ASTPP/lib/ASTPP.pm 2009-09-20 00:18:28 UTC (rev 2254)
+++ trunk/modules/ASTPP/lib/ASTPP.pm 2009-09-20 03:31:28 UTC (rev 2255)
@@ -429,6 +429,7 @@
# set total_entries *once* then pass it around
# in the object's links from then on for efficiency:
my ($record,$sql);
+ $arg{te} = 0 if !$arg{te};
my $verify = $arg{ve} || '';
my $total_entries = int( $arg{te} );
my $te_match = $total_entries
@@ -580,6 +581,24 @@
}
}
+sub invoice_list_internal
+{
+ my ($self, %arg) = @_; # List Internal Invoices.
+ my ($tmp,$sql,@invoices);
+ $tmp = "SELECT * FROM invoice_list_view";
+ if ($arg{accountid}) {
+ $tmp .= " WHERE accountid = "
+ . $self->{_astpp_db}->quote($arg{accountid});
+ }
+ $sql = $self->{_astpp_db}->prepare($tmp);
+ $sql->execute;
+ while ( my $record = $sql->fetchrow_hashref ) {
+ push @invoices, $record;
+ }
+ $sql->finish;
+ return @invoices;
+}
+
sub invoice_create_internal
{
my ($self, %arg) = @_; # Create invoice in ASTPP Internally and return the invoice number.
@@ -728,6 +747,39 @@
return $arg{sort_order};
}
+
+sub account_cdr_post
+{
+ my ($self, %arg) = @_; # Create invoice in ASTPP Internally and return the invoice number.
+ $arg{description} = "" if !$arg{timestamp};
+ $arg{pricelist} = "" if !$arg{pricelist};
+ $arg{pattern} = "" if !$arg{pattern};
+ $arg{answeredtime} = "0" if !$arg{answeredtime};
+ $arg{uniqueid} = "N/A" if $arg{uniqueid} eq "" || !$arg{uniqueid};
+ $arg{clid} = "N/A" if $arg{clid} eq "" || !$arg{clid};
+
+ my $tmp = "INSERT INTO cdrs (uniqueid, cardnum, callednum, debit,"
+ . " billseconds, callstart,callerid,pricelist,pattern) VALUES ("
+ . $self->{_astpp_db}->quote($arg{uniqueid}) . ", "
+ . $self->{_astpp_db}->quote($arg{account}) . ","
+ . $self->{_astpp_db}->quote($arg{description}) . ", "
+ . $self->{_astpp_db}->quote($arg{amount}) . ", "
+ . $self->{_astpp_db}->quote($arg{answeredtime}) . ", "
+ . $self->{_astpp_db}->quote($arg{timestamp}) . ", "
+ . $self->{_astpp_db}->quote($arg{clid}) . ","
+ . $self->{_astpp_db}->quote($arg{pricelist}) . ","
+ . $self->{_astpp_db}->quote($arg{pattern}) . ")";
+
+ if ( $self->{_astpp_db}->do($tmp) ) {
+ return (1, "POSTED CDR: $arg{account} in the amount of: " . $arg{amount} / 10000 . "\n");
+ }
+ else {
+ return (2, $tmp . " FAILED! \n");
+ }
+}
+
+
+
# Preloaded methods go here.
1;
Modified: trunk/templates/account-info.tpl
===================================================================
--- trunk/templates/account-info.tpl 2009-09-20 00:18:28 UTC (rev 2254)
+++ trunk/templates/account-info.tpl 2009-09-20 03:31:28 UTC (rev 2255)
@@ -76,7 +76,7 @@
<TMPL_LOOP NAME="chargelist">
<tr>
<td><a href="astpp-admin.cgi?mode=View Details&chargeid=<TMPL_VAR NAME="id">&accountnum=<TMPL_VAR NAME="accountnum">&action=Remove Charge...">Remove Charge...</a></td>
- <td><TMPL_VAR NAME="id"><td>
+ <td><TMPL_VAR NAME="id"></td>
<td><TMPL_VAR NAME="description"></td>
<td><TMPL_VAR NAME="sweep"></td>
<td>$<TMPL_VAR NAME="cost"></td>
@@ -200,6 +200,9 @@
</table>
<table class="default">
<tr class="header">
+ <td colspan=5>Invoices</td>
+ </tr>
+ <tr class="header">
<td>Invoice Number</td>
<td>Invoice Date</td>
<td>Invoice Total</td>
@@ -210,7 +213,7 @@
<tr>
<td><TMPL_VAR NAME="invoiceid"></td>
<td><TMPL_VAR NAME="date"></td>
- <td><TMPL_VAR NAME="total"></td>
+ <td><TMPL_VAR NAME="value"></td>
<td><a href="astpp-admin.cgi?mode=View Invoice&format=html&invoiceid=<TMPL_VAR NAME="invoiceid">">View</a></td>
<td><a href="astpp-admin.cgi?mode=View Invoice&format=pdf&invoiceid=<TMPL_VAR NAME="invoiceid">">View</a></td>
</tr>
Added: trunk/templates/invoice.tpl
===================================================================
--- trunk/templates/invoice.tpl (rev 0)
+++ trunk/templates/invoice.tpl 2009-09-20 03:31:28 UTC (rev 2255)
@@ -0,0 +1,25 @@
+
+
+<table class="default">
+ <tr class="header">
+ <td>Date & Time</td>
+ <td>Caller*ID</td>
+ <td>Called Number</td>
+ <td>Disposition</td>
+ <td>Billable Seconds</td>
+ <td>Charge</td>
+ <td>Notes</td>
+ </tr>
+ <TMPL_LOOP NAME="invoice_cdr_list">
+ <TR>
+ <TD><TMPL_VAR NAME="callstart"></TD>
+ <TD><TMPL_VAR NAME="callerid"></TD>
+ <TD><TMPL_VAR NAME="callednum"></TD>
+ <TD><TMPL_VAR NAME="disposition"></TD>
+ <TD><TMPL_VAR NAME="billseconds"></TD>
+ <TD><TMPL_VAR NAME="charge"></TD>
+ <TD><TMPL_VAR NAME="notes"></TD>
+ </TR>
+ </TMPL_LOOP>
+</table>
+
Modified: trunk/web_interface/astpp-admin.cgi
===================================================================
--- trunk/web_interface/astpp-admin.cgi 2009-09-20 00:18:28 UTC (rev 2254)
+++ trunk/web_interface/astpp-admin.cgi 2009-09-20 03:31:28 UTC (rev 2255)
@@ -2110,6 +2110,11 @@
}
}
$template->param( account_device_list => \@account_device_list );
+ my @account_invoice_list = $ASTPP->invoice_list_internal(
+ accountid => $accountinfo->{accountid}
+ );
+ $template->param( account_invoice_list => \@account_invoice_list );
+
### End Section ###
( $sql, $pagination ) = $ASTPP->pagination(
sql_select => "SELECT * FROM cdrs WHERE cardnum ="
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dar...@us...> - 2009-09-22 04:11:20
|
Revision: 2256
http://astpp.svn.sourceforge.net/astpp/?rev=2256&view=rev
Author: darrenkw
Date: 2009-09-22 04:11:06 +0000 (Tue, 22 Sep 2009)
Log Message:
-----------
I finished the Freeswitch SIP device editing/deleting/adding interface allowing easy access to work with SIP devices in FreeSwitch from the GUI.
Modified Paths:
--------------
trunk/modules/ASTPP/lib/ASTPP.pm
trunk/templates/freeswitch-sip-list.tpl
trunk/web_interface/astpp-admin.cgi
Modified: trunk/modules/ASTPP/lib/ASTPP.pm
===================================================================
--- trunk/modules/ASTPP/lib/ASTPP.pm 2009-09-20 03:31:28 UTC (rev 2255)
+++ trunk/modules/ASTPP/lib/ASTPP.pm 2009-09-22 04:11:06 UTC (rev 2256)
@@ -233,6 +233,194 @@
return $arg{xml};
}
+sub fs_add_sip_user
+# Add a SIP user
+# Arguments
+# sip_ext_prepend = $config->{sip_ext_prepend}
+# accountcode
+# context = $config->{freeswitch_context}
+# vm_password = Password
+# password = Password
+#
+{
+ my ($self, %arg) = @_;
+ # Find uniqueid to prepend to the login
+ my $sipid = 0;
+ if (!$arg{username} || $arg{username} eq "") {
+ $arg{username} = $arg{accountcode};
+ for ( ; ; ) {
+ my $count = 1;
+ $sipid =
+ int( rand() * 9000 + 1000 )
+ . int( rand() * 9000 + 1000 )
+ . int( rand() * 9000 + 1000 )
+ . int( rand() * 9000 + 1000 )
+ . int( rand() * 9000 + 1000 )
+ . int( rand() * 9000 + 1000 )
+ . int( rand() * 9000 + 1000 )
+ . int( rand() * 9000 + 1000 );
+ $sipid = $arg{sip_ext_prepend} . $sipid;
+ $sipid = substr( $sipid, 0, 5 );
+ $sipid = $arg{username} . $sipid;
+ my $sql =
+ $self->{_freeswitch_db}->prepare(
+ "SELECT COUNT(*) FROM directory WHERE username = "
+ . $self->{_freeswitch_db}->quote($sipid) );
+ $sql->execute;
+ my $record = $sql->fetchrow_hashref;
+ $sql->finish;
+ if ( $record->{"COUNT(*)"} == 0 ) {
+ last;
+ }
+ }
+ } else {
+ $arg{username} =~ s/\W//mg;
+ $sipid = $arg{username}
+ }
+
+ my $tmp =
+ "INSERT INTO directory (username,domain) VALUES ("
+ . $self->{_freeswitch_db}->quote($sipid) . ", "
+ . $self->{_freeswitch_db}->quote($arg{freeswitch_domain}). ")";
+ print STDERR $tmp . "\n";
+ my $sql = $self->{_freeswitch_db}->prepare($tmp);
+ if ( !$sql->execute ) {
+ print "$tmp failed";
+ return (1,"SIP Device Creation Failed!");
+ }
+ else {
+ my $directory_id = $sql->{'mysql_insertid'};
+ my $tmp = "INSERT INTO directory_vars (directory_id,var_name,var_value) VALUES ("
+ . $self->{_freeswitch_db}->quote($directory_id) . ","
+ . "'accountcode',"
+ . $self->{_freeswitch_db}->quote($arg{accountcode})
+ . "),("
+ . $self->{_freeswitch_db}->quote($directory_id) . ","
+ . "'user_context',"
+ . $self->{_freeswitch_db}->quote($arg{freeswitch_context}) . ")";
+ print STDERR $tmp . "\n";
+ $self->{_freeswitch_db}->do($tmp);
+
+ $tmp = "INSERT INTO directory_params (directory_id,param_name,param_value) VALUES ("
+ . $self->{_freeswitch_db}->quote($directory_id) . ","
+ . "'vm-password',"
+ . $self->{_freeswitch_db}->quote($arg{vm_password})
+ . "),("
+ . $self->{_freeswitch_db}->quote($directory_id) . ","
+ . "'password',"
+ . $self->{_freeswitch_db}->quote($arg{password}) . ")";
+ print STDERR $tmp . "\n";
+ $self->{_freeswitch_db}->do($tmp);
+
+ return (0, "SIP Device Added!" . "Username:" . " " . $sipid . " " . "Password:" . " " . $arg{password}, $sipid);
+ }
+}
+
+
+sub fs_save_sip_user
+{
+ my ($self, %arg) = @_;
+ my $tmp = "UPDATE directory SET username = "
+ . $self->{_freeswitch_db}->quote($arg{username})
+ . " WHERE id = "
+ . $self->{_freeswitch_db}->quote($arg{directory_id});
+ print STDERR $tmp . "\n";
+ $self->{_freeswitch_db}->do($tmp);
+
+ $tmp = "UPDATE directory_vars SET var_value = "
+ . $self->{_freeswitch_db}->quote($arg{accountcode})
+ . " WHERE var_name = 'accountcode'"
+ . " AND directory_id = "
+ . $self->{_freeswitch_db}->quote($arg{directory_id});
+ print STDERR $tmp . "\n";
+ $self->{_freeswitch_db}->do($tmp);
+
+ $tmp = "UPDATE directory_vars SET var_value = "
+ . $self->{_freeswitch_db}->quote($arg{freeswitch_context})
+ . " WHERE var_name = 'user_context'"
+ . " AND directory_id = "
+ . $self->{_freeswitch_db}->quote($arg{directory_id});
+ print STDERR $tmp . "\n";
+ $self->{_freeswitch_db}->do($tmp);
+
+ $tmp = "UPDATE directory_params SET param_value = "
+ . $self->{_freeswitch_db}->quote($arg{vm_password})
+ . " WHERE param_name = 'vm-password'"
+ . " AND directory_id = "
+ . $self->{_freeswitch_db}->quote($arg{directory_id});
+ print STDERR $tmp . "\n";
+ $self->{_freeswitch_db}->do($tmp);
+
+ $tmp = "UPDATE directory_params SET param_value = "
+ . $self->{_freeswitch_db}->quote($arg{password})
+ . " WHERE param_name = 'password'"
+ . " AND directory_id = "
+ . $self->{_freeswitch_db}->quote($arg{directory_id});
+ print STDERR $tmp . "\n";
+ $self->{_freeswitch_db}->do($tmp);
+
+ return (0, "SIP Device Saved!" . "Username:" . " " . $arg{username} . " " . "Password:" . " " . $arg{password}, $arg{username});
+}
+
+sub fs_retrieve_sip_user
+# Retrieve a SIP user
+# Parameters
+# directory_id = directory_id of sip user you are looking for.
+{
+ my ($self, %arg) = @_;
+ my ($tmp,$record,$sql,$deviceinfo);
+ $tmp = "SELECT username FROM directory WHERE id = "
+ . $self->{_freeswitch_db}->quote($arg{directory_id});
+ print STDERR $tmp . "\n";
+ $sql = $self->{_freeswitch_db}->prepare($tmp);
+ $sql->execute;
+ $record = $sql->fetchrow_hashref;
+ $sql->finish;
+ $deviceinfo->{username} = $record->{username};
+
+ $tmp = "SELECT var_value FROM directory_vars WHERE directory_id = "
+ . $self->{_freeswitch_db}->quote($arg{directory_id})
+ . " AND var_name = 'user_context'";
+ print STDERR $tmp . "\n";
+ $sql = $self->{_freeswitch_db}->prepare($tmp);
+ $sql->execute;
+ $record = $sql->fetchrow_hashref;
+ $sql->finish;
+ $deviceinfo->{context} = $record->{var_value};
+
+ $tmp = "SELECT param_value FROM directory_params WHERE directory_id = "
+ . $self->{_freeswitch_db}->quote($arg{directory_id})
+ . " AND param_name = 'password' LIMIT 1";
+ print STDERR $tmp . "\n";
+ $sql = $self->{_freeswitch_db}->prepare($tmp);
+ $sql->execute;
+ $record = $sql->fetchrow_hashref;
+ $sql->finish;
+ $deviceinfo->{password} = $record->{param_value};
+
+ $tmp = "SELECT param_value FROM directory_params WHERE directory_id = "
+ . $self->{_freeswitch_db}->quote($arg{directory_id})
+ . " AND param_name = 'vm-password' LIMIT 1";
+ print STDERR $tmp . "\n";
+ $sql = $self->{_freeswitch_db}->prepare($tmp);
+ $sql->execute;
+ $record = $sql->fetchrow_hashref;
+ $sql->finish;
+ $deviceinfo->{vm_password} = $record->{param_value};
+
+ $tmp = "SELECT var_value FROM directory_vars WHERE directory_id = "
+ . $self->{_freeswitch_db}->quote($arg{directory_id})
+ . " AND var_name = 'accountcode' LIMIT 1";
+ print STDERR $tmp . "\n";
+ $sql = $self->{_freeswitch_db}->prepare($tmp);
+ $sql->execute;
+ $record = $sql->fetchrow_hashref;
+ $sql->finish;
+ $deviceinfo->{accountcode} = $record->{var_value};
+ return $deviceinfo;
+}
+
+
sub fs_delete_sip_user
#Delete the SIP user
#id = directory.id to delete
Modified: trunk/templates/freeswitch-sip-list.tpl
===================================================================
--- trunk/templates/freeswitch-sip-list.tpl 2009-09-20 03:31:28 UTC (rev 2255)
+++ trunk/templates/freeswitch-sip-list.tpl 2009-09-22 04:11:06 UTC (rev 2256)
@@ -2,14 +2,32 @@
<table>
<tr>
<input type="hidden" name="mode" value="Freeswitch(TM) SIP Devices"/>
- <td colspan=7 align=center><TMPL_VAR NAME="status"></td>
+ <td colspan=8 align=center><TMPL_VAR NAME="status"></td>
</tr>
- <tr class="header">
- <td colspan=7><TMPL_VAR NAME="account_types"></td>
+ <tr align="center" class="header">
+ <td colspan=8>Add / Edit Device</td>
</tr>
<tr class="header">
- <td colspan=7><input type="submit" name="action" value="Add..." /> <input type="submit" name="Refresh" value="Refresh" /></td>
+ <td>Directory ID</td>
+ <td>Username</td>
+ <td>Password</td>
+ <td>Accountcode</td>
+ <td>VM Password</td>
+ <td>Context</td>
+ <td colspan=2>Action</td>
</tr>
+ <tr>
+ <td><TMPL_VAR NAME="directory_id"><input type="hidden" name="directory_id" value="<TMPL_VAR NAME="directory_id">"></td>
+ <TD><input name="fs_username" size="20" type="text" value="<TMPL_VAR NAME="fs_username">"></a></TD>
+ <TD><input name="fs_password" size="20" type="text" value="<TMPL_VAR NAME="fs_password">"></a></TD>
+ <TD><input name="accountcode" size="20" type="text" value="<TMPL_VAR NAME="accountcode">"></a></TD>
+ <TD><input name="vm_password" size="20" type="text" value="<TMPL_VAR NAME="vm_password">"></a></TD>
+ <TD><input name="context" size="20" type="text" value="<TMPL_VAR NAME="context">"></a></TD>
+ <td colspan=2><input type="submit" name="action" value="Save..." /></td>
+ </tr>
+ <tr align="Center" class="header">
+ <td colspan=8>Current Devices</td>
+ </tr>
<tr class="header">
<td>Directory ID</td>
<td>Username</td>
@@ -17,15 +35,15 @@
<td>Accountcode</td>
<td>VM Password</td>
<td>Context</td>
- <td>Action</td>
+ <td colspan=2>Action</td>
</tr>
<TMPL_LOOP NAME="device_list">
<TR>
<TD><TMPL_VAR NAME="directory_id"></td>
- <TD><TMPL_VAR NAME="username"></a></TD>
- <TD><TMPL_VAR NAME="password"></TD>
+ <TD><TMPL_VAR NAME="fs_username"></a></TD>
+ <TD><TMPL_VAR NAME="fs_password"></TD>
<TD><TMPL_VAR NAME="accountcode"></TD>
- <TD><TMPL_VAR NAME="vmpassword"></TD>
+ <TD><TMPL_VAR NAME="vm_password"></TD>
<TD><TMPL_VAR NAME="context"></TD>
<TD><a href="astpp-admin.cgi?mode=Freeswitch(TM) SIP Devices&directory_id=<TMPL_VAR NAME="directory_id">&action=Delete...">Delete...</a></TD>
<TD><a href="astpp-admin.cgi?mode=Freeswitch(TM) SIP Devices&directory_id=<TMPL_VAR NAME="directory_id">&action=Edit...">Edit...</a></TD>
Modified: trunk/web_interface/astpp-admin.cgi
===================================================================
--- trunk/web_interface/astpp-admin.cgi 2009-09-20 03:31:28 UTC (rev 2255)
+++ trunk/web_interface/astpp-admin.cgi 2009-09-22 04:11:06 UTC (rev 2256)
@@ -2066,8 +2066,9 @@
);
foreach my $record (@sip_devices) {
print STDERR $record->{username};
- my $deviceinfo =
- &get_sip_account_freeswitch( $fs_db, $config, $record->{id} );
+ my $deviceinfo = $ASTPP->fs_retrieve_sip_user(
+ directory_id => $record->{id}
+ );
my %row;
$row{tech} = "SIP";
$row{type} = "user@" . $record->{domain};
@@ -2441,7 +2442,7 @@
}
}
if ( $config->{openser} == 1 ) {
- $status .= $status .=
+ $status .=
&add_sip_user_openser( $openser_db, $config, $name,
$params->{accountpassword},
$params->{context}, $params->{number}, $params );
@@ -2454,13 +2455,15 @@
}
}
if ( $config->{users_dids_freeswitch} == 1 ) {
- my $name =
- &finduniquesip_freeswitch( $fs_db, $config,
- $params->{number} );
- $status .=
- &add_sip_user_freeswitch( $fs_db, $config, $name,
- $params->{accountpassword},
- $params->{number}, $params, $accountinfo->{cc} );
+ my $failure;
+ ($failure, $status, $name) .= $ASTPP->fs_add_sip_user(
+ accountcode => $params->{number},
+ freeswitch_domain => $config->{freeswitch_domain},
+ freeswitch_context => $config->{freeswitch_context},
+ vm_password => $params->{accountpassword},
+ password => $params->{accountpassword},
+ sip-ext-prepend => $config->{sip_ext_prepend},
+ );
$status .= "<br>";
if ( $config->{email} == 1 && $params->{accounttype} == 0 ) {
$params->{extension} = $name;
@@ -9614,7 +9617,8 @@
$ASTPP->set_cdr_db($cdr_db);
}
-############### Freeswitch SIP Device handling ##############################
+############### Freeswitch SIP Device handling #########################
+
sub build_freeswitch_sip_devices() {
return gettext("Database is NOT configured!") . "\n" unless $astpp_db;
my ( @device_list, @sip_devices );
@@ -9629,18 +9633,59 @@
. $params->{directory_id} . " "
. gettext("Removed Successfully!");
}
+ elsif ( $params->{action} eq "Save..." ) {
+ my $failure;
+ $ASTPP->debug( user => $param->{username}, debug => "Directory ID: " . $params->{directory_id});
+ if (!$params->{directory_id} || $params->{directory_id} == 0 || $params->{directory_id} eq "") {
+ $ASTPP->debug( user => $param->{username}, debug => "Adding User");
+ $params->{domain} = $config->{freeswitch_domain} if !$params->{domain};
+ $params->{context} = $config->{freeswitch_context} if !$params->{context};
+ ($failure, $status, $name) .= $ASTPP->fs_add_sip_user(
+ username => $params->{fs_username},
+ accountcode => $params->{accountcode},
+ freeswitch_domain => $params->{domain},
+ freeswitch_context => $params->{context},
+ vm_password => $params->{vm_password},
+ password => $params->{fs_password},
+ sip_ext_prepend => $config->{sip_ext_prepend},
+ );
+ } else {
+ $ASTPP->debug( user => $param->{username}, debug => "Saving User");
+ $ASTPP->fs_save_sip_user( directory_id => $params->{directory_id},
+ username => $params->{fs_username},
+ accountcode => $params->{accountcode},
+ freeswitch_domain => $params->{domain},
+ freeswitch_context => $params->{context},
+ vm_password => $params->{vm_password},
+ password => $params->{fs_password},
+ );
+ }
+ $status .= "<br>";
+ }
+ elsif ( $params->{action} eq "Edit..." ) {
+ my $deviceinfo = $ASTPP->fs_retrieve_sip_user(
+ directory_id => $params->{directory_id}
+ );
+ $template->param( directory_id => $params->{directory_id} );
+ $template->param( accountcode => $deviceinfo->{accountcode} );
+ $template->param( context => $deviceinfo->{context} );
+ $template->param( fs_password => $deviceinfo->{password} );
+ $template->param( vm_password => $deviceinfo->{vm_password} );
+ $template->param( fs_username => $deviceinfo->{username} );
+ }
@sip_devices = $ASTPP->fs_list_sip_usernames();
foreach my $record (@sip_devices) {
- my $deviceinfo =
- &get_sip_account_freeswitch( $fs_db, $config, $record->{id} );
+ my $deviceinfo = $ASTPP->fs_retrieve_sip_user(
+ directory_id => $record->{id}
+ );
my %row;
$row{directory_id} = $record->{id};
$row{tech} = "SIP";
$row{type} = "user@" . $record->{domain};
- $row{username} = $record->{username};
- $row{password} = $deviceinfo->{password};
- $row{vmpassword} = $deviceinfo->{vmpassword};
+ $row{fs_username} = $record->{username};
+ $row{fs_password} = $deviceinfo->{password};
+ $row{vm_password} = $deviceinfo->{vm_password};
$row{context} = $deviceinfo->{context};
$row{accountcode} = $deviceinfo->{accountcode};
push( @device_list, \%row );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dar...@us...> - 2009-09-24 01:54:09
|
Revision: 2260
http://astpp.svn.sourceforge.net/astpp/?rev=2260&view=rev
Author: darrenkw
Date: 2009-09-24 01:53:56 +0000 (Thu, 24 Sep 2009)
Log Message:
-----------
More Freeswitch improvements especially relating to rating calls.
Modified Paths:
--------------
trunk/freeswitch/astpp-callingcards.pl
trunk/freeswitch/astpp-fs-monitor.pl
trunk/modules/ASTPP/lib/ASTPP.pm
trunk/scripts/astpp-common.pl
trunk/scripts/astpp-rate-engine.pl
trunk/templates/account-create.tpl
trunk/web_interface/astpp-admin.cgi
Modified: trunk/freeswitch/astpp-callingcards.pl
===================================================================
--- trunk/freeswitch/astpp-callingcards.pl 2009-09-23 04:31:30 UTC (rev 2259)
+++ trunk/freeswitch/astpp-callingcards.pl 2009-09-24 01:53:56 UTC (rev 2260)
@@ -472,11 +472,13 @@
$session->execute( "export", "NEWCALL=1" );
$session->execute( "export", "DESTINATION=$stats{destination}" );
&exit_program();
+ return 1;
}
elsif ( $whatnow == 2 ) {
$session->execute( "export", "NEWCALL=1" );
$session->execute( "export", "DESTINATION=" );
&exit_program();
+ return 1;
}
elsif ( $whatnow == 3 ) {
$session->streamFile( $sound->{goodbye} );
@@ -500,7 +502,8 @@
. $astpp_db->quote( $stats{answered_time} )
. ")" );
$stats{total_time} = tv_interval( $stats{start_time} );
- exit(1);
+# exit(1);
+ return 1;
}
sub print_console() #Dump string to the console
@@ -585,7 +588,8 @@
if ( $cardinfo->{status} != 1 ) {
$session->streamFile( $sound->{goodbye} );
$session->hangup();
- exit(1);
+# exit(1);
+ return 1;
}
}
@@ -606,7 +610,8 @@
if ( $pin != $cardinfo->{pin} ) {
$session->streamFile( $sound->{pin_incorrect} );
$session->streamFile( $sound->{goodbye} );
- exit(0);
+# exit(1);
+ return 1;
}
}
&check_card($cardinfo) if $cc == 0;
Modified: trunk/freeswitch/astpp-fs-monitor.pl
===================================================================
--- trunk/freeswitch/astpp-fs-monitor.pl 2009-09-23 04:31:30 UTC (rev 2259)
+++ trunk/freeswitch/astpp-fs-monitor.pl 2009-09-24 01:53:56 UTC (rev 2260)
@@ -138,6 +138,8 @@
if $myhash->{'variable_last_app'} eq "";
$myhash->{'variable_last_arg'} = ""
if $myhash->{'variable_last_arg'} eq "";
+ $myhash->{'variable_caller_id'} = "N/A"
+ if $myhash->{'variable_caller_id'} eq "";
my $tmp =
"INSERT INTO `fscdr` (`accountcode`, `src`, `dst`, `dcontext`, `clid`,"
. "`channel`, `dstchannel`, `lastapp`, `lastdata`, `calldate`, `answerdate`,"
Modified: trunk/modules/ASTPP/lib/ASTPP.pm
===================================================================
--- trunk/modules/ASTPP/lib/ASTPP.pm 2009-09-23 04:31:30 UTC (rev 2259)
+++ trunk/modules/ASTPP/lib/ASTPP.pm 2009-09-24 01:53:56 UTC (rev 2260)
@@ -582,7 +582,7 @@
sub debug #Prints debugging if appropriate
#
{
-my ($self, %arg) = @_;
+ my ($self, %arg) = @_;
$self->{_verbosity_item_level} = $arg{verbosity} if $arg{verbosity};
print STDERR $arg{debug} . "\n" if $arg{debug} && $self->{_verbosity_item_level} <= $self->{_verbosity_level};
$self->{_asterisk_agi}->verbose($arg{debug} . "\n" , $self->{_verbosity_level}) if $arg{debug} && $self->{_asterisk_agi} && $self->{_verbosity_item_level} <= $self->{_verbosity_level};
Modified: trunk/scripts/astpp-common.pl
===================================================================
--- trunk/scripts/astpp-common.pl 2009-09-23 04:31:30 UTC (rev 2259)
+++ trunk/scripts/astpp-common.pl 2009-09-24 01:53:56 UTC (rev 2260)
@@ -3838,80 +3838,80 @@
my ($astpp_db) = @_;
my $sound;
$sound->{no_responding} =
- "astpp-down"; #The calling card platform is down, please try again later.
+ "astpp-down.gsm"; #The calling card platform is down, please try again later.
$sound->{cardnumber} =
- "astpp-accountnum"; #Please enter your card number followed by pound.
-$sound->{cardnumber_incorrect} = "astpp-badaccount"; #Incorrect card number.
-$sound->{pin} = "astpp-pleasepin"; #Please enter your pin followed by pound.
-$sound->{pin_incorrect} = "astpp-invalidpin"; #Incorrect pin.
-$sound->{goodbye} = "goodbye"; #Goodbye.
+ "astpp-accountnum.gsm"; #Please enter your card number followed by pound.
+$sound->{cardnumber_incorrect} = "astpp-badaccount.gsm"; #Incorrect card number.
+$sound->{pin} = "astpp-pleasepin.gsm"; #Please enter your pin followed by pound.
+$sound->{pin_incorrect} = "astpp-invalidpin.gsm"; #Incorrect pin.
+$sound->{goodbye} = "goodbye.gsm"; #Goodbye.
$sound->{destination} =
- "astpp-phonenum"; #Please enter the number you wish to dial followed by pound.
-$sound->{destination_incorrect} = "astcc-badphone"; #Phone number not found!
-$sound->{card_inuse} = "astpp-in-use"; #This card is presently being used.
-$sound->{call_will_cost} = "astpp-willcost"; #This call will cost:
-$sound->{main_currency} = "astpp-dollar"; #Dollar
-$sound->{sub_currency} = "astpp-cent"; #Cent
-$sound->{main_currency_plural} = "astpp-dollars"; #Dollars
-$sound->{sub_currency_plural} = "astpp-cents"; #cents
-$sound->{per} = "astpp-per"; #per
-$sound->{minute} = "astpp-minute"; #Minute
-$sound->{minutes} = "astpp-minutes"; #Minutes
-$sound->{second} = "astpp-second"; #Second
-$sound->{seconds} = "astpp-seconds"; #Seconds
-$sound->{a_connect_charge} = "astpp-connectcharge"; #A connect charge of
-$sound->{will_apply} = "astpp-willapply"; #Will apply
+ "astpp-phonenum.gsm"; #Please enter the number you wish to dial followed by pound.
+$sound->{destination_incorrect} = "astcc-badphone.gsm"; #Phone number not found!
+$sound->{card_inuse} = "astpp-in-use.gsm"; #This card is presently being used.
+$sound->{call_will_cost} = "astpp-willcost.gsm"; #This call will cost:
+$sound->{main_currency} = "astpp-dollar.gsm"; #Dollar
+$sound->{sub_currency} = "astpp-cent.gsm"; #Cent
+$sound->{main_currency_plural} = "astpp-dollars.gsm"; #Dollars
+$sound->{sub_currency_plural} = "astpp-cents.gsm"; #cents
+$sound->{per} = "astpp-per.gsm"; #per
+$sound->{minute} = "astpp-minute.gsm"; #Minute
+$sound->{minutes} = "astpp-minutes.gsm"; #Minutes
+$sound->{second} = "astpp-second.gsm"; #Second
+$sound->{seconds} = "astpp-seconds.gsm"; #Seconds
+$sound->{a_connect_charge} = "astpp-connectcharge.gsm"; #A connect charge of
+$sound->{will_apply} = "astpp-willapply.gsm"; #Will apply
$sound->{please_wait_will_connect} =
- "astpp-please-wait-while-i-connect"; #Please wait while I connect your call
-$sound->{card_is_empty} = "astpp-card-is-empty"; #This card is empty.
+ "astpp-please-wait-while-i-connect.gsm"; #Please wait while I connect your call
+$sound->{card_is_empty} = "astpp-card-is-empty.gsm"; #This card is empty.
$sound->{card_has_balance_of} =
- "astpp-this-card-has-a-balance-of"; #Card has a balance of:
-$sound->{card_has_expired} = "astpp-card-has-expired"; #This card has expired.
-$sound->{call_will_last} = "astpp-this-call-will-last"; #This call will last:
+ "astpp-this-card-has-a-balance-of.gsm"; #Card has a balance of:
+$sound->{card_has_expired} = "astpp-card-has-expired.gsm"; #This card has expired.
+$sound->{call_will_last} = "astpp-this-call-will-last.gsm"; #This call will last:
$sound->{not_enough_credit} =
- "astpp-not-enough-credit"; #You do not have enough credit
+ "astpp-not-enough-credit.gsm"; #You do not have enough credit
$sound->{call_completed} =
- "astpp-call-completed"; #This call has been completed.
+ "astpp-call-completed.gsm"; #This call has been completed.
$sound->{astpp_callingcard_menu} =
- "astpp-callingcard-menu"
+ "astpp-callingcard-menu.gsm"
; #Press one if you wish to place another call, press 2 for your card balance, or press 3 to hangup
-$sound->{busy} = "astpp-busy-tryagain"; #Number was busy, Press 1 to try again.
-$sound->{cancelled} = "astpp-cancelled-tryagain"; #Call was cancelled.
+$sound->{busy} = "astpp-busy-tryagain.gsm"; #Number was busy, Press 1 to try again.
+$sound->{cancelled} = "astpp-cancelled-tryagain.gsm"; #Call was cancelled.
$sound->{congested} =
- "astpp-congested-tryagain"; #Number was congested, Press 1 to try again.
+ "astpp-congested-tryagain.gsm"; #Number was congested, Press 1 to try again.
$sound->{noanswer} =
- "astpp-noanswer-tryagain"; #There was no answer, Press 1 to try again.
+ "astpp-noanswer-tryagain.gsm"; #There was no answer, Press 1 to try again.
$sound->{badnumber} =
- "astpp-badnumber"; # "Calls from this location are blocked!"
+ "astpp-badnumber.gsm"; # "Calls from this location are blocked!"
$sound->{used_elsewhere} =
- "astpp-used-elsewhere"; # "This location has been used already."
-$sound->{goodbye} = "goodbye"; # "Goodbye"
+ "astpp-used-elsewhere.gsm"; # "This location has been used already."
+$sound->{goodbye} = "goodbye.gsm"; # "Goodbye"
$sound->{callback_performed} =
- "astpp-callback-performed"; # "This callback has been performed please disconnect now"
+ "astpp-callback-performed.gsm"; # "This callback has been performed please disconnect now"
$sound->{cardnumber} =
- "astpp-accountnum"; #Please enter your card number followed by pound.
-$sound->{cardnumber_incorrect} = "astpp-badaccount"; #Incorrect card number.
-$sound->{pin} = "astpp-pleasepin"; #Please enter your pin followed by pound.
-$sound->{pin_incorrect} = "astpp-invalidpin"; #Incorrect pin.
-$sound->{point} = "astcc-point"; #point.
+ "astpp-accountnum.gsm"; #Please enter your card number followed by pound.
+$sound->{cardnumber_incorrect} = "astpp-badaccount.gsm"; #Incorrect card number.
+$sound->{pin} = "astpp-pleasepin.gsm"; #Please enter your pin followed by pound.
+$sound->{pin_incorrect} = "astpp-invalidpin.gsm"; #Incorrect pin.
+$sound->{point} = "astcc-point.gsm"; #point.
$sound->{register_ani} =
- "astpp-register"
+ "astpp-register.gsm"
; # "Register ANI to this card? Press 1 for yes or any other key for no."
-$sound->{card_has_expired} = "astpp_expired"; #"This card has expired"
-$sound->{card_is_empty} = "astpp-empty"; #This card is empty
+$sound->{card_has_expired} = "astpp_expired.gsm"; #"This card has expired"
+$sound->{card_is_empty} = "astpp-empty.gsm"; #This card is empty
$sound->{where_to_call} =
- "astpp-where-to-call"
+ "astpp-where-to-call.gsm"
; #Press 1 to receive a call at the number you called from or registered
#Otherwise enter the number you wish to be called at.
$sound->{number_to_register} =
- "astpp-number-to-register"; #Press 1 to register the number you called from.
+ "astpp-number-to-register.gsm"; #Press 1 to register the number you called from.
#Otherwise enter the number you wish to register.
-$sound->{card_has_been_refilled} = "astpp-card-has-been-refilled"; # Your card has been refilled.
-$sound->{card_to_refill} = "astpp-card-to-refill"; #please enter the card number you wish to refill followed
+$sound->{card_has_been_refilled} = "astpp-card-has-been-refilled.gsm"; # Your card has been refilled.
+$sound->{card_to_refill} = "astpp-card-to-refill.gsm"; #please enter the card number you wish to refill followed
# by the pound sign.
-$sound->{card_to_empty} = "astpp-card-to-empty"; #please enter the card number you wish to empty into your card
+$sound->{card_to_empty} = "astpp-card-to-empty.gsm"; #please enter the card number you wish to empty into your card
# followed by the pound sign.
-$sound->{astpp_please_pin_card_empty} = "astpp-please-pin-card-empty"; #please enter the pin number for the card
+$sound->{astpp_please_pin_card_empty} = "astpp-please-pin-card-empty.gsm"; #please enter the pin number for the card
# you wish to empty followed by the pound
# sign.
return $sound;
@@ -3965,6 +3965,21 @@
######## Call Rating ################################
+sub cleanup_cdrs_fs() {
+ my ($cdr_db, $config) = @_;
+ $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET cost = '0' WHERE disposition REGEXP 'ORIGINATOR_CANCEL'");
+ $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET cost = '0' WHERE disposition REGEXP 'CALL_REJECTED'");
+ $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET cost = '0' WHERE disposition REGEXP 'USER_NOT_REGISTERED'");
+ $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET cost = '0' WHERE disposition REGEXP 'CHAN_NOT_IMPLEMENTED'");
+ $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET cost = '0' WHERE disposition REGEXP 'INVALID_NUMBER_FORMAT'");
+ if ($config->{trackvendorcharges} == 1) {
+ $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET vendor = '0' WHERE disposition REGEXP 'ORIGINATOR_CANCEL'");
+ $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET vendor = '0' WHERE disposition REGEXP 'CALL_REJECTED'");
+ $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET vendor = '0' WHERE disposition REGEXP 'USER_NOT_REGISTERED'");
+ $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET vendor = '0' WHERE disposition REGEXP 'CHAN_NOT_IMPLEMENTED'");
+ $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET vendor = '0' WHERE disposition REGEXP 'INVALID_NUMBER_FORMAT'");
+ }
+}
sub cleanup_cdrs() {
my ($cdr_db, $config) = @_;
# First we cleanup all calls that are not answered
Modified: trunk/scripts/astpp-rate-engine.pl
===================================================================
--- trunk/scripts/astpp-rate-engine.pl 2009-09-23 04:31:30 UTC (rev 2259)
+++ trunk/scripts/astpp-rate-engine.pl 2009-09-24 01:53:56 UTC (rev 2260)
@@ -61,6 +61,7 @@
if ($softswitch eq "freeswitch") {
$cdr_table = $config->{freeswitch_cdr_table};
$ASTPP->debug("Rating calls for FreeSwitch", $verbosity);
+ &cleanup_cdrs_fs($cdr_db, $config);
} else {
$cdr_table = $config->{asterisk_cdr_table};
$ASTPP->debug("Rating calls for Asterisk", $verbosity);
Modified: trunk/templates/account-create.tpl
===================================================================
--- trunk/templates/account-create.tpl 2009-09-23 04:31:30 UTC (rev 2259)
+++ trunk/templates/account-create.tpl 2009-09-24 01:53:56 UTC (rev 2260)
@@ -9,7 +9,7 @@
<td>Password</td>
<td>Pricelist</td>
<td>Billing Schedule</td>
- <td>Credit Limit in<TMPL_VAR NAME="default_currency"></td>
+ <td>Credit Limit in <TMPL_VAR NAME="default_currency"></td>
<td>Timezone</td>
</tr>
<tr class="rowone">
Modified: trunk/web_interface/astpp-admin.cgi
===================================================================
--- trunk/web_interface/astpp-admin.cgi 2009-09-23 04:31:30 UTC (rev 2259)
+++ trunk/web_interface/astpp-admin.cgi 2009-09-24 01:53:56 UTC (rev 2260)
@@ -157,7 +157,7 @@
my @output = ("STDERR"); # "LOGFILE" );
my @language = all_language_codes;
@language = sort @language;
-my @currency;
+#my @currency;
my @deviceprotocol = ("SIP");
my @countries = all_country_names();
@countries = sort @countries;
@@ -1421,7 +1421,7 @@
\n";
if ( $params->{answered} == 1 ) {
$tmp =
- " SELECT * from cdr where disposition = 'ANSWERED'"
+ " SELECT * from fscdr where disposition IN ('ANSWERED','NORMAL_CLEARING')"
. " and calldate >= "
. $cdr_db->quote($sd)
. " and calldate <= "
@@ -1430,7 +1430,7 @@
}
else {
$tmp =
- " SELECT * from cdr where calldate >= "
+ " SELECT * from fscdr where calldate >= "
. $cdr_db->quote($sd)
. " and calldate <= "
. $cdr_db->quote($ed);
@@ -2026,7 +2026,7 @@
push( @account_ip_list, \%row );
}
$template->param( account_ip_list => \@account_ip_list );
- $template->param( currency => $currency[0] );
+ $template->param( currency => $config->{currency} );
## List the SIP/IAX2 devices belonging to this account. ##
my @account_device_list;
@@ -2462,7 +2462,7 @@
freeswitch_context => $config->{freeswitch_context},
vm_password => $params->{accountpassword},
password => $params->{accountpassword},
- sip-ext-prepend => $config->{sip_ext_prepend},
+ sip_ext_prepend => $config->{sip_ext_prepend},
);
$status .= "<br>";
if ( $config->{email} == 1 && $params->{accounttype} == 0 ) {
@@ -2541,7 +2541,7 @@
$template->param(
currency_menu => popup_menu(
-name => "currency",
- -values => \@currency
+ -values => $config->{currency}
)
);
$template->param(
@@ -2567,6 +2567,7 @@
)
);
$template->param( status => $status );
+ $template->param( default_currency => $config->{currency} );
return $template->output;
}
@@ -3417,7 +3418,7 @@
. gettext("Brand")
. "</td><td>"
. gettext("Value")
- . " $currency[0]"
+ . " $config->{currency}"
. "</td><td>"
. gettext("Used")
. "</td><td>"
@@ -3599,7 +3600,7 @@
. gettext("Pricelist")
. "</td><td>"
. gettext("Value")
- . " $currency[0]"
+ . " $config->{currency}"
. "</td><td>"
. gettext("Used")
. "</td><td>"
@@ -3694,7 +3695,7 @@
. gettext("Length in Seconds")
. "</td><td>"
. gettext("Cost")
- . "($currency[0]) </td></tr>";
+ . "($config->{currency}) </td></tr>";
$sql = $astpp_db->prepare(
"SELECT * FROM callingcardcdrs WHERE cardnumber = "
. $astpp_db->quote( param('number') ) );
@@ -4000,9 +4001,9 @@
);
my $sql_select =
-"SELECT * FROM cdr WHERE cost IN( 'error','rating') OR (accountcode IS NULL OR accountcode = '') AND cost ='none' ORDER BY calldate";
+"SELECT * FROM fscdr WHERE cost IN( 'error','rating') OR (accountcode IS NULL OR accountcode = '') AND cost ='none' ORDER BY calldate";
my $sql_count =
-"SELECT COUNT(*) FROM cdr WHERE cost IN ( 'error','rating') OR (accountcode IS NULL OR accountcode = '') AND cost ='none'";
+"SELECT COUNT(*) FROM fscdr WHERE cost IN ( 'error','rating') OR (accountcode IS NULL OR accountcode = '') AND cost ='none'";
my ( $sql, $pagination ) = $ASTPP->pagination(
sql_select => $sql_select,
@@ -4701,7 +4702,7 @@
. "</td><td>"
. popup_menu(
-name => "currency",
- -values => \@currency,
+ -values => $config->{currency},
-default => $accountinfo->{currency}
)
. "</td><td>"
@@ -5690,7 +5691,7 @@
-values => \@accountlist,
);
$template->param( accountlist => $accountmenu );
- $template->param( currency => $config->{currency_name} );
+ $template->param( currency => $config->{currency} );
$template->param( status => $status );
return $template->output;
}
@@ -8971,10 +8972,16 @@
)
. "</td><td>"
. textfield(
+ -name => 'cost',
+ -size => 20,
+ -default => $record->{cost}
+ )
+ . "</td><td>"
+ . textfield(
-name => 'precedence',
-size => 2,
-default => $record->{precedence}
- ) . "</td><td>";
+ );
my @resellers = &list_resellers($astpp_db);
$ASTPP->debug(
user => $param->{username},
@@ -11214,7 +11221,7 @@
}
$template->param( status => $status );
$template->param( pricelists => $pricelists );
- $template->param( currency => $currency );
+ $template->param( currency => $config->{currency} );
$template->param( language => $language );
$template->param( context => $config->{booth_context} );
$template->param( default_currency => $config->{currency} );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dar...@us...> - 2009-09-28 15:21:56
|
Revision: 2261
http://astpp.svn.sourceforge.net/astpp/?rev=2261&view=rev
Author: darrenkw
Date: 2009-09-28 15:21:45 +0000 (Mon, 28 Sep 2009)
Log Message:
-----------
Add realtime billing support for Freeswitch. Vendor rating for freeswitch is also working.
Modified Paths:
--------------
trunk/Makefile
trunk/freeswitch/astpp-fs-monitor.pl
trunk/freeswitch/astpp-fs-xml.pl
trunk/modules/ASTPP/lib/ASTPP.pm
trunk/scripts/astpp-common.pl
trunk/scripts/astpp-rate-engine.pl
trunk/web_interface/astpp-admin.cgi
Added Paths:
-----------
trunk/sql/astpp-2009-09-23.sql
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2009-09-24 01:53:56 UTC (rev 2260)
+++ trunk/Makefile 2009-09-28 15:21:45 UTC (rev 2261)
@@ -39,6 +39,7 @@
chgrp $(GROUP) $(DESTDIR)$(ASTPPEXECDIR)
# Install Freeswitch .pl files as .cgi files
install -m 755 -o $(OWNER) -g $(GROUP) freeswitch/astpp-fs-xml.pl $(DESTDIR)$(WWWDIR)/cgi-bin/astpp-fs-xml.cgi
+ install -m 755 -o $(OWNER) -g $(GROUP) freeswitch/astpp-fs-cdr-xml.pl $(DESTDIR)$(WWWDIR)/cgi-bin/astpp-fs-cdr-xml.cgi
#
install -m 755 -o $(OWNER) -g $(GROUP) web_interface/astpp-callback.cgi $(DESTDIR)$(WWWDIR)/cgi-bin/astpp-callback.cgi
install -m 755 -o $(OWNER) -g $(GROUP) web_interface/astpp-pricelist.cgi $(DESTDIR)$(WWWDIR)/cgi-bin/astpp-pricelist.cgi
Modified: trunk/freeswitch/astpp-fs-monitor.pl
===================================================================
--- trunk/freeswitch/astpp-fs-monitor.pl 2009-09-24 01:53:56 UTC (rev 2260)
+++ trunk/freeswitch/astpp-fs-monitor.pl 2009-09-28 15:21:45 UTC (rev 2261)
@@ -32,7 +32,7 @@
print STDERR "Interface language is set to: $ENV{'LANGUAGE'}\n";
bindtextdomain( "ASTPP", "/var/locale" );
textdomain("ASTPP");
-use vars qw($ASTPP $fs $config $astpp_db $osc_db $agile_db $cdr_db $cdr_table
+use vars qw($ASTPP $fs $config $astpp_db $osc_db $agile_db $cdr_db
@output @cardlist $config $params $lastheartbeat);
@output = ( "STDOUT", "LOGFILE" );
my $verbosity = 1;
@@ -49,7 +49,6 @@
$fs = &fs_client_connect($config);
open( LOGFILE, ">>$config->{log_file}" )
|| die "Error - could not open $config->{log_file} for writing\n";
- $cdr_table = $config->{freeswitch_cdr_table};
# $ASTPP->debug("Rating calls for FreeSwitch", $verbosity);
@@ -79,6 +78,7 @@
###############################################
&initialize;
+$config->{cdr_table} = $config->{freeswitch_cdr_table};
my $timeout = 1;
sigaction SIGALRM, new POSIX::SigAction sub {
@@ -122,7 +122,8 @@
}
}
- elsif ( $myhash->{'event-name'} eq "CHANNEL_HANGUP" )
+# elsif ( $myhash->{'event-name'} eq "CHANNEL_HANGUP" )
+ elsif ( $myhash->{'event-name'} eq "CHANNEL_DESTROY" )
{ ## hangup event
print "\n\n############################\n\n";
print $myhash->{'unique-id'} . " has hung up\n";
@@ -154,7 +155,8 @@
. $cdr_db->quote( $myhash->{'variable_channel_name'} ) . ","
. $cdr_db->quote( $myhash->{'variable_last_app'} ) . ","
. $cdr_db->quote( $myhash->{'variable_last_arg'} ) . ","
- . $cdr_db->quote( $myhash->{'variable_start_stamp'} ) . ","
+ . $cdr_db->quote( $myhash->{'event-date-local'} ) . ","
+# . $cdr_db->quote( $myhash->{'variable_start_stamp'} ) . ","
. $cdr_db->quote( $myhash->{'variable_answer_stamp'} ) . ","
. $cdr_db->quote( $myhash->{'variable_end_stamp'} ) . ","
. $cdr_db->quote( $myhash->{'variable_duration'} ) . ","
@@ -170,7 +172,7 @@
$cdr_db->do($tmp);
my (@chargelist);
push @chargelist, $myhash->{'unique-id'};
- &processlist( $astpp_db, $cdr_db, $cdr_table, $config,
+ &processlist( $astpp_db, $cdr_db, $config,
\@chargelist );
# }
if ( $myhash->{'variable_callingcards'}
Modified: trunk/freeswitch/astpp-fs-xml.pl
===================================================================
--- trunk/freeswitch/astpp-fs-xml.pl 2009-09-24 01:53:56 UTC (rev 2260)
+++ trunk/freeswitch/astpp-fs-xml.pl 2009-09-28 15:21:45 UTC (rev 2261)
@@ -253,7 +253,8 @@
my ($returned_data,$junk) = $ASTPP->fs_dialplan_xml_bridge(
destination_number => $params->{'Caller-Destination-Number'},
route_prepend => $route->{prepend},
- trunk_name => $route->{trunk}
+ trunk_name => $route->{trunk},
+ route_id => $route->{id}
);
$xml .= $returned_data;
}
Modified: trunk/modules/ASTPP/lib/ASTPP.pm
===================================================================
--- trunk/modules/ASTPP/lib/ASTPP.pm 2009-09-24 01:53:56 UTC (rev 2260)
+++ trunk/modules/ASTPP/lib/ASTPP.pm 2009-09-28 15:21:45 UTC (rev 2261)
@@ -144,6 +144,7 @@
$sql->finish;
my @variables = split /,(?!(?:[^",]|[^"],[^"])+")/, $diddata->{variables};
foreach my $variable (@variables) {
+ $arg{xml} .= "<action application=\"set\" data=\"accountcode=" . $arg{accountcode} . "\"/>\n";
$xml .= "<action application=\"set\" data=\"" . $variable . "\"/>\n";
}
if ($diddata->{extensions} =~ m/^("|)(L|l)ocal.*/m) {
@@ -174,6 +175,9 @@
$trunkdata = $sql->fetchrow_hashref;
$arg{route_prepend} = "" if !$arg{route_prepend};
$sql->finish;
+ $dialstring = "<action application=\"set\" data=\"outbound_route=" . $arg{route_id} . "\"/>\n";
+ $dialstring .= "<action application=\"set\" data=\"provider=" . $trunkdata->{provider} . "\"/>\n";
+ $dialstring .= "<action application=\"set\" data=\"trunk=" . $trunkdata->{name} . "\"/>\n";
if ($trunkdata->{dialed_modify} && $trunkdata->{dialed_modify} ne "") {
my @regexs = split(m/","/m, $trunkdata->{dialed_modify});
foreach my $regex (@regexs) {
@@ -187,7 +191,7 @@
}
}
if ( $trunkdata->{tech} eq "Zap" ) {
- $dialstring = "<action application=\"bridge\" data=\"openzap/" . $trunkdata->{path} . "/1/" . $arg{route_prepend} . $arg{destination_number} . "\"/>\n";
+ $dialstring .= "<action application=\"bridge\" data=\"openzap/" . $trunkdata->{path} . "/1/" . $arg{route_prepend} . $arg{destination_number} . "\"/>\n";
return ($dialstring,$data);
}
elsif ( $trunkdata->{tech} eq "SIP" ) {
@@ -196,10 +200,10 @@
$dest =~ s/"//g; #Strip off quotation marks
if ($profile eq "gateway") {
$data = "sofia/gateway/" . $dest . "/" . $arg{route_prepend} . $arg{destination_number};
- $dialstring = "<action application=\"bridge\" data=\"" . $data . "\"/>\n";
+ $dialstring .= "<action application=\"bridge\" data=\"" . $data . "\"/>\n";
} else {
$data = "sofia/" . $profile . "/" . $arg{route_prepend} . $arg{destination_number} . "\@" . $dest;
- $dialstring = "<action application=\"bridge\" data=\"" . $data . "\"/>\n";
+ $dialstring .= "<action application=\"bridge\" data=\"" . $data . "\"/>\n";
}
return ($dialstring,$data);
}
@@ -674,7 +678,7 @@
. $arg{mode} . "&ve="
. $arg{ve} . "&te="
. $total_entries . "&pg="
- . $arg{last_page} . "\">"
+ . $pgr->get_last_page() . "\">"
. "Last Page" . "</a>";
return ($sql,$html);
}
Modified: trunk/scripts/astpp-common.pl
===================================================================
--- trunk/scripts/astpp-common.pl 2009-09-24 01:53:56 UTC (rev 2260)
+++ trunk/scripts/astpp-common.pl 2009-09-28 15:21:45 UTC (rev 2261)
@@ -1477,21 +1477,21 @@
# Select a specific cdr from the Asterisk(tm) cdr table.
sub get_cdr() {
- my ( $config, $cdr_db, $cdr_table, $uniqueid,$rating,$dst ) = @_;
+ my ( $config, $cdr_db, $uniqueid,$rating,$dst ) = @_;
my ( $sql, $cdrdata );
if ($dst) {
$sql =
$cdr_db->prepare(
- "SELECT * FROM $cdr_table WHERE uniqueid = " . $cdr_db->quote($uniqueid) . " AND dst = " . $cdr_db->quote($dst) . " ORDER BY cost DESC LIMIT 1" );
+ "SELECT * FROM $config->{cdr_table} WHERE uniqueid = " . $cdr_db->quote($uniqueid) . " AND dst = " . $cdr_db->quote($dst) . " ORDER BY cost DESC LIMIT 1" );
}
elsif ($rating) {
$sql =
$cdr_db->prepare(
- "SELECT * FROM $cdr_table WHERE uniqueid = " . $cdr_db->quote($uniqueid) . " AND cost in ('error','none') ORDER BY cost DESC LIMIT 1" );
+ "SELECT * FROM $config->{cdr_table} WHERE uniqueid = " . $cdr_db->quote($uniqueid) . " AND cost in ('error','none') ORDER BY cost DESC LIMIT 1" );
} else {
$sql =
$cdr_db->prepare(
- "SELECT * FROM $cdr_table WHERE uniqueid = " . $cdr_db->quote($uniqueid) . " ORDER by cost DESC LIMIT 1" );
+ "SELECT * FROM $config->{cdr_table} WHERE uniqueid = " . $cdr_db->quote($uniqueid) . " ORDER by cost DESC LIMIT 1" );
}
$sql->execute;
$cdrdata = $sql->fetchrow_hashref;
@@ -1501,8 +1501,8 @@
# Update the cost of a cdr in the Asterisk(tm) cdr table. This is used to denote a cdr that has been rated.
sub save_cdr() {
- my ( $config, $cdr_db, $cdr_table, $uniqueid, $cost,$dst ) = @_;
- $cdr_db->do( "UPDATE $cdr_table SET cost = "
+ my ( $config, $cdr_db, $uniqueid, $cost,$dst ) = @_;
+ $cdr_db->do( "UPDATE $config->{cdr_table} SET cost = "
. $cdr_db->quote($cost)
. "WHERE uniqueid = "
. $cdr_db->quote($uniqueid)
@@ -1515,11 +1515,11 @@
# used to select cdrs that have not been billed which have value "none" or those that the rating engine ran
# into a problem with which are marked "error".
sub list_cdrs_status() {
- my ( $config, $cdr_db, $cdr_table, $default ) = @_;
+ my ( $config, $cdr_db, $default ) = @_;
my ( $sql, @cdrlist, $row );
$sql =
$cdr_db->prepare(
- "SELECT * FROM $cdr_table WHERE cost = " . $cdr_db->quote($default) );
+ "SELECT * FROM $config->{cdr_table} WHERE cost = " . $cdr_db->quote($default) );
$sql->execute;
while ( $row = $sql->fetchrow_hashref ) {
push @cdrlist, $row->{uniqueid};
@@ -1544,25 +1544,27 @@
# Update the cost of a cdr in the Asterisk(tm) cdr table. This is used to denote a cdr that has been tagged
# to a vendor.
sub save_cdr_vendor() {
- my ( $config, $cdr_db, $cdr_table, $uniqueid, $cost,$dst ) = @_;
- $cdr_db->do( "UPDATE $cdr_table SET vendor = "
+ my ( $config, $cdr_db, $uniqueid, $cost,$dst ) = @_;
+ my $tmp = "UPDATE $config->{cdr_table} SET vendor = "
. $cdr_db->quote($cost)
- . "WHERE uniqueid = "
+ . " WHERE uniqueid = "
. $cdr_db->quote($uniqueid)
. " AND dst = "
. $cdr_db->quote($dst)
- . " LIMIT 1");
+ . " LIMIT 1";
+ print STDERR $tmp . "\n" if $config->{debug} ==1;
+ $cdr_db->do($tmp);
}
# Select all cdrs in the Asterisk(tm) cdr database which have a specified value in the vendor field. This is
# used to select cdrs that have not been tagged to a vendor which have value "none" or those that the rating engine ran
# into a problem with which are marked "error".
sub list_cdrs_status_vendor() {
- my ( $config, $cdr_db, $cdr_table, $default ) = @_;
+ my ( $config, $cdr_db, $default ) = @_;
my ( $sql, @cdrlist, $row );
$sql =
$cdr_db->prepare(
- "SELECT * FROM $cdr_table WHERE vendor = " . $cdr_db->quote($default) );
+ "SELECT * FROM $config->{cdr_table} WHERE vendor = " . $cdr_db->quote($default) );
$sql->execute;
while ( $row = $sql->fetchrow_hashref ) {
push @cdrlist, $row->{uniqueid};
@@ -3518,7 +3520,7 @@
my ($config, $cdr_db,$account) = @_;
my ( $sql, $count, $record );
$sql =
- $cdr_db->prepare( "SELECT COUNT(*) FROM $config->{asterisk_cdr_table} WHERE cost = 'error' OR "
+ $cdr_db->prepare( "SELECT COUNT(*) FROM $config->{cdr_table} WHERE cost = 'error' OR "
. "accountcode IN (" . $account . ") AND cost ='none'" );
$sql->execute;
$record = $sql->fetchrow_hashref;
@@ -3997,7 +3999,7 @@
$cdr_db->do("UPDATE $config->{asterisk_cdr_table} SET vendor = '0' WHERE disposition REGEXP 'CANCEL'");
}
if ($config->{thirdlane_mods} == 1) {
- $cdr_db->do("UPDATE cdr SET accountcode = userfield WHERE (accountcode IS NULL or accountcode = '')");
+ $cdr_db->do("UPDATE $config->{cdr_table} SET accountcode = userfield WHERE (accountcode IS NULL or accountcode = '')");
}
}
}
@@ -4017,7 +4019,7 @@
$outfile = "/var/log/astpp/astpp.csv" if !$outfile;
my $notes = "Notes: " . $cdrinfo->{accountcode};
open( OUTFILE, ">>$outfile" )
- || die "CSV Error - could not open $outfile for writing\n";
+ || print STDERR "CSV Error - could not open $outfile for writing\n";
print OUTFILE << "ending_print_tag";
$cardno,$cost,$cdrinfo->{disposition},$cdrinfo->{calldate},$cdrinfo->{dst},$billsec,$notes
ending_print_tag
@@ -4025,7 +4027,7 @@
}
sub rating() { # This routine recieves a specific cdr and takes care of rating it and of marking it as rated. It bills resellers as appropriate.
- my ( $astpp_db, $cdr_db, $cdr_table, $config, $cdrinfo, $carddata, $vars, @output ) = @_;
+ my ( $astpp_db, $cdr_db, $config, $cdrinfo, $carddata, $vars, @output ) = @_;
my ( $increment, $numdata, $package, $notes, $status );
print STDERR "----------------------------------------------------------------\n";
print STDERR
@@ -4041,7 +4043,7 @@
$numdata = &get_route( $astpp_db, $config, $cdrinfo->{dst}, $carddata->{pricelist}, $carddata, $cdrinfo->{userfield} );
print STDERR "PATTERN: $numdata->{pattern}";
if ( !$numdata->{pattern} ) {
- &save_cdr( $config, $cdr_db,$cdr_table, $cdrinfo->{uniqueid}, "error",$cdrinfo->{dst} ) if !$vars && $config->{astcdr} == 1;
+ &save_cdr( $config, $cdr_db, $cdrinfo->{uniqueid}, "error",$cdrinfo->{dst} ) if !$vars && $config->{astcdr} == 1;
print STDERR "ERROR - ERROR - ERROR - ERROR - ERROR \n";
print STDERR "NO MATCHING PATTERN\n";
print STDERR "----------------------------------------------------------------\n";
@@ -4110,7 +4112,7 @@
my $sigset = POSIX::SigSet->new;
my $blockset = POSIX::SigSet->new( SIGINT, SIGQUIT, SIGCHLD );
sigprocmask( SIG_BLOCK, $blockset, $sigset ) or die "Could not block INT,QUIT,CHLD signals: $!\n";
- &save_cdr( $config, $cdr_db,$cdr_table, $cdrinfo->{uniqueid}, $cost,$cdrinfo->{dst} ) if !$vars && $config->{astcdr} == 1;
+ &save_cdr( $config, $cdr_db, $cdrinfo->{uniqueid}, $cost,$cdrinfo->{dst} ) if !$vars && $config->{astcdr} == 1;
if ( $cdrinfo->{accountcode} ne $carddata->{number} && $cdrinfo->{accountcode} ne $carddata->{cc}) {
$notes = $cdrinfo->{accountcode} . "|" . $numdata->{comment} . "|" . $numdata->{pattern};
}
@@ -4139,7 +4141,7 @@
}
}
else {
- &save_cdr( $config, $cdr_db,$cdr_table, $cdrinfo->{uniqueid}, "error",$cdrinfo->{dst} ) if !$vars && $config->{astcdr} == 1;
+ &save_cdr( $config, $cdr_db,$cdrinfo->{uniqueid}, "error",$cdrinfo->{dst} ) if !$vars && $config->{astcdr} == 1;
print STDERR "ERROR - ERROR - ERROR - ERROR - ERROR \n";
print STDERR "DISPOSITION: $cdrinfo->{disposition} \n";
print STDERR "UNIQUEID: $cdrinfo->{uniqueid} \n";
@@ -4158,7 +4160,7 @@
sub vendor_not_billed() { # Prints the information on calls where the "vendor" field is either none or error.
my ($config, $cdr_db) = @_;
- my $tmp = "SELECT * FROM $config->{asterisk_cdr_table} WHERE vendor IN ('none','error')";
+ my $tmp = "SELECT * FROM $config->{cdr_table} WHERE vendor IN ('none','error')";
my $sql = $cdr_db->prepare($tmp);
$sql->execute;
while ( my $cdr = $sql->fetchrow_hashref ) {
@@ -4177,15 +4179,14 @@
sub processlist() { # Deal with a list of calls which have not been rated so far.
- my ($astpp_db, $cdr_db, $cdr_table, $config, $chargelist, $vars) = @_;
+ my ($astpp_db, $cdr_db, $config, $chargelist, $vars) = @_;
my ( $status, $cdrinfo);
- foreach (@$chargelist) {
- my $uniqueid = $_;
+ foreach my $uniqueid (@$chargelist) {
print STDERR gettext("Processing Uniqueid: ") . $uniqueid . "\n";
- $cdrinfo = ($vars) ? $vars : &get_cdr( $config, $cdr_db,$cdr_table, $uniqueid );
+ $cdrinfo = &get_cdr( $config, $cdr_db, $uniqueid );
my $savedcdrinfo = $cdrinfo;
# if(!$vars) {
-# my $tmp = "UPDATE $cdr_table SET cost = 'rating' WHERE uniqueid = "
+# my $tmp = "UPDATE $config->{cdr_table} SET cost = 'rating' WHERE uniqueid = "
# . $cdr_db->quote($uniqueid)
# . " AND cost = 'none'"
# . " AND dst = "
@@ -4213,9 +4214,9 @@
$cdrinfo->{billsec} = $cdrinfo->{duration};
}
if ( $cdrinfo->{billsec} <= 0 ) { # not having the right billable seconds.
- &save_cdr( $config, $cdr_db,$cdr_table, $uniqueid, 0,$cdrinfo->{dst} ) if !$vars && $config->{astcdr} == 1;
- &save_cdr_vendor( $config, $cdr_db, $cdr_table, $uniqueid, 0,$cdrinfo->{dst} )
- if !$vars && $config->{astcdr} == 1 && $config->{trackvendorcharges} == 1;
+ &save_cdr( $config, $cdr_db, $uniqueid, 0,$cdrinfo->{dst} ) if !$vars && $config->{astcdr} == 1;
+ &save_cdr_vendor( $config, $cdr_db, $uniqueid, 0,$cdrinfo->{dst} )
+ if $config->{astcdr} == 1;
print STDERR "\n----------------------\n";
print STDERR "CDR Written - No Billable Seconds\n";
print STDERR
@@ -4224,15 +4225,15 @@
print STDERR "----------------------\n";
}
elsif ( $cdrinfo->{accountcode} ) {
- $status = &rating( $astpp_db, $cdr_db,$cdr_table, $config, $cdrinfo, $carddata, $vars);
- $cdrinfo = &get_cdr( $config, $cdr_db,$cdr_table, $uniqueid ) if !$vars;
+ $status = &rating( $astpp_db, $cdr_db,$config, $cdrinfo, $carddata, $vars);
+ $cdrinfo = &get_cdr( $config, $cdr_db, $uniqueid ) if !$vars;
if ( $status == 1 ) {
my $previous_account = $carddata->{number};
while ( $carddata->{reseller} ne "" ) {
- $cdrinfo = &get_cdr( $config, $cdr_db,$cdr_table, $uniqueid ) if !$vars;
+ $cdrinfo = &get_cdr( $config, $cdr_db, $uniqueid ) if !$vars;
print STDERR "Charge $uniqueid to $carddata->{reseller}" if $config->{debug} == 1;
$carddata = &get_account( $astpp_db, $carddata->{reseller} );
- $status = &rating( $astpp_db, $cdr_db, $cdr_table,$config, $cdrinfo, $carddata, $vars);
+ $status = &rating( $astpp_db, $cdr_db, $config, $cdrinfo, $carddata, $vars);
my $tmp = "SELECT id FROM cdrs WHERE uniqueid = '" . $uniqueid
. "' AND cardnum = '" . $previous_account . "' LIMIT 1";
print STDERR "$tmp\n" if $config->{debug} == 1;
@@ -4295,12 +4296,66 @@
}
}
my $phrase = "none";
- &vendor_process_rating( $astpp_db, $cdr_db, $config, $phrase, $uniqueid, $vars ) if $config->{trackvendorcharges} == 1;
+ if ($config->{trackvendorcharges} == 1) {
+ print STDERR gettext("Vendor Rating Starting") . "/n";
+ &vendor_process_rating( $astpp_db, $cdr_db, $config, $phrase, $uniqueid, $vars ) if $config->{softswitch} == 0;
+ &vendor_process_rating_fs( $astpp_db, $cdr_db, $config, $phrase, $uniqueid, $vars ) if $config->{softswitch} == 1;
+ }
}
}
+
+sub vendor_process_rating_fs() { #Rate Vendor calls.
+ my ( $astpp_db, $cdr_db, $config, $phrase, $uniqueid, $vars ) = @_;
+ my ($sql,$tmp);
+ print STDERR "Vendor Rating Uniqueid: " . $uniqueid . "\n";
+ if(!$uniqueid) {
+ $tmp = "SELECT * FROM $config->{freeswitch_cdr_table} WHERE vendor IN ('error','none')";
+ } else {
+ $tmp = "SELECT * FROM $config->{freeswitch_cdr_table} WHERE uniqueid = '$uniqueid'";
+ }
+ print STDERR $tmp . "\n" if $config->{debug} == 1;
+ $sql = $cdr_db->prepare($tmp);
+ $sql->execute;
+ while ( my $cdrinfo = $sql->fetchrow_hashref ) {
+ my $tmp = "SELECT * FROM outbound_routes WHERE id = "
+ . $astpp_db->quote( $cdrinfo->{outbound_route} );
+ my $sql2 = $astpp_db->prepare($tmp);
+ $sql2->execute;
+ print STDERR $tmp . "\n" if $config->{debug} == 1;
+ my $pricerecord = $sql2->fetchrow_hashref;
+ $sql2->finish;
+ if ( $pricerecord->{id} ) {
+ my $cost = &calc_call_cost(
+ $pricerecord->{connectcost}, $pricerecord->{cost},
+ $cdrinfo->{billsec}, $pricerecord->{inc},
+ $pricerecord->{includedseconds}
+ );
+ $cost = sprintf( "%." . $config->{decimalpoints} . "f", $cost );
+ &post_cdr(
+ $astpp_db, $config,
+ $cdrinfo->{uniqueid}, $cdrinfo->{provider},
+ $cdrinfo->{src}, $cdrinfo->{dst},
+ $cdrinfo->{disposition}, $cdrinfo->{billsec},
+ $cost * -1, $cdrinfo->{calldate},
+ "", $cdrinfo->{trunk},
+ $pricerecord->{comment} . "|" . $pricerecord->{pattern}
+ ) if $config->{posttoastpp} == 1;
+ &save_cdr_vendor( $config, $cdr_db, $cdrinfo->{uniqueid}, $cost,$cdrinfo->{dst} );
+ my $tmp = "UPDATE cdrs SET cost = '" . $cost . "' WHERE uniqueid = '" .
+ $cdrinfo->{uniqueid} . "' AND cost = 0 "
+ . " AND cardnum != '" . $cdrinfo->{provider} . "' AND callednum = "
+ . $astpp_db->quote($cdrinfo->{dst}) . " LIMIT 1";
+ print STDERR "$tmp\n" if $config->{debug} == 1;
+ $astpp_db->do($tmp);
+ } else {
+ &save_cdr_vendor( $config, $cdr_db, $cdrinfo->{uniqueid}, "error",$cdrinfo->{dst} );
+ }
+ }
+}
+
sub vendor_process_rating() { #Rate Vendor calls.
- my ( $astpp_db, $cdr_db, $cdr_table, $config, $phrase, $uniqueid, $vars ) = @_;
+ my ( $astpp_db, $cdr_db, $config, $phrase, $uniqueid, $vars ) = @_;
my $tmp = "SELECT * FROM trunks ORDER BY LENGTH(path)";
my $sql = $astpp_db->prepare($tmp);
print STDERR "$tmp\n" . "\n" if $config->{debug} == 1;
@@ -4360,7 +4415,7 @@
"", $cdrinfo->{trunk},
$pricerecord->{comment} . "|" . $pricerecord->{pattern}
) if $config->{posttoastpp} == 1;
- &save_cdr_vendor( $config, $cdr_db,$cdr_table, $cdrinfo->{uniqueid}, $cost,$cdrinfo->{dst} );
+ &save_cdr_vendor( $config, $cdr_db, $cdrinfo->{uniqueid}, $cost,$cdrinfo->{dst} );
my $tmp = "UPDATE cdrs SET cost = '" . $cost . "' WHERE uniqueid = '" .
$cdrinfo->{uniqueid} . "' AND cost = 0 "
. " AND cardnum != '" . $trunk->{provider} . "' AND dst = "
@@ -4368,7 +4423,7 @@
print STDERR "$tmp\n" if $config->{debug} == 1;
$astpp_db->do($tmp);
} else {
- &save_cdr_vendor( $config, $cdr_db,$cdr_table, $cdrinfo->{uniqueid}, "error",$cdrinfo->{dst} );
+ &save_cdr_vendor( $config, $cdr_db, $cdrinfo->{uniqueid}, "error",$cdrinfo->{dst} );
}
}
} else {
Modified: trunk/scripts/astpp-rate-engine.pl
===================================================================
--- trunk/scripts/astpp-rate-engine.pl 2009-09-24 01:53:56 UTC (rev 2260)
+++ trunk/scripts/astpp-rate-engine.pl 2009-09-28 15:21:45 UTC (rev 2261)
@@ -34,7 +34,7 @@
bindtextdomain( "ASTPP", "/var/locale" );
textdomain("ASTPP");
use vars qw(@output $shucks $params $astpp_db $cdr_db $config
- $uniqueid $run_type $cdr_table);
+ $uniqueid $run_type);
@output = ( "STDOUT", "LOGFILE" );
$shucks = 0;
@@ -54,16 +54,15 @@
################# Program Starts HERE #################################
$uniqueid = param('uniqueid'); #$ARGV[0];
$run_type = param('runtype'); # realtime,batch,price_only
-$softswitch = param('softswitch'); # asterisk or freeswitch
&initialize();
-if ($softswitch eq "freeswitch") {
- $cdr_table = $config->{freeswitch_cdr_table};
+if ($config->{softswitch} == 1) {
+ $config->{cdr_table} = $config->{freeswitch_cdr_table};
$ASTPP->debug("Rating calls for FreeSwitch", $verbosity);
&cleanup_cdrs_fs($cdr_db, $config);
} else {
- $cdr_table = $config->{asterisk_cdr_table};
+ $config->{cdr_table} = $config->{asterisk_cdr_table};
$ASTPP->debug("Rating calls for Asterisk", $verbosity);
}
@@ -71,7 +70,7 @@
my @chargelist;
push @chargelist, $uniqueid;
#sleep $config->{sleep};
- &processlist($astpp_db, $cdr_db,$cdr_table, $config, \@chargelist);
+ &processlist($astpp_db, $cdr_db,$config, \@chargelist);
#&cleanup_cdrs($cdr_db, $config);
&shutdown();
exit(0);
@@ -102,7 +101,7 @@
);
my @chargelist;
push @chargelist, $ARGV[16];
- &processlist($astpp_db, $cdr_db,$cdr_table, $config, \@chargelist, \%args);
+ &processlist($astpp_db, $cdr_db, $config, \@chargelist, \%args);
&cleanup_cdrs($cdr_db, $config);
}
elsif ( $run_type eq "price_only" ) {
@@ -155,13 +154,13 @@
if ( !$cdr_db ) {
$cdr_db = &connect_db( $config, @output );
}
- my $cdrinfo = &get_cdr( $config, $cdr_db, $input->{Uniqueid},$cdr_table,1 );
+ my $cdrinfo = &get_cdr( $config, $cdr_db, $input->{Uniqueid},1 );
# my $tmp = "UPDATE $config->{asterisk_cdr_table} SET cost = 'rating' WHERE uniqueid = " . $input->{Uniqueid} . " AND cost = 'none' AND dst = " . $cdr_db->quote($cdrinfo->{dst}) . " LIMIT 1";
# print STDERR $tmp if $config->{debug} == 1;
# print $tmp if $config->{debug} == 1;
# $cdr_db->do($tmp);
if ($cdrinfo->{lastapp} eq "MeetMe" || $cdrinfo->{billsec} > 0 || $cdrinfo->{cost} eq "none") {
- &processlist($astpp_db, $cdr_db, $cdr_table, $config, \@chargelist);
+ &processlist($astpp_db, $cdr_db, $config, \@chargelist);
&vendor_process_rating( $astpp_db, $cdr_db, $config, "none", $input->{Uniqueid} ) if $config->{trackvendorcharges} == 1;
} # else {
&cleanup_cdrs($cdr_db, $config);
@@ -177,17 +176,24 @@
&cleanup_cdrs($cdr_db, $config);
my @chargelist;
my $phrase = "none";
- @chargelist = &list_cdrs_status( $config, $cdr_db, $cdr_table, $phrase ); # Grab a list of all calls with "none" assigned in the cost field
- &processlist($astpp_db, $cdr_db,$cdr_table, $config,\@chargelist); # Bill as many calls as we can.
+ @chargelist = &list_cdrs_status( $config, $cdr_db, $phrase ); # Grab a list of all calls with "none" assigned in the cost field
+ &processlist($astpp_db, $cdr_db, $config,\@chargelist); # Bill as many calls as we can.
$phrase = "error";
- @chargelist = &list_cdrs_status( $config, $cdr_db, $cdr_table, $phrase ); # Grab a list of all calls with "none" assigned in the cost field
- &processlist($astpp_db, $cdr_db,$cdr_table, $config, \@chargelist); # See if we can now bill some of the calls that are marked in "error"
-# print STDERR gettext("START ON VENDOR CALL RATING!") . "\n" if $config->{debug} == 1;
-# &vendor_process_rating( $astpp_db, $cdr_db,$cdr_table, $config, "none", 0 ) if $config->{trackvendorcharges} == 1;
-# &vendor_process_rating( $astpp_db, $cdr_db,$cdr_table, $config. $config, "error", 0 ) if $config->{trackvendorcharges} == 1;
-# print STDERR gettext("VENDOR CALLS WHICH HAVE NOT BEEN RATED.") . "\n" if $config->{debug} == 1;
+ @chargelist = &list_cdrs_status( $config, $cdr_db, $phrase ); # Grab a list of all calls with "none" assigned in the cost field
+ &processlist($astpp_db, $cdr_db, $config, \@chargelist); # See if we can now bill some of the calls that are marked in "error"
+ if ($config->{trackvendorcharges} == 1) {
+ print STDERR gettext("START ON VENDOR CALL RATING!") . "\n" if $config->{debug} == 1;
+ if ($config->{softswitch} == 0) {
+ &vendor_process_rating( $astpp_db, $cdr_db, $config, "none", 0 );
+ &vendor_process_rating( $astpp_db, $cdr_db, $config. $config, "error", 0 );
+ } elsif ($config->{softswitch} == 1) {
+ &vendor_process_rating_fs( $astpp_db, $cdr_db, $config, "none", 0 );
+ &vendor_process_rating_fs( $astpp_db, $cdr_db, $config. $config, "error", 0 );
+ }
+ print STDERR gettext("VENDOR CALLS WHICH HAVE NOT BEEN RATED.") . "\n" if $config->{debug} == 1;
# Print a list of calls which have not been rated
- &vendor_not_billed($config, $cdr_db) if $config->{trackvendorcharges} == 1;
+ &vendor_not_billed($config, $cdr_db);
+ }
&cleanup_cdrs($cdr_db, $config);
}
&shutdown();
Added: trunk/sql/astpp-2009-09-23.sql
===================================================================
--- trunk/sql/astpp-2009-09-23.sql (rev 0)
+++ trunk/sql/astpp-2009-09-23.sql 2009-09-28 15:21:45 UTC (rev 2261)
@@ -0,0 +1,1403 @@
+DROP TABLE IF EXISTS `routes`;
+CREATE TABLE routes (
+id INTEGER NOT NULL AUTO_INCREMENT,
+pattern CHAR(40),
+comment CHAR(80),
+connectcost INTEGER NOT NULL,
+includedseconds INTEGER NOT NULL,
+cost INTEGER NOT NULL,
+pricelist CHAR(80),
+inc INTEGER,
+reseller CHAR(50) default NULL,
+precedence INT(4) NOT NULL DEFAULT 0,
+status INTEGER NOT NULL DEFAULT 1,
+PRIMARY KEY (`id`),
+KEY `pattern` (`pattern`),
+KEY `pricelist` (`pricelist`),
+KEY `reseller` (`reseller`),
+KEY `status` (`status`)
+);
+
+DROP TABLE IF EXISTS `pricelists`;
+CREATE TABLE pricelists (
+name CHAR(40) NOT NULL,
+markup INTEGER NOT NULL DEFAULT 0,
+inc INTEGER NOT NULL DEFAULT 0,
+status INTEGER DEFAULT 1 NOT NULL,
+reseller CHAR(50) default NULL,
+PRIMARY KEY (`name`)
+);
+
+DROP TABLE IF EXISTS `callingcardbrands`;
+CREATE TABLE callingcardbrands (
+name CHAR(40) NOT NULL,
+reseller CHAR(40) NOT NULL DEFAULT '',
+language CHAR(10) NOT NULL DEFAULT '',
+pricelist CHAR(40) NOT NULL DEFAULT '',
+status INTEGER DEFAULT 1 NOT NULL,
+validfordays CHAR(4) NOT NULL DEFAULT '',
+pin INTEGER NOT NULL DEFAULT 0,
+maint_fee_pennies INTEGER NOT NULL DEFAULT 0,
+maint_fee_days INTEGER NOT NULL DEFAULT 0,
+disconnect_fee_pennies INTEGER NOT NULL DEFAULT 0,
+minute_fee_minutes INTEGER NOT NULL DEFAULT 0,
+minute_fee_pennies INTEGER NOT NULL DEFAULT 0,
+min_length_minutes INTEGER NOT NULL DEFAULT 0,
+min_length_pennies INTEGER NOT NULL DEFAULT 0,
+PRIMARY KEY (`name`),
+ KEY `reseller` (`reseller`),
+ KEY `pricelist` (`pricelist`)
+);
+
+DROP TABLE IF EXISTS `callingcardcdrs`;
+CREATE TABLE callingcardcdrs (
+id INTEGER NOT NULL AUTO_INCREMENT,
+cardnumber CHAR(50) NOT NULL DEFAULT '',
+clid CHAR(80) NOT NULL DEFAULT '',
+destination CHAR(40) NOT NULL DEFAULT '',
+disposition CHAR(20)NOT NULL DEFAULT '',
+callstart CHAR(40) NOT NULL DEFAULT '',
+seconds INTEGER NOT NULL DEFAULT 0,
+debit DECIMAL(20,6) NOT NULL DEFAULT 0.00000,
+credit DECIMAL(20,6) NOT NULL DEFAULT 0.00000,
+status INTEGER DEFAULT 0 NOT NULL,
+uniqueid VARCHAR(32) NOT NULL DEFAULT '',
+notes CHAR(80) NOT NULL DEFAULT '',
+pricelist C...
[truncated message content] |
|
From: <dar...@us...> - 2009-10-01 04:43:55
|
Revision: 2267
http://astpp.svn.sourceforge.net/astpp/?rev=2267&view=rev
Author: darrenkw
Date: 2009-10-01 04:43:47 +0000 (Thu, 01 Oct 2009)
Log Message:
-----------
Committed code to allow viewing invoices in HTML. The html is stored in a template and can easily be modified to suit your requirements.
Modified Paths:
--------------
trunk/scripts/astpp-common.pl
trunk/templates/invoice.tpl
trunk/web_interface/astpp-admin.cgi
Modified: trunk/scripts/astpp-common.pl
===================================================================
--- trunk/scripts/astpp-common.pl 2009-10-01 03:21:35 UTC (rev 2266)
+++ trunk/scripts/astpp-common.pl 2009-10-01 04:43:47 UTC (rev 2267)
@@ -324,8 +324,22 @@
return $trunkdata;
}
+sub get_invoice() {
+ my ( $astpp_db, $invoiceid ) = @_;
+ my ( $sql, $invoicedata );
+ $sql =
+ $astpp_db->prepare(
+ "SELECT * FROM invoice_list_view WHERE invoiceid = " . $astpp_db->quote($invoiceid) );
+ $sql->execute;
+ $invoicedata = $sql->fetchrow_hashref;
+ $sql->finish;
+ return $invoicedata;
+}
+
# This is used by calling cards as well as lcr. Pass on the phone number as well as the trunk to use. It will return the dialstring
# for Asterisk(tm).
+# This is used by calling cards as well as lcr. Pass on the phone number as well as the trunk to use. It will return the dialstring
+# for Asterisk(tm).
sub get_dial_string() {
my ( $astpp_db, $route, $phone ) = @_;
my ( $sql, $trunkdata, $dialstring );
@@ -1655,8 +1669,20 @@
$sql->execute;
$accountdata = $sql->fetchrow_hashref;
$sql->finish;
+ }
+ if ($accountdata) {
+ return $accountdata;
+ } else {
+ $sql =
+ $astpp_db->prepare( "SELECT * FROM accounts WHERE accountid = "
+ . $astpp_db->quote($accountno)
+ . " AND status = 1" );
+ $sql->execute;
+ $accountdata = $sql->fetchrow_hashref;
+ $sql->finish;
return $accountdata;
}
+
}
@@ -1681,8 +1707,20 @@
$sql->execute;
$accountdata = $sql->fetchrow_hashref;
$sql->finish;
+ }
+ if ($accountdata) {
+ return $accountdata;
+ } else {
+ $sql =
+ $astpp_db->prepare( "SELECT * FROM accounts WHERE accountid = "
+ . $astpp_db->quote($accountno)
+ . " AND status = 1" );
+ $sql->execute;
+ $accountdata = $sql->fetchrow_hashref;
+ $sql->finish;
return $accountdata;
}
+
}
# Go looking for account by CC number.
Modified: trunk/templates/invoice.tpl
===================================================================
--- trunk/templates/invoice.tpl 2009-10-01 03:21:35 UTC (rev 2266)
+++ trunk/templates/invoice.tpl 2009-10-01 04:43:47 UTC (rev 2267)
@@ -1,14 +1,76 @@
+<div align="center">
+ <table width="100%" border="0">
+ <tr>
+ <td width="50%">VOIP Wholesale Company</td>
+ <td><div align="right">www.astpp.org</div></td>
+ </tr>
+ <tr>
+ <td width="50%">123 Street</td>
+ <td><div align="right">(800) 555-1212</div></td>
+ </tr>
+ <tr>
+ <td width="50%">City, Province</td>
+ <td><div align="right">su...@as...</div></td>
+ </tr>
+ <tr>
+ <td width="50%">Canada</td>
+ <td><div align="right"></div></td>
+ </tr>
+ </table>
+ <hr />
+ <p>I N V O I C E
+</p>
+</div>
-
-<table class="default">
+<div align="left">
+<table border="0">
+<tr><td>
+To:
+</td></tr>
+<tr><td>
+<TMPL_VAR NAME="firstname"> <TMPL_VAR NAME="lastname">
+</td></tr>
+<tr><td>
+<TMPL_VAR NAME="company_name">
+</td></tr>
+<tr><td>
+<TMPL_VAR NAME="address_1">
+</td></tr>
+<tr><td>
+<TMPL_VAR NAME="address_2">
+</td></tr>
+<tr><td>
+<TMPL_VAR NAME="address_3">
+</td></tr>
+<tr><td>
+<TMPL_VAR NAME="city">, <TMPL_VAR NAME="province"> <TMPL_VAR NAME="postal_code">
+</td></tr>
+<tr><td>
+<TMPL_VAR NAME="country"></pre>
+</td></tr>
+</table>
+</div>
+<table width="100%" border="1" cellspacing="0">
+ <tr>
+ <td width="33.3%"><div align="center">Account ID</div></td>
+ <td width="33.3%"><div align="center">Invoice Number</div></td>
+ <td width="33.3%"><div align="center">Invoice Date</div></td>
+ </tr>
+ <tr>
+ <td><div align="center"><TMPL_VAR NAME="accountid"></div></td>
+ <td><div align="center"><TMPL_VAR NAME="invoiceid"></div></td>
+ <td><div align="center"><TMPL_VAR NAME="invoicedate"></div></td>
+ </tr>
+</table>
+<p> </p>
+<table width="100%" class="default">
<tr class="header">
- <td>Date & Time</td>
- <td>Caller*ID</td>
- <td>Called Number</td>
- <td>Disposition</td>
- <td>Billable Seconds</td>
- <td>Charge</td>
- <td>Notes</td>
+ <td width="20%">Date & Time</td>
+ <td width="20%">Caller*ID</td>
+ <td width="20%">Called Number</td>
+ <td width="20%">Disposition</td>
+ <td width="10%">Duration</td>
+ <td width="10%">Charge</td>
</tr>
<TMPL_LOOP NAME="invoice_cdr_list">
<TR>
@@ -17,9 +79,24 @@
<TD><TMPL_VAR NAME="callednum"></TD>
<TD><TMPL_VAR NAME="disposition"></TD>
<TD><TMPL_VAR NAME="billseconds"></TD>
- <TD><TMPL_VAR NAME="charge"></TD>
- <TD><TMPL_VAR NAME="notes"></TD>
+ <TD><div align="right"><TMPL_VAR NAME="charge"></div></TD>
</TR>
</TMPL_LOOP>
</table>
-
+<br>
+<table width="100%" class="default">
+ <tr class="header">
+ <td width="40%"></td>
+ <td width="20%">Title</td>
+ <td width="20%">Text</td>
+ <td width="20%">Fee</td>
+ </tr>
+ <TMPL_LOOP NAME="invoice_total_list">
+ <TR>
+ <TD></td>
+ <TD><TMPL_VAR NAME="title"></TD>
+ <TD><TMPL_VAR NAME="text"></TD>
+ <TD><div align="right"><TMPL_VAR NAME="value"></div></TD>
+ </TR>
+ </TMPL_LOOP>
+</table>
Modified: trunk/web_interface/astpp-admin.cgi
===================================================================
--- trunk/web_interface/astpp-admin.cgi 2009-10-01 03:21:35 UTC (rev 2266)
+++ trunk/web_interface/astpp-admin.cgi 2009-10-01 04:43:47 UTC (rev 2267)
@@ -428,6 +428,8 @@
return &build_view_cdrs() if $params->{mode} eq gettext("View CDRs");
return &build_configuration()
if $params->{mode} eq gettext("Configuration");
+ return &build_view_invoice()
+ if $params->{mode} eq gettext("View Invoice");
return &build_add_callshop()
if $params->{mode} eq gettext("Create CallShop");
@@ -2394,6 +2396,61 @@
return $status;
}
+sub build_view_invoice() {
+ my ($tmp,$sql,$body, $status, @cdr_list,@total_list);
+ my $template = HTML::Template->new(
+ filename => '/var/lib/astpp/templates/invoice.tpl',
+ die_on_bad_params => $config->{template_die_on_bad_params}
+ );
+ return gettext("Database is NOT configured!") . " \n" unless $astpp_db;
+ return gettext("No Invoice Selected!") . " \n" unless $params->{invoiceid};
+ $params->{format} = "html" if !$params->{format};
+
+ $tmp = "SELECT * FROM cdrs WHERE invoiceid = "
+ . $astpp_db->quote($params->{invoiceid});
+ $sql = $astpp_db->prepare($tmp);
+ $sql->execute;
+
+ while ( my $cdr = $sql->fetchrow_hashref ) {
+ $cdr->{charge} = ($cdr->{debit} - $cdr->{credit}) / 10000;
+ $cdr->{charge} = sprintf( "%." . $config->{decimalpoints} . "f", $cdr->{charge} );
+ push( @cdr_list, $cdr );
+ }
+ $template->param( invoice_cdr_list => \@cdr_list );
+
+ $tmp = "SELECT * FROM invoices_total WHERE invoices_id = "
+ . $astpp_db->quote($params->{invoiceid})
+ . " ORDER BY sort_order";
+ $sql = $astpp_db->prepare($tmp);
+ $sql->execute;
+
+ while ( my $total = $sql->fetchrow_hashref ) {
+# $cdr->{charge} = ($cdr->{debit} - $cdr->{credit}) / 10000;
+# $cdr->{charge} = sprintf( "%." . $config->{decimalpoints} . "f", $cdr->{charge} );
+ push( @total_list, $total );
+ }
+ $template->param( invoice_total_list => \@total_list );
+
+ my $invoicedata = &get_invoice( $astpp_db, $params->{invoiceid});
+ $template->param( invoiceid => $invoicedata->{invoiceid} );
+ $template->param( invoicedate => $invoicedata->{date} );
+ $template->param( accountid => $invoicedata->{accountid} );
+
+ my $accountinfo = &get_account_including_closed( $astpp_db, $invoicedata->{accountid} );
+ $template->param( first_name => $accountinfo->{first_name} );
+ $template->param( last_name => $accountinfo->{last_name} );
+ $template->param( company => $accountinfo->{company} );
+ $template->param( address_1 => $accountinfo->{address_1} );
+ $template->param( address_2 => $accountinfo->{address_2} );
+ $template->param( address_3 => $accountinfo->{address_3} );
+ $template->param( city => $accountinfo->{city} );
+ $template->param( province => $accountinfo->{province} );
+ $template->param( country => $accountinfo->{country} );
+ $template->param( postal_code => $accountinfo->{postal_code} );
+
+ return $template->output;
+}
+
sub build_create_account() {
my ( @pricelists, $status, $body );
my $template = HTML::Template->new(
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dar...@us...> - 2009-10-02 16:38:19
|
Revision: 2268
http://astpp.svn.sourceforge.net/astpp/?rev=2268&view=rev
Author: darrenkw
Date: 2009-10-02 16:22:27 +0000 (Fri, 02 Oct 2009)
Log Message:
-----------
Resolved a problem with authenticating calls by IP address as well as with rating calls with no increment set.
Modified Paths:
--------------
trunk/freeswitch/astpp-fs-xml.pl
trunk/modules/ASTPP/lib/ASTPP.pm
trunk/scripts/astpp-common.pl
Modified: trunk/freeswitch/astpp-fs-xml.pl
===================================================================
--- trunk/freeswitch/astpp-fs-xml.pl 2009-10-01 04:43:47 UTC (rev 2267)
+++ trunk/freeswitch/astpp-fs-xml.pl 2009-10-02 16:22:27 UTC (rev 2268)
@@ -42,7 +42,7 @@
################# Programs start here #######################################
&initialize;
-my ( $xml, $maxlength, $maxmins, $callstatus,$astppdid,$didinfo );
+my ( $ipinfo, $xml, $maxlength, $maxmins, $callstatus,$astppdid,$didinfo );
foreach my $param ( param() ) {
$params->{$param} = param($param);
$ASTPP->debug( debug => "$param $params->{$param}" );
@@ -62,11 +62,6 @@
$params->{variable_accountcode} = $didinfo->{account};
}
- $xml = $ASTPP->fs_dialplan_xml_header(
- xml => $xml,
- destination_number => $params->{'Caller-Destination-Number'},
- DID => $didinfo->{number}
- );
if ( !$params->{variable_accountcode} ) {
@@ -87,16 +82,23 @@
if ( !$params->{variable_accountcode} ) {
$ASTPP->debug(
debug => "Checking IP Address:" . $params->{'Hunt-Network-Addr'} );
- my $ip_data = $ASTPP->ip_address_authenticate(
+ $ipinfo = $ASTPP->ip_address_authenticate(
ip_address => $params->{'Hunt-Network-Addr'},
destination => $params->{'Caller-Destination-Number'}
);
- if ($ip_data) {
- $params->{variable_accountcode} = $ip_data->{account};
- $params->{'Caller-Destination-Number'} =~ s/$ip_data->{prefix}//g;
+ if ($ipinfo->{account} ne "") {
+ $params->{variable_accountcode} = $ipinfo->{account};
+ $params->{'Caller-Destination-Number'} =~ s/$ipinfo->{prefix}//g;
}
}
+ $xml = $ASTPP->fs_dialplan_xml_header(
+ xml => $xml,
+ destination_number => $params->{'Caller-Destination-Number'},
+ DID => $didinfo->{number},
+ IP => $ipinfo->{account}
+ );
+
$ASTPP->debug( debug =>
"$params->{variable_accountcode}, $params->{'Caller-Destination-Number'}"
);
Modified: trunk/modules/ASTPP/lib/ASTPP.pm
===================================================================
--- trunk/modules/ASTPP/lib/ASTPP.pm 2009-10-01 04:43:47 UTC (rev 2267)
+++ trunk/modules/ASTPP/lib/ASTPP.pm 2009-10-02 16:22:27 UTC (rev 2268)
@@ -111,9 +111,11 @@
$arg{xml} .= "<document type=\"freeswitch/xml\">\n";
$arg{xml} .= "<section name=\"dialplan\" description=\"ASTPP Dynamic Routing\">\n";
if ($arg{DID} > 0) {
- $arg{xml} .= "<context name=\"public\">\n";
+ $arg{xml} .= "<context name=\"public\">\n";
+ } elsif ($arg{IP} ne "") {
+ $arg{xml} .= "<context name=\"public\">\n";
} else {
- $arg{xml} .= "<context name=\"default\">\n";
+ $arg{xml} .= "<context name=\"default\">\n";
};
$arg{xml} .= "<extension name=\"" . $arg{destination_number} . "\">\n";
$arg{xml} .= "<condition field=\"destination_number\" expression=\"" . $arg{destination_number} . "\">\n";
Modified: trunk/scripts/astpp-common.pl
===================================================================
--- trunk/scripts/astpp-common.pl 2009-10-01 04:43:47 UTC (rev 2267)
+++ trunk/scripts/astpp-common.pl 2009-10-02 16:22:27 UTC (rev 2268)
@@ -1109,6 +1109,9 @@
my ( $connect, $cost, $answeredtime, $increment, $inc_seconds ) = @_;
print STDERR "Connect: $connect Cost: $cost Answered: $answeredtime \n";
print STDERR " Inc: $increment included: $inc_seconds \n";
+ if (!$increment || $increment == 0) {
+ $increment = 1;
+ }
if ($answeredtime > 0) {
my ($total_seconds);
$total_seconds = ( $answeredtime - $inc_seconds ) / $increment if $inc_seconds;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dar...@us...> - 2009-10-03 05:17:15
|
Revision: 2273
http://astpp.svn.sourceforge.net/astpp/?rev=2273&view=rev
Author: darrenkw
Date: 2009-10-03 05:17:07 +0000 (Sat, 03 Oct 2009)
Log Message:
-----------
Fix a couple of problems in the perl module so that it will compile again.
Modified Paths:
--------------
trunk/freeswitch/astpp-fs-xml.pl.mod_perl
trunk/modules/ASTPP/lib/ASTPP.pm
Modified: trunk/freeswitch/astpp-fs-xml.pl.mod_perl
===================================================================
--- trunk/freeswitch/astpp-fs-xml.pl.mod_perl 2009-10-03 04:40:49 UTC (rev 2272)
+++ trunk/freeswitch/astpp-fs-xml.pl.mod_perl 2009-10-03 05:17:07 UTC (rev 2273)
@@ -43,7 +43,7 @@
dbpass => $config->{dbpass}
);
$ASTPP->set_astpp_db($astpp_db);
- $config = &load_config_db( $astpp_db, $config ) if $astpp_db;
+ $config = $ASTPP->load_config_db( config => $config ) if $astpp_db;
$freeswitch_db = $ASTPP->connect_db(
dbengine => "MySQL",
dbname => $config->{freeswitch_dbname},
@@ -164,7 +164,6 @@
account_pricelist => $carddata->{pricelist},
account_reseller => $carddata->{reseller},
default_brand => $config->{default_brand},
-
);
# &max_length( $astpp_db, $config, $carddata,
# $params->{'Caller-Destination-Number'} );
@@ -187,19 +186,36 @@
}
while ( $carddata->{reseller} && $maxlength > 1 && $callstatus == 1 ) {
$ASTPP->debug( debug => "FINDING LIMIT FOR: $carddata->{reseller}" );
- $carddata = &get_account( $astpp_db, $carddata->{reseller} );
+ $carddata = &ASTPP->get_account( account => $carddata->{reseller} );
push @reseller_list, $carddata->{number};
$ASTPP->debug( debug =>
"ADDING $carddata->{number} to the list of resellers for this account"
);
- my ( $resellercallstatus, $resellermaxlength ) =
- &max_length( $astpp_db, $config, $carddata,
- $params->{'Caller-Destination-Number'} );
- my $routeinfo = &get_route(
- $astpp_db, $config,
- $params->{'Caller-Destination-Number'},
- $carddata->{pricelist}, $carddata
+ my ( $resellercallstatus, $resellermaxlength, $routeinfo ) = $ASTPP->max_length(
+ destination => $params->{'Caller-Destination-Number'},
+ call_max_length => $config->{call_max_length},
+ max_free_length => $config->{max_free_length},
+ markup => $pricelistdata->{markup},
+ account => $carddata->{number},
+ account_creditlimit => $carddata->{credit_limit},
+ account_maxchannels => $carddata->{maxchannels},
+ debug => $config->{debug},
+ account_pricelist => $carddata->{pricelist},
+ account_reseller => $carddata->{reseller},
+ default_brand => $config->{default_brand},
+
);
+
+
+# my ( $resellercallstatus, $resellermaxlength ) =
+# &max_length( $astpp_db, $config, $carddata,
+# $params->{'Caller-Destination-Number'} );
+#
+# my $routeinfo = &get_route(
+# $astpp_db, $config,
+# $params->{'Caller-Destination-Number'},
+# $carddata->{pricelist}, $carddata
+# );
if ( $resellercallstatus != 1 ) {
$carddata->{reseller} = "";
$callstatus = $resellercallstatus;
@@ -254,11 +270,11 @@
"L(" . sprintf( "%.0f", $maxlength * 60 * 1000 ) . ":60000:30000)";
$ASTPP->debug( debug => "Looking for outbound Route" );
- my $routeinfo = &get_route(
- $astpp_db, $config,
- $params->{'Caller-Destination-Number'},
- $carddata->{pricelist}, $carddata, $astppdid
- );
+# my $routeinfo = &get_route(
+# $astpp_db, $config,
+# $params->{'Caller-Destination-Number'},
+# $carddata->{pricelist}, $carddata, $astppdid
+# );
if ($didinfo->{number} ) {
$ASTPP->debug( debug => "THIS IS A DID CALL: $xml");
Modified: trunk/modules/ASTPP/lib/ASTPP.pm
===================================================================
--- trunk/modules/ASTPP/lib/ASTPP.pm 2009-10-03 04:40:49 UTC (rev 2272)
+++ trunk/modules/ASTPP/lib/ASTPP.pm 2009-10-03 05:17:07 UTC (rev 2273)
@@ -180,6 +180,24 @@
return $config;
}
+# Load configuration from database. Please pass the configuration from astpp-config.conf along. This will overwrite
+# those settings with settings from the database.
+sub load_config_db() {
+ my ($self, %arg) = @_;
+ my $config = $arg{config};
+ my ($sql, @didlist, $row, $tmp );
+ $tmp =
+ "SELECT name,value FROM system WHERE reseller IS NULL";
+ $sql = $self->{_astpp_db}->prepare($tmp);
+ $sql->execute;
+ while ( $row = $sql->fetchrow_hashref ) {
+ $config->{$row->{name}} = $row->{value};
+ }
+ $sql->finish;
+ return $config;
+}
+
+
=item $ASTPP->connect_db()
Connect to a database and return the connection. This can be used for either
@@ -1475,13 +1493,13 @@
$branddata = &get_pricelist($self, pricelist => $carddata->{pricelist});
print STDERR "pattern: $record->{pattern}\n" if $record->{pattern};
}
- elsif ($config->{thirdlane_mods} == 1 && $arg{type} =~ m/.\d\d\d-IN/) {
+ elsif ($arg{thirdlane_mods} == 1 && $arg{type} =~ m/.\d\d\d-IN/) {
print STDERR "Call belongs to a Thirdlane(tm) DID.\n";
($arg{destination} = $arg{type}) =~ s/-IN//g;
print STDERR "Destination: $arg{destination} \n";
$record = &get_did( reseller => $arg{reseller}, did => $arg{destination});
$record->{comment} = $record->{city} . "," . $record->{province} . "," . $record->{country}; $record->{pattern} = "DID:" . $arg{destination};
- $branddata = &get_pricelist($self, pricelist => $carddata->{{pricelist});
+ $branddata = &get_pricelist($self, pricelist => $carddata->{pricelist});
print STDERR "pattern: $record->{pattern}\n" if $record->{pattern};
}
else {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dar...@us...> - 2009-10-06 03:56:11
|
Revision: 2282
http://astpp.svn.sourceforge.net/astpp/?rev=2282&view=rev
Author: darrenkw
Date: 2009-10-06 03:56:05 +0000 (Tue, 06 Oct 2009)
Log Message:
-----------
Start adding support to be able to link the A and B legs of calls in Freeswitch.
Modified Paths:
--------------
trunk/freeswitch/astpp-fs-xml.pl
Added Paths:
-----------
trunk/sql/cdrdb-2009-10-05.sql
Modified: trunk/freeswitch/astpp-fs-xml.pl
===================================================================
--- trunk/freeswitch/astpp-fs-xml.pl 2009-10-06 03:54:35 UTC (rev 2281)
+++ trunk/freeswitch/astpp-fs-xml.pl 2009-10-06 03:56:05 UTC (rev 2282)
@@ -322,7 +322,7 @@
my $tmp = "INSERT INTO " . $config->{freeswitch_cdr_table} . "(accountcode,src,dst,dcontext,clid,channel,dstchannel,lastapp,"
- . "lastdata,calldate,answerdate,enddate,duration,billsec,disposition,amaflags,uniqueid,userfield,read_codec,"
+ . "lastdata,calldate,answerdate,enddate,duration,billsec,disposition,amaflags,uniqueid,originator,userfield,read_codec,"
. "write_codec,cost,vendor,provider,trunk,outbound_route,progressmsec,answermsec,progress_mediamsec) VALUES ("
. "'"
. $data->{variables}->{accountcode}
@@ -388,6 +388,10 @@
. $data->{callflow}->{caller_profile}->{uuid}
. "'"
. ","
+ . "'"
+ . $data->{variables}->{originator}
+ . "'"
+ . ","
. "''"
. ","
. "'" . $data->{variables}->{read_code} . "'"
Added: trunk/sql/cdrdb-2009-10-05.sql
===================================================================
--- trunk/sql/cdrdb-2009-10-05.sql (rev 0)
+++ trunk/sql/cdrdb-2009-10-05.sql 2009-10-06 03:56:05 UTC (rev 2282)
@@ -0,0 +1,70 @@
+--
+-- Table structure for table `cdr`
+--
+
+DROP TABLE IF EXISTS `cdr`;
+CREATE TABLE `cdr` (
+ `calldate` datetime NOT NULL default '0000-00-00 00:00:00',
+ `clid` varchar(80) NOT NULL default '',
+ `src` varchar(80) NOT NULL default '',
+ `dst` varchar(80) NOT NULL default '',
+ `dcontext` varchar(80) NOT NULL default '',
+ `channel` varchar(80) NOT NULL default '',
+ `dstchannel` varchar(80) NOT NULL default '',
+ `lastapp` varchar(80) NOT NULL default '',
+ `lastdata` varchar(80) NOT NULL default '',
+ `duration` int(11) NOT NULL default '0',
+ `billsec` int(11) NOT NULL default '0',
+ `disposition` varchar(45) NOT NULL default '',
+ `amaflags` int(11) NOT NULL default '0',
+ `accountcode` varchar(20) NOT NULL default '',
+ `uniqueid` varchar(32) NOT NULL default '',
+ `userfield` varchar(255) NOT NULL default '',
+ `cost` varchar(20) NOT NULL default 'none',
+ `vendor` varchar(20) NOT NULL default 'none',
+ KEY `calldate` (`calldate`),
+ KEY `dst` (`dst`),
+ KEY `accountcode` (`accountcode`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+--
+-- Table structure for table `fscdr`
+--
+
+DROP TABLE IF EXISTS `fscdr`;
+CREATE TABLE IF NOT EXISTS `fscdr` (
+ `accountcode` varchar(20) NOT NULL default '',
+ `src` varchar(80) NOT NULL default '',
+ `dst` varchar(80) NOT NULL default '',
+ `dcontext` varchar(80) NOT NULL default '',
+ `clid` varchar(80) NOT NULL default '',
+ `channel` varchar(80) NOT NULL default '',
+ `dstchannel` varchar(80) NOT NULL default '',
+ `lastapp` varchar(80) NOT NULL default '',
+ `lastdata` varchar(80) NOT NULL default '',
+ `calldate` datetime NOT NULL default '0000-00-00 00:00:00',
+ `answerdate` datetime NOT NULL default '0000-00-00 00:00:00',
+ `enddate` datetime NOT NULL default '0000-00-00 00:00:00',
+ `duration` int(11) NOT NULL default '0',
+ `billsec` int(11) NOT NULL default '0',
+ `disposition` varchar(45) NOT NULL default '',
+ `amaflags` int(11) NOT NULL default '0',
+ `uniqueid` varchar(60) NOT NULL,
+ `originator` varchar(60),
+ `userfield` varchar(255) NOT NULL default '',
+ `read_codec` varchar(60) NOT NULL default '',
+ `write_codec` varchar(60) NOT NULL default '',
+ `cost` varchar(20) NOT NULL default 'none',
+ `vendor` varchar(20) NOT NULL default 'none',
+ `provider` varchar(60) NOT NULL,
+ `trunk` varchar(60) NOT NULL,
+ `outbound_route` varchar(60) NOT NULL,
+ `progressmsec` varchar(20) NOT NULL,
+ `answermsec` varchar(20) NOT NULL,
+ `progress_mediamsec` varchar(20) NOT NULL,
+ KEY `calldate` (`calldate`),
+ KEY `dst` (`dst`),
+ KEY `accountcode` (`accountcode`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dar...@us...> - 2009-10-17 20:41:46
|
Revision: 2292
http://astpp.svn.sourceforge.net/astpp/?rev=2292&view=rev
Author: darrenkw
Date: 2009-10-17 20:41:31 +0000 (Sat, 17 Oct 2009)
Log Message:
-----------
Add the ability to edit the database configuration items from within the gui.
Modified Paths:
--------------
trunk/Makefile
trunk/freeswitch/astpp-callingcards.pl
trunk/templates/configuration-list.tpl
trunk/web_interface/astpp-admin.cgi
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2009-10-15 02:08:55 UTC (rev 2291)
+++ trunk/Makefile 2009-10-17 20:41:31 UTC (rev 2292)
@@ -65,7 +65,6 @@
install_samples:
install -m 644 -o $(OWNER) -g $(GROUP) ./samples/sample.astpp-config.conf $(DESTDIR)$(ASTPPDIR)/astpp-config.conf
- install -m 644 -o $(OWNER) -g $(GROUP) ./samples/sample.astpp-dialplan.conf $(DESTDIR)$(ASTERISKDIR)/astpp-dialplan.conf
install_php:
mkdir -p $(DESTDIR)$(WWWDIR)/html/astpp
Modified: trunk/freeswitch/astpp-callingcards.pl
===================================================================
--- trunk/freeswitch/astpp-callingcards.pl 2009-10-15 02:08:55 UTC (rev 2291)
+++ trunk/freeswitch/astpp-callingcards.pl 2009-10-17 20:41:31 UTC (rev 2292)
@@ -228,7 +228,7 @@
);
}
elsif ( $cc == 1 ) {
- $balance = &accountbalance( $astpp_db, $cardinfo->{number} );
+ $balance = $ASTPP->accountbalance( $cardinfo->{number} );
$balance = ( $balance * -1 ) + ( $cardinfo->{credit_limit} );
$available = ( $balance - $numberinfo->{connectfee} ) / 100;
}
Modified: trunk/templates/configuration-list.tpl
===================================================================
--- trunk/templates/configuration-list.tpl 2009-10-15 02:08:55 UTC (rev 2291)
+++ trunk/templates/configuration-list.tpl 2009-10-17 20:41:31 UTC (rev 2292)
@@ -4,6 +4,7 @@
<input name="mode" value="Configuration" type="hidden">
</tr>
<tr class="header">
+ <td>ID</td>
<td>Reseller</td>
<td>Brand</td>
<td>Name</td>
@@ -12,28 +13,31 @@
<td>Action</td>
</tr>
<tr class="header">
- <td colspan=6>Add Item</td>
+ <td colspan=7 align="center">Add / Edit Item</td>
</tr>
<tr class="rowone">
+ <input name="id" value="<TMPL_VAR NAME="id">" type="hidden">
+ <td><TMPL_VAR NAME="id"></td>
<td><TMPL_VAR NAME="resellers"></td>
<td><TMPL_VAR NAME="brands"></td>
- <td><input name="name" size="20" type="text"></td>
- <td><input name="value" size="20" type="text"></td>
- <td><input name="comment" size="50" type="text"></td>
- <td><input name="action" value="Add Item" type="submit"></td>
+ <td><input name="name" size="20" type="text" value="<TMPL_VAR NAME="name">"></td>
+ <td><input name="value" size="20" type="text" value="<TMPL_VAR NAME="value">"></td>
+ <td><input name="comment" size="50" type="text" value="<TMPL_VAR NAME="comment">"></td>
+ <td><TMPL_VAR NAME="action"></td>
</tr>
<tr class="header">
- <td colspan=5>List</td>
+ <td colspan=7>List</td>
</tr>
<TMPL_LOOP NAME="configuration_list">
<TR>
+ <TD><TMPL_VAR NAME="id"></TD>
<TD><TMPL_VAR NAME="reseller"></TD>
<TD><TMPL_VAR NAME="brand"></TD>
<TD><TMPL_VAR NAME="name"></TD>
<TD><TMPL_VAR NAME="value"></TD>
<TD><TMPL_VAR NAME="comment"></TD>
- <TD><a href="astpp-admin.cgi?mode=Configuration&action=Delete&name=<TMPL_VAR NAME="name">&reseller=<TMPL_VAR NAME="Reseller">">Delete</a>
- <a href="astpp-admin.cgi?mode=Configuration&action=Edit&name=<TMPL_VAR NAME="name">&reseller=<TMPL_VAR NAME="Reseller">">Edit</a></TD>
+ <TD><a href="astpp-admin.cgi?mode=Configuration&action=Delete&id=<TMPL_VAR NAME="id">">Delete</a>
+ <a href="astpp-admin.cgi?mode=Configuration&action=Edit&id=<TMPL_VAR NAME="id">">Edit</a></TD>
</TR>
</TMPL_LOOP>
</table>
Modified: trunk/web_interface/astpp-admin.cgi
===================================================================
--- trunk/web_interface/astpp-admin.cgi 2009-10-15 02:08:55 UTC (rev 2291)
+++ trunk/web_interface/astpp-admin.cgi 2009-10-17 20:41:31 UTC (rev 2292)
@@ -226,19 +226,19 @@
print header();
}
$ASTPP->debug(
- user => $param->{username},
+ user => $params->{username},
debug => gettext("ASTPP-USER:") . " $params->{username}"
);
$ASTPP->debug(
- user => $param->{username},
+ user => $params->{username},
debug => gettext("ASTPP-PASS:") . " $params->{password}"
);
$ASTPP->debug(
- user => $param->{username},
+ user => $params->{username},
debug => gettext("ASTPP-AUTHCODE:") . " $config->{auth}"
);
$ASTPP->debug(
- user => $param->{username},
+ user => $params->{username},
debug => gettext("ASTPP-USER-COUNT:") . " $count"
);
return ( $params->{mode}, $count );
@@ -286,19 +286,19 @@
$count = 0;
}
$ASTPP->debug(
- user => $param->{username},
+ user => $params->{username},
debug => gettext("ASTPP-USER:") . " $params->{username}"
) if $config->{debug} == 1 && $params->{username};
$ASTPP->debug(
- user => $param->{username},
+ user => $params->{username},
debug => gettext("ASTPP-PASS:") . " $params->{password}"
) if $config->{debug} == 1 && $params->{password};
$ASTPP->debug(
- user => $param->{username},
+ user => $params->{username},
debug => gettext("ASTPP-AUTHCODE:") . " $config->{auth}"
) if $config->{debug} == 1;
$ASTPP->debug(
- user => $param->{username},
+ user => $params->{username},
debug => gettext("ASTPP-USER-COUNT:") . " $count"
) if $config->{debug} == 1;
print header();
@@ -1024,7 +1024,7 @@
}
}
-# $where = 0 if $param->{$name} eq "" && $destination eq "" && $pattern eq "";
+# $where = 0 if $params->{$name} eq "" && $destination eq "" && $pattern eq "";
$body .=
start_form()
@@ -1074,7 +1074,7 @@
print STDERR $query ."\n" if $config->{debug} == 1;
$sth = $astpp_db->do($query)
|| return gettext("Something is wrong with astpp database") . "\n";
- $ASTPP->debug( user => $param->{username}, debug => " SQL: $query " );
+ $ASTPP->debug( user => $params->{username}, debug => " SQL: $query " );
my $sql =
$astpp_db->prepare("SELECT DISTINCT cardnum AS $name FROM $table");
@@ -1262,7 +1262,7 @@
. " and (dstchannel like '$row->{tech}/$row->{path}%'"
. " or lastdata like '" . $freeswitch_trunk . "'"
. "or dstchannel like '$row->{tech}\[$row->{path}\]%' ) ";
- $ASTPP->debug( user => $param->{username}, debug => " SQL: $sql1 \n " );
+ $ASTPP->debug( user => $params->{username}, debug => " SQL: $sql1 \n " );
my $sth1 = $cdr_db->prepare($sql1);
$sth1->execute();
my $ref1 = $sth1->fetchrow_hashref();
@@ -1275,7 +1275,7 @@
. " or lastdata like '" . $freeswitch_trunk . "'"
. " OR dstchannel like '$row->{tech}\[$row->{path}\]%' )";
my $sth2 = $cdr_db->prepare($sql2);
- $ASTPP->debug( user => $param->{username}, debug => " SQL: $sql2" );
+ $ASTPP->debug( user => $params->{username}, debug => " SQL: $sql2" );
$sth2->execute();
my $ref2 = $sth2->fetchrow_hashref();
$sth2->finish;
@@ -1287,7 +1287,7 @@
. " OR lastdata like '" . $freeswitch_trunk . "'"
. " OR dstchannel like '$row->{tech}\[$row->{path}\]%' )";
my $sth3 = $cdr_db->prepare($sql3);
- $ASTPP->debug( user => $param->{username}, debug => " SQL: $sql3" );
+ $ASTPP->debug( user => $params->{username}, debug => " SQL: $sql3" );
$sth3->execute();
my $ref3 = $sth3->fetchrow_hashref();
$sth3->finish;
@@ -1298,7 +1298,7 @@
. " or lastdata like '" . $freeswitch_trunk . "'"
. " OR dstchannel like '$row->{tech}\[$row->{path}\]%' )";
my $sth4 = $cdr_db->prepare($sql4);
- $ASTPP->debug( user => $param->{username}, debug => " SQL: $sql4" );
+ $ASTPP->debug( user => $params->{username}, debug => " SQL: $sql4" );
$sth4->execute();
my $ref4 = $sth4->fetchrow_hashref();
$sth4->finish;
@@ -1437,7 +1437,7 @@
. $cdr_db->quote($sd)
. " and calldate <= "
. $cdr_db->quote($ed);
- $ASTPP->debug( user => $param->{username}, debug => " SQL: $tmp" );
+ $ASTPP->debug( user => $params->{username}, debug => " SQL: $tmp" );
}
else {
$tmp =
@@ -1445,7 +1445,7 @@
. $cdr_db->quote($sd)
. " and calldate <= "
. $cdr_db->quote($ed);
- $ASTPP->debug( user => $param->{username}, debug => " SQL: $tmp" );
+ $ASTPP->debug( user => $params->{username}, debug => " SQL: $tmp" );
}
if ( $params->{accountcode} && $params->{logintype} == 2 ) {
$tmp .=
@@ -1457,7 +1457,7 @@
"SELECT * FROM trunks WHERE name = "
. $astpp_db->quote( $params->{trunk} )
. " LIMIT 1";
- $ASTPP->debug( user => $param->{username}, debug => $tmpsql );
+ $ASTPP->debug( user => $params->{username}, debug => $tmpsql );
$sql = $astpp_db->prepare($tmpsql);
$sql->execute
|| return gettext("Something is wrong with the trunks database")
@@ -1478,7 +1478,7 @@
. " or dstchannel like ". $astpp_db->quote($freeswitch_trunk)
. " or dstchannel like '$row->{tech}\[$row->{path}\]\%')";
}
- $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ $ASTPP->debug( user => $params->{username}, debug => $tmp );
$sql = $cdr_db->prepare($tmp);
$sql->execute;
$results = $sql->rows;
@@ -1618,7 +1618,7 @@
$accounts .= ",";
}
}
- $ASTPP->debug( user => $param->{username}, debug => $accounts );
+ $ASTPP->debug( user => $params->{username}, debug => $accounts );
$template->param(
customer_count => &count_accounts(
$astpp_db, "WHERE type = 0 AND reseller = '$params->{username}'"
@@ -1887,7 +1887,7 @@
. $astpp_db->quote($number) . ", "
. $astpp_db->quote( $params->{prefix} ) . ", "
. $astpp_db->quote( $params->{ipcontext} ) . ")";
- $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ $ASTPP->debug( user => $params->{username}, debug => $tmp );
if ( $astpp_db->do($tmp) ) {
$status .=
gettext("IP") . " '"
@@ -2296,7 +2296,7 @@
}
my $brandinfo = &get_cc_brand( $astpp_db, $params->{brand} );
$ASTPP->debug(
- user => $param->{username},
+ user => $params->{username},
debug => "BRAND: $params->{brand}"
);
while ( $count < $params->{count} ) {
@@ -2682,7 +2682,7 @@
$tmp = "DELETE FROM callingcardbrands WHERE name = "
. $astpp_db->quote( $params->{name} );
}
- $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ $ASTPP->debug( user => $params->{username}, debug => $tmp );
if ( $astpp_db->do($tmp) ) {
$status .= gettext("Brand Deleted!");
}
@@ -2729,7 +2729,7 @@
. $astpp_db->quote( $params->{min_length_minutes} ) . ", "
. $astpp_db->quote( $params->{min_length_pennies} ) . ")";
}
- $ASTPP->debug( user => $param->{username}, debug => "sql" );
+ $ASTPP->debug( user => $params->{username}, debug => "sql" );
if ( $astpp_db->do($sql) ) {
$status .= gettext("Brand Added!");
}
@@ -2869,7 +2869,7 @@
. " WHERE name ="
. $astpp_db->quote( $params->{name} );
}
- $ASTPP->debug( user => $param->{username}, debug => $sql );
+ $ASTPP->debug( user => $params->{username}, debug => $sql );
if ( $astpp_db->do($sql) ) {
$status .= gettext("Brand Updated!");
}
@@ -3033,7 +3033,7 @@
$tmp =
"SELECT name FROM callingcardbrands WHERE status < 2 AND (reseller IS NULL OR reseller = '')";
}
- $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ $ASTPP->debug( user => $params->{username}, debug => $tmp );
$sql = $astpp_db->prepare($tmp);
$sql->execute
|| return gettext(
@@ -3055,7 +3055,7 @@
$tmp =
"SELECT * FROM callingcardbrands WHERE status < 2 AND (reseller IS NULL OR reseller = '') ORDER BY name limit $params->{limit} , $results_per_page";
}
- $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ $ASTPP->debug( user => $params->{username}, debug => $tmp );
$sql = $astpp_db->prepare($tmp);
$sql->execute
|| return gettext(
@@ -3350,7 +3350,7 @@
. $astpp_db->quote( $cardinfo->{cardnumber} )
. " AND brand "
. $brandsql;
- $ASTPP->debug( user => $param->{username}, debug => $sql );
+ $ASTPP->debug( user => $params->{username}, debug => $sql );
$astpp_db->do($sql) || print "$sql " . gettext("FAILED");
}
@@ -3361,7 +3361,7 @@
$cardinfo =
&get_callingcard( $astpp_db, $params->{cardnumber}, $config );
$ASTPP->debug(
- user => $param->{username},
+ user => $params->{username},
debug => "CARDNUMBER: " . $cardinfo->{cardnumber}
);
&update_balance( $cardinfo, $params->{pennies} * 100 );
@@ -3553,7 +3553,7 @@
"SELECT * FROM callingcards WHERE status < 2 AND brand $brandsql ORDER BY id LIMIT "
. ( $pgr->get_first() - 1 ) . ", "
. $pgr->get_entries_on_this_page();
- $ASTPP->debug( user => $param->{username}, debug => $sql );
+ $ASTPP->debug( user => $params->{username}, debug => $sql );
$sql = $astpp_db->prepare($sql);
$sql->execute;
@@ -4092,14 +4092,14 @@
mode => $params->{mode},
);
- $ASTPP->debug( user => $param->{username}, debug => $sql );
+ $ASTPP->debug( user => $params->{username}, debug => $sql );
$results = $cdr_db->prepare($sql);
$results->execute;
while ( my $record = $results->fetchrow_hashref ) {
$ASTPP->debug(
- user => $param->{username},
+ user => $params->{username},
debug => $record->{uniqueid}
);
$count++;
@@ -4121,7 +4121,7 @@
my (%stuff) = @_;
foreach ( keys %stuff ) {
$ASTPP->debug(
- user => $param->{username},
+ user => $params->{username},
debug => "$_: " . $stuff{$_}
);
}
@@ -4836,7 +4836,7 @@
. $astpp_db->quote( $params->{desc} ) . ", "
. $astpp_db->quote( $params->{charge} ) . ", "
. $astpp_db->quote( $params->{sweep} ) . ", 1)";
- $ASTPP->debug( user => $param->{username}, debug => $sql );
+ $ASTPP->debug( user => $params->{username}, debug => $sql );
if ( $astpp_db->do($sql) ) {
$status .= gettext("Periodic Charge Added!");
}
@@ -4971,7 +4971,7 @@
. $astpp_db->quote( $params->{sweep} )
. ", status = '1' WHERE id = "
. $astpp_db->quote( $params->{chargeid} );
- $ASTPP->debug( user => $param->{username}, debug => $sql );
+ $ASTPP->debug( user => $params->{username}, debug => $sql );
if ( $astpp_db->do($sql) ) {
$status .= gettext("Periodic Charge Updated!");
}
@@ -4984,7 +4984,7 @@
elsif ( $params->{action} eq gettext("Delete...") ) {
my $sql = "DELETE FROM charges WHERE id = "
. $astpp_db->quote( $params->{chargeid} );
- $ASTPP->debug( user => $param->{username}, debug => $sql );
+ $ASTPP->debug( user => $params->{username}, debug => $sql );
if ( $astpp_db->do($sql) ) {
$status .= gettext("Periodic Charge Deleted!");
}
@@ -4994,7 +4994,7 @@
}
$sql = "DELETE FROM charge_to_account WHERE charge_id = "
. $astpp_db->quote( $params->{chargeid} );
- $ASTPP->debug( user => $param->{username}, debug => $sql );
+ $ASTPP->debug( user => $params->{username}, debug => $sql );
if ( $astpp_db->do($sql) ) {
$status .= gettext("Periodic Charge Deleted!");
}
@@ -5169,7 +5169,7 @@
my $uploaded = upload('rateimport');
my ( @data, $record );
while ( my $record = <$uploaded> ) {
- $ASTPP->debug( user => $param->{username}, debug => $record );
+ $ASTPP->debug( user => $params->{username}, debug => $record );
chomp;
push @data, $record;
}
@@ -5211,7 +5211,7 @@
. $astpp_db->quote( $columns[9] ) . ","
. $astpp_db->quote( $columns[1] ) . ", 1,"
. $astpp_db->quote( $columns[10] ) . ")";
- $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ $ASTPP->debug( user => $params->{username}, debug => $tmp );
if ( $astpp_db->do($tmp) ) {
$status .=
gettext("Pattern: ") . " '"
@@ -5303,7 +5303,7 @@
$uploaded = upload('rateimport');
my ( @data, $record );
while ( my $record = <$uploaded> ) {
- $ASTPP->debug( user => $param->{username}, debug => $record );
+ $ASTPP->debug( user => $params->{username}, debug => $record );
chomp;
push @data, $record;
}
@@ -5335,7 +5335,7 @@
. " AND pricelist = "
. $astpp_db->quote( $resellerdata->{pricelist} )
. " LIMIT 1";
- $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ $ASTPP->debug( user => $params->{username}, debug => $tmp );
my $sql = $astpp_db->prepare($tmp);
my ($routeinfo,$row);
$sql->execute;
@@ -5530,7 +5530,7 @@
. $astpp_db->quote( $columns[13] ) . ","
. $astpp_db->quote( $columns[14] ) . ","
. $astpp_db->quote( $columns[15] ) . ")";
- $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ $ASTPP->debug( user => $params->{username}, debug => $tmp );
if ( $astpp_db->do($tmp) ) {
$status .=
gettext("DID: ") . " '"
@@ -5560,7 +5560,7 @@
gettext("The old pattern for") . " '"
. $params->{number} . "' "
. gettext("FAILED to remove!");
- $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ $ASTPP->debug( user => $params->{username}, debug => $tmp );
}
$tmp =
"INSERT INTO routes (pattern,comment,pricelist,connectcost,includedseconds,cost) VALUES ("
@@ -5853,7 +5853,7 @@
gettext("Pricelist: ")
. $params->{name}
. gettext(" Failed to Reactivate!");
- $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ $ASTPP->debug( user => $params->{username}, debug => $tmp );
}
}
else {
@@ -5891,7 +5891,7 @@
gettext("Pricelist: ")
. $params->{name}
. gettext(" Failed to Add!");
- $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ $ASTPP->debug( user => $params->{username}, debug => $tmp );
}
}
$params->{action} = gettext("Information...");
@@ -5933,7 +5933,7 @@
gettext("Pricelist: ")
. $params->{name}
. gettext(" Failed to Update!");
- $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ $ASTPP->debug( user => $params->{username}, debug => $tmp );
}
}
else {
@@ -5971,7 +5971,7 @@
gettext("Pricelist: ")
. $params->{name}
. gettext(" Failed to Deactivate!");
- $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ $ASTPP->debug( user => $params->{username}, debug => $tmp );
}
}
$params->{action} = gettext("Information...");
@@ -6038,7 +6038,7 @@
$tmp =
"SELECT * FROM pricelists WHERE status < 2 AND reseller IS NULL";
}
- $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ $ASTPP->debug( user => $params->{username}, debug => $tmp );
$sql = $astpp_db->prepare($tmp);
$sql->execute
|| return gettext("Something is wrong with the ASTPP database!")
@@ -6060,7 +6060,7 @@
$tmp =
"SELECT * FROM pricelists WHERE status < 2 AND reseller IS NULL ORDER BY name limit $params->{limit} , $results_per_page";
}
- $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ $ASTPP->debug( user => $params->{username}, debug => $tmp );
$sql = $astpp_db->prepare($tmp);
$sql->execute
|| return gettext("Something is wrong with the ASTPP database!")
@@ -6433,7 +6433,7 @@
gettext("DID") . " '"
. $params->{number} . "' "
. gettext("FAILED to create!");
- $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ $ASTPP->debug( user => $params->{username}, debug => $tmp );
}
$tmp =
"DELETE FROM routes WHERE pattern = "
@@ -6451,7 +6451,7 @@
gettext("The old pattern for") . " '"
. $params->{number} . "' "
. gettext("FAILED to remove!");
- $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ $ASTPP->debug( user => $params->{username}, debug => $tmp );
}
$tmp =
"INSERT INTO routes (pattern,comment,pricelist,connectcost,includedseconds,cost,inc,reseller) VALUES ("
@@ -6465,7 +6465,7 @@
. $astpp_db->quote( $params->{included} ) . ","
. $astpp_db->quote( $params->{cost} ) . ","
. $astpp_db->quote( $params->{inc} ) . ",'')";
- $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ $ASTPP->debug( user => $params->{username}, debug => $tmp );
if ( $astpp_db->do($tmp) ) {
$status .=
gettext("Pattern") . " '"
@@ -6477,7 +6477,7 @@
gettext("Pattern") . " '"
. $params->{number} . "' "
. gettext("FAILED to create!");
- $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ $ASTPP->debug( user => $params->{username}, debug => $tmp );
}
$params->{action} = gettext("Information...");
}
@@ -6534,7 +6534,7 @@
gettext("DID") . " '"
. $params->{number} . "' "
. gettext("FAILED to update!");
- $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ $ASTPP->debug( user => $params->{username}, debug => $tmp );
}
$tmp =
"UPDATE routes SET"
@@ -9540,42 +9540,103 @@
}
sub build_configuration() {
- my ( @brands, @resellerlist, $tmp, $template, @configuration_list );
+ my ( $action, @brands, @resellerlist, $tmp, $template, @configuration_list );
+ $action = "<input name=\"action\" value=\"Add Item\" type=\"submit\">";
$template = HTML::Template->new(
filename => '/var/lib/astpp/templates/configuration-list.tpl',
die_on_bad_params => $config->{template_die_on_bad_params}
);
if ( $params->{logintype} == 1 ) {
- push( @resellerlist, $params->{username} );
+ unshift( @resellerlist, $params->{username} );
}
else {
@resellerlist = &list_resellers($astpp_db);
- push( @resellerlist, "" );
+ unshift( @resellerlist, "" );
}
- $template->param(
- resellers => popup_menu(
- -name => "resellers",
- -values => \@resellerlist
- )
- );
if ( $params->{logintype} == 1 || $params->{logintype} == 5 ) {
@brands = &list_cc_brands_reseller( $astpp_db, $params->{username} );
- push( @brands, "" );
+ unshift( @brands, "" );
}
else {
@brands = &list_cc_brands($astpp_db);
- push( @brands, "" );
+ unshift( @brands, "" );
}
+
+
+ if ( !$params->{action} ) { $params->{action} = "List"; }
+ if ( $params->{action} eq "Edit" ) {
+ my ($tmp,$sql);
+ if ( $params->{logintype} == 1 ) {
+ $tmp =
+ "SELECT * FROM system WHERE reseller = "
+ . $astpp_db->quote( $params->{username} )
+ . " AND id = "
+ . $astpp_db->quote( $params->{id} );
+ } else {
+ $tmp =
+ "SELECT * FROM system WHERE id = "
+ . $astpp_db->quote( $params->{id} );
+
+ }
+ $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ $sql = $astpp_db->prepare($tmp);
+ $sql->execute;
+ my $config_item = $sql->fetchrow_hashref;
+ $sql->finish;
+
+ $action = "<input name=\"action\" value=\"Save Item\" type=\"submit\">";
+ $template->param(id => $config_item->{id});
+ $template->param(name => $config_item->{name});
+ $template->param(value => $config_item->{value});
+ $template->param(comment => $config_item->{comment});
$template->param(
brands => popup_menu(
-name => "brands",
- -values => \@brands
+ -values => \@brands,
+ -default => $config_item->{brand}
)
);
+ $template->param(
+ resellers => popup_menu(
+ -name => "resellers",
+ -values => \@resellerlist,
+ -default => $config_item->{reseller}
+ )
+ );
- if ( !$params->{action} ) { $params->{action} = "List"; }
- if ( $params->{action} eq "Edit" ) {
+
}
+ elsif ( $params->{action} eq "Save Item" ) {
+ if ( $params->{logintype} == 1 ) {
+ $params->{reseller} = $params->{username};
+ }
+ $tmp =
+ "UPDATE system SET "
+ . " reseller = "
+ . $astpp_db->quote( $params->{reseller} ) . ","
+ . " brand = "
+ . $astpp_db->quote( $params->{brand} ) . ","
+ . " name = "
+ . $astpp_db->quote( $params->{name} ) . ","
+ . " value = "
+ . $astpp_db->quote( $params->{value} ) . ","
+ . " comment = "
+ . $astpp_db->quote( $params->{comment} )
+ . " WHERE id = "
+ . $astpp_db->quote( $params->{id} );
+ if ($params->{resller}) {
+ $tmp .= " AND reseller = "
+ . $astpp_db->quote( $params->{reseller} );
+ }
+ $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ if ( $astpp_db->do($tmp) ) {
+ $status .= "Saved Configuration Item!";
+ }
+ else {
+ $status .= "Failed to Save Configuration Item!";
+ }
+ $params->{action} = "List";
+ }
elsif ( $params->{action} eq "Add Item" ) {
if ( $params->{logintype} == 1 ) {
$params->{reseller} = $params->{username};
@@ -9600,23 +9661,23 @@
if ( $params->{logintype} == 2 ) {
if ( $params->{reseller} ne "" ) {
$tmp =
- "DELETE FROM system WHERE name = "
- . $astpp_db->quote( $params->{name} )
+ "DELETE FROM system WHERE id = "
+ . $astpp_db->quote( $params->{id} )
. " AND reseller = "
. $astpp_db->quote( $params->{reseller} )
. " LIMIT 1";
}
else {
$tmp =
- "DELETE FROM system WHERE name = "
- . $astpp_db->quote( $params->{name} )
+ "DELETE FROM system WHERE id = "
+ . $astpp_db->quote( $params->{id} )
. " AND reseller IS NULL LIMIT 1";
}
}
elsif ( $params->{logintype} == 1 ) {
$tmp =
- "DELETE FROM system WHERE name = "
- . $astpp_db->quote( $params->{name} )
+ "DELETE FROM system WHERE id = "
+ . $astpp_db->quote( $params->{id} )
. " AND reseller = "
. $astpp_db->quote( $params->{username} )
. " LIMIT 1";
@@ -9631,6 +9692,18 @@
$params->{action} = "List";
}
if ( $params->{action} eq "List" ) {
+ $template->param(
+ brands => popup_menu(
+ -name => "brands",
+ -values => \@brands
+ )
+ );
+ $template->param(
+ resellers => popup_menu(
+ -name => "resellers",
+ -values => \@resellerlist
+ )
+ );
if ( $params->{logintype} == 2 ) {
$tmp = "SELECT * FROM system ORDER BY reseller,name";
}
@@ -9651,11 +9724,13 @@
$row{value} = $record->{value};
$row{comment} = $record->{comment};
$row{timestamp} = $record->{timestamp};
+ $row{id} = $record->{id};
push( @configuration_list, \%row );
}
$sql->finish;
$template->param( configuration_list => \@configuration_list );
}
+ $template->param(action => $action );
return $template->output;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dar...@us...> - 2009-10-17 21:46:29
|
Revision: 2293
http://astpp.svn.sourceforge.net/astpp/?rev=2293&view=rev
Author: darrenkw
Date: 2009-10-17 21:46:20 +0000 (Sat, 17 Oct 2009)
Log Message:
-----------
Add menus so that when you click the main menu in the interface it brings up sub menus in the window below rather than failing.
Modified Paths:
--------------
trunk/web_interface/astpp-admin.cgi
Added Paths:
-----------
trunk/templates/sub_menu.tpl
Added: trunk/templates/sub_menu.tpl
===================================================================
--- trunk/templates/sub_menu.tpl (rev 0)
+++ trunk/templates/sub_menu.tpl 2009-10-17 21:46:20 UTC (rev 2293)
@@ -0,0 +1,11 @@
+<div align="center">
+ <table width="100%" border="0">
+ <TR>
+ <TD align="center"> MENU </TD>
+ <TR>
+ <TMPL_LOOP NAME="menu">
+ <TR>
+ <TD align="center"><a href="astpp-admin.cgi?mode=<TMPL_VAR NAME="value">"> <TMPL_VAR NAME="value"> </a></TD>
+ </TR>
+ </TMPL_LOOP>
+</table>
Modified: trunk/web_interface/astpp-admin.cgi
===================================================================
--- trunk/web_interface/astpp-admin.cgi 2009-10-17 20:41:31 UTC (rev 2292)
+++ trunk/web_interface/astpp-admin.cgi 2009-10-17 21:46:20 UTC (rev 2293)
@@ -322,6 +322,22 @@
return "";
}
+sub build_menu() {
+ my (@items) = @_;
+ my @menu_list;
+ my $template = HTML::Template->new(
+ filename => '/var/lib/astpp/templates/sub_menu.tpl',
+ die_on_bad_params => $config->{template_die_on_bad_params}
+ );
+ foreach my $tmp (@items) {
+ my %row;
+ $row{value} = $tmp;
+ push( @menu_list, \%row );
+ }
+ $template->param( menu => \@menu_list );
+ return $template->output;
+}
+
sub build_menu_ts() {
my ($selected) = @_;
my ( $tmp, $body, $x );
@@ -352,6 +368,28 @@
}
sub build_body() {
+ return &build_homepage()
+ if $params->{mode} eq gettext("Home Page")
+ || $params->{mode} eq gettext("Home")
+ || $params->{mode} eq ""
+ || $params->{mode} eq gettext("Login")
+ || $params->{mode} eq gettext("Logout");
+
+ # Make sure that the main menus are covered
+ return &build_menu(@Accounts) if $params->{mode} eq gettext("Accounts");
+ return &build_menu(@AdminReports) if $params->{mode} eq gettext("Admin Reports");
+ return &build_menu(@CallShops) if $params->{mode} eq gettext("Call Shops");
+ return &build_menu(@Callingcards) if $params->{mode} eq gettext("Calling Cards");
+ return &build_menu(@DIDs) if $params->{mode} eq gettext("DIDs");
+ return &build_menu(@LCR) if $params->{mode} eq gettext("LCR");
+ return &build_menu(@Rates) if $params->{mode} eq gettext("Rates");
+ return &build_menu(@Statistics) if $params->{mode} eq gettext("Statistics");
+ return &build_menu(@SwitchConfig) if $params->{mode} eq gettext("Switch Config");
+ return &build_menu(@System) if $params->{mode} eq gettext("System");
+ return &build_menu(@CallShops) if $params->{mode} eq gettext("CallShops");
+ return &build_menu(@Booths) if $params->{mode} eq gettext("Booths");
+
+ # Cover all the submenus
if ( $params->{logintype} == 2 ) { #Admin Login
return &build_providers() if $params->{mode} eq gettext("Providers");
return &build_trunks() if $params->{mode} eq gettext("Trunks");
@@ -379,8 +417,6 @@
return &build_account_info()
if $params->{mode} eq gettext("View Details");
return &build_list_accounts()
- if $params->{mode} eq gettext("Accounts");
- return &build_list_accounts()
if $params->{mode} eq gettext("List Accounts");
return &build_edit_account()
if $params->{mode} eq gettext("Edit Account");
@@ -443,12 +479,6 @@
return &build_admin_vendor_report()
if $params->{mode} eq gettext("Vendor Report");
- return &build_homepage()
- if $params->{mode} eq gettext("Home Page")
- || $params->{mode} eq gettext("Home")
- || $params->{mode} eq ""
- || $params->{mode} eq gettext("Login")
- || $params->{mode} eq gettext("Logout");
return gettext("Not Available!") . "\n";
}
elsif ( $params->{logintype} == 3 ) { #Vendor Login
@@ -479,8 +509,6 @@
if $params->{mode} eq gettext("Calc Charge");
return &build_dids()
if $params->{mode} eq gettext("Manage DIDs");
- return &build_dids()
- if $params->{mode} eq gettext("DIDs");
return &build_sip_devices()
if $params->{mode} eq gettext("Asterisk(TM) SIP Devices");
return &build_iax_devices()
@@ -556,14 +584,7 @@
return &build_counters()
if $params->{mode} eq gettext("Counters");
- return &build_homepage()
- if $params->{mode} eq gettext("Home Page")
- || $params->{mode} eq gettext("Home")
- || $params->{mode} eq ""
- || $params->{mode} eq gettext("Login")
- || $params->{mode} eq gettext("Logout");
return gettext("Not Available!") . "\n";
- return gettext("Not Available!") . "\n";
}
elsif ( $params->{logintype} == 5 ) { #Call Shop Login
return &build_pricelists() if $params->{mode} eq gettext("Pricelists");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dar...@us...> - 2009-10-31 23:51:51
|
Revision: 2295
http://astpp.svn.sourceforge.net/astpp/?rev=2295&view=rev
Author: darrenkw
Date: 2009-10-31 23:51:38 +0000 (Sat, 31 Oct 2009)
Log Message:
-----------
Add the first revision of the tax handling interface. Add support to perform regex commands on accountcodes prior to rating as per http://www.astpp.org/?q=node/261
Modified Paths:
--------------
trunk/scripts/astpp-common.pl
trunk/web_interface/astpp-admin.cgi
Added Paths:
-----------
trunk/templates/taxes.tpl
Modified: trunk/scripts/astpp-common.pl
===================================================================
--- trunk/scripts/astpp-common.pl 2009-10-28 01:21:43 UTC (rev 2294)
+++ trunk/scripts/astpp-common.pl 2009-10-31 23:51:38 UTC (rev 2295)
@@ -4249,6 +4249,9 @@
$cdrinfo->{accountcode} = $record->{account};
$cdrinfo->{dst} = $did;
}
+ if ($config->{cdr_regex_accountcode}) {
+ $cdrinfo->{accountcode} =~ $config->{cdr_regex_accountcode};
+ }
my $carddata = &get_account( $astpp_db, $cdrinfo->{accountcode} );
if ($carddata->{number}) {
Added: trunk/templates/taxes.tpl
===================================================================
--- trunk/templates/taxes.tpl (rev 0)
+++ trunk/templates/taxes.tpl 2009-10-31 23:51:38 UTC (rev 2295)
@@ -0,0 +1,53 @@
+<table class="default">
+ <tr class="header">
+ <td colspan=10 align="center">Tax Details</td>
+<input name="mode" value="Taxes" type="hidden">
+ </tr>
+ <tr class="header">
+ <td>ID</td>
+ <td>Priority</td>
+ <td>Amount</td>
+ <td>Rate</td>
+ <td>Description</td>
+ <td>Modified</td>
+ <td>Created</td>
+ <td>Action</td>
+ </tr>
+ <tr class="header">
+ <td colspan=8 align="center">Add / Edit Item</td>
+ </tr>
+ <tr class="rowone">
+ <input name="taxes_id" value="<TMPL_VAR NAME="taxes_id">" type="hidden">
+ <td><TMPL_VAR NAME="taxes_id"></td>
+ <td><input name="taxes_priority" size="4" type="text" value="<TMPL_VAR NAME="taxes_priority">"></td>
+ <td><input name="taxes_amount" size="20" type="text" value="<TMPL_VAR NAME="taxes_amount">"></td>
+ <td><input name="taxes_rate" size="20" type="text" value="<TMPL_VAR NAME="taxes_rate">"></td>
+ <td><input name="taxes_description" size="50" type="text" value="<TMPL_VAR NAME="taxes_description">"></td>
+ <td><TMPL_VAR NAME="last_modified"></td>
+ <td><TMPL_VAR NAME="date_added"></td>
+ <td><TMPL_VAR NAME="action"></td>
+ </tr>
+ <tr class="header">
+ <td colspan=8>List</td>
+ </tr>
+ <TMPL_LOOP NAME="taxes_list">
+ <TR>
+ <TD><TMPL_VAR NAME="taxes_id"></TD>
+ <TD><TMPL_VAR NAME="taxes_priority"></TD>
+ <TD><TMPL_VAR NAME="taxes_amount"></TD>
+ <TD><TMPL_VAR NAME="taxes_rate"></TD>
+ <TD><TMPL_VAR NAME="taxes_description"></TD>
+ <TD><TMPL_VAR NAME="last_modified"></TD>
+ <TD><TMPL_VAR NAME="date_added"></TD>
+ <TD><a href="astpp-admin.cgi?mode=Taxes&action=Delete&taxes_id=<TMPL_VAR NAME="taxes_id">">Delete</a>
+ <a href="astpp-admin.cgi?mode=Taxes&action=Edit&taxes_id=<TMPL_VAR NAME="taxes_id">">Edit</a></TD>
+ </TR>
+ </TMPL_LOOP>
+</table>
+
+<table>
+ <tr>
+ <td><TMPL_VAR NAME="status"></td>
+ </tr>
+ </table>
+</form>
Modified: trunk/web_interface/astpp-admin.cgi
===================================================================
--- trunk/web_interface/astpp-admin.cgi 2009-10-28 01:21:43 UTC (rev 2294)
+++ trunk/web_interface/astpp-admin.cgi 2009-10-31 23:51:38 UTC (rev 2295)
@@ -88,7 +88,7 @@
gettext("Outbound Routes"),
gettext("Import Outbound Routes")
);
-my @System = ( gettext("Purge Deactivated"), gettext("Configuration") );
+my @System = ( gettext("Purge Deactivated"), gettext("Configuration"), gettext("Taxes") );
my @Statistics = (
gettext("Asterisk Stats"), gettext("List Errors"),
gettext("Trunk stats"), gettext("View CDRs"),
@@ -478,6 +478,8 @@
if $params->{mode} eq gettext("Reseller Report");
return &build_admin_vendor_report()
if $params->{mode} eq gettext("Vendor Report");
+ return &build_taxes()
+ if $params->{mode} eq gettext("Taxes");
return gettext("Not Available!") . "\n";
}
@@ -9560,6 +9562,114 @@
return $template->output;
}
+
+sub build_taxes() {
+ my ( $action, @brands, $tmp, $template, @taxes_list );
+ $action = "<input name=\"action\" value=\"Add Item\" type=\"submit\">";
+ $template = HTML::Template->new(
+ filename => '/var/lib/astpp/templates/taxes.tpl',
+ die_on_bad_params => $config->{template_die_on_bad_params}
+ );
+
+ if ( !$params->{action} ) { $params->{action} = "List"; }
+
+ if ( $params->{action} eq "Edit" ) {
+ my ($tmp,$sql);
+ $tmp =
+ "SELECT * FROM taxes WHERE taxes_id = "
+ . $astpp_db->quote( $params->{taxes_id} );
+
+ $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ $sql = $astpp_db->prepare($tmp);
+ $sql->execute;
+ my $tax_item = $sql->fetchrow_hashref;
+ $sql->finish;
+
+ $action = "<input name=\"action\" value=\"Save Item\" type=\"submit\">";
+ $template->param(taxes_id => $tax_item->{taxes_id});
+ $template->param(taxes_priority => $tax_item->{taxes_priority});
+ $template->param(taxes_amount => $tax_item->{taxes_amount});
+ $template->param(taxes_rate => $tax_item->{taxes_rate});
+ $template->param(taxes_description => $tax_item->{taxes_description});
+ $template->param(last_modified => $tax_item->{last_modified});
+ $template->param(date_added => $tax_item->{date_added});
+
+ }
+ elsif ( $params->{action} eq "Save Item" ) {
+ $tmp =
+ "UPDATE taxes SET "
+ . " taxes_priority = "
+ . $astpp_db->quote( $params->{taxes_priority} ) . ","
+ . " taxes_amount = "
+ . $astpp_db->quote( $params->{taxes_amount} ) . ","
+ . " taxes_rate = "
+ . $astpp_db->quote( $params->{taxes_rate} ) . ","
+ . " taxes_description = "
+ . $astpp_db->quote( $params->{taxes_description} ) . ","
+ . " last_modified = NOW() "
+ . " WHERE id = "
+ . $astpp_db->quote( $params->{taxes_id} );
+ $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ if ( $astpp_db->do($tmp) ) {
+ $status .= "Saved Tax!";
+ }
+ else {
+ $status .= "Failed to Save Tax!";
+ }
+ $params->{action} = "List";
+ }
+ elsif ( $params->{action} eq "Add Item" ) {
+ $tmp =
+ "INSERT INTO taxes (taxes_priority,taxes_amount,taxes_rate,taxes_description) VALUES ("
+ . $astpp_db->quote( $params->{taxes_priority} ) . ","
+ . $astpp_db->quote( $params->{taxes_amount} ) . ","
+ . $astpp_db->quote( $params->{taxes_rate} ) . ","
+ . $astpp_db->quote( $params->{taxes_description} ) . ")";
+ $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ if ( $astpp_db->do($tmp) ) {
+ $status .= "Added Tax!";
+ }
+ else {
+ $status .= "Failed to Add Tax!";
+ }
+ $params->{action} = "List";
+ }
+ elsif ( $params->{action} eq "Delete" ) {
+ $tmp =
+ "DELETE FROM taxes WHERE taxes_id = "
+ . $astpp_db->quote( $params->{taxes_id} );
+ $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ if ( $astpp_db->do($tmp) ) {
+ $status .= "Removed Tax!";
+ }
+ else {
+ $status .= "Failed to Remove Tax!";
+ }
+ $params->{action} = "List";
+ }
+ if ( $params->{action} eq "List" ) {
+ $tmp = "SELECT * FROM taxes ORDER BY taxes_priority,taxes_description";
+ $ASTPP->debug( user => $param->{username}, debug => $tmp );
+ my $sql = $astpp_db->prepare($tmp);
+ $sql->execute;
+ while ( my $record = $sql->fetchrow_hashref ) {
+ my %row;
+ $row{taxes_id} = $record->{taxes_id};
+ $row{taxes_priority} = $record->{taxes_priority};
+ $row{taxes_amount} = $record->{taxes_amount};
+ $row{taxes_amount} = $record->{taxes_rate};
+ $row{taxes_description} = $record->{taxes_description};
+ $row{last_modified} = $record->{last_modified};
+ $row{date_added} = $record->{date_added};
+ push( @taxes_list, \%row );
+ }
+ $sql->finish;
+ $template->param( taxes_list => \@taxes_list );
+ }
+ $template->param(action => $action );
+ return $template->output;
+}
+
sub build_configuration() {
my ( $action, @brands, @resellerlist, $tmp, $template, @configuration_list );
$action = "<input name=\"action\" value=\"Add Item\" type=\"submit\">";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dar...@us...> - 2010-02-12 04:14:33
|
Revision: 2301
http://astpp.svn.sourceforge.net/astpp/?rev=2301&view=rev
Author: darrenkw
Date: 2010-02-12 04:14:25 +0000 (Fri, 12 Feb 2010)
Log Message:
-----------
Add a couple of missing perl modules.
Adjust the xml that is returned when a record is not found.
Modified Paths:
--------------
trunk/Makefile
trunk/freeswitch/astpp-fs-xml.pl
trunk/modules/ASTPP/lib/ASTPP.pm
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2010-02-10 05:33:45 UTC (rev 2300)
+++ trunk/Makefile 2010-02-12 04:14:25 UTC (rev 2301)
@@ -138,6 +138,7 @@
perl -MCPAN -e "install DateTime::TimeZone";
perl -MCPAN -e "install DateTime";
perl -MCPAN -e "install Locale::gettext_pp";
+ perl -MCPAN -e "install XML::Simple";
cd modules/ASTPP && perl Makefile.PL && make && make install && cd ../../
Modified: trunk/freeswitch/astpp-fs-xml.pl
===================================================================
--- trunk/freeswitch/astpp-fs-xml.pl 2010-02-10 05:33:45 UTC (rev 2300)
+++ trunk/freeswitch/astpp-fs-xml.pl 2010-02-12 04:14:25 UTC (rev 2301)
@@ -23,7 +23,7 @@
use strict;
use vars
- qw($cdr_db $params $ASTPP @output $config $freeswitch_db $astpp_db $verbosity );
+ qw($void_xml $cdr_db $params $ASTPP @output $config $freeswitch_db $astpp_db $verbosity );
use Locale::gettext_pp qw(:locale_h);
require "/usr/local/astpp/astpp-common.pl";
$ENV{LANGUAGE} = "en"; # de, es, br - whatever
@@ -35,6 +35,13 @@
$ASTPP = ASTPP->new;
$ASTPP->set_verbosity(4); #Tell ASTPP debugging how verbose we want to be.
+$void_xml = "<?xml version=\"1.0\"?>\n";
+$void_xml .= "<document type=\"freeswitch/xml\">\n";
+$void_xml .= "<section name=\"result\">\n";
+$void_xml .= "<result status=\"not found\" />";
+$void_xml .= "</section>\n";
+$void_xml .= "</document>\n";
+
sub initialize() {
$config = &load_config();
$astpp_db = &connect_db( $config, @output );
@@ -120,9 +127,8 @@
$xml .=
"<action application=\"reject\" data=\"CANNOT RETRIEVE ACCOUNT\"/>\n";
$xml = $ASTPP->fs_dialplan_xml_footer( xml => $xml );
-# print $xml;
$ASTPP->debug( debug => "Returning nothing so dialplan can continue." );
- print "";
+ print $void_xml;
exit(0);
}
@@ -248,8 +254,8 @@
$xml .= "</extension>\n";
$xml .= "</context>\n";
$xml .= "<context name=\"default\">\n";
- $xml .= "<extension name=\"" . $arg{destination_number} . "\">\n";
- $xml .= "<condition field=\"destination_number\" expression=\"" . $arg{destination_number} . "\">\n";
+ $xml .= "<extension name=\"" . $params->{'Caller-Destination-Number'} . "\">\n";
+ $xml .= "<condition field=\"destination_number\" expression=\"" . $params->{'Caller-Destination-Number'} . "\">\n";
$xml .= $returned_data;
} else {
@@ -304,9 +310,10 @@
#domain 192.168.2.119
#ip 192.168.2.119
+ my $user_count = 0;
if ($params->{'user'}) {
$xml = $ASTPP->fs_directory_xml_header( xml => $xml );
- $xml = $ASTPP->fs_directory_xml(
+ ($xml,$user_count) = $ASTPP->fs_directory_xml(
xml => $xml,
ip => $params->{'ip'},
user => $params->{'user'},
@@ -314,8 +321,14 @@
);
$xml = $ASTPP->fs_directory_xml_footer( xml => $xml );
}
+
$ASTPP->debug( debug => $xml );
- print $xml;
+ $ASTPP->debug( debug => $user_count );
+ if ($user_count > 0) {
+ print $xml;
+ } else {
+ print $void_xml;
+ }
} elsif ( $params->{cdr} ) {
print header( -type => 'text/plain' );
Modified: trunk/modules/ASTPP/lib/ASTPP.pm
===================================================================
--- trunk/modules/ASTPP/lib/ASTPP.pm 2010-02-10 05:33:45 UTC (rev 2300)
+++ trunk/modules/ASTPP/lib/ASTPP.pm 2010-02-12 04:14:25 UTC (rev 2301)
@@ -773,9 +773,11 @@
{
my ($self, %arg) = @_;
my ($sql,$sql1,$tmp,$tmp1);
+ my $user_count = 0;
$arg{xml} .= "<domain name=\"" . $arg{domain} . "\">";
my @sip_users = &fs_list_sip_usernames($self,%arg);
foreach my $record (@sip_users) {
+ $user_count++;
$arg{xml} .= "<user id=\"" . $record->{username} . "\" mailbox=\"" . $record->{mailbox} . "\">\n";
$arg{xml} .= "<params>\n";
my @params = &fs_list_sip_params($self,$record->{id});
@@ -793,6 +795,7 @@
};
my @ip_users = &ip_address_authenticate($self,%arg);
foreach my $record (@ip_users) {
+ $user_count++;
# This is only temporary and should be removed
#
$record->{id} = 0;
@@ -815,7 +818,7 @@
$arg{xml} .= "</user>\n";
}
$arg{xml} .= "</domain>\n";
- return $arg{xml};
+ return ($arg{xml},$user_count);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dar...@us...> - 2010-02-15 18:57:23
|
Revision: 2304
http://astpp.svn.sourceforge.net/astpp/?rev=2304&view=rev
Author: darrenkw
Date: 2010-02-15 18:57:11 +0000 (Mon, 15 Feb 2010)
Log Message:
-----------
It is now working to process calls both through ASTPP and through the static configuration files. The same goes for registering sip users.
Modified Paths:
--------------
trunk/freeswitch/astpp-fs-xml.pl
trunk/modules/ASTPP/lib/ASTPP.pm
Modified: trunk/freeswitch/astpp-fs-xml.pl
===================================================================
--- trunk/freeswitch/astpp-fs-xml.pl 2010-02-12 04:25:26 UTC (rev 2303)
+++ trunk/freeswitch/astpp-fs-xml.pl 2010-02-15 18:57:11 UTC (rev 2304)
@@ -324,12 +324,15 @@
$xml = $ASTPP->fs_directory_xml_footer( xml => $xml );
}
- $ASTPP->debug( debug => $xml );
- $ASTPP->debug( debug => $user_count );
+ $ASTPP->debug( debug => "User Count: " . $user_count );
if ($user_count > 0) {
+ $ASTPP->debug( debug => $xml );
print $xml;
+ exit(0);
} else {
+ $ASTPP->debug( debug => $void_xml );
print $void_xml;
+ exit(0);
}
} elsif ( $params->{cdr} ) {
print header( -type => 'text/plain' );
Modified: trunk/modules/ASTPP/lib/ASTPP.pm
===================================================================
--- trunk/modules/ASTPP/lib/ASTPP.pm 2010-02-12 04:25:26 UTC (rev 2303)
+++ trunk/modules/ASTPP/lib/ASTPP.pm 2010-02-15 18:57:11 UTC (rev 2304)
@@ -252,7 +252,7 @@
sub ip_address_authenticate
{
my ($self, %arg) = @_;
- my ($sql,$tmp);
+ my ($sql,$tmp,@results);
$arg{ip_address} = $arg{ip} if $arg{ip}; #Freeswitch passes the ip in a different format.
$tmp = "SELECT * FROM ip_map WHERE ip = " . $self->{_astpp_db}->quote($arg{ip_address})
. " AND prefix IN (NULL,'') OR ip = " . $self->{_astpp_db}->quote($arg{ip_address});
@@ -261,9 +261,13 @@
print STDERR $tmp . "\n";
$sql = $self->{_astpp_db}->prepare($tmp);
$sql->execute;
- my $anidata = $sql->fetchrow_hashref;
+ while (my $record = $sql->fetchrow_hashref) {
+ print STDERR $record->{ip};
+ push @results, $record;
+ }
+ my $rows = $sql->rows;
$sql->finish;
- return $anidata;
+ return ($rows,@results);
}
=item $ASTPP->fs_dialplan_xml_header()
@@ -728,8 +732,9 @@
print STDERR $record->{username};
push @results, $record;
}
+ my $rows = $sql->rows;
$sql->finish;
- return @results;
+ return ($rows,@results);
}
sub fs_list_sip_params
@@ -775,7 +780,9 @@
my ($sql,$sql1,$tmp,$tmp1);
my $user_count = 0;
$arg{xml} .= "<domain name=\"" . $arg{domain} . "\">";
- my @sip_users = &fs_list_sip_usernames($self,%arg);
+ my ($count,@sip_users) = &fs_list_sip_usernames($self,%arg);
+ print STDERR "COUNT: $count\n";
+ if ($count > 0) {
foreach my $record (@sip_users) {
$user_count++;
$arg{xml} .= "<user id=\"" . $record->{username} . "\" mailbox=\"" . $record->{mailbox} . "\">\n";
@@ -790,12 +797,16 @@
foreach my $record (@vars) {
$arg{xml} .= "<variable name=\"" . $record->{var_name} . "\" value=\"" . $record->{var_value} . "\"/>\n";
}
+ $arg{xml} .= "<variable name=\"accountcode\" value=\"" . $record->{account} . "\"/>\n";
+ $arg{xml} .= "<variable name=\"user_context\" value=\"" . $record->{context} . "\"/>\n";
$arg{xml} .= "</variables>\n";
$arg{xml} .= "</user>\n";
- };
- my @ip_users = &ip_address_authenticate($self,%arg);
+ }
+ }
+ my ($count,@ip_users) = &ip_address_authenticate($self,%arg);
+ print STDERR "COUNT: $count\n";
+ if ($count > 0) {
foreach my $record (@ip_users) {
- $user_count++;
# This is only temporary and should be removed
#
$record->{id} = 0;
@@ -817,7 +828,9 @@
$arg{xml} .= "</variables>\n";
$arg{xml} .= "</user>\n";
}
+ }
$arg{xml} .= "</domain>\n";
+ print STDERR "TOTAL USERS: $user_count \n";
return ($arg{xml},$user_count);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dar...@us...> - 2010-02-20 07:01:23
|
Revision: 2306
http://astpp.svn.sourceforge.net/astpp/?rev=2306&view=rev
Author: darrenkw
Date: 2010-02-20 07:01:16 +0000 (Sat, 20 Feb 2010)
Log Message:
-----------
Cleaned up in the makefile. Fixed a bug that caused astpp-admin.cgi to fail when trying to list sip devices from freeswitch.
Modified Paths:
--------------
trunk/Makefile
trunk/web_interface/astpp-admin.cgi
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2010-02-18 05:02:42 UTC (rev 2305)
+++ trunk/Makefile 2010-02-20 07:01:16 UTC (rev 2306)
@@ -1,3 +1,4 @@
+#Makefile for ASTPP (www.astpp.org)
SHELL=/bin/sh
ASTERISKDIR=/etc/asterisk
IAX=/etc/asterisk/iax.conf
Modified: trunk/web_interface/astpp-admin.cgi
===================================================================
--- trunk/web_interface/astpp-admin.cgi 2010-02-18 05:02:42 UTC (rev 2305)
+++ trunk/web_interface/astpp-admin.cgi 2010-02-20 07:01:16 UTC (rev 2306)
@@ -2104,13 +2104,12 @@
}
}
if ($fs_db) {
- my (@sip_devices);
- @sip_devices = $ASTPP->fs_list_sip_usernames(
+ my ($count,@sip_devices) = $ASTPP->fs_list_sip_usernames(
cc => $accountinfo->{cc},
accountcode => $accountinfo->{number}
);
foreach my $record (@sip_devices) {
- print STDERR $record->{username};
+# print STDERR $record->{username};
my $deviceinfo = $ASTPP->fs_retrieve_sip_user(
directory_id => $record->{id}
);
@@ -9908,7 +9907,7 @@
sub build_freeswitch_sip_devices() {
return gettext("Database is NOT configured!") . "\n" unless $astpp_db;
- my ( @device_list, @sip_devices );
+ my ( @device_list, $count, @sip_devices );
my $template = HTML::Template->new(
filename => '/var/lib/astpp/templates/freeswitch-sip-list.tpl',
die_on_bad_params => $config->{template_die_on_bad_params}
@@ -9962,7 +9961,7 @@
$template->param( fs_username => $deviceinfo->{username} );
}
- @sip_devices = $ASTPP->fs_list_sip_usernames();
+ ($count,@sip_devices) = $ASTPP->fs_list_sip_usernames();
foreach my $record (@sip_devices) {
my $deviceinfo = $ASTPP->fs_retrieve_sip_user(
directory_id => $record->{id}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dar...@us...> - 2010-02-27 02:45:33
|
Revision: 2309
http://astpp.svn.sourceforge.net/astpp/?rev=2309&view=rev
Author: darrenkw
Date: 2010-02-27 02:45:25 +0000 (Sat, 27 Feb 2010)
Log Message:
-----------
Corrected the freeswitch sound handling.
Modified Paths:
--------------
trunk/freeswitch/astpp-callingcards.pl
trunk/scripts/astpp-common.pl
Added Paths:
-----------
trunk/sql/astpp-2010-02-26.sql
Modified: trunk/freeswitch/astpp-callingcards.pl
===================================================================
--- trunk/freeswitch/astpp-callingcards.pl 2010-02-20 07:06:27 UTC (rev 2308)
+++ trunk/freeswitch/astpp-callingcards.pl 2010-02-27 02:45:25 UTC (rev 2309)
@@ -47,7 +47,7 @@
}
$cdr_db = &cdr_connect_db( $config, @output );
$ASTPP->set_cdr_db($cdr_db);
- $sound = &define_sounds($astpp_db);
+ $sound = &define_sounds($astpp_db,$config->{freeswitch_sound_files});
}
sub set_in_use()
Modified: trunk/scripts/astpp-common.pl
===================================================================
--- trunk/scripts/astpp-common.pl 2010-02-20 07:06:27 UTC (rev 2308)
+++ trunk/scripts/astpp-common.pl 2010-02-27 02:45:25 UTC (rev 2309)
@@ -3879,83 +3879,68 @@
#Map sound files to variable names. Ultimately this should probably be done in the database.
sub define_sounds() {
- my ($astpp_db) = @_;
+ my ($astpp_db,$location) = @_;
+ $location = "" if !$location;
my $sound;
- $sound->{no_responding} =
- "astpp-down.gsm"; #The calling card platform is down, please try again later.
-$sound->{cardnumber} =
- "astpp-accountnum.gsm"; #Please enter your card number followed by pound.
-$sound->{cardnumber_incorrect} = "astpp-badaccount.gsm"; #Incorrect card number.
-$sound->{pin} = "astpp-pleasepin.gsm"; #Please enter your pin followed by pound.
-$sound->{pin_incorrect} = "astpp-invalidpin.gsm"; #Incorrect pin.
-$sound->{goodbye} = "goodbye.gsm"; #Goodbye.
-$sound->{destination} =
- "astpp-phonenum.gsm"; #Please enter the number you wish to dial followed by pound.
-$sound->{destination_incorrect} = "astcc-badphone.gsm"; #Phone number not found!
-$sound->{card_inuse} = "astpp-in-use.gsm"; #This card is presently being used.
-$sound->{call_will_cost} = "astpp-willcost.gsm"; #This call will cost:
-$sound->{main_currency} = "astpp-dollar.gsm"; #Dollar
-$sound->{sub_currency} = "astpp-cent.gsm"; #Cent
-$sound->{main_currency_plural} = "astpp-dollars.gsm"; #Dollars
-$sound->{sub_currency_plural} = "astpp-cents.gsm"; #cents
-$sound->{per} = "astpp-per.gsm"; #per
-$sound->{minute} = "astpp-minute.gsm"; #Minute
-$sound->{minutes} = "astpp-minutes.gsm"; #Minutes
-$sound->{second} = "astpp-second.gsm"; #Second
-$sound->{seconds} = "astpp-seconds.gsm"; #Seconds
-$sound->{a_connect_charge} = "astpp-connectcharge.gsm"; #A connect charge of
-$sound->{will_apply} = "astpp-willapply.gsm"; #Will apply
-$sound->{please_wait_will_connect} =
- "astpp-please-wait-while-i-connect.gsm"; #Please wait while I connect your call
-$sound->{card_is_empty} = "astpp-card-is-empty.gsm"; #This card is empty.
-$sound->{card_has_balance_of} =
- "astpp-this-card-has-a-balance-of.gsm"; #Card has a balance of:
-$sound->{card_has_expired} = "astpp-card-has-expired.gsm"; #This card has expired.
-$sound->{call_will_last} = "astpp-this-call-will-last.gsm"; #This call will last:
-$sound->{not_enough_credit} =
- "astpp-not-enough-credit.gsm"; #You do not have enough credit
-$sound->{call_completed} =
- "astpp-call-completed.gsm"; #This call has been completed.
-$sound->{astpp_callingcard_menu} =
- "astpp-callingcard-menu.gsm"
+ $sound->{no_responding} = $location . "astpp-down.gsm"; #The calling card platform is down, please try again later.
+$sound->{cardnumber} = $location . "astpp-accountnum.gsm" ; #Please enter your card number followed by pound.
+$sound->{cardnumber_incorrect} = $location . "astpp-badaccount.gsm"; #Incorrect card number.
+$sound->{pin} = $location . "astpp-pleasepin.gsm"; #Please enter your pin followed by pound.
+$sound->{pin_incorrect} = $location . "astpp-invalidpin.gsm"; #Incorrect pin.
+$sound->{goodbye} = $location . "goodbye.gsm"; #Goodbye.
+$sound->{destination} = $location . "astpp-phonenum.gsm"; #Please enter the number you wish to dial followed by pound.
+$sound->{destination_incorrect} = $location . "astcc-badphone.gsm"; #Phone number not found!
+$sound->{card_inuse} = $location . "astpp-in-use.gsm"; #This card is presently being used.
+$sound->{call_will_cost} = $location . "astpp-willcost.gsm"; #This call will cost:
+$sound->{main_currency} = $location . "astpp-dollar.gsm"; #Dollar
+$sound->{sub_currency} = $location . "astpp-cent.gsm"; #Cent
+$sound->{main_currency_plural} = $location . "astpp-dollars.gsm"; #Dollars
+$sound->{sub_currency_plural} = $location . "astpp-cents.gsm"; #cents
+$sound->{per} = $location . "astpp-per.gsm"; #per
+$sound->{minute} = $location . "astpp-minute.gsm"; #Minute
+$sound->{minutes} = $location . "astpp-minutes.gsm"; #Minutes
+$sound->{second} = $location . "astpp-second.gsm"; #Second
+$sound->{seconds} = $location . "astpp-seconds.gsm"; #Seconds
+$sound->{a_connect_charge} = $location . "astpp-connectcharge.gsm"; #A connect charge of
+$sound->{will_apply} = $location . "astpp-willapply.gsm"; #Will apply
+$sound->{please_wait_will_connect} = $location . "astpp-please-wait-while-i-connect.gsm"; #Please wait while I connect your call
+$sound->{card_is_empty} = $location . "astpp-card-is-empty.gsm"; #This card is empty.
+$sound->{card_has_balance_of} = $location . "astpp-this-card-has-a-balance-of.gsm"; #Card has a balance of:
+$sound->{card_has_expired} = $location . "astpp-card-has-expired.gsm"; #This card has expired.
+$sound->{call_will_last} = $location . "astpp-this-call-will-last.gsm"; #This call will last:
+$sound->{not_enough_credit} = $location . "astpp-not-enough-credit.gsm"; #You do not have enough credit
+$sound->{call_completed} = $location . "astpp-call-completed.gsm"; #This call has been completed.
+$sound->{astpp_callingcard_menu} = $location . "astpp-callingcard-menu.gsm"
; #Press one if you wish to place another call, press 2 for your card balance, or press 3 to hangup
-$sound->{busy} = "astpp-busy-tryagain.gsm"; #Number was busy, Press 1 to try again.
-$sound->{cancelled} = "astpp-cancelled-tryagain.gsm"; #Call was cancelled.
-$sound->{congested} =
- "astpp-congested-tryagain.gsm"; #Number was congested, Press 1 to try again.
-$sound->{noanswer} =
- "astpp-noanswer-tryagain.gsm"; #There was no answer, Press 1 to try again.
-$sound->{badnumber} =
- "astpp-badnumber.gsm"; # "Calls from this location are blocked!"
-$sound->{used_elsewhere} =
- "astpp-used-elsewhere.gsm"; # "This location has been used already."
-$sound->{goodbye} = "goodbye.gsm"; # "Goodbye"
-$sound->{callback_performed} =
- "astpp-callback-performed.gsm"; # "This callback has been performed please disconnect now"
-$sound->{cardnumber} =
- "astpp-accountnum.gsm"; #Please enter your card number followed by pound.
-$sound->{cardnumber_incorrect} = "astpp-badaccount.gsm"; #Incorrect card number.
-$sound->{pin} = "astpp-pleasepin.gsm"; #Please enter your pin followed by pound.
-$sound->{pin_incorrect} = "astpp-invalidpin.gsm"; #Incorrect pin.
-$sound->{point} = "astcc-point.gsm"; #point.
-$sound->{register_ani} =
- "astpp-register.gsm"
- ; # "Register ANI to this card? Press 1 for yes or any other key for no."
-$sound->{card_has_expired} = "astpp_expired.gsm"; #"This card has expired"
-$sound->{card_is_empty} = "astpp-empty.gsm"; #This card is empty
-$sound->{where_to_call} =
+$sound->{busy} = $location . "astpp-busy-tryagain.gsm"; #Number was busy, Press 1 to try again.
+$sound->{cancelled} = $location . "astpp-cancelled-tryagain.gsm"; #Call was cancelled.
+$sound->{congested} = $location . "astpp-congested-tryagain.gsm"; #Number was congested, Press 1 to try again.
+$sound->{noanswer} = $location . "astpp-noanswer-tryagain.gsm"; #There was no answer, Press 1 to try again.
+$sound->{badnumber} = $location . "astpp-badnumber.gsm"; # "Calls from this location are blocked!"
+$sound->{used_elsewhere} = $location . "astpp-used-elsewhere.gsm"; # "This location has been used already."
+$sound->{goodbye} = $location . "goodbye.gsm"; # "Goodbye"
+$sound->{callback_performed} = $location . "astpp-callback-performed.gsm"; # "This callback has been performed please disconnect now"
+$sound->{cardnumber} = $location . "astpp-accountnum.gsm"; #Please enter your card number followed by pound.
+$sound->{cardnumber_incorrect} = $location . "astpp-badaccount.gsm"; #Incorrect card number.
+$sound->{pin} = $location . "astpp-pleasepin.gsm"; #Please enter your pin followed by pound.
+$sound->{pin_incorrect} = $location . "astpp-invalidpin.gsm"; #Incorrect pin.
+$sound->{point} = $location . "astcc-point.gsm"; #point.
+$sound->{register_ani} = $location . "astpp-register.gsm"; # "Register ANI to this card? Press 1 for yes or any other key for no."
+$sound->{card_has_expired} = $location . "astpp_expired.gsm"; #"This card has expired"
+$sound->{card_is_empty} = $location . "astpp-empty.gsm"; #This card is empty
+$sound->{where_to_call} = $location .
"astpp-where-to-call.gsm"
; #Press 1 to receive a call at the number you called from or registered
#Otherwise enter the number you wish to be called at.
-$sound->{number_to_register} =
+$sound->{number_to_register} = $location .
"astpp-number-to-register.gsm"; #Press 1 to register the number you called from.
#Otherwise enter the number you wish to register.
-$sound->{card_has_been_refilled} = "astpp-card-has-been-refilled.gsm"; # Your card has been refilled.
-$sound->{card_to_refill} = "astpp-card-to-refill.gsm"; #please enter the card number you wish to refill followed
+$sound->{card_has_been_refilled} = $location . "astpp-card-has-been-refilled.gsm"; # Your card has been refilled.
+$sound->{card_to_refill} = $location . "astpp-card-to-refill.gsm"; #please enter the card number you wish to refill followed
# by the pound sign.
-$sound->{card_to_empty} = "astpp-card-to-empty.gsm"; #please enter the card number you wish to empty into your card
+$sound->{card_to_empty} = $location . "astpp-card-to-empty.gsm"; #please enter the card number you wish to empty into your card
# followed by the pound sign.
-$sound->{astpp_please_pin_card_empty} = "astpp-please-pin-card-empty.gsm"; #please enter the pin number for the card
+$sound->{astpp_please_pin_card_empty} = $location . "astpp-please-pin-card-empty.gsm"; #please enter the pin number for the card
# you wish to empty followed by the pound
# sign.
return $sound;
Added: trunk/sql/astpp-2010-02-26.sql
===================================================================
--- trunk/sql/astpp-2010-02-26.sql (rev 0)
+++ trunk/sql/astpp-2010-02-26.sql 2010-02-27 02:45:25 UTC (rev 2309)
@@ -0,0 +1,1406 @@
+DROP TABLE IF EXISTS `routes`;
+CREATE TABLE routes (
+id INTEGER NOT NULL AUTO_INCREMENT,
+pattern CHAR(40),
+comment CHAR(80),
+connectcost INTEGER NOT NULL,
+includedseconds INTEGER NOT NULL,
+cost INTEGER NOT NULL,
+pricelist CHAR(80),
+inc INTEGER,
+reseller CHAR(50) default NULL,
+precedence INT(4) NOT NULL DEFAULT 0,
+status INTEGER NOT NULL DEFAULT 1,
+PRIMARY KEY (`id`),
+KEY `pattern` (`pattern`),
+KEY `pricelist` (`pricelist`),
+KEY `reseller` (`reseller`),
+KEY `status` (`status`)
+);
+
+DROP TABLE IF EXISTS `pricelists`;
+CREATE TABLE pricelists (
+name CHAR(40) NOT NULL,
+markup INTEGER NOT NULL DEFAULT 0,
+inc INTEGER NOT NULL DEFAULT 0,
+status INTEGER DEFAULT 1 NOT NULL,
+reseller CHAR(50) default NULL,
+PRIMARY KEY (`name`)
+);
+
+DROP TABLE IF EXISTS `callingcardbrands`;
+CREATE TABLE callingcardbrands (
+name CHAR(40) NOT NULL,
+reseller CHAR(40) NOT NULL DEFAULT '',
+language CHAR(10) NOT NULL DEFAULT '',
+pricelist CHAR(40) NOT NULL DEFAULT '',
+status INTEGER DEFAULT 1 NOT NULL,
+validfordays CHAR(4) NOT NULL DEFAULT '',
+pin INTEGER NOT NULL DEFAULT 0,
+maint_fee_pennies INTEGER NOT NULL DEFAULT 0,
+maint_fee_days INTEGER NOT NULL DEFAULT 0,
+disconnect_fee_pennies INTEGER NOT NULL DEFAULT 0,
+minute_fee_minutes INTEGER NOT NULL DEFAULT 0,
+minute_fee_pennies INTEGER NOT NULL DEFAULT 0,
+min_length_minutes INTEGER NOT NULL DEFAULT 0,
+min_length_pennies INTEGER NOT NULL DEFAULT 0,
+PRIMARY KEY (`name`),
+ KEY `reseller` (`reseller`),
+ KEY `pricelist` (`pricelist`)
+);
+
+DROP TABLE IF EXISTS `callingcardcdrs`;
+CREATE TABLE callingcardcdrs (
+id INTEGER NOT NULL AUTO_INCREMENT,
+cardnumber CHAR(50) NOT NULL DEFAULT '',
+clid CHAR(80) NOT NULL DEFAULT '',
+destination CHAR(40) NOT NULL DEFAULT '',
+disposition CHAR(20)NOT NULL DEFAULT '',
+callstart CHAR(40) NOT NULL DEFAULT '',
+seconds INTEGER NOT NULL DEFAULT 0,
+debit DECIMAL(20,6) NOT NULL DEFAULT 0.00000,
+credit DECIMAL(20,6) NOT NULL DEFAULT 0.00000,
+status INTEGER DEFAULT 0 NOT NULL,
+uniqueid VARCHAR(60) NOT NULL DEFAULT '',
+notes CHAR(80) NOT NULL DEFAULT '',
+pricelist CHAR(80) NOT NULL DEFAULT '',
+pattern CHAR(80) NOT NULL DEFAULT '',
+ PRIMARY KEY (`id`),
+ KEY `cardnumber` (`cardnumber`)
+);
+
+DROP TABLE IF EXISTS `trunks`;
+CREATE TABLE trunks (
+name VARCHAR(30) NOT NULL,
+tech CHAR(10) NOT NULL DEFAULT '',
+path CHAR(40) NOT NULL DEFAULT '',
+provider CHAR(100) NOT NULL DEFAULT '',
+status INTEGER DEFAULT 1 NOT NULL,
+dialed_modify TEXT NOT NULL DEFAULT '',
+resellers TEXT NOT NULL DEFAULT '',
+precedence INT(4) NOT NULL DEFAULT 0,
+maxchannels INTEGER DEFAULT 0 NOT NULL,
+ PRIMARY KEY (`name`),
+ KEY `provider` (`provider`),
+ KEY `provider_2` (`provider`)
+);
+
+DROP TABLE IF EXISTS `outbound_routes`;
+CREATE TABLE outbound_routes (
+pattern CHAR(40),
+id INTEGER NOT NULL AUTO_INCREMENT,
+comment CHAR(80) NOT NULL DEFAULT '',
+connectcost INTEGER NOT NULL DEFAULT 0,
+includedseconds INTEGER NOT NULL DEFAULT 0,
+cost INTEGER NOT NULL DEFAULT 0,
+trunk CHAR(80) NOT NULL DEFAULT '',
+inc CHAR(10) NOT NULL DEFAULT '',
+strip CHAR(40) NOT NULL DEFAULT '',
+prepend CHAR(40) NOT NULL DEFAULT '',
+precedence INT(4) NOT NULL DEFAULT 0,
+resellers TEXT NOT NULL DEFAULT '',
+status INTEGER DEFAULT 1 NOT NULL,
+PRIMARY KEY (`id`),
+ KEY `trunk` (`trunk`),
+ KEY `pattern` (`pattern`)
+);
+
+DROP TABLE IF EXISTS `dids`;
+CREATE TABLE dids (
+number CHAR(40) NOT NULL,
+account CHAR(50) NOT NULL DEFAULT '',
+connectcost INTEGER NOT NULL DEFAULT 0,
+includedseconds INTEGER NOT NULL DEFAULT 0,
+monthlycost INTEGER NOT NULL DEFAULT 0,
+cost INTEGER NOT NULL DEFAULT 0,
+inc CHAR(10) NOT NULL DEFAULT '',
+extensions CHAR(180) NOT NULL DEFAULT '',
+status INTEGER DEFAULT 1 NOT NULL,
+provider CHAR(40) NOT NULL DEFAULT '',
+country CHAR (80)NOT NULL DEFAULT '',
+province CHAR (80) NOT NULL DEFAULT '',
+city CHAR (80) NOT NULL DEFAULT '',
+prorate int(1) NOT NULL default 0,
+setup int(11) NOT NULL default 0,
+limittime int(1) NOT NULL default 1,
+disconnectionfee INT(11) NOT NULL default 0,
+variables TEXT NOT NULL DEFAULT '',
+options varchar(40) default NULL,
+maxchannels int(4) NOT NULL default 0,
+chargeonallocation int(1) NOT NULL default 1,
+allocation_bill_status int(1) NOT NULL default 0,
+dial_as CHAR(40) NOT NULL DEFAULT '',
+PRIMARY KEY (`number`),
+ KEY `account` (`account`)
+);
+
+DROP TABLE IF EXISTS `accounts`;
+CREATE TABLE accounts (
+accountid INTEGER NOT NULL AUTO_INCREMENT,
+cc CHAR(20) NOT NULL DEFAULT '',
+number CHAR(50) NOT NULL,
+reseller CHAR(40) NOT NULL DEFAULT '',
+pricelist CHAR(24) NOT NULL DEFAULT '',
+status INTEGER DEFAULT 1 NOT NULL,
+credit INTEGER NOT NULL DEFAULT 0,
+sweep INTEGER NOT NULL DEFAULT 0,
+creation TIMESTAMP NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
+pin INTEGER NOT NULL DEFAULT 0,
+credit_limit INTEGER NOT NULL DEFAULT 0,
+posttoexternal INTEGER NOT NULL DEFAULT 0,
+balance DECIMAL(20,6) NOT NULL DEFAULT 0,
+password CHAR(80) NOT NULL DEFAULT '',
+first_name CHAR(40) NOT NULL DEFAULT '',
+middle_name CHAR(40) NOT NULL DEFAULT '',
+last_name CHAR(40) NOT NULL DEFAULT '',
+company_name CHAR(40) NOT NULL DEFAULT '',
+address_1 CHAR(80) NOT NULL DEFAULT '',
+address_2 CHAR(80) NOT NULL DEFAULT '',
+address_3 CHAR(80) NOT NULL DEFAULT '',
+postal_code CHAR(12) NOT NULL DEFAULT '',
+province CHAR(40) NOT NULL DEFAULT '',
+city CHAR(80) NOT NULL DEFAULT '',
+country CHAR(40) NOT NULL DEFAULT '',
+telephone_1 CHAR(40) NOT NULL DEFAULT '',
+telephone_2 CHAR(40) NOT NULL DEFAULT '',
+fascimile CHAR(40) NOT NULL DEFAULT '',
+email CHAR(80) NOT NULL DEFAULT '',
+language CHAR(2) NOT NULL DEFAULT '',
+currency CHAR(3) NOT NULL DEFAULT '',
+maxchannels INTEGER DEFAULT 1 NOT NULL,
+routing_technique INT(4) NOT NULL DEFAULT 0,
+dialed_modify TEXT NOT NULL DEFAULT '',
+type INTEGER DEFAULT 0,
+tz CHAR(40) NOT NULL DEFAULT '',
+PRIMARY KEY (`accountid`),
+ KEY `number` (`number`),
+ KEY `pricelist` (`pricelist`),
+ KEY `reseller` (`reseller`)
+);
+
+DROP TABLE IF EXISTS `counters`;
+CREATE TABLE counters (
+id INTEGER NOT NULL AUTO_INCREMENT,
+package CHAR(40) NOT NULL DEFAULT '',
+account VARCHAR(50) NOT NULL,
+seconds INTEGER NOT NULL DEFAULT 0,
+status INTEGER NOT NULL DEFAULT 1,
+PRIMARY KEY (`id`)
+);
+
+DROP TABLE IF EXISTS `callingcards`;
+CREATE TABLE callingcards (
+id INTEGER NOT NULL AUTO_INCREMENT,
+cardnumber CHAR(20) NOT NULL DEFAULT '',
+language CHAR(10) NOT NULL DEFAULT '',
+value INTEGER NOT NULL DEFAULT 0,
+used INTEGER NOT NULL DEFAULT 0,
+brand VARCHAR(20) NOT NULL DEFAULT '',
+created DATETIME,
+firstused DATETIME,
+expiry DATETIME,
+validfordays CHAR(4) NOT NULL DEFAULT '',
+inuse INTEGER NOT NULL DEFAULT 0,
+pin CHAR(20),
+account VARCHAR(50) NOT NULL DEFAULT '',
+maint_fee_pennies INTEGER NOT NULL DEFAULT 0,
+maint_fee_days INTEGER NOT NULL DEFAULT 0,
+maint_day INTEGER NOT NULL DEFAULT 0,
+disconnect_fee_pennies INTEGER NOT NULL DEFAULT 0,
+minute_fee_minutes INTEGER NOT NULL DEFAULT 0,
+minute_fee_pennies INTEGER NOT NULL DEFAULT 0,
+min_length_minutes INTEGER NOT NULL DEFAULT 0,
+min_length_pennies INTEGER NOT NULL DEFAULT 0,
+timeused INTEGER NOT NULL DEFAULT 0,
+invoice CHAR(20) NOT NULL DEFAULT 0,
+status INTEGER DEFAULT 1 NOT NULL,
+PRIMARY KEY (`id`),
+ KEY `brand` (`brand`)
+);
+
+CREATE TABLE charge_to_account (
+id INTEGER NOT NULL AUTO_INCREMENT,
+charge_id INTEGER NOT NULL DEFAULT 0,
+cardnum CHAR(50) NOT NULL DEFAULT '',
+status INTEGER NOT NULL DEFAULT 1,
+PRIMARY KEY (`id`)
+);
+
+CREATE TABLE queue_list (
+id INTEGER NOT NULL AUTO_INCREMENT,
+queue_id INTEGER NOT NULL DEFAULT 0,
+cardnum CHAR(20) NOT NULL DEFAULT '',
+PRIMARY KEY (`id`)
+);
+
+CREATE TABLE pbx_list (
+id INTEGER NOT NULL AUTO_INCREMENT,
+pbx_id INTEGER NOT NULL DEFAULT 0,
+cardnum CHAR(20) NOT NULL DEFAULT '',
+PRIMARY KEY (`id`)
+);
+
+CREATE TABLE extension_list (
+id INTEGER NOT NULL AUTO_INCREMENT,
+extension_id INTEGER NOT NULL DEFAULT 0,
+cardnum CHAR(20) NOT NULL DEFAULT '',
+PRIMARY KEY (`id`)
+);
+
+CREATE TABLE cdrs (
+id INTEGER NOT NULL AUTO_INCREMENT,
+uniqueid varchar(60) NOT NULL DEFAULT '',
+cardnum CHAR(50),
+callerid CHAR(80),
+callednum varchar(80) NOT NULL DEFAULT '',
+billseconds INT DEFAULT 0 NOT NULL,
+trunk VARCHAR(30),
+disposition varchar(45) NOT NULL DEFAULT '',
+callstart varchar(80) NOT NULL DEFAULT '',
+debit DECIMAL (20,6) NOT NULL DEFAULT 0,
+credit DECIMAL (20,6) NOT NULL DEFAULT 0,
+status INTEGER DEFAULT 0 NOT NULL,
+notes CHAR(80),
+provider CHAR(50),
+cost DECIMAL(20,6) NOT NULL DEFAULT 0,
+pricelist CHAR(80) NOT NULL DEFAULT '',
+pattern CHAR(80) NOT NULL DEFAULT '',
+type tinyint(1) NOT NULL default '1',
+invoiceid INT(11) DEFAULT 0 NOT NULL,
+PRIMARY KEY (`id`),
+ KEY `cardnum` (`cardnum`),
+ KEY `provider` (`provider`),
+ KEY `trunk` (`trunk`),
+ KEY `uniqueid` (`uniqueid`),
+ KEY `status` (`status`)
+);
+
+CREATE TABLE packages (
+id INTEGER NOT NULL AUTO_INCREMENT,
+name CHAR(40) NOT NULL DEFAULT '',
+pricelist CHAR(40) NOT NULL DEFAULT '',
+pattern CHAR(40) NOT NULL DEFAULT '',
+includedseconds INTEGER NOT NULL DEFAULT 0,
+reseller VARCHAR(50) NOT NULL DEFAULT '',
+status INTEGER DEFAULT 1 NOT NULL,
+PRIMARY KEY (`id`),
+ KEY `pricelist` (`pricelist`),
+ KEY `reseller` (`reseller`)
+);
+
+CREATE TABLE ani_map (
+number char(20) NOT NULL,
+account char(50) NOT NULL default '',
+status int(11) NOT NULL default '0',
+context varchar(20) NOT NULL,
+ PRIMARY KEY (`number`),
+KEY `account` (`account`)
+);
+
+CREATE TABLE `ip_map` (
+ip char(15) NOT NULL default '',
+account char(20) NOT NULL default '',
+prefix varchar(20) NULL,
+context varchar(20) NOT NULL,
+PRIMARY KEY (`ip`,`prefix`),
+KEY `account` (`account`)
+);
+
+CREATE TABLE charges (
+id INTEGER NOT NULL AUTO_INCREMENT,
+pricelist CHAR(40) NOT NULL DEFAULT '',
+description VARCHAR(80) NOT NULL DEFAULT '',
+charge INTEGER NOT NULL DEFAULT 0,
+sweep INTEGER NOT NULL DEFAULT 0,
+reseller CHAR(40) NOT NULL DEFAULT '',
+status INTEGER NOT NULL DEFAULT 1,
+PRIMARY KEY (`id`),
+ KEY `pricelist` (`pricelist`)
+);
+
+CREATE TABLE manager_action_variables (
+id INTEGER NOT NULL AUTO_INCREMENT,
+name CHAR(60) NOT NULL DEFAULT '',
+value CHAR(60) NOT NULL DEFAULT '',
+PRIMARY KEY (`id`)
+);
+
+CREATE TABLE callingcard_stats (
+uniqueid VARCHAR(60) NOT NULL,
+total_time VARCHAR(48) NOT NULL,
+billable_time VARCHAR(48) NOT NULL,
+timestamp DATETIME NULL,
+PRIMARY KEY (`uniqueid`)
+);
+
+CREATE TABLE system (
+id INTEGER NOT NULL AUTO_INCREMENT,
+name VARCHAR(48) NULL,
+value VARCHAR(255) NULL,
+comment VARCHAR(255) NULL,
+timestamp DATETIME NULL,
+reseller VARCHAR(48) NULL,
+brand VARCHAR(48) NULL,
+PRIMARY KEY (`id`),
+ KEY (`name`),
+ KEY `reseller` (`reseller`),
+ KEY `brand` (`brand`)
+);
+
+
+INSERT INTO system (name, value, comment) VALUES (
+'log_file','/var/log/astpp/astpp.log','Where do I log to?');
+
+INSERT INTO system (name, value, comment) VALUES (
+'callout_accountcode','admin','Call Files: What accountcode should we use?');
+
+INSERT INTO system (name, value, comment) VALUES (
+'lcrcontext','astpp-outgoing','This is the Local context we use to route our outgoing calls through esp for callbacks');
+
+INSERT INTO system (name, value, comment) VALUES (
+'maxretries','3','Call Files: How many times do we retry?');
+
+INSERT INTO system (name, value, comment) VALUES (
+'retrytime','30','Call Files: How long do we wait between retries?');
+
+INSERT INTO system (name, value, comment) VALUES (
+'waittime','15','Call Files: How long do we wait before the initial call?');
+
+INSERT INTO system (name, value, comment) VALUES (
+'clidname','Private','Call Files: Outgoing CallerID Name');
+
+INSERT INTO system (name, value, comment) VALUES (
+'clidnumber','0000000000','Call Files: Outgoing CallerID Number');
+
+INSERT INTO system (name, value, comment) VALUES (
+'callingcards_callback_context','astpp-callingcards','Call Files: For callingcards what context do we end up in?');
+
+INSERT INTO system (name, value, comment) VALUES (
+'callingcards_callback_extension', 's','Call Files: For callingcards what extension do we use?');
+
+INSERT INTO system (name, value, comment) VALUES (
+'openser_dbengine', 'MySQL','For now this must be MySQL');
+
+INSERT INTO system (name, value, comment) VALUES (
+'openser', '0','Use OPENSER? 1 for yes or 0 for no');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'openser_dbname', 'openser','OPENSER Database Name', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'openser_dbuser', 'root','OPENSER Database User', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'openser_dbhost', 'localhost','OPENSER Database Host', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'openser_dbpass', 'Passw0rd','OPENSER Database Password', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'openser_domain', NULL,'OPENSER Domain', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'company_email', 'em...@as...','Email address that email should appear to be from', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'asterisk_dir', '/etc/asterisk','Which directory are asterisk configuration files stored in?', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'company_website', 'http://www.astpp.org','Link to your company website', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'company_name', 'ASTPP.ORG','The name of your company. Used in emails.', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'email', '1','Send out email? 0=no 1=yes', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'user_email', '1','Email user on account changes? 0=no 1=yes', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'debug', '1','Enable debugging output? 0=no 1=yes', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'emailadd', 'em...@as...','Administrator email address', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'startingdigit', '0','The digit that all calling cards must start with. 0=disabled', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'enablelcr', '1','Use least cost routing 0=no 1=yes', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'log_file', '/var/log/astpp/astpp.log','ASTPP Log file', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'key_home', 'http://www.astpp.org/astpp.pub','Asterisk RSA Key location (optional)', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'rate_engine_csv_file', '/var/log/astpp/astpp.csv','CSV File for call rating data', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'csv_dir', '/var/log/astpp/','CSV File Directory', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'default_brand', 'default','Default pricelist. If a price is not found in the customers pricelist we check this one.', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'new_user_brand', 'default','What is the default pricelist for new customers?', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'default_context', 'custom-astpp','What is the default context for new devices?', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'cardlength', '10','Number of digits in calling cards and cc codes.', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'asterisk_server', 'voip.astpp.org','Your default voip server. Used in outgoing email.', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'currency', 'CAD','Name of the currency you use', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'iax_port', '4569','Default IAX2 Port', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'sip_port', '5060','Default SIP Port', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'ipaddr', 'dynamic','Default IP Address for new devices', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'key', 'astpp.pub','Asterisk RSA Key Name (Optional)', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'pinlength', '6','For those calling cards that are using pins this is the number of digits it will have.', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'credit_limit', '0','Default credit limit in dollars.', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'decimalpoints', '4','How many decimal points do we bill to?', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'decimalpoints_tax', '2','How many decimal points do we calculate taxes to?', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'decimalpoints_total', '2','How many decimal points do we calculate totals to?', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'max_free_length', '100','What is the maximum length (in minutes) of calls that are at no charge?', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'trackvendorcharges', '0','Do we track the amount of money we spend with specific providers? 0=no 1=yes', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'company_logo', 'http://www.astpp.org/logo.png','The location of our company logo.', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'company_slogan', 'Welcome to ASTPP','Company slogan', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'version', '1.5Beta', 'ASTPP Version', '');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'default_language', 'en', 'Default ASTPP Language','');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'card_retries','3', 'How many retries do we allow for calling card numbers?','');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'pin_retries','3', 'How many retries do we allow for pins?','');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'number_retries','3','How many retries do we allow calling card users when dialing a number?','');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'booth_context','callshop_booth','Please enter the default context for a callshop booth.','');
+
+INSERT INTO system (name, value, comment, timestamp) VALUES (
+'callingcards_max_length','9000','What is the maximum length (in ms) of a callingcard call?','');
+
+INSERT INTO system (name,value,comment,timestamp) VALUES ...
[truncated message content] |
|
From: <dar...@us...> - 2010-03-06 02:30:00
|
Revision: 2311
http://astpp.svn.sourceforge.net/astpp/?rev=2311&view=rev
Author: darrenkw
Date: 2010-03-06 02:29:53 +0000 (Sat, 06 Mar 2010)
Log Message:
-----------
Added sounds for Freeswitch.
Modified Paths:
--------------
trunk/Makefile
Added Paths:
-----------
trunk/sounds/GSM/
trunk/sounds/GSM/astcc-badphone.GSM
trunk/sounds/GSM/astpp-accountnum.GSM
trunk/sounds/GSM/astpp-badaccount.GSM
trunk/sounds/GSM/astpp-badphone.GSM
trunk/sounds/GSM/astpp-busy-tryagain.GSM
trunk/sounds/GSM/astpp-call-completed.GSM
trunk/sounds/GSM/astpp-callingcard-menu.GSM
trunk/sounds/GSM/astpp-card-has-expired.GSM
trunk/sounds/GSM/astpp-card-is-empty.GSM
trunk/sounds/GSM/astpp-card-to-empty.GSM
trunk/sounds/GSM/astpp-card-to-refill.GSM
trunk/sounds/GSM/astpp-cent.GSM
trunk/sounds/GSM/astpp-cents.GSM
trunk/sounds/GSM/astpp-congested-tryagain.GSM
trunk/sounds/GSM/astpp-connectcharge.GSM
trunk/sounds/GSM/astpp-dollar.GSM
trunk/sounds/GSM/astpp-dollars.GSM
trunk/sounds/GSM/astpp-down.GSM
trunk/sounds/GSM/astpp-in-use.GSM
trunk/sounds/GSM/astpp-invalidpin.GSM
trunk/sounds/GSM/astpp-menu.GSM
trunk/sounds/GSM/astpp-minute.GSM
trunk/sounds/GSM/astpp-no-enough-credit.GSM
trunk/sounds/GSM/astpp-noanswer-tryagain.GSM
trunk/sounds/GSM/astpp-not-enough-money.GSM
trunk/sounds/GSM/astpp-per.GSM
trunk/sounds/GSM/astpp-phonenum.GSM
trunk/sounds/GSM/astpp-please-wait-while-i-connect.GSM
trunk/sounds/GSM/astpp-pleasepin.GSM
trunk/sounds/GSM/astpp-second.GSM
trunk/sounds/GSM/astpp-seconds.GSM
trunk/sounds/GSM/astpp-this-call-will-last.GSM
trunk/sounds/GSM/astpp-this-card-has-a-balance-of.GSM
trunk/sounds/GSM/astpp-will-apply.GSM
trunk/sounds/GSM/astpp-willcost.GSM
trunk/sounds/GSM/cent.GSM
trunk/sounds/GSM/is-suspended.GSM
trunk/sounds/GSM/of-local-credit.GSM
trunk/sounds/GSM/of-longdistance-credit.GSM
trunk/sounds/GSM/per.GSM
trunk/sounds/GSM/please-wait-while-i-connect.GSM
trunk/sounds/GSM/press_one_if_you_wish.GSM
trunk/sounds/GSM/this-call-will-last.GSM
trunk/sounds/GSM/this-card-has-a-balance-of.GSM
trunk/sounds/wav/
trunk/sounds/wav/astcc-badphone.wav
trunk/sounds/wav/astpp-accountnum.wav
trunk/sounds/wav/astpp-badaccount.wav
trunk/sounds/wav/astpp-badphone.wav
trunk/sounds/wav/astpp-busy-tryagain.wav
trunk/sounds/wav/astpp-call-completed.wav
trunk/sounds/wav/astpp-callingcard-menu.wav
trunk/sounds/wav/astpp-card-has-expired.wav
trunk/sounds/wav/astpp-card-is-empty.wav
trunk/sounds/wav/astpp-card-to-empty.wav
trunk/sounds/wav/astpp-card-to-refill.wav
trunk/sounds/wav/astpp-cent.wav
trunk/sounds/wav/astpp-cents.wav
trunk/sounds/wav/astpp-congested-tryagain.wav
trunk/sounds/wav/astpp-connectcharge.wav
trunk/sounds/wav/astpp-dollar.wav
trunk/sounds/wav/astpp-dollars.wav
trunk/sounds/wav/astpp-down.wav
trunk/sounds/wav/astpp-in-use.wav
trunk/sounds/wav/astpp-invalidpin.wav
trunk/sounds/wav/astpp-menu.wav
trunk/sounds/wav/astpp-minute.wav
trunk/sounds/wav/astpp-noanswer-tryagain.wav
trunk/sounds/wav/astpp-not-enough-credit.wav
trunk/sounds/wav/astpp-not-enough-money.wav
trunk/sounds/wav/astpp-per.wav
trunk/sounds/wav/astpp-phonenum.wav
trunk/sounds/wav/astpp-please-wait-while-i-connect.wav
trunk/sounds/wav/astpp-pleasepin.wav
trunk/sounds/wav/astpp-second.wav
trunk/sounds/wav/astpp-seconds.wav
trunk/sounds/wav/astpp-this-call-will-last.wav
trunk/sounds/wav/astpp-this-card-has-a-balance-of.gsm
trunk/sounds/wav/astpp-this-card-has-a-balance-of.wav
trunk/sounds/wav/astpp-willapply.wav
trunk/sounds/wav/astpp-willcost.wav
trunk/sounds/wav/cent.wav
trunk/sounds/wav/is-suspended.wav
trunk/sounds/wav/of-local-credit.wav
trunk/sounds/wav/of-longdistance-credit.wav
trunk/sounds/wav/per.wav
trunk/sounds/wav/please-wait-while-i-connect.wav
trunk/sounds/wav/press_one_if_you_wish.wav
trunk/sounds/wav/this-call-will-last.wav
trunk/sounds/wav/this-card-has-a-balance-of.wav
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2010-02-27 03:56:44 UTC (rev 2310)
+++ trunk/Makefile 2010-03-06 02:29:53 UTC (rev 2311)
@@ -92,10 +92,14 @@
done
install_sounds_freeswitch:
- for x in sounds/*.gsm; do \
+ for x in sounds/GSM/*.GSM; do \
echo $$x;\
install -m 644 $$x $(DESTDIR)$(FS_SOUNDSDIR); \
done
+ for x in sounds/wav/*.wav; do \
+ echo $$x;\
+ install -m 644 $$x $(DESTDIR)$(FS_SOUNDSDIR); \
+ done
install_templates:
Added: trunk/sounds/GSM/astcc-badphone.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astcc-badphone.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-accountnum.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-accountnum.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-badaccount.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-badaccount.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-badphone.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-badphone.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-busy-tryagain.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-busy-tryagain.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-call-completed.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-call-completed.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-callingcard-menu.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-callingcard-menu.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-card-has-expired.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-card-has-expired.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-card-is-empty.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-card-is-empty.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-card-to-empty.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-card-to-empty.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-card-to-refill.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-card-to-refill.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-cent.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-cent.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-cents.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-cents.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-congested-tryagain.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-congested-tryagain.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-connectcharge.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-connectcharge.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-dollar.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-dollar.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-dollars.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-dollars.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-down.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-down.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-in-use.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-in-use.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-invalidpin.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-invalidpin.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-menu.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-menu.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-minute.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-minute.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-no-enough-credit.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-no-enough-credit.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-noanswer-tryagain.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-noanswer-tryagain.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-not-enough-money.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-not-enough-money.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-per.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-per.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-phonenum.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-phonenum.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-please-wait-while-i-connect.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-please-wait-while-i-connect.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-pleasepin.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-pleasepin.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-second.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-second.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-seconds.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-seconds.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-this-call-will-last.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-this-call-will-last.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-this-card-has-a-balance-of.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-this-card-has-a-balance-of.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-will-apply.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-will-apply.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/astpp-willcost.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/astpp-willcost.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/cent.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/cent.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/is-suspended.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/is-suspended.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/of-local-credit.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/of-local-credit.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/of-longdistance-credit.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/of-longdistance-credit.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/per.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/per.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/please-wait-while-i-connect.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/please-wait-while-i-connect.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/press_one_if_you_wish.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/press_one_if_you_wish.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/this-call-will-last.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/this-call-will-last.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/GSM/this-card-has-a-balance-of.GSM
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/GSM/this-card-has-a-balance-of.GSM
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astcc-badphone.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astcc-badphone.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-accountnum.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-accountnum.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-badaccount.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-badaccount.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-badphone.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-badphone.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-busy-tryagain.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-busy-tryagain.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-call-completed.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-call-completed.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-callingcard-menu.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-callingcard-menu.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-card-has-expired.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-card-has-expired.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-card-is-empty.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-card-is-empty.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-card-to-empty.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-card-to-empty.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-card-to-refill.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-card-to-refill.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-cent.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-cent.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-cents.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-cents.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-congested-tryagain.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-congested-tryagain.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-connectcharge.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-connectcharge.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-dollar.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-dollar.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-dollars.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-dollars.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-down.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-down.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-in-use.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-in-use.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-invalidpin.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-invalidpin.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-menu.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-menu.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-minute.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-minute.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-noanswer-tryagain.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-noanswer-tryagain.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-not-enough-credit.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-not-enough-credit.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-not-enough-money.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-not-enough-money.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-per.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-per.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-phonenum.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-phonenum.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-please-wait-while-i-connect.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-please-wait-while-i-connect.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-pleasepin.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-pleasepin.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-second.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-second.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-seconds.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-seconds.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-this-call-will-last.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-this-call-will-last.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-this-card-has-a-balance-of.gsm
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-this-card-has-a-balance-of.gsm
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-this-card-has-a-balance-of.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-this-card-has-a-balance-of.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-willapply.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-willapply.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/astpp-willcost.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/astpp-willcost.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/sounds/wav/cent.wav
===================================================================
(Binary files differ)
Property changes on: trunk/sounds/wav/cent.wav
___...
[truncated message content] |
|
From: <dar...@us...> - 2010-09-01 03:26:07
|
Revision: 2315
http://astpp.svn.sourceforge.net/astpp/?rev=2315&view=rev
Author: darrenkw
Date: 2010-09-01 03:26:00 +0000 (Wed, 01 Sep 2010)
Log Message:
-----------
Fix a few more issues. Makefile was installing files in wrong location.
Modified Paths:
--------------
trunk/Makefile
trunk/freeswitch/astpp-callingcards.pl
trunk/modules/ASTPP/lib/ASTPP.pm
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2010-09-01 01:25:12 UTC (rev 2314)
+++ trunk/Makefile 2010-09-01 03:26:00 UTC (rev 2315)
@@ -92,7 +92,7 @@
done
install_sounds_freeswitch:
- for x in sounds/GSM/*.GSM; do \
+ for x in sounds/gsm/*.gsm; do \
echo $$x;\
install -m 644 $$x $(DESTDIR)$(FS_SOUNDSDIR); \
done
Modified: trunk/freeswitch/astpp-callingcards.pl
===================================================================
--- trunk/freeswitch/astpp-callingcards.pl 2010-09-01 01:25:12 UTC (rev 2314)
+++ trunk/freeswitch/astpp-callingcards.pl 2010-09-01 03:26:00 UTC (rev 2315)
@@ -9,7 +9,7 @@
# This program is Free Software and is distributed under the
# terms of the GNU General Public License version 2.
#############################################################################
-use DBI;
+#use DBI;
use POSIX qw(ceil floor);
use POSIX qw(strftime);
use Time::HiRes qw( gettimeofday tv_interval );
@@ -47,7 +47,7 @@
}
$cdr_db = &cdr_connect_db( $config, @output );
$ASTPP->set_cdr_db($cdr_db);
- $sound = &define_sounds($astpp_db,$config->{freeswitch_sound_files});
+ $sound = &define_sounds($astpp_db);
}
sub set_in_use()
@@ -228,7 +228,7 @@
);
}
elsif ( $cc == 1 ) {
- $balance = $ASTPP->accountbalance( $cardinfo->{number} );
+ $balance = &accountbalance( $astpp_db, $cardinfo->{number} );
$balance = ( $balance * -1 ) + ( $cardinfo->{credit_limit} );
$available = ( $balance - $numberinfo->{connectfee} ) / 100;
}
@@ -428,12 +428,13 @@
trunk_name => $route->{trunk}
);
my ( $dialedtime, $uniqueid, $answeredtime, $clid );
+ $session->execute( "export", "CALLINGCARDS=1" );
if ( $cc == 1 ) {
- $session->execute( "export", "accountcode=$cardinfo->{number}" );
+ $session->execute( "export", "ACCOUNTCODE=CC:$cardinfo->{number}" );
}
else {
$session->execute( "export",
- "callingcard=$cardinfo->{cardnumber}" );
+ "ACCOUNTCODE=CC:$cardinfo->{cardnumber}" );
}
$session->execute( "bridge", "$data_string" );
return 1;
@@ -471,13 +472,11 @@
$session->execute( "export", "NEWCALL=1" );
$session->execute( "export", "DESTINATION=$stats{destination}" );
&exit_program();
- return 1;
}
elsif ( $whatnow == 2 ) {
$session->execute( "export", "NEWCALL=1" );
$session->execute( "export", "DESTINATION=" );
&exit_program();
- return 1;
}
elsif ( $whatnow == 3 ) {
$session->streamFile( $sound->{goodbye} );
@@ -501,8 +500,7 @@
. $astpp_db->quote( $stats{answered_time} )
. ")" );
$stats{total_time} = tv_interval( $stats{start_time} );
-# exit(1);
- return 1;
+ return 1;
}
sub print_console() #Dump string to the console
@@ -586,9 +584,8 @@
}
if ( $cardinfo->{status} != 1 ) {
$session->streamFile( $sound->{goodbye} );
- $session->hangup();
-# exit(1);
- return 1;
+# $session->hangup();
+ return 1;
}
}
@@ -609,8 +606,7 @@
if ( $pin != $cardinfo->{pin} ) {
$session->streamFile( $sound->{pin_incorrect} );
$session->streamFile( $sound->{goodbye} );
-# exit(1);
- return 1;
+ return 1;
}
}
&check_card($cardinfo) if $cc == 0;
@@ -661,7 +657,7 @@
if ( !$numberinfo->{pattern} ) {
$session->streamFile( $sound->{destination_incorrect} );
$session->streamFile( $sound->{goodbye} );
- $session->hangup();
+# $session->hangup();
&leave($cardinfo);
}
@@ -678,4 +674,3 @@
);
1;
-
Modified: trunk/modules/ASTPP/lib/ASTPP.pm
===================================================================
--- trunk/modules/ASTPP/lib/ASTPP.pm 2010-09-01 01:25:12 UTC (rev 2314)
+++ trunk/modules/ASTPP/lib/ASTPP.pm 2010-09-01 03:26:00 UTC (rev 2315)
@@ -803,7 +803,8 @@
$arg{xml} .= "</user>\n";
}
}
- my ($count,@ip_users) = &ip_address_authenticate($self,%arg);
+ my @ip_users;
+ ($count,@ip_users) = &ip_address_authenticate($self,%arg);
print STDERR "COUNT: $count\n";
if ($count > 0) {
foreach my $record (@ip_users) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dar...@us...> - 2010-09-13 23:25:13
|
Revision: 2318
http://astpp.svn.sourceforge.net/astpp/?rev=2318&view=rev
Author: darrenkw
Date: 2010-09-13 23:25:06 +0000 (Mon, 13 Sep 2010)
Log Message:
-----------
Added support to view callingcard cdrs from the interface.
Modified Paths:
--------------
trunk/web_interface/astpp-admin.cgi
Added Paths:
-----------
trunk/templates/callingcards-cdrs.tpl
Added: trunk/templates/callingcards-cdrs.tpl
===================================================================
--- trunk/templates/callingcards-cdrs.tpl (rev 0)
+++ trunk/templates/callingcards-cdrs.tpl 2010-09-13 23:25:06 UTC (rev 2318)
@@ -0,0 +1,43 @@
+<table class="viewcdrs">
+ <tr>
+ <td colspan=7><form method="post" action="/cgi-bin/astpp-admin/astpp-admin.cgi?mode=List%20Errors" enctype="multipart/form-data"></td>
+ </tr>
+ <tr class="header">
+ <td>Card Number</td>
+ <td>UniqueID</td>
+ <td>Date</td>
+ <td>CallerID</td>
+ <td>Dest</td>
+ <td>BillSec</td>
+ <td>Disposition</td>
+ <td>Debit</td>
+ <td>Credit</td>
+ <td>Notes</td>
+ <td>Pricelist</td>
+ <td>Pattern</td>
+ </tr>
+ <TMPL_LOOP NAME="cdrlist">
+ <tr class="<TMPL_VAR NAME="class">">
+ <td><TMPL_VAR NAME="cardnumber"></td>
+ <td><TMPL_VAR NAME="uniqueid"></td>
+ <td><TMPL_VAR NAME="callstart"></td>
+ <td><TMPL_VAR NAME="clid"></td>
+ <td><TMPL_VAR NAME="destination"></td>
+ <td><TMPL_VAR NAME="seconds"></td>
+ <td><TMPL_VAR NAME="disposition"></td>
+ <td><TMPL_VAR NAME="debit"></td>
+ <td><TMPL_VAR NAME="credit"></td>
+ <td><TMPL_VAR NAME="notes"></td>
+ <td><TMPL_VAR NAME="pricelist"></td>
+ <td><TMPL_VAR NAME="pattern"></td>
+ </tr>
+ </TMPL_LOOP>
+</table>
+
+<table>
+ <tr>
+ <td><TMPL_VAR NAME="pagination"></td>
+ <td><TMPL_VAR NAME="status"></td>
+ </tr>
+ </table>
+</form>
Modified: trunk/web_interface/astpp-admin.cgi
===================================================================
--- trunk/web_interface/astpp-admin.cgi 2010-09-13 04:14:22 UTC (rev 2317)
+++ trunk/web_interface/astpp-admin.cgi 2010-09-13 23:25:06 UTC (rev 2318)
@@ -99,7 +99,8 @@
gettext("List Cards"), gettext("Add Cards"),
gettext("Delete Card"), gettext("Refill Card"),
gettext("View Card"), gettext("Update Card(s) Status"),
- gettext("Reset InUse"), gettext("CC Brands")
+ gettext("Reset InUse"), gettext("CC Brands"),
+ gettext("Callingcard CDRs")
);
my @SwitchConfig = ();
my @CallShops = ( gettext("Create CallShop"), gettext("Remove CallShop") );
@@ -445,6 +446,8 @@
return &build_view_card() if $params->{mode} eq gettext("View Card");
return &build_cc_brands()
if $params->{mode} eq gettext("CC Brands");
+ return &build_callingcard_cdrs()
+ if $params->{mode} eq gettext("Callingcard CDRs");
return &build_delete_cards()
if $params->{mode} eq gettext("Delete Card");
return &build_refill_card()
@@ -464,6 +467,8 @@
return &build_periodic_charges()
if $params->{mode} eq gettext("Periodic Charges");
return &build_view_cdrs() if $params->{mode} eq gettext("View CDRs");
+ return &build_view_cdrs_asterisk() if $params->{mode} eq gettext("View Asterisk(TM) CDRs");
+ return &build_view_cdrs_freeswitch() if $params->{mode} eq gettext("View FreeSwitch(TM) CDRs");
return &build_configuration()
if $params->{mode} eq gettext("Configuration");
return &build_view_invoice()
@@ -488,6 +493,8 @@
if $params->{mode} eq gettext("Trunk Statistics");
return &logout() if $params->{mode} eq gettext("Logout");
return &build_view_cdrs() if $params->{mode} eq gettext("View CDRs");
+ return &build_view_cdrs_asterisk() if $params->{mode} eq gettext("View Asterisk CDRs");
+ return &build_view_cdrs_freeswitch() if $params->{mode} eq gettext("View FreeSwitch CDRs");
return &build_outbound_routes()
if $params->{mode} eq gettext("Outbound Routes");
$params->{mode} = gettext("Home");
@@ -1356,6 +1363,15 @@
}
#################### Stats stuff ###########################
+sub build_view_cdrs_asterisk() {
+ return &build_view_cdrs();
+}
+
+sub build_view_cdrs_freeswitch() {
+ $config->{cdr_table} = $config->{freeswitch_cdr_table};
+ return &build_view_cdrs();
+}
+
sub build_view_cdrs() {
my (
@trunklist, $body, $id, $tmp,
@@ -4082,7 +4098,52 @@
}
### End of Code from convergence.com.pk
+sub build_callingcard_cdrs() {
+ my ( @cdrlist, $results, $body, $status, $count, $pageno, $pagesrequired );
+ $count = 0;
+ my $template = HTML::Template->new(
+ filename => '/var/lib/astpp/templates/callingcards-cdrs.tpl',
+ die_on_bad_params => $config->{template_die_on_bad_params}
+ );
+ my $sql_select =
+"SELECT * FROM callingcardcdrs ORDER BY callstart DESC";
+ my $sql_count =
+"SELECT COUNT(*) FROM callingcardcdrs";
+ my ( $sql, $pagination ) = $ASTPP->pagination(
+ sql_select => $sql_select,
+ sql_count => $sql_count,
+ results_per_page => $config->{results_per_page},
+ ve => $params->{ve},
+ te => $params->{ee},
+ db => $astpp_db,
+ mode => $params->{mode},
+ );
+
+ $ASTPP->debug( user => $params->{username}, debug => $sql );
+ $results = $astpp_db->prepare($sql);
+ $results->execute;
+
+ while ( my $record = $results->fetchrow_hashref ) {
+ $ASTPP->debug(
+ user => $params->{username},
+ debug => $record->{uniqueid}
+ );
+ $count++;
+ if ( $count % 2 == 0 ) {
+ $record->{class} = "rowtwo";
+ }
+ else {
+ $record->{class} = "rowone";
+ }
+ push( @cdrlist, $record );
+ }
+ $results->finish;
+ $template->param( cdrlist => \@cdrlist );
+ $template->param( pagination => $pagination );
+ return $template->output;
+}
+
sub build_list_errors() {
my ( @cdrlist, $results, $body, $status, $count, $pageno, $pagesrequired );
$cdr_db = &cdr_connect_db( $config, @output );
@@ -12062,9 +12123,15 @@
gettext("Asterisk(TM) SIP Devices"),
gettext("Asterisk(TM) Dialplan")
);
+ push @Statistics,(
+ gettext("View Asterisk(TM) CDRs")
+ );
}
if ( $config->{users_dids_freeswitch} == 1 ) {
push @SwitchConfig, ( gettext("Freeswitch(TM) SIP Devices") );
+ push @Statistics,(
+ gettext("View FreeSwitch(TM) CDRs")
+ );
}
}
if ( $config->{callingcards} == 1 ) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dar...@us...> - 2010-12-31 02:09:35
|
Revision: 2324
http://astpp.svn.sourceforge.net/astpp/?rev=2324&view=rev
Author: darrenkw
Date: 2010-12-31 02:09:29 +0000 (Fri, 31 Dec 2010)
Log Message:
-----------
Correct a couple of samples, fix spacing in ASTPP.pm, add perl modules to makefile.
Modified Paths:
--------------
trunk/Makefile
trunk/freeswitch/contrib/darren/conf/autoload_configs/acl.conf.xml
trunk/freeswitch/contrib/darren/conf/dialplan/default.xml
trunk/modules/ASTPP/lib/ASTPP.pm
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2010-12-30 02:47:26 UTC (rev 2323)
+++ trunk/Makefile 2010-12-31 02:09:29 UTC (rev 2324)
@@ -127,6 +127,7 @@
perl -MCPAN -e "install DBI";
perl -MCPAN -e "install DBD::mysql";
# perl -MCPAN -e "install DBD::Pg";
+ perl -MCPAN -e "install Params::Validate";
perl -MCPAN -e "install CGI";
perl -MCPAN -e "install Asterisk::AGI";
perl -MCPAN -e "install LWP::Simple";
@@ -140,7 +141,9 @@
perl -MCPAN -e "install Data::Paginate";
perl -MCPAN -e "install HTML::Template";
perl -MCPAN -e "install HTML::Template::Expr";
+ perl -MCPAN -e "install DateTime";
perl -MCPAN -e "install DateTime::TimeZone";
+ perl -MCPAN -e "install DateTime::Locale";
perl -MCPAN -e "install DateTime";
perl -MCPAN -e "install Locale::gettext_pp";
perl -MCPAN -e "install XML::Simple";
Modified: trunk/freeswitch/contrib/darren/conf/autoload_configs/acl.conf.xml
===================================================================
--- trunk/freeswitch/contrib/darren/conf/autoload_configs/acl.conf.xml 2010-12-30 02:47:26 UTC (rev 2323)
+++ trunk/freeswitch/contrib/darren/conf/autoload_configs/acl.conf.xml 2010-12-31 02:09:29 UTC (rev 2324)
@@ -1,29 +1,20 @@
<configuration name="acl.conf" description="Network Lists">
<network-lists>
- <list name="dl-candidates" default="allow">
- <node type="deny" cidr="10.0.0.0/8"/>
- <node type="deny" cidr="172.16.0.0/12"/>
- <node type="deny" cidr="192.168.0.0/16"/>
- </list>
- <list name="rfc1918" default="deny">
- <node type="allow" cidr="10.0.0.0/8"/>
- <node type="allow" cidr="172.16.0.0/12"/>
- <node type="allow" cidr="192.168.0.0/16"/>
- </list>
+ <!--
+ These ACL's are automatically created on startup.
- <list name="lan" default="allow">
- <node type="deny" cidr="192.168.42.0/24"/>
- <node type="allow" cidr="192.168.42.42/32"/>
- </list>
+ rfc1918.auto - RFC1918 Space
+ nat.auto - RFC1918 Excluding your local lan.
+ localnet.auto - ACL for your local lan.
+ loopback.auto - ACL for your local lan.
+ -->
- <list name="strict" default="deny">
- <node type="allow" cidr="208.102.123.124/32"/>
+ <list name="domains" default="allow">
+ <node type="deny" cidr="1.2.3.0/24"/>
</list>
- <list name="domains" default="deny">
- <node type="allow" domain="$${domain}"/>
- </list>
</network-lists>
</configuration>
+
Modified: trunk/freeswitch/contrib/darren/conf/dialplan/default.xml
===================================================================
--- trunk/freeswitch/contrib/darren/conf/dialplan/default.xml 2010-12-30 02:47:26 UTC (rev 2323)
+++ trunk/freeswitch/contrib/darren/conf/dialplan/default.xml 2010-12-31 02:09:29 UTC (rev 2324)
@@ -257,7 +257,7 @@
</extension>
<extension name="astpp_callingcards">
- <condition field="destination_number" expression="^9912345$">
+ <condition field="destination_number" expression="^14357297148$">
<action application="answer"/>
<action application="eval" data="Here we go!"/>
<!-- <action application="lua" data="astpp_callingcards.lua"/> -->
Modified: trunk/modules/ASTPP/lib/ASTPP.pm
===================================================================
--- trunk/modules/ASTPP/lib/ASTPP.pm 2010-12-30 02:47:26 UTC (rev 2323)
+++ trunk/modules/ASTPP/lib/ASTPP.pm 2010-12-31 02:09:29 UTC (rev 2324)
@@ -354,8 +354,12 @@
if ($diddata->{extensions} =~ m/^("|)(L|l)ocal.*/m) {
my ($junk,$ext,$context) = split /,(?!(?:[^",]|[^"],[^"])+")/, $diddata->{extensions};
#jump to local dialplan
-$ext =~ s/"//mg;
-$context =~ s/"//mg;
+ print STDERR "EXT: $ext\n" if $arg{debug} == 1;
+ $ext =~ s/"//mg;
+ print STDERR "EXT: $ext \n" if $arg{debug} == 1;
+ print STDERR "CONTEXT: $context\n" if $arg{debug} == 1;
+ $context =~ s/"//mg;
+ print STDERR "CONTEXT: $context \n" if $arg{debug} == 1;
$xml .= "<action application=\"transfer\" data=\"" . $ext ." XML " .$context . "\"/>\n";
} else {
$xml .= "<action application=\"bridge\" data=\"" . $diddata->{extensions} . "\"/>\n";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dar...@us...> - 2011-04-13 03:07:57
|
Revision: 2334
http://astpp.svn.sourceforge.net/astpp/?rev=2334&view=rev
Author: darrenkw
Date: 2011-04-13 03:07:50 +0000 (Wed, 13 Apr 2011)
Log Message:
-----------
Corrected LCR code to match that suggested by FreeSWTICH team. This breaks some of our vendor costing code but that will be fixed later.
Modified Paths:
--------------
trunk/freeswitch/astpp-fs-xml.pl
trunk/modules/ASTPP/lib/ASTPP.pm
Modified: trunk/freeswitch/astpp-fs-xml.pl
===================================================================
--- trunk/freeswitch/astpp-fs-xml.pl 2011-03-23 04:33:55 UTC (rev 2333)
+++ trunk/freeswitch/astpp-fs-xml.pl 2011-04-13 03:07:50 UTC (rev 2334)
@@ -262,33 +262,31 @@
$xml .= "<condition field=\"destination_number\" expression=\"" . $params->{'Caller-Destination-Number'} . "\">\n";
$xml .= $returned_data;
- } else {
- # Get the list of routes for the phone number.
- my @outboundroutes =
- &get_outbound_routes( $astpp_db, $params->{'Caller-Destination-Number'},
- $carddata, $routeinfo, @reseller_list );
- foreach my $route (@outboundroutes) {
- $ASTPP->debug( debug =>
- "$route->{trunk}: cost $route->{cost}\t $route->{pattern}" );
- if ( $route->{cost} > $routeinfo->{cost} ) {
- $ASTPP->debug( debug =>
-"$route->{trunk}: $route->{cost} > $routeinfo->{cost}, skipping"
- );
- }
- else {
- my ($returned_data,$junk) = $ASTPP->fs_dialplan_xml_bridge(
- destination_number => $params->{'Caller-Destination-Number'},
- route_prepend => $route->{prepend},
- trunk_name => $route->{trunk},
- route_id => $route->{id}
- );
- $xml .= $returned_data;
- }
- }
- }
- $xml = $ASTPP->fs_dialplan_xml_footer( xml => $xml );
- $ASTPP->debug( debug => $xml );
- print $xml;
+ } else {
+ # Get the list of routes for the phone number.
+ my @outboundroutes = &get_outbound_routes( $astpp_db, $params->{'Caller-Destination-Number'},
+ $carddata, $routeinfo, @reseller_list );
+ $xml .= $ASTPP->fs_dialplan_xml_bridge_start() if @outboundroutes;
+ foreach my $route (@outboundroutes) {
+ $ASTPP->debug( debug => "$route->{trunk}: cost $route->{cost}\t $route->{pattern}" );
+ if ( $route->{cost} > $routeinfo->{cost} ) {
+ $ASTPP->debug( debug => "$route->{trunk}: $route->{cost} > $routeinfo->{cost}, skipping" );
+ }
+ else {
+ my ($returned_data,$junk) = $ASTPP->fs_dialplan_xml_bridge(
+ destination_number => $params->{'Caller-Destination-Number'},
+ route_prepend => $route->{prepend},
+ trunk_name => $route->{trunk},
+ route_id => $route->{id}
+ );
+ $xml .= $returned_data;
+ }
+ }
+ $xml .= $ASTPP->fs_dialplan_xml_bridge_end() if @outboundroutes;
+ }
+ $xml = $ASTPP->fs_dialplan_xml_footer( xml => $xml );
+ $ASTPP->debug( debug => $xml );
+ print $xml;
}
elsif ( $params->{section} eq "directory" ) {
Modified: trunk/modules/ASTPP/lib/ASTPP.pm
===================================================================
--- trunk/modules/ASTPP/lib/ASTPP.pm 2011-03-23 04:33:55 UTC (rev 2333)
+++ trunk/modules/ASTPP/lib/ASTPP.pm 2011-04-13 03:07:50 UTC (rev 2334)
@@ -368,7 +368,19 @@
return $xml;
}
+sub fs_dialplan_xml_bridge_start() {
+# my $dialstring = "<action application=\"set\" data=\"outbound_route=" . $arg{route_id} . "\"/>\n";
+# $dialstring .= "<action application=\"set\" data=\"provider=" . $trunkdata->{provider} . "\"/>\n";
+# $dialstring .= "<action application=\"set\" data=\"trunk=" . $trunkdata->{name} . "\"/>\n";
+ my $dialstring = "<action application=\"bridge\" data=\"";
+ return $dialstring;
+}
+sub fs_dialplan_xml_bridge_end() {
+ my $dialstring = "\"/>\n";
+ return $dialstring;
+}
+
=item $ASTPP->fs_dialplan_xml_bridge()
Return the bridge command along with details. This is only called if a call is approved.
@@ -391,9 +403,6 @@
$trunkdata = $sql->fetchrow_hashref;
$arg{route_prepend} = "" if !$arg{route_prepend};
$sql->finish;
- $dialstring = "<action application=\"set\" data=\"outbound_route=" . $arg{route_id} . "\"/>\n";
- $dialstring .= "<action application=\"set\" data=\"provider=" . $trunkdata->{provider} . "\"/>\n";
- $dialstring .= "<action application=\"set\" data=\"trunk=" . $trunkdata->{name} . "\"/>\n";
if ($trunkdata->{dialed_modify} && $trunkdata->{dialed_modify} ne "") {
my @regexs = split(m/","/m, $trunkdata->{dialed_modify});
foreach my $regex (@regexs) {
@@ -406,20 +415,20 @@
print STDERR "Phone After: $arg{destination_number}\n";
}
}
- if ( $trunkdata->{tech} eq "Zap" ) {
- $dialstring .= "<action application=\"bridge\" data=\"openzap/" . $trunkdata->{path} . "/1/" . $arg{route_prepend} . $arg{destination_number} . "\"/>\n";
- return ($dialstring,$data);
- }
+ if ( $trunkdata->{tech} eq "Zap" ) {
+ $dialstring .= "openzap/" . $trunkdata->{path} . "/1/" . $arg{route_prepend} . $arg{destination_number} ."|";
+ return ($dialstring,$data);
+ }
elsif ( $trunkdata->{tech} eq "SIP" ) {
my ($profile,$dest) = split(m/","/m, $trunkdata->{path});
$profile =~ s/"//g; #Strip off quotation marks
$dest =~ s/"//g; #Strip off quotation marks
if ($profile eq "gateway") {
$data = "sofia/gateway/" . $dest . "/" . $arg{route_prepend} . $arg{destination_number};
- $dialstring .= "<action application=\"bridge\" data=\"" . $data . "\"/>\n";
+ $dialstring .= $data . "|";
} else {
$data = "sofia/" . $profile . "/" . $arg{route_prepend} . $arg{destination_number} . "\@" . $dest;
- $dialstring .= "<action application=\"bridge\" data=\"" . $data . "\"/>\n";
+ $dialstring .= $data . "|";
}
return ($dialstring,$data);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dar...@us...> - 2011-05-07 03:09:42
|
Revision: 2337
http://astpp.svn.sourceforge.net/astpp/?rev=2337&view=rev
Author: darrenkw
Date: 2011-05-07 03:09:36 +0000 (Sat, 07 May 2011)
Log Message:
-----------
Fixed FreeSWITCH gateway issues. Tested to be working.
Modified Paths:
--------------
trunk/modules/ASTPP/lib/ASTPP.pm
trunk/web_interface/astpp-admin.cgi
Modified: trunk/modules/ASTPP/lib/ASTPP.pm
===================================================================
--- trunk/modules/ASTPP/lib/ASTPP.pm 2011-04-30 16:51:30 UTC (rev 2336)
+++ trunk/modules/ASTPP/lib/ASTPP.pm 2011-05-07 03:09:36 UTC (rev 2337)
@@ -421,16 +421,8 @@
return ($dialstring,$data);
}
elsif ( $trunkdata->{tech} eq "SIP" ) {
- my ($profile,$dest) = split(m/","/m, $trunkdata->{path});
- $profile =~ s/"//g; #Strip off quotation marks
- $dest =~ s/"//g; #Strip off quotation marks
- if ($profile eq "gateway") {
- $data = "sofia/gateway/" . $dest . "/" . $arg{route_prepend} . $arg{destination_number};
- $dialstring .= $data . "|";
- } else {
- $data = "sofia/" . $profile . "/" . $arg{route_prepend} . $arg{destination_number} . "\@" . $dest;
- $dialstring .= $data . "|";
- }
+ $data = "sofia/gateway/" . $trunkdata->{path} . "/" . $arg{route_prepend} . $arg{destination_number};
+ $dialstring .= $data . "|";
return ($dialstring,$data);
}
else {
Modified: trunk/web_interface/astpp-admin.cgi
===================================================================
--- trunk/web_interface/astpp-admin.cgi 2011-04-30 16:51:30 UTC (rev 2336)
+++ trunk/web_interface/astpp-admin.cgi 2011-05-07 03:09:36 UTC (rev 2337)
@@ -8445,13 +8445,7 @@
. "</td><td>"
. gettext("Protocol")
. "</td><td>"
- . "<a href=\"\#\">"
. gettext("Peer Name")
- . "<span class=\"popups\">"
- . gettext(
-"If using freeswitch then use the following formats: \"gateway\",\"gatewayname\" or \"profilename\",\"destinationhost\""
- )
- . "</span>" . "</a>"
. "</td><td>"
. gettext("Provider")
. "</td><td>"
@@ -8651,15 +8645,7 @@
. "</td><td>"
. gettext("Protocol")
. "</td><td>"
- . "<div id=\"popups\">"
- . "<a href=\"\#\">"
. gettext("Peer Name")
- . "<span class=\"popups\">"
- . gettext(
-"If using freeswitch then use the following formats: \"gateway\",\"gatewayname\" or \"profilename\",\"destinationhost\""
- )
- . "</span>" . "</a>"
- . "</div>"
. "</td><td>"
. gettext("Provider")
. "</td><td>"
@@ -8754,14 +8740,7 @@
. "</td><td>"
. gettext("Protocol")
. "</td><td>"
- . "<div id=\"popups\">"
- . "<a href=\"\#\">"
. gettext("Peer Name")
- . "<span class=\"popups\">"
- . gettext(
-"If using freeswitch then use the following formats: \"gateway\",\"gatewayname\" or \"profilename\",\"destinationhost\""
- )
- . "</span>" . "</a>"
. "</div>"
. "</td><td>"
. gettext("Provider")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|