+ my @cust_svc_pbx =
+ grep { my($n,$l,$t) = $_->label; $t eq 'svc_pbx' }
+ @cust_svc;
+
+ if ( ! @cust_svc_pbx ) {
+ return { 'status' => 'E',
+ 'error' => "customer $custnum has no conference service" };
+ } elsif ( scalar(@cust_svc_pbx) > 1 ) {
+ return { 'status' => 'E',
+ 'error' =>
+ "customer $custnum has more than one conference".
+ " service (reseller?); specify a svcnum as a second argument",
+ };
+ }
+
+ my $cust_svc_pbx = $cust_svc_pbx[0];
+
+ $svc_pbx = $cust_svc_pbx->svc_x;
+
+ # find "outbound service" y/n
+
+ my $conf = new FS::Conf;
+ my %outbound_pkgs = map { $_=>1 } $conf->config('mc-outbound_packages');
+ $outbound_service =
+ scalar( grep { $outbound_pkgs{ $_->pkgpart }
+ && !$_->get('cancel')
+ }
+ @cust_pkg
+ )
+ ? 1 : 0;
+
+ # find "good till" date/time stamp
+
+ my @active_cust_pkg =
+ sort { $a->bill <=> $b->bill }
+ grep { !$_->get('cancel') && $_->part_pkg->freq ne '0' }
+ @cust_pkg;
+ $good_till = time2str('%c', $active_cust_pkg[0]->bill || time );
+
+ }