[Astpp-commit] SF.net SVN: astpp:[2239] trunk
Brought to you by:
darrenkw
|
From: <dar...@us...> - 2009-03-07 22:29:45
|
Revision: 2239
http://astpp.svn.sourceforge.net/astpp/?rev=2239&view=rev
Author: darrenkw
Date: 2009-03-07 22:29:40 +0000 (Sat, 07 Mar 2009)
Log Message:
-----------
More freeswitch corrections and a few minor fixes to the interface.
Modified Paths:
--------------
trunk/Makefile
trunk/freeswitch/astpp-callingcards.pl
trunk/web_interface/astpp-admin.cgi
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2009-02-22 03:09:51 UTC (rev 2238)
+++ trunk/Makefile 2009-03-07 22:29:40 UTC (rev 2239)
@@ -13,6 +13,10 @@
ASTPPLOGDIR=/var/log/astpp/
EXTENSIONS=/etc/asterisk/extensions.conf
LOCALE_DIR=/usr/local/share/locale
+
+FS_SOUNDSDIR=/usr/local/freeswitch/sounds/en/us/callie
+FS_SCRIPTS=/usr/local/freeswitch/scripts
+
OWNER=root
GROUP=wheel
WWWDIR=/var/www
@@ -80,6 +84,13 @@
install -m 644 $$x $(DESTDIR)$(SOUNDSDIR); \
done
+install_sounds_fs:
+ for x in sounds/*.gsm; do \
+ echo $$x;\
+ install -m 644 $$x $(DESTDIR)$(FS_SOUNDSDIR); \
+ done
+
+
install_templates:
for x in templates/*; do \
echo $$x;\
Modified: trunk/freeswitch/astpp-callingcards.pl
===================================================================
--- trunk/freeswitch/astpp-callingcards.pl 2009-02-22 03:09:51 UTC (rev 2238)
+++ trunk/freeswitch/astpp-callingcards.pl 2009-03-07 22:29:40 UTC (rev 2239)
@@ -149,13 +149,13 @@
if ($config->{calling_cards_rate_announce} == 1) {
if ( $numberinfo->{cost} > 0 ) {
$session->streamFile($sound->{call_will_cost});
- $session->execute("phrase","pronounce," . ceil($numberinfo->{cost}/100));
+ $session->execute("phrase","spell," . ceil($numberinfo->{cost}/100));
$session->streamFile($sound->{currency});
my @call_cost = split(/\./, ($numberinfo->{cost} / 100));
- $session->execute("phrase","pronounce," . @call_cost[0]);
+ $session->execute("phrase","spell," . @call_cost[0]);
if (@call_cost[1]) {
$session->streamFile($sound->{point});
- $session->execute("phrase","pronounce," . @call_cost[1]);
+ $session->execute("phrase","spell," . @call_cost[1]);
$session->streamFile($sound->{sub_currency});
}
$session->streamFile($sound->{per});
@@ -163,7 +163,7 @@
}
if ( $numberinfo->{connectcost} > 0 ) {
$session->streamFile($sound->{a_connect_charge});
- $session->execute("phrase","pronounce," . ceil($numberinfo->{connectcost}/100));
+ $session->execute("phrase","spell," . ceil($numberinfo->{connectcost}/100));
$session->streamFile($sound->{sub_currency});
$session->streamFile($sound->{will_apply});
}
@@ -243,11 +243,11 @@
$minutes = sprintf( "%.0f", $minutes );
$session->streamFile($sound->{call_will_last});
if ( $minutes == 1 ) {
- $session->execute("phrase","pronounce," . $minutes);
+ $session->execute("phrase","spell," . $minutes);
$session->streamFile($sound->{minute});
}
elsif ( $minutes > 1 ) {
- $session->execute("phrase","pronounce," . $minutes);
+ $session->execute("phrase","spell," . $minutes);
$session->streamFile($sound->{minutes});
}
}
@@ -256,10 +256,6 @@
$session->streamFile($sound->{goodbye});
&leave($cardinfo);
}
- $maxtime = $timelimit * 1000;
-
-
- $timelimit = "\|30\|HL($maxtime:60000:30000)\|Hgj";
$ASTPP->debug( debug => "Available: $available",
verbosity => $verbosity );
$ASTPP->debug( debug => "Balance: $balance", verbosity => $verbosity );
@@ -284,19 +280,19 @@
my $interrupt = $session->playAndGetDigits(1,1,1,0,"#*","$sound->{card_has_balance_of}","$sound->{card_has_balance_of}",'^[0-9]+$');
if (!$interrupt || $interrupt eq "" || $interrupt == 0) {
if ( $main_balance == 1 ) {
-$session->execute("phrase","pronounce," . $main_balance);
+$session->execute("phrase","spell," . $main_balance);
$session->streamFile($sound->{main_currency});
}
elsif ( $main_balance > 1 ) {
-$session->execute("phrase","pronounce," . $main_balance);
+$session->execute("phrase","spell," . $main_balance);
$session->streamFile($sound->{main_currency_plural});
}
if ( $sub_balance == 1 ) {
-$session->execute("phrase","pronounce," . $sub_balance);
+$session->execute("phrase","spell," . $sub_balance);
$session->streamFile($sound->{sub_currency});
}
elsif ( $sub_balance > 1 ) {
-$session->execute("phrase","pronounce," . $sub_balance);
+$session->execute("phrase","spell," . $sub_balance);
$session->streamFile($sound->{sub_currency_plural});
}
}
@@ -389,17 +385,19 @@
}
$count = 0;
foreach my $route (@outboundroutes) {
- my $dialstring = $ASTPP->fs_dialplan_xml_bridge();
my $callstart = localtime();
my ($accountcode);
$callstart = &prettytimestamp if $cc == 1;
- $session->execute->("sched_hangup","+" . $timelimit * 60);
+ $session->execute("sched_hangup","+" . $timelimit/1000*60);
my ($xml_string,$data_string) = $ASTPP->fs_dialplan_xml_bridge(
destination_number => $destination,
route_prepend => $route->{prepend},
trunk_name => $route->{trunk}
);
- my $vars = $session->execute->("bridge",$data_string);
+ my ($dialedtime,$uniqueid,$answeredtime,$clid);
+ my $vars = $session->execute("bridge","$data_string");
+
+ $ASTPP->debug( debug => "Vars: " . $vars);
# return 1 if (! $session->ready());
# $VARS{destination_number} = $num_dial;
# UPDATEV();
@@ -421,7 +419,7 @@
$destination, $callstart, 0, $uniqueid, $clid )
if $cc == 1;
&write_asterisk_cdr( $accountcode, $clid, $destination, $status,
- $callstart, $answeredtime, $trunk, "CallingCards", $dialedtime, $uniqueid . "a", $asterisk_time, $cdr_db);
+ $callstart, $answeredtime, $route->{trunk}, "CallingCards", $dialedtime, $uniqueid . "a", $asterisk_time, $cdr_db);
&leave($cardinfo);
} else {
push @outboundroutes, $route;
@@ -438,7 +436,7 @@
$destination, $callstart, 0, $uniqueid, $clid )
if $cc == 1;
&write_asterisk_cdr( $accountcode, $clid, $destination, $status,
- $callstart, $answeredtime, $trunk, "CallingCards", $dialedtime, $uniqueid . "a", $asterisk_time, $cdr_db);
+ $callstart, $answeredtime, $route->{trunk}, "CallingCards", $dialedtime, $uniqueid . "a", $asterisk_time, $cdr_db);
&leave($cardinfo);
} else {
push @outboundroutes, $route;
@@ -473,7 +471,7 @@
$callstart, $charge, $answeredtime, $uniqueid
);
&write_asterisk_cdr( $accountcode, $clid, $destination, "ANSWERED",
- $callstart, $answeredtime, $trunk, "CallingCards", $dialedtime, $uniqueid . "a", $asterisk_time, $cdr_db);
+ $callstart, $answeredtime, $route->{trunk}, "CallingCards", $dialedtime, $uniqueid . "a", $asterisk_time, $cdr_db);
&update_balance( $cardinfo, $charge );
$astpp_db->do("UPDATE callingcards SET timeused = "
. $astpp_db->quote($cardinfo->{timeused} + $answeredtime)
@@ -485,7 +483,7 @@
&write_account_cdr( $astpp_db, $cardinfo->{number},
$charge, $destination, $callstart, $answeredtime, $uniqueid, $clid );
&write_asterisk_cdr( $accountcode, $clid, $destination, $status,
- $callstart, $answeredtime, $trunk, "CallingCards", $dialedtime, $uniqueid . "a", $asterisk_time, $cdr_db);
+ $callstart, $answeredtime, $route->{trunk}, "CallingCards", $dialedtime, $uniqueid . "a", $asterisk_time, $cdr_db);
$ASTPP->debug( debug => $status, verbosity => $verbosity );
}
$session->streamFile($sound->{call_completed});
@@ -501,7 +499,7 @@
$destination, $callstart, 0, $uniqueid, $clid )
if $cc == 1;
&write_asterisk_cdr( $accountcode, $clid, $destination, $status,
- $callstart, $answeredtime, $trunk, "CallingCards", $dialedtime, $uniqueid . "a", $asterisk_time, $cdr_db);
+ $callstart, $answeredtime, $route->{trunk}, "CallingCards", $dialedtime, $uniqueid . "a", $asterisk_time, $cdr_db);
&leave($cardinfo);
}
else {
@@ -515,7 +513,7 @@
$destination, $callstart, 0, $uniqueid, $clid )
if $cc == 1;
&write_asterisk_cdr( $accountcode, $clid, $destination, $status,
- $callstart, $answeredtime, $trunk, "CallingCards", $dialedtime, $uniqueid . "a", $asterisk_time, $cdr_db);
+ $callstart, $answeredtime, $route->{trunk}, "CallingCards", $dialedtime, $uniqueid . "a", $asterisk_time, $cdr_db);
&leave($cardinfo);
}
}
@@ -671,7 +669,7 @@
}
$retries = 0;
while ( !$numberinfo->{pattern} && $retries < $config->{number_retries} ) {
- $destination = $session->playAndGetDigits(4,999,1,$config->{calling_cards_dial_input_timeout},"#","$sound->{destination}","$sound->{destination}",'^[0-9]+$');
+ $destination = $session->playAndGetDigits(4,35,1,$config->{calling_cards_dial_input_timeout},"#","$sound->{destination}","$sound->{destination}",'^[0-9]+$');
$numberinfo =
&get_route( $astpp_db, $config, $destination, $brandinfo->{pricelist}, $cardinfo );
if ( !$numberinfo->{pattern} ) {
Modified: trunk/web_interface/astpp-admin.cgi
===================================================================
--- trunk/web_interface/astpp-admin.cgi 2009-02-22 03:09:51 UTC (rev 2238)
+++ trunk/web_interface/astpp-admin.cgi 2009-03-07 22:29:40 UTC (rev 2239)
@@ -2114,11 +2114,11 @@
( $sql, $pagination ) = $ASTPP->pagination(
sql_select => "SELECT * FROM cdrs WHERE cardnum ="
. $astpp_db->quote( $accountinfo->{number} )
- . "and status IN (NULL, '', 0, 1)"
+ . "and ( status IS NULL OR status IN (0,1,''))"
. " ORDER BY callstart DESC ",
sql_count => "SELECT COUNT(*) FROM cdrs WHERE cardnum ="
. $astpp_db->quote( $accountinfo->{number} )
- . "and status IN (NULL, '', 0, 1)",
+ . "and ( status IS NULL OR status IN (0,1,''))",
results_per_page => $config->{results_per_page},
ve => $params->{ve},
te => $params->{ee},
@@ -2906,7 +2906,7 @@
}
else {
$tmp =
-"SELECT name FROM callingcardbrands WHERE status < 2 AND reseller IN (NULL,'')";
+"SELECT name FROM callingcardbrands WHERE status < 2 AND (reseller IS NULL OR reseller = '')";
}
$ASTPP->debug( user => $param->{username}, debug => $tmp );
$sql = $astpp_db->prepare($tmp);
@@ -2928,7 +2928,7 @@
}
else {
$tmp =
-"SELECT * FROM callingcardbrands WHERE status < 2 AND reseller IN (NULL,'') ORDER BY name limit $params->{limit} , $results_per_page";
+"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 );
$sql = $astpp_db->prepare($tmp);
@@ -3954,9 +3954,9 @@
);
my $sql_select =
-"SELECT * FROM cdr WHERE cost IN( 'error','rating') OR accountcode IN (NULL,'') AND cost ='none' ORDER BY calldate";
+"SELECT * FROM cdr 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 IN (NULL,'') AND cost ='none'";
+"SELECT COUNT(*) FROM cdr WHERE cost IN ( 'error','rating') OR (accountcode IS NULL OR accountcode = '') AND cost ='none'";
my ( $sql, $pagination ) = $ASTPP->pagination(
sql_select => $sql_select,
@@ -6347,16 +6347,18 @@
$ASTPP->debug( user => $param->{username}, debug => $tmp );
}
$tmp =
-"INSERT INTO routes (pattern,comment,pricelist,connectcost,includedseconds,cost) VALUES ("
+"INSERT INTO routes (pattern,comment,pricelist,connectcost,includedseconds,cost,inc,reseller) VALUES ("
. $astpp_db->quote( "^" . $params->{number} . "\$" ) . ","
- . $astpp_db->quote( $params->{country} . ","
+ . $astpp_db->quote("DID: " . $params->{country} . ","
. $params->{province} . ","
. $params->{city} )
. ","
. $astpp_db->quote( $config->{default_brand} ) . ","
. $astpp_db->quote( $params->{connectcost} ) . ","
. $astpp_db->quote( $params->{included} ) . ","
- . $astpp_db->quote( $params->{cost} ) . ")";
+ . $astpp_db->quote( $params->{cost} ) . ","
+ . $astpp_db->quote( $params->{inc} ) . ",'')";
+ $ASTPP->debug( user => $param->{username}, debug => $tmp );
if ( $astpp_db->do($tmp) ) {
$status .=
gettext("Pattern") . " '"
@@ -6430,10 +6432,9 @@
$tmp =
"UPDATE routes SET"
. " comment = "
- . $astpp_db->quote( $params->{country} . ","
- . $params->{province} . ","
- . $params->{city} )
- . ","
+ . $astpp_db->quote("DID: " . $params->{country} . ","
+ . $params->{province} . ","
+ . $params->{city} ) . ","
. " pricelist="
. $astpp_db->quote( $config->{default_brand} ) . ","
. " connectcost="
@@ -6441,9 +6442,13 @@
. " includedseconds="
. $astpp_db->quote( $params->{included} ) . ","
. " cost="
- . $astpp_db->quote( $params->{cost} )
+ . $astpp_db->quote( $params->{cost} ) . ","
+ . " inc="
+ . $astpp_db->quote( $params->{inc} ) . ","
+ . " status=1"
. " WHERE pattern = "
. $astpp_db->quote( "^" . $params->{number} . "\$" );
+ $ASTPP->debug( user => $param->{username}, debug => $tmp );
if ( $astpp_db->do($tmp) ) {
$status .=
gettext("Pattern") . " '"
@@ -6490,8 +6495,7 @@
"<table class=\"default\">"
. "<tr class=\"header\"><td colspan=12>"
. gettext("All costs are in 1/100 of a penny")
- . "</td></tr>
-"
+ . "</td></tr>"
. "<tr class=\"header\"><td>"
. hidden( -name => 'mode', -value => gettext("Manage DIDs") )
. gettext("Number")
@@ -7906,7 +7910,7 @@
";
if ( $params->{logintype} == 1 || $params->{logintype} == 5 ) {
$tmp =
- "SELECT * FROM routes WHERE status < 2 AND reseller IN (NULL,'')"
+ "SELECT * FROM routes WHERE status < 2 AND (reseller IS NULL OR reseller = '')"
. " AND pricelist = "
. $astpp_db->quote( $params->{username} )
. " UNION SELECT * FROM routes WHERE status < 2 "
@@ -7915,7 +7919,7 @@
}
else {
$tmp =
- "SELECT * FROM routes WHERE status < 2 AND reseller IN (NULL,'')";
+ "SELECT * FROM routes WHERE status < 2 AND ( reseller IS NULL OR reseller = '' )";
}
$ASTPP->debug( user => $param->{username}, debug => $tmp );
$sql = $astpp_db->prepare($tmp);
@@ -7930,7 +7934,7 @@
if ( $params->{logintype} == 1 || $params->{logintype} == 5 ) {
$sql = $astpp_db->prepare(
-"SELECT * FROM routes WHERE reseller IN (NULL,'') AND pricelist = "
+"SELECT * FROM routes WHERE ( reseller IS NULL OR reseller = '') AND pricelist = "
. $astpp_db->quote( $params->{username} )
. " UNION SELECT * FROM routes WHERE status < 2 "
. " AND reseller = "
@@ -7940,7 +7944,7 @@
}
else {
$sql = $astpp_db->prepare(
-"SELECT * FROM routes WHERE reseller IN (NULL,'') AND status < 2 ORDER BY comment limit $params->{limit} , $results_per_page"
+"SELECT * FROM routes WHERE ( reseller IS NULL OR reseller = '') AND status < 2 ORDER BY comment limit $params->{limit} , $results_per_page"
);
}
$sql->execute
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|