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

Voice does not pass.

Open osnosov opened this issue 5 years ago • 17 comments

Hi. Help me please. Home LAN 192.168.10.0/24 New installation ubuntu server 20.04 (ip: 192.168.10.20), snap package Docker. Install https://github.com/tiredofit/docker-freepbx/blob/15/examples/docker-compose.yml Create 2 Extensions [chan_sip]: 1001 and 1002. PS, softphone Linphone, connect to number 1001 (ip:192.168.10.6). Android smartphone, softphone Linphone, connect to number 1001. Tried and other softphones. Call 1001 -> 1002 or 1002 -> 1001, call is dropped randomly through time 1-30s. Voice does not pass. If you call the number does not exist (for example, the number in 1005), then hear the answer of no existence of numbers.

osnosov avatar Sep 03 '20 10:09 osnosov

I have the same issue, i tried it locally and also a new installation in my vps, and it's not working, the voice don't pass

UPDATE: After a day playing with this image, i found that it has a problem whit the port forward, and astererisk itslef... asterisk needs the ports 18.000 to 20.000 openeds to listen for rtp connections( udp ) to pass the voice... the problem with this is docker itself can't open 2000 ports, because for every port opened it will use a bit of cup and ram... in my case 4 gb ram was not enought ... so the only whay to make this image working is to run it in host network... (network_mode: host) but it's not ideal because you cant run more servers etc.... and also i found that is working fine in local but not in my vps... so i thing its not the best way and it needs a solution... i mean what about separate the image in multipe microservices? asterisk image... database image ... apache image ... etc... and use them togheter to run the project and only execute asterisk as host node... so all udp ports can be opened whitout expose database or webserver

andreigae avatar Sep 03 '20 19:09 andreigae

I answer myself at last i could set it up propley and now is working fine ...

docker-compose.yml version: '3' services: freepbx: container_name: freepbx-app image: tiredofit/freepbx:15 restart: always

ports:
  - 5000:80
  - 5060:5060/udp
  - 5160:5160/udp
  - 18000-18100:18000-18100/udp

volumes:
  - ./certs:/certs
  - ./data:/data
  - ./logs:/var/log
  - ./data/www:/var/www/html

environment:
  - VIRTUAL_NETWORK=host
  - ZABBIX_HOSTNAME=freepbx-app
  - RTP_START=18000
  - RTP_FINISH=18100

cap_add:
  - NET_ADMIN

networks:
  - freepbx-network

networks: freepbx-network: driver: bridge

After everithing was started, login and create new extensions... but as legacy extensions.... sip no pjsip

after that just go to settings->asterisk sip settings -> detect network settings->asterisk sip settings -> rtp port range change to 18000-18100

save and everithing will work...

i understand than it has to be configured by docker... but as i can se it isn't configurated automatically....

andreigae avatar Sep 04 '20 21:09 andreigae

@andreigae I tried to make it work but there's still no voice passed, any idea? Im using MacOs

***More info:

I setup 2 extensions and use Zoiper (1 for Android phone, 1 for Mac) [email protected]:5160 [email protected]:5160

asterisk sip settings -> detect network External Address: xxxx Local Networks: 172.24.0.0/16

RTP Port Ranges: 18000 - 18100

Here is my docker compose: `version: '3'

services: freepbx-app: container_name: freepbx-app image: tiredofit/freepbx ports: - 80:80 - 5060:5060/udp - 5160:5160/udp - 18000-18100:18000-18100/udp volumes: - ./certs:/certs - ./data:/data - ./logs:/var/log - ./data/www:/var/www/html

environment: 
  - VIRTUAL_NETWORK=host
  - ZABBIX_HOSTNAME=freepbx-app
  - RTP_START=18000
  - RTP_FINISH=18100

### Use for External MySQL Server
  - DB_EMBEDDED=FALSE

  - ENABLE_FAIL2BAN=FALSE
### These are only necessary if DB_EMBEDDED=FALSE
  - DB_HOST=freepbx-db
  - DB_PORT=3306
  - DB_NAME=asterisk
  - DB_USER=asterisk
  - DB_PASS=asteriskpass
 
restart: always
networks:
  - freepbx-network

freepbx-db: container_name: freepbx-db image: tiredofit/mariadb restart: always volumes: - ./db:/var/lib/mysql environment: - MYSQL_ROOT_PASSWORD=password - MYSQL_DATABASE=asterisk - MYSQL_USER=asterisk - MYSQL_PASSWORD=asteriskpass networks: - freepbx-network

networks: freepbx-network: driver: bridge `

