Problems connecting to AMI console

Hi guys!!
I´m new with the asterisk and i´m having some problems to connect to the AMI console.

I can´t connect to AMI by telnet 5038 port to the Asterisk server. I can´t do it neither doing a telnet:5038 to the asterisk server from the asterisk server itself. Telnet is enabled and i have no problems in connecting it by telnet 23 port.

I configured the file etc/asterik/manager_custom.conf as follow:

[admin]
secret = password
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
permit=192.168.1.0/255.255.255.0 ; corporate network
permit=172.16.0.0/255.255.0.0 ;corporate network
read = system,call,log,verbose,command,agent,user,config,command,dtmf,reporting,cdr,dialplan,originate
write = system,call,log,verbose,command,agent,user,config,command,dtmf,reporting,cdr,dialplan,originate

After this i executed like root:
asterisk -rx’manager reload’

The error is as folow:

Asterisk Call Manager/1.1
Action: Login
Username: admin
Secret: password

Response: Error
Message: Missing action in request

Do you know what am i doing wrong?

Thank so much!!!

You are connecting OK.

Maybe the telnet client is initiation telnet protocol requests, which are appearing ahead of the A in Action.

Maybe the client is not in true telnet, line buffered, mode and is not sending CR-LF when you press return.

What are you using as the client?

You can also try disabling iptables / SELinux temporary.

It looks like a malformed request, not a security issue, to me.

I’m assuming that the error is produced in response to the blank line, rather than on a timeout.

Thanks guys!

Bichara, the firewall and SeLinux are disabled on the asterisk server (CentOS).

I tested again copy and pasting
Action: Login
Username: admin
Secret: password

And now I can connect to AMI when i connect by telnet:5038 from the asterisk itself:

[root@elastix01 ~]# telnet
telnet> open 127.0.0.1 5038
Trying 127.0.0.1…
Connected to localhost (127.0.0.1).
Escape character is ‘^]’.
Asterisk Call Manager/1.1
Action: Login
Username: admin
Secret: password

But I can´t connect when I try to connect to AMI by telnet:5038 to the asterisk server from the network 172.16.0.0/16 ussing Putty. This network is configured to permit in the etc/asterik/manager_custom.conf file:

[admin]
secret = password
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
permit=192.168.1.0/255.255.255.0 ; corporate network
permit=172.16.0.0/255.255.0.0 ;corporate network
read = system,call,log,verbose,command,agent,user,config,command,dtmf,reporting,cdr,dialplan,originate
write = system,call,log,verbose,command,agent,user,config,command,dtmf,reporting,cdr,dialplan,originate

In theory, por 5038 is open in the firewalls.

David55 says:
“Maybe the client is not in true telnet, line buffered, mode and is not sending CR-LF when you press return.”

How can I configure Putty correctly or which other telnet client must I use?

Thanks so much for your help!!

The Windows native one works.

Note that is not line buffered, so you cannot correct typos.

It´s working!!
I just used the windows native telnet client like you said.

Thanks!!