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