docker-freepbx icon indicating copy to clipboard operation
docker-freepbx copied to clipboard

Difficulties when connecting via Proxy

Open riquedev opened this issue 3 years ago • 1 comments

Hello, I'm trying to install FreePBX inside a Portainer and I can make all connections to port 5060 normally, they all arrive at FreePBX but I'm having problems with the request headers (I'm testing via applications like Zoiper), see:

[2021-03-27 18:57:53] ERROR[1104] pjproject: sip_transport.c Error processing 597 bytes packet from UDP 192.168.100.1:39327 : PJSIP syntax error exception when parsing 'Via' header on line 2 col 37: REGISTER sip:192.168.100.100:5060 SIP/2.0 Via: SIP/2.0/UDP 192.168.100.1:39327branch=z9hG4bK.99qn03bai;rport From: sip:[email protected]:5060;tag=MIRec9E0K To: sip:[email protected]:5060 CSeq: 35 REGISTER Call-ID: f8x5CoJwbW Max-Forwards: 70 Supported: replaces, outbound, gruu Accept: application/sdp Accept: text/plain Accept: application/vnd.gsma.rcs-ft-http+xml Contact: sip:[email protected]:39327;transport=udp;+sip.instance="urn:uuid:a601bec0-2f0d-00c4-8eeb-a908e24c9942" Expires: 3600 User-Agent: LinphoneAndroid/4.3.1 (Mi A2) LinphoneSDK/4.4.2 (tags/4.4.2^0)

What happens externally is that a different machine, using Nginx, is trying to make a Proxy Pass for this one, apparently my Nginx is damaging the header (?), Is there any way to solve this?

Below my configuration on Nginx:

server {
      # freepbx pjsip                                                                                                                                                                                                                         
      listen [::]:5060 udp;                                                                                                                                                                                                                       
      listen 5060 udp;                                                                                                                                                                                                                        
      proxy_bind $remote_addr:$remote_port transparent;                                                                                                                                                                                           
      proxy_pass 192.168.100.109:5060;                                                                                                                                                                                                            
      proxy_responses 1;                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
}      

I don't have much experience with this, I just tried to follow several tutorials on the internet and I was stuck here for a few days.

riquedev avatar Mar 27 '21 19:03 riquedev

Out of the box Nginx only supports HTTP and HTTPS traffic. You need to use the stream {} block to enable UDP or TCP (non HTTP) traffic. Take a look at the docs here → https://docs.nginx.com/nginx/admin-guide/load-balancer/tcp-udp-load-balancer/

I use nginx proxy manager with my dockerised installation of FreePBX which has a GUI to help configure all of this for you.

neilherbertuk avatar Mar 14 '23 17:03 neilherbertuk