freeside/httemplate/search sqlradius.cgi,1.6,1.7 sqlradius.html,1.1,1.2
ivan
ivan at pouncequick.420.am
Sat Nov 20 09:27:03 PST 2004
Update of /home/cvs/cvsroot/freeside/httemplate/search
In directory pouncequick:/tmp/cvs-serv3612/httemplate/search
Modified Files:
sqlradius.cgi sqlradius.html
Log Message:
first pass at VoIP rating
Index: sqlradius.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/sqlradius.cgi,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- sqlradius.cgi 12 Oct 2004 06:08:03 -0000 1.6
+++ sqlradius.cgi 20 Nov 2004 17:26:55 -0000 1.7
@@ -51,6 +51,15 @@
$ip = $1;
}
+ my $prefix = $cgi->param('prefix');
+ $prefix =~ s/\D//g;
+ if ( $prefix =~ /^(\d+)$/ ) {
+ $prefix = $1;
+ $prefix = "011$prefix" unless $prefix =~ /^1/;
+ } else {
+ $prefix = '';
+ }
+
###
# field formatting subroutines
###
@@ -221,11 +230,30 @@
# and finally, display the thing
###
- foreach my $part_export ( map $_->rebless,
+ foreach my $part_export (
+ #grep $_->can('usage_sessions'), qsearch( 'part_export' )
qsearch( 'part_export', { 'exporttype' => 'sqlradius' } ),
qsearch( 'part_export', { 'exporttype' => 'sqlradius_withdomain' } )
) {
%user2svc_acct = ();
+
+ my $efields = tie my %efields, 'Tie::IxHash', %fields;
+ delete $efields{'framedipaddress'} if $part_export->option('hide_ip');
+ if ( $part_export->option('hide_data') ) {
+ delete $efields{$_} foreach qw(acctinputoctets acctoutputoctets);
+ }
+ if ( $part_export->option('show_called_station') ) {
+ $efields->Splice(1, 0,
+ 'calledstationid' => {
+ 'name' =>
+ 'attrib' => 'Called-Station-ID',
+ 'fmt' =>
+ sub { length($_[0]) ? shift : ' '; },
+ 'align' => 'left',
+ },
+ );
+ }
+
%>
<%= $part_export->exporttype %> to <%= $part_export->machine %><BR>
@@ -239,8 +267,10 @@
<% } %>
</TR>
<% foreach my $session (
- @{ $part_export->usage_sessions( $beginning, $ending, $cgi_svc_acct, $ip ) }
-) { %>
+ @{ $part_export->usage_sessions(
+ $beginning, $ending, $cgi_svc_acct, $ip, $prefix, ) }
+ ) {
+%>
<TR>
<% foreach my $field ( keys %fields ) { %>
<TD ALIGN="<%= $fields{$field}->{align} %>">
Index: sqlradius.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/sqlradius.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- sqlradius.html 5 Oct 2004 16:28:27 -0000 1.1
+++ sqlradius.html 20 Nov 2004 17:26:56 -0000 1.2
@@ -15,14 +15,35 @@
<TD></TD>
<TD><FONT SIZE="-1"><I>(leave blank to show all users)</I></FONT></TD>
</TR>
-<TR>
- <TD ALIGN="right">IP address: </TD>
- <TD><INPUT TYPE="text" NAME="ip"></TD>
-</TR>
-<TR>
- <TD></TD>
- <TD><FONT SIZE="-1"><I>(leave blank to show all IPs)</I></FONT></TD>
-</TR>
+
+<% my @part_export = qsearch( 'part_export', { 'exporttype' => 'sqlradius' } );
+ push @part_export,
+ qsearch( 'part_export', { 'exporttype' => 'sqlradius_withdomain' } );
+%>
+
+<% if ( grep { ! $_->option('hide_ip') } @part_export ) { %>
+ <TR>
+ <TD ALIGN="right">IP address: </TD>
+ <TD><INPUT TYPE="text" NAME="ip"></TD>
+ </TR>
+ <TR>
+ <TD></TD>
+ <TD><FONT SIZE="-1"><I>(leave blank to show all IPs)</I></FONT></TD>
+ </TR>
+<% } %>
+
+<% if ( grep { $_->option('show_called_station') } @part_export ) { %>
+ <TR>
+ <TD ALIGN="right">Destination prefix:</TD>
+ <TD><INPUT TYPE="text" NAME="prefix"></TD>
+ </TR>
+ <TR>
+ <TD></TD>
+ <TD><FONT SIZE="-1"><I>(country code or country code and prefix)</I></FONT></TD>
+ <TD><FONT SIZE="-1"><I>(leave blank to show all destinations)</I></FONT></TD>
+ </TR>
+<% } %>
+
<TR>
<TD ALIGN="right">From: </TD>
<TD>
More information about the freeside-commits
mailing list