Skip to content

Commit

Permalink
Merge pull request #1 from voipxswitch/init-commit
Browse files Browse the repository at this point in the history
init commit
  • Loading branch information
eschmidbauer authored Dec 21, 2019
2 parents 60eb4ac + 84080fb commit 29fed93
Show file tree
Hide file tree
Showing 6 changed files with 489 additions and 1 deletion.
135 changes: 135 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
run-notes.txt

### Ansible ###
*.retry
.vault-pass.txt

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

#GoLand
.idea/

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don’t work, or not
# install all needed dependencies.
#Pipfile.lock

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# End of https://www.gitignore.io/api/python,ansible
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM debian:buster as build_freeswitch
ADD script /tmp/freeswitch
RUN apt-get update && apt-get install -y apt-transport-https ca-certificates gnupg2 wget
RUN /usr/bin/wget -O - https://files.freeswitch.org/repo/deb/freeswitch-1.8/fsstretch-archive-keyring.asc | apt-key add -
RUN /bin/echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.8/ buster main" > /etc/apt/sources.list.d/freeswitch.list
RUN /bin/echo "deb-src http://files.freeswitch.org/repo/deb/freeswitch-1.8/ buster main" >> /etc/apt/sources.list.d/freeswitch.list
RUN apt-get update && apt-get install -y freeswitch freeswitch-mod-console freeswitch-mod-sofia freeswitch-mod-commands freeswitch-mod-conference freeswitch-mod-db freeswitch-mod-dptools freeswitch-mod-hash freeswitch-mod-dialplan-xml freeswitch-mod-sndfile freeswitch-mod-native-file freeswitch-mod-tone-stream freeswitch-mod-say-en freeswitch-mod-event-socket
RUN /bin/bash -c "source /tmp/freeswitch/make_min_archive.sh"
RUN /bin/mkdir /tmp/build_image
RUN /bin/tar zxvf ./freeswitch_img.tar.gz -C /tmp/build_image

FROM scratch
COPY --from=build_freeswitch /tmp/build_image /
ADD etc/freeswitch /etc/freeswitch
CMD ["/usr/bin/freeswitch", "-nc", "-nf", "-nonat"]
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
# freeswitch-docker
# freeswitch-docker

build freeswitch container on scratch using DIND

