1 <% include('elements/svc_Common.html',
2 'table' => 'svc_phone',
11 'countrycode' => 'Country code',
12 'phonenum' => 'Phone number',
13 'sip_password' => 'SIP password',
15 'phone_name' => 'Name',
17 'html_foot' => $html_foot,
23 my $svc_phone = shift;
31 my $sth = dbh->prepare("SELECT COUNT(*) FROM part_device") #WHERE disabled = '' OR disabled IS NULL;");
33 $sth->execute or die $sth->errstr;
34 my $num_part_device = $sth->fetchrow_arrayref->[0];
36 my @phone_device = $svc_phone->phone_device;
37 if ( @phone_device || $num_part_device ) {
38 my $svcnum = $svc_phone->svcnum;
40 qq[Devices (<A HREF="${p}edit/phone_device.html?svcnum=$svcnum">Add device</A>)<BR>];
41 if ( @phone_device ) {
45 function areyousure(href) {
46 if (confirm("Are you sure you want to delete this device?") == true)
47 window.location.href = href;
54 include('/elements/table-grid.html').
56 '<TH CLASS="grid" BGCOLOR="#cccccc">Type</TH>'.
57 '<TH CLASS="grid" BGCOLOR="#cccccc">MAC Addr</TH>'.
58 '<TH CLASS="grid" BGCOLOR="#cccccc"></TH>'.
60 my $bgcolor1 = '#eeeeee';
61 my $bgcolor2 = '#ffffff';
64 foreach my $phone_device ( @phone_device ) {
66 if ( $bgcolor eq $bgcolor1 ) {
71 my $td = qq(<TD CLASS="grid" BGCOLOR="$bgcolor">);
73 my $devicenum = $phone_device->devicenum;
76 $td. $phone_device->part_device->devicename. '</TD>'.
77 $td. $phone_device->mac_addr. '</TD>'.
79 qq(<A HREF="${p}edit/phone_device.html?$devicenum">edit</A> | ).
80 qq(<A HREF="javascript:areyousure('${p}misc/delete-phone_device.html?$devicenum')">delete</A>).
84 $devices .= '</TABLE><BR>';
93 tie my %what, 'Tie::IxHash',
98 #XXX src & charged party (& default prefix) as per voip_cdr.pm
99 #XXX handle toll free too
101 my $number = $svc_phone->phonenum;
102 $number = $svc_phone->countrycode. $number
103 unless $svc_phone->countrycode eq '1';
106 # qq(<A HREF="${p}search/cdr.html?src=$number;freesidestatus=$what{$_}">).
107 # "View $_ CDRs</A>";
110 qq(<A HREF="${p}search/cdr.html?cdrbatch=__ALL__;charged_party=$number;freesidestatus=$what{$_}">).
114 my @ilinks = ( qq(<A HREF="${p}search/cdr.html?cdrbatch=__ALL__;dst=$number">).
115 'View incoming CDRs</A>' );
118 # concatenate & return
122 join(' | ', @links ). '<BR>'.
123 join(' | ', @ilinks). '<BR>';