Skip to content

Commit

Permalink
Add Debian Jessie package builder, update example configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Lindenberg committed Jul 9, 2015
1 parent 260ff8b commit b3bf29c
Show file tree
Hide file tree
Showing 16 changed files with 185 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
bin/
pkg/
packages/
gofaxd
gofaxsend
gofaxbuild.id
19 changes: 19 additions & 0 deletions Dockerfile.debbuilder
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM debian:jessie
MAINTAINER Markus Lindenberg <[email protected]>

ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update -y && apt-get install --no-install-recommends -y -q curl build-essential ca-certificates git mercurial ruby ruby-dev

RUN curl https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz | tar xz -C /usr/local
ENV GOROOT /usr/local/go
ENV PATH $PATH:$GOROOT/bin

RUN gem install fpm

ADD . /usr/src/gofaxip

RUN adduser --system --home /usr/src/build build
USER build
WORKDIR /usr/src/build

CMD ["/usr/src/gofaxip/docker/build.sh"]
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,14 @@ bin/gofaxsend:

clean:
rm -rf bin
rm -rf packages
rm -f gofaxbuild.id

deb: iid := $(shell cat /proc/sys/kernel/random/uuid)
deb:
docker build -t $(iid) -f Dockerfile.debbuilder .
docker run --cidfile=gofaxbuild.id $(iid)
docker cp `cat gofaxbuild.id`:/usr/src/build/packages .
docker rm `cat gofaxbuild.id`
docker rmi $(iid)
rm gofaxbuild.id
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ The resulting binaries `gofaxd` and `gofaxsend` are located in the `bin` directo

## Installation

GOfax.IP was tested and developed on Debian 7 ("Wheezy"), so these instructions cover Debian in detail. Of course it is possible to install and use GOfax.IP on other Linux distributions and possibly other Unixes supported by golang, FreeSWITCH and HylaFAX.
We recommend running GOfax.IP on Debian 8 ("Jessie"), so these instructions cover Debian in detail. Of course it is possible to install and use GOfax.IP on other Linux distributions and possibly other Unixes supported by golang, FreeSWITCH and HylaFAX.

### Dependencies

Expand All @@ -53,7 +53,7 @@ The official FreeSWITCH Debian repository can be used to obtain and install all
Adding the repository:

```
echo 'deb http://files.freeswitch.org/repo/deb/debian/ wheezy main' >> /etc/apt/sources.list.d/freeswitch.list
echo 'deb http://files.freeswitch.org/repo/deb/debian/ jessie main' >> /etc/apt/sources.list.d/freeswitch.list
curl http://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | apt-key add -
```

Expand Down Expand Up @@ -191,4 +191,4 @@ Note that this will only affect all subsequent calls from/to the remote station,
A transmission is regarded as failed and added to the fallback database if SpanDSP reports the transmission as not successful and one of the following conditions apply:

* Negotiation has happened multiple times
* Negotiation was successful but transmitted pages contain bad rows
* Negotiation was successful but transmitted pages contain bad rows
4 changes: 2 additions & 2 deletions config/freeswitch/autoload_configs/logfile.conf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<!-- Maximum number of log files to keep before wrapping -->
<!-- If this parameter is enabled, the log filenames will not include a date stamp -->
<!-- <param name="maximum-rotate" value="32"/> -->
<!-- Uncomment to prefix all log lines by the session's uuid -->
<param name="uuid" value="true" />
<!-- Prefix all log lines by the session's uuid -->
<param name="uuid" value="true" />
</settings>
<mappings>
<!--
Expand Down
8 changes: 3 additions & 5 deletions config/freeswitch/autoload_configs/modules.conf.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
<configuration name="modules.conf" description="Modules">
<modules>


<load module="mod_syslog"/>
<load module="mod_logfile"/>

<load module="mod_event_socket"/>
<load module="mod_sofia"/>

<load module="mod_commands"/>
<load module="mod_dptools"/>

<load module="mod_spandsp"/>
<load module="mod_timerfd"/>

<load module="mod_tone_stream"/>
<load module="mod_db"/>

Expand Down
4 changes: 2 additions & 2 deletions config/freeswitch/autoload_configs/sofia.conf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
<param name="dtmf-duration" value="2000"/>
<param name="codec-prefs" value="PCMA,PCMU"/>
<param name="disable-hold" value="true"/>
<param name="rtp-timer-name" value="timerfd"/>

<param name="rtp-timer-name" value="soft"/>
<param name="local-network-acl" value="localnet.auto"/>
<param name="manage-presence" value="false"/>

Expand Down
18 changes: 18 additions & 0 deletions config/freeswitch/autoload_configs/syslog.conf.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<configuration name="syslog.conf" description="Syslog Logger">
<!-- SYSLOG -->
<!-- emerg - system is unusable -->
<!-- alert - action must be taken immediately -->
<!-- crit - critical conditions -->
<!-- err - error conditions -->
<!-- warning - warning conditions -->
<!-- notice - normal, but significant, condition -->
<!-- info - informational message -->
<!-- debug - debug-level message -->
<settings>
<param name="facility" value="uucp"/>
<param name="ident" value="freeswitch"/>
<param name="loglevel" value="warning"/>
<!-- log uuids in syslogs -->
<param name="uuid" value="true"/>
</settings>
</configuration>
5 changes: 4 additions & 1 deletion config/freeswitch/gateways/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
<param name="username" value="foo"/>
<param name="password" value="bar"/>

<param name="extension" value="auto_to_user"/>
<param name="caller-id-in-from" value="true"/>
<param name="extension-in-contact" value="true"/>

