export host selection per service, RT#17914
[freeside.git] / FS / FS / part_export / phone_shellcommands.pm
index cfbae50..5c1ae01 100644 (file)
@@ -27,27 +27,28 @@ tie my %options, 'Tie::IxHash',
   'options' => \%options,
   'notes'   => <<'END'
 Run remote commands via SSH, for phone numbers.  You will need to
-<a href="../docs/ssh.html">setup SSH for unattended operation</a>.
+<a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.9:Documentation:Administration:SSH_Keys">setup SSH for unattended operation</a>.
 <BR><BR>Use these buttons for some useful presets:
 <UL>
   <LI>
     <INPUT TYPE="button" VALUE="FreePBX (build_exten CLI module needed)" onClick='
       this.form.user.value = "root";
-      this.form.useradd.value = "build_exten.php --create --exten $phonenum --name $cust_name --vm-password $pin";
-      this.form.userdel.value = "build_exten.php --delete --exten $phonenum";
-      this.form.usermod.value = "";
+      this.form.useradd.value = "build_exten.php --create --exten $phonenum --directdid 1$phonenum --sip-secret $sip_password --name $cust_name --vm-password $pin && /usr/share/asterisk/bin/module_admin reload";
+      this.form.userdel.value = "build_exten.php --delete --exten $phonenum && /usr/share/asterisk/bin/module_admin reload";
+      this.form.usermod.value = "build_exten.php --modify --exten $new_phonenum --directdid 1$new_phonenum --sip-secret $new_sip_password --name $new_cust_name --vm-password $new_pin && /usr/share/asterisk/bin/module_admin reload";
       this.form.suspend.value = "";
       this.form.unsuspend.value = "";
-    '>
-</UL>
+    '> (Important note: Reduce freeside-queued "max_kids" to 1 when using FreePBX integration)
+  </UL>
 
 The following variables are available for interpolation (prefixed with new_ or
 old_ for replace operations):
 <UL>
   <LI><code>$countrycode</code> - Country code
   <LI><code>$phonenum</code> - Phone number
+  <LI><code>$sip_password</code> - SIP secret (quoted for the shell)
   <LI><code>$pin</code> - Personal identification number
-  <LI><code>$cust_name</code> - Customer name
+  <LI><code>$cust_name</code> - Customer name (quoted for the shell)
 </UL>
 END
 );
@@ -88,6 +89,7 @@ sub _export_command {
   my $cust_pkg = $svc_phone->cust_svc->cust_pkg;
   my $cust_name = $cust_pkg ? $cust_pkg->cust_main->name : '';
   $cust_name = shell_quote $cust_name;
+  my $sip_password = shell_quote $svc_phone->sip_password;
   #done setting variables for the command
 
   $self->shellcommands_queue( $svc_phone->svcnum,
@@ -136,3 +138,4 @@ sub ssh_cmd { #subroutine, not method
   &Net::SSH::ssh_cmd( { @_ } );
 }
 
+1;