I’m trying to send a command to Linux from a dial plan. Basically I want to turn off fail2ban and iptables by dialing some extension for 600 seconds, long enough to to access via SSH and then turn it back on.
Here is what I have now:
exten => 5432,1,Noop()
exten => 5432,n,Read(ext_pwd,S200,4,3,6) ; Please enter your passcode
exten => 5432,n,GotoIf($["${ext_pwd}"=“7777”]?start)
exten => 5432,n,Playback(login-fail)
exten => 5432,n,Goto(1) ; wrong - start again
;
exten => 5432,n(start),Noop()
exten => 5432,n,system(bin/sh -c “service fail2ban stop”)
exten => 5432,n,system(bin/sh -c “service iptables stop”)
exten => 5432,n,Playback(is-set-to&disabled)
exten => 5432,n,Wait(300) ; allow time to SSH into Server
exten => 5432,n,system(bin/sh -c “service fail2ban start”)
exten => 5432,n,system(bin/sh -c “service iptables start”)
exten => 5432,n,Playback(is-set-to&enabled)
exten => 5432,n,Hangup()
I’ve try many different system() formats, but none work - maybe you know what I’m doing wrong?
Bart