X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=fs_selfservice%2FFS-SelfService%2FSelfService%2FFreeRadiusVoip.pm;h=0df24f7d704283cd8d6b3eead204cb9af0a9db92;hb=e513d7cb331d7c7d99d1ea7b5f0a5f8e08e0d725;hp=0ab4f1456b5ea3d9ce4360b2c58fa90c7f987354;hpb=a0089f91a0d228b3f80d4e5d73cec93948813b1b;p=freeside.git diff --git a/fs_selfservice/FS-SelfService/SelfService/FreeRadiusVoip.pm b/fs_selfservice/FS-SelfService/SelfService/FreeRadiusVoip.pm index 0ab4f1456..0df24f7d7 100644 --- a/fs_selfservice/FS-SelfService/SelfService/FreeRadiusVoip.pm +++ b/fs_selfservice/FS-SelfService/SelfService/FreeRadiusVoip.pm @@ -1,23 +1,20 @@ -# Add this to the modules section of radiusd.conf -# #path to this module -# module=/usr/local/share/perl/5.8.8/FS/SelfService/FreeRadiusVoip.pm -# func_autheenticate = authenticate +#Add this to the modules section of radiusd.conf +# perl { +# #path to this module +# module=/usr/local/share/perl/5.8.8/FS/SelfService/FreeRadiusVoip.pm +# func_authorize = authorize; +# } # #In the Authorize section #Make sure that you have 'files' uncommented. Then add a line containing 'perl' # after it. # -#In the Authentication section add -# Auth-Type Perl { -# perl -# } -# # #N/A# Add a line containing 'perl' to the Accounting section. # -# In the users file comment the 'DEFAULT Auth-Type = System' lines -# and then add -# DEFAULT Auth-Type = Perl -# Fall-Through = 1 +# and on debian systems, add this to /etc/init.d/freeradius, with the +# correct path (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=416266) +# LD_PRELOAD=/usr/lib/libperl.so.5.8.8 +# export LD_PRELOAD BEGIN { $FS::SelfService::skip_uid_check = 1; } @@ -37,17 +34,20 @@ use constant RLM_MODULE_NOOP=> 7; #module succeeded without doing anything use constant RLM_MODULE_UPDATED=> 8; #OK (pairs modified) use constant RLM_MODULE_NUMCODES=> 9; #How many return codes there are -sub authenticate { +sub authorize { - #my $src = $RAD_REQUEST{'User-Name'}; + #&log_request_attributes(); -# my $response = call_time( 'src' => $RAD_REQUEST{'Calling-Station-Id'}, -# 'dst' => $RAD_REQUEST{'Called-Station-Id'}, ); -# -# if $response{$ + my $response = call_time( 'src' => $RAD_REQUEST{'Calling-Station-Id'}, + 'dst' => $RAD_REQUEST{'Called-Station-Id'}, ); - $RAD_REPLY{'Session-Timeout'} = 420; - return RLM_MODULE_UPDATED; + if ( $response->{'error'} ) { + $RAD_REPLY{'Reply-Message'} = $response->{'error'}; + return RLM_MODULE_REJECT; + } else { + $RAD_REPLY{'Session-Timeout'} = $response->{'seconds'}; + return RLM_MODULE_OK; + } }