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);
22 use FS::cust_location;
25 $me = '[' . __PACKAGE__ . ']';
29 @pw_set = ( 'a'..'k', 'm','n', 'p-z', 'A'..'N', 'P'..'Z' , '2'..'9' );
31 #ask FS::UID to run this stuff for us later
32 FS::UID->install_callback( sub {
34 $phone_name_max = $conf->config('svc_phone-phone_name-max_length');
35 $passwordmin = $conf->config('sip_passwordmin') || 0;
36 $passwordmax = $conf->config('sip_passwordmax') || 80;
42 FS::svc_phone - Object methods for svc_phone records
48 $record = new FS::svc_phone \%hash;
49 $record = new FS::svc_phone { 'column' => 'value' };
51 $error = $record->insert;
53 $error = $new_record->replace($old_record);
55 $error = $record->delete;
57 $error = $record->check;
59 $error = $record->suspend;
61 $error = $record->unsuspend;
63 $error = $record->cancel;
67 An FS::svc_phone object represents a phone number. FS::svc_phone inherits
68 from FS::Record. The following fields are currently supported:
82 SIM IMSI (http://en.wikipedia.org/wiki/International_mobile_subscriber_identity)
94 Optional svcnum from svc_pbx
98 Forwarding destination
102 Email address for virtual fax (fax-to-email) services
106 LNP Status (can be null, native, portedin, portingin, portin-reject,
107 portingout, portout-reject)
113 =item lnp_desired_due_date
117 =item lnp_other_provider
119 If porting the number in or out, name of the losing or winning provider,
122 =item lnp_other_provider_account
124 Account number of other provider. See lnp_other_provider.
126 =item lnp_reject_reason
128 See lnp_status. If lnp_status is portin-reject or portout-reject, this is an
129 optional reject reason.
133 Class of Service for E911 service (per the NENA 2.1 standard).
137 Type of Service for E911 service.
141 The L<FS::svc_circuit> record for the physical circuit that transports this
146 The hostname of the SIP server that this phone number is routed to.
156 Creates a new phone number. To add the number to the database, see L<"insert">.
158 Note that this stores the hash reference, not a distinct copy of the hash it
159 points to. You can ask the object for a copy with the I<hash> method.
163 # the new method can be inherited from FS::Record, if a table method is defined
166 my %dis2 = ( disable_inventory=>1, disable_select=>1 );
168 'name' => 'Phone number',
169 'sorts' => 'phonenum',
170 'display_weight' => 60,
171 'cancel_weight' => 80,
173 'svcnum' => 'Service',
174 'countrycode' => { label => 'Country code',
176 disable_inventory => 1,
179 'phonenum' => 'Phone number',
180 'sim_imsi' => 'IMSI', #http://en.wikipedia.org/wiki/International_mobile_subscriber_identity
181 'pin' => { label => 'Voicemail PIN', #'Personal Identification Number',
183 disable_inventory => 1,
186 'sip_password' => 'SIP password',
187 'phone_name' => 'Name',
188 'pbxsvc' => { label => 'PBX',
189 type => 'select-svc_pbx.html',
190 disable_inventory => 1,
191 disable_select => 1, #UI wonky, pry works otherwise
196 select_table => 'svc_domain',
197 select_key => 'svcnum',
198 select_label => 'domain',
199 disable_inventory => 1,
201 'circuit_svcnum' => { label => 'Circuit',
203 select_table => 'svc_domain',
204 select_key => 'svcnum',
205 select_label => 'circuit_label',
206 disable_inventory => 1,
209 'sms_carrierid' => { label => 'SMS Carrier',
211 select_table => 'cdr_carrier',
212 select_key => 'carrierid',
213 select_label => 'carriername',
214 disable_inventory => 1,
216 'sms_account' => { label => 'SMS Carrier Account', },
217 'max_simultaneous' => { label=>'Maximum number of simultaneous users' },
219 label => 'E911 location',
220 disable_inventory => 1,
223 'forwarddst' => { label => 'Forward Destination',
226 'email' => { label => 'Email',
229 'lnp_status' => { label => 'LNP Status',
230 type => 'select-lnp_status.html',
233 'lnp_reject_reason' => {
234 label => 'LNP Reject Reason',
237 'portable' => { label => 'Portable?', %dis2, },
238 'lrn' => { label => 'LRN',
239 disable_inventory => 1,
241 'lnp_desired_due_date' =>
242 { label => 'LNP Desired Due Date', %dis2 },
244 { label => 'LNP Due Date', %dis2 },
245 'lnp_other_provider' =>
246 { label => 'LNP Other Provider',
247 disable_inventory => 1,
249 'lnp_other_provider_account' =>
250 { label => 'LNP Other Provider Account #',
254 label => 'E911 Service Class',
255 type => 'select-e911_class',
256 disable_inventory => 1,
260 label => 'E911 Service Type',
261 type => 'select-e911_type',
262 disable_inventory => 1,
273 sub table { 'svc_phone'; }
275 sub table_dupcheck_fields { ( 'countrycode', 'phonenum' ); }
277 =item search_sql STRING
279 Class method which returns an SQL fragment to search for the given string.
284 my( $class, $string ) = @_;
286 #my $conf = new FS::Conf;
288 if ( $conf->exists('svc_phone-allow_alpha_phonenum') ) {
294 my $ccode = ( $conf->exists('default_phone_countrycode')
295 && $conf->config('default_phone_countrycode')
297 ? $conf->config('default_phone_countrycode')
300 $string =~ s/^$ccode//;
302 $class->search_sql_field('phonenum', $string );
307 Returns the phone number.
313 my $phonenum = $self->phonenum; #XXX format it better
314 my $label = $phonenum;
315 $label .= '@'.$self->domain if $self->domsvc;
316 $label .= ' ('.$self->phone_name.')' if $self->phone_name;
322 Adds this phone number to the database. If there is an error, returns the
323 error, otherwise returns false.
332 warn "[$me] insert called on $self: ". Dumper($self).
333 "\nwith options: ". Dumper(%options);
336 local $SIG{HUP} = 'IGNORE';
337 local $SIG{INT} = 'IGNORE';
338 local $SIG{QUIT} = 'IGNORE';
339 local $SIG{TERM} = 'IGNORE';
340 local $SIG{TSTP} = 'IGNORE';
341 local $SIG{PIPE} = 'IGNORE';
343 my $oldAutoCommit = $FS::UID::AutoCommit;
344 local $FS::UID::AutoCommit = 0;
347 #false laziness w/cust_pkg.pm... move this to location_Mixin? that would
348 #make it more of a base class than a mixin... :)
349 if ( $options{'cust_location'} ) {
350 my $error = $options{'cust_location'}->find_or_insert;
352 $dbh->rollback if $oldAutoCommit;
353 return "inserting cust_location (transaction rolled back): $error";
355 $self->locationnum( $options{'cust_location'}->locationnum );
357 #what about on-the-fly edits? if the ui supports it?
359 my $error = $self->SUPER::insert(%options);
361 $dbh->rollback if $oldAutoCommit;
365 $dbh->commit or die $dbh->errstr if $oldAutoCommit;
372 Delete this record from the database.
379 local $SIG{HUP} = 'IGNORE';
380 local $SIG{INT} = 'IGNORE';
381 local $SIG{QUIT} = 'IGNORE';
382 local $SIG{TERM} = 'IGNORE';
383 local $SIG{TSTP} = 'IGNORE';
384 local $SIG{PIPE} = 'IGNORE';
386 my $oldAutoCommit = $FS::UID::AutoCommit;
387 local $FS::UID::AutoCommit = 0;
390 foreach my $phone_device ( $self->phone_device ) {
391 my $error = $phone_device->delete;
393 $dbh->rollback if $oldAutoCommit;
398 my @phone_avail = qsearch('phone_avail', { 'svcnum' => $self->svcnum } );
399 foreach my $phone_avail ( @phone_avail ) {
400 $phone_avail->svcnum('');
401 my $error = $phone_avail->replace;
403 $dbh->rollback if $oldAutoCommit;
408 my $error = $self->SUPER::delete;
410 $dbh->rollback if $oldAutoCommit;
414 $dbh->commit or die $dbh->errstr if $oldAutoCommit;
419 =item replace OLD_RECORD
421 Replaces the OLD_RECORD with this one in the database. If there is an error,
422 returns the error, otherwise returns false.
429 my $old = ( blessed($_[0]) && $_[0]->isa('FS::Record') )
436 warn "[$me] replacing $old with $new\n".
437 "\nwith options: ". Dumper(%options);
440 local $SIG{HUP} = 'IGNORE';
441 local $SIG{INT} = 'IGNORE';
442 local $SIG{QUIT} = 'IGNORE';
443 local $SIG{TERM} = 'IGNORE';
444 local $SIG{TSTP} = 'IGNORE';
445 local $SIG{PIPE} = 'IGNORE';
447 my $oldAutoCommit = $FS::UID::AutoCommit;
448 local $FS::UID::AutoCommit = 0;
451 #false laziness w/cust_pkg.pm... move this to location_Mixin? that would
452 #make it more of a base class than a mixin... :)
453 if ( $options{'cust_location'}
454 && ( ! $new->locationnum || $new->locationnum == -1 ) ) {
455 my $error = $options{'cust_location'}->insert;
457 $dbh->rollback if $oldAutoCommit;
458 return "inserting cust_location (transaction rolled back): $error";
460 $new->locationnum( $options{'cust_location'}->locationnum );
462 #what about on-the-fly edits? if the ui supports it?
464 # LNP data validation
465 return 'Invalid LNP status' # if someone does really stupid stuff
466 if ( ($old->lnp_status eq 'portingout' && $new->lnp_status eq 'portingin')
467 || ($old->lnp_status eq 'portout-reject' && $new->lnp_status eq 'portingin')
468 || ($old->lnp_status eq 'portin-reject' && $new->lnp_status eq 'portingout')
469 || ($old->lnp_status eq 'portingin' && $new->lnp_status eq 'native')
470 || ($old->lnp_status eq 'portin-reject' && $new->lnp_status eq 'native')
471 || ($old->lnp_status eq 'portingin' && $new->lnp_status eq 'portingout')
472 || ($old->lnp_status eq 'portingout' && $new->lnp_status eq 'portin-reject')
475 my $error = $new->SUPER::replace($old, %options);
477 # if this changed the e911 location, notify exports
478 if ($new->locationnum ne $old->locationnum) {
479 my $new_location = $new->cust_location_or_main;
480 my $old_location = $new->cust_location_or_main;
481 $error ||= $new->export('relocate', $new_location, $old_location);
485 $dbh->rollback if $oldAutoCommit;
486 return $error if $error;
490 $dbh->commit or die $dbh->errstr if $oldAutoCommit;
496 Called by the suspend method of FS::cust_pkg (see L<FS::cust_pkg>).
500 Called by the unsuspend method of FS::cust_pkg (see L<FS::cust_pkg>).
504 Called by the cancel method of FS::cust_pkg (see L<FS::cust_pkg>).
508 Checks all fields to make sure this is a valid phone number. If there is
509 an error, returns the error, otherwise returns false. Called by the insert
514 # the check method should currently be supplied - FS::Record contains some
515 # data checking routines
520 #my $conf = new FS::Conf;
522 my $x = $self->setfixed;
523 return $x unless ref($x);
526 my $phonenum = $self->phonenum;
527 my $phonenum_check_method;
528 if ( $conf->exists('svc_phone-allow_alpha_phonenum') ) {
529 $phonenum =~ s/\W//g;
530 $phonenum_check_method = 'ut_alpha';
532 $phonenum =~ s/\D//g;
533 $phonenum_check_method = 'ut_number';
535 $self->phonenum($phonenum);
537 $self->locationnum('') if !$self->locationnum || $self->locationnum == -1;
540 $self->ut_numbern('svcnum')
541 || $self->ut_numbern('countrycode')
542 || $self->$phonenum_check_method('phonenum')
543 || $self->ut_numbern('sim_imsi')
544 || $self->ut_anything('sip_password')
545 || $self->ut_numbern('pin')
546 || $self->ut_textn('phone_name')
547 || $self->ut_foreign_keyn('pbxsvc', 'svc_pbx', 'svcnum' )
548 || $self->ut_foreign_keyn('domsvc', 'svc_domain', 'svcnum' )
549 || $self->ut_foreign_keyn('sms_carrierid', 'cdr_carrier', 'carrierid' )
550 || $self->ut_alphan('sms_account')
551 || $self->ut_numbern('max_simultaneous')
552 || $self->ut_foreign_keyn('locationnum', 'cust_location', 'locationnum')
553 || $self->ut_numbern('forwarddst')
554 || $self->ut_textn('email')
555 || $self->ut_numbern('lrn')
556 || $self->ut_numbern('lnp_desired_due_date')
557 || $self->ut_numbern('lnp_due_date')
558 || $self->ut_textn('lnp_other_provider')
559 || $self->ut_textn('lnp_other_provider_account')
560 || $self->ut_enumn('lnp_status', ['','portingin','portingout','portedin',
561 'native', 'portin-reject', 'portout-reject'])
562 || $self->ut_enumn('portable', ['','Y'])
563 || $self->ut_textn('lnp_reject_reason')
564 || $self->ut_domainn('sip_server')
566 return $error if $error;
568 return 'Illegal IMSI (not 14-15 digits)' #shorter?
569 if length($self->sim_imsi)
570 && ( length($self->sim_imsi) < 14 || length($self->sim_imsi) > 15 );
572 # LNP data validation
573 return 'Cannot set LNP fields: no LNP in progress'
574 if ( ($self->lnp_desired_due_date || $self->lnp_due_date
575 || $self->lnp_other_provider || $self->lnp_other_provider_account
576 || $self->lnp_reject_reason)
577 && (!$self->lnp_status || $self->lnp_status eq 'native') );
578 return 'Cannot set LNP reject reason: no LNP in progress or status is not reject'
579 if ($self->lnp_reject_reason && (!$self->lnp_status
580 || $self->lnp_status !~ /^port(in|out)-reject$/) );
581 return 'Cannot port-out a non-portable number'
582 if (!$self->portable && $self->lnp_status eq 'portingout');
585 return 'Name ('. $self->phone_name.
586 ") is longer than $phone_name_max characters"
587 if $phone_name_max && length($self->phone_name) > $phone_name_max;
589 $self->countrycode(1) unless $self->countrycode;
591 unless ( length($self->pin) ) {
592 my $random_pin = $conf->config('svc_phone-random_pin');
593 if ( defined($random_pin) && $random_pin =~ /^\d+$/ ) {
595 join('', map int(rand(10)), 0..($random_pin-1))
600 if ( length($self->sip_password) ) {
602 return "SIP password must be longer than $passwordmin characters"
603 if length($self->sip_password) < $passwordmin;
604 return "SIP password must be shorter than $passwordmax characters"
605 if length($self->sip_password) > $passwordmax;
607 } elsif ( $part_svc->part_svc_column('sip_password')->columnflag ne 'F' ) {
611 join('', map $pw_set[ int(rand $#pw_set) ], (1..min($passwordmax,16)) )
616 if ($self->e911_class and !exists(e911_classes()->{$self->e911_class})) {
617 return "undefined e911 class '".$self->e911_class."'";
619 if ($self->e911_type and !exists(e911_types()->{$self->e911_type})) {
620 return "undefined e911 type '".$self->e911_type."'";
626 =item _check duplicate
628 Internal method to check for duplicate phone numers.
632 #false laziness w/svc_acct.pm's _check_duplicate.
633 sub _check_duplicate {
636 my $global_unique = $conf->config('global_unique-phonenum') || 'none';
637 return '' if $global_unique eq 'disabled';
642 grep { !$self->svcnum || $_->svcnum != $self->svcnum }
643 qsearch( 'svc_phone', {
644 'countrycode' => $self->countrycode,
645 'phonenum' => $self->phonenum,
648 return gettext('phonenum_in_use')
649 if $global_unique eq 'countrycode+phonenum' && @dup_ccphonenum;
651 my $part_svc = qsearchs('part_svc', { 'svcpart' => $self->svcpart } );
652 unless ( $part_svc ) {
653 return 'unknown svcpart '. $self->svcpart;
656 if ( @dup_ccphonenum ) {
658 my $exports = FS::part_export::export_info('svc_phone');
659 my %conflict_ccphonenum_svcpart = ( $self->svcpart => 'SELF', );
661 foreach my $part_export ( $part_svc->part_export ) {
663 #this will catch to the same exact export
664 my @svcparts = map { $_->svcpart } $part_export->export_svc;
666 $conflict_ccphonenum_svcpart{$_} = $part_export->exportnum
671 foreach my $dup_ccphonenum ( @dup_ccphonenum ) {
672 my $dup_svcpart = $dup_ccphonenum->cust_svc->svcpart;
673 if ( exists($conflict_ccphonenum_svcpart{$dup_svcpart}) ) {
674 return "duplicate phone number ".
675 $self->countrycode. ' '. $self->phonenum.
676 ": conflicts with svcnum ". $dup_ccphonenum->svcnum.
677 " via exportnum ". $conflict_ccphonenum_svcpart{$dup_svcpart};
689 Checks the supplied PIN against the PIN in the database. Returns true for a
690 sucessful authentication, false if no match.
695 my($self, $check_pin) = @_;
696 length($self->pin) && $check_pin eq $self->pin;
705 #XXX Session-Timeout! holy shit, need rlm_perl to ask for this in realtime
717 #my $conf = new FS::Conf;
720 if ( $conf->config('svc_phone-radius-password') eq 'countrycode_phonenum' ) {
721 $password = $self->countrycode. $self->phonenum;
723 $password = $conf->config('svc_phone-radius-default_password');
725 $check{'User-Password'} = $password;
734 =item sms_cdr_carrier
736 Returns the L<FS::cdr_carrier> assigned as the SMS carrier for this phone.
740 sub sms_cdr_carrier {
742 return '' unless $self->sms_carrierid;
743 qsearchs('cdr_carrier', { 'carrierid' => $self->sms_carrierid } );
746 =item sms_carriername
748 Returns the name of the SMS carrier, or an empty string if there isn't one.
752 sub sms_carriername {
754 my $cdr_carrier = $self->sms_cdr_carrier or return '';
755 $cdr_carrier->carriername;
760 Returns the L<FS::svc_circuit> assigned as the trunk for this phone line.
764 Returns the label of the circuit (the part_svc label followed by the
765 circuit ID), or an empty string if there isn't one.
771 my $svcnum = $self->get('circuit_svcnum') or return '';
772 return FS::svc_circuit->by_key($svcnum);
777 my $svc_circuit = $self->svc_circuit or return '';
778 return join(' ', $svc_circuit->part_svc->svc, $svc_circuit->circuit_id);
783 Returns any FS::phone_device records associated with this service.
787 #override location_Mixin version cause we want to try the cust_pkg location
788 #in between us and cust_main
789 # XXX what to do in the unlinked case??? return a pseudo-object that returns
791 sub cust_location_or_main {
793 return $self->cust_location if $self->locationnum;
794 my $cust_pkg = $self->cust_svc->cust_pkg;
795 $cust_pkg ? $cust_pkg->cust_location_or_main : '';
798 =item phone_name_or_cust
800 Returns the C<phone_name> field if it has a value, or the package contact
801 name if there is one, or the customer contact name.
805 sub phone_name_or_cust {
807 if ( $self->phone_name ) {
808 return $self->phone_name;
810 my $cust_pkg = $self->cust_svc->cust_pkg or return '';
811 if ( $cust_pkg->contactnum ) {
812 return $cust_pkg->contact->firstlast;
814 return $cust_pkg->cust_main->name_short;
818 =item psearch_cdrs OPTIONS
820 Returns a paged search (L<FS::PagedSearch>) for Call Detail Records
821 associated with this service. By default, "associated with" means that
822 either the "src" or the "charged_party" field of the CDR matches the
823 "phonenum" field of the service. To access the CDRs themselves, call
824 "->fetch" on the resulting object.
828 Accepts the following options:
830 =item for_update => 1: SELECT the CDRs "FOR UPDATE".
832 =item status => "" (or "processing-tiered", "done"): Return only CDRs with that processing status.
834 =item inbound => 1: Return CDRs for inbound calls (that is, those that match
835 on 'dst'). With "status", will filter on inbound processing status.
837 =item default_prefix => "XXX": Also accept the phone number of the service prepended
838 with the chosen prefix.
840 =item begin, end: Start and end of a date range, as unix timestamp.
842 =item cdrtypenum: Only return CDRs with this type.
844 =item calltypenum: Only return CDRs with this call type.
846 =item disable_src => 1: Only match on 'charged_party', not 'src'.
848 =item disable_charged_party => 1: Only match on 'src', not 'charged_party'.
850 =item nonzero: Only return CDRs where duration > 0.
852 =item by_svcnum: not supported for svc_phone
854 =item billsec_sum: Instead of returning all of the CDRs, return a single
855 record (as an L<FS::cdr> object) with the sum of the 'billsec' field over
856 the entire result set.
864 my($self, %options) = @_;
869 if ( $options{'inbound'} ) {
872 if ( exists($options{'status'}) ) {
873 my $status = $options{'status'};
875 push @where, 'EXISTS ( SELECT 1 FROM cdr_termination '.
876 'WHERE cdr.acctid = cdr_termination.acctid '.
877 "AND cdr_termination.status = '$status' ". #quoting kludge
878 'AND cdr_termination.termpart = 1 )';
880 push @where, 'NOT EXISTS ( SELECT 1 FROM cdr_termination '.
881 'WHERE cdr.acctid = cdr_termination.acctid '.
882 'AND cdr_termination.termpart = 1 )';
888 push @fields, 'charged_party' unless $options{'disable_charged_party'};
889 push @fields, 'src' unless $options{'disable_src'};
890 $hash{'freesidestatus'} = $options{'status'}
891 if exists($options{'status'});
894 if ($options{'cdrtypenum'}) {
895 $hash{'cdrtypenum'} = $options{'cdrtypenum'};
897 if ($options{'calltypenum'}) {
898 $hash{'calltypenum'} = $options{'calltypenum'};
901 my $for_update = $options{'for_update'} ? 'FOR UPDATE' : '';
903 my $number = $self->phonenum;
905 my $prefix = $options{'default_prefix'};
907 my @orwhere = map " $_ = '$number' ", @fields;
908 push @orwhere, map " $_ = '$prefix$number' ", @fields
909 if defined($prefix) && length($prefix);
910 if ( $prefix && $prefix =~ /^\+(\d+)$/ ) {
911 push @orwhere, map " $_ = '$1$number' ", @fields
914 push @where, ' ( '. join(' OR ', @orwhere ). ' ) ';
916 if ( $options{'begin'} ) {
917 push @where, 'startdate >= '. $options{'begin'};
919 if ( $options{'end'} ) {
920 push @where, 'startdate < '. $options{'end'};
922 if ( $options{'nonzero'} ) {
923 push @where, 'duration > 0';
926 my $extra_sql = ( keys(%hash) ? ' AND ' : ' WHERE ' ). join(' AND ', @where );
931 'extra_sql' => $extra_sql,
932 'order_by' => $options{'billsec_sum'} ? '' : "ORDER BY startdate $for_update",
933 'select' => $options{'billsec_sum'} ? 'sum(billsec) as billsec_sum' : '*',
937 =item get_cdrs (DEPRECATED)
939 Like psearch_cdrs, but returns all the L<FS::cdr> objects at once, in a
940 single list. Arguments are the same as for psearch_cdrs. This can take
941 an unreasonably large amount of memory and is best avoided.
947 my $psearch = $self->psearch_cdrs(@_);
948 qsearch ( $psearch->{query} )
953 Takes the same options as psearch_cdrs, but returns a single row containing
954 "count" (the number of CDRs) and the sums of the following fields: duration,
955 billsec, rated_price, rated_seconds, rated_minutes.
957 Note that if any calls are not rated, their rated_* fields will be null.
958 If you want to use those fields, pass the 'status' option to limit to
959 calls that have been rated. This is intentional; please don't "fix" it.
965 my $psearch = $self->psearch_cdrs(@_);
966 $psearch->{query}->{'select'} = join(',',
968 map { "SUM($_) AS $_" }
969 qw(duration billsec rated_price rated_seconds rated_minutes)
972 $psearch->{query}->{'extra_sql'} =~ s/ ORDER BY.*$//;
973 qsearchs ( $psearch->{query} );
984 Returns a hashref of allowed values and descriptions for the C<e911_class>
989 Returns a hashref of allowed values and descriptions for the C<e911_type>
995 tie my %x, 'Tie::IxHash', (
998 3 => 'Residence PBX',
1001 6 => 'Coin 1 Way out',
1004 9 => 'Residence OPX',
1005 0 => 'Business OPX',
1006 A => 'Customer Operated Coin Telephone',
1008 G => 'Wireless Phase I',
1009 H => 'Wireless Phase II',
1010 I => 'Wireless Phase II with Phase I information',
1011 V => 'VoIP Services Default',
1012 C => 'VoIP Residence',
1013 D => 'VoIP Business',
1014 E => 'VoIP Coin/Pay Phone',
1015 F => 'VoIP Wireless',
1016 J => 'VoIP Nomadic',
1017 K => 'VoIP Enterprise Services',
1024 tie my %x, 'Tie::IxHash', (
1025 0 => 'Not FX nor Non-Published',
1026 1 => 'FX in 911 serving area',
1027 2 => 'FX outside 911 serving area',
1028 3 => 'Non-Published',
1029 4 => 'Non-Published FX in serving area',
1030 5 => 'Non-Published FX outside serving area',
1031 6 => 'Local Ported Number',
1032 7 => 'Interim Ported Number',
1043 L<FS::svc_Common>, L<FS::Record>, L<FS::cust_svc>, L<FS::part_svc>,
1044 L<FS::cust_pkg>, schema.html from the base documentation.