how Calling-Station-Id on RADIUS reports (as a MAC address w/vendor), RT#29154
authorIvan Kohler <ivan@freeside.biz>
Thu, 21 Aug 2014 07:35:26 +0000 (00:35 -0700)
committerIvan Kohler <ivan@freeside.biz>
Thu, 21 Aug 2014 07:35:26 +0000 (00:35 -0700)
FS/FS/part_export/sqlradius.pm
httemplate/search/sqlradius.cgi

index 5d84f37..7ec869c 100644 (file)
@@ -48,7 +48,7 @@ tie %options, 'Tie::IxHash',
   },
   'show_called_station' => {
     type  => 'checkbox',
-    label => 'Show the Called-Station-ID on session reports',
+    label => 'Show the Called-Station-ID on session reports', #as a phone number
   },
   'overlimit_groups' => {
       label => 'Radius groups to assign to svc_acct which has exceeded its bandwidth or time limit (if not overridden by overlimit_groups global or per-agent config)', 
index f7873e7..604f44e 100644 (file)
 %   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'   => 'Destination',
-%                              'attrib' => 'Called-Station-ID',
-%                              'fmt'    =>
-%                                sub { length($_[0]) ? shift : '&nbsp'; },
-%                              'align'  => 'left',
-%                            },
-%     );
-%   }
 
     <FONT CLASS="fsinnerbox-title">
       <% $part_export->exportname || $part_export->exporttype |h %>
@@ -384,6 +373,37 @@ tie %fields, 'Tie::IxHash',
                                           },
                            align   => 'right',
                          },
+  'callingstationid'  => {
+                           name    => 'Source&nbsp;or&nbsp;MAC',
+                           attrib  => 'Calling-Station-Id',
+                           fmt     => sub {
+                             my $src = shift;
+                             if ( $src =~
+                                    /^\s*(([\dA-F]{2}[\-:]){5}[\dA-F]{2})/i ) {
+                               return $src. ' ('.
+                                        (Net::MAC::Vendor::lookup($1))->[0].
+                                      ')';
+
+                             }
+                             length($src) ? $src : '&nbsp';
+                           },
+                           align   => 'right',
+                         },
+  'calledstationid'   => {
+                           name    => 'Destination',
+                           attrib  => 'Called-Station-ID',
+                           fmt     => sub {
+                             my $dst = shift;
+                             if ( $dst =~
+                                    /^\s*(([\dA-F]{2}[\-:]){5}[\dA-F]{2})/i ) {
+                               return $dst. ' ('.
+                                        (Net::MAC::Vendor::lookup($1))->[0].
+                                      ')';
+                             }
+                             length($dst) ? $dst : '&nbsp';
+                           },
+                           align   => 'left',
+                       },
   'acctstarttime'     => {
                            name    => 'Start&nbsp;time',
                            attrib  => 'Acct-Start-Time',