projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git]
/
fs_selfservice
/
FS-SelfService
/
SelfService
/
FreeRadiusVoip.pm
diff --git
a/fs_selfservice/FS-SelfService/SelfService/FreeRadiusVoip.pm
b/fs_selfservice/FS-SelfService/SelfService/FreeRadiusVoip.pm
index
c52a97f
..
25f673f
100644
(file)
--- a/
fs_selfservice/FS-SelfService/SelfService/FreeRadiusVoip.pm
+++ b/
fs_selfservice/FS-SelfService/SelfService/FreeRadiusVoip.pm
@@
-1,8
+1,13
@@
#Add this to the modules section of radiusd.conf
# perl {
# #path to this module
#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
+# # deb 6 example
+# #module=/usr/local/share/perl/5.10.1/FS/SelfService/FreeRadiusVoip.pm
+# # deb 7 example
+# module=/usr/local/share/perl/5.14.2/FS/SelfService/FreeRadiusVoip.pm
+#
# func_authorize = authorize;
# func_authorize = authorize;
+#
# }
#
#In the Authorize section
# }
#
#In the Authorize section
@@
-11,9
+16,9
@@
#
# #N/A# Add a line containing 'perl' to the Accounting section.
#
#
# #N/A# Add a line containing 'perl' to the Accounting section.
#
-# and on debian systems, add this to /etc/init.d/freeradius, with the
+# and on debian
6
systems, add this to /etc/init.d/freeradius, with the
# correct path (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=416266)
# correct path (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=416266)
-# LD_PRELOAD=/usr/lib/libperl.so.5.
8.8
+# LD_PRELOAD=/usr/lib/libperl.so.5.
10
# export LD_PRELOAD
BEGIN { $FS::SelfService::skip_uid_check = 1; }
# export LD_PRELOAD
BEGIN { $FS::SelfService::skip_uid_check = 1; }
@@
-36,16
+41,21
@@
use constant RLM_MODULE_NUMCODES=> 9; #How many return codes there are
sub authorize {
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'}, );
my $response = call_time( 'src' => $RAD_REQUEST{'Calling-Station-Id'},
'dst' => $RAD_REQUEST{'Called-Station-Id'}, );
- if ( $response->{
$error
} ) {
- $RAD_REPLY{'
Access-Reject
'} = $response->{'error'};
+ if ( $response->{
'error'
} ) {
+ $RAD_REPLY{'
Reply-Message
'} = $response->{'error'};
return RLM_MODULE_REJECT;
return RLM_MODULE_REJECT;
+ } elsif ( $response->{'seconds'} ) {
+ $RAD_REPLY{'Session-Timeout'} = $response->{'seconds'};
+ $RAD_REPLY{'Termination-Action'} = 0;
+ return RLM_MODULE_OK;
} else {
} else {
- $RAD_REPLY{'Session-Timeout'} = $response->{'seconds'}
+ # if the called number is free, put 1 in the Termination-Action attribute
+ $RAD_REPLY{'Termination-Action'} = 1;
return RLM_MODULE_OK;
}
return RLM_MODULE_OK;
}