[Astpp-commit] SF.net SVN: astpp:[2273] trunk
Brought to you by:
darrenkw
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. |