<!-- If you are having a problem with the default registering as gw+gateway_name@ip you can set this to true to use extension@ip -->
<param name="extension-in-contact" value="false"/>

<!-- uncomment to disable registering at the gateway -->
<!-- <param name="register" value="false"/> -->
Expand Down
4 changes: 2 additions & 2 deletions config/gofax.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ disablet38 = false
; Enable fallback to softmodem for the next call of
; a caller (identified by caller id) if negotiation using T.38 fails
; Persistent fallback data is saved in FreeSWITCH's mod_db
softmodemfallback = false
softmodemfallback = true

[hylafax]
spooldir = /var/spool/hylafax
Expand All @@ -24,7 +24,7 @@ spooldir = /var/spool/hylafax
modems = 5

; Enable to make GOfax.IP write xferfaxlog
; xferfaxlog = /var/spool/hylafax/etc/xferfaxlog
xferfaxlog = log/xferfaxlog

[gofaxd]
socket = :8022
Expand Down
3 changes: 3 additions & 0 deletions config/hylafax/DynamicConfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
echo "RejectCall: false"

14 changes: 13 additions & 1 deletion config/hylafax/FaxDispatch
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@
# $CALLID3 -> Recipent (SIP To-User)
#

[email protected]
# Language / email template
TEMPLATE=en

# From address for all faxes / notifications
[email protected]

# Recipient for faxmaster (administrative) notifications
[email protected]
NOTIFY_FAXMASTER=never

# Recipient for incoming fax
[email protected]

# Filetype for fax attachment
FILETYPE=pdf
17 changes: 17 additions & 0 deletions config/hylafax/FaxNotify
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Language / email template
TEMPLATE=en

# From address for all faxes / notifications
[email protected]

# Recipient for faxmaster (administrative) notifications
[email protected]
NOTIFY_FAXMASTER=never

# When to notify recipient / sender
notify="always"

# Override recipient
mailaddr=$TOADDR
58 changes: 58 additions & 0 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

set -e -x

REPO="/usr/src/gofaxip"
BUILD="${HOME}/gofaxip"
ROOT="${HOME}/debroot"
OUTPUT="${HOME}/packages"

rm -rf ${BUILD} ${ROOT} ${OUTPUT}
cp -r ${REPO} ${BUILD}

shortid="$(cd ${REPO} && git rev-parse --short HEAD)"
timestamp="$(date -d @$(cd ${REPO} && git log -1 --pretty=format:%ct) -u +%Y%m%d%H%M)"
version="1.0~git${timestamp}.${shortid}"
debversion="${version}"

cd ${BUILD}
export GOPATH=$(pwd)
go install -ldflags "-X main.version '${version}'" gofaxd gofaxsend

mkdir -p ${ROOT} ${OUTPUT}
mkdir -p ${ROOT}/usr/bin ${ROOT}/etc ${ROOT}/lib/systemd/system ${ROOT}/usr/share/doc/gofaxip
cp ${BUILD}/bin/* ${ROOT}/usr/bin/
cp ${BUILD}/AUTHORS ${BUILD}/LICENSE ${BUILD}/README.md ${ROOT}/usr/share/doc/gofaxip/
cp -r ${BUILD}/config ${ROOT}/usr/share/doc/gofaxip/config
cp ${BUILD}/config/gofax.conf ${ROOT}/etc/
cp ${BUILD}/docker/gofaxip.service ${ROOT}/lib/systemd/system/
cp ${BUILD}/docker/freeswitch.service ${ROOT}/lib/systemd/system/
cp -r ${BUILD}/config/freeswitch ${ROOT}/etc/freeswitch
#ToDo: Chown config

fpm -f -s dir -t deb -n gofaxip \
-C "${ROOT}" \
-v "${version}" \
-p ${OUTPUT}/gofaxip_VERSION_ARCH.deb \
--description "GOfax.IP - T.38 / Fax Over IP backend for HylaFAX using FreeSWITCH" \
--category comm \
--license GPL2 \
--vendor "GONICUS GmbH" \
--url "https://github.com/gonicus/gofaxip" \
--maintainer "Markus Lindenberg <[email protected]>" \
--config-files /etc/gofax.conf \
--config-files /etc/freeswitch \
-d hylafax-server \
-d freeswitch \
-d freeswitch-mod-commands \
-d freeswitch-mod-dptools \
-d freeswitch-mod-event-socket \
-d freeswitch-mod-sofia \
-d freeswitch-mod-spandsp \
-d freeswitch-mod-tone-stream \
-d freeswitch-mod-db \
-d freeswitch-mod-syslog \
-d freeswitch-mod-logfile \
--conflicts freeswitch-sysvinit \
--conflicts freeswitch-systemd \
.
17 changes: 17 additions & 0 deletions docker/freeswitch.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[Unit]
Description=FreeSWITCH VoIP Softswitch
After=network.target local-fs.target

[Service]
User=uucp
Group=uucp
RuntimeDirectory=freeswitch
PermissionsStartOnly=true
ExecStartPre=/bin/chown -R uucp: /var/lib/freeswitch /var/log/freeswitch
ExecStart=/usr/bin/freeswitch -nonat -nc -nf
TimeoutSec=45s
Restart=always
IOSchedulingClass=realtime

[Install]
WantedBy=multi-user.target
11 changes: 11 additions & 0 deletions docker/gofaxip.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=GOfax.IP Fax over IP Bridge
After=network.target local-fs.target

[Service]
User=uucp
ExecStart=/usr/bin/gofaxd
Restart=always

[Install]
WantedBy=multi-user.target

0 comments on commit b3bf29c

Please sign in to comment.