I have two running SIP applications on a Debian buster server, one app use port 1000 (a softphone) and another one using port 2000 (VoIP server like FreePBX). both of them are on the same machine and OS. I want to connect these two applications together on the same server via port bridging. I used "SOCAT" but when SOCAT running the apps can not connect to the ports due to the port being opened by socat.

socat  TCP4-LISTEN:1000,reuseaddr TCP4-LISTEN:2000,reuseaddr

is there any other way to connect these two ports on localhost? or can SOCAT listen to the port in another way like sniffing?

  • 1
    Please edit your question and add more details: In which way do the applications use the ports? Listen and wait for a connection? Initiate a connection? What protocol do the applications use to communicate?
    – Bodo
    Jan 21, 2022 at 13:26
  • The protocol is SIP, I want to run PJSIP as a client on the same machine that runs the VOIP server (FreePBX) Jan 21, 2022 at 15:49
  • You could at least write in the question the exact socat command you're using in the attempt. Anyway SIP usually declares other streams (the voice itself etc.) in its commands and I'm not sure this kind of relaying will get these streams handled correctly.
    – A.B
    Jan 21, 2022 at 17:48
  • Question Updated Jan 21, 2022 at 19:14
  • Your socat command would listen on both ports and expect that both ends connect to the respective port. Is this right? I assume that your FreePBX acting as a SIP server will listen on port 2000 and your SIP client implemented with PJSIP will connect to port 1000. In the latter case you would need simple port forwarding. But why don't you configure/program one of FreePBX/PJSIP to use the matching port? In the first case FreePBX seems to act as a client and I doubt that you can connect to SIP clients using socat. This is what SIP servers do.
    – Bodo
    Jan 24, 2022 at 8:57


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.