summaryrefslogtreecommitdiff
path: root/httemplate/view/svc_phone.cgi
blob: 3cc1b3f44da74e4c01e7a2f164b5753753ffbda1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<% include('elements/svc_Common.html',
              'table'     => 'svc_phone',
              'fields'    => [qw( countrycode phonenum sip_password pin )],
              'labels'    => {
                               'countrycode'  => 'Country code',
                               'phonenum'     => 'Phone number',
                               'sip_password' => 'SIP password',
                               'pin'          => 'PIN',
                             },
              'html_foot' => $html_foot,
          )
%>
<%init>

my $html_foot = sub {
  my $svc_phone = shift;

  tie my %what, 'Tie::IxHash',
    'pending' => 'NULL',
    'billed'  => 'done',
  ;

  #XXX src & charged party (& default prefix) as per voip_cdr.pm
  #XXX handle toll free too

  my $number = $svc_phone->phonenum;

  #my @links = map {
  #  qq(<A HREF="${p}search/cdr.html?src=$number;freesidestatus=$what{$_}">).
  #  "View $_ CDRs</A>";
  #} keys(%what);
  my @links = map {
    qq(<A HREF="${p}search/cdr.html?charged_party=$number;freesidestatus=$what{$_}">).
    "View $_ CDRs</A>";
  } keys(%what);

  my @ilinks = ( qq(<A HREF="${p}search/cdr.html?dst=$number">).
                 'View incoming CDRs</A>' );

  join(' | ', @links ). '<BR>'.
  join(' | ', @ilinks). '<BR>';

};

</%init>