From 73d273354133d1e76fc1590abb21603cc855cc8c Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Fri, 5 Nov 2021 12:17:25 -0400 Subject: [PATCH 01/16] WIP --- Dockerfile | 25 +++++++++++++++++++------ rtpengine.conf | 12 ------------ 2 files changed, 19 insertions(+), 18 deletions(-) delete mode 100644 rtpengine.conf diff --git a/Dockerfile b/Dockerfile index df46570..acdc40f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,29 @@ -FROM debian:stretch +FROM debian:buster RUN apt-get update \ && apt-get -y --quiet --force-yes upgrade curl iproute2 \ - && apt-get install -y --no-install-recommends ca-certificates gcc g++ make build-essential git iptables-dev libavfilter-dev \ + && apt-get install -y --no-install-recommends ca-certificates gcc g++ make cmake build-essential git iptables-dev libavfilter-dev \ libevent-dev libpcap-dev libxmlrpc-core-c3-dev markdown \ libjson-glib-dev default-libmysqlclient-dev libhiredis-dev libssl-dev \ - libcurl4-openssl-dev libavcodec-extra gperf libspandsp-dev libwebsockets-dev\ + libcurl4-openssl-dev libavcodec-extra gperf libspandsp-dev \ && cd /usr/local/src \ - && git clone https://github.com/sipwise/rtpengine.git \ + && git clone https://github.com/BelledonneCommunications/bcg729.git \ + && cd bcg729 \ + && echo "building bcg729" \ + && cmake . -DCMAKE_INSTALL_PREFIX=/usr && make && make install \ + && cd /usr/local/src \ + && git clone https://github.com/warmcat/libwebsockets.git -b v3.2.3 \ + && cd /usr/local/src/libwebsockets \ + && echo "building libwebsockets" \ + && mkdir -p build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo && make && make install \ + && git clone https://github.com/sipwise/rtpengine.git -b mr9.3.1.8 \ + && echo "searching for libwebsockets" \ + && find /usr -name libwebsockets.so \ && cd rtpengine/daemon \ - && make && make install \ - && cp /usr/local/src/rtpengine/daemon/rtpengine /usr/local/bin/rtpengine \ + && echo "building rtpengine" \ + && make with_transcoding=yes \ + && find . -name rtpengine \ + && cp rtpengine /usr/local/bin/rtpengine \ && rm -Rf /usr/local/src/rtpengine \ && apt-get purge -y --quiet --force-yes --auto-remove \ ca-certificates gcc g++ make build-essential git markdown \ diff --git a/rtpengine.conf b/rtpengine.conf deleted file mode 100644 index bab109a..0000000 --- a/rtpengine.conf +++ /dev/null @@ -1,12 +0,0 @@ -[rtpengine] -interface=MY_IP -foreground=true -log-stderr=true -listen-ng=MY_IP:22222 -port-min=23000 -port-max=32768 -recording-dir=/tmp -recording-method=pcap -recording-format=eth -log-level=6 -delete-delay=0 From edd8a2f0379ba650784b5e0f620c2e805766746c Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Fri, 5 Nov 2021 13:04:21 -0400 Subject: [PATCH 02/16] more WIP --- Dockerfile | 2 -- entrypoint.sh | 27 +++++++++++++++++++-------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index acdc40f..4a5385a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,8 +40,6 @@ EXPOSE 23000-32768/udp 22222/udp COPY ./entrypoint.sh /entrypoint.sh -COPY ./rtpengine.conf /etc - ENTRYPOINT ["/entrypoint.sh"] CMD ["rtpengine"] diff --git a/entrypoint.sh b/entrypoint.sh index 9a4c2cb..a714129 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -24,17 +24,28 @@ case $CLOUD in ;; esac -if [ -n "$PUBLIC_IP" ]; then - MY_IP="$LOCAL_IP"!"$PUBLIC_IP" -else - MY_IP=`ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/'` +if [ -z "$PUBLIC_IP" ]; then + LOCAL_IP=`ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/'` + PUBLIC_IP=`ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/'` fi -sed -i -e "s/MY_IP/$MY_IP/g" /etc/rtpengine.conf +if [ -z "$RTP_START_PORT" ]; then + RTP_START_PORT=40000 +fi +if [ -z "$RTP_END_PORT" ]; then + RTP_END_PORT=60000 +fi +if [ -z "$LOGLEVEL" ]; then + LOGLEVEL=7 +fi + +echo "LOGLEVEL is $LOGLEVEL" if [ "$1" = 'rtpengine' ]; then shift - exec rtpengine --config-file /etc/rtpengine.conf "$@" + echo "starting rtpengine" + echo "rtpengine --interface private/${LOCAL_IP} --interface public/${LOCAL_IP}'!'${PUBLIC_IP} --listen-ng=22222 --listen-http=8080 --listen-udp=12222 --dtmf-log-dest=127.0.0.1:22223 --listen-cli=127.0.0.1:9900 --pidfile /var/run/rtpengine.pid --port-min ${RTP_START_PORT} --port-max ${RTP_END_PORT} --recording-dir /tmp --recording-method pcap --recording-format eth --log-level ${LOGLEVEL} --delete-delay 0 $@" + exec rtpengine --interface private/${LOCAL_IP} --interface "public/${LOCAL_IP}'!'${PUBLIC_IP}" --listen-ng=22222 --listen-http=8080 --listen-udp=12222 --dtmf-log-dest=127.0.0.1:22223 --listen-cli=127.0.0.1:9900 --pidfile /var/run/rtpengine.pid --port-min ${RTP_START_PORT} --port-max ${RTP_END_PORT} --recording-dir /tmp --recording-method pcap --recording-format eth --log-level ${LOGLEVEL} --delete-delay 0 +else + exec "$@" fi - -exec "$@" \ No newline at end of file From 49d5d10ead4e0f3d77c447fb94bfc78133ce6d52 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Fri, 5 Nov 2021 13:27:36 -0400 Subject: [PATCH 03/16] first working version for jambonz needs --- Dockerfile | 1 + entrypoint.sh | 9 ++++----- rtpengine.conf | 8 ++++++++ 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 rtpengine.conf diff --git a/Dockerfile b/Dockerfile index 4a5385a..cb3c669 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,6 +39,7 @@ VOLUME ["/tmp"] EXPOSE 23000-32768/udp 22222/udp COPY ./entrypoint.sh /entrypoint.sh +COPY ./rtpengine.conf /etc/rtpengine.conf ENTRYPOINT ["/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh index a714129..8288243 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -36,16 +36,15 @@ if [ -z "$RTP_END_PORT" ]; then RTP_END_PORT=60000 fi if [ -z "$LOGLEVEL" ]; then - LOGLEVEL=7 + LOGLEVEL=6 fi -echo "LOGLEVEL is $LOGLEVEL" +sed -i -e "s/LOCAL_IP/$LOCAL_IP/g" /etc/rtpengine.conf +sed -i -e "s/PUBLIC_IP/$PUBLIC_IP/g" /etc/rtpengine.conf if [ "$1" = 'rtpengine' ]; then shift - echo "starting rtpengine" - echo "rtpengine --interface private/${LOCAL_IP} --interface public/${LOCAL_IP}'!'${PUBLIC_IP} --listen-ng=22222 --listen-http=8080 --listen-udp=12222 --dtmf-log-dest=127.0.0.1:22223 --listen-cli=127.0.0.1:9900 --pidfile /var/run/rtpengine.pid --port-min ${RTP_START_PORT} --port-max ${RTP_END_PORT} --recording-dir /tmp --recording-method pcap --recording-format eth --log-level ${LOGLEVEL} --delete-delay 0 $@" - exec rtpengine --interface private/${LOCAL_IP} --interface "public/${LOCAL_IP}'!'${PUBLIC_IP}" --listen-ng=22222 --listen-http=8080 --listen-udp=12222 --dtmf-log-dest=127.0.0.1:22223 --listen-cli=127.0.0.1:9900 --pidfile /var/run/rtpengine.pid --port-min ${RTP_START_PORT} --port-max ${RTP_END_PORT} --recording-dir /tmp --recording-method pcap --recording-format eth --log-level ${LOGLEVEL} --delete-delay 0 + exec rtpengine --config-file /etc/rtpengine.conf --log-level ${LOGLEVEL} --port-min ${RTP_START_PORT} --port-max ${RTP_END_PORT} --listen-ng=22222 --listen-http=8080 --listen-udp=12222 --dtmf-log-dest=127.0.0.1:22223 --listen-cli=127.0.0.1:9900 --pidfile /var/run/rtpengine.pid --recording-dir /tmp --recording-method pcap --recording-format eth --delete-delay 0 --log-stderr --foreground $@ else exec "$@" fi diff --git a/rtpengine.conf b/rtpengine.conf new file mode 100644 index 0000000..ee07f4e --- /dev/null +++ b/rtpengine.conf @@ -0,0 +1,8 @@ +[rtpengine] +interface=private/LOCAL_IP +interface=public/LOCAL_IP!PUBLIC_IP + + + + + From 0240a1b29412bf62ba0ed7082f5bc6ef9d64b86c Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Wed, 8 Dec 2021 13:42:28 -0500 Subject: [PATCH 04/16] update to latest rtpengine, eliminate config file --- Dockerfile | 3 +-- entrypoint.sh | 5 +---- rtpengine.conf | 8 -------- 3 files changed, 2 insertions(+), 14 deletions(-) delete mode 100644 rtpengine.conf diff --git a/Dockerfile b/Dockerfile index cb3c669..be18e23 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ RUN apt-get update \ && cd /usr/local/src/libwebsockets \ && echo "building libwebsockets" \ && mkdir -p build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo && make && make install \ - && git clone https://github.com/sipwise/rtpengine.git -b mr9.3.1.8 \ + && git clone https://github.com/sipwise/rtpengine.git -b mr10.2.1.1 \ && echo "searching for libwebsockets" \ && find /usr -name libwebsockets.so \ && cd rtpengine/daemon \ @@ -39,7 +39,6 @@ VOLUME ["/tmp"] EXPOSE 23000-32768/udp 22222/udp COPY ./entrypoint.sh /entrypoint.sh -COPY ./rtpengine.conf /etc/rtpengine.conf ENTRYPOINT ["/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh index 8288243..014d4f5 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -39,12 +39,9 @@ if [ -z "$LOGLEVEL" ]; then LOGLEVEL=6 fi -sed -i -e "s/LOCAL_IP/$LOCAL_IP/g" /etc/rtpengine.conf -sed -i -e "s/PUBLIC_IP/$PUBLIC_IP/g" /etc/rtpengine.conf - if [ "$1" = 'rtpengine' ]; then shift - exec rtpengine --config-file /etc/rtpengine.conf --log-level ${LOGLEVEL} --port-min ${RTP_START_PORT} --port-max ${RTP_END_PORT} --listen-ng=22222 --listen-http=8080 --listen-udp=12222 --dtmf-log-dest=127.0.0.1:22223 --listen-cli=127.0.0.1:9900 --pidfile /var/run/rtpengine.pid --recording-dir /tmp --recording-method pcap --recording-format eth --delete-delay 0 --log-stderr --foreground $@ + exec rtpengine --interface private/${LOCAL_IP} --interface public/${PUBLIC_IP} --log-level ${LOGLEVEL} --port-min ${RTP_START_PORT} --port-max ${RTP_END_PORT} --listen-ng=22222 --listen-http=8080 --listen-udp=12222 --dtmf-log-dest=127.0.0.1:22223 --listen-cli=127.0.0.1:9900 --pidfile /var/run/rtpengine.pid --recording-dir /tmp --recording-method pcap --recording-format eth --delete-delay 0 --log-stderr --foreground $@ else exec "$@" fi diff --git a/rtpengine.conf b/rtpengine.conf deleted file mode 100644 index ee07f4e..0000000 --- a/rtpengine.conf +++ /dev/null @@ -1,8 +0,0 @@ -[rtpengine] -interface=private/LOCAL_IP -interface=public/LOCAL_IP!PUBLIC_IP - - - - - From 0f22724e2dfe7263bc53178bd628b3d94132139c Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Wed, 8 Dec 2021 14:38:48 -0500 Subject: [PATCH 05/16] added port range to cmd line args --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 014d4f5..80c69a6 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -41,7 +41,7 @@ fi if [ "$1" = 'rtpengine' ]; then shift - exec rtpengine --interface private/${LOCAL_IP} --interface public/${PUBLIC_IP} --log-level ${LOGLEVEL} --port-min ${RTP_START_PORT} --port-max ${RTP_END_PORT} --listen-ng=22222 --listen-http=8080 --listen-udp=12222 --dtmf-log-dest=127.0.0.1:22223 --listen-cli=127.0.0.1:9900 --pidfile /var/run/rtpengine.pid --recording-dir /tmp --recording-method pcap --recording-format eth --delete-delay 0 --log-stderr --foreground $@ + exec rtpengine --interface private/${LOCAL_IP} --interface public/${PUBLIC_IP} --port-min ${RTP_START_PORT} --port-max ${RTP_END_PORT} --log-level ${LOGLEVEL} --port-min ${RTP_START_PORT} --port-max ${RTP_END_PORT} --listen-ng=22222 --listen-http=8080 --listen-udp=12222 --dtmf-log-dest=127.0.0.1:22223 --listen-cli=127.0.0.1:9900 --pidfile /var/run/rtpengine.pid --recording-dir /tmp --recording-method pcap --recording-format eth --delete-delay 0 --log-stderr --foreground $@ else exec "$@" fi From 2fc1a906797161845e2ca18c90ba06ae5d7f6fa4 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Wed, 8 Dec 2021 15:17:46 -0500 Subject: [PATCH 06/16] formatting --- Dockerfile | 2 +- entrypoint.sh | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index be18e23..29709ab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM debian:buster RUN apt-get update \ && apt-get -y --quiet --force-yes upgrade curl iproute2 \ && apt-get install -y --no-install-recommends ca-certificates gcc g++ make cmake build-essential git iptables-dev libavfilter-dev \ - libevent-dev libpcap-dev libxmlrpc-core-c3-dev markdown \ + libevent-dev libpcap-dev libxmlrpc-core-c3-dev markdown \ libjson-glib-dev default-libmysqlclient-dev libhiredis-dev libssl-dev \ libcurl4-openssl-dev libavcodec-extra gperf libspandsp-dev \ && cd /usr/local/src \ diff --git a/entrypoint.sh b/entrypoint.sh index 80c69a6..f8ff053 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -41,7 +41,19 @@ fi if [ "$1" = 'rtpengine' ]; then shift - exec rtpengine --interface private/${LOCAL_IP} --interface public/${PUBLIC_IP} --port-min ${RTP_START_PORT} --port-max ${RTP_END_PORT} --log-level ${LOGLEVEL} --port-min ${RTP_START_PORT} --port-max ${RTP_END_PORT} --listen-ng=22222 --listen-http=8080 --listen-udp=12222 --dtmf-log-dest=127.0.0.1:22223 --listen-cli=127.0.0.1:9900 --pidfile /var/run/rtpengine.pid --recording-dir /tmp --recording-method pcap --recording-format eth --delete-delay 0 --log-stderr --foreground $@ + exec rtpengine \ + --interface private/${LOCAL_IP} --interface public/${PUBLIC_IP} \ + --port-min ${RTP_START_PORT} --port-max ${RTP_END_PORT} \ + --log-level ${LOGLEVEL} --port-min ${RTP_START_PORT} --port-max ${RTP_END_PORT} \ + --listen-ng=22222 --listen-http=8080 --listen-udp=12222 \ + --dtmf-log-dest=127.0.0.1:22223 \ + --listen-cli=127.0.0.1:9900 \ + --pidfile /var/run/rtpengine.pid \ + --recording-dir /tmp --recording-method pcap --recording-format eth \ + --delete-delay 0 \ + --log-stderr \ + --foreground \ + $@ else exec "$@" fi From 75aba6d8b82ec32f2ac2a974c69aaf66cabdefbe Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Fri, 10 Dec 2021 12:44:40 -0500 Subject: [PATCH 07/16] fix typo --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index f8ff053..e4bcebf 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -42,7 +42,7 @@ fi if [ "$1" = 'rtpengine' ]; then shift exec rtpengine \ - --interface private/${LOCAL_IP} --interface public/${PUBLIC_IP} \ + --interface private/${LOCAL_IP} --interface public/${LOCAL_IP}!${PUBLIC_IP} \ --port-min ${RTP_START_PORT} --port-max ${RTP_END_PORT} \ --log-level ${LOGLEVEL} --port-min ${RTP_START_PORT} --port-max ${RTP_END_PORT} \ --listen-ng=22222 --listen-http=8080 --listen-udp=12222 \ From 8623c45a19804ec6b2834cd667750894b541e7e7 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Tue, 25 Jan 2022 10:17:50 -0500 Subject: [PATCH 08/16] entrypoint.sh handle IMDSv2 on aws --- entrypoint.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index e4bcebf..2ad8a67 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -9,8 +9,12 @@ case $CLOUD in PUBLIC_IP=$(curl -s -H "Metadata-Flavor: Google" http://metadata/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip) ;; aws) - LOCAL_IP=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4) - PUBLIC_IP=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4) + if [ -z "$IMDSv2" ]; then + LOCAL_IP=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4) + PUBLIC_IP=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4) + else + LOCAL_IP=$(TOKEN=`curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` && curl -s -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/local-ipv4) + PUBLIC_IP=$(TOKEN=`curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` && curl -s -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/public-ipv4) ;; digitalocean) LOCAL_IP=$(curl -s http://169.254.169.254/metadata/v1/interfaces/private/0/ipv4/address) From fff8e7b087bdc7f8e64db2ae28fea03ecec6b218 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Tue, 25 Jan 2022 13:19:57 -0500 Subject: [PATCH 09/16] fix typo in prev checkin --- entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/entrypoint.sh b/entrypoint.sh index 2ad8a67..07c0e3b 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -15,6 +15,7 @@ case $CLOUD in else LOCAL_IP=$(TOKEN=`curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` && curl -s -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/local-ipv4) PUBLIC_IP=$(TOKEN=`curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` && curl -s -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/public-ipv4) + fi ;; digitalocean) LOCAL_IP=$(curl -s http://169.254.169.254/metadata/v1/interfaces/private/0/ipv4/address) From 1a1df5538e254dbe5514286e0cae714eaf9434c7 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Fri, 28 Jan 2022 10:11:20 -0500 Subject: [PATCH 10/16] update to rtpengine mr10.2.1.5 and add support for IMSv2 on aws --- Dockerfile | 4 ++-- entrypoint.sh | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 29709ab..87ab89c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ RUN apt-get update \ && cd /usr/local/src/libwebsockets \ && echo "building libwebsockets" \ && mkdir -p build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo && make && make install \ - && git clone https://github.com/sipwise/rtpengine.git -b mr10.2.1.1 \ + && git clone https://github.com/sipwise/rtpengine.git -b mr10.2.1.5 \ && echo "searching for libwebsockets" \ && find /usr -name libwebsockets.so \ && cd rtpengine/daemon \ @@ -36,7 +36,7 @@ RUN apt-get update \ VOLUME ["/tmp"] -EXPOSE 23000-32768/udp 22222/udp +EXPOSE 40000-60000/udp 22222/udp COPY ./entrypoint.sh /entrypoint.sh diff --git a/entrypoint.sh b/entrypoint.sh index e4bcebf..f557d63 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -9,8 +9,13 @@ case $CLOUD in PUBLIC_IP=$(curl -s -H "Metadata-Flavor: Google" http://metadata/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip) ;; aws) - LOCAL_IP=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4) - PUBLIC_IP=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4) + if [ -z "$IMDSv2" ]; then + LOCAL_IP=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4) + PUBLIC_IP=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4) + else + LOCAL_IP=$(TOKEN=`curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` && curl -s -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/local-ipv4) + PUBLIC_IP=$(TOKEN=`curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` && curl -s -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/public-ipv4) + fi ;; digitalocean) LOCAL_IP=$(curl -s http://169.254.169.254/metadata/v1/interfaces/private/0/ipv4/address) @@ -36,7 +41,7 @@ if [ -z "$RTP_END_PORT" ]; then RTP_END_PORT=60000 fi if [ -z "$LOGLEVEL" ]; then - LOGLEVEL=6 + LOGLEVEL=5 fi if [ "$1" = 'rtpengine' ]; then From 91af5c34cf69da8a1ab19db02c694955067f64ae Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Fri, 28 Jan 2022 10:12:59 -0500 Subject: [PATCH 11/16] remove logging --- Dockerfile | 4 ---- LICENSE | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 87ab89c..e994e68 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,13 +14,9 @@ RUN apt-get update \ && cd /usr/local/src \ && git clone https://github.com/warmcat/libwebsockets.git -b v3.2.3 \ && cd /usr/local/src/libwebsockets \ - && echo "building libwebsockets" \ && mkdir -p build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo && make && make install \ && git clone https://github.com/sipwise/rtpengine.git -b mr10.2.1.5 \ - && echo "searching for libwebsockets" \ - && find /usr -name libwebsockets.so \ && cd rtpengine/daemon \ - && echo "building rtpengine" \ && make with_transcoding=yes \ && find . -name rtpengine \ && cp rtpengine /usr/local/bin/rtpengine \ diff --git a/LICENSE b/LICENSE index 96a7461..cee71aa 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017 Dave Horton +Copyright (c) 2017-2022 Dave Horton Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 9a24d6b5ca4898840ccf87380beed4543945cde7 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Wed, 30 Mar 2022 12:18:43 -0400 Subject: [PATCH 12/16] entrypoint: fix for digital ocean --- entrypoint.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index f557d63..d21b2e5 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,6 +7,8 @@ case $CLOUD in gcp) LOCAL_IP=$(curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip) PUBLIC_IP=$(curl -s -H "Metadata-Flavor: Google" http://metadata/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip) + PRIVATE_INTERFACE="private/${LOCAL_IP}" + PUBLIC_INTERFACE="public/${LOCAL_IP}!${PUBLIC_IP}" ;; aws) if [ -z "$IMDSv2" ]; then @@ -16,14 +18,20 @@ case $CLOUD in LOCAL_IP=$(TOKEN=`curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` && curl -s -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/local-ipv4) PUBLIC_IP=$(TOKEN=`curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` && curl -s -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/public-ipv4) fi + PRIVATE_INTERFACE="private/${LOCAL_IP}" + PUBLIC_INTERFACE="public/${LOCAL_IP}!${PUBLIC_IP}" ;; digitalocean) LOCAL_IP=$(curl -s http://169.254.169.254/metadata/v1/interfaces/private/0/ipv4/address) PUBLIC_IP=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address) + PRIVATE_INTERFACE="private/${LOCAL_IP}" + PUBLIC_INTERFACE="public/${PUBLIC_IP}" ;; azure) LOCAL_IP=$(curl -H Metadata:true "http://169.254.169.254/metadata/instance/network/interface/0/ipv4/ipAddress/0/privateIpAddress?api-version=2017-08-01&format=text") PUBLIC_IP=$(curl -H Metadata:true "http://169.254.169.254/metadata/instance/network/interface/0/ipv4/ipAddress/0/publicIpAddress?api-version=2017-08-01&format=text") + PRIVATE_INTERFACE="private/${LOCAL_IP}" + PUBLIC_INTERFACE="public/${LOCAL_IP}!${PUBLIC_IP}" ;; *) ;; @@ -32,6 +40,8 @@ esac if [ -z "$PUBLIC_IP" ]; then LOCAL_IP=`ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/'` PUBLIC_IP=`ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/'` + PRIVATE_INTERFACE="private/${LOCAL_IP}" + PUBLIC_INTERFACE="public/${LOCAL_IP}!${PUBLIC_IP}" fi if [ -z "$RTP_START_PORT" ]; then @@ -47,7 +57,7 @@ fi if [ "$1" = 'rtpengine' ]; then shift exec rtpengine \ - --interface private/${LOCAL_IP} --interface public/${LOCAL_IP}!${PUBLIC_IP} \ + --interface ${PRIVATE_INTERFACE} --interface ${PUBLIC_INTERFACE} \ --port-min ${RTP_START_PORT} --port-max ${RTP_END_PORT} \ --log-level ${LOGLEVEL} --port-min ${RTP_START_PORT} --port-max ${RTP_END_PORT} \ --listen-ng=22222 --listen-http=8080 --listen-udp=12222 \ From 87bfa773d889fbc4b3d8ffff2dc7ccb0c29b8dd3 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Wed, 10 Aug 2022 13:29:26 +0200 Subject: [PATCH 13/16] update rtpengine version to mr10.4.1.4 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e994e68..4d5e1ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ RUN apt-get update \ && git clone https://github.com/warmcat/libwebsockets.git -b v3.2.3 \ && cd /usr/local/src/libwebsockets \ && mkdir -p build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo && make && make install \ - && git clone https://github.com/sipwise/rtpengine.git -b mr10.2.1.5 \ + && git clone https://github.com/sipwise/rtpengine.git -b mr10.4.1.4 \ && cd rtpengine/daemon \ && make with_transcoding=yes \ && find . -name rtpengine \ From 2ea2c08895dff7ae143639239aa9ce23f27a8aac Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Fri, 26 Aug 2022 22:54:45 +0200 Subject: [PATCH 14/16] update to rtpengine mr10.5.1.3 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4d5e1ed..b6e667a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ RUN apt-get update \ && git clone https://github.com/warmcat/libwebsockets.git -b v3.2.3 \ && cd /usr/local/src/libwebsockets \ && mkdir -p build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo && make && make install \ - && git clone https://github.com/sipwise/rtpengine.git -b mr10.4.1.4 \ + && git clone https://github.com/sipwise/rtpengine.git -b mr10.5.1.3 \ && cd rtpengine/daemon \ && make with_transcoding=yes \ && find . -name rtpengine \ From d69f8812d3b71151e7db8806d961f8a1e27593d4 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Mon, 31 Oct 2022 10:47:43 -0400 Subject: [PATCH 15/16] update to rtpengine mr11.1.1.1 --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b6e667a..df1b847 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:buster +FROM debian:buster-slim RUN apt-get update \ && apt-get -y --quiet --force-yes upgrade curl iproute2 \ @@ -15,7 +15,7 @@ RUN apt-get update \ && git clone https://github.com/warmcat/libwebsockets.git -b v3.2.3 \ && cd /usr/local/src/libwebsockets \ && mkdir -p build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo && make && make install \ - && git clone https://github.com/sipwise/rtpengine.git -b mr10.5.1.3 \ + && git clone https://github.com/sipwise/rtpengine.git -b mr11.1.1.1 \ && cd rtpengine/daemon \ && make with_transcoding=yes \ && find . -name rtpengine \ From 2c80af0904bac1fa12dd2f3745518a693c2cec77 Mon Sep 17 00:00:00 2001 From: Guilherme Rauen Date: Thu, 29 Dec 2022 15:55:38 +0100 Subject: [PATCH 16/16] update debian image --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index df1b847..d47d19e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:buster-slim +FROM debian:bullseye-slim RUN apt-get update \ && apt-get -y --quiet --force-yes upgrade curl iproute2 \