Sign inSign up

wbh16/freepbx

By wbh16

Updated over 6 years ago

Imagem para baseada no SO Debian 10 e Freepbx15 e sounds pt_BR

Image
1

10K+

wbh16/freepbx repository overview

Dicas Importantes:

  • Caso queira usar o antigo CHAN_SIP, os clientes devem usar a porta 5160 para se autenticarem, caso contrario sempre dará erro de autenticação.
  • Na utilização do PJSIP na rede interna ele insistem em fazer nat pelo ip válido de saida para a internet, fazendo que as ligações fiquem mudas, não sei como mudar isso . Para contornar esta limitação optei por usar o CHAN_SIP legado que foi fácil configurar na rede interna, e fizuso do OPENVPN para clientes fora da rede.
  • Estou utilizando um pacote pt_BR que ainda não está totalmente adaptado ao contexto do freepbx 15 ficando algumas menssagens ainda em inglês.

Dockerfile:

#FROM dokken/debian-10 FROM wbh16/debian10:latest LABEL maintainer="wbh16 [email protected]"

ENV DEBIAN_FRONTEND noninteractive #ENV BCG729_VERSION=1.0.4

#Função das portas: #SMTP = 25 #SMTP /SSL = 465 #http = 80 #https = 443 #ssh = 22 #webmin = ?? #WebRTC s/ SSL = 8082 a 8083/tcp e udp #WebRTC s/ SSL = 9082 a 9083/tcp e udp #MGCP = 2727 #IAX2 = 4569/udp #IAX1 = 5036/udp #SIP Interno = 5060/tcp e udp #SIP Interno /SSL = 5061/tcp e udp #SIP externo = 5080 e 5090/tcp e udp #RTP = 10000 a 20000/udp #Monit. Datalog = 8125 a 8128/tcp e udp

EXPOSE 25 465 80 443 22 4569/udp 5038 5060/tcp 5060/udp 5061/tcp 5061/udp 8001 8003 8088 8089 10000-20000/tcp 10000-10100/udp

RUN echo deb http://deb.debian.org/debian/ buster main contrib > /etc/apt/sources.list
&& echo deb-src http://deb.debian.org/debian/ buster main contrib >> /etc/apt/sources.list
&& echo deb http://security.debian.org/debian-security buster/updates main contrib >> /etc/apt/sources.list
&& echo deb-src http://security.debian.org/debian-security buster/updates main contrib >> /etc/apt/sources.list
&& echo "# buster-updates, previously known as 'volatile'" >> /etc/apt/sources.list
&& echo deb http://deb.debian.org/debian/ buster-updates main contrib >> /etc/apt/sources.list
&& echo deb-src http://deb.debian.org/debian/ buster-updates main contrib >> /etc/apt/sources.list
&& echo "#BackPorts" >> /etc/apt/sources.list
&& echo deb http://http.debian.net/debian/ buster-backports main contrib >> /etc/apt/sources.list
&& echo deb http://ftp.br.debian.org/debian/ buster-backports main contrib >> /etc/apt/sources.list
&& echo deb-src http://ftp.br.debian.org/debian/ buster-backports main contrib >> /etc/apt/sources.list
&& apt-get update && apt-get upgrade -y
&& apt-get autoremove -y && apt-get autoclean

#Install all prerequisite packages
&& apt-get install -y build-essential linux-headers-uname -r openssh-server apache2 mariadb-server mariadb-client bison flex php php-curl
php-cli php-pdo php-mysql php-pear php-gd php-mbstring php-intl php-bcmath curl sox libncurses5-dev libssl-dev mpg123 libxml2-dev libnewt-dev
sqlite3 libsqlite3-dev pkg-config automake libtool autoconf git unixodbc-dev uuid uuid-dev libasound2-dev libogg-dev libvorbis-dev libicu-dev
libcurl4-openssl-dev libical-dev libneon27-dev libsrtp2-dev libspandsp-dev sudo subversion libtool-bin python-dev unixodbc dirmngr sendmail-bin
sendmail asterisk debhelper-compat cmake libmariadb-dev odbc-mariadb wget systemctl

#Timezone: && echo "America/Sao_Paulo" > /etc/timezone && rm /etc/localtime && ln -s /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime

#Install Node.js && curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
&& sudo apt-get install -y nodejs

#Install this pear module && pear install Console_Getopt

