dot

packages and services management
Log | Files | Refs | README

commit 2a0c0da54458d828c22cc14c8f8ce0a282c4f3da
parent b5aff7706ce5f25b8c21ffa9c88fc6d241d14837
Author: Josuah Demangeon <mail@josuah.net>
Date:   Sat,  8 Dec 2018 19:49:06 +0100

s6/baresip: add setup wrapper

Diffstat:
Mbin/service-build | 2+-
Mpack/baresip/build | 8++++++++
Apack/baresip/dependencies/libalsa | 2++
Mpack/libalsa/build | 6+++++-
As6/baresip/x/conf/audio_alert | 1+
As6/baresip/x/conf/audio_player | 1+
As6/baresip/x/conf/audio_source | 1+
As6/baresip/x/conf/cons_listen | 1+
As6/baresip/x/data/accounts | 33+++++++++++++++++++++++++++++++++
As6/baresip/x/data/contacts | 11+++++++++++
As6/baresip/x/module/x | 4++++
As6/baresip/x/module_app/x | 3+++
As6/baresip/x/module_tmp/x | 1+
Ms6/baresip/x/setup | 32+++++++++++++++++++++++++++++++-
14 files changed, 103 insertions(+), 3 deletions(-)

diff --git a/bin/service-build b/bin/service-build @@ -42,7 +42,7 @@ if { { s6-hiercopy /etc/s6/.s6-rc/service-log ${sv},log } if { redirfd -a 1 ${sv},x/producer-for echo ${sv},log } if { redirfd -w 1 ${sv},log/consumer-for echo ${sv},x } - if { redirfd -w 1 ${sv},log/env/SERVICE echo ${sv},x } + if { redirfd -w 1 ${sv},log/env/SERVICE echo ${sv} } } # run the setup script diff --git a/pack/baresip/build b/pack/baresip/build @@ -10,11 +10,19 @@ mv $$ Makefile export STATIC=yes export LFLAGS=-static +export CFLAGS="${CFLAGS} -I${libalsa}/include" +export LFLAGS="${LFLAGS} -L${libalsa}/lib" + make \ + V=yes \ + \ LIBRE_MK="$libre/share/re/re.mk" \ LIBRE_SO="$libre/lib" \ LIBRE_INC="$libre/include/re" \ LIBREM_PATH="$librem" \ + \ + USE_ALSA=yes \ + \ PREFIX="$PREFIX" mkdir -p "$PREFIX/bin" diff --git a/pack/baresip/dependencies/libalsa b/pack/baresip/dependencies/libalsa @@ -0,0 +1 @@ +../../libalsa/version+ \ No newline at end of file diff --git a/pack/libalsa/build b/pack/libalsa/build @@ -1,4 +1,8 @@ #!/bin/sh -ex -./configure --prefix="$PREFIX" +./configure \ + --prefix="$PREFIX" \ + --enable-static=yes \ + --enable-shared=no + make install diff --git a/s6/baresip/x/conf/audio_alert b/s6/baresip/x/conf/audio_alert @@ -0,0 +1 @@ +alsa,default diff --git a/s6/baresip/x/conf/audio_player b/s6/baresip/x/conf/audio_player @@ -0,0 +1 @@ +alsa,default diff --git a/s6/baresip/x/conf/audio_source b/s6/baresip/x/conf/audio_source @@ -0,0 +1 @@ +alsa,default diff --git a/s6/baresip/x/conf/cons_listen b/s6/baresip/x/conf/cons_listen @@ -0,0 +1 @@ +0.0.0.0:5555 diff --git a/s6/baresip/x/data/accounts b/s6/baresip/x/data/accounts @@ -0,0 +1,33 @@ +# +# SIP accounts - one account per line -- sample configuration +# +# Displayname <sip:user:password@domain;uri-params>;addr-params +# +# uri-params: +# ;transport={udp,tcp,tls} +# +# addr-params: +# ;answermode={manual,early,auto} +# ;audio_codecs=opus/48000/2,pcma,... +# ;auth_user=username +# ;mediaenc={srtp,srtp-mand,srtp-mandf,dtls_srtp,zrtp} +# ;medianat={stun,turn,ice} +# ;outbound="sip:primary.example.com;transport=tcp" +# ;outbound2=sip:secondary.example.com +# ;ptime={10,20,30,40,...} +# ;regint=3600 +# ;pubint=0 (publishing off) +# ;regq=0.5 +# ;rtpkeep={zero,stun,dyna,rtcp} +# ;sipnat={outbound} +# ;stunserver=stun:[user:pass]@host[:port] +# ;video_codecs=h264,h263,... +# +# Examples: +# +# <sip:user:secret@domain.com;transport=tcp> +# <sip:user:secret@1.2.3.4;transport=tcp> +# <sip:user:secret@[2001:df8:0:16:216:6fff:fe91:614c]:5070;transport=tcp> +# + +<sip:josuah@sip.linphone.org>;transport=tls;medianat=ice;stunserver="stun:josuah@stun.linphone.org" diff --git a/s6/baresip/x/data/contacts b/s6/baresip/x/data/contacts @@ -0,0 +1,11 @@ +# +# SIP contacts +# +# Displayname <sip:user@domain>;addr-params +# +# addr-params: +# ;presence={none,p2p} +# + +"Echo Server" <sip:echo@creytiv.com> + diff --git a/s6/baresip/x/module/x b/s6/baresip/x/module/x @@ -0,0 +1,4 @@ +cons.so +stun.so +turn.so +ice.so diff --git a/s6/baresip/x/module_app/x b/s6/baresip/x/module_app/x @@ -0,0 +1,3 @@ +auloop.so +contact.so +menu.so diff --git a/s6/baresip/x/module_tmp/x b/s6/baresip/x/module_tmp/x @@ -0,0 +1 @@ +account.so diff --git a/s6/baresip/x/setup b/s6/baresip/x/setup @@ -1,3 +1,33 @@ #!/usr/bin/env execlineb -mkdir data +if { mkdir -p data } + +redirfd -w 1 data/config + +# configuration variables +if { + forbacktickx -n -o 0 x { ls conf } + importas var x + + redirfd -r 0 conf/${var} + withstdinas -n x + importas value x + + printf "%-20s %s\n" ${var} ${value} +} + +# modules to load +if { + forx -o 0 x { module module_tmp module_app } + importas type x + + backtick x { ls ${type} } + importas -s -d "\n" lists x + + if { echo } + + forbacktickx -d "\n" -o 0 x { sed "s/#.*//; s/ *$//; /^$/d" ${type}/${lists} } + importas -n module.so x + + printf "%-20s %s\n" ${type} ${module.so} +}