dot

packages and services management
Log | Files | Refs | README

commit 8151b3b74d25ad518172be2d0f30d7805b03e184
parent e020fe9ad928a26a5821d37059eb80171d01b4a2
Author: Josuah Demangeon <mail@josuah.net>
Date:   Sun, 16 Dec 2018 08:36:08 +0100

s6/kamailio/*/conf/module/*: module_name.so -> module_name

Diffstat:
Mbin/ptree | 7+------
Mbin/user-group-add | 14+++++++-------
Mbin/user-list | 3++-
Mbin/xdg-open | 2+-
Mdot/config/open/protocol/9p | 10+++++++++-
Mdot/config/open/protocol/ftp | 11+++++++++--
Mdot/config/open/protocol/git | 23+++++++++++++++++------
Mdot/config/open/protocol/gopher | 9++++++++-
Mdot/config/open/protocol/news | 5+++--
Mdot/config/open/protocol/sftp | 14+++++++++++---
Mdot/config/open/protocol/ssh | 18++++++++++++++----
Mdot/config/open/protocol/telnet | 11++++++++++-
Mdot/config/open/protocol/vnc | 14+++++++++++++-
Mpack/kamailio/build | 7+++++++
As6/acme-client/x/env/USER | 1+
Ms6/acme-client/x/run | 3+++
As6/axfrdns/x/env/USER | 1+
Ms6/axfrdns/x/run | 2+-
As6/baresip/x/env/USER | 1+
Ms6/baresip/x/run | 1-
As6/collectd/x/env/USER | 1+
Ms6/collectd/x/run | 1-
As6/curvevpn/x/env/USER | 1+
As6/dnscache/x/env/USER | 1+
Ms6/dnscache/x/run | 4++--
As6/fossil/x/env/USER | 1+
Ms6/fossil/x/run | 6+++---
As6/geomyidae/x/env/USER | 1+
Ms6/geomyidae/x/run | 2+-
As6/git-daemon/x/env/USER | 1+
Ms6/git-daemon/x/run | 6++----
Ds6/git-mirror/snooze/run | 22----------------------
Rs6/git-mirror/snooze/data/mirror -> s6/git-mirror/x/data/mirror | 0
Rs6/git-mirror/snooze/env/GIT -> s6/git-mirror/x/env/GIT | 0
As6/git-mirror/x/env/USER | 1+
As6/git-mirror/x/run | 12++++++++++++
Ds6/kamailio/mysql/conf/define/DBURL | 1-
Rs6/ii/x/env/USER -> s6/kamailio/sqlite/conf/module/db_sqlite | 0
As6/kamailio/sqlite/database/acc-create.sql | 41+++++++++++++++++++++++++++++++++++++++++
As6/kamailio/sqlite/database/alias_db-create.sql | 14++++++++++++++
As6/kamailio/sqlite/database/auth_db-create.sql | 14++++++++++++++
As6/kamailio/sqlite/database/avpops-create.sql | 16++++++++++++++++
As6/kamailio/sqlite/database/carrierroute-create.sql | 46++++++++++++++++++++++++++++++++++++++++++++++
As6/kamailio/sqlite/database/cpl-create.sql | 11+++++++++++
As6/kamailio/sqlite/database/dialog-create.sql | 43+++++++++++++++++++++++++++++++++++++++++++
As6/kamailio/sqlite/database/dialplan-create.sql | 14++++++++++++++
As6/kamailio/sqlite/database/dispatcher-create.sql | 12++++++++++++
As6/kamailio/sqlite/database/domain-create.sql | 23+++++++++++++++++++++++
As6/kamailio/sqlite/database/domainpolicy-create.sql | 14++++++++++++++
As6/kamailio/sqlite/database/drouting-create.sql | 43+++++++++++++++++++++++++++++++++++++++++++
As6/kamailio/sqlite/database/group-create.sql | 21+++++++++++++++++++++
As6/kamailio/sqlite/database/htable-create.sql | 11+++++++++++
As6/kamailio/sqlite/database/imc-create.sql | 21+++++++++++++++++++++
As6/kamailio/sqlite/database/lcr-create.sql | 49+++++++++++++++++++++++++++++++++++++++++++++++++
As6/kamailio/sqlite/database/matrix-create.sql | 10++++++++++
As6/kamailio/sqlite/database/mohqueue-create.sql | 26++++++++++++++++++++++++++
As6/kamailio/sqlite/database/msilo-create.sql | 20++++++++++++++++++++
As6/kamailio/sqlite/database/mtree-create.sql | 19+++++++++++++++++++
As6/kamailio/sqlite/database/pdt-create.sql | 10++++++++++
As6/kamailio/sqlite/database/permissions-create.sql | 25+++++++++++++++++++++++++
As6/kamailio/sqlite/database/pipelimit-create.sql | 9+++++++++
As6/kamailio/sqlite/database/presence-create.sql | 122+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
As6/kamailio/sqlite/database/purple-create.sql | 10++++++++++
As6/kamailio/sqlite/database/registrar-create.sql | 32++++++++++++++++++++++++++++++++
As6/kamailio/sqlite/database/rls-create.sql | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
As6/kamailio/sqlite/database/rtpengine-create.sql | 12++++++++++++
As6/kamailio/sqlite/database/rtpproxy-create.sql | 11+++++++++++
As6/kamailio/sqlite/database/sca-create.sql | 23+++++++++++++++++++++++
As6/kamailio/sqlite/database/siptrace-create.sql | 23+++++++++++++++++++++++
As6/kamailio/sqlite/database/speeddial-create.sql | 15+++++++++++++++
As6/kamailio/sqlite/database/standard-create.sql | 8++++++++
As6/kamailio/sqlite/database/topos-create.sql | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
As6/kamailio/sqlite/database/uac-create.sql | 20++++++++++++++++++++
As6/kamailio/sqlite/database/uid_auth_db-create.sql | 19+++++++++++++++++++
As6/kamailio/sqlite/database/uid_avp_db-create.sql | 12++++++++++++
As6/kamailio/sqlite/database/uid_domain-create.sql | 26++++++++++++++++++++++++++
As6/kamailio/sqlite/database/uid_gflags-create.sql | 11+++++++++++
As6/kamailio/sqlite/database/uid_uri_db-create.sql | 28++++++++++++++++++++++++++++
As6/kamailio/sqlite/database/uri_db-create.sql | 11+++++++++++
As6/kamailio/sqlite/database/userblacklist-create.sql | 23+++++++++++++++++++++++
As6/kamailio/sqlite/database/usrloc-create.sql | 49+++++++++++++++++++++++++++++++++++++++++++++++++
As6/kamailio/sqlite/setup-database | 11+++++++++++
As6/kamailio/x/conf/module/acc | 1+
Ds6/kamailio/x/conf/module/acc.so | 1-
Rs6/kamailio/mysql/conf/module/db_mysql.so -> s6/kamailio/x/conf/module/alias_db | 0
Rs6/kamailio/sqlite/conf/module/db_sqlite.so -> s6/kamailio/x/conf/module/auth | 0
Rs6/kamailio/x/conf/module/alias_db.so -> s6/kamailio/x/conf/module/auth_db | 0
Rs6/kamailio/x/conf/module/auth.so -> s6/kamailio/x/conf/module/cfg_rpc | 0
Rs6/kamailio/x/conf/module/auth_db.so -> s6/kamailio/x/conf/module/corex | 0
Rs6/kamailio/x/conf/module/cfg_rpc.so -> s6/kamailio/x/conf/module/counters | 0
Rs6/kamailio/x/conf/module/corex.so -> s6/kamailio/x/conf/module/ctl | 0
Rs6/kamailio/x/conf/module/counters.so -> s6/kamailio/x/conf/module/debugger | 0
Rs6/kamailio/x/conf/module/ctl.so -> s6/kamailio/x/conf/module/domain | 0
Rs6/kamailio/x/conf/module/debugger.so -> s6/kamailio/x/conf/module/htable | 0
Rs6/kamailio/x/conf/module/domain.so -> s6/kamailio/x/conf/module/jsonrpcs | 0
Rs6/kamailio/x/conf/module/htable.so -> s6/kamailio/x/conf/module/kex | 0
Rs6/kamailio/x/conf/module/jsonrpcs.so -> s6/kamailio/x/conf/module/maxfwd | 0
Rs6/kamailio/x/conf/module/kex.so -> s6/kamailio/x/conf/module/nathelper | 0
Rs6/kamailio/x/conf/module/maxfwd.so -> s6/kamailio/x/conf/module/permissions | 0
Rs6/kamailio/x/conf/module/nathelper.so -> s6/kamailio/x/conf/module/pike | 0
Rs6/kamailio/x/conf/module/permissions.so -> s6/kamailio/x/conf/module/pv | 0
Rs6/kamailio/x/conf/module/pike.so -> s6/kamailio/x/conf/module/registrar | 0
Rs6/kamailio/x/conf/module/pv.so -> s6/kamailio/x/conf/module/rr | 0
Rs6/kamailio/x/conf/module/registrar.so -> s6/kamailio/x/conf/module/rtpproxy | 0
Rs6/kamailio/x/conf/module/rr.so -> s6/kamailio/x/conf/module/sanity | 0
Rs6/kamailio/x/conf/module/rtpproxy.so -> s6/kamailio/x/conf/module/siputils | 0
Rs6/kamailio/x/conf/module/sanity.so -> s6/kamailio/x/conf/module/sl | 0
Rs6/kamailio/x/conf/module/siputils.so -> s6/kamailio/x/conf/module/speeddial | 0
Rs6/kamailio/x/conf/module/sl.so -> s6/kamailio/x/conf/module/textops | 0
Rs6/kamailio/x/conf/module/speeddial.so -> s6/kamailio/x/conf/module/tm | 0
Ds6/kamailio/x/conf/module/tm.so | 0
As6/kamailio/x/conf/module/tmx | 1+
Ds6/kamailio/x/conf/module/tmx.so | 1-
As6/kamailio/x/conf/module/usrloc | 1+
Ds6/kamailio/x/conf/module/usrloc.so | 1-
Rs6/kamailio/x/conf/module/textops.so -> s6/kamailio/x/conf/module/xlog | 0
Ds6/kamailio/x/conf/module/xlog.so | 0
As6/kamailio/x/env/USER | 1+
Ms6/kamailio/x/run | 2++
Ms6/kamailio/x/setup | 6++++--
Ds6/kamailio/xmlrpc/conf/modparam/xmlrpc/route | 1-
Ds6/kamailio/xmlrpc/conf/modparam/xmlrpc/url_match | 1-
Ds6/kamailio/xmlrpc/conf/route/route/XMLRPC | 15---------------
As6/ngircd/x/env/USER | 1+
Ms6/ngircd/x/run | 1-
As6/opentracker/x/env/USER | 1+
Ms6/opentracker/x/run | 1-
As6/pjsua/x/env/USER | 1+
Ms6/pjsua/x/run | 1-
As6/qemu/x/env/USER | 1+
Ds6/qmail-send/x/env/USER | 1-
Ds6/qmail-smtpd/x/env/USER | 1-
Rs6/mpop/x/env/USER -> s6/ratox/josuah/env/USER | 0
Ms6/ratox/x/run | 10++++++++--
As6/sndiod/x/env/USER | 1+
Ds6/ssh-agent/x/env/USER | 0
As6/tapio/x/env/USER | 1+
As6/tinc/x/env/USER | 1+
Ms6/tinc/x/run | 1-
Ms6/tinydns/x/run | 2+-
Ts6/tor/x/env/USER | 0
As6/transmission/x/env/USER | 1+
Ms6/transmission/x/run | 5++++-
As6/u9fs-mount/x/env/USER | 1+
As6/u9fs-ssh/x/env/USER | 1+
Ms6/u9fs-ssh/x/run | 1-
Ds6/user-check/type | 1-
As6/venti/x/env/USER | 1+
Ms6/venti/x/run | 2+-
As6/vsftpd/x/env/USER | 1+
Ms6/vsftpd/x/run | 1-
As6/vtund/x/env/USER | 1+
As6/walldns/x/env/USER | 1+
As6/warp-vpn/x/env/USER | 1+
154 files changed, 1285 insertions(+), 108 deletions(-)

diff --git a/bin/ptree b/bin/ptree @@ -29,11 +29,6 @@ BEGIN { # pstree implementation in awk -NR == 1 { - sub(" *[^ ]+", ""); - print $0; -} - # Build a relational database in <entries> from the output of ps: The # parent pid (ppid) -> pid pairs are used to accumulate a list of child # pid (serialized into a csv: ",234,532,454") later used for building @@ -112,7 +107,7 @@ END { printf("%s", entries[i":info"]); for (j = 1; entries[i":"j] != ""; j++) printf("%s", entries[i":"j]); - printf("%-" 30 - j * 3 "s", entries[i":comm"]); + printf("%-" 30 - j * 3 "s ", entries[i":comm"]); print(" "entries[i":args"]); } } diff --git a/bin/user-group-add b/bin/user-group-add @@ -1,10 +1,10 @@ #!/usr/bin/env execlineb -importas -i user 1 +elgetpositionals +shift -n 1 -ifelse { fdclose 1 fdclose 2 busybox --help addgroup } { - forbacktickx -n x { dollarat } importas group x - busybox addgroup $user $group -} +if { group-add ${@} } -forbacktickx -n x { dollarat } importas group x -usermod -a -G $group $user +forbacktickx -n -o 0 x { dollarat -n -d , } +importas group x + +usermod -a -G ${1} ${user} diff --git a/bin/user-list b/bin/user-list @@ -1,3 +1,4 @@ #!/usr/bin/env execlineb -pipeline { sed s/::/:.:/g /etc/passwd } column -t -s : +pipeline { sed s/::/:.:/g /etc/passwd } +column -t -s : diff --git a/bin/xdg-open b/bin/xdg-open @@ -1,3 +1,3 @@ #!/usr/bin/env execlineb elgetpositionals -open $@ +window open $@ diff --git a/dot/config/open/protocol/9p b/dot/config/open/protocol/9p @@ -1,5 +1,13 @@ #!/usr/bin/env execlineb -importas host 3 +multisubstitute { + importas uri 1 + importas user 2 + importas host 3 + importas port 4 + importas path 5 + importas frag 6 +} + define dir /mnt/9p/$host mkdir -p $dir exec 9pfs $host $dir diff --git a/dot/config/open/protocol/ftp b/dot/config/open/protocol/ftp @@ -1,4 +1,11 @@ #!/usr/bin/env execlineb -importas uri 1 +multisubstitute { + importas uri 1 + importas user 2 + importas host 3 + importas port 4 + importas path 5 + importas frag 6 +} -ftp $1 +ftp ${uri} diff --git a/dot/config/open/protocol/git b/dot/config/open/protocol/git @@ -1,11 +1,22 @@ #!/usr/bin/env execlineb -backtick -n x { whoami } importas USER x -backtick -n x { homeof $USER } importas HOME x -importas uri 1 -importas host 3 -importas repo 5 +multisubstitute { + importas uri 1 + importas user 2 + importas host 3 + importas port 4 + importas path 5 + importas frag 6 +} + +backtick -n x { whoami } +importas USER x + +backtick -n x { homeof ${USER} } +importas HOME x + +backtick -n x { dirname ${HOME}/git/${host}/${path} } +importas dir x -backtick -n x { dirname ${HOME}/git/${host}/${repo} } importas dir x if { mkdir -p $dir } cd $dir if { echo $dir } diff --git a/dot/config/open/protocol/gopher b/dot/config/open/protocol/gopher @@ -1,4 +1,11 @@ #!/usr/bin/env execlineb -importas uri 1 +multisubstitute { + importas uri 1 + importas user 2 + importas host 3 + importas port 4 + importas path 5 + importas frag 6 +} sacc $uri diff --git a/dot/config/open/protocol/news b/dot/config/open/protocol/news @@ -1,2 +1,3 @@ -#!/bin/sh -ex -exec links "$1" +#!/usr/bin/env execlineb +elgetpositionals +links ${1} diff --git a/dot/config/open/protocol/sftp b/dot/config/open/protocol/sftp @@ -1,3 +1,11 @@ -#!/usr/bin/sh -test -z "$4" && port='22' || port=$ -exec sftp -P $port $3 +#!/usr/bin/env execlineb +multisubstitute { + importas uri 1 + importas user 2 + importas host 3 + importas -D 22 port 4 + importas path 5 + importas frag 6 +} + +exec sftp -P ${port} ${host} diff --git a/dot/config/open/protocol/ssh b/dot/config/open/protocol/ssh @@ -1,4 +1,14 @@ -#!/bin/sh -e -test "$user" && host=$user@$host -test "$port" && port=-p' '$port -exec ssh $port "$host" +#!/usr/bin/env execlineb +multisubstitute { + importas uri 1 + importas user 2 + importas host 3 + importas port 4 + importas path 5 + importas frag 6 +} + +ifelse { if { test ${port} } if { test ${user} } { exec ssh -p ${port} ${user}@${host} } +ifelse { if -n { test ${port} } if { test ${user} } { exec ssh ${user}@${host} } +ifelse { if { test ${port} } if -n { test ${user} } { exec ssh -p ${port} ${host} } +ifelse { if -n { test ${port} } if -n { test ${user} } { exec ssh ${host} } diff --git a/dot/config/open/protocol/telnet b/dot/config/open/protocol/telnet @@ -1,2 +1,11 @@ #!/bin/sh -e -exec telnet "$port" "$host" +multisubstitute { + importas uri 1 + importas user 2 + importas host 3 + importas port 4 + importas path 5 + importas frag 6 +} + +telnet ${host} ${port} diff --git a/dot/config/open/protocol/vnc b/dot/config/open/protocol/vnc @@ -1,2 +1,14 @@ #!/bin/sh -e -exec vncviewer -use8 "$(echo "$1" | sed 's,vnc://,,')" +multisubstitute { + importas uri 1 + importas user 2 + importas host 3 + importas port 4 + importas path 5 + importas frag 6 +} + +backtick -n x { heredoc 0 ${uri} sed "s,vnc://,," } +importas stripped_uri x + +vncviewer -use8 ${stripped_uri} diff --git a/pack/kamailio/build b/pack/kamailio/build @@ -8,3 +8,10 @@ export LD="cc -L${sqlite}/lib -L${libressl}/lib" make CC="${CC}" LD="${LD}" PREFIX="${PREFIX}" install mv "$PREFIX/sbin" "$PREFIX/bin" + +for script in kamctl kamdbctl; do + file= + sed -r '1 s,#!/bin/bash,#!/bin/sh,' "${PREFIX}/bin/${script}" >$$ + chmod +x $$ + mv $$ ${PREFIX}/bin/${script} +done diff --git a/s6/acme-client/x/env/USER b/s6/acme-client/x/env/USER @@ -0,0 +1 @@ +ssl diff --git a/s6/acme-client/x/run b/s6/acme-client/x/run @@ -7,6 +7,7 @@ multisubstitute { importas WWWDIR WWWDIR importas SSLDIR SSLDIR importas DOMAIN DOMAIN + importas USER USER } # It uses ":well-known" instead of ".well-known" because httpfile(1) @@ -17,6 +18,8 @@ if { mkdir -p ${SSLDIR}/${DOMAIN} } if { mkdir -p ${SSLDIR}/private } if { chmod 700 ${SSLDIR}/private } +s6-setuidgid ${USER} + snooze -d1 acme-client -vnN -a $AGREEMENT_URL diff --git a/s6/axfrdns/x/env/USER b/s6/axfrdns/x/env/USER @@ -0,0 +1 @@ +dns diff --git a/s6/axfrdns/x/run b/s6/axfrdns/x/run @@ -6,7 +6,7 @@ multisubstitute { importas USER USER } -s6-envuidgid $USER +s6-envuidgid ${USER} s6-softliimt 300000 s6-tcpserver -vDRHl0 0.0.0.0 53 axrfdns diff --git a/s6/baresip/x/env/USER b/s6/baresip/x/env/USER @@ -0,0 +1 @@ +sip diff --git a/s6/baresip/x/run b/s6/baresip/x/run @@ -1,5 +1,4 @@ #!/usr/bin/env execlineb fdmove -c 2 1 - baresip -v -f data diff --git a/s6/collectd/x/env/USER b/s6/collectd/x/env/USER @@ -0,0 +1 @@ +monit diff --git a/s6/collectd/x/run b/s6/collectd/x/run @@ -1,5 +1,4 @@ #!/usr/bin/env execlineb fdmove -c 2 1 - collectd -f -C /etc/collectd/conf diff --git a/s6/curvevpn/x/env/USER b/s6/curvevpn/x/env/USER @@ -0,0 +1 @@ +vpn diff --git a/s6/dnscache/x/env/USER b/s6/dnscache/x/env/USER @@ -0,0 +1 @@ +dns diff --git a/s6/dnscache/x/run b/s6/dnscache/x/run @@ -2,11 +2,11 @@ fdmove -c 2 1 s6-envdir env -{ +multisubstitute { importas DATALIMIT DATALIMIT } s6-envguid dns -s6-softlimit -o 250 -d $DATALIMIT +s6-softlimit -o 250 -d ${DATALIMIT} pipeline { dd if=/dev/random } dnscache diff --git a/s6/fossil/x/env/USER b/s6/fossil/x/env/USER @@ -0,0 +1 @@ +9p diff --git a/s6/fossil/x/run b/s6/fossil/x/run @@ -8,8 +8,8 @@ multisubstitute { importas PORT_H PORT_H } -cd $ROOT +cd ${ROOT} fossil -s -c data/conf - -a tcp!*!$PORT_A - -h tcp!*!$PORT_H + -a tcp!*!${PORT_A} + -h tcp!*!${PORT_H} diff --git a/s6/geomyidae/x/env/USER b/s6/geomyidae/x/env/USER @@ -0,0 +1 @@ +gopher diff --git a/s6/geomyidae/x/run b/s6/geomyidae/x/run @@ -9,4 +9,4 @@ multisubstitute { importas IPV IPV } -geomyidae -d -b $ROOT -h $BIND -p $PORT -$IPV +geomyidae -d -b ${ROOT} -h ${BIND} -p ${PORT} -${IPV} diff --git a/s6/git-daemon/x/env/USER b/s6/git-daemon/x/env/USER @@ -0,0 +1 @@ +git diff --git a/s6/git-daemon/x/run b/s6/git-daemon/x/run @@ -8,7 +8,5 @@ multisubstitute { importas ROOT ROOT } -s6-tcpserver $BIND $PORT -git daemon - --inetd - --base-path=$ROOT +s6-tcpserver ${BIND} ${PORT} +git daemon --inetd --base-path=${ROOT} diff --git a/s6/git-mirror/snooze/run b/s6/git-mirror/snooze/run @@ -1,22 +0,0 @@ -#!/usr/bin/env execlineb -fdmove -c 2 1 -s6-envdir env - -fdmove -c 1 -s6-envdir env multisubstitute { - importas GIT GIT -} - -foreground { - if { mkdir -p $GIT } - forbacktickx -n x { cat data/mirror } importas x x - backtick -n repo { basename $x .git } importas repo repo - if -n { test -d ${GIT}/${repo} } - if { git clone --bare ${x} ${GIT}/${repo} } - git -C ${GIT}/${repo} config remote.origin.fetch 'refs/heads/*:refs/heads/*' -} - -snooze -H * -M /15 - -forbacktickx -n x { s6-ls ${GIT} } importas x x -git -C ${GIT}/${x} fetch --all --verbose diff --git a/s6/git-mirror/snooze/data/mirror b/s6/git-mirror/x/data/mirror diff --git a/s6/git-mirror/snooze/env/GIT b/s6/git-mirror/x/env/GIT diff --git a/s6/git-mirror/x/env/USER b/s6/git-mirror/x/env/USER @@ -0,0 +1 @@ +git diff --git a/s6/git-mirror/x/run b/s6/git-mirror/x/run @@ -0,0 +1,12 @@ +#!/usr/bin/env execlineb +fdmove -c 2 1 +s6-envdir env + +multisubstitute { + importas GITDIR GITDIR +} + +snooze -H * -M /15 +forbacktickx -n x { s6-ls ${GIT} } +importas x x +git -C ${GITDIR}/${x} fetch --all --verbose diff --git a/s6/kamailio/mysql/conf/define/DBURL b/s6/kamailio/mysql/conf/define/DBURL @@ -1 +0,0 @@ -"mysql://kamailio:kamailiorw@localhost/kamailio" diff --git a/s6/ii/x/env/USER b/s6/kamailio/sqlite/conf/module/db_sqlite diff --git a/s6/kamailio/sqlite/database/acc-create.sql b/s6/kamailio/sqlite/database/acc-create.sql @@ -0,0 +1,41 @@ +CREATE TABLE acc ( + id INTEGER PRIMARY KEY NOT NULL, + method VARCHAR(16) DEFAULT '' NOT NULL, + from_tag VARCHAR(64) DEFAULT '' NOT NULL, + to_tag VARCHAR(64) DEFAULT '' NOT NULL, + callid VARCHAR(255) DEFAULT '' NOT NULL, + sip_code VARCHAR(3) DEFAULT '' NOT NULL, + sip_reason VARCHAR(128) DEFAULT '' NOT NULL, + time TIMESTAMP WITHOUT TIME ZONE NOT NULL +); + +CREATE INDEX acc_callid_idx ON acc (callid); + +INSERT INTO version (table_name, table_version) values ('acc','5'); + +CREATE TABLE acc_cdrs ( + id INTEGER PRIMARY KEY NOT NULL, + start_time TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:00' NOT NULL, + end_time TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:00' NOT NULL, + duration REAL DEFAULT 0 NOT NULL +); + +CREATE INDEX acc_cdrs_start_time_idx ON acc_cdrs (start_time); + +INSERT INTO version (table_name, table_version) values ('acc_cdrs','2'); + +CREATE TABLE missed_calls ( + id INTEGER PRIMARY KEY NOT NULL, + method VARCHAR(16) DEFAULT '' NOT NULL, + from_tag VARCHAR(64) DEFAULT '' NOT NULL, + to_tag VARCHAR(64) DEFAULT '' NOT NULL, + callid VARCHAR(255) DEFAULT '' NOT NULL, + sip_code VARCHAR(3) DEFAULT '' NOT NULL, + sip_reason VARCHAR(128) DEFAULT '' NOT NULL, + time TIMESTAMP WITHOUT TIME ZONE NOT NULL +); + +CREATE INDEX missed_calls_callid_idx ON missed_calls (callid); + +INSERT INTO version (table_name, table_version) values ('missed_calls','4'); + diff --git a/s6/kamailio/sqlite/database/alias_db-create.sql b/s6/kamailio/sqlite/database/alias_db-create.sql @@ -0,0 +1,14 @@ +CREATE TABLE dbaliases ( + id INTEGER PRIMARY KEY NOT NULL, + alias_username VARCHAR(64) DEFAULT '' NOT NULL, + alias_domain VARCHAR(64) DEFAULT '' NOT NULL, + username VARCHAR(64) DEFAULT '' NOT NULL, + domain VARCHAR(64) DEFAULT '' NOT NULL +); + +CREATE INDEX dbaliases_alias_user_idx ON dbaliases (alias_username); +CREATE INDEX dbaliases_alias_idx ON dbaliases (alias_username, alias_domain); +CREATE INDEX dbaliases_target_idx ON dbaliases (username, domain); + +INSERT INTO version (table_name, table_version) values ('dbaliases','1'); + diff --git a/s6/kamailio/sqlite/database/auth_db-create.sql b/s6/kamailio/sqlite/database/auth_db-create.sql @@ -0,0 +1,14 @@ +CREATE TABLE subscriber ( + id INTEGER PRIMARY KEY NOT NULL, + username VARCHAR(64) DEFAULT '' NOT NULL, + domain VARCHAR(64) DEFAULT '' NOT NULL, + password VARCHAR(64) DEFAULT '' NOT NULL, + ha1 VARCHAR(128) DEFAULT '' NOT NULL, + ha1b VARCHAR(128) DEFAULT '' NOT NULL, + CONSTRAINT subscriber_account_idx UNIQUE (username, domain) +); + +CREATE INDEX subscriber_username_idx ON subscriber (username); + +INSERT INTO version (table_name, table_version) values ('subscriber','7'); + diff --git a/s6/kamailio/sqlite/database/avpops-create.sql b/s6/kamailio/sqlite/database/avpops-create.sql @@ -0,0 +1,16 @@ +CREATE TABLE usr_preferences ( + id INTEGER PRIMARY KEY NOT NULL, + uuid VARCHAR(64) DEFAULT '' NOT NULL, + username VARCHAR(128) DEFAULT 0 NOT NULL, + domain VARCHAR(64) DEFAULT '' NOT NULL, + attribute VARCHAR(32) DEFAULT '' NOT NULL, + type INTEGER DEFAULT 0 NOT NULL, + value VARCHAR(128) DEFAULT '' NOT NULL, + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL +); + +CREATE INDEX usr_preferences_ua_idx ON usr_preferences (uuid, attribute); +CREATE INDEX usr_preferences_uda_idx ON usr_preferences (username, domain, attribute); + +INSERT INTO version (table_name, table_version) values ('usr_preferences','2'); + diff --git a/s6/kamailio/sqlite/database/carrierroute-create.sql b/s6/kamailio/sqlite/database/carrierroute-create.sql @@ -0,0 +1,46 @@ +CREATE TABLE carrierroute ( + id INTEGER PRIMARY KEY NOT NULL, + carrier INTEGER DEFAULT 0 NOT NULL, + domain INTEGER DEFAULT 0 NOT NULL, + scan_prefix VARCHAR(64) DEFAULT '' NOT NULL, + flags INTEGER DEFAULT 0 NOT NULL, + mask INTEGER DEFAULT 0 NOT NULL, + prob REAL DEFAULT 0 NOT NULL, + strip INTEGER DEFAULT 0 NOT NULL, + rewrite_host VARCHAR(128) DEFAULT '' NOT NULL, + rewrite_prefix VARCHAR(64) DEFAULT '' NOT NULL, + rewrite_suffix VARCHAR(64) DEFAULT '' NOT NULL, + description VARCHAR(255) DEFAULT NULL +); + +INSERT INTO version (table_name, table_version) values ('carrierroute','3'); + +CREATE TABLE carrierfailureroute ( + id INTEGER PRIMARY KEY NOT NULL, + carrier INTEGER DEFAULT 0 NOT NULL, + domain INTEGER DEFAULT 0 NOT NULL, + scan_prefix VARCHAR(64) DEFAULT '' NOT NULL, + host_name VARCHAR(128) DEFAULT '' NOT NULL, + reply_code VARCHAR(3) DEFAULT '' NOT NULL, + flags INTEGER DEFAULT 0 NOT NULL, + mask INTEGER DEFAULT 0 NOT NULL, + next_domain INTEGER DEFAULT 0 NOT NULL, + description VARCHAR(255) DEFAULT NULL +); + +INSERT INTO version (table_name, table_version) values ('carrierfailureroute','2'); + +CREATE TABLE carrier_name ( + id INTEGER PRIMARY KEY NOT NULL, + carrier VARCHAR(64) DEFAULT NULL +); + +INSERT INTO version (table_name, table_version) values ('carrier_name','1'); + +CREATE TABLE domain_name ( + id INTEGER PRIMARY KEY NOT NULL, + domain VARCHAR(64) DEFAULT NULL +); + +INSERT INTO version (table_name, table_version) values ('domain_name','1'); + diff --git a/s6/kamailio/sqlite/database/cpl-create.sql b/s6/kamailio/sqlite/database/cpl-create.sql @@ -0,0 +1,11 @@ +CREATE TABLE cpl ( + id INTEGER PRIMARY KEY NOT NULL, + username VARCHAR(64) NOT NULL, + domain VARCHAR(64) DEFAULT '' NOT NULL, + cpl_xml TEXT, + cpl_bin TEXT, + CONSTRAINT cpl_account_idx UNIQUE (username, domain) +); + +INSERT INTO version (table_name, table_version) values ('cpl','1'); + diff --git a/s6/kamailio/sqlite/database/dialog-create.sql b/s6/kamailio/sqlite/database/dialog-create.sql @@ -0,0 +1,43 @@ +CREATE TABLE dialog ( + id INTEGER PRIMARY KEY NOT NULL, + hash_entry INTEGER NOT NULL, + hash_id INTEGER NOT NULL, + callid VARCHAR(255) NOT NULL, + from_uri VARCHAR(128) NOT NULL, + from_tag VARCHAR(64) NOT NULL, + to_uri VARCHAR(128) NOT NULL, + to_tag VARCHAR(64) NOT NULL, + caller_cseq VARCHAR(20) NOT NULL, + callee_cseq VARCHAR(20) NOT NULL, + caller_route_set VARCHAR(512), + callee_route_set VARCHAR(512), + caller_contact VARCHAR(128) NOT NULL, + callee_contact VARCHAR(128) NOT NULL, + caller_sock VARCHAR(64) NOT NULL, + callee_sock VARCHAR(64) NOT NULL, + state INTEGER NOT NULL, + start_time INTEGER NOT NULL, + timeout INTEGER DEFAULT 0 NOT NULL, + sflags INTEGER DEFAULT 0 NOT NULL, + iflags INTEGER DEFAULT 0 NOT NULL, + toroute_name VARCHAR(32), + req_uri VARCHAR(128) NOT NULL, + xdata VARCHAR(512) +); + +CREATE INDEX dialog_hash_idx ON dialog (hash_entry, hash_id); + +INSERT INTO version (table_name, table_version) values ('dialog','7'); + +CREATE TABLE dialog_vars ( + id INTEGER PRIMARY KEY NOT NULL, + hash_entry INTEGER NOT NULL, + hash_id INTEGER NOT NULL, + dialog_key VARCHAR(128) NOT NULL, + dialog_value VARCHAR(512) NOT NULL +); + +CREATE INDEX dialog_vars_hash_idx ON dialog_vars (hash_entry, hash_id); + +INSERT INTO version (table_name, table_version) values ('dialog_vars','1'); + diff --git a/s6/kamailio/sqlite/database/dialplan-create.sql b/s6/kamailio/sqlite/database/dialplan-create.sql @@ -0,0 +1,14 @@ +CREATE TABLE dialplan ( + id INTEGER PRIMARY KEY NOT NULL, + dpid INTEGER NOT NULL, + pr INTEGER NOT NULL, + match_op INTEGER NOT NULL, + match_exp VARCHAR(64) NOT NULL, + match_len INTEGER NOT NULL, + subst_exp VARCHAR(64) NOT NULL, + repl_exp VARCHAR(256) NOT NULL, + attrs VARCHAR(64) NOT NULL +); + +INSERT INTO version (table_name, table_version) values ('dialplan','2'); + diff --git a/s6/kamailio/sqlite/database/dispatcher-create.sql b/s6/kamailio/sqlite/database/dispatcher-create.sql @@ -0,0 +1,12 @@ +CREATE TABLE dispatcher ( + id INTEGER PRIMARY KEY NOT NULL, + setid INTEGER DEFAULT 0 NOT NULL, + destination VARCHAR(192) DEFAULT '' NOT NULL, + flags INTEGER DEFAULT 0 NOT NULL, + priority INTEGER DEFAULT 0 NOT NULL, + attrs VARCHAR(128) DEFAULT '' NOT NULL, + description VARCHAR(64) DEFAULT '' NOT NULL +); + +INSERT INTO version (table_name, table_version) values ('dispatcher','4'); + diff --git a/s6/kamailio/sqlite/database/domain-create.sql b/s6/kamailio/sqlite/database/domain-create.sql @@ -0,0 +1,23 @@ +CREATE TABLE domain ( + id INTEGER PRIMARY KEY NOT NULL, + domain VARCHAR(64) NOT NULL, + did VARCHAR(64) DEFAULT NULL, + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL, + CONSTRAINT domain_domain_idx UNIQUE (domain) +); + +INSERT INTO version (table_name, table_version) values ('domain','2'); + +CREATE TABLE domain_attrs ( + id INTEGER PRIMARY KEY NOT NULL, + did VARCHAR(64) NOT NULL, + name VARCHAR(32) NOT NULL, + type INTEGER NOT NULL, + value VARCHAR(255) NOT NULL, + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL +); + +CREATE INDEX domain_attrs_domain_attrs_idx ON domain_attrs (did, name); + +INSERT INTO version (table_name, table_version) values ('domain_attrs','1'); + diff --git a/s6/kamailio/sqlite/database/domainpolicy-create.sql b/s6/kamailio/sqlite/database/domainpolicy-create.sql @@ -0,0 +1,14 @@ +CREATE TABLE domainpolicy ( + id INTEGER PRIMARY KEY NOT NULL, + rule VARCHAR(255) NOT NULL, + type VARCHAR(255) NOT NULL, + att VARCHAR(255), + val VARCHAR(128), + description VARCHAR(255) NOT NULL, + CONSTRAINT domainpolicy_rav_idx UNIQUE (rule, att, val) +); + +CREATE INDEX domainpolicy_rule_idx ON domainpolicy (rule); + +INSERT INTO version (table_name, table_version) values ('domainpolicy','2'); + diff --git a/s6/kamailio/sqlite/database/drouting-create.sql b/s6/kamailio/sqlite/database/drouting-create.sql @@ -0,0 +1,43 @@ +CREATE TABLE dr_gateways ( + gwid INTEGER PRIMARY KEY NOT NULL, + type INTEGER DEFAULT 0 NOT NULL, + address VARCHAR(128) NOT NULL, + strip INTEGER DEFAULT 0 NOT NULL, + pri_prefix VARCHAR(64) DEFAULT NULL, + attrs VARCHAR(255) DEFAULT NULL, + description VARCHAR(128) DEFAULT '' NOT NULL +); + +INSERT INTO version (table_name, table_version) values ('dr_gateways','3'); + +CREATE TABLE dr_rules ( + ruleid INTEGER PRIMARY KEY NOT NULL, + groupid VARCHAR(255) NOT NULL, + prefix VARCHAR(64) NOT NULL, + timerec VARCHAR(255) NOT NULL, + priority INTEGER DEFAULT 0 NOT NULL, + routeid VARCHAR(64) NOT NULL, + gwlist VARCHAR(255) NOT NULL, + description VARCHAR(128) DEFAULT '' NOT NULL +); + +INSERT INTO version (table_name, table_version) values ('dr_rules','3'); + +CREATE TABLE dr_gw_lists ( + id INTEGER PRIMARY KEY NOT NULL, + gwlist VARCHAR(255) NOT NULL, + description VARCHAR(128) DEFAULT '' NOT NULL +); + +INSERT INTO version (table_name, table_version) values ('dr_gw_lists','1'); + +CREATE TABLE dr_groups ( + id INTEGER PRIMARY KEY NOT NULL, + username VARCHAR(64) NOT NULL, + domain VARCHAR(128) DEFAULT '' NOT NULL, + groupid INTEGER DEFAULT 0 NOT NULL, + description VARCHAR(128) DEFAULT '' NOT NULL +); + +INSERT INTO version (table_name, table_version) values ('dr_groups','2'); + diff --git a/s6/kamailio/sqlite/database/group-create.sql b/s6/kamailio/sqlite/database/group-create.sql @@ -0,0 +1,21 @@ +CREATE TABLE grp ( + id INTEGER PRIMARY KEY NOT NULL, + username VARCHAR(64) DEFAULT '' NOT NULL, + domain VARCHAR(64) DEFAULT '' NOT NULL, + grp VARCHAR(64) DEFAULT '' NOT NULL, + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL, + CONSTRAINT grp_account_group_idx UNIQUE (username, domain, grp) +); + +INSERT INTO version (table_name, table_version) values ('grp','2'); + +CREATE TABLE re_grp ( + id INTEGER PRIMARY KEY NOT NULL, + reg_exp VARCHAR(128) DEFAULT '' NOT NULL, + group_id INTEGER DEFAULT 0 NOT NULL +); + +CREATE INDEX re_grp_group_idx ON re_grp (group_id); + +INSERT INTO version (table_name, table_version) values ('re_grp','1'); + diff --git a/s6/kamailio/sqlite/database/htable-create.sql b/s6/kamailio/sqlite/database/htable-create.sql @@ -0,0 +1,11 @@ +CREATE TABLE htable ( + id INTEGER PRIMARY KEY NOT NULL, + key_name VARCHAR(64) DEFAULT '' NOT NULL, + key_type INTEGER DEFAULT 0 NOT NULL, + value_type INTEGER DEFAULT 0 NOT NULL, + key_value VARCHAR(128) DEFAULT '' NOT NULL, + expires INTEGER DEFAULT 0 NOT NULL +); + +INSERT INTO version (table_name, table_version) values ('htable','2'); + diff --git a/s6/kamailio/sqlite/database/imc-create.sql b/s6/kamailio/sqlite/database/imc-create.sql @@ -0,0 +1,21 @@ +CREATE TABLE imc_rooms ( + id INTEGER PRIMARY KEY NOT NULL, + name VARCHAR(64) NOT NULL, + domain VARCHAR(64) NOT NULL, + flag INTEGER NOT NULL, + CONSTRAINT imc_rooms_name_domain_idx UNIQUE (name, domain) +); + +INSERT INTO version (table_name, table_version) values ('imc_rooms','1'); + +CREATE TABLE imc_members ( + id INTEGER PRIMARY KEY NOT NULL, + username VARCHAR(64) NOT NULL, + domain VARCHAR(64) NOT NULL, + room VARCHAR(64) NOT NULL, + flag INTEGER NOT NULL, + CONSTRAINT imc_members_account_room_idx UNIQUE (username, domain, room) +); + +INSERT INTO version (table_name, table_version) values ('imc_members','1'); + diff --git a/s6/kamailio/sqlite/database/lcr-create.sql b/s6/kamailio/sqlite/database/lcr-create.sql @@ -0,0 +1,49 @@ +CREATE TABLE lcr_gw ( + id INTEGER PRIMARY KEY NOT NULL, + lcr_id SMALLINT NOT NULL, + gw_name VARCHAR(128), + ip_addr VARCHAR(50), + hostname VARCHAR(64), + port SMALLINT, + params VARCHAR(64), + uri_scheme SMALLINT, + transport SMALLINT, + strip SMALLINT, + prefix VARCHAR(16) DEFAULT NULL, + tag VARCHAR(64) DEFAULT NULL, + flags INTEGER DEFAULT 0 NOT NULL, + defunct INTEGER DEFAULT NULL +); + +CREATE INDEX lcr_gw_lcr_id_idx ON lcr_gw (lcr_id); + +INSERT INTO version (table_name, table_version) values ('lcr_gw','3'); + +CREATE TABLE lcr_rule_target ( + id INTEGER PRIMARY KEY NOT NULL, + lcr_id SMALLINT NOT NULL, + rule_id INTEGER NOT NULL, + gw_id INTEGER NOT NULL, + priority SMALLINT NOT NULL, + weight INTEGER DEFAULT 1 NOT NULL, + CONSTRAINT lcr_rule_target_rule_id_gw_id_idx UNIQUE (rule_id, gw_id) +); + +CREATE INDEX lcr_rule_target_lcr_id_idx ON lcr_rule_target (lcr_id); + +INSERT INTO version (table_name, table_version) values ('lcr_rule_target','1'); + +CREATE TABLE lcr_rule ( + id INTEGER PRIMARY KEY NOT NULL, + lcr_id SMALLINT NOT NULL, + prefix VARCHAR(16) DEFAULT NULL, + from_uri VARCHAR(64) DEFAULT NULL, + request_uri VARCHAR(64) DEFAULT NULL, + mt_tvalue VARCHAR(128) DEFAULT NULL, + stopper INTEGER DEFAULT 0 NOT NULL, + enabled INTEGER DEFAULT 1 NOT NULL, + CONSTRAINT lcr_rule_lcr_id_prefix_from_uri_idx UNIQUE (lcr_id, prefix, from_uri) +); + +INSERT INTO version (table_name, table_version) values ('lcr_rule','3'); + diff --git a/s6/kamailio/sqlite/database/matrix-create.sql b/s6/kamailio/sqlite/database/matrix-create.sql @@ -0,0 +1,10 @@ +CREATE TABLE matrix ( + first INTEGER NOT NULL, + second SMALLINT NOT NULL, + res INTEGER NOT NULL +); + +CREATE INDEX matrix_matrix_idx ON matrix (first, second); + +INSERT INTO version (table_name, table_version) values ('matrix','1'); + diff --git a/s6/kamailio/sqlite/database/mohqueue-create.sql b/s6/kamailio/sqlite/database/mohqueue-create.sql @@ -0,0 +1,26 @@ +CREATE TABLE mohqcalls ( + id INTEGER PRIMARY KEY NOT NULL, + mohq_id INTEGER NOT NULL, + call_id VARCHAR(100) NOT NULL, + call_status INTEGER NOT NULL, + call_from VARCHAR(100) NOT NULL, + call_contact VARCHAR(100), + call_time TIMESTAMP WITHOUT TIME ZONE NOT NULL, + CONSTRAINT mohqcalls_mohqcalls_idx UNIQUE (call_id) +); + +INSERT INTO version (table_name, table_version) values ('mohqcalls','1'); + +CREATE TABLE mohqueues ( + id INTEGER PRIMARY KEY NOT NULL, + name VARCHAR(25) NOT NULL, + uri VARCHAR(100) NOT NULL, + mohdir VARCHAR(100), + mohfile VARCHAR(100) NOT NULL, + debug INTEGER NOT NULL, + CONSTRAINT mohqueues_mohqueue_uri_idx UNIQUE (uri), + CONSTRAINT mohqueues_mohqueue_name_idx UNIQUE (name) +); + +INSERT INTO version (table_name, table_version) values ('mohqueues','1'); + diff --git a/s6/kamailio/sqlite/database/msilo-create.sql b/s6/kamailio/sqlite/database/msilo-create.sql @@ -0,0 +1,20 @@ +CREATE TABLE silo ( + id INTEGER PRIMARY KEY NOT NULL, + src_addr VARCHAR(128) DEFAULT '' NOT NULL, + dst_addr VARCHAR(128) DEFAULT '' NOT NULL, + username VARCHAR(64) DEFAULT '' NOT NULL, + domain VARCHAR(64) DEFAULT '' NOT NULL, + inc_time INTEGER DEFAULT 0 NOT NULL, + exp_time INTEGER DEFAULT 0 NOT NULL, + snd_time INTEGER DEFAULT 0 NOT NULL, + ctype VARCHAR(32) DEFAULT 'text/plain' NOT NULL, + body BLOB, + extra_hdrs TEXT, + callid VARCHAR(128) DEFAULT '' NOT NULL, + status INTEGER DEFAULT 0 NOT NULL +); + +CREATE INDEX silo_account_idx ON silo (username, domain); + +INSERT INTO version (table_name, table_version) values ('silo','8'); + diff --git a/s6/kamailio/sqlite/database/mtree-create.sql b/s6/kamailio/sqlite/database/mtree-create.sql @@ -0,0 +1,19 @@ +CREATE TABLE mtree ( + id INTEGER PRIMARY KEY NOT NULL, + tprefix VARCHAR(32) DEFAULT '' NOT NULL, + tvalue VARCHAR(128) DEFAULT '' NOT NULL, + CONSTRAINT mtree_tprefix_idx UNIQUE (tprefix) +); + +INSERT INTO version (table_name, table_version) values ('mtree','1'); + +CREATE TABLE mtrees ( + id INTEGER PRIMARY KEY NOT NULL, + tname VARCHAR(128) DEFAULT '' NOT NULL, + tprefix VARCHAR(32) DEFAULT '' NOT NULL, + tvalue VARCHAR(128) DEFAULT '' NOT NULL, + CONSTRAINT mtrees_tname_tprefix_tvalue_idx UNIQUE (tname, tprefix, tvalue) +); + +INSERT INTO version (table_name, table_version) values ('mtrees','2'); + diff --git a/s6/kamailio/sqlite/database/pdt-create.sql b/s6/kamailio/sqlite/database/pdt-create.sql @@ -0,0 +1,10 @@ +CREATE TABLE pdt ( + id INTEGER PRIMARY KEY NOT NULL, + sdomain VARCHAR(128) NOT NULL, + prefix VARCHAR(32) NOT NULL, + domain VARCHAR(128) DEFAULT '' NOT NULL, + CONSTRAINT pdt_sdomain_prefix_idx UNIQUE (sdomain, prefix) +); + +INSERT INTO version (table_name, table_version) values ('pdt','1'); + diff --git a/s6/kamailio/sqlite/database/permissions-create.sql b/s6/kamailio/sqlite/database/permissions-create.sql @@ -0,0 +1,25 @@ +CREATE TABLE trusted ( + id INTEGER PRIMARY KEY NOT NULL, + src_ip VARCHAR(50) NOT NULL, + proto VARCHAR(4) NOT NULL, + from_pattern VARCHAR(64) DEFAULT NULL, + ruri_pattern VARCHAR(64) DEFAULT NULL, + tag VARCHAR(64), + priority INTEGER DEFAULT 0 NOT NULL +); + +CREATE INDEX trusted_peer_idx ON trusted (src_ip); + +INSERT INTO version (table_name, table_version) values ('trusted','6'); + +CREATE TABLE address ( + id INTEGER PRIMARY KEY NOT NULL, + grp INTEGER DEFAULT 1 NOT NULL, + ip_addr VARCHAR(50) NOT NULL, + mask INTEGER DEFAULT 32 NOT NULL, + port SMALLINT DEFAULT 0 NOT NULL, + tag VARCHAR(64) +); + +INSERT INTO version (table_name, table_version) values ('address','6'); + diff --git a/s6/kamailio/sqlite/database/pipelimit-create.sql b/s6/kamailio/sqlite/database/pipelimit-create.sql @@ -0,0 +1,9 @@ +CREATE TABLE pl_pipes ( + id INTEGER PRIMARY KEY NOT NULL, + pipeid VARCHAR(64) DEFAULT '' NOT NULL, + algorithm VARCHAR(32) DEFAULT '' NOT NULL, + plimit INTEGER DEFAULT 0 NOT NULL +); + +INSERT INTO version (table_name, table_version) values ('pl_pipes','1'); + diff --git a/s6/kamailio/sqlite/database/presence-create.sql b/s6/kamailio/sqlite/database/presence-create.sql @@ -0,0 +1,122 @@ +CREATE TABLE presentity ( + id INTEGER PRIMARY KEY NOT NULL, + username VARCHAR(64) NOT NULL, + domain VARCHAR(64) NOT NULL, + event VARCHAR(64) NOT NULL, + etag VARCHAR(128) NOT NULL, + expires INTEGER NOT NULL, + received_time INTEGER NOT NULL, + body BLOB NOT NULL, + sender VARCHAR(128) NOT NULL, + priority INTEGER DEFAULT 0 NOT NULL, + ruid VARCHAR(64), + CONSTRAINT presentity_presentity_idx UNIQUE (username, domain, event, etag), + CONSTRAINT presentity_ruid_idx UNIQUE (ruid) +); + +CREATE INDEX presentity_presentity_expires ON presentity (expires); +CREATE INDEX presentity_account_idx ON presentity (username, domain, event); + +INSERT INTO version (table_name, table_version) values ('presentity','5'); + +CREATE TABLE active_watchers ( + id INTEGER PRIMARY KEY NOT NULL, + presentity_uri VARCHAR(128) NOT NULL, + watcher_username VARCHAR(64) NOT NULL, + watcher_domain VARCHAR(64) NOT NULL, + to_user VARCHAR(64) NOT NULL, + to_domain VARCHAR(64) NOT NULL, + event VARCHAR(64) DEFAULT 'presence' NOT NULL, + event_id VARCHAR(64), + to_tag VARCHAR(64) NOT NULL, + from_tag VARCHAR(64) NOT NULL, + callid VARCHAR(255) NOT NULL, + local_cseq INTEGER NOT NULL, + remote_cseq INTEGER NOT NULL, + contact VARCHAR(128) NOT NULL, + record_route TEXT, + expires INTEGER NOT NULL, + status INTEGER DEFAULT 2 NOT NULL, + reason VARCHAR(64), + version INTEGER DEFAULT 0 NOT NULL, + socket_info VARCHAR(64) NOT NULL, + local_contact VARCHAR(128) NOT NULL, + from_user VARCHAR(64) NOT NULL, + from_domain VARCHAR(64) NOT NULL, + updated INTEGER NOT NULL, + updated_winfo INTEGER NOT NULL, + flags INTEGER DEFAULT 0 NOT NULL, + user_agent VARCHAR(255) DEFAULT '', + CONSTRAINT active_watchers_active_watchers_idx UNIQUE (callid, to_tag, from_tag) +); + +CREATE INDEX active_watchers_active_watchers_expires ON active_watchers (expires); +CREATE INDEX active_watchers_active_watchers_pres ON active_watchers (presentity_uri, event); +CREATE INDEX active_watchers_updated_idx ON active_watchers (updated); +CREATE INDEX active_watchers_updated_winfo_idx ON active_watchers (updated_winfo, presentity_uri); + +INSERT INTO version (table_name, table_version) values ('active_watchers','12'); + +CREATE TABLE watchers ( + id INTEGER PRIMARY KEY NOT NULL, + presentity_uri VARCHAR(128) NOT NULL, + watcher_username VARCHAR(64) NOT NULL, + watcher_domain VARCHAR(64) NOT NULL, + event VARCHAR(64) DEFAULT 'presence' NOT NULL, + status INTEGER NOT NULL, + reason VARCHAR(64), + inserted_time INTEGER NOT NULL, + CONSTRAINT watchers_watcher_idx UNIQUE (presentity_uri, watcher_username, watcher_domain, event) +); + +INSERT INTO version (table_name, table_version) values ('watchers','3'); + +CREATE TABLE xcap ( + id INTEGER PRIMARY KEY NOT NULL, + username VARCHAR(64) NOT NULL, + domain VARCHAR(64) NOT NULL, + doc BLOB NOT NULL, + doc_type INTEGER NOT NULL, + etag VARCHAR(128) NOT NULL, + source INTEGER NOT NULL, + doc_uri VARCHAR(255) NOT NULL, + port INTEGER NOT NULL, + CONSTRAINT xcap_doc_uri_idx UNIQUE (doc_uri) +); + +CREATE INDEX xcap_account_doc_type_idx ON xcap (username, domain, doc_type); +CREATE INDEX xcap_account_doc_type_uri_idx ON xcap (username, domain, doc_type, doc_uri); +CREATE INDEX xcap_account_doc_uri_idx ON xcap (username, domain, doc_uri); + +INSERT INTO version (table_name, table_version) values ('xcap','4'); + +CREATE TABLE pua ( + id INTEGER PRIMARY KEY NOT NULL, + pres_uri VARCHAR(128) NOT NULL, + pres_id VARCHAR(255) NOT NULL, + event INTEGER NOT NULL, + expires INTEGER NOT NULL, + desired_expires INTEGER NOT NULL, + flag INTEGER NOT NULL, + etag VARCHAR(128) NOT NULL, + tuple_id VARCHAR(64), + watcher_uri VARCHAR(128) NOT NULL, + call_id VARCHAR(255) NOT NULL, + to_tag VARCHAR(64) NOT NULL, + from_tag VARCHAR(64) NOT NULL, + cseq INTEGER NOT NULL, + record_route TEXT, + contact VARCHAR(128) NOT NULL, + remote_contact VARCHAR(128) NOT NULL, + version INTEGER NOT NULL, + extra_headers TEXT NOT NULL, + CONSTRAINT pua_pua_idx UNIQUE (etag, tuple_id, call_id, from_tag) +); + +CREATE INDEX pua_expires_idx ON pua (expires); +CREATE INDEX pua_dialog1_idx ON pua (pres_id, pres_uri); +CREATE INDEX pua_dialog2_idx ON pua (call_id, from_tag); +CREATE INDEX pua_record_idx ON pua (pres_id); + +INSERT INTO version (table_name, table_version) values ('pua','7'); + diff --git a/s6/kamailio/sqlite/database/purple-create.sql b/s6/kamailio/sqlite/database/purple-create.sql @@ -0,0 +1,10 @@ +CREATE TABLE purplemap ( + id INTEGER PRIMARY KEY NOT NULL, + sip_user VARCHAR(128) NOT NULL, + ext_user VARCHAR(128) NOT NULL, + ext_prot VARCHAR(16) NOT NULL, + ext_pass VARCHAR(64) +); + +INSERT INTO version (table_name, table_version) values ('purplemap','1'); + diff --git a/s6/kamailio/sqlite/database/registrar-create.sql b/s6/kamailio/sqlite/database/registrar-create.sql @@ -0,0 +1,32 @@ +CREATE TABLE aliases ( + id INTEGER PRIMARY KEY NOT NULL, + ruid VARCHAR(64) DEFAULT '' NOT NULL, + username VARCHAR(64) DEFAULT '' NOT NULL, + domain VARCHAR(64) DEFAULT NULL, + contact VARCHAR(255) DEFAULT '' NOT NULL, + received VARCHAR(128) DEFAULT NULL, + path VARCHAR(512) DEFAULT NULL, + expires TIMESTAMP WITHOUT TIME ZONE DEFAULT '2030-05-28 21:32:15' NOT NULL, + q REAL DEFAULT 1.0 NOT NULL, + callid VARCHAR(255) DEFAULT 'Default-Call-ID' NOT NULL, + cseq INTEGER DEFAULT 1 NOT NULL, + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL, + flags INTEGER DEFAULT 0 NOT NULL, + cflags INTEGER DEFAULT 0 NOT NULL, + user_agent VARCHAR(255) DEFAULT '' NOT NULL, + socket VARCHAR(64) DEFAULT NULL, + methods INTEGER DEFAULT NULL, + instance VARCHAR(255) DEFAULT NULL, + reg_id INTEGER DEFAULT 0 NOT NULL, + server_id INTEGER DEFAULT 0 NOT NULL, + connection_id INTEGER DEFAULT 0 NOT NULL, + keepalive INTEGER DEFAULT 0 NOT NULL, + partition INTEGER DEFAULT 0 NOT NULL, + CONSTRAINT aliases_ruid_idx UNIQUE (ruid) +); + +CREATE INDEX aliases_account_contact_idx ON aliases (username, domain, contact); +CREATE INDEX aliases_expires_idx ON aliases (expires); + +INSERT INTO version (table_name, table_version) values ('aliases','8'); + diff --git a/s6/kamailio/sqlite/database/rls-create.sql b/s6/kamailio/sqlite/database/rls-create.sql @@ -0,0 +1,53 @@ +CREATE TABLE rls_presentity ( + id INTEGER PRIMARY KEY NOT NULL, + rlsubs_did VARCHAR(255) NOT NULL, + resource_uri VARCHAR(128) NOT NULL, + content_type VARCHAR(255) NOT NULL, + presence_state BLOB NOT NULL, + expires INTEGER NOT NULL, + updated INTEGER NOT NULL, + auth_state INTEGER NOT NULL, + reason VARCHAR(64) NOT NULL, + CONSTRAINT rls_presentity_rls_presentity_idx UNIQUE (rlsubs_did, resource_uri) +); + +CREATE INDEX rls_presentity_rlsubs_idx ON rls_presentity (rlsubs_did); +CREATE INDEX rls_presentity_updated_idx ON rls_presentity (updated); +CREATE INDEX rls_presentity_expires_idx ON rls_presentity (expires); + +INSERT INTO version (table_name, table_version) values ('rls_presentity','1'); + +CREATE TABLE rls_watchers ( + id INTEGER PRIMARY KEY NOT NULL, + presentity_uri VARCHAR(128) NOT NULL, + to_user VARCHAR(64) NOT NULL, + to_domain VARCHAR(64) NOT NULL, + watcher_username VARCHAR(64) NOT NULL, + watcher_domain VARCHAR(64) NOT NULL, + event VARCHAR(64) DEFAULT 'presence' NOT NULL, + event_id VARCHAR(64), + to_tag VARCHAR(64) NOT NULL, + from_tag VARCHAR(64) NOT NULL, + callid VARCHAR(255) NOT NULL, + local_cseq INTEGER NOT NULL, + remote_cseq INTEGER NOT NULL, + contact VARCHAR(128) NOT NULL, + record_route TEXT, + expires INTEGER NOT NULL, + status INTEGER DEFAULT 2 NOT NULL, + reason VARCHAR(64) NOT NULL, + version INTEGER DEFAULT 0 NOT NULL, + socket_info VARCHAR(64) NOT NULL, + local_contact VARCHAR(128) NOT NULL, + from_user VARCHAR(64) NOT NULL, + from_domain VARCHAR(64) NOT NULL, + updated INTEGER NOT NULL, + CONSTRAINT rls_watchers_rls_watcher_idx UNIQUE (callid, to_tag, from_tag) +); + +CREATE INDEX rls_watchers_rls_watchers_update ON rls_watchers (watcher_username, watcher_domain, event); +CREATE INDEX rls_watchers_rls_watchers_expires ON rls_watchers (expires); +CREATE INDEX rls_watchers_updated_idx ON rls_watchers (updated); + +INSERT INTO version (table_name, table_version) values ('rls_watchers','3'); + diff --git a/s6/kamailio/sqlite/database/rtpengine-create.sql b/s6/kamailio/sqlite/database/rtpengine-create.sql @@ -0,0 +1,12 @@ +CREATE TABLE rtpengine ( + id INTEGER PRIMARY KEY NOT NULL, + setid INTEGER DEFAULT 0 NOT NULL, + url VARCHAR(64) NOT NULL, + weight INTEGER DEFAULT 1 NOT NULL, + disabled INTEGER DEFAULT 0 NOT NULL, + stamp TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL, + CONSTRAINT rtpengine_rtpengine_nodes UNIQUE (setid, url) +); + +INSERT INTO version (table_name, table_version) values ('rtpengine','1'); + diff --git a/s6/kamailio/sqlite/database/rtpproxy-create.sql b/s6/kamailio/sqlite/database/rtpproxy-create.sql @@ -0,0 +1,11 @@ +CREATE TABLE rtpproxy ( + id INTEGER PRIMARY KEY NOT NULL, + setid VARCHAR(32) DEFAULT 00 NOT NULL, + url VARCHAR(64) DEFAULT '' NOT NULL, + flags INTEGER DEFAULT 0 NOT NULL, + weight INTEGER DEFAULT 1 NOT NULL, + description VARCHAR(64) DEFAULT '' NOT NULL +); + +INSERT INTO version (table_name, table_version) values ('rtpproxy','1'); + diff --git a/s6/kamailio/sqlite/database/sca-create.sql b/s6/kamailio/sqlite/database/sca-create.sql @@ -0,0 +1,23 @@ +CREATE TABLE sca_subscriptions ( + id INTEGER PRIMARY KEY NOT NULL, + subscriber VARCHAR(255) NOT NULL, + aor VARCHAR(255) NOT NULL, + event INTEGER DEFAULT 0 NOT NULL, + expires INTEGER DEFAULT 0 NOT NULL, + state INTEGER DEFAULT 0 NOT NULL, + app_idx INTEGER DEFAULT 0 NOT NULL, + call_id VARCHAR(255) NOT NULL, + from_tag VARCHAR(64) NOT NULL, + to_tag VARCHAR(64) NOT NULL, + record_route TEXT, + notify_cseq INTEGER NOT NULL, + subscribe_cseq INTEGER NOT NULL, + server_id INTEGER DEFAULT 0 NOT NULL, + CONSTRAINT sca_subscriptions_sca_subscriptions_idx UNIQUE (subscriber, call_id, from_tag, to_tag) +); + +CREATE INDEX sca_subscriptions_sca_expires_idx ON sca_subscriptions (server_id, expires); +CREATE INDEX sca_subscriptions_sca_subscribers_idx ON sca_subscriptions (subscriber, event); + +INSERT INTO version (table_name, table_version) values ('sca_subscriptions','2'); + diff --git a/s6/kamailio/sqlite/database/siptrace-create.sql b/s6/kamailio/sqlite/database/siptrace-create.sql @@ -0,0 +1,23 @@ +CREATE TABLE sip_trace ( + id INTEGER PRIMARY KEY NOT NULL, + time_stamp TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL, + time_us INTEGER DEFAULT 0 NOT NULL, + callid VARCHAR(255) DEFAULT '' NOT NULL, + traced_user VARCHAR(128) DEFAULT '' NOT NULL, + msg TEXT NOT NULL, + method VARCHAR(50) DEFAULT '' NOT NULL, + status VARCHAR(128) DEFAULT '' NOT NULL, + fromip VARCHAR(50) DEFAULT '' NOT NULL, + toip VARCHAR(50) DEFAULT '' NOT NULL, + fromtag VARCHAR(64) DEFAULT '' NOT NULL, + totag VARCHAR(64) DEFAULT '' NOT NULL, + direction VARCHAR(4) DEFAULT '' NOT NULL +); + +CREATE INDEX sip_trace_traced_user_idx ON sip_trace (traced_user); +CREATE INDEX sip_trace_date_idx ON sip_trace (time_stamp); +CREATE INDEX sip_trace_fromip_idx ON sip_trace (fromip); +CREATE INDEX sip_trace_callid_idx ON sip_trace (callid); + +INSERT INTO version (table_name, table_version) values ('sip_trace','4'); + diff --git a/s6/kamailio/sqlite/database/speeddial-create.sql b/s6/kamailio/sqlite/database/speeddial-create.sql @@ -0,0 +1,15 @@ +CREATE TABLE speed_dial ( + id INTEGER PRIMARY KEY NOT NULL, + username VARCHAR(64) DEFAULT '' NOT NULL, + domain VARCHAR(64) DEFAULT '' NOT NULL, + sd_username VARCHAR(64) DEFAULT '' NOT NULL, + sd_domain VARCHAR(64) DEFAULT '' NOT NULL, + new_uri VARCHAR(128) DEFAULT '' NOT NULL, + fname VARCHAR(64) DEFAULT '' NOT NULL, + lname VARCHAR(64) DEFAULT '' NOT NULL, + description VARCHAR(64) DEFAULT '' NOT NULL, + CONSTRAINT speed_dial_speed_dial_idx UNIQUE (username, domain, sd_domain, sd_username) +); + +INSERT INTO version (table_name, table_version) values ('speed_dial','2'); + diff --git a/s6/kamailio/sqlite/database/standard-create.sql b/s6/kamailio/sqlite/database/standard-create.sql @@ -0,0 +1,8 @@ +CREATE TABLE version ( + table_name VARCHAR(32) NOT NULL, + table_version INTEGER DEFAULT 0 NOT NULL, + CONSTRAINT version_table_name_idx UNIQUE (table_name) +); + +INSERT INTO version (table_name, table_version) values ('version','1'); + diff --git a/s6/kamailio/sqlite/database/topos-create.sql b/s6/kamailio/sqlite/database/topos-create.sql @@ -0,0 +1,69 @@ +CREATE TABLE topos_d ( + id INTEGER PRIMARY KEY NOT NULL, + rectime TIMESTAMP WITHOUT TIME ZONE NOT NULL, + s_method VARCHAR(64) DEFAULT '' NOT NULL, + s_cseq VARCHAR(64) DEFAULT '' NOT NULL, + a_callid VARCHAR(255) DEFAULT '' NOT NULL, + a_uuid VARCHAR(255) DEFAULT '' NOT NULL, + b_uuid VARCHAR(255) DEFAULT '' NOT NULL, + a_contact VARCHAR(128) DEFAULT '' NOT NULL, + b_contact VARCHAR(128) DEFAULT '' NOT NULL, + as_contact VARCHAR(128) DEFAULT '' NOT NULL, + bs_contact VARCHAR(128) DEFAULT '' NOT NULL, + a_tag VARCHAR(255) DEFAULT '' NOT NULL, + b_tag VARCHAR(255) DEFAULT '' NOT NULL, + a_rr TEXT, + b_rr TEXT, + s_rr TEXT, + iflags INTEGER DEFAULT 0 NOT NULL, + a_uri VARCHAR(128) DEFAULT '' NOT NULL, + b_uri VARCHAR(128) DEFAULT '' NOT NULL, + r_uri VARCHAR(128) DEFAULT '' NOT NULL, + a_srcaddr VARCHAR(128) DEFAULT '' NOT NULL, + b_srcaddr VARCHAR(128) DEFAULT '' NOT NULL, + a_socket VARCHAR(128) DEFAULT '' NOT NULL, + b_socket VARCHAR(128) DEFAULT '' NOT NULL +); + +CREATE INDEX topos_d_rectime_idx ON topos_d (rectime); +CREATE INDEX topos_d_a_callid_idx ON topos_d (a_callid); +CREATE INDEX topos_d_a_uuid_idx ON topos_d (a_uuid); +CREATE INDEX topos_d_b_uuid_idx ON topos_d (b_uuid); + +INSERT INTO version (table_name, table_version) values ('topos_d','1'); + +CREATE TABLE topos_t ( + id INTEGER PRIMARY KEY NOT NULL, + rectime TIMESTAMP WITHOUT TIME ZONE NOT NULL, + s_method VARCHAR(64) DEFAULT '' NOT NULL, + s_cseq VARCHAR(64) DEFAULT '' NOT NULL, + a_callid VARCHAR(255) DEFAULT '' NOT NULL, + a_uuid VARCHAR(255) DEFAULT '' NOT NULL, + b_uuid VARCHAR(255) DEFAULT '' NOT NULL, + direction INTEGER DEFAULT 0 NOT NULL, + x_via TEXT, + x_vbranch VARCHAR(255) DEFAULT '' NOT NULL, + x_rr TEXT, + y_rr TEXT, + s_rr TEXT, + x_uri VARCHAR(128) DEFAULT '' NOT NULL, + a_contact VARCHAR(128) DEFAULT '' NOT NULL, + b_contact VARCHAR(128) DEFAULT '' NOT NULL, + as_contact VARCHAR(128) DEFAULT '' NOT NULL, + bs_contact VARCHAR(128) DEFAULT '' NOT NULL, + x_tag VARCHAR(255) DEFAULT '' NOT NULL, + a_tag VARCHAR(255) DEFAULT '' NOT NULL, + b_tag VARCHAR(255) DEFAULT '' NOT NULL, + a_srcaddr VARCHAR(128) DEFAULT '' NOT NULL, + b_srcaddr VARCHAR(128) DEFAULT '' NOT NULL, + a_socket VARCHAR(128) DEFAULT '' NOT NULL, + b_socket VARCHAR(128) DEFAULT '' NOT NULL +); + +CREATE INDEX topos_t_rectime_idx ON topos_t (rectime); +CREATE INDEX topos_t_a_callid_idx ON topos_t (a_callid); +CREATE INDEX topos_t_x_vbranch_idx ON topos_t (x_vbranch); +CREATE INDEX topos_t_a_uuid_idx ON topos_t (a_uuid); + +INSERT INTO version (table_name, table_version) values ('topos_t','1'); + diff --git a/s6/kamailio/sqlite/database/uac-create.sql b/s6/kamailio/sqlite/database/uac-create.sql @@ -0,0 +1,20 @@ +CREATE TABLE uacreg ( + id INTEGER PRIMARY KEY NOT NULL, + l_uuid VARCHAR(64) DEFAULT '' NOT NULL, + l_username VARCHAR(64) DEFAULT '' NOT NULL, + l_domain VARCHAR(64) DEFAULT '' NOT NULL, + r_username VARCHAR(64) DEFAULT '' NOT NULL, + r_domain VARCHAR(64) DEFAULT '' NOT NULL, + realm VARCHAR(64) DEFAULT '' NOT NULL, + auth_username VARCHAR(64) DEFAULT '' NOT NULL, + auth_password VARCHAR(64) DEFAULT '' NOT NULL, + auth_ha1 VARCHAR(128) DEFAULT '' NOT NULL, + auth_proxy VARCHAR(128) DEFAULT '' NOT NULL, + expires INTEGER DEFAULT 0 NOT NULL, + flags INTEGER DEFAULT 0 NOT NULL, + reg_delay INTEGER DEFAULT 0 NOT NULL, + CONSTRAINT uacreg_l_uuid_idx UNIQUE (l_uuid) +); + +INSERT INTO version (table_name, table_version) values ('uacreg','3'); + diff --git a/s6/kamailio/sqlite/database/uid_auth_db-create.sql b/s6/kamailio/sqlite/database/uid_auth_db-create.sql @@ -0,0 +1,19 @@ +CREATE TABLE uid_credentials ( + id INTEGER PRIMARY KEY NOT NULL, + auth_username VARCHAR(64) NOT NULL, + did VARCHAR(64) DEFAULT '_default' NOT NULL, + realm VARCHAR(64) NOT NULL, + password VARCHAR(28) DEFAULT '' NOT NULL, + flags INTEGER DEFAULT 0 NOT NULL, + ha1 VARCHAR(32) NOT NULL, + ha1b VARCHAR(32) DEFAULT '' NOT NULL, + uid VARCHAR(64) NOT NULL +); + +CREATE INDEX uid_credentials_cred_idx ON uid_credentials (auth_username, did); +CREATE INDEX uid_credentials_uid ON uid_credentials (uid); +CREATE INDEX uid_credentials_did_idx ON uid_credentials (did); +CREATE INDEX uid_credentials_realm_idx ON uid_credentials (realm); + +INSERT INTO version (table_name, table_version) values ('uid_credentials','7'); + diff --git a/s6/kamailio/sqlite/database/uid_avp_db-create.sql b/s6/kamailio/sqlite/database/uid_avp_db-create.sql @@ -0,0 +1,12 @@ +CREATE TABLE uid_user_attrs ( + id INTEGER PRIMARY KEY NOT NULL, + uid VARCHAR(64) NOT NULL, + name VARCHAR(32) NOT NULL, + value VARCHAR(128), + type INTEGER DEFAULT 0 NOT NULL, + flags INTEGER DEFAULT 0 NOT NULL, + CONSTRAINT uid_user_attrs_userattrs_idx UNIQUE (uid, name, value) +); + +INSERT INTO version (table_name, table_version) values ('uid_user_attrs','3'); + diff --git a/s6/kamailio/sqlite/database/uid_domain-create.sql b/s6/kamailio/sqlite/database/uid_domain-create.sql @@ -0,0 +1,26 @@ +CREATE TABLE uid_domain ( + id INTEGER PRIMARY KEY NOT NULL, + did VARCHAR(64) NOT NULL, + domain VARCHAR(64) NOT NULL, + flags INTEGER DEFAULT 0 NOT NULL, + CONSTRAINT uid_domain_domain_idx UNIQUE (domain) +); + +CREATE INDEX uid_domain_did_idx ON uid_domain (did); + +INSERT INTO version (table_name, table_version) values ('uid_domain','2'); + +CREATE TABLE uid_domain_attrs ( + id INTEGER PRIMARY KEY NOT NULL, + did VARCHAR(64), + name VARCHAR(32) NOT NULL, + type INTEGER DEFAULT 0 NOT NULL, + value VARCHAR(128), + flags INTEGER DEFAULT 0 NOT NULL, + CONSTRAINT uid_domain_attrs_domain_attr_idx UNIQUE (did, name, value) +); + +CREATE INDEX uid_domain_attrs_domain_did ON uid_domain_attrs (did, flags); + +INSERT INTO version (table_name, table_version) values ('uid_domain_attrs','1'); + diff --git a/s6/kamailio/sqlite/database/uid_gflags-create.sql b/s6/kamailio/sqlite/database/uid_gflags-create.sql @@ -0,0 +1,11 @@ +CREATE TABLE uid_global_attrs ( + id INTEGER PRIMARY KEY NOT NULL, + name VARCHAR(32) NOT NULL, + type INTEGER DEFAULT 0 NOT NULL, + value VARCHAR(128), + flags INTEGER DEFAULT 0 NOT NULL, + CONSTRAINT uid_global_attrs_global_attrs_idx UNIQUE (name, value) +); + +INSERT INTO version (table_name, table_version) values ('uid_global_attrs','1'); + diff --git a/s6/kamailio/sqlite/database/uid_uri_db-create.sql b/s6/kamailio/sqlite/database/uid_uri_db-create.sql @@ -0,0 +1,28 @@ +CREATE TABLE uid_uri ( + id INTEGER PRIMARY KEY NOT NULL, + uid VARCHAR(64) NOT NULL, + did VARCHAR(64) NOT NULL, + username VARCHAR(64) NOT NULL, + flags INTEGER DEFAULT 0 NOT NULL, + scheme VARCHAR(8) DEFAULT 'sip' NOT NULL +); + +CREATE INDEX uid_uri_uri_idx1 ON uid_uri (username, did, scheme); +CREATE INDEX uid_uri_uri_uid ON uid_uri (uid); + +INSERT INTO version (table_name, table_version) values ('uid_uri','3'); + +CREATE TABLE uid_uri_attrs ( + id INTEGER PRIMARY KEY NOT NULL, + username VARCHAR(64) NOT NULL, + did VARCHAR(64) NOT NULL, + name VARCHAR(32) NOT NULL, + value VARCHAR(128), + type INTEGER DEFAULT 0 NOT NULL, + flags INTEGER DEFAULT 0 NOT NULL, + scheme VARCHAR(8) DEFAULT 'sip' NOT NULL, + CONSTRAINT uid_uri_attrs_uriattrs_idx UNIQUE (username, did, name, value, scheme) +); + +INSERT INTO version (table_name, table_version) values ('uid_uri_attrs','2'); + diff --git a/s6/kamailio/sqlite/database/uri_db-create.sql b/s6/kamailio/sqlite/database/uri_db-create.sql @@ -0,0 +1,11 @@ +CREATE TABLE uri ( + id INTEGER PRIMARY KEY NOT NULL, + username VARCHAR(64) DEFAULT '' NOT NULL, + domain VARCHAR(64) DEFAULT '' NOT NULL, + uri_user VARCHAR(64) DEFAULT '' NOT NULL, + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL, + CONSTRAINT uri_account_idx UNIQUE (username, domain, uri_user) +); + +INSERT INTO version (table_name, table_version) values ('uri','1'); + diff --git a/s6/kamailio/sqlite/database/userblacklist-create.sql b/s6/kamailio/sqlite/database/userblacklist-create.sql @@ -0,0 +1,23 @@ +CREATE TABLE userblacklist ( + id INTEGER PRIMARY KEY NOT NULL, + username VARCHAR(64) DEFAULT '' NOT NULL, + domain VARCHAR(64) DEFAULT '' NOT NULL, + prefix VARCHAR(64) DEFAULT '' NOT NULL, + whitelist SMALLINT DEFAULT 0 NOT NULL +); + +CREATE INDEX userblacklist_userblacklist_idx ON userblacklist (username, domain, prefix); + +INSERT INTO version (table_name, table_version) values ('userblacklist','1'); + +CREATE TABLE globalblacklist ( + id INTEGER PRIMARY KEY NOT NULL, + prefix VARCHAR(64) DEFAULT '' NOT NULL, + whitelist SMALLINT DEFAULT 0 NOT NULL, + description VARCHAR(255) DEFAULT NULL +); + +CREATE INDEX globalblacklist_globalblacklist_idx ON globalblacklist (prefix); + +INSERT INTO version (table_name, table_version) values ('globalblacklist','1'); + diff --git a/s6/kamailio/sqlite/database/usrloc-create.sql b/s6/kamailio/sqlite/database/usrloc-create.sql @@ -0,0 +1,49 @@ +CREATE TABLE location ( + id INTEGER PRIMARY KEY NOT NULL, + ruid VARCHAR(64) DEFAULT '' NOT NULL, + username VARCHAR(64) DEFAULT '' NOT NULL, + domain VARCHAR(64) DEFAULT NULL, + contact VARCHAR(512) DEFAULT '' NOT NULL, + received VARCHAR(128) DEFAULT NULL, + path VARCHAR(512) DEFAULT NULL, + expires TIMESTAMP WITHOUT TIME ZONE DEFAULT '2030-05-28 21:32:15' NOT NULL, + q REAL DEFAULT 1.0 NOT NULL, + callid VARCHAR(255) DEFAULT 'Default-Call-ID' NOT NULL, + cseq INTEGER DEFAULT 1 NOT NULL, + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL, + flags INTEGER DEFAULT 0 NOT NULL, + cflags INTEGER DEFAULT 0 NOT NULL, + user_agent VARCHAR(255) DEFAULT '' NOT NULL, + socket VARCHAR(64) DEFAULT NULL, + methods INTEGER DEFAULT NULL, + instance VARCHAR(255) DEFAULT NULL, + reg_id INTEGER DEFAULT 0 NOT NULL, + server_id INTEGER DEFAULT 0 NOT NULL, + connection_id INTEGER DEFAULT 0 NOT NULL, + keepalive INTEGER DEFAULT 0 NOT NULL, + partition INTEGER DEFAULT 0 NOT NULL, + CONSTRAINT location_ruid_idx UNIQUE (ruid) +); + +CREATE INDEX location_account_contact_idx ON location (username, domain, contact); +CREATE INDEX location_expires_idx ON location (expires); +CREATE INDEX location_connection_idx ON location (server_id, connection_id); + +INSERT INTO version (table_name, table_version) values ('location','9'); + +CREATE TABLE location_attrs ( + id INTEGER PRIMARY KEY NOT NULL, + ruid VARCHAR(64) DEFAULT '' NOT NULL, + username VARCHAR(64) DEFAULT '' NOT NULL, + domain VARCHAR(64) DEFAULT NULL, + aname VARCHAR(64) DEFAULT '' NOT NULL, + atype INTEGER DEFAULT 0 NOT NULL, + avalue VARCHAR(512) DEFAULT '' NOT NULL, + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL +); + +CREATE INDEX location_attrs_account_record_idx ON location_attrs (username, domain, ruid); +CREATE INDEX location_attrs_last_modified_idx ON location_attrs (last_modified); + +INSERT INTO version (table_name, table_version) values ('location_attrs','1'); + diff --git a/s6/kamailio/sqlite/setup-database b/s6/kamailio/sqlite/setup-database @@ -0,0 +1,11 @@ +#!/usr/bin/env execlineb + +if -tn { test -f /var/kamailio/sqlite.db } + +forx -o 0 x { + standard acc lcr domain group permissions registrar usrloc msilo + alias_db uri_db speeddial avpops auth_db pdt dialog dispatcher + dialplan +} +importas module x +sqlite3 -init database/${module}-create.sql /var/kamailio/sqlite.db diff --git a/s6/kamailio/x/conf/module/acc b/s6/kamailio/x/conf/module/acc @@ -0,0 +1 @@ +tm diff --git a/s6/kamailio/x/conf/module/acc.so b/s6/kamailio/x/conf/module/acc.so @@ -1 +0,0 @@ -tm.so diff --git a/s6/kamailio/mysql/conf/module/db_mysql.so b/s6/kamailio/x/conf/module/alias_db diff --git a/s6/kamailio/sqlite/conf/module/db_sqlite.so b/s6/kamailio/x/conf/module/auth diff --git a/s6/kamailio/x/conf/module/alias_db.so b/s6/kamailio/x/conf/module/auth_db diff --git a/s6/kamailio/x/conf/module/auth.so b/s6/kamailio/x/conf/module/cfg_rpc diff --git a/s6/kamailio/x/conf/module/auth_db.so b/s6/kamailio/x/conf/module/corex diff --git a/s6/kamailio/x/conf/module/cfg_rpc.so b/s6/kamailio/x/conf/module/counters diff --git a/s6/kamailio/x/conf/module/corex.so b/s6/kamailio/x/conf/module/ctl diff --git a/s6/kamailio/x/conf/module/counters.so b/s6/kamailio/x/conf/module/debugger diff --git a/s6/kamailio/x/conf/module/ctl.so b/s6/kamailio/x/conf/module/domain diff --git a/s6/kamailio/x/conf/module/debugger.so b/s6/kamailio/x/conf/module/htable diff --git a/s6/kamailio/x/conf/module/domain.so b/s6/kamailio/x/conf/module/jsonrpcs diff --git a/s6/kamailio/x/conf/module/htable.so b/s6/kamailio/x/conf/module/kex diff --git a/s6/kamailio/x/conf/module/jsonrpcs.so b/s6/kamailio/x/conf/module/maxfwd diff --git a/s6/kamailio/x/conf/module/kex.so b/s6/kamailio/x/conf/module/nathelper diff --git a/s6/kamailio/x/conf/module/maxfwd.so b/s6/kamailio/x/conf/module/permissions diff --git a/s6/kamailio/x/conf/module/nathelper.so b/s6/kamailio/x/conf/module/pike diff --git a/s6/kamailio/x/conf/module/permissions.so b/s6/kamailio/x/conf/module/pv diff --git a/s6/kamailio/x/conf/module/pike.so b/s6/kamailio/x/conf/module/registrar diff --git a/s6/kamailio/x/conf/module/pv.so b/s6/kamailio/x/conf/module/rr diff --git a/s6/kamailio/x/conf/module/registrar.so b/s6/kamailio/x/conf/module/rtpproxy diff --git a/s6/kamailio/x/conf/module/rr.so b/s6/kamailio/x/conf/module/sanity diff --git a/s6/kamailio/x/conf/module/rtpproxy.so b/s6/kamailio/x/conf/module/siputils diff --git a/s6/kamailio/x/conf/module/sanity.so b/s6/kamailio/x/conf/module/sl diff --git a/s6/kamailio/x/conf/module/siputils.so b/s6/kamailio/x/conf/module/speeddial diff --git a/s6/kamailio/x/conf/module/sl.so b/s6/kamailio/x/conf/module/textops diff --git a/s6/kamailio/x/conf/module/speeddial.so b/s6/kamailio/x/conf/module/tm diff --git a/s6/kamailio/x/conf/module/tm.so b/s6/kamailio/x/conf/module/tm.so diff --git a/s6/kamailio/x/conf/module/tmx b/s6/kamailio/x/conf/module/tmx @@ -0,0 +1 @@ +tm diff --git a/s6/kamailio/x/conf/module/tmx.so b/s6/kamailio/x/conf/module/tmx.so @@ -1 +0,0 @@ -tm.so diff --git a/s6/kamailio/x/conf/module/usrloc b/s6/kamailio/x/conf/module/usrloc @@ -0,0 +1 @@ +db_sqlite diff --git a/s6/kamailio/x/conf/module/usrloc.so b/s6/kamailio/x/conf/module/usrloc.so @@ -1 +0,0 @@ -db_sqlite.so diff --git a/s6/kamailio/x/conf/module/textops.so b/s6/kamailio/x/conf/module/xlog diff --git a/s6/kamailio/x/conf/module/xlog.so b/s6/kamailio/x/conf/module/xlog.so diff --git a/s6/kamailio/x/env/USER b/s6/kamailio/x/env/USER @@ -0,0 +1 @@ +kamailio diff --git a/s6/kamailio/x/run b/s6/kamailio/x/run @@ -5,6 +5,8 @@ s6-envdir env multisubstitute { importas BIND BIND importas MODULES_DIR MODULES_DIR + importas USER USER } +#s6-setuidgid ${USER} kamailio -ED -f data/conf -l ${BIND} -L ${MODULES_DIR} diff --git a/s6/kamailio/x/setup b/s6/kamailio/x/setup @@ -1,7 +1,9 @@ #!/usr/bin/env execlineb +if { mkdir -p data /var/kamailio /etc/kamailio } +if { ./setup-database } if { chown -R kamailio /var/kamailio } -if { mkdir -p data /var/kamailio } + redirfd -w 1 data/conf cd conf @@ -41,7 +43,7 @@ if { # resolve module dependency pipeline { elglob -0 x * ../../setup-dep ${x} } - awk "! exist[$0]++ { print \"loadmodule \\\"\"$0\"\\\"\"; }" + awk "! exist[$0]++ { print \"loadmodule \\\"\"$0\".so\\\"\"; }" } if { diff --git a/s6/kamailio/xmlrpc/conf/modparam/xmlrpc/route b/s6/kamailio/xmlrpc/conf/modparam/xmlrpc/route @@ -1 +0,0 @@ -"XMLRPC" diff --git a/s6/kamailio/xmlrpc/conf/modparam/xmlrpc/url_match b/s6/kamailio/xmlrpc/conf/modparam/xmlrpc/url_match @@ -1 +0,0 @@ -"^/RPC" diff --git a/s6/kamailio/xmlrpc/conf/route/route/XMLRPC b/s6/kamailio/xmlrpc/conf/route/route/XMLRPC @@ -1,15 +0,0 @@ -# XMLRPC routing - -# allow XMLRPC from localhost -if ((method=="POST" || method=="GET") - && (src_ip==127.0.0.1)) { - # close connection only for xmlrpclib user agents (there is a bug in - # xmlrpclib: it waits for EOF before interpreting the response). - if ($hdr(User-Agent) =~ "xmlrpclib") - set_reply_close(); - set_reply_no_connect(); - dispatch_rpc(); - exit; -} -send_reply("403", "Forbidden"); -exit; diff --git a/s6/ngircd/x/env/USER b/s6/ngircd/x/env/USER @@ -0,0 +1 @@ +nobody diff --git a/s6/ngircd/x/run b/s6/ngircd/x/run @@ -1,5 +1,4 @@ #!/usr/bin/env execlineb fdmove -c 2 1 - ngircd -n -f data/conf diff --git a/s6/opentracker/x/env/USER b/s6/opentracker/x/env/USER @@ -0,0 +1 @@ +opentracker diff --git a/s6/opentracker/x/run b/s6/opentracker/x/run @@ -1,5 +1,4 @@ #!/usr/bin/env execlineb fdmove -c 2 1 - opentracker -d /var/opentracker diff --git a/s6/pjsua/x/env/USER b/s6/pjsua/x/env/USER @@ -0,0 +1 @@ +sip diff --git a/s6/pjsua/x/run b/s6/pjsua/x/run @@ -1,5 +1,4 @@ #!/usr/bin/env execlineb fdmove -c 2 1 - pjsua --config-file data/conf diff --git a/s6/qemu/x/env/USER b/s6/qemu/x/env/USER @@ -0,0 +1 @@ +vm diff --git a/s6/qmail-send/x/env/USER b/s6/qmail-send/x/env/USER @@ -1 +0,0 @@ -sqmail diff --git a/s6/qmail-smtpd/x/env/USER b/s6/qmail-smtpd/x/env/USER @@ -1 +0,0 @@ -qmaild diff --git a/s6/mpop/x/env/USER b/s6/ratox/josuah/env/USER diff --git a/s6/ratox/x/run b/s6/ratox/x/run @@ -1,8 +1,14 @@ #!/usr/bin/env execlineb fdmove -c 2 1 +multisubstitute { + importas USER USER +} -backtick home { homeof $USER } if { mkdir -p $home/tox } cd $home/tox +s6-setuidgid ${USER} + +backtick home { homeof ${USER} } +if { mkdir -p $home/tox } +cd $home/tox -s6-setuidgid $USER ratox diff --git a/s6/sndiod/x/env/USER b/s6/sndiod/x/env/USER @@ -0,0 +1 @@ +audio diff --git a/s6/ssh-agent/x/env/USER b/s6/ssh-agent/x/env/USER diff --git a/s6/tapio/x/env/USER b/s6/tapio/x/env/USER @@ -0,0 +1 @@ +vpn diff --git a/s6/tinc/x/env/USER b/s6/tinc/x/env/USER @@ -0,0 +1 @@ +vpn diff --git a/s6/tinc/x/run b/s6/tinc/x/run @@ -1,5 +1,4 @@ #!/usr/bin/env execlineb fdmove -c 2 1 - tincd -D -d 5 --config=data --pidfile=pid diff --git a/s6/tinydns/x/run b/s6/tinydns/x/run @@ -6,5 +6,5 @@ multisubstitute { importas USER USER } -s6-envuidgid $USER +s6-envuidgid ${USER} tinydns diff --git a/s6/tor/x/env/USER b/s6/tor/x/env/USER diff --git a/s6/transmission/x/env/USER b/s6/transmission/x/env/USER @@ -0,0 +1 @@ +transmission diff --git a/s6/transmission/x/run b/s6/transmission/x/run @@ -1,5 +1,8 @@ #!/usr/bin/env execlineb fdmove -c 2 1 +multisubstitute { + importas USER USER +} - +s6-envuidgid ${USER} transmission-daemon -f -g /var/transmission diff --git a/s6/u9fs-mount/x/env/USER b/s6/u9fs-mount/x/env/USER @@ -0,0 +1 @@ +9p diff --git a/s6/u9fs-ssh/x/env/USER b/s6/u9fs-ssh/x/env/USER @@ -0,0 +1 @@ +9p diff --git a/s6/u9fs-ssh/x/run b/s6/u9fs-ssh/x/run @@ -1,7 +1,6 @@ #!/usr/bin/env execlineb fdmove -c 2 1 - unixserver -v /tmp/9p ssh u9fs@host u9fs -l /dev/stderr -a none -u u9fs /home/u9fs diff --git a/s6/user-check/type b/s6/user-check/type @@ -1 +0,0 @@ -longrun diff --git a/s6/venti/x/env/USER b/s6/venti/x/env/USER @@ -0,0 +1 @@ +fs diff --git a/s6/venti/x/run b/s6/venti/x/run @@ -10,6 +10,6 @@ multisubstitute { s6-setuidgid venti venti -s - -c $ROOT + -c ${ROOT} -a tcp!*!$PORT_A -h tcp!*!$PORT_H diff --git a/s6/vsftpd/x/env/USER b/s6/vsftpd/x/env/USER @@ -0,0 +1 @@ +ftp diff --git a/s6/vsftpd/x/run b/s6/vsftpd/x/run @@ -1,5 +1,4 @@ #!/usr/bin/env execlineb fdmove -c 2 1 - vsftpd data/conf diff --git a/s6/vtund/x/env/USER b/s6/vtund/x/env/USER @@ -0,0 +1 @@ +vpn diff --git a/s6/walldns/x/env/USER b/s6/walldns/x/env/USER @@ -0,0 +1 @@ +dns diff --git a/s6/warp-vpn/x/env/USER b/s6/warp-vpn/x/env/USER @@ -0,0 +1 @@ +vpn