Hi,
I have an issue with executing ruby script from my dial plan.
While my dial plan executing I want to call ruby script where I doing ssh connection to remote.
My ruby script executes SSH connection to remote server and executing other script on it.
This script is working fine when I run it manually from terminal:
[root@asterisk scripts]# ruby test.rb
it works fine when I executing it from asterisk console:
asterisk*CLI> !/srv/nfs/scripts/test.rb
But my trubles starting when want do to the sane in dail plan.
This is try it
same => n,AGI(/srv/nfs/scripts/test.rb)
and
same => n,System(/srv/nfs/scripts/test.rb)
Please help me to understand what I am doing wrong or this is some asterisk bug issue.
[script]
#!/usr/bin/env ruby
require ‘net/ssh’
HOST = ‘192.168.56.102’ #Remote server
USER = 'root’
PASS = 'xxxxxxx’
command="ruby /home/ubuntu/Documents/prototype/public/nfs-share/scripts/update_db.rb"
puts command
Net::SSH.start( HOST, USER, :password => PASS ) do|ssh|
result = ssh.exec!(command)
puts result
end
puts “ssh_update_END”