khacthanhf avatar Oct 16 '20 19:10 khacthanhf

@khacthanhf

Try to add

cap_add:

  • NET_ADMIN

to docker-compose.yml file and also run the database in the same container (it is going to fail less)

UPDATE: After i have ran this setup in a production server for 2 weeks i can confirme that it is not really ready for production server i mean the voice pass i can make and receive calls without problems but sometimes the voice is distorsioned because of docker nat

and also because docker has to open a new rtp port for that call. so if the port is opened because you just had another call the voice is perfect. but if you wait for example for 2 hours and receive a call the voice could be distorsioned sometimes

so i recomand this setup only for servers where the coinatiner will use the host Network, in that case you will not have any problem

you can use a 5$ vps for this setup without any problems

but if you are interested in having your own private Cloud PBX and you don't care if the PBX will not run in your own servers.... there are anothers options in the marketplace free...

andreigae avatar Oct 16 '20 20:10 andreigae

Some of us use this with thousands of calls per day on a multi extension system :)

tiredofit avatar Oct 17 '20 00:10 tiredofit

@andreigae thanks for your information, but I cannot manage to make it work, call is dropped after a few seconds, no voice passed :(,does it OS related issue?

khacthanhf avatar Oct 17 '20 13:10 khacthanhf

I have the same problem, also after above variant docker compose adjusted and made the settings for SIP rtp port range. Unfortunately without success (synology NAS). Same problem also with the release of flaviostutz/freepbx.

I've gotten to the point where I would run FreePBX as host. However, I can't because of port 80 which is already in use. Is there any way to specify an alternate port via docker compose in host mode?

aBua-MUC avatar Dec 29 '20 14:12 aBua-MUC

Sure - Set your HTTP_PORT to something other than 80. I have never tested but worked this in a few years ago as a just in case measure.

tiredofit avatar Dec 29 '20 17:12 tiredofit

@tiredofit thank you very much!

I get the container to run with "- HTTP_PORT=8980"

`version: '2'
services:
  freepbx-app:
    container_name: freepbx-app
    image: tiredofit/freepbx
    network_mode: "host"
    volumes:
      - /volume1/docker/asterisk/certs:/certs
      - /volume1/docker/asterisk/data:/data
      - /volume1/docker/asterisk/logs:/var/log
      - /volume1/docker/asterisk/html:/var/www/html

    environment: 
      - HTTP_PORT=8980
      - ZABBIX_HOSTNAME=freepbx-app
      - RTP_START=18000
      - RTP_FINISH=18500
      - DB_EMBEDDED=TRUE
    restart: always

but under IP:8980/admin theres is no connection possible. Do you have maybe a docker-compose.yml for "dummies" Thanks a lot

aBua-MUC avatar Dec 29 '20 20:12 aBua-MUC

That should do it TBH. It's been a while since this was all put together.

Sadly I think you may have to do some digging inside the container. Starting with netstat -tunap would be a great place to see if indeed the apache process is listening on 8980.

curl http://localhost:8980 is another great one followed by the same but with /admin.

If indeed the curl command sends out data there is a Docker host networking issue- although there shouldn't. I know new versions of docker-compose don't allow you to add

ports:
  - 8980:80 

anymore, but you could try it anyways. Sadly we're bending it again in ways that we shouldn't, as I already bent freepbx pretty hard to make it work this way :)

tiredofit avatar Dec 29 '20 21:12 tiredofit

For the folks that is keep trying to use this docker container, Yes there is a problem with the sound but almost always is about the rtp port of asterisk and the NAT of docker, etc,

so the best way to run this container without any problem is to run it in the host network: network_mode: "host" In This way docker will not do any nat, so it will use the minimum resources and the voice will pass without any problem, because it will work similar to fresh install in the host, so we can keep the benefits of docker like the posibility to move to another provider in any moment, make a full backup of everything and run it local, etc.

My configs is:

docker-compose.yml

version: '3' services: freepbx: container_name: freepbx-app image: tiredofit/freepbx:15-5.0.6 restart: always

network_mode: "host"

volumes:
 - ./certs:/certs
 - ./data:/data
 - ./logs:/var/log
 - ./data/www:/var/www/html
 - ./fail2ban:/etc/fail2ban

environment:
 - HTTP_PORT=8000
 - HTTPS_PORT=4433

 - VIRTUAL_NETWORK=host
 - ZABBIX_HOSTNAME=freepbx
 - ENABLE_FAIL2BAN=TRUE
 - DB_EMBEDDED=FALSE
 - DB_HOST=127.0.0.1
 - DB_PORT=3306
 - DB_NAME=asterisk
 - DB_USER=asterisk
 - DB_PASS=asteriskpass
deploy:
  resources:
    limits:
      memory: 800M


cap_add:
 - NET_ADMIN

freepbx-db: container_name: freepbx-db image: tiredofit/mariadb:3.7.0 restart: always

expose: 
 - 3306

network_mode: "host"

volumes:
 - ./database:/var/lib/mysql
environment:
 - MYSQL_ROOT_PASSWORD=rootpassword
 - MYSQL_DATABASE=asterisk
 - MYSQL_USER=asterisk
 - MYSQL_PASSWORD=asteriskpass

when you have started the container and the installation of freepbx is done you have to open the ports of the VPS/Server for asterisk: 5160,5060,10000-20000/tcp//udp and the everything will work fine

root@vps-ovh:~# ufw status numbered Status: active

 To                         Action      From
 --                         ------      ----

[ 1] OpenSSH ALLOW IN Anywhere
[ 2] Nginx Full ALLOW IN Anywhere
[ 3] 10000:20000/tcp ALLOW IN Anywhere
[ 4] 5160 ALLOW IN Anywhere
[ 5] 5060 ALLOW IN Anywhere
[ 6] 10000:20000/udp ALLOW IN Anywhere
[ 7] 4433 ALLOW IN 192.168.20.0/24
[ 8] OpenSSH (v6) ALLOW IN Anywhere (v6)
[ 9] Nginx Full (v6) ALLOW IN Anywhere (v6)
[10] 10000:20000/tcp (v6) ALLOW IN Anywhere (v6)
[11] 5160 (v6) ALLOW IN Anywhere (v6)
[12] 5060 (v6) ALLOW IN Anywhere (v6)
[13] 10000:20000/udp (v6) ALLOW IN Anywhere (v6)

`

andreigae avatar Jan 06 '21 00:01 andreigae

Hello Everyone! I'm not sure if anyone has been able to fix this issue. I can make internal calls and externals, but the voice doesn't pass and the calls end after 30s.

I have tried a few setups from this tread, HTTP_Port:80 give me and on the nginx. I have also tried the network_mode: "host" on a separate VPS. I also disable the UFW firewall to check if it's a firewall configuration. I have been following this Youtube playlist to set up my system https://www.youtube.com/watch?v=fTtql5lMeKk&t=4s. At the moment I'm only using zopier softphone on MacOS and iOS. I'm using SIP Legacy [chan_sip] on 'Port 5060'. I created a separate reverse proxy network for FreePBX, that still connected to 'jrcs/letsencrypt-nginx-proxy-companion'.

My environment is as follow:

  • VPS
  • Ubuntu 16.04.7
    • 2 CPU
  • 4 GB Ram
  • Reverse Proxy using docker jrcs/letsencrypt-nginx-proxy-companion
  • Telnyx - SIP provider
  • Softphone: Zopier

This is my docker-compose file:

version: '2'

services: freepbx-app: container_name: freepbx-app image: tiredofit/freepbx ports: #### If you aren't using a reverse proxy # - 80 #### If you want SSL Support and not using a reverse proxy #- 443:443 - 5060:5060/udp - 5160:5160/udp - 18000-18100:18000-18100/udp #### Flash Operator Panel - 4445:4445 volumes: - ./certs:/certs - ./data:/data - ./logs:/var/log - ./data/www:/var/www/html ### Only Enable this option below if you set DB_EMBEDDED=TRUE #- ./db:/var/lib/mysql ### You can drop custom files overtop of the image if you have made modifications to modules/css/whatever - Use with care #- ./assets/custom:/assets/custom

environment:
  - VIRTUAL_HOST=sub.domain.com
  - VIRTUAL_NETWORK=freepbx
      # If you want to connect to the SSL Enabled Container
  #- VIRTUAL_PORT=443
  #- VIRTUAL_PROTO=https
  #- HTTP_PORT=80
  - VIRTUAL_PORT=80
  - LETSENCRYPT_HOST=sub.domain.com
  - [email protected]
  - ADMIN_PASSWORD=password
  - ZABBIX_HOSTNAME=freepbx-app

  - RTP_START=18000
  - RTP_FINISH=18100
 ## Use for External MySQL Server
  - DB_EMBEDDED=FALSE'

 ### These are only necessary if DB_EMBEDDED=FALSE
  - DB_HOST=freepbx-db
  - DB_PORT=3306
  - DB_NAME=asterisk
  - DB_USER=asterisk
  - DB_PASS=password

 ### If you are using TLS Support for Apache to listen on 443 in the container drop them in /certs and set these:
 #- TLS_CERT=cert.pem
 #- TLS_KEY=key.pem

restart: always
networks:
  - proxy-tier

### These final lines are for Fail2ban. If you don't want, comment and also add ENABLE_FAIL2BAN=FALSE to your environment
cap_add:
  - NET_ADMIN
privileged: true

freepbx-db: container_name: freepbx-db image: tiredofit/mariadb restart: always volumes: - ./db:/var/lib/mysql environment: - MYSQL_ROOT_PASSWORD=password - MYSQL_DATABASE=asterisk - MYSQL_USER=asterisk - MYSQL_PASSWORD=password networks: - proxy-tier

freepbx-db-backup: container_name: freepbx-db-backup image: tiredofit/db-backup links: - freepbx-db volumes: - ./dbbackup:/backup environment: - ZABBIX_HOSTNAME=freepbx-db-backup - DB_HOST=freepbx-db - DB_TYPE=mariadb - DB_NAME=asterisk - DB_USER=asterisk - DB_PASS=password - DB_DUMP_FREQ=1440 - DB_DUMP_BEGIN=0000 - DB_CLEANUP_TIME=8640 - COMPRESSION=BZ - MD5=TRUE networks: - proxy-tier restart: always

networks: proxy-tier: external: name: freepbx`

I hope someone can help me. Thank you in advance!

jrd2017 avatar Jan 25 '21 22:01 jrd2017

Hello Everyone! I'm not sure if anyone has been able to fix this issue. I can make internal calls and externals, but the voice doesn't pass and the calls end after 30s.

I got it working by setting

  • VIRTUAL_NETWORK=host
  • using port 5160 (not 5060) for legacy SIP
  • I also updated the external address of my NAT settings to the IP address of my docker host system

image

janvda avatar Mar 21 '21 12:03 janvda

hi @tiredofit ,

I have tried to deploy it with same settings as instructed. But getting voice issue. Can you please specify the settings that we need to do for Iptables NAT etc to achieve our target.

I dont see any issue in the deployment though. Still I would require your help in getting this voice issue resolved. Please suggest any changes which might not be available in the Doc.

Thanks

ArsalanAli301 avatar Jul 27 '21 07:07 ArsalanAli301

this stack won't work as is due to docker NAT problems.

No matter what you tell FreePBX as "External address", RTP packets will be sent to containerized docker addresses.

As stated in the thread, you have to remove at least one NAT layer to make it work by running the stack in network_mode: host

arkanoid87 avatar Oct 12 '21 22:10 arkanoid87

for me just making sure the RTP range same as what is in the docker-compose was the trick . no home network was needed.

galaxyware241 avatar May 31 '22 08:05 galaxyware241

Hi everyone, I was having the same issue but fixed by --net host. Now I have another problem. I cannot log into the web panel anymore because in the host there is already a nginx proxy. How can I edit the web panel port? I've tried with VIRTUAL_PORT, HTTP_PORT, but nothing works for me!

pierluigizagaria avatar Jun 03 '22 14:06 pierluigizagaria