snom autodial integration
authorivan <ivan>
Thu, 4 Feb 2010 06:53:15 +0000 (06:53 +0000)
committerivan <ivan>
Thu, 4 Feb 2010 06:53:15 +0000 (06:53 +0000)
httemplate/elements/phonenumber.html
httemplate/pref/pref-process.html
httemplate/pref/pref.html

index 60414a6..854f584 100644 (file)
@@ -4,22 +4,64 @@
 
     <% $number %>
 
-%   if ( $opt{'callable'} && $curuser->option('vonage-username') ) { 
-
-      <% 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'       => qq!<IMG SRC="${fsurl}images/red_telephone_mimooh_01.png" BORDER=0 ALT="Call this 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>
+
+
+%     }
+%
 %   } 
 %
 % } else { 
@@ -34,7 +76,6 @@ my( $number, %opt ) = @_;
 
 my $curuser = $FS::CurrentUser::CurrentUser;
 
-( my $vonage_number = $curuser->option('vonage-fromnumber') ) =~ s/\D//g;
-$vonage_number =~ /^1/ or $vonage_number = "1$vonage_number";
+my $img = qq(IMG SRC="${fsurl}images/red_telephone_mimooh_01.png" BORDER=0 ALT="Call this number");
 
 </%init>
index 378164e..2b6c969 100644 (file)
@@ -45,8 +45,10 @@ unless ( $error ) { # if ($access_user) {
   #XXX autogen
   my @paramlist = qw( menu_position default_customer_view
                       email_address
+                      snom-ip snom-username snom-password
                       vonage-fromnumber vonage-username vonage-password
-                      show_pkgnum show_db_profile save_db_profile
+                      show_pkgnum show_confitem_counts
+                      show_db_profile save_db_profile
                       height width availHeight availWidth colorDepth
                     );
 
index 562ef29..5cd75e2 100644 (file)
@@ -80,6 +80,10 @@ Development
     <TD><INPUT TYPE="checkbox" NAME="show_pkgnum" VALUE="1" <% $curuser->option('show_pkgnum') ? 'CHECKED' : '' %>></TD>
   </TR>
   <TR>
+    <TH>Show config item counts: </TH>
+    <TD><INPUT TYPE="checkbox" NAME="show_confitem_counts" VALUE="1" <% $curuser->option('show_confitem_counts') ? 'CHECKED' : '' %>></TD>
+  </TR>
+  <TR>
     <TH>Show database profiling (when available): </TH>
     <TD><INPUT TYPE="checkbox" NAME="show_db_profile" VALUE="1" <% $curuser->option('show_db_profile') ? 'CHECKED' : '' %>></TD>
   </TR>
@@ -91,6 +95,28 @@ Development
 </TABLE>
 <BR>
 
+SNOM integration
+<% ntable("#cccccc",2) %>
+
+  <TR>
+    <TH ALIGN="right">SNOM IP address</TH>
+    <TD><INPUT TYPE="text" NAME="snom-ip" VALUE="<% $curuser->option('snom-ip') %>"></TD>
+  </TR>
+
+  <TR>
+    <TH ALIGN="right">SNOM HTTP username (if necessary)</TH>
+    <TD><INPUT TYPE="text" NAME="snom-username" VALUE="<% $curuser->option('snom-username') %>"></TD>
+  </TR>
+
+  <TR>
+    <TH ALIGN="right">SNOM HTTP password (if necessary)</TH>
+    <TD><INPUT TYPE="password" NAME="snom-password" VALUE="<% $curuser->option('snom-password') %>"></TD>
+  </TR>
+
+</TABLE>
+<BR>
+
+OR<BR><BR>
 
 Vonage integration (see <a href="https://secure.click2callu.com/">Click2Call</a>)
 <% ntable("#cccccc",2) %>