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