X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fsvc_phone.pm;h=9a7bc47572eac389f20e77a6bd45bc629aea5b5d;hb=78b44177a16bc4da793da1c461455a0e77d52999;hp=72c609c51a320806f83f8bd7a4ec7fbe025906d1;hpb=0c04fc78f66d17a5736686757cd8f838715c8380;p=freeside.git diff --git a/FS/FS/svc_phone.pm b/FS/FS/svc_phone.pm index 72c609c51..9a7bc4757 100644 --- a/FS/FS/svc_phone.pm +++ b/FS/FS/svc_phone.pm @@ -1,7 +1,10 @@ package FS::svc_phone; +use base qw( FS::svc_Domain_Mixin FS::svc_PBX_Mixin + FS::location_Mixin + FS::svc_Common + ); use strict; -use base qw( FS::svc_Domain_Mixin FS::location_Mixin FS::svc_Common ); use vars qw( $DEBUG $me @pw_set $conf $phone_name_max $passwordmin $passwordmax ); @@ -13,7 +16,6 @@ use FS::Record qw( qsearch qsearchs dbh ); use FS::PagedSearch qw( psearch ); use FS::Msgcat qw(gettext); use FS::part_svc; -use FS::phone_device; use FS::svc_pbx; use FS::svc_domain; use FS::cust_location; @@ -239,7 +241,7 @@ Class method which returns an SQL fragment to search for the given string. sub search_sql { my( $class, $string ) = @_; - my $conf = new FS::Conf; + #my $conf = new FS::Conf; if ( $conf->exists('svc_phone-allow_alpha_phonenum') ) { $string =~ s/\W//g; @@ -464,7 +466,11 @@ and replace methods. sub check { my $self = shift; - my $conf = new FS::Conf; + #my $conf = new FS::Conf; + + my $x = $self->setfixed; + return $x unless ref($x); + my $part_svc = $x; my $phonenum = $self->phonenum; my $phonenum_check_method; @@ -546,8 +552,9 @@ sub check { return "SIP password must be shorter than $passwordmax characters" if length($self->sip_password) > $passwordmax; - } else { # option for this? + } elsif ( $part_svc->part_svc_column('sip_password')->columnflag ne 'F' ) { + # option for this? $self->sip_password( join('', map $pw_set[ int(rand $#pw_set) ], (1..min($passwordmax,16)) ) ); @@ -648,9 +655,15 @@ sub radius_check { my $self = shift; my %check = (); - my $conf = new FS::Conf; + #my $conf = new FS::Conf; - $check{'User-Password'} = $conf->config('svc_phone-radius-default_password'); + my $password; + if ( $conf->config('svc_phone-radius-password') eq 'countrycode_phonenum' ) { + $password = $self->countrycode. $self->phonenum; + } else { + $password = $conf->config('svc_phone-radius-default_password'); + } + $check{'User-Password'} = $password; %check; } @@ -685,11 +698,6 @@ Returns any FS::phone_device records associated with this service. =cut -sub phone_device { - my $self = shift; - qsearch('phone_device', { 'svcnum' => $self->svcnum } ); -} - #override location_Mixin version cause we want to try the cust_pkg location #in between us and cust_main # XXX what to do in the unlinked case??? return a pseudo-object that returns @@ -717,8 +725,8 @@ Accepts the following options: =item status => "" (or "processing-tiered", "done"): Return only CDRs with that processing status. -=item inbound => 1: Return CDRs for inbound calls. With "status", will filter -on inbound processing status. +=item inbound => 1: Return CDRs for inbound calls (that is, those that match +on 'dst'). With "status", will filter on inbound processing status. =item default_prefix => "XXX": Also accept the phone number of the service prepended with the chosen prefix. @@ -729,7 +737,9 @@ with the chosen prefix. =item calltypenum: Only return CDRs with this call type. -=item disable_src => 1: Only match on "charged_party", not "src". +=item disable_src => 1: Only match on 'charged_party', not 'src'. + +=item disable_charged_party => 1: Only match on 'src', not 'charged_party'. =item nonzero: Only return CDRs where duration > 0. @@ -769,8 +779,8 @@ sub psearch_cdrs { } else { - @fields = ( 'charged_party' ); - push @fields, 'src' if !$options{'disable_src'}; + push @fields, 'charged_party' unless $options{'disable_charged_party'}; + push @fields, 'src' unless $options{'disable_src'}; $hash{'freesidestatus'} = $options{'status'} if exists($options{'status'}); }