drachtio / drachtio-fsmrf

Drachtio freeswitch-based media resource function -- http://davehorton.github.io/drachtio-fsmrf
MIT License
48 stars 26 forks source link

Unable to connect Media Server ( Remote ) #41

Closed amanullahtanweer closed 4 years ago

amanullahtanweer commented 4 years ago

I have Drachtio Server hosted on a server, i can connect and run node apps from the server perfectly fine, but when i try to run it remortly it doesn't connect.

I tried editing ACL but didn't work out

{"level":30,"time":1593102971346,"pid":34771,"hostname":"Amanullahs-MacBook-Pro-2.local","msg":"connected to sip on tcp/95.217.176.58:5060,udp/95.217.176.58:5060"}

{"level":50,"time":1593102976326,"pid":34771,"hostname":"Amanullahs-MacBook-Pro-2.local","stack":"Error: Connection timeout}

"drachtio": { "host": "95.217.176.58", "port": 9022, "secret": "cymru" }, "freeswitch": { "address": "95.217.176.58", "port": 8021, "secret": "ClueCon" }

mrf.connect({ address: '95.217.176.58', port: 8021, secret: 'ClueCon' }) .then((mediaserver) => { console.log('successfully connected to mediaserver'); mediaserver.createEndpoint(function (ep) { console.log(ep); }); }) .catch((err) => { console.error(error connecting to mediaserver: ${err}); });

davehorton commented 4 years ago

It sounds like there is a firewall of some sort blocking the traffic from the server that the node.js app is on to the freeswitch on port 8021.

The connection that is failing is a tcp connection initiated from the node.js app to freeswitch.

from the server where you are starting the node.js app, are you able to connect to the freeswitch address via telnet?

telnet 95.217.176.58 8021

If not, the issue is network connectivity or firewalls

amanullahtanweer commented 4 years ago

Yes i have firewall on the server to prevent the requests from unknown bots..

EXECUTE [depth=0] sofia/drachtio_mrf/nobody@95.217.176.58:5060 answer()
EXECUTE [depth=0] sofia/drachtio_mrf/nobody@95.217.176.58:5060 socket(192.168.31.117:50722 async full)
2020-06-25 19:06:14.920561 [NOTICE] mod_event_socket.c:447 Trying host: 192.168.31.117:50722
recv 338 bytes from udp/[95.217.176.58]:5060 at 19:06:18.927378:
------------------------------------------------------------------------
BYE sip:drachtio@95.217.176.58:5080;transport=udp SIP/2.0
Via: SIP/2.0/UDP 95.217.176.58;rport;branch=z9hG4bKHZ4cH84t0FjZa
Max-Forwards: 70
From: <sip:95.217.176.58:5060>;tag=pgm83KS77BUeQ
To: <sip:drachtio@95.217.176.58:5080>;tag=SZ15p18Drr1QS
Call-ID: 04ae3af4-31a9-1239-c594-9600005aaaed
CSeq: 21998596 BYE
Content-Length: 0

recv 338 bytes from udp/[95.217.176.58]:5060 at 19:06:33.930837:
------------------------------------------------------------------------
BYE sip:drachtio@95.217.176.58:5080;transport=udp SIP/2.0
Via: SIP/2.0/UDP 95.217.176.58;rport;branch=z9hG4bKHZ4cH84t0FjZa
Max-Forwards: 70
From: <sip:95.217.176.58:5060>;tag=pgm83KS77BUeQ
To: <sip:drachtio@95.217.176.58:5080>;tag=SZ15p18Drr1QS
Call-ID: 04ae3af4-31a9-1239-c594-9600005aaaed
CSeq: 21998596 BYE
Content-Length: 0

2020-06-25 19:06:36.080580 [ERR] mod_event_socket.c:481 Socket Error: Connection timed out
2020-06-25 19:06:36.080580 [ERR] mod_event_socket.c:485 Socket Error!

Trying 95.217.176.58... Connected to 95.217.176.58. Escape character is '^]'. Content-Type: auth/request

Content-Type: text/disconnect-notice Content-Length: 67

Disconnected, goodbye. See you at ClueCon! http://www.cluecon.com/ Connection closed by foreign host.

amanullahtanweer commented 4 years ago

If you think its just some port blocking issue let me try this on a local hosted vm and see if the issue persists.

davehorton commented 4 years ago

I think you may be misunderstanding, and thinking the connection is made from the drachtio server machine to freeswitch. It is not -- it is made from the node.js server to freeswitch

amanullahtanweer commented 4 years ago

I think you may be misunderstanding, and thinking the connection is made from the drachtio server machine to freeswitch. It is not -- it is made from the node.js server to freeswitch

Let me try it on your AWS image and see if i can connect remotely from node app