I am trying to create a shell script to listen for events from the Asterisk AMI, but when I attempt to connect, I get:
Response: Error
Message: Permission denied
Here is the relevant code from my script:
set username "username"
set secret "secret"
set host "127.0.0.1"
set port "5038"
spawn telnet $host $port
expect "Manager/1.3" {
send_user "Connected.\n"
send "Action: Login \nUsername: ${username}\nSecret: ${secret}\n\n"
}
The thing is, if I log in manually to that host and port using the exact same username and password, it works just fine.
In case it helps here is the relevant code from manager.conf
[general]
enabled = yes
bindaddr = 127.0.0.1
port = 5038
[username]
secret=secret
read=call
write=all
The output to CLI confirms that it's trying to connect from 127.0.0.1
I feel like I must be missing something obvious but can't figure out what it is.
Thanks!