b93fe8c1a564ade959ba589c2c82e3b45f1c62e7
[freeside.git] / FS / FS / part_export / phone_sqlradius.pm
1 package FS::part_export::phone_sqlradius;
2
3 use vars qw(@ISA $DEBUG %info );
4 use Tie::IxHash;
5 use FS::Record; #qw( dbh qsearch qsearchs str2time_sql );
6 #use FS::part_export;
7 use FS::part_export::sqlradius;
8 #use FS::svc_phone;
9 #use FS::export_svc;
10 #use Carp qw( cluck );
11
12 @ISA = qw(FS::part_export::sqlradius);
13
14 $DEBUG = 0;
15
16 tie %options, 'Tie::IxHash',
17   'datasrc'  => { label=>'DBI data source ' },
18   'username' => { label=>'Database username' },
19   'password' => { label=>'Database password' },
20   'ignore_accounting' => {
21     type  => 'checkbox',
22     label => 'Ignore accounting records from this database'
23   },
24   'hide_ip' => {
25     type  => 'checkbox',
26     label => 'Hide IP address information on session reports',
27   },
28   'hide_data' => {
29     type  => 'checkbox',
30     label => 'Hide download/upload information on session reports',
31   },
32
33   #should be default for this one, right?
34   #'show_called_station' => {
35   #  type  => 'checkbox',
36   #  label => 'Show the Called-Station-ID on session reports',
37   #},
38
39   #N/A
40   #'overlimit_groups' => { label => 'Radius groups to assign to svc_acct which has exceeded its bandwidth or time limit', } ,
41   #'groups_susp_reason' => { label =>
42   #                           'Radius group mapping to reason (via template user) (svcnum|username|username@domain  reasonnum|reason)',
43   #                          type  => 'textarea',
44   #                        },
45
46 ;
47
48 %info = (
49   'svc'      => 'svc_phone',
50   'desc'     => 'Real-time export to SQL-backed RADIUS (FreeRADIUS, ICRADIUS) for phone provisioning and rating',
51   'options'  => \%options,
52   'notes'    => <<END,
53 Real-time export of <b>radcheck</b> table
54 <!--, <b>radreply</b> and <b>usergroup</b>-- tables>
55 to any SQL database for <a href="http://www.freeradius.org/">FreeRADIUS</a>
56 or <a href="http://radius.innercite.com/">ICRADIUS</a>.
57 <br><br>
58
59 This export is for phone/VoIP provisioning and rating.  For a regular RADIUS
60 export, see sqlradius.
61 <br><br>
62
63 <!--An existing RADIUS database will be updated in realtime, but you can use
64 <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.9:Documentation:Developer/bin/freeside-phone_sqlradius-reset">freeside-phone_sqlradius-reset</a>
65 to delete the entire RADIUS database and repopulate the tables from the
66 Freeside database.
67 <br><br>
68 -->
69
70 See the
71 <a href="http://search.cpan.org/dist/DBI/DBI.pm#connect">DBI documentation</a>
72 and the
73 <a href="http://search.cpan.org/search?mode=module&query=DBD%3A%3A">documentation for your DBD</a>
74 for the exact syntax of a DBI data source.
75
76 END
77 );
78
79 sub rebless { shift; }
80
81 sub export_username {
82   my($self, $svc_phone) = (shift, shift);
83   $svc_phone->countrycode. $svc_phone->phonenum;
84 }
85
86 sub _export_suspend {}
87 sub _export_unsuspend {}
88
89 #probably harmless that we ->can('usage_sessions').... ?
90
91 1;
92