summaryrefslogtreecommitdiff
path: root/httemplate/elements/phonenumber.html
blob: 736984b45d46d3346c1370760bd846d83abb5c8f (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<% include('/elements/init_overlib.html') %>

% if ( length($number) ) { 

    <% $number %>

%   if ( $opt{'callable'} ) {
%
%     if ( $curuser->option('vonage-username') ) { 
%
%       (my $vonage_number = $curuser->option('vonage-fromnumber')) =~ s/\D//g;
%       $vonage_number =~ /^1/ or $vonage_number = "1$vonage_number";

        <% include('/elements/popup_link.html',
             'action'      =>
               'https://secure.click2callu.com/tpcc/makecall'.
               '?username='. uri_escape($curuser->option('vonage-username')).
               '&password='. uri_escape($curuser->option('vonage-password')).
               "&fromnumber=$vonage_number".
               "&tonumber=$snumber",
             'width'       => 240,
             'height'      => 64,
             'actionlabel' => 'Initiating call',
             'label'       => "<$img>",
           )
        %>

%     } elsif ( $curuser->option('snom-ip') ) {
%
%       my $host = $curuser->option('snom-ip');
%       if ( $curuser->option('snom-username') ) {
%         my $userpass = uri_escape($curuser->option('snom-username'));
%         $userpass .= ':'. uri_escape($curuser->option('snom-password'))
%           if $curuser->option('snom-password');
%         $host = $userpass.'@'.$host;
%       }
%
%       $snumber = "1$snumber" unless $snumber =~ /~1/; #NANPA-centric

%#        <% include('/elements/popup_link.html',
%#             'action'      => "http://$host/command.htm?number=$snumber",
%#             %link_common,
%#           )
%#        %>

        <A HREF="javascript:snom_call(<%$snumber%>)"><<% $img %>></A>

        <SCRIPT TYPE="text/javascript">
          function snom_call(number) {

            var url = '<% "http://$host/command.htm?number=" %>';
            url = url + number;

            var xmlhttp = new XMLHttpRequest();
            xmlhttp.open('GET', url, true);
            xmlhttp.send(null);

          }

        </SCRIPT>


%     }
%
%   } 
%
%   if ( $opt{'calling_list_exempt'} ) {
 - calling list exempt
%   }
%
% } else { 

  &nbsp;

% } 
<%init>

my( $number, %opt ) = @_;
( my $snumber = $number ) =~ s/\D//g;

my $curuser = $FS::CurrentUser::CurrentUser;

my $img = qq(IMG SRC="${fsurl}images/red_telephone_mimooh_01.png" BORDER=0 ALT="Call this number");

</%init>