1 <% include('elements/svc_Common.html',
2 'table' => 'svc_phone',
12 'countrycode' => 'Country code',
13 'phonenum' => 'Phone number',
15 'sip_password' => 'SIP password',
17 'phone_name' => 'Name',
19 'html_foot' => $html_foot,
25 my $svc_phone = shift;
33 my $sth = dbh->prepare("SELECT COUNT(*) FROM part_device") #WHERE disabled = '' OR disabled IS NULL;");
35 $sth->execute or die $sth->errstr;
36 my $num_part_device = $sth->fetchrow_arrayref->[0];
38 my @phone_device = $svc_phone->phone_device;
39 if ( @phone_device || $num_part_device ) {
40 my $svcnum = $svc_phone->svcnum;
42 qq[Devices (<A HREF="${p}edit/phone_device.html?svcnum=$svcnum">Add device</A>)<BR>];
43 if ( @phone_device ) {
47 function areyousure(href) {
48 if (confirm("Are you sure you want to delete this device?") == true)
49 window.location.href = href;
56 include('/elements/table-grid.html').
58 '<TH CLASS="grid" BGCOLOR="#cccccc">Type</TH>'.
59 '<TH CLASS="grid" BGCOLOR="#cccccc">MAC Addr</TH>'.
60 '<TH CLASS="grid" BGCOLOR="#cccccc"></TH>'.
62 my $bgcolor1 = '#eeeeee';
63 my $bgcolor2 = '#ffffff';
66 foreach my $phone_device ( @phone_device ) {
68 if ( $bgcolor eq $bgcolor1 ) {
73 my $td = qq(<TD CLASS="grid" BGCOLOR="$bgcolor">);
75 my $devicenum = $phone_device->devicenum;
78 $td. $phone_device->part_device->devicename. '</TD>'.
79 $td. $phone_device->mac_addr. '</TD>'.
81 qq(<A HREF="${p}edit/phone_device.html?$devicenum">edit</A> | ).
82 qq(<A HREF="javascript:areyousure('${p}misc/delete-phone_device.html?$devicenum')">delete</A>).
86 $devices .= '</TABLE><BR>';
95 tie my %what, 'Tie::IxHash',
100 #XXX src & charged party (& default prefix) as per voip_cdr.pm
101 #XXX handle toll free too
103 my $number = $svc_phone->phonenum;
104 $number = $svc_phone->countrycode. $number
105 unless $svc_phone->countrycode eq '1';
108 # qq(<A HREF="${p}search/cdr.html?src=$number;freesidestatus=$what{$_}">).
109 # "View $_ CDRs</A>";
112 qq(<A HREF="${p}search/cdr.html?cdrbatchnum=__ALL__;charged_party=$number;freesidestatus=$what{$_}">).
116 my @ilinks = ( qq(<A HREF="${p}search/cdr.html?cdrbatchnum=__ALL__;dst=$number">).
117 'View incoming CDRs</A>' );
120 # concatenate & return
124 join(' | ', @links ). '<BR>'.
125 join(' | ', @ilinks). '<BR>';