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 select_allow_empty => 1,
200 disable_inventory => 1,
202 'circuit_svcnum' => { label => 'Circuit',
204 select_table => 'svc_domain',
205 select_key => 'svcnum',
206 select_label => 'circuit_label',
207 disable_inventory => 1,
210 'sms_carrierid' => { label => 'SMS Carrier',
212 select_table => 'cdr_carrier',
213 select_key => 'carrierid',
214 select_label => 'carriername',
215 disable_inventory => 1,
217 'sms_account' => { label => 'SMS Carrier Account', },
218 'max_simultaneous' => { label=>'Maximum number of simultaneous users' },
220 label => 'E911 location',
221 disable_inventory => 1,
224 'forwarddst' => { label => 'Forward Destination',
227 'email' => { label => 'Email',
230 'lnp_status' => { label => 'LNP Status',
231 type => 'select-lnp_status.html',
234 'lnp_reject_reason' => {
235 label => 'LNP Reject Reason',
238 'portable' => { label => 'Portable?', %dis2, },
239 'lrn' => { label => 'LRN',
240 disable_inventory => 1,
242 'lnp_desired_due_date' =>
243 { label => 'LNP Desired Due Date', %dis2 },
245 { label => 'LNP Due Date', %dis2 },
246 'lnp_other_provider' =>
247 { label => 'LNP Other Provider',
248 disable_inventory => 1,
250 'lnp_other_provider_account' =>
251 { label => 'LNP Other Provider Account #',
255 label => 'E911 Service Class',
256 type => 'select-e911_class',
257 disable_inventory => 1,
261 label => 'E911 Service Type',
262 type => 'select-e911_type',
263 disable_inventory => 1,
274 sub table { 'svc_phone'; }
276 sub table_dupcheck_fields { ( 'countrycode', 'phonenum' ); }
278 =item search_sql STRING
280 Class method which returns an SQL fragment to search for the given string.
285 my( $class, $string ) = @_;
287 #my $conf = new FS::Conf;
289 if ( $conf->exists('svc_phone-allow_alpha_phonenum') ) {
295 my $ccode = ( $conf->exists('default_phone_countrycode')
296 && $conf->config('default_phone_countrycode')
298 ? $conf->config('default_phone_countrycode')
301 $string =~ s/^$ccode//;
303 $class->search_sql_field('phonenum', $string );
308 Returns the phone number.
314 my $phonenum = $self->phonenum; #XXX format it better
315 my $label = $phonenum;
316 $label .= '@'.$self->domain if $self->domsvc;
317 $label .= ' ('.$self->phone_name.')' if $self->phone_name;
323 Adds this phone number to the database. If there is an error, returns the
324 error, otherwise returns false.
333 warn "[$me] insert called on $self: ". Dumper($self).
334 "\nwith options: ". Dumper(%options);
337 local $SIG{HUP} = 'IGNORE';
338 local $SIG{INT} = 'IGNORE';
339 local $SIG{QUIT} = 'IGNORE';
340 local $SIG{TERM} = 'IGNORE';
341 local $SIG{TSTP} = 'IGNORE';
342 local $SIG{PIPE} = 'IGNORE';
344 my $oldAutoCommit = $FS::UID::AutoCommit;
345 local $FS::UID::AutoCommit = 0;
348 #false laziness w/cust_pkg.pm... move this to location_Mixin? that would
349 #make it more of a base class than a mixin... :)
350 if ( $options{'cust_location'} ) {
351 $options{'cust_location'}->custnum( $self->cust_svc->cust_pkg->custnum );
352 my $error = $options{'cust_location'}->find_or_insert;
354 $dbh->rollback if $oldAutoCommit;
355 return "inserting cust_location (transaction rolled back): $error";
357 $self->locationnum( $options{'cust_location'}->locationnum );
359 #what about on-the-fly edits? if the ui supports it?
361 my $error = $self->SUPER::insert(%options);
363 $dbh->rollback if $oldAutoCommit;
367 $dbh->commit or die $dbh->errstr if $oldAutoCommit;
374 Delete this record from the database.
381 local $SIG{HUP} = 'IGNORE';
382 local $SIG{INT} = 'IGNORE';
383 local $SIG{QUIT} = 'IGNORE';
384 local $SIG{TERM} = 'IGNORE';
385 local $SIG{TSTP} = 'IGNORE';
386 local $SIG{PIPE} = 'IGNORE';
388 my $oldAutoCommit = $FS::UID::AutoCommit;
389 local $FS::UID::AutoCommit = 0;
392 foreach my $phone_device ( $self->phone_device ) {
393 my $error = $phone_device->delete;
395 $dbh->rollback if $oldAutoCommit;
400 my @phone_avail = qsearch('phone_avail', { 'svcnum' => $self->svcnum } );
401 foreach my $phone_avail ( @phone_avail ) {
402 $phone_avail->svcnum('');
403 my $error = $phone_avail->replace;
405 $dbh->rollback if $oldAutoCommit;
410 my $error = $self->SUPER::delete;
412 $dbh->rollback if $oldAutoCommit;
416 $dbh->commit or die $dbh->errstr if $oldAutoCommit;
421 =item replace OLD_RECORD
423 Replaces the OLD_RECORD with this one in the database. If there is an error,
424 returns the error, otherwise returns false.
431 my $old = ( blessed($_[0]) && $_[0]->isa('FS::Record') )
438 warn "[$me] replacing $old with $new\n".
439 "\nwith options: ". Dumper(%options);
442 local $SIG{HUP} = 'IGNORE';
443 local $SIG{INT} = 'IGNORE';
444 local $SIG{QUIT} = 'IGNORE';
445 local $SIG{TERM} = 'IGNORE';
446 local $SIG{TSTP} = 'IGNORE';
447 local $SIG{PIPE} = 'IGNORE';
449 my $oldAutoCommit = $FS::UID::AutoCommit;
450 local $FS::UID::AutoCommit = 0;
453 #false laziness w/cust_pkg.pm... move this to location_Mixin? that would
454 #make it more of a base class than a mixin... :)
455 if ( $options{'cust_location'}
456 && ( ! $new->locationnum || $new->locationnum == -1 ) ) {
457 my $error = $options{'cust_location'}->insert;
459 $dbh->rollback if $oldAutoCommit;
460 return "inserting cust_location (transaction rolled back): $error";
462 $new->locationnum( $options{'cust_location'}->locationnum );
464 #what about on-the-fly edits? if the ui supports it?
466 # LNP data validation
467 return 'Invalid LNP status' # if someone does really stupid stuff
468 if ( ($old->lnp_status eq 'portingout' && $new->lnp_status eq 'portingin')
469 || ($old->lnp_status eq 'portout-reject' && $new->lnp_status eq 'portingin')
470 || ($old->lnp_status eq 'portin-reject' && $new->lnp_status eq 'portingout')
471 || ($old->lnp_status eq 'portingin' && $new->lnp_status eq 'native')
472 || ($old->lnp_status eq 'portin-reject' && $new->lnp_status eq 'native')
473 || ($old->lnp_status eq 'portingin' && $new->lnp_status eq 'portingout')
474 || ($old->lnp_status eq 'portingout' && $new->lnp_status eq 'portin-reject')
477 my $error = $new->SUPER::replace($old, %options);
479 # if this changed the e911 location, notify exports
480 if ($new->locationnum ne $old->locationnum) {
481 my $new_location = $new->cust_location_or_main;
482 my $old_location = $new->cust_location_or_main;
483 $error ||= $new->export('relocate', $new_location, $old_location);
487 $dbh->rollback if $oldAutoCommit;
488 return $error if $error;
492 $dbh->commit or die $dbh->errstr if $oldAutoCommit;
498 Called by the suspend method of FS::cust_pkg (see L<FS::cust_pkg>).
502 Called by the unsuspend method of FS::cust_pkg (see L<FS::cust_pkg>).
506 Called by the cancel method of FS::cust_pkg (see L<FS::cust_pkg>).
510 Checks all fields to make sure this is a valid phone number. If there is
511 an error, returns the error, otherwise returns false. Called by the insert
516 # the check method should currently be supplied - FS::Record contains some
517 # data checking routines
522 #my $conf = new FS::Conf;
524 my $x = $self->setfixed;
525 return $x unless ref($x);
528 my $phonenum = $self->phonenum;
529 my $phonenum_check_method;
530 if ( $conf->exists('svc_phone-allow_alpha_phonenum') ) {
531 $phonenum =~ s/\W//g;
532 $phonenum_check_method = 'ut_alpha';
534 $phonenum =~ s/\D//g;
535 $phonenum_check_method = 'ut_number';
537 $self->phonenum($phonenum);
539 $self->locationnum('') if !$self->locationnum || $self->locationnum == -1;
542 $self->ut_numbern('svcnum')
543 || $self->ut_numbern('countrycode')
544 || $self->$phonenum_check_method('phonenum')
545 || $self->ut_numbern('sim_imsi')
546 || $self->ut_anything('sip_password')
547 || $self->ut_numbern('pin')
548 || $self->ut_textn('phone_name')
549 || $self->ut_foreign_keyn('pbxsvc', 'svc_pbx', 'svcnum' )
550 || $self->ut_foreign_keyn('domsvc', 'svc_domain', 'svcnum' )
551 || $self->ut_foreign_keyn('sms_carrierid', 'cdr_carrier', 'carrierid' )
552 || $self->ut_alphan('sms_account')
553 || $self->ut_numbern('max_simultaneous')
554 || $self->ut_foreign_keyn('locationnum', 'cust_location', 'locationnum')
555 || $self->ut_numbern('forwarddst')
556 || $self->ut_textn('email')
557 || $self->ut_numbern('lrn')
558 || $self->ut_numbern('lnp_desired_due_date')
559 || $self->ut_numbern('lnp_due_date')
560 || $self->ut_textn('lnp_other_provider')
561 || $self->ut_textn('lnp_other_provider_account')
562 || $self->ut_enumn('lnp_status', ['','portingin','portingout','portedin',
563 'native', 'portin-reject', 'portout-reject'])
564 || $self->ut_enumn('portable', ['','Y'])
565 || $self->ut_textn('lnp_reject_reason')
566 || $self->ut_domainn('sip_server')
568 return $error if $error;
570 return 'Illegal IMSI (not 14-15 digits)' #shorter?
571 if length($self->sim_imsi)
572 && ( length($self->sim_imsi) < 14 || length($self->sim_imsi) > 15 );
574 # LNP data validation
575 return 'Cannot set LNP fields: no LNP in progress'
576 if ( ($self->lnp_desired_due_date || $self->lnp_due_date
577 || $self->lnp_other_provider || $self->lnp_other_provider_account
578 || $self->lnp_reject_reason)
579 && (!$self->lnp_status || $self->lnp_status eq 'native') );
580 return 'Cannot set LNP reject reason: no LNP in progress or status is not reject'
581 if ($self->lnp_reject_reason && (!$self->lnp_status
582 || $self->lnp_status !~ /^port(in|out)-reject$/) );
583 return 'Cannot port-out a non-portable number'
584 if (!$self->portable && $self->lnp_status eq 'portingout');
587 return 'Name ('. $self->phone_name.
588 ") is longer than $phone_name_max characters"
589 if $phone_name_max && length($self->phone_name) > $phone_name_max;
591 $self->countrycode(1) unless $self->countrycode;
593 unless ( length($self->pin) ) {
594 my $random_pin = $conf->config('svc_phone-random_pin');
595 if ( defined($random_pin) && $random_pin =~ /^\d+$/ ) {
597 join('', map int(rand(10)), 0..($random_pin-1))
602 if ( length($self->sip_password) ) {
604 return "SIP password must be longer than $passwordmin characters"
605 if length($self->sip_password) < $passwordmin;
606 return "SIP password must be shorter than $passwordmax characters"
607 if length($self->sip_password) > $passwordmax;
609 } elsif ( $part_svc->part_svc_column('sip_password')->columnflag ne 'F' ) {
613 join('', map $pw_set[ int(rand $#pw_set) ], (1..min($passwordmax,16)) )
618 if ($self->e911_class and !exists(e911_classes()->{$self->e911_class})) {
619 return "undefined e911 class '".$self->e911_class."'";
621 if ($self->e911_type and !exists(e911_types()->{$self->e911_type})) {
622 return "undefined e911 type '".$self->e911_type."'";
628 =item _check duplicate
630 Internal method to check for duplicate phone numers.
634 #false laziness w/svc_acct.pm's _check_duplicate.
635 sub _check_duplicate {
638 my $global_unique = $conf->config('global_unique-phonenum') || 'none';
639 return '' if $global_unique eq 'disabled';
644 grep { !$self->svcnum || $_->svcnum != $self->svcnum }
645 qsearch( 'svc_phone', {
646 'countrycode' => $self->countrycode,
647 'phonenum' => $self->phonenum,
650 return gettext('phonenum_in_use')
651 if $global_unique eq 'countrycode+phonenum' && @dup_ccphonenum;
653 my $part_svc = qsearchs('part_svc', { 'svcpart' => $self->svcpart } );
654 unless ( $part_svc ) {
655 return 'unknown svcpart '. $self->svcpart;
658 if ( @dup_ccphonenum ) {
660 my $exports = FS::part_export::export_info('svc_phone');
661 my %conflict_ccphonenum_svcpart = ( $self->svcpart => 'SELF', );
663 foreach my $part_export ( $part_svc->part_export ) {
665 #this will catch to the same exact export
666 my @svcparts = map { $_->svcpart } $part_export->export_svc;
668 $conflict_ccphonenum_svcpart{$_} = $part_export->exportnum
673 foreach my $dup_ccphonenum ( @dup_ccphonenum ) {
674 my $dup_svcpart = $dup_ccphonenum->cust_svc->svcpart;
675 if ( exists($conflict_ccphonenum_svcpart{$dup_svcpart}) ) {
676 return "duplicate phone number ".
677 $self->countrycode. ' '. $self->phonenum.
678 ": conflicts with svcnum ". $dup_ccphonenum->svcnum.
679 " via exportnum ". $conflict_ccphonenum_svcpart{$dup_svcpart};
691 Checks the supplied PIN against the PIN in the database. Returns true for a
692 sucessful authentication, false if no match.
697 my($self, $check_pin) = @_;
698 length($self->pin) && $check_pin eq $self->pin;
707 #XXX Session-Timeout! holy shit, need rlm_perl to ask for this in realtime
719 #my $conf = new FS::Conf;
722 if ( $conf->config('svc_phone-radius-password') eq 'countrycode_phonenum' ) {
723 $password = $self->countrycode. $self->phonenum;
725 $password = $conf->config('svc_phone-radius-default_password');
727 $check{'User-Password'} = $password;
736 =item sms_cdr_carrier
738 Returns the L<FS::cdr_carrier> assigned as the SMS carrier for this phone.
742 sub sms_cdr_carrier {
744 return '' unless $self->sms_carrierid;
745 qsearchs('cdr_carrier', { 'carrierid' => $self->sms_carrierid } );
748 =item sms_carriername
750 Returns the name of the SMS carrier, or an empty string if there isn't one.
754 sub sms_carriername {
756 my $cdr_carrier = $self->sms_cdr_carrier or return '';
757 $cdr_carrier->carriername;
762 Returns the L<FS::svc_circuit> assigned as the trunk for this phone line.
766 Returns the label of the circuit (the part_svc label followed by the
767 circuit ID), or an empty string if there isn't one.
773 my $svcnum = $self->get('circuit_svcnum') or return '';
774 return FS::svc_circuit->by_key($svcnum);
779 my $svc_circuit = $self->svc_circuit or return '';
780 return join(' ', $svc_circuit->part_svc->svc, $svc_circuit->circuit_id);
785 Returns any FS::phone_device records associated with this service.
789 #override location_Mixin version cause we want to try the cust_pkg location
790 #in between us and cust_main
791 # XXX what to do in the unlinked case??? return a pseudo-object that returns
793 sub cust_location_or_main {
795 return $self->cust_location if $self->locationnum;
796 my $cust_pkg = $self->cust_svc->cust_pkg;
797 $cust_pkg ? $cust_pkg->cust_location_or_main : '';
800 =item phone_name_or_cust
802 Returns the C<phone_name> field if it has a value, or the package contact
803 name if there is one, or the customer contact name.
807 sub phone_name_or_cust {
809 if ( $self->phone_name ) {
810 return $self->phone_name;
812 my $cust_pkg = $self->cust_svc->cust_pkg or return '';
813 if ( $cust_pkg->contactnum ) {
814 return $cust_pkg->contact->firstlast;
816 return $cust_pkg->cust_main->name_short;
820 =item psearch_cdrs OPTIONS
822 Returns a paged search (L<FS::PagedSearch>) for Call Detail Records
823 associated with this service. By default, "associated with" means that
824 either the "src" or the "charged_party" field of the CDR matches the
825 "phonenum" field of the service. To access the CDRs themselves, call
826 "->fetch" on the resulting object.
830 Accepts the following options:
832 =item for_update => 1: SELECT the CDRs "FOR UPDATE".
834 =item status => "" (or "processing-tiered", "done"): Return only CDRs with that processing status.
836 =item inbound => 1: Return CDRs for inbound calls (that is, those that match
837 on 'dst'). With "status", will filter on inbound processing status.
839 =item default_prefix => "XXX": Also accept the phone number of the service prepended
840 with the chosen prefix.
842 =item begin, end: Start and end of a date range, as unix timestamp.
844 =item cdrtypenum: Only return CDRs with this type.
846 =item calltypenum: Only return CDRs with this call type.
848 =item disable_src => 1: Only match on 'charged_party', not 'src'.
850 =item disable_charged_party => 1: Only match on 'src', not 'charged_party'.
852 =item nonzero: Only return CDRs where duration > 0.
854 =item by_svcnum: not supported for svc_phone
856 =item billsec_sum: Instead of returning all of the CDRs, return a single
857 record (as an L<FS::cdr> object) with the sum of the 'billsec' field over
858 the entire result set.
866 my($self, %options) = @_;
871 if ( $options{'inbound'} ) {
874 if ( exists($options{'status'}) ) {
875 my $status = $options{'status'};
877 push @where, 'EXISTS ( SELECT 1 FROM cdr_termination '.
878 'WHERE cdr.acctid = cdr_termination.acctid '.
879 "AND cdr_termination.status = '$status' ". #quoting kludge
880 'AND cdr_termination.termpart = 1 )';
882 push @where, 'NOT EXISTS ( SELECT 1 FROM cdr_termination '.
883 'WHERE cdr.acctid = cdr_termination.acctid '.
884 'AND cdr_termination.termpart = 1 )';
890 push @fields, 'charged_party' unless $options{'disable_charged_party'};
891 push @fields, 'src' unless $options{'disable_src'};
892 $hash{'freesidestatus'} = $options{'status'}
893 if exists($options{'status'});
896 if ($options{'cdrtypenum'}) {
897 $hash{'cdrtypenum'} = $options{'cdrtypenum'};
899 if ($options{'calltypenum'}) {
900 $hash{'calltypenum'} = $options{'calltypenum'};
903 my $for_update = $options{'for_update'} ? 'FOR UPDATE' : '';
905 my $number = $self->phonenum;
907 my $prefix = $options{'default_prefix'};
909 my @orwhere = map " $_ = '$number' ", @fields;
910 push @orwhere, map " $_ = '$prefix$number' ", @fields
911 if defined($prefix) && length($prefix);
912 if ( $prefix && $prefix =~ /^\+(\d+)$/ ) {
913 push @orwhere, map " $_ = '$1$number' ", @fields
916 push @where, ' ( '. join(' OR ', @orwhere ). ' ) ';
918 if ( $options{'begin'} ) {
919 push @where, 'startdate >= '. $options{'begin'};
921 if ( $options{'end'} ) {
922 push @where, 'startdate < '. $options{'end'};
924 if ( $options{'nonzero'} ) {
925 push @where, 'duration > 0';
928 my $extra_sql = ( keys(%hash) ? ' AND ' : ' WHERE ' ). join(' AND ', @where );
933 'extra_sql' => $extra_sql,
934 'order_by' => $options{'billsec_sum'} ? '' : "ORDER BY startdate $for_update",
935 'select' => $options{'billsec_sum'} ? 'sum(billsec) as billsec_sum' : '*',
939 =item get_cdrs (DEPRECATED)
941 Like psearch_cdrs, but returns all the L<FS::cdr> objects at once, in a
942 single list. Arguments are the same as for psearch_cdrs. This can take
943 an unreasonably large amount of memory and is best avoided.
949 my $psearch = $self->psearch_cdrs(@_);
950 qsearch ( $psearch->{query} )
955 Takes the same options as psearch_cdrs, but returns a single row containing
956 "count" (the number of CDRs) and the sums of the following fields: duration,
957 billsec, rated_price, rated_seconds, rated_minutes.
959 Note that if any calls are not rated, their rated_* fields will be null.
960 If you want to use those fields, pass the 'status' option to limit to
961 calls that have been rated. This is intentional; please don't "fix" it.
967 my $psearch = $self->psearch_cdrs(@_);
968 $psearch->{query}->{'select'} = join(',',
970 map { "SUM($_) AS $_" }
971 qw(duration billsec rated_price rated_seconds rated_minutes)
974 $psearch->{query}->{'extra_sql'} =~ s/ ORDER BY.*$//;
975 qsearchs ( $psearch->{query} );
986 Returns a hashref of allowed values and descriptions for the C<e911_class>
991 Returns a hashref of allowed values and descriptions for the C<e911_type>
997 tie my %x, 'Tie::IxHash', (
1000 3 => 'Residence PBX',
1001 4 => 'Business PBX',
1003 6 => 'Coin 1 Way out',
1006 9 => 'Residence OPX',
1007 0 => 'Business OPX',
1008 A => 'Customer Operated Coin Telephone',
1010 G => 'Wireless Phase I',
1011 H => 'Wireless Phase II',
1012 I => 'Wireless Phase II with Phase I information',
1013 V => 'VoIP Services Default',
1014 C => 'VoIP Residence',
1015 D => 'VoIP Business',
1016 E => 'VoIP Coin/Pay Phone',
1017 F => 'VoIP Wireless',
1018 J => 'VoIP Nomadic',
1019 K => 'VoIP Enterprise Services',
1026 tie my %x, 'Tie::IxHash', (
1027 0 => 'Not FX nor Non-Published',
1028 1 => 'FX in 911 serving area',
1029 2 => 'FX outside 911 serving area',
1030 3 => 'Non-Published',
1031 4 => 'Non-Published FX in serving area',
1032 5 => 'Non-Published FX outside serving area',
1033 6 => 'Local Ported Number',
1034 7 => 'Interim Ported Number',
1045 L<FS::svc_Common>, L<FS::Record>, L<FS::cust_svc>, L<FS::part_svc>,
1046 L<FS::cust_pkg>, schema.html from the base documentation.