Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote updates #2

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .dockerignore
Empty file.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.bingkey
20 changes: 8 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM debian:jessie
MAINTAINER "Lorenzo Mangani <lorenzo.mangani@gmail.com>"
LABEL MAINTAINER "Lorenzo Mangani <lorenzo.mangani@gmail.com>"

USER root

RUN apt-get update && apt-get install -y sudo git make bison flex curl && \
RUN apt-get update && apt-get install -y sudo git make bison flex curl libz-dev libssl-dev x11-apps && \
echo "mysql-server mysql-server/root_password password passwd" | sudo debconf-set-selections && \
echo "mysql-server mysql-server/root_password_again password passwd" | sudo debconf-set-selections && \
apt-get install -y mysql-server libmysqlclient-dev \
Expand Down Expand Up @@ -31,21 +31,13 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
#cp /lib/modules/$(uname -r)/extra/xt_RTPENGINE.ko /rtpengine/xt_RTPENGINE.ko && \
apt-get clean


RUN apt-get purge -y bison build-essential ca-certificates flex git m4 pkg-config curl && \
apt-get autoremove -y && \
apt-get install -y libmicrohttpd10 rsyslog ngrep && \
apt-get clean

COPY conf/opensipsctlrc /usr/local/etc/opensips/opensipsctlrc
COPY conf/opensips-rtpengine.cfg /usr/local/etc/opensips/opensips.cfg
COPY rtpengine/rtpengine-recording.conf /etc/rtpengine/rtpengine-recording.conf

COPY boot_run.sh /etc/boot_run.sh
RUN chown root.root /etc/boot_run.sh && chmod 700 /etc/boot_run.sh

RUN apt install -y curl git && \
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - && \
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - && \
apt-get install -y nodejs && \
cd /opt && git clone https://github.com/lmangani/RTPEngine-Speech2Text && \
cd RTPEngine-Speech2Text && npm install && npm install -g forever
Expand All @@ -56,5 +48,9 @@ EXPOSE 9060/udp
EXPOSE 9060/tcp
EXPOSE 6060/udp
EXPOSE 20000-20100/udp

COPY conf/opensipsctlrc /usr/local/etc/opensips/opensipsctlrc
COPY conf/opensips-rtpengine.cfg /usr/local/etc/opensips/opensips.cfg
COPY rtpengine/rtpengine-recording.conf /etc/rtpengine/rtpengine-recording.conf
COPY boot_run.sh /etc/boot_run.sh
RUN chown root.root /etc/boot_run.sh && chmod 700 /etc/boot_run.sh
ENTRYPOINT ["/etc/boot_run.sh"]
11 changes: 6 additions & 5 deletions boot_run.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -x
# OpenSIPS Docker bootstrap

MYSQL_PWD=${MYSQL_PWD:-"passwd"}
Expand All @@ -8,14 +9,14 @@ ADVERTISED_PORT=${ADVERTISED_PORT:-"5060"}
ADVERTISED_RANGE_FIRST=${ADVERTISED_RANGE_FIRST:-"20000"}
ADVERTISED_RANGE_LAST=${ADVERTISED_RANGE_LAST:-"20100"}
WSS_PORT=${WSS_PORT:-"5061"}

mkdir -p /lib/modules/$(uname -r)/updates
HOST_IP=$(ip route get 8.8.8.8 | awk '{print $NF; exit}')

echo "Your IP : ${HOST_IP}"
echo "Public IP : ${EXTERNAL_IP}"
echo -e "Advertised IP:PORT : ${ADVERTISED_IP}:${ADVERTISED_PORT}\n\n"
echo -e "Advertised RTP Range : ${ADVERTISED_RANGE_FIRST}-${ADVERTISED_RANGE_LAST}\n\n"

uname -r
# Starting MySQL
service mysql start

Expand All @@ -38,11 +39,11 @@ sed -i "s/listen=udp.*/listen=udp:${HOST_IP}:${ADVERTISED_PORT}/g" /usr/local/et
sed -i "s/listen=ws.*/listen=ws:${HOST_IP}:${WSS_PORT}/g" /usr/local/etc/opensips/opensips.cfg

# Prepare RTPEngine modules
mkdir /lib/modules/$(uname -r)/updates
cp -u /rtpengine/xt_RTPENGINE.ko "/lib/modules/$(uname -r)/updates/xt_RTPENGINE.ko"

cp -fu /rtpengine/xt_RTPENGINE.ko "/lib/modules/$(uname -r)/updates/xt_RTPENGINE.ko"
depmod -a
modprobe xt_RTPENGINE
mkdir /recording
mkdir -p /recording
# Starting RTPEngine process
echo 'del 0' > /proc/rtpengine/control || true
rtpengine-recording --config-file=/etc/rtpengine/rtpengine-recording.conf
Expand Down
7 changes: 6 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version: '2.2'
services:
opensips-rec:
build: .
image: qxip/docker-rtpengine-speech
privileged: true
restart: always
Expand All @@ -9,10 +10,14 @@ services:
ADVERTISED_RANGE_LAST: 20100
HOMER_SERVER: '127.0.0.1'
HOMER_PORT: 9060
BING_KEY: 'YOUR_KEY_HERE'
BING_KEY: ${BING_KEY}
volumes:
- /var/lib/mysql
- /recording
- conf/opensipsctlrc:/usr/local/etc/opensips/opensipsctlrc
- conf/opensips-rtpengine.cfg:/usr/local/etc/opensips/opensips.cfg
- rtpengine/rtpengine-recording.conf:/etc/rtpengine/rtpengine-recording.conf
- boot_run.sh:/etc/boot_run.sh
ports:
- "9060:9060/udp"
- "5060:5060/udp"
Expand Down