1 <% include('elements/svc_Common.html',
3 'edit_url' => $p.'edit/svc_pbx.html?',
5 'html_foot' => $html_foot,
10 my $fields = FS::svc_pbx->table_info->{'fields'};
11 my %labels = map { $_ => ( ref($fields->{$_})
12 ? $fields->{$_}{'label'}
25 my @pbx_extension = sort { $a->extension cmp $b->extension }
26 $svc_pbx->pbx_extension;
29 if ( @pbx_extension ) {
31 $extensions .= '<FONT CLASS="fsinnerbox-title">Extensions</FONT>'.
32 include('/elements/table-grid.html');
33 my $bgcolor1 = '#eeeeee';
34 my $bgcolor2 = '#ffffff';
39 # <TH CLASS="grid" BGCOLOR="#cccccc">Ext</TH>
40 # <TH CLASS="grid" BGCOLOR="#cccccc">Name</TH>
44 foreach my $pbx_extension ( @pbx_extension ) {
45 if ( $bgcolor eq $bgcolor1 ) {
53 <TD CLASS="grid" BGCOLOR="$bgcolor">). $pbx_extension->extension. qq(
54 <TD CLASS="grid" BGCOLOR="$bgcolor">). $pbx_extension->phone_name. qq(
60 $extensions .= '</TABLE><BR>';
67 tie my %what, 'Tie::IxHash',
72 #matching as per package def cdr_svc_method
73 my $cust_pkg = $svc_pbx->cust_svc->cust_pkg;
74 return $extensions unless $cust_pkg;
77 grep { $_->plan eq 'voip_cdr' } $cust_pkg->part_pkg->self_and_bill_linked;
78 if ( scalar(@voip_pkgs) > 1 ) {
79 warn "multiple voip_cdr packages bundled\n";
81 } elsif ( !@voip_pkgs ) {
82 warn "no voip_cdr packages\n";
84 my $voip_pkg = @voip_pkgs[0];
86 my $cdr_svc_method = ( $voip_pkg && $voip_pkg->option('cdr_svc_method') )
87 || 'svc_phone.phonenum';
88 return $extensions unless $cdr_svc_method =~ /^svc_pbx\.(.*)$/;
92 if ( $field eq 'title' ) {
93 $search = 'charged_party='. uri_escape($svc_pbx->title);
94 } elsif ( $field =~ /^ip\.(\w+)$/ ) {
95 $search = "$1_ip_addr=". uri_escape($svc_pbx->title);
96 } elsif ( $field eq 'svcnum' ) {
97 $search = 'svcnum='. $svc_pbx->svcnum;
99 warn "unknown cdr_svc_method svc_pbx.$field";
104 qq(<A HREF="${p}search/cdr.html?cdrbatchnum=__ALL__;$search;freesidestatus=$what{$_}">).
109 # concatenate & return
113 join(' | ', @links ). '<BR>';