2 use base qw( FS::svc_Domain_Mixin FS::svc_PBX_Mixin
8 use vars qw( $DEBUG $me @pw_set $conf $phone_name_max
9 $passwordmin $passwordmax
12 use Scalar::Util qw( blessed );
13 use List::Util qw( min );
16 use FS::Record qw( qsearch qsearchs dbh );
17 use FS::PagedSearch qw( psearch );
18 use FS::Msgcat qw(gettext);
19 use FS::Password_Mixin; # for pw_set
23 use FS::cust_location;
26 $me = '[' . __PACKAGE__ . ']';
29 #ask FS::UID to run this stuff for us later
30 FS::UID->install_callback( sub {
32 $phone_name_max = $conf->config('svc_phone-phone_name-max_length');
33 $passwordmin = $conf->config('sip_passwordmin') || 0;
34 $passwordmax = $conf->config('sip_passwordmax') || 80;
35 @pw_set = FS::Password_Mixin->pw_set;
41 FS::svc_phone - Object methods for svc_phone records
47 $record = new FS::svc_phone \%hash;
48 $record = new FS::svc_phone { 'column' => 'value' };
50 $error = $record->insert;
52 $error = $new_record->replace($old_record);
54 $error = $record->delete;
56 $error = $record->check;
58 $error = $record->suspend;
60 $error = $record->unsuspend;
62 $error = $record->cancel;
66 An FS::svc_phone object represents a phone number. FS::svc_phone inherits
67 from FS::Record. The following fields are currently supported:
81 SIM IMSI (http://en.wikipedia.org/wiki/International_mobile_subscriber_identity)
93 Optional svcnum from svc_pbx
97 Forward destination, if it's another service. Some exports use this
102 Forwarding destination, if it's not a service.
106 Email address for virtual fax (fax-to-email) services
110 LNP Status (can be null, native, portedin, portingin, portin-reject,
111 portingout, portout-reject)
117 =item lnp_desired_due_date
121 =item lnp_other_provider
123 If porting the number in or out, name of the losing or winning provider,
126 =item lnp_other_provider_account
128 Account number of other provider. See lnp_other_provider.
130 =item lnp_reject_reason
132 See lnp_status. If lnp_status is portin-reject or portout-reject, this is an
133 optional reject reason.
137 Port identifier from porting provider, for checking status
141 Boolean (empty or `Y') indicating if a signature is required for the port
145 Boolean (empty or `Y') indicating if a copy of an existing bill is required for
150 Class of Service for E911 service (per the NENA 2.1 standard).
154 Type of Service for E911 service.
158 The L<FS::svc_circuit> record for the physical circuit that transports this
163 The hostname of the SIP server that this phone number is routed to.
173 Creates a new phone number. To add the number to the database, see L<"insert">.
175 Note that this stores the hash reference, not a distinct copy of the hash it
176 points to. You can ask the object for a copy with the I<hash> method.
180 # the new method can be inherited from FS::Record, if a table method is defined
183 my %dis2 = ( disable_inventory=>1, disable_select=>1 );
185 'name' => 'Phone number',
186 'sorts' => 'phonenum',
187 'display_weight' => 60,
188 'cancel_weight' => 80,
190 'svcnum' => 'Service',
191 'countrycode' => { label => 'Country code',
193 disable_inventory => 1,
196 'phonenum' => 'Phone number',
197 'sim_imsi' => 'IMSI', #http://en.wikipedia.org/wiki/International_mobile_subscriber_identity
198 'pin' => { label => 'Voicemail PIN', #'Personal Identification Number',
200 disable_inventory => 1,
203 'sip_password' => 'SIP password',
204 'phone_name' => 'Name',
205 'pbxsvc' => { label => 'PBX',
206 type => 'select-svc_pbx.html',
207 disable_inventory => 1,
208 disable_select => 1, #UI wonky, pry works otherwise
213 select_table => 'svc_domain',
214 select_key => 'svcnum',
215 select_label => 'domain',
216 select_allow_empty => 1,
217 disable_inventory => 1,
219 'circuit_svcnum' => { label => 'Circuit',
221 select_table => 'svc_circuit',
222 select_key => 'svcnum',
223 select_label => 'label',
224 select_allow_empty=> 1,
225 disable_inventory => 1,
228 'sms_carrierid' => { label => 'SMS Carrier',
230 select_table => 'cdr_carrier',
231 select_key => 'carrierid',
232 select_label => 'carriername',
233 disable_inventory => 1,
235 'sms_account' => { label => 'SMS Carrier Account', },
236 'max_simultaneous' => { label=>'Maximum number of simultaneous users' },
238 label => 'E911 location',
239 disable_inventory => 1,
242 'forwarddst' => { label => 'Forward Destination',
245 'forward_svcnum' => { label => 'Route to service',
248 'email' => { label => 'Email',
251 'lnp_status' => { label => 'LNP Status',
252 type => 'select-lnp_status.html',
255 'lnp_reject_reason' => {
256 label => 'LNP Reject Reason',
259 'portable' => { label => 'Portable?', %dis2, },
260 'lrn' => { label => 'LRN',
261 disable_inventory => 1,
263 'lnp_desired_due_date' =>
264 { label => 'LNP Desired Due Date', %dis2 },
266 { label => 'LNP Due Date', %dis2 },
267 'lnp_other_provider' =>
268 { label => 'LNP Other Provider',
269 disable_inventory => 1,
271 'lnp_other_provider_account' =>
272 { label => 'LNP Other Provider Account #',
276 label => 'E911 Service Class',
277 type => 'select-e911_class',
278 disable_inventory => 1,
282 label => 'E911 Service Type',
283 type => 'select-e911_type',
284 disable_inventory => 1,
289 disable_inventory => 1,
295 sub table { 'svc_phone'; }
297 sub table_dupcheck_fields { ( 'countrycode', 'phonenum' ); }
299 sub device_table { 'phone_device'; }
301 =item search_sql STRING
303 Class method which returns an SQL fragment to search for the given string.
308 my( $class, $string ) = @_;
310 #my $conf = new FS::Conf;
312 if ( $conf->exists('svc_phone-allow_alpha_phonenum') ) {
318 my $ccode = ( $conf->exists('default_phone_countrycode')
319 && $conf->config('default_phone_countrycode')
321 ? $conf->config('default_phone_countrycode')
324 $string =~ s/^$ccode//;
326 $class->search_sql_field('phonenum', $string );
331 Returns the phone number.
337 my $phonenum = $self->phonenum; #XXX format it better
338 my $label = $phonenum;
339 $label .= '@'.$self->domain if $self->domsvc;
340 $label .= ' ('.$self->phone_name.')' if $self->phone_name;
346 Adds this phone number to the database. If there is an error, returns the
347 error, otherwise returns false.
351 sub preinsert_hook_first {
352 my( $self, %options ) = @_;
354 return '' unless $options{'cust_location'};
356 #false laziness w/cust_pkg.pm... move this to location_Mixin? that would
357 #make it more of a base class than a mixin... :)
358 $options{'cust_location'}->custnum( $self->cust_svc->cust_pkg->custnum );
359 my $error = $options{'cust_location'}->find_or_insert;
360 return "inserting cust_location (transaction rolled back): $error"
362 $self->locationnum( $options{'cust_location'}->locationnum );
363 #what about on-the-fly edits? if the ui supports it?
371 Delete this record from the database.
378 local $SIG{HUP} = 'IGNORE';
379 local $SIG{INT} = 'IGNORE';
380 local $SIG{QUIT} = 'IGNORE';
381 local $SIG{TERM} = 'IGNORE';
382 local $SIG{TSTP} = 'IGNORE';
383 local $SIG{PIPE} = 'IGNORE';
385 my $oldAutoCommit = $FS::UID::AutoCommit;
386 local $FS::UID::AutoCommit = 0;
389 foreach my $phone_device ( $self->phone_device ) {
390 my $error = $phone_device->delete;
392 $dbh->rollback if $oldAutoCommit;
397 my @phone_avail = qsearch('phone_avail', { 'svcnum' => $self->svcnum } );
398 foreach my $phone_avail ( @phone_avail ) {
399 $phone_avail->svcnum('');
400 my $error = $phone_avail->replace;
402 $dbh->rollback if $oldAutoCommit;
407 my $error = $self->SUPER::delete;
409 $dbh->rollback if $oldAutoCommit;
413 $dbh->commit or die $dbh->errstr if $oldAutoCommit;
418 =item replace OLD_RECORD
420 Replaces the OLD_RECORD with this one in the database. If there is an error,
421 returns the error, otherwise returns false.
428 my $old = ( blessed($_[0]) && $_[0]->isa('FS::Record') )
435 warn "[$me] replacing $old with $new\n".
436 "\nwith options: ". Dumper(%options);
439 local $SIG{HUP} = 'IGNORE';
440 local $SIG{INT} = 'IGNORE';
441 local $SIG{QUIT} = 'IGNORE';
442 local $SIG{TERM} = 'IGNORE';
443 local $SIG{TSTP} = 'IGNORE';
444 local $SIG{PIPE} = 'IGNORE';
446 my $oldAutoCommit = $FS::UID::AutoCommit;
447 local $FS::UID::AutoCommit = 0;
450 #false laziness w/cust_pkg.pm... move this to location_Mixin? that would
451 #make it more of a base class than a mixin... :)
452 if ( $options{'cust_location'}
453 && ( ! $new->locationnum || $new->locationnum == -1 ) ) {
454 my $error = $options{'cust_location'}->insert;
456 $dbh->rollback if $oldAutoCommit;
457 return "inserting cust_location (transaction rolled back): $error";
459 $new->locationnum( $options{'cust_location'}->locationnum );
461 #what about on-the-fly edits? if the ui supports it?
463 # LNP data validation
464 return 'Invalid LNP status' # if someone does really stupid stuff
465 if ( ($old->lnp_status eq 'portingout' && $new->lnp_status eq 'portingin')
466 || ($old->lnp_status eq 'portout-reject' && $new->lnp_status eq 'portingin')
467 || ($old->lnp_status eq 'portin-reject' && $new->lnp_status eq 'portingout')
468 || ($old->lnp_status eq 'portingin' && $new->lnp_status eq 'native')
469 || ($old->lnp_status eq 'portin-reject' && $new->lnp_status eq 'native')
470 || ($old->lnp_status eq 'portingin' && $new->lnp_status eq 'portingout')
471 || ($old->lnp_status eq 'portingout' && $new->lnp_status eq 'portin-reject')
474 my $error = $new->SUPER::replace($old, %options);
476 # if this changed the e911 location, notify exports
477 if ($new->locationnum ne $old->locationnum) {
478 my $new_location = $new->cust_location_or_main;
479 my $old_location = $new->cust_location_or_main;
480 $error ||= $new->export('relocate', $new_location, $old_location);
484 $dbh->rollback if $oldAutoCommit;
485 return $error if $error;
489 $dbh->commit or die $dbh->errstr if $oldAutoCommit;
495 Called by the suspend method of FS::cust_pkg (see L<FS::cust_pkg>).
499 Called by the unsuspend method of FS::cust_pkg (see L<FS::cust_pkg>).
503 Called by the cancel method of FS::cust_pkg (see L<FS::cust_pkg>).
507 Checks all fields to make sure this is a valid phone number. If there is
508 an error, returns the error, otherwise returns false. Called by the insert
513 # the check method should currently be supplied - FS::Record contains some
514 # data checking routines
519 #my $conf = new FS::Conf;
521 my $x = $self->setfixed;
522 return $x unless ref($x);
525 my $phonenum = $self->phonenum;
526 my $phonenum_check_method;
527 if ( $conf->exists('svc_phone-allow_alpha_phonenum') ) {
528 $phonenum =~ s/\W//g;
529 $phonenum_check_method = 'ut_alpha';
531 $phonenum =~ s/\D//g;
532 $phonenum_check_method = 'ut_number';
534 $self->phonenum($phonenum);
536 $self->locationnum('') if !$self->locationnum || $self->locationnum == -1;
539 $self->ut_numbern('svcnum')
540 || $self->ut_numbern('countrycode')
541 || $self->$phonenum_check_method('phonenum')
542 || $self->ut_numbern('sim_imsi')
543 || $self->ut_anything('sip_password')
544 || $self->ut_numbern('pin')
545 || $self->ut_textn('phone_name')
546 || $self->ut_foreign_keyn('pbxsvc', 'svc_pbx', 'svcnum' )
547 || $self->ut_foreign_keyn('domsvc', 'svc_domain', 'svcnum' )
548 || $self->ut_foreign_keyn('sms_carrierid', 'cdr_carrier', 'carrierid' )
549 || $self->ut_alphan('sms_account')
550 || $self->ut_numbern('max_simultaneous')
551 || $self->ut_foreign_keyn('locationnum', 'cust_location', 'locationnum')
552 || $self->ut_numbern('forward_svcnum')
553 || $self->ut_foreign_keyn('forward_svcnum', 'cust_svc', 'svcnum')
554 || $self->ut_textn('forwarddst')
555 || $self->ut_textn('email')
556 || $self->ut_numbern('lrn')
557 || $self->ut_numbern('lnp_desired_due_date')
558 || $self->ut_numbern('lnp_due_date')
559 || $self->ut_textn('lnp_other_provider')
560 || $self->ut_textn('lnp_other_provider_account')
561 || $self->ut_enumn('lnp_status', ['','portingin','portingout','portedin',
562 'native', 'portin-reject', 'portout-reject'])
563 || $self->ut_enumn('portable', ['','Y'])
564 || $self->ut_textn('lnp_reject_reason')
565 || $self->ut_textn('lnp_portid')
566 || $self->ut_enumn('lnp_signature', ['','Y'])
567 || $self->ut_enumn('lnp_bill', ['','Y'])
568 || $self->ut_domainn('sip_server')
570 return $error if $error;
572 return 'Illegal IMSI (not 14-15 digits)' #shorter?
573 if length($self->sim_imsi)
574 && ( length($self->sim_imsi) < 14 || length($self->sim_imsi) > 15 );
576 # LNP data validation
577 return 'Cannot set LNP fields: no LNP in progress'
578 if ( ($self->lnp_desired_due_date || $self->lnp_due_date
579 || $self->lnp_other_provider || $self->lnp_other_provider_account
580 || $self->lnp_reject_reason)
581 && (!$self->lnp_status || $self->lnp_status eq 'native') );
582 return 'Cannot set LNP reject reason: no LNP in progress or status is not reject'
583 if ($self->lnp_reject_reason && (!$self->lnp_status
584 || $self->lnp_status !~ /^port(in|out)-reject$/) );
585 return 'Cannot port-out a non-portable number'
586 if (!$self->portable && $self->lnp_status eq 'portingout');
589 return 'Name ('. $self->phone_name.
590 ") is longer than $phone_name_max characters"
591 if $phone_name_max && length($self->phone_name) > $phone_name_max;
593 $self->countrycode(1) unless $self->countrycode;
595 unless ( length($self->pin) ) {
596 my $random_pin = $conf->config('svc_phone-random_pin');
597 if ( defined($random_pin) && $random_pin =~ /^\d+$/ ) {
599 join('', map int(rand(10)), 0..($random_pin-1))
604 if ( length($self->sip_password) ) {
606 return "SIP password must be longer than $passwordmin characters"
607 if length($self->sip_password) < $passwordmin;
608 return "SIP password must be shorter than $passwordmax characters"
609 if length($self->sip_password) > $passwordmax;
611 } elsif ( $part_svc->part_svc_column('sip_password')->columnflag ne 'F' ) {
615 join('', map $pw_set[ int(rand $#pw_set) ], (1..min($passwordmax,16)) )
620 if ($self->e911_class and !exists(e911_classes()->{$self->e911_class})) {
621 return "undefined e911 class '".$self->e911_class."'";
623 if ($self->e911_type and !exists(e911_types()->{$self->e911_type})) {
624 return "undefined e911 type '".$self->e911_type."'";
630 =item _check duplicate
632 Internal method to check for duplicate phone numers.
636 #false laziness w/svc_acct.pm's _check_duplicate.
637 sub _check_duplicate {
640 my $global_unique = $conf->config('global_unique-phonenum') || 'none';
641 return '' if $global_unique eq 'disabled';
646 grep { !$self->svcnum || $_->svcnum != $self->svcnum }
647 qsearch( 'svc_phone', {
648 'countrycode' => $self->countrycode,
649 'phonenum' => $self->phonenum,
652 return gettext('phonenum_in_use')
653 if $global_unique eq 'countrycode+phonenum' && @dup_ccphonenum;
655 my $part_svc = qsearchs('part_svc', { 'svcpart' => $self->svcpart } );
656 unless ( $part_svc ) {
657 return 'unknown svcpart '. $self->svcpart;
660 if ( @dup_ccphonenum ) {
662 my $exports = FS::part_export::export_info('svc_phone');
663 my %conflict_ccphonenum_svcpart = ( $self->svcpart => 'SELF', );
665 foreach my $part_export ( $part_svc->part_export ) {
667 #this will catch to the same exact export
668 my @svcparts = map { $_->svcpart } $part_export->export_svc;
670 $conflict_ccphonenum_svcpart{$_} = $part_export->exportnum
675 foreach my $dup_ccphonenum ( @dup_ccphonenum ) {
676 my $dup_svcpart = $dup_ccphonenum->cust_svc->svcpart;
677 if ( exists($conflict_ccphonenum_svcpart{$dup_svcpart}) ) {
678 return "duplicate phone number ".
679 $self->countrycode. ' '. $self->phonenum.
680 ": conflicts with svcnum ". $dup_ccphonenum->svcnum.
681 " via exportnum ". $conflict_ccphonenum_svcpart{$dup_svcpart};
693 Checks the supplied PIN against the PIN in the database. Returns true for a
694 sucessful authentication, false if no match.
699 my($self, $check_pin) = @_;
700 length($self->pin) && $check_pin eq $self->pin;
709 #XXX Session-Timeout! holy shit, need rlm_perl to ask for this in realtime
721 #my $conf = new FS::Conf;
724 if ( $conf->config('svc_phone-radius-password') eq 'countrycode_phonenum' ) {
725 $password = $self->countrycode. $self->phonenum;
727 $password = $conf->config('svc_phone-radius-default_password');
729 $check{'User-Password'} = $password;
738 =item sms_cdr_carrier
740 Returns the L<FS::cdr_carrier> assigned as the SMS carrier for this phone.
744 sub sms_cdr_carrier {
746 return '' unless $self->sms_carrierid;
747 qsearchs('cdr_carrier', { 'carrierid' => $self->sms_carrierid } );
750 =item sms_carriername
752 Returns the name of the SMS carrier, or an empty string if there isn't one.
756 sub sms_carriername {
758 my $cdr_carrier = $self->sms_cdr_carrier or return '';
759 $cdr_carrier->carriername;
764 Returns the L<FS::svc_circuit> assigned as the trunk for this phone line.
768 Returns the label of the circuit (the part_svc label followed by the
769 circuit ID), or an empty string if there isn't one.
775 my $svcnum = $self->get('circuit_svcnum') or return '';
776 return FS::svc_circuit->by_key($svcnum);
781 my $svc_circuit = $self->svc_circuit or return '';
782 return join(' ', $svc_circuit->part_svc->svc, $svc_circuit->circuit_id);
787 Returns any FS::phone_device records associated with this service.
791 #override location_Mixin version cause we want to try the cust_pkg location
792 #in between us and cust_main
793 # XXX what to do in the unlinked case??? return a pseudo-object that returns
795 sub cust_location_or_main {
797 return $self->cust_location if $self->locationnum;
798 my $cust_pkg = $self->cust_svc->cust_pkg;
799 $cust_pkg ? $cust_pkg->cust_location_or_main : '';
802 =item phone_name_or_cust
804 Returns the C<phone_name> field if it has a value, or the package contact
805 name if there is one, or the customer contact name.
809 sub phone_name_or_cust {
811 if ( $self->phone_name ) {
812 return $self->phone_name;
814 my $cust_pkg = $self->cust_svc->cust_pkg or return '';
815 if ( $cust_pkg->contactnum ) {
816 return $cust_pkg->contact_obj->firstlast;
818 return $cust_pkg->cust_main->name_short;
822 =item psearch_cdrs OPTIONS
824 Returns a paged search (L<FS::PagedSearch>) for Call Detail Records
825 associated with this service. By default, "associated with" means that
826 either the "src" or the "charged_party" field of the CDR matches the
827 "phonenum" field of the service. To access the CDRs themselves, call
828 "->fetch" on the resulting object.
832 Accepts the following options:
834 =item for_update => 1: SELECT the CDRs "FOR UPDATE".
836 =item status => "" (or "processing-tiered", "done"): Return only CDRs with that processing status.
838 =item inbound => 1: Return CDRs for inbound calls (that is, those that match
839 on 'dst'). With "status", will filter on inbound processing status.
841 =item default_prefix => "XXX": Also accept the phone number of the service prepended
842 with the chosen prefix.
844 =item begin, end: Start and end of a date range, as unix timestamp.
846 =item cdrtypenum: Only return CDRs with this type.
848 =item calltypenum: Only return CDRs with this call type.
850 =item disable_src => 1: Only match on 'charged_party', not 'src'.
852 =item disable_charged_party => 1: Only match on 'src', not 'charged_party'.
854 =item nonzero: Only return CDRs where duration > 0.
856 =item by_svcnum: not supported for svc_phone
858 =item billsec_sum: Instead of returning all of the CDRs, return a single
859 record (as an L<FS::cdr> object) with the sum of the 'billsec' field over
860 the entire result set.
867 my($self, %options) = @_;
869 unless ( $options{'billsec_sum'} ) {
870 #fixes a weird sequential scan of the whole cdr table on startdate, but only
871 # for a few charged_party values here and there.
872 # Pg 9.1 only? need to retest on 9.4, 9.6
873 dbh->do('SET enable_indexscan TO OFF');
880 if ( $options{'inbound'} ) {
883 if ( exists($options{'status'}) ) {
884 my $status = $options{'status'};
886 push @where, 'EXISTS ( SELECT 1 FROM cdr_termination '.
887 'WHERE cdr.acctid = cdr_termination.acctid '.
888 "AND cdr_termination.status = '$status' ". #quoting kludge
889 'AND cdr_termination.termpart = 1 )';
891 push @where, 'NOT EXISTS ( SELECT 1 FROM cdr_termination '.
892 'WHERE cdr.acctid = cdr_termination.acctid '.
893 'AND cdr_termination.termpart = 1 )';
899 push @fields, 'charged_party' unless $options{'disable_charged_party'};
900 push @fields, 'src' unless $options{'disable_src'};
901 $hash{'freesidestatus'} = $options{'status'}
902 if exists($options{'status'});
905 if ($options{'cdrtypenum'}) {
906 $hash{'cdrtypenum'} = $options{'cdrtypenum'};
908 if ($options{'calltypenum'}) {
909 $hash{'calltypenum'} = $options{'calltypenum'};
912 my $for_update = $options{'for_update'} ? 'FOR UPDATE' : '';
914 my $number = $self->phonenum;
916 my $prefix = $options{'default_prefix'};
918 my @orwhere = map " $_ = '$number' ", @fields;
919 push @orwhere, map " $_ = '$prefix$number' ", @fields
920 if defined($prefix) && length($prefix);
921 if ( $prefix && $prefix =~ /^\+(\d+)$/ ) {
922 push @orwhere, map " $_ = '$1$number' ", @fields
925 push @where, ' ( '. join(' OR ', @orwhere ). ' ) ';
927 if ( $options{'begin'} ) {
928 push @where, 'startdate >= '. $options{'begin'};
930 if ( $options{'end'} ) {
931 push @where, 'startdate < '. $options{'end'};
933 if ( $options{'nonzero'} ) {
934 push @where, 'duration > 0';
937 my $extra_sql = ( keys(%hash) ? ' AND ' : ' WHERE ' ). join(' AND ', @where );
942 'extra_sql' => $extra_sql,
943 'order_by' => $options{'billsec_sum'} ? '' : "ORDER BY startdate $for_update",
944 'select' => $options{'billsec_sum'} ? 'sum(billsec) as billsec_sum' : '*',
948 =item get_cdrs (DEPRECATED)
950 Like psearch_cdrs, but returns all the L<FS::cdr> objects at once, in a
951 single list. Arguments are the same as for psearch_cdrs. This can take
952 an unreasonably large amount of memory and is best avoided.
958 my $psearch = $self->psearch_cdrs(@_);
959 qsearch ( $psearch->{query} )
964 Takes the same options as psearch_cdrs, but returns a single row containing
965 "count" (the number of CDRs) and the sums of the following fields: duration,
966 billsec, rated_price, rated_seconds, rated_minutes.
968 Note that if any calls are not rated, their rated_* fields will be null.
969 If you want to use those fields, pass the 'status' option to limit to
970 calls that have been rated. This is intentional; please don't "fix" it.
976 my $psearch = $self->psearch_cdrs(@_);
977 $psearch->{query}->{'select'} = join(',',
979 map { "SUM($_) AS $_" }
980 qw(duration billsec rated_price rated_seconds rated_minutes)
983 $psearch->{query}->{'extra_sql'} =~ s/ ORDER BY.*$//;
984 qsearchs ( $psearch->{query} );
995 Returns a hashref of allowed values and descriptions for the C<e911_class>
1000 Returns a hashref of allowed values and descriptions for the C<e911_type>
1006 tie my %x, 'Tie::IxHash', (
1009 3 => 'Residence PBX',
1010 4 => 'Business PBX',
1012 6 => 'Coin 1 Way out',
1015 9 => 'Residence OPX',
1016 0 => 'Business OPX',
1017 A => 'Customer Operated Coin Telephone',
1019 G => 'Wireless Phase I',
1020 H => 'Wireless Phase II',
1021 I => 'Wireless Phase II with Phase I information',
1022 V => 'VoIP Services Default',
1023 C => 'VoIP Residence',
1024 D => 'VoIP Business',
1025 E => 'VoIP Coin/Pay Phone',
1026 F => 'VoIP Wireless',
1027 J => 'VoIP Nomadic',
1028 K => 'VoIP Enterprise Services',
1035 tie my %x, 'Tie::IxHash', (
1036 0 => 'Not FX nor Non-Published',
1037 1 => 'FX in 911 serving area',
1038 2 => 'FX outside 911 serving area',
1039 3 => 'Non-Published',
1040 4 => 'Non-Published FX in serving area',
1041 5 => 'Non-Published FX outside serving area',
1042 6 => 'Local Ported Number',
1043 7 => 'Interim Ported Number',
1054 L<FS::svc_Common>, L<FS::Record>, L<FS::cust_svc>, L<FS::part_svc>,
1055 L<FS::cust_pkg>, schema.html from the base documentation.