D
D
DromHour2022-03-01 21:13:31
FreeSWITCH
DromHour, 2022-03-01 21:13:31

In FreeSwitch + FusionPBX, I can't connect to event_socket from an external IP, why?

There is a freshly installed server on which I installed:

  • free switch
  • FusionPBX
  • MongoDB 5.0
  • Node.JS 16.14.0

FusionPBX apparently connects to a socket.
However, I need to connect in addition to my own application.
Here is the code I am running via node.js:
const net = require('net');

const client = new net.Socket();
console.log('connecting')
client.connect(8021, '<Убрал IP>', function(a) {
  console.log('Connected', a);
  client.write('ClueCon');
});


client.on('data', function(data) {
  console.log('Received: ' + data);
  client.destroy();
});

client.on('close', function() {
  console.log('Connection closed');
});


Running this from the server outputs:
connecting
Connected undefined
Received: Content-Type: auth/request

Accordingly, there is access to the socket (well, almost)

But what happens when I try to do this from my computer:
Error: connect ECONNREFUSED <Убрал IP>:8021

I gave access to the computer with iptables, and I'm sure of it - otherwise there would be Timeout, like with other ports.

I also attach the settings of the event_socket module:
<configuration name="event_socket.conf" description="Socket Client">
  <settings>
    <param name="nat-map" value="false"/>
    <param name="listen-ip" value="<Убрал IP (внешний, а не 127.0.0.1)>"/>
    <param name="listen-port" value="8021"/>
    <param name="password" value="ClueCon"/>
    <param name="apply-inbound-acl" value="dromhour"/>
  </settings>
</configuration>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DromHour, 2022-03-02
@DromHour

For those who face the same problem:

  • Through iptables, you can still open the port for yourself, but I would prefer to just use something like ufw, which works through the same iptables, but is easier to configure. When setting up directly, I still missed something.
  • You will most likely change the socket password. Don't forget to do the same in FusionPBX at /app/settings/setting_edit.php
  • FreeSwitch are asking for authorization, and at first glance it is not at all clear how to enter the password. In fact, in the official documentation , the "auth my_password" command is specified.
  • Under Node.JS, there is an "esl" module that makes it easy to work with the socket itself. There is practically no documentation, I hope someday the author will find inspiration for it.
  • The hints in the comments above worked, I was able to connect to the socket

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question