#Prepare asterisk: && /etc/init.d/asterisk stop
&& cd /etc/ && mkdir DIST && mv asterisk/* DIST
&& mv DIST asterisk/ && cd /etc/asterisk/ && cp DIST/asterisk.conf .
&& sed -i 's/(!)//' asterisk.conf
&& touch modules.conf && touch cdr.conf

#Configure Apache && sed -i 's/(^upload_max_filesize = )./\120M/' /etc/php/7.3/apache2/php.ini
&& sed -i 's/(^memory_limit = ).
/\1256M/' /etc/php/7.3/apache2/php.ini
&& sed -i 's/^(User|Group)./\1 asterisk/' /etc/apache2/apache2.conf
&& sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
&& a2enmod rewrite && /etc/init.d/apache2 restart && rm /var/www/html/index.html

#Configure odbc && echo "[MySQL]" > /etc/odbcinst.ini
&& echo "Description = ODBC for MySQL (MariaDB)" >> /etc/odbcinst.ini
&& echo "Driver = /usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so" >> /etc/odbcinst.ini
&& echo "FileUsage = 1" >> /etc/odbcinst.ini

&& echo "[MySQL-asteriskcdrdb]" > /etc/odbc.ini
&& echo "Description = MySQL connection to 'asteriskcdrdb' database" >> /etc/odbc.ini
&& echo "Driver = MySQL" >> /etc/odbc.ini
&& echo "Server = localhost" >> /etc/odbc.ini
&& echo "Database = asteriskcdrdb" >> /etc/odbc.ini
&& echo "Port = 3306" >> /etc/odbc.ini
&& echo "Socket = /var/run/mysqld/mysqld.sock" >> /etc/odbc.ini
&& echo "Option = 3" >> /etc/odbc.ini

#Download ffmpeg static build for sound file manipulation && cd /usr/local/src && wget "https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz"
&& tar xf ffmpeg-release-amd64-static.tar.xz && cd ffmpeg-4
&& mv ffmpeg /usr/local/bin

#Finally we get to install FreePBX

RUN cd /usr/local/src && /etc/init.d/mysql start
&& wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-15.0-latest.tgz
&& tar zxvf freepbx-15.0-latest.tgz && cd /usr/local/src/freepbx/
&& ./start_asterisk start && ./install -n && /etc/init.d/mysql stop

#Get the rest of the modules RUN /etc/init.d/mysql restart && fwconsole ma installall

#Uninstall digium_phones module, broken with PHP 7.3 RUN /etc/init.d/mysql restart && /etc/init.d/asterisk restart && fwconsole ma uninstall digium_phones

#Reload to apply config so far #RUN /etc/init.d/apache2 restart && /etc/init.d/mysql restart && /etc/init.d/asterisk restart && fwconsole r --verbose && /usr/sbin/fwconsole stop && /usr/sbin/fwconsole start #Use the sound files freepbx installed instead of the sound files from the Debian repo RUN cd /usr/share/asterisk && mv sounds sounds-DIST && ln -s /var/lib/asterisk/sounds sounds

#Need to restart in order to load Asterisk modules that weren't configured yet #&& fwconsole restart

#Set up systemd startup script && echo "[Unit]" > /etc/systemd/system/freepbx.service
&& echo "Description=FreePBX VoIP Server" >> /etc/systemd/system/freepbx.service
&& echo "After=mariadb.service" >> /etc/systemd/system/freepbx.service
&& echo "[Service]" >> /etc/systemd/system/freepbx.service
&& echo "Type=oneshot" >> /etc/systemd/system/freepbx.service
&& echo "RemainAfterExit=yes" >> /etc/systemd/system/freepbx.service
&& echo "ExecStart=/usr/sbin/fwconsole start -q" >> /etc/systemd/system/freepbx.service
&& echo "ExecStop=/usr/sbin/fwconsole stop -q" >> /etc/systemd/system/freepbx.service
&& echo "[Install]" >> /etc/systemd/system/freepbx.service
&& echo "WantedBy=multi-user.target" >> /etc/systemd/system/freepbx.service
&& chmod 755 /etc/systemd/system/freepbx.service && chown -R mysql:mysql /var/lib/mysql

#enable https in admin && a2ensite default-ssl &&
a2enmod ssl &&
/etc/init.d/apache2 restart

#Insrtalar drive khomp: #COPY config/khomp/channel_5.0_010_x86-64.sh /tmp/ #RUN apt-get update && apt-get install libusb-0.1-4 unzip && chmod +x /tmp/channel_5.0_010_x86-64.sh && /tmp/channel_5.0_010_x86-64.sh #RUN chown -R asterisk.asterisk /var/www/db
#&& chown -R mysql:mysql /var/lib/mysql \

#COPY configs/audio/pt_BR /usr/share/asterisk/sounds/pt_BR ##COPY configs/custom/ /var/lib/asterisk/sounds/custom/

#Instalar iSymphonyServerV3 #RUN tar && java

#Optional tools #RUN apt-get install --no-install-recommends -y tcpdump tcpflow whois sipsak sngrep

#ADD config/run_progs.sh /run_progs.sh #RUN chmod -v +x /run_progs.sh

RUN systemctl enable apache2 && systemctl enable ssh && systemctl enable freepbx
&& systemctl enable asterisk && systemctl enable rsyslog

ENTRYPOINT ["systemctl","default","--init"]

#CMD ["systemctl","start","mysql"]

#--privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro #Asterisk and FreePBX 15 are installed! Go to the web interface at http://YOUR-IP to finish setup

2 - Exemplo de docker-compose.yml:

version: '3.3' networks: vlan_172_admin: external: true services: freepbx: image: wbh16/freepbx:latest container_name: freepbx hostname: freepbx #environment: # - ADMIN_PASSWORD=admin restart: always # ports: # - 8080:80 # - 5060:5060/udp # - 5160:5160/udp # - 3306:3306 # - 18000-18100:18000-18100/udp networks: vlan_172_admin: ipv4_address: 172.17.80.243 cap_add: - ALL

volumes:

- backup:/backup

- recordings:/var/spool/asterisk/monitor

- freepbx-etc:/etc

- freepbx-www:/var/www

- freepbx-log:/var/log

- freepbx-lib:/var/lib

- freepbx-home:/home

- /etc/resolv.conf:/etc/resolv.conf:ro

- ../flaviostutz-freepbx:/home

#volumes: #backup: #recordings: #freepbx-etc: #freepbx-www: #freepbx-log: #freepbx-lib: #freepbx-home:

Tag summary

Content type

Image

Digest

Size

1.7 GB

Last updated

over 6 years ago

docker pull wbh16/freepbx