fsockopen(): unable to connect to 127.0.0.1:8021

Status
Not open for further replies.

Edson

Member
Aug 1, 2017
59
4
8
47
Dear,

I just installed fusionpbx in a server cloud. Everything seems to be ok but in dashboard there is a warning message: Warning: fsockopen(): unable to connect to 127.0.0.1:8021 (Connection refused) in /var/www/fusionpbx/resources/classes/event_socket.php on line 111

What can be happening? Can you help me, please!?

Regards,

Edson
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,043
565
113
Check the event socket config in /etc/freeswitch/autoload_configs/event_socket.conf.xml

It should look like this:
Code:
<configuration name="event_socket.conf" description="Socket Client">
  <settings>
    <param name="nat-map" value="false"/>
    <param name="listen-ip" value="127.0.0.1"/>
    <param name="listen-port" value="8021"/>
    <param name="password" value="ClueCon"/>
    <!--<param name="apply-inbound-acl" value="lan"/>-->
  </settings>
</configuration>

Other than that, is freeswitch even running??

ps aux | grep freeswitch
 

Edson

Member
Aug 1, 2017
59
4
8
47
Dear,

Thanks so much.

I checked the file and it seems to be ok.

<configuration name="event_socket.conf" description="Socket Client">
<settings>
<param name="nat-map" value="false"/>
<param name="listen-ip" value="127.0.0.1"/>
<param name="listen-port" value="8021"/>
<param name="password" value="ClueCon"/>
<!--<param name="apply-inbound-acl" value="lan"/>-->
</settings>
</configuration>

Freeswith is running:

[root@mtjq6tzkr9 ~]# ps aux | grep freeswitch
freeswi+ 667 0.7 3.4 1303304 34948 ? S<sl Aug28 8:34 /usr/bin/freeswitch -u freeswitch -g daemon -ncwait -nonat
root 10409 0.0 0.0 112648 972 pts/0 S+ 05:52 0:00 grep --color=auto freeswitch
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,043
565
113
Dear,

Thanks so much.

I checked the file and it seems to be ok.

<configuration name="event_socket.conf" description="Socket Client">
<settings>
<param name="nat-map" value="false"/>
<param name="listen-ip" value="127.0.0.1"/>
<param name="listen-port" value="8021"/>
<param name="password" value="ClueCon"/>
<!--<param name="apply-inbound-acl" value="lan"/>-->
</settings>
</configuration>

Freeswith is running:

[root@mtjq6tzkr9 ~]# ps aux | grep freeswitch
freeswi+ 667 0.7 3.4 1303304 34948 ? S<sl Aug28 8:34 /usr/bin/freeswitch -u freeswitch -g daemon -ncwait -nonat
root 10409 0.0 0.0 112648 972 pts/0 S+ 05:52 0:00 grep --color=auto freeswitch

I see a problem straight away, you are not using the standard debian install are you??

A debian install would have freeswitch running as user and group www-data
 

Edson

Member
Aug 1, 2017
59
4
8
47
I have just solved the issue. My server is under NAT, so i changed this line <param name="nat-map" value="false"/> to <param name="nat-map" value="true"/> and now the event service is running and php is able to connect to it:

[root@mtjq7tzkr9 ~]# netstat -atn | grep 8021
tcp 0 0 127.0.0.1:8021 0.0.0.0:* LISTEN
[root@mtjq7tzkr9 ~]#

running
 

avttd

New Member
Sep 12, 2017
1
0
1
42
to me this method did not help.
I had in /etc/systemd/system/multi-user.target.wants comment $DAEMON_OPTS
 

Edson

Member
Aug 1, 2017
59
4
8
47
Dear avttd,

Sorry, you mean you had to comment this following line on freeswtich.service file to solve this issue?

ExecStart=/usr/bin/freeswitch -u freeswitch -g daemon -ncwait $DAEMON_OPTS
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,043
565
113
Freeswitch should be running under user www-data and group www-data
 

Jeff w

New Member
Sep 15, 2017
1
0
1
43
I confirm this is an issue. I spun up a brand new CentoOS 7 on digital ocean and followed instructions on installation however I too have the same error I will investigate and figure out why...
 

Edson

Member
Aug 1, 2017
59
4
8
47
Yes, it seems to be an issue regarding Centos 7 installation as well.

The best workaround so far to solve this issue is to comment $DAEMON_OPTS command on freeswitch.service start up script. Reboot Server and the check if Event Socket is running properly on port 8021 (netsat -atn)

nano /etc/systemd/system/multi-user.target.wants/freeswitch.service

ExecStart=/usr/bin/freeswitch -u freeswitch -g daemon -ncwait ; $DAEMON_OPTS
 
Status
Not open for further replies.