From 7166d0f448eae451b1a6287b522c0fc82387b05b Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sun, 5 Mar 2017 16:47:57 +0100 Subject: [PATCH] contrib: Add Dockerfile to build and configure a FreeSWITCH Rhizomatica is using FreeSWITCH and we should have an easy way to test against it. A docker container with exposed ports seems like the easiest. FreeSWITCH by default is giving us some exmaple numbers: * 5000 a menu... that allows DTMF * 9195 an echo test * 9198 tetris. The config is copied on top of the default/big config that is installed. If this PBX should be reached from the outside one needs to change 127.0.0.1 to the external address and maybe configure the acl as well to add more CIDRs. Besides that make container make run Will build it and start the container. Takes a bit of time and requires docker. With it configure one can see things like: 2017-03-05 15:32:49.913912 [INFO] switch_channel.c:515 RECV DTMF 3:2000 2017-03-05 15:32:50.952752 [INFO] switch_channel.c:515 RECV DTMF 2:2000 Now to test DTMF in the system. Change-Id: I7f3aa8c81b9e8698df090a05d2e41a41b67d8e3c --- contrib/testpbx/Dockerfile | 25 + contrib/testpbx/Makefile | 12 + contrib/testpbx/README | 29 + contrib/testpbx/configs/acl.conf.xml | 34 + contrib/testpbx/configs/default.xml | 832 ++++++++++++++++++++++++ contrib/testpbx/configs/internal.xml | 422 ++++++++++++ contrib/testpbx/configs/public.xml | 68 ++ contrib/testpbx/configs/switch.conf.xml | 181 ++++++ contrib/testpbx/configs/vars.xml | 450 +++++++++++++ 9 files changed, 2053 insertions(+) create mode 100644 contrib/testpbx/Dockerfile create mode 100644 contrib/testpbx/Makefile create mode 100644 contrib/testpbx/README create mode 100644 contrib/testpbx/configs/acl.conf.xml create mode 100644 contrib/testpbx/configs/default.xml create mode 100644 contrib/testpbx/configs/internal.xml create mode 100644 contrib/testpbx/configs/public.xml create mode 100644 contrib/testpbx/configs/switch.conf.xml create mode 100644 contrib/testpbx/configs/vars.xml diff --git a/contrib/testpbx/Dockerfile b/contrib/testpbx/Dockerfile new file mode 100644 index 0000000..2f03424 --- /dev/null +++ b/contrib/testpbx/Dockerfile @@ -0,0 +1,25 @@ +FROM debian:jessie + +RUN apt-get update +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends wget + +# They use comodo.. it was hacked.. so don't bother trying to +# install the right root certificates... +RUN wget --no-check-certificate -O - https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | apt-key add - +RUN echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main" > /etc/apt/sources.list.d/freeswitch.list +RUN apt-get update && apt-get install -y freeswitch-meta-all + + +# Change the config... +COPY configs/vars.xml /etc/freeswitch/vars.xml +COPY configs/acl.conf.xml /etc/freeswitch/autoload_configs/acl.conf.xml +COPY configs/switch.conf.xml /etc/freeswitch/autoload_configs/switch.conf.xml +COPY configs/public.xml /etc/freeswitch/dialplan/public.xml +COPY configs/default.xml /etc/freeswitch/dialplan/default.xml +COPY configs/internal.xml /etc/freeswitch/sip_profiles/internal.xml + +# Prepare to run +# Reduce the number of ports.. as otherwise we wait a long time +EXPOSE 6000-6020/udp +EXPOSE 5060/udp +CMD /usr/bin/freeswitch -nf diff --git a/contrib/testpbx/Makefile b/contrib/testpbx/Makefile new file mode 100644 index 0000000..ea34799 --- /dev/null +++ b/contrib/testpbx/Makefile @@ -0,0 +1,12 @@ +all: container + +container: + docker build -t osmo-freeswitch-pbx:latest . + +run: + docker run -it --name=osmo-freeswitch-pbx \ + -p 5060:5060/udp -p 6000-6020:6000-6020/udp \ + --rm=true osmo-freeswitch-pbx:latest + +stop: + docker rm -f osmo-freeswitch-pbx diff --git a/contrib/testpbx/README b/contrib/testpbx/README new file mode 100644 index 0000000..11c16f0 --- /dev/null +++ b/contrib/testpbx/README @@ -0,0 +1,29 @@ +Provide a semi-stable remote PBX system. + +There is no preferred PBX but YaTE is pretty small and still +functional enough. Anyway Rhizomatica is using FreeSWITCH so +let's use that for testing. + +This is creating a docker image with a SIP configuration that +will allow to record audio, have a DTMF menu using some fixed +numbers. Feel free to extend it to support bidirectional calls +and routing. + +It is using the Debian packages and installs everything as I +am not interested to track dependencies and see what is missing. +Again feel free to optimize the size. + + +Build: + make + + or + + docker build -t yourimagename:tag . + + +Run: + + docker run yourimagename:tag + +SIP is exposed on 5060 of your port and audio on 6000-6020 diff --git a/contrib/testpbx/configs/acl.conf.xml b/contrib/testpbx/configs/acl.conf.xml new file mode 100644 index 0000000..70a64ea --- /dev/null +++ b/contrib/testpbx/configs/acl.conf.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/contrib/testpbx/configs/default.xml b/contrib/testpbx/configs/default.xml new file mode 100644 index 0000000..f0e0af1 --- /dev/null +++ b/contrib/testpbx/configs/default.xml @@ -0,0 +1,832 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contrib/testpbx/configs/internal.xml b/contrib/testpbx/configs/internal.xml new file mode 100644 index 0000000..2a679fb --- /dev/null +++ b/contrib/testpbx/configs/internal.xml @@ -0,0 +1,422 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contrib/testpbx/configs/public.xml b/contrib/testpbx/configs/public.xml new file mode 100644 index 0000000..d9b1d17 --- /dev/null +++ b/contrib/testpbx/configs/public.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contrib/testpbx/configs/switch.conf.xml b/contrib/testpbx/configs/switch.conf.xml new file mode 100644 index 0000000..1a82409 --- /dev/null +++ b/contrib/testpbx/configs/switch.conf.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contrib/testpbx/configs/vars.xml b/contrib/testpbx/configs/vars.xml new file mode 100644 index 0000000..1cb826d --- /dev/null +++ b/contrib/testpbx/configs/vars.xml @@ -0,0 +1,450 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +