Freepbx unable to connect to asterisk manager: connection to port 5038 refused

hello everyone I have a configuration problem with freebpx: i foolowed all the instructions regarding installing and configuring asterisk and freebox. At the end, i always have this error:
exit: 1

Checking for PEAR DB…OK
Checking for PEAR Console::Getopt…OK
Checking for /etc/amportal.conf …OK
Bootstrapping /etc/amportal.conf …OK
Parsing /etc/amportal.conf …OK
Parsing /etc/asterisk/asterisk.conf …OK
Connecting to database…OK
Connecting to Asterisk manager interface…Tue, 20 Dec 2011 17:54:35 +0000 - Unable to connect to manager 127.0.0.1:5038 (111): Connection refused
FAILED
[FATAL] Asterisk Manager Connection Failure Failed to connect to the Asterisk manager through port: 5038
1 error(s) occured, you should view the notification log on the dashboard or main screen to check for more details.

You did not tell us what Operating System and procedure you are following.

You also did not tell us the FreePBX version.

Without this information it is not possible to offer specific help.

The bottom line is the credentials in /etc/asterisk/manager.conf don’t match the settings in FreePBX.

I use debian Version: 2,30,2 and 2,5,1 freepbx

Thanks for your reply I use debian 6 freepbx 2.5.

Hello, I have a similar problem connecting to Asterisk and I am hoping it is related to yours so we can both figure out the solution to our problems.

I am using the Freepbx distro (with CentOS) that is version 1.87.29.55.
On top of this instillation, I have also installed FOP2 and Asternic Call Statistics (This is most likely unneeded information, but in case it is related).

The system status when I log into the web interface (PBX Administrator) suggests that Asterisk is not on and it cannot connect to the retrieve_conf giving the error:
Reload failed because retrieve_conf encountered an error: 1
Added 16 minutes ago
(freepbx.RCONFFAIL)

When I run ps ax on the machine it shows that Asterisk is indeed running.
I can connect to Asterisk locally by running #asterisk -r, but this will show that there are authentication errors:
NOTICE[8447]: manager.c:2314 authenticate: 127.0.0.1 failed to authenticate as ‘admin’

netstat -nl |grep 5038 suggested that a connection had been made to that port from the localhost, which suggested to me the port was open - however when I try to telnet to that port I am closed by a foreign host.

From what I can tell all of my administrator usernames and passwords match up in the configuration files that I could find
/etc/asterisk/manager.conf
/etc/asterisk/manager_custom.conf
/etc/amportal.conf

As per the recommended fix that other people have given, I have also checked to see if the OS can resolve “localhost” and it can

I hope that maybe this can help both the original poster’s problem and mine - and I do not intend to hijack the thread (apologies if I did).

In FreePBX 2.5 the manager settings are in /etc/amportal.conf

They need to match the settings in /etc/asterisk/manager.conf

FreePBX 2.5 is very old. You should consider using 2.8 then using the upgrade tool in FreePBX to move to 2.9

try this command in root mode: amportal start.
then it will work fine