`script/make_min_archive.sh` borrowed from SignalWire Repo (https://github.com/signalwire/freeswitch/blob/f6c10f8622e997548a486e5bf4f700b37e12a4eb/docker/base_image/README.md)

```bash
docker build . -t freeswitch:latest

# run with host network
docker run --rm --net=host --name freeswitch freeswitch:latest

# without host network
docker run --rm --name freeswitch freeswitch:latest

# connect via fs_cli
docker exec -i -t freeswitch /usr/bin/fs_cli

# setup an alias for fs_cli
alias fs_cli='docker exec -i -t freeswitch /usr/bin/fs_cli'
```
152 changes: 152 additions & 0 deletions etc/freeswitch/freeswitch.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
<document type="freeswitch/xml">
<X-PRE-PROCESS cmd="include" data="vars.xml"/>
<section name="configuration" description="Various Configuration">
<configuration name="modules.conf" description="Modules">
<modules>
<load module="mod_console"/>
<load module="mod_event_socket"/>
<load module="mod_sofia"/>
<load module="mod_commands"/>
<load module="mod_conference"/>
<load module="mod_db"/>
<load module="mod_dptools"/>
<load module="mod_hash"/>
<load module="mod_dialplan_xml"/>
<load module="mod_sndfile"/>
<load module="mod_native_file"/>
<load module="mod_tone_stream"/>
<load module="mod_say_en"/>
</modules>
</configuration>
<configuration name="switch.conf" description="Core Configuration">
<cli-keybindings>
</cli-keybindings>
<default-ptimes>
</default-ptimes>
<settings>
<param name="colorize-console" value="true"/>
<param name="dialplan-timestamps" value="false"/>
<param name="max-db-handles" value="50"/>
<param name="db-handle-timeout" value="10"/>
<param name="max-sessions" value="1000"/>
<param name="sessions-per-second" value="30"/>
<param name="loglevel" value="debug"/>
<param name="mailer-app" value="sendmail"/>
<param name="mailer-app-args" value="-t"/>
<param name="dump-cores" value="yes"/>
<param name="rtp-enable-zrtp" value="false"/>
</settings>
</configuration>
<configuration name="console.conf" description="Console Logger">
<mappings>
<map name="all" value="console,debug,info,notice,warning,err,crit,alert"/>
</mappings>
<settings>
<param name="colorize" value="true"/>
</settings>
</configuration>
<configuration name="db.conf" description="LIMIT DB Configuration">
<settings>
</settings>
</configuration>
<configuration name="acl.conf" description="Network Lists">
<network-lists>
<list name="domains" default="deny">
</list>
</network-lists>
</configuration>
<configuration name="conference.conf" description="Audio Conference">
<advertise>
</advertise>
<caller-controls>
<group name="default">
</group>
</caller-controls>
<profiles>
</profiles>
</configuration>
<configuration name="event_socket.conf" description="Socket Client">
<settings>
<param name="nat-map" value="false"/>
<param name="listen-ip" value="::"/>
<param name="listen-port" value="8021"/>
<param name="password" value="ClueCon"/>
<!--<param name="apply-inbound-acl" value="loopback.auto"/>-->
<!--<param name="stop-on-bind-error" value="true"/>-->
</settings>
</configuration>
<configuration name="sofia.conf" description="sofia Endpoint">
<global_settings>
<param name="log-level" value="0"/>
<param name="auto-restart" value="false"/>
<param name="debug-presence" value="0"/>
</global_settings>
<profiles>
<profile name="internal">
<aliases>
</aliases>
<gateways>
</gateways>
<domains>
<domain name="all" alias="true" parse="false"/>
</domains>
<settings>
<param name="sip-ip" value="$${local_ip_v4}"/>
<param name="rtp-ip" value="$${local_ip_v4}"/>
<param name="sip-port" value="5060"/>
<param name="session-timeout" value="600"/>
<param name="enable-timer" value="true"/>
<param name="debug" value="0"/>
<param name="sip-trace" value="no"/>
<param name="sip-capture" value="no"/>
<param name="log-auth-failures" value="false"/>
<param name="forward-unsolicited-mwi-notify" value="false"/>
<param name="context" value="public"/>
<param name="rfc2833-pt" value="101"/>
<param name="dialplan" value="XML"/>
<param name="dtmf-duration" value="2000"/>
<param name="inbound-codec-prefs" value="$${global_codec_prefs}"/>
<param name="outbound-codec-prefs" value="$${global_codec_prefs}"/>
<param name="rtp-timer-name" value="soft"/>
<param name="apply-nat-acl" value="nat.auto"/>
<param name="apply-inbound-acl" value="domains"/>
<param name="local-network-acl" value="localnet.auto"/>
<param name="caller-id-type" value="pid"/>
<param name="manage-presence" value="false"/>
<param name="inbound-codec-negotiation" value="generous"/>
<param name="inbound-late-negotiation" value="true"/>
<param name="inbound-proxy-media" value="false"/>
<param name="inbound-zrtp-passthru" value="true"/>
<param name="nonce-ttl" value="60"/>
<param name="auth-calls" value="true"/>
<param name="inbound-reg-force-matching-username" value="true"/>
<param name="auth-all-packets" value="false"/>
<param name="media_timeout" value="300"/>
<param name="media_hold_timeout" value="1800"/>
<param name="challenge-realm" value="auto_from"/>
</settings>
</profile>
</profiles>
</configuration>
</section>
<section name="dialplan" description="Regex/XML Dialplan">
</section>
<section name="chatplan" description="Regex/XML Chatplan">
</section>
<section name="directory" description="User Directory">
<domain name="$${domain}">
<params>
<param name="dial-string" value="{^^:sip_invite_domain=${dialed_domain}:presence_id=${dialed_user}@${dialed_domain}}${sofia_contact(*/${dialed_user}@${dialed_domain})},${verto_contact(${dialed_user}@${dialed_domain})}"/>
<param name="jsonrpc-allowed-methods" value="verto"/>
</params>
<groups>
<group name="default">
<users>
</users>
</group>
</groups>
</domain>
</section>
<section name="languages" description="Language Management">
</section>
</document>
43 changes: 43 additions & 0 deletions etc/freeswitch/vars.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<include>
<X-PRE-PROCESS cmd="set" data="domain=mydomain.com"/>
<X-PRE-PROCESS cmd="set" data="default_password=1234"/>
<X-PRE-PROCESS cmd="set" data="global_codec_prefs=OPUS,PCMU"/>
<X-PRE-PROCESS cmd="set" data="disable_system_api_commands=true"/>
<X-PRE-PROCESS cmd="set" data="au-ring=%(400,200,383,417);%(400,2000,383,417)"/>
<X-PRE-PROCESS cmd="set" data="be-ring=%(1000,3000,425)"/>
<X-PRE-PROCESS cmd="set" data="ca-ring=%(2000,4000,440,480)"/>
<X-PRE-PROCESS cmd="set" data="cn-ring=%(1000,4000,450)"/>
<X-PRE-PROCESS cmd="set" data="cy-ring=%(1500,3000,425)"/>
<X-PRE-PROCESS cmd="set" data="cz-ring=%(1000,4000,425)"/>
<X-PRE-PROCESS cmd="set" data="de-ring=%(1000,4000,425)"/>
<X-PRE-PROCESS cmd="set" data="dk-ring=%(1000,4000,425)"/>
<X-PRE-PROCESS cmd="set" data="dz-ring=%(1500,3500,425)"/>
<X-PRE-PROCESS cmd="set" data="eg-ring=%(2000,1000,475,375)"/>
<X-PRE-PROCESS cmd="set" data="es-ring=%(1500,3000,425)"/>
<X-PRE-PROCESS cmd="set" data="fi-ring=%(1000,4000,425)"/>
<X-PRE-PROCESS cmd="set" data="fr-ring=%(1500,3500,440)"/>
<X-PRE-PROCESS cmd="set" data="hk-ring=%(400,200,440,480);%(400,3000,440,480)"/>
<X-PRE-PROCESS cmd="set" data="hu-ring=%(1250,3750,425)"/>
<X-PRE-PROCESS cmd="set" data="il-ring=%(1000,3000,400)"/>
<X-PRE-PROCESS cmd="set" data="in-ring=%(400,200,425,375);%(400,2000,425,375)"/>
<X-PRE-PROCESS cmd="set" data="jp-ring=%(1000,2000,420,380)"/>
<X-PRE-PROCESS cmd="set" data="ko-ring=%(1000,2000,440,480)"/>
<X-PRE-PROCESS cmd="set" data="pk-ring=%(1000,2000,400)"/>
<X-PRE-PROCESS cmd="set" data="pl-ring=%(1000,4000,425)"/>
<X-PRE-PROCESS cmd="set" data="ro-ring=%(1850,4150,475,425)"/>
<X-PRE-PROCESS cmd="set" data="rs-ring=%(1000,4000,425)"/>
<X-PRE-PROCESS cmd="set" data="ru-ring=%(800,3200,425)"/>
<X-PRE-PROCESS cmd="set" data="sa-ring=%(1200,4600,425)"/>
<X-PRE-PROCESS cmd="set" data="tr-ring=%(2000,4000,450)"/>
<X-PRE-PROCESS cmd="set" data="uk-ring=%(400,200,400,450);%(400,2000,400,450)"/>
<X-PRE-PROCESS cmd="set" data="us-ring=%(2000,4000,440,480)"/>
<X-PRE-PROCESS cmd="set" data="bong-ring=v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)"/>
<X-PRE-PROCESS cmd="set" data="beep=%(1000,0,640)"/>
<X-PRE-PROCESS cmd="set" data="sit=%(274,0,913.8);%(274,0,1370.6);%(380,0,1776.7)"/>
<X-PRE-PROCESS cmd="set" data="df_us_ssn=(?!219099999|078051120)(?!666|000|9\d{2})\d{3}(?!00)\d{2}(?!0{4})\d{4}"/>
<X-PRE-PROCESS cmd="set" data="df_luhn=?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|6(?:011|5[0-9]{2})[0-9]{12}|(?:2131|1800|35\d{3})\d{11}"/>
<X-PRE-PROCESS cmd="set" data="rtp_video_max_bandwidth_in=3mb"/>
<X-PRE-PROCESS cmd="set" data="rtp_video_max_bandwidth_out=3mb"/>
<X-PRE-PROCESS cmd="set" data="suppress_cng=true"/>
<X-PRE-PROCESS cmd="set" data="rtp_liberal_dtmf=true"/>
</include>
Loading

0 comments on commit 29fed93

Please sign in to comment.