1 #Add this to the modules section of radiusd.conf
4 # module=/usr/local/share/perl/5.8.8/FS/SelfService/FreeRadiusVoip.pm
5 # func_authorize = authorize;
8 #In the Authorize section
9 #Make sure that you have 'files' uncommented. Then add a line containing 'perl'
12 # #N/A# Add a line containing 'perl' to the Accounting section.
14 # and on debian systems, add this to /etc/init.d/freeradius, with the
15 # correct path (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=416266)
16 # LD_PRELOAD=/usr/lib/libperl.so.5.8.8
19 BEGIN { $FS::SelfService::skip_uid_check = 1; }
22 use vars qw(%RAD_REQUEST %RAD_REPLY %RAD_CHECK);
24 use FS::SelfService qw(call_time);
26 use constant RLM_MODULE_REJECT=> 0; #immediately reject the request
27 use constant RLM_MODULE_FAIL=> 1; #module failed, don't reply
28 use constant RLM_MODULE_OK=> 2; #the module is OK, continue
29 use constant RLM_MODULE_HANDLED=> 3; #the module handled the request, so stop
30 use constant RLM_MODULE_INVALID=> 4; #the module considers the request invalid
31 use constant RLM_MODULE_USERLOCK=> 5; #reject the request (user is locked out)
32 use constant RLM_MODULE_NOTFOUND=> 6; #user not found
33 use constant RLM_MODULE_NOOP=> 7; #module succeeded without doing anything
34 use constant RLM_MODULE_UPDATED=> 8; #OK (pairs modified)
35 use constant RLM_MODULE_NUMCODES=> 9; #How many return codes there are
39 #&log_request_attributes();
41 my $response = call_time( 'src' => $RAD_REQUEST{'Calling-Station-Id'},
42 'dst' => $RAD_REQUEST{'Called-Station-Id'}, );
44 if ( $response->{'error'} ) {
45 $RAD_REPLY{'Reply-Message'} = $response->{'error'};
46 return RLM_MODULE_REJECT;
48 $RAD_REPLY{'Session-Timeout'} = $response->{'seconds'};
54 sub log_request_attributes {
55 # This shouldn't be done in production environments!
56 # This is only meant for debugging!
57 for (keys %RAD_REQUEST) {
58 &radiusd::radlog(1, "RAD_REQUEST: $_ = $RAD_REQUEST{$_}");