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