Your test configuration is sound. You have to hit enter "twice" after secret or it will timeout waiting for an Enter by itself. Here is a reference link All command packets are closed with two carriage returns. This article is for Asterisk 1.6 but the same still applies for later versions.
managerAMI not connecting:Connection closed by foregin host
Question
I am going through the asterisk definite guide and I followed the manager guide http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html/asterisk-book.html#AMI_id269468
This is my manager.conf file. I am using Asterisk-1.8
; Asterisk Call Management support
; By default asterisk will listen on localhost only.
[general]
enabled = yes
webenabled = yes
port = 5038
bindaddr = 127.0.0.1
[hello]
secret=world
; No access is allowed by default.
; To set a password, create a file in /etc/asterisk/manager.d
; use creative permission games to allow other serivces to create their own files
#include "manager.d/*.conf"
Below is my log file. After using sudo telnet 127.0.0.1 5038 and providing action,username,secret I am getting the following output
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Asterisk Call Manager/1.1
Action:Login
Username:hello
Secret:world
Connection closed by foreign host
Below is my log file:
[Jun 7 22:55:44] VERBOSE[5328] config.c: == Parsing '/etc/asterisk/logger.conf': [Jun 7 22:55:44] DEBUG[5328] config.c: Parsing /etc/asterisk/logger.conf
[Jun 7 22:55:44] VERBOSE[5328] config.c: == Found
[Jun 7 22:55:44] VERBOSE[5328] logger.c: Asterisk Queue Logger restarted
[Jun 7 22:56:40] VERBOSE[5533] manager.c: == Client from 127.0.0.1, failed to authenticate in 30 seconds
[Jun 7 22:56:40] VERBOSE[5533] manager.c: == Connect attempt from '127.0.0.1' unable to authenticate
And I am entering the commands(Action,username,Secret) before 30 seconds.I asked in Asterisk forum and they said to copy paste the Action,Username,Secret.Tried that but still not working
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow