X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fsvc_phone.pm;h=c90339a8b09a7097901b75d126303211b7a627b9;hb=4eea4e8c5dc178ccd3b478b80361896da027e481;hp=bd92ed84be4122eff29f0658282d16a116396723;hpb=bb5907148eb298e2e509fa37e23dcbe63619db9d;p=freeside.git diff --git a/FS/FS/svc_phone.pm b/FS/FS/svc_phone.pm index bd92ed84b..c90339a8b 100644 --- a/FS/FS/svc_phone.pm +++ b/FS/FS/svc_phone.pm @@ -1,12 +1,16 @@ package FS::svc_phone; use strict; -use vars qw( @ISA ); +use vars qw( @ISA @pw_set ); +use FS::Conf; #use FS::Record qw( qsearch qsearchs ); use FS::svc_Common; @ISA = qw( FS::svc_Common ); +#avoid l 1 and o O 0 +@pw_set = ( 'a'..'k', 'm','n', 'p-z', 'A'..'N', 'P'..'Z' , '2'..'9' ); + =head1 NAME FS::svc_phone - Object methods for svc_phone records @@ -39,13 +43,21 @@ from FS::Record. The following fields are currently supported: =over 4 -=item svcnum - primary key +=item svcnum + +primary key + +=item countrycode + +=item phonenum -=item countrycode - +=item sip_password -=item phonenum - +=item pin -=item pin - +Voicemail PIN + +=item phone_name =back @@ -71,17 +83,19 @@ sub table_info { 'display_weight' => 60, 'cancel_weight' => 80, 'fields' => { - 'countrycode' => { label => 'Country code', - type => 'text', - disable_inventory => 1, - disable_select => 1, - }, - 'phonenum' => 'Phone number', - 'pin' => { label => 'Personal Identification Number', - type => 'text', - disable_inventory => 1, - disable_select => 1, - }, + 'countrycode' => { label => 'Country code', + type => 'text', + disable_inventory => 1, + disable_select => 1, + }, + 'phonenum' => 'Phone number', + 'pin' => { label => 'Personal Identification Number', + type => 'text', + disable_inventory => 1, + disable_select => 1, + }, + 'sip_password' => 'SIP password', + 'name' => 'Name', }, }; } @@ -107,7 +121,10 @@ Returns the phone number. sub label { my $self = shift; - $self->phonenum; #XXX format it better + my $phonenum = $self->phonenum; #XXX format it better + my $label = $phonenum; + $label .= ' ('.$self->phone_name.')' if $self->phone_name; + $label; } =item insert @@ -170,13 +187,22 @@ sub check { $self->ut_numbern('svcnum') || $self->ut_numbern('countrycode') || $self->ut_number('phonenum') - || $self->ut_anythingn('sip_password') + || $self->ut_anything('sip_password') || $self->ut_numbern('pin') + || $self->ut_textn('phone_name') ; return $error if $error; $self->countrycode(1) unless $self->countrycode; + unless ( length($self->sip_password) ) { + + $self->sip_password( + join('', map $pw_set[ int(rand $#pw_set) ], (0..16) ) + ); + + } + $self->SUPER::check; } @@ -192,6 +218,35 @@ sub check_pin { $check_pin eq $self->pin; } +=item radius_reply + +=cut + +sub radius_reply { + my $self = shift; + #XXX Session-Timeout! holy shit, need rlm_perl to ask for this in realtime + (); +} + +=item radius_check + +=cut + +sub radius_check { + my $self = shift; + my %check = (); + + my $conf = new FS::Conf; + + $check{'User-Password'} = $conf->config('svc_phone-radius-default_password'); + + %check; +} + +sub radius_groups { + (); +} + =back =head1 BUGS