Hello, i’m completely a newbie. I have a server 1 and a server 2. On server 1 there is windows server 2016 and i installed putty. On server 2 there is freepbx distro. On server 1 i started putty (plink) with a batchfile. I’nm doing this because i want to transfer CLI-commands via putty to server 2.
The content of the batchfile is:
C:\plink.exe -ssh root@xx.90.201.xx -pw mypassword -m “c:\xx.txt” -t -batch
In the file xx.txt i enter the command to open the CLI console:
asterisk -r
Ok, this works, but my problem is, that now i want to add another CLI commands like:
confbridge list
confbridge kick 100 all
So i change the xx.txt file like:
asterisk -r
confbridge list
confbridge kick 100 all
But this doesn’t work. Can somesome help me? Please explain what to do in a very simply way, because i’m only a beginner. Than you very much.
I’d try sending it as a shell inline file (<<word). One possibility here is that the command sequence got block buffered by the shell, so there was nothing left for Asterisk to read.
I can’t rule out that Asterisk -r is fussy about having something that looks like a real terminal.
FreePBX is irrelevant here, and FreePBX isn’t supported on this forum. However, as noted in the second paragraph, Asterisk might just be relevant.
Another possibility is that plink isn’t converting from Windows to Linux newline sequences, and the carriage returns are causing confusion.
Thank you, for your answer, but i don’t know what a shell inline is, sorry i need concrete solution with example how to make it. If someone can help to solve this problem (via teamviewer, i speak english/german), i give him xx Euro via paypal. I would be very grateful.
If I’d been aware that the cost of starting Asterisk twice was not an issue, I would have suggested simply calling plink twice. I assumed that only starting asterisk -r once was a key part of your requirement.
Since you don’t mind starting Asterisk multiple times and there is no ‘context’ between the commands, why not eliminate the xx.txt file and just do it as 2 plink commands (as david551 suggests) like:
Still, as I said privately, once you get this working, I’d consider using a login other than root (in which case, you’ll need to add ‘sudo’ to the ‘nc’ command) and using SSH keys.
And, just for future readers, you could also solve this task by sending commands to Asterisk using the socket interface like: