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>'.
61 '<TH CLASS="grid" BGCOLOR="#cccccc"></TH>'.
63 my $bgcolor1 = '#eeeeee';
64 my $bgcolor2 = '#ffffff';
67 foreach my $phone_device ( @phone_device ) {
69 if ( $bgcolor eq $bgcolor1 ) {
74 my $td = qq(<TD CLASS="grid" BGCOLOR="$bgcolor">);
76 my $devicenum = $phone_device->devicenum;
77 my $export_links = join( '<BR>', @{ $phone_device->export_links } );
80 $td. $phone_device->part_device->devicename. '</TD>'.
81 $td. $phone_device->mac_addr. '</TD>'.
82 $td. $export_links. '</TD>'.
84 qq(<A HREF="${p}edit/phone_device.html?$devicenum">edit</A> | ).
85 qq(<A HREF="javascript:areyousure('${p}misc/delete-phone_device.html?$devicenum')">delete</A>).
89 $devices .= '</TABLE><BR>';
98 tie my %what, 'Tie::IxHash',
103 #XXX src & charged party (& default prefix) as per voip_cdr.pm
104 #XXX handle toll free too
106 my $number = $svc_phone->phonenum;
107 $number = $svc_phone->countrycode. $number
108 unless $svc_phone->countrycode eq '1';
111 # qq(<A HREF="${p}search/cdr.html?src=$number;freesidestatus=$what{$_}">).
112 # "View $_ CDRs</A>";
115 qq(<A HREF="${p}search/cdr.html?cdrbatchnum=__ALL__;charged_party=$number;freesidestatus=$what{$_}">).
119 my @ilinks = ( qq(<A HREF="${p}search/cdr.html?cdrbatchnum=__ALL__;dst=$number">).
120 'View incoming CDRs</A>' );
123 # concatenate & return
127 join(' | ', @links ). '<BR>'.
128 join(' | ', @ilinks). '<BR>';