├── README.md ├── alpine_asterisk_rpi ├── Dockerfile └── Makefile ├── alpine_kamailio_dbtext_rpi ├── Dockerfile ├── Makefile ├── boot_run.sh ├── build │ └── modules.lst └── conf │ ├── default │ ├── kamailio │ └── kamailio.init │ └── etc │ ├── certs │ ├── kamailio-selfsigned.key │ └── kamailio-selfsigned.pem │ ├── dictionary.kamailio │ ├── kamailio.cfg │ ├── kamctlrc │ ├── subscriber │ └── tls.cfg ├── alpine_kamailio_sqlite_rpi ├── Dockerfile ├── Makefile ├── boot_run.sh ├── build │ └── modules.lst └── conf │ ├── default │ ├── kamailio │ └── kamailio.init │ └── etc │ ├── certs │ ├── kamailio-selfsigned.key │ └── kamailio-selfsigned.pem │ ├── dictionary.kamailio │ ├── kamailio.cfg │ ├── kamctlrc │ ├── subscriber │ └── tls.cfg ├── alpine_nginx_snom_provisioning_rpi ├── Dockerfile ├── Makefile └── etc │ ├── certs.crt │ ├── local.conf │ └── nginx.conf ├── asterisk_13.10.0 ├── Dockerfile └── conf │ └── config.sh ├── asterisk_14.0.0 ├── Dockerfile ├── build.sh └── config.sh ├── asterisk_rpi_hypriot ├── Dockerfile └── conf │ └── config.sh ├── kamailio_4.4.4_rpi ├── Dockerfile ├── Makefile ├── boot_run.sh ├── build │ └── modules.lst ├── conf │ ├── default │ │ ├── kamailio │ │ └── kamailio.init │ └── etc │ │ ├── certs │ │ ├── .placeholder │ │ ├── ca.pem │ │ └── req.pem │ │ ├── dictionary.kamailio │ │ ├── kamailio.cfg │ │ ├── kamctlrc │ │ ├── modules.lst │ │ └── tls.cfg └── create_database.sh ├── kamailio_4.4 ├── Dockerfile ├── Makefile ├── boot_run.sh ├── conf │ ├── ca.pem │ ├── dictionary.kamailio │ ├── kamailio.cfg │ ├── kamctlrc │ ├── modules.lst │ ├── req.pem │ └── tls.cfg ├── create_database.sh └── default │ ├── kamailio │ ├── kamailio.init │ └── kamailio~ ├── kamailio_4.4_dbtext_rpi ├── Dockerfile ├── Makefile ├── boot_run.sh ├── build │ └── modules.lst └── conf │ ├── default │ ├── kamailio │ └── kamailio.init │ └── etc │ ├── certs │ ├── .placeholder │ ├── ca.pem │ ├── kamailio-selfsigned.key │ ├── kamailio-selfsigned.pem │ └── req.pem │ ├── dictionary.kamailio │ ├── kamailio.cfg │ ├── kamctlrc │ ├── subscriber │ └── tls.cfg ├── opensips_2.2 ├── Dockerfile ├── Makefile ├── boot_run.sh └── conf │ ├── opensips.cfg │ └── opensipsctlrc ├── snom-flic-io-rpi ├── Dockerfile ├── boot.sh ├── build.sh └── phone.py └── snom_enviro_phat_rpi ├── Dockerfile ├── boot.sh ├── build.sh └── snom_xmlserver.py /README.md: -------------------------------------------------------------------------------- 1 | Docker Images for VoIP Stuff 2 | -------------------------------------------------------------------------------- /alpine_asterisk_rpi/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM armhf/alpine 2 | 3 | RUN apk --update add --no-cache asterisk asterisk-curl asterisk-speex asterisk-sample-config asterisk-srtp curl joe 4 | 5 | RUN rm -rf /var/cache/apk/* /tmp/* /var/tmp/* 6 | 7 | RUN asterisk && sleep 5 8 | 9 | #COPY etc/nginx.conf /etc/nginx/nginx.conf 10 | 11 | #COPY etc/local.conf /etc/nginx/conf.d/local.conf 12 | 13 | EXPOSE 5060/udp 5061 14 | 15 | ENTRYPOINT ["/usr/sbin/asterisk", "-vvvdddf", "-T", "-W", "-U", "root","-p"] 16 | 17 | -------------------------------------------------------------------------------- /alpine_asterisk_rpi/Makefile: -------------------------------------------------------------------------------- 1 | NAME = voipnovatos/alpine-asterisk-rpi 2 | VERSION = latest 3 | 4 | .PHONY: all build run 5 | 6 | all: build 7 | 8 | build: 9 | 10 | docker build -t $(NAME):$(VERSION) . 11 | 12 | run: 13 | 14 | docker run -dt -p 5080:5060/udp -p 5081:5061 --name=asterisk -h "asterisk.local" voipnovatos/alpine-asterisk-rpi 15 | 16 | 17 | -------------------------------------------------------------------------------- /alpine_kamailio_dbtext_rpi/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM armhf/alpine 2 | 3 | MAINTAINER Alberto Sagredo 4 | 5 | ENV build_date 2016-11-13 6 | 7 | ENV DEBIAN_FRONTEND noninteractive 8 | 9 | ENV SIP_PORT 5060 10 | 11 | ENV TLS_PORT 5061 12 | 13 | RUN apk add --no-cache kamailio kamailio-presence kamailio-dbtext kamailio-tls bash joe python kamailio-debugger kamailio-dbg kamailio-xml libssl1.0 14 | 15 | ADD conf/etc/* /etc/kamailio/ 16 | 17 | ADD boot_run.sh /etc/ 18 | 19 | WORKDIR /etc/kamailio/ 20 | 21 | RUN mkdir /etc/kamailio/certs 22 | 23 | ADD conf/etc/certs/* /etc/kamailio/certs/ 24 | 25 | # Patch to use kamctl to add sip extensiones 26 | 27 | COPY conf/etc/subscriber /usr/share/kamailio/dbtext/kamailio/subscriber 28 | 29 | RUN chmod a+x /usr/share/kamailio/dbtext/kamailio/subscriber 30 | 31 | EXPOSE $SIP_PORT $SIP_PORT/udp $TLS_PORT 32 | 33 | RUN chmod a+x /etc/boot_run.sh 34 | 35 | ENTRYPOINT ["/etc/boot_run.sh"] 36 | -------------------------------------------------------------------------------- /alpine_kamailio_dbtext_rpi/Makefile: -------------------------------------------------------------------------------- 1 | NAME = voipnovatos/alpine-kamailio-dbtext-rpi 2 | VERSION = latest 3 | 4 | .PHONY: all build run 5 | 6 | all: build 7 | 8 | build: 9 | 10 | @docker build -t $(NAME):$(VERSION) . 11 | 12 | run: 13 | @docker run -dt -p 5060:5060 -p 5060:5060/udp -p 5061:5061 -e ADVERTISED_IP="10.0.200.94" --name=kamailio -h "kamailio.local" voipnovatos/alpine-kamailio-dbtext-rpi 14 | 15 | 16 | -------------------------------------------------------------------------------- /alpine_kamailio_dbtext_rpi/boot_run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MYSQL_PWD=${MYSQL_PWD:-"passwd"} 4 | 5 | ADVERTISED_IP=${ADVERTISED_IP:-"127.0.0.1"} 6 | 7 | HOST_IP=$(ip route get 8.8.8.8 | awk '{print $NF; exit}') 8 | 9 | SIP_PORT=5060 10 | 11 | TLS_PORT=5061 12 | 13 | echo "Your IP : ${HOST_IP}" 14 | 15 | echo -e "Your Advertised IP : ${ADVERTISED_IP}\n\n" 16 | 17 | echo -e "Your Kamailio SIP Port : ${SIP_PORT}\n\n" 18 | 19 | # Configure kamailio.cfg 20 | 21 | sed -i "s/alias=.*/alias=\"${ADVERTISED_IP}\"/g" /etc/kamailio/kamailio.cfg 22 | 23 | sed -i "s/listen=udp.*/listen=udp:${HOST_IP}:5060 advertise ${ADVERTISED_IP}:5060/g" /etc/kamailio/kamailio.cfg 24 | 25 | sed -i "s/listen=tcp.*/listen=tcp:${HOST_IP}:5060 advertise ${ADVERTISED_IP}:5060/g" /etc/kamailio/kamailio.cfg 26 | 27 | sed -i "s/listen=tls.*/listen=tls:${HOST_IP}:5061 advertise ${ADVERTISED_IP}:5061/g" /etc/kamailio/kamailio.cfg 28 | 29 | #sed -i "s/port=.*/port=${SIP_PORT}/g" /usr/local/etc/kamailio/kamailio.cfg 30 | 31 | sed -i "s/SIP_DOMAIN=.*/SIP_DOMAIN=${ADVERTISED_IP}/g" /etc/kamailio/kamctlrc 32 | 33 | #mkdir /var/spool/rtpengine 34 | 35 | #rtpengine -p /var/run/rtpengine.pid --interface=127.0.0.1!$ADVERTISED_IP -n 127.0.0.1:60000 -c 127.0.0.1:60001 -m 20000 -M 30000 -E -L 7 36 | 37 | # Auto Create Database 38 | 39 | kamdbctl create 40 | 41 | kamctl add 100 snom 42 | 43 | kamctl add 101 snom 44 | 45 | kamctl add 102 snom 46 | 47 | kamctl add 103 snom 48 | 49 | kamctl add 104 snom 50 | 51 | kamctl add 105 snom 52 | 53 | kamctl add 106 snom 54 | 55 | kamctl add 107 snom 56 | 57 | kamctl add 108 snom 58 | 59 | kamctl add 109 snom 60 | 61 | kamctl add 110 snom 62 | 63 | kamctl add 200 snom 64 | 65 | kamctl add 201 snom 66 | 67 | kamctl add 202 snom 68 | 69 | # Starting Kamailio process 70 | 71 | /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg 72 | 73 | /bin/bash -------------------------------------------------------------------------------- /alpine_kamailio_dbtext_rpi/build/modules.lst: -------------------------------------------------------------------------------- 1 | # this file is autogenerated by make modules-cfg 2 | 3 | # the list of sub-directories with modules 4 | modules_dirs:=modules 5 | 6 | # the list of module groups to compile 7 | cfg_group_include= 8 | 9 | # the list of extra modules to compile 10 | include_modules= stun outbound path uuid ctl xhttp kex tm tmx sl rr maxfwd siputils presence presence_conference presence_dialoginfo presence_mwi presence_profile presence_reginfo presence_xml websocket tls pua_dialoginfo snmpstats ctl cfg_rpc kex tm tmx sl rr maxfwd siputils sanity textops htable pv xlog mi_fifo uac uac_redirect db_text kazoo dispatcher rtimer timer sqlops 11 | 12 | # the list of static modules 13 | static_modules= 14 | 15 | # the list of modules to skip from compile list 16 | skip_modules= alias_db path corex mi_rpc async auth_diameter avpops avp benchmark blst call_control cfg_db counters db2_ops db_cluster db_flatstore debugger diversion dmq domainpolicy domain drouting enum exec group imc ipops malloc_test mangler matrix mediaproxy mi_datagram mqueue msilo msrp mtree nat_traversal pdb pdt pipelimit prefix_route print_lib print p_usrloc qos ratelimit rtpproxy sca sdpops seas sipcapture siptrace sms speeddial sst statistics tmrec topoh uid_auth_db uid_avp_db uid_domain uid_gflags uid_uri_db uri_db userblacklist xhttp_rpc xprint 17 | 18 | # the list of modules to exclude from compile list 19 | exclude_modules= acc_radius app_java app_lua app_mono app_perl app_python auth_ephemeral auth_identity auth_radius cdp cdp_avp cnxcc cpl-c crypto db2_ldap db_berkeley db_cassandra db_mongodb db_mysql db_oracle db_perlvdb db_postgres db_sqlite db_unixodbc dialplan dnssec evapi geoip geoip2 gzcompress h350 http_async_client http_client ims_auth ims_charging ims_dialog ims_icscf ims_isc ims_qos ims_registrar_pcscf ims_registrar_scscf ims_usrloc_pcscf ims_usrloc_scscf iptrtpproxy jansson janssonrpc-c json jsonrpc-c lcr ldap log_systemd memcached mi_xmlrpc misc_radius ndb_cassandra ndb_mongodb ndb_redis osp outbound peering pua pua_bla pua_dialoginfo pua_mi pua_reginfo pua_usrloc pua_xmpp purple regex rls sctp snmpstats tls utils uuid websocket xcap_client xcap_server xhttp_pi xmlops xmlrpc xmpp $(skip_modules) 20 | 21 | #enabled carrierroute erlang cfg_rpc 22 | 23 | modules_all= $(filter-out modules/CVS,$(wildcard modules/*)) 24 | modules_noinc= $(filter-out $(addprefix modules/, $(exclude_modules) $(static_modules)), $(modules_all)) 25 | modules= $(filter-out $(modules_noinc), $(addprefix modules/, $(include_modules) )) $(modules_noinc) 26 | modules_configured:=1 27 | -------------------------------------------------------------------------------- /alpine_kamailio_dbtext_rpi/conf/default/kamailio: -------------------------------------------------------------------------------- 1 | # 2 | # Kamailio startup options 3 | # 4 | 5 | # Set to yes to enable kamailio, once configured properly. 6 | RUN_KAMAILIO=yes 7 | 8 | # User to run as 9 | #USER=kamailio 10 | 11 | # Group to run as 12 | #GROUP=kamailio 13 | 14 | # Amount of shared and private memory to allocate 15 | # for the running Kamailio server (in Mb) 16 | #SHM_MEMORY=64 17 | #PKG_MEMORY=8 18 | 19 | # Config file 20 | #CFGFILE=/etc/kamailio/kamailio.cfg 21 | 22 | # Enable the server to leave a core file when it crashes. 23 | # Set this to 'yes' to enable Kamailio to leave a core file when it crashes 24 | # or 'no' to disable this feature. This option is case sensitive and only 25 | # accepts 'yes' and 'no' and only in lowercase letters. 26 | # On some systems it is necessary to specify a directory for the core files 27 | # to get a dump. Look into the kamailio init file for an example configuration. 28 | #DUMP_CORE=yes 29 | -------------------------------------------------------------------------------- /alpine_kamailio_dbtext_rpi/conf/default/kamailio.init: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | ### BEGIN INIT INFO 4 | # Provides: kamailio 5 | # Required-Start: $syslog $network $local_fs $remote_fs $time 6 | # Should-Start: $named slapd mysql postgresql snmpd radiusd 7 | # Should-Stop: $named slapd mysql postgresql snmpd radiusd 8 | # Required-Stop: $syslog $network $local_fs $remote_fs 9 | # Default-Start: 2 3 4 5 10 | # Default-Stop: 0 1 6 11 | # Short-Description: Start the Kamailio SIP proxy server 12 | # Description: Start the Kamailio SIP proxy server 13 | ### END INIT INFO 14 | 15 | . /lib/lsb/init-functions 16 | 17 | PATH=/sbin:/bin:/usr/sbin:/usr/bin 18 | DAEMON=/usr/local/sbin/kamailio 19 | CFGFILE=/usr/local/etc/kamailio/kamailio.cfg 20 | NAME=`basename "$0"` 21 | DESC="Kamailio SIP Server" 22 | HOMEDIR=/var/run/$NAME 23 | PIDFILE=$HOMEDIR/$NAME.pid 24 | DEFAULTS=/etc/default/$NAME 25 | RUN_KAMAILIO=no 26 | USER=kamailio 27 | GROUP=kamailio 28 | # Amount of shared and private memory to allocate 29 | # for the running Kamailio server (in Mb) 30 | SHM_MEMORY=64 31 | PKG_MEMORY=8 32 | DUMP_CORE=no 33 | 34 | # Do not start kamailio if fork=no is set in the config file 35 | # otherwise the boot process will just stop 36 | check_fork () 37 | { 38 | if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" $CFGFILE; then 39 | log_failure_msg "Not starting $DESC: fork=no specified in config file; run /etc/init.d/kamailio debug instead" 40 | exit 0 41 | fi 42 | } 43 | 44 | check_kamailio_config () 45 | { 46 | # Check if kamailio configuration is valid before starting the server 47 | set +e 48 | out=$($DAEMON -f $CFGFILE -M $PKG_MEMORY -c 2>&1 > /dev/null) 49 | retcode=$? 50 | set -e 51 | if [ "$retcode" != '0' ]; then 52 | log_failure_msg "Not starting $DESC: invalid configuration file!" 53 | log_failure_msg 54 | log_failure_msg "$out" 55 | log_failure_msg 56 | exit 1 57 | fi 58 | } 59 | 60 | create_radius_seqfile () 61 | { 62 | # Create a radius sequence file to be used by the radius client if 63 | # radius accounting is enabled. This is needed to avoid any issue 64 | # with the file not being writable if kamailio first starts as user 65 | # root because DUMP_CORE is enabled and creates this file as user 66 | # root and then later it switches back to user kamailio and cannot 67 | # write to the file. If the file exists before kamailio starts, it 68 | # won't change it's ownership and will be writable for both root 69 | # and kamailio, no matter what options are chosen at install time 70 | RADIUS_SEQ_FILE="$HOMEDIR/kamailio_radius.seq" 71 | if [ -d $HOMEDIR ]; then 72 | chown ${USER}:${GROUP} $HOMEDIR 73 | 74 | if [ ! -f $RADIUS_SEQ_FILE ]; then 75 | touch $RADIUS_SEQ_FILE 76 | fi 77 | 78 | chown ${USER}:${GROUP} $RADIUS_SEQ_FILE 79 | chmod 660 $RADIUS_SEQ_FILE 80 | fi 81 | } 82 | 83 | test -f $DAEMON || exit 0 84 | 85 | # Load startup options if available 86 | if [ -f $DEFAULTS ]; then 87 | . $DEFAULTS || true 88 | fi 89 | 90 | if [ "$RUN_KAMAILIO" != "yes" ]; then 91 | log_failure_msg "Kamailio not yet configured. Edit /etc/default/$NAME first." 92 | exit 0 93 | fi 94 | 95 | set -e 96 | 97 | SHM_MEMORY=$((`echo $SHM_MEMORY | sed -e 's/[^0-9]//g'`)) 98 | PKG_MEMORY=$((`echo $PKG_MEMORY | sed -e 's/[^0-9]//g'`)) 99 | [ -z "$USER" ] && USER=kamailio 100 | [ -z "$GROUP" ] && GROUP=kamailio 101 | [ $SHM_MEMORY -le 0 ] && SHM_MEMORY=64 102 | [ $PKG_MEMORY -le 0 ] && PKG_MEMORY=4 103 | 104 | if test "$DUMP_CORE" = "yes" ; then 105 | # set proper ulimit 106 | ulimit -c unlimited 107 | 108 | # directory for the core dump files 109 | # COREDIR=/home/corefiles 110 | # [ -d $COREDIR ] || mkdir $COREDIR 111 | # chmod 777 $COREDIR 112 | # echo "$COREDIR/core.%e.sig%s.%p" > /proc/sys/kernel/core_pattern 113 | fi 114 | 115 | # /var/run can be a tmpfs 116 | if [ ! -d $HOMEDIR ]; then 117 | mkdir -p $HOMEDIR 118 | chown ${USER}:${GROUP} $HOMEDIR 119 | fi 120 | 121 | OPTIONS="-f $CFGFILE -P $PIDFILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP" 122 | 123 | case "$1" in 124 | start|debug) 125 | check_kamailio_config 126 | create_radius_seqfile 127 | 128 | if [ "$1" != "debug" ]; then 129 | check_fork 130 | fi 131 | 132 | log_daemon_msg "Starting $DESC: $NAME" 133 | start-stop-daemon --start --quiet --pidfile $PIDFILE \ 134 | --exec $DAEMON -- $OPTIONS || log_failure_msg " already running" 135 | log_end_msg 0 136 | ;; 137 | stop) 138 | log_daemon_msg "Stopping $DESC: $NAME" 139 | start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \ 140 | --exec $DAEMON 141 | log_end_msg 0 142 | ;; 143 | restart|force-reload) 144 | check_kamailio_config 145 | create_radius_seqfile 146 | 147 | $0 stop 148 | sleep 1 149 | $0 start 150 | ;; 151 | status) 152 | log_daemon_msg "Status of $DESC: " 153 | 154 | status_of_proc -p"$PIDFILE" $NAME $NAME 155 | ;; 156 | *) 157 | N=/etc/init.d/$NAME 158 | echo "Usage: $N {start|stop|restart|force-reload|status|debug}" >&2 159 | exit 1 160 | ;; 161 | esac 162 | 163 | exit 0 164 | -------------------------------------------------------------------------------- /alpine_kamailio_dbtext_rpi/conf/etc/certs/kamailio-selfsigned.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBANlHQ9WEqEpHwTs8 3 | OFj8tIp+z9Q9YRJflIbdhw5tEK8Vj9OPoqfvM8mXxFyd9FS79RzTJk0u7UWpazsw 4 | 5tdiqp9zy4uIcqyCqaQIeR+VyUq9pscTROHUeQSYDA23anXo75jVRPCwRvT2MpDu 5 | n5uDQEuWnz+u+aUhXGBCGOoZH9gvAgMBAAECgYAO+2oDBBWyoYYCdqGQCUTNs/bS 6 | tLTH1o1gS1Avv3eCCyOSu/nESKsygGOK211oplk9dpXShqTXw9ngB/wy59vJ6Eo/ 7 | KDHJZDOdymZEYqvbpHJychkv6zzENLy69orTM2vB3BVGGqSP1m7B6PzmHKRysTKO 8 | X75kChS0ty4rVwm6sQJBAP9nSn/Z1y1WEyaXbzBYpZOSZ7YPaQWUiTu74dUGVkMO 9 | JIUFq1og3cRmwiUPTBm7G6HFKsQ/1Z2hnEbmAIdXx3kCQQDZyS2w6A2WTZ5AMzhb 10 | 6LmKfgfAtOBIewgbSG1poD5Wks8EyD09hmyt4cS319pmX3COpEnsjUvVfU/pllwa 11 | eSrnAkEAh9o9enw5RNhAH4r1jdXZXQHHQMQ5rMoxpSBvI4zXXZusOUWmu643yDyQ 12 | kH3ukNFCBW6HLRR3X/2SzvOQ3G0IoQJBALi3u7tKdwu+tbS6PNknoQdoMecvAvQ2 13 | 9f8+BR8LvRPs3Q2vUNH4TAGHdjSALkuaM3uouNKcXW+sI7V5xJDnqI0CQDtCI3A+ 14 | V09BXhd9GHLg9AiajFDCtbCX9gyjYL9eVei6J4nkwJk8CcBXpwr8FA7t1oYlG8ii 15 | EF4qtGd/6LFAmM8= 16 | -----END PRIVATE KEY----- 17 | -------------------------------------------------------------------------------- /alpine_kamailio_dbtext_rpi/conf/etc/certs/kamailio-selfsigned.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICmzCCAgQCCQCPEDnYk9mhaTANBgkqhkiG9w0BAQUFADCBkTEtMCsGA1UEChMk 3 | U2VsZi1zaWduZWQgY2VydGlmaWNhdGUgZm9yIGthbWFpbGlvMQ8wDQYDVQQLEwZt 4 | YWNwcGMxITAfBgNVBAMTGG1hY3BwYy5wb3J0cy5vcGVuYnNkLm9yZzEsMCoGCSqG 5 | SIb3DQEJARYdcm9vdEBtYWNwcGMucG9ydHMub3BlbmJzZC5vcmcwHhcNMTIwODEw 6 | MTE1MDE2WhcNMTMwODEwMTE1MDE2WjCBkTEtMCsGA1UEChMkU2VsZi1zaWduZWQg 7 | Y2VydGlmaWNhdGUgZm9yIGthbWFpbGlvMQ8wDQYDVQQLEwZtYWNwcGMxITAfBgNV 8 | BAMTGG1hY3BwYy5wb3J0cy5vcGVuYnNkLm9yZzEsMCoGCSqGSIb3DQEJARYdcm9v 9 | dEBtYWNwcGMucG9ydHMub3BlbmJzZC5vcmcwgZ8wDQYJKoZIhvcNAQEBBQADgY0A 10 | MIGJAoGBANlHQ9WEqEpHwTs8OFj8tIp+z9Q9YRJflIbdhw5tEK8Vj9OPoqfvM8mX 11 | xFyd9FS79RzTJk0u7UWpazsw5tdiqp9zy4uIcqyCqaQIeR+VyUq9pscTROHUeQSY 12 | DA23anXo75jVRPCwRvT2MpDun5uDQEuWnz+u+aUhXGBCGOoZH9gvAgMBAAEwDQYJ 13 | KoZIhvcNAQEFBQADgYEAwKOB5sDunJ0KnuBZ/Y2twy0htT0ST/hPFif37BDAZdb0 14 | e0mzeLOe8cJ9F51o8prbbLUiqkaey44LSrfE45AQOVEEuFVxpaFjO3Z/vXsXzk9t 15 | UcrATorqpAMf0eih0EMaaRox+K3gUauAPtnYNphGK3G4X3yvt4TmgqOJ6S+t72I= 16 | -----END CERTIFICATE----- 17 | -------------------------------------------------------------------------------- /alpine_kamailio_dbtext_rpi/conf/etc/dictionary.kamailio: -------------------------------------------------------------------------------- 1 | # 2 | # $Id$ 3 | # 4 | # SIP RADIUS attributes 5 | # 6 | # Proprietary indicates an attribute that hasn't 7 | # been standardized 8 | # 9 | # 10 | # NOTE: All standard (IANA registered) attributes are 11 | # defined in the default dictionary of the 12 | # radiusclient-ng library. 13 | # 14 | 15 | 16 | #### Attributes ### 17 | ATTRIBUTE Sip-Uri-User 208 string # Proprietary, auth_radius 18 | ATTRIBUTE Sip-Group 211 string # Proprietary, group_radius 19 | ATTRIBUTE Sip-Rpid 213 string # Proprietary, auth_radius 20 | ATTRIBUTE SIP-AVP 225 string # Proprietary, avp_radius 21 | 22 | ### Acct-Status-Type Values ### 23 | #VALUE Acct-Status-Type Failed 15 # RFC2866, acc 24 | 25 | ### Service-Type Values ### 26 | #VALUE Service-Type Call-Check 10 # RFC2865, uri_radius 27 | VALUE Service-Type Group-Check 12 # Proprietary, group_radius 28 | ##VALUE Service-Type Sip-Session 15 # Schulzrinne, acc, auth_radius 29 | VALUE Service-Type SIP-Caller-AVPs 30 # Proprietary, avp_radius 30 | VALUE Service-Type SIP-Callee-AVPs 31 # Proprietary, avp_radius 31 | 32 | ### Sip-Method Values ### 33 | VALUE Sip-Method Undefined 0 34 | VALUE Sip-Method Invite 1 35 | VALUE Sip-Method Cancel 2 36 | VALUE Sip-Method Ack 4 37 | VALUE Sip-Method Bye 8 38 | VALUE Sip-Method Info 16 39 | VALUE Sip-Method Options 32 40 | VALUE Sip-Method Update 64 41 | VALUE Sip-Method Register 128 42 | VALUE Sip-Method Message 256 43 | VALUE Sip-Method Subscribe 512 44 | VALUE Sip-Method Notify 1024 45 | VALUE Sip-Method Prack 2048 46 | VALUE Sip-Method Refer 4096 47 | VALUE Sip-Method Other 8192 48 | 49 | 50 | -------------------------------------------------------------------------------- /alpine_kamailio_dbtext_rpi/conf/etc/kamctlrc: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | # 3 | # The Kamailio configuration file for the control tools. 4 | # 5 | # Here you can set variables used in the kamctl and kamdbctl setup 6 | # scripts. Per default all variables here are commented out, the control tools 7 | # will use their internal default values. 8 | 9 | ## your SIP domain 10 | SIP_DOMAIN=10.0.200.94 11 | 12 | ## chrooted directory 13 | # $CHROOT_DIR="/path/to/chrooted/directory" 14 | 15 | ## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, DBTEXT, or SQLITE 16 | # by default none is loaded 17 | # 18 | # If you want to setup a database with kamdbctl, you must at least specify 19 | # this parameter. 20 | 21 | DBENGINE=DBTEXT 22 | 23 | ## database host 24 | 25 | #DBHOST=127.0.0.1 26 | 27 | ## database name (for ORACLE this is TNS name) 28 | #DBNAME=kamailio 29 | 30 | # database path used by dbtext, db_berkeley or sqlite 31 | DB_PATH="/usr/local/share/kamailio/dbtext/kamailio/" 32 | USERCOL="username" 33 | 34 | ## database read/write user 35 | 36 | #DBRWUSER="kamailio" 37 | 38 | ## password for database read/write user 39 | #DBRWPW="kamailiorw" 40 | 41 | ## database read only user 42 | #DBROUSER="kamailioro" 43 | 44 | ## password for database read only user 45 | #DBROPW="kamailioro" 46 | 47 | ## database access host (from where is kamctl used) 48 | # DBACCESSHOST=192.168.0.1 49 | 50 | ## database super user (for ORACLE this is 'scheme-creator' user) 51 | #DBROOTUSER="root" 52 | 53 | # user name column 54 | # USERCOL="username" 55 | 56 | 57 | # SQL definitions 58 | # If you change this definitions here, then you must change them 59 | # in db/schema/entities.xml too. 60 | # FIXME 61 | 62 | # FOREVER="2030-05-28 21:32:15" 63 | # DEFAULT_Q="1.0" 64 | 65 | 66 | # Program to calculate a message-digest fingerprint 67 | # MD5="md5sum" 68 | 69 | # awk tool 70 | # AWK="awk" 71 | 72 | # gdb tool 73 | # GDB="gdb" 74 | 75 | # If you use a system with a grep and egrep that is not 100% gnu grep compatible, 76 | # e.g. solaris, install the gnu grep (ggrep) and specify this below. 77 | # 78 | # grep tool 79 | # GREP="grep" 80 | 81 | # egrep tool 82 | # EGREP="egrep" 83 | 84 | # sed tool 85 | # SED="sed" 86 | 87 | # tail tool 88 | # LAST_LINE="tail -n 1" 89 | 90 | # expr tool 91 | # EXPR="expr" 92 | 93 | 94 | # Describe what additional tables to install. Valid values for the variables 95 | # below are yes/no/ask. With ask (default) it will interactively ask the user 96 | # for an answer, while yes/no allow for automated, unassisted installs. 97 | # 98 | 99 | # If to install tables for the modules in the EXTRA_MODULES variable. 100 | INSTALL_EXTRA_TABLES=yes 101 | 102 | # If to install presence related tables. 103 | INSTALL_PRESENCE_TABLES=yes 104 | 105 | # If to install uid modules related tables. 106 | INSTALL_DBUID_TABLES=yes 107 | 108 | # Define what module tables should be installed. 109 | # If you use the postgres database and want to change the installed tables, then you 110 | # must also adjust the STANDARD_TABLES or EXTRA_TABLES variable accordingly in the 111 | # kamdbctl.base script. 112 | 113 | # Kamailio standard modules 114 | STANDARD_MODULES="presence_dialoginfo pua pua_dialoginfo pua_usrloc db_text dialplan nth presence presence_xml xml tls" 115 | # standard acc lcr domain group permissions registrar usrloc msilo 116 | # alias_db uri_db speeddial avpops auth_db pdt dialog dispatcher 117 | # dialplan" 118 | 119 | # Kamailio extra modules 120 | # EXTRA_MODULES="imc cpl siptrace domainpolicy carrierroute userblacklist htable purple sca" 121 | 122 | 123 | ## type of aliases used: DB - database aliases; UL - usrloc aliases 124 | ## - default: none 125 | # ALIASES_TYPE="DB" 126 | 127 | ## control engine: FIFO or UNIXSOCK 128 | ## - default FIFO 129 | # CTLENGINE="FIFO" 130 | 131 | ## path to FIFO file 132 | FIFOPATH="/var/run/kamailio/kamailio_fifo" 133 | 134 | ## check ACL names; default on (1); off (0) 135 | # VERIFY_ACL=1 136 | 137 | ## ACL names - if VERIFY_ACL is set, only the ACL names from below list 138 | ## are accepted 139 | # ACL_GROUPS="local ld int voicemail free-pstn" 140 | 141 | ## verbose - debug purposes - default '0' 142 | # VERBOSE=1 143 | 144 | ## do (1) or don't (0) store plaintext passwords 145 | ## in the subscriber table - default '1' 146 | # STORE_PLAINTEXT_PW=0 147 | 148 | ## Kamailio START Options 149 | ## PID file path - default is: /var/run/kamailio.pid 150 | PID_FILE=/var/run/kamailio/kamailio.pid 151 | 152 | ## Extra start options - default is: not set 153 | # example: start Kamailio with 64MB share memory: STARTOPTIONS="-m 64" 154 | # STARTOPTIONS= 155 | -------------------------------------------------------------------------------- /alpine_kamailio_dbtext_rpi/conf/etc/subscriber: -------------------------------------------------------------------------------- 1 | id(int,auto) username(string) domain(string) password(string) ha1(string) ha1b(string) email_address(string,null) rpid(string,null) 2 | -------------------------------------------------------------------------------- /alpine_kamailio_dbtext_rpi/conf/etc/tls.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # Example Kamailio TLS Configuration File 3 | # 4 | 5 | # This is the default server domain, settings 6 | # in this domain will be used for all incoming 7 | # connections that do not match any other server 8 | # domain in this configuration file. 9 | # 10 | # We do not enable anything else than TLSv1 11 | # over the public internet. Clients do not have 12 | # to present client certificates by default. 13 | # 14 | [server:default] 15 | method = TLSv1 16 | verify_certificate = no 17 | require_certificate = no 18 | private_key = /etc/kamailio/certs/kamailio-selfsigned.key 19 | certificate = /etc/kamailio/certs/kamailio-selfsigned.pem 20 | #ca_list = /usr/local/etc/kamailio/ca.pem 21 | #crl = ./modules/tls/crl.pem 22 | 23 | # This is the default client domain, settings 24 | # in this domain will be used for all outgoing 25 | # TLS connections that do not match any other 26 | # client domain in this configuration file. 27 | # We require that servers present valid certificate. 28 | # 29 | [client:default] 30 | verify_certificate = no 31 | require_certificate = no 32 | 33 | # This is an example server domain for TLS connections 34 | # received from the loopback interface. We allow 35 | # the use of SSLv2 and SSLv3 protocols here, we do 36 | # not require that clients present client certificates 37 | # but if they present it it must be valid. We also use 38 | # a special certificate and CA list for loopback 39 | # interface. 40 | # 41 | #[server:127.0.0.1:5061] 42 | #method = SSLv23 43 | #verify_certificate = yes 44 | #require_certificate = no 45 | #private_key = ./modules/tls/local_key.pem 46 | #certificate = ./modules/tls/local_cert.pem 47 | #verify_depth = 3 48 | #ca_list = local_ca.pem 49 | #crl = local_crl.pem 50 | 51 | # Special settings for the iptel.org public SIP 52 | # server. We do not verify the certificate of the 53 | # server because it can be expired. The server 54 | # implements authentication using SSL client 55 | # certificates so configure the client certificate 56 | # that was given to use by iptel.org staff here. 57 | # 58 | #[client:195.37.77.101:5061] 59 | #verify_certificate = no 60 | #certificate = ./modules/tls/iptel_client.pem 61 | #private_key = ./modules/tls/iptel_key.pem 62 | #ca_list = ./modules/tls/iptel_ca.pem 63 | #crl = ./modules/tls/iptel_crl.pem 64 | -------------------------------------------------------------------------------- /alpine_kamailio_sqlite_rpi/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM armhf/alpine 2 | 3 | MAINTAINER Alberto Sagredo 4 | 5 | ENV build_date 2016-11-18 6 | 7 | ENV DEBIAN_FRONTEND noninteractive 8 | 9 | ENV SIP_PORT 5060 10 | 11 | ENV TLS_PORT 5061 12 | 13 | RUN apk add --no-cache sqlite kamailio kamailio-presence kamailio-tls bash joe python kamailio-debugger kamailio-dbg kamailio-xml kamailio-sqlite libssl1.0 14 | 15 | ADD conf/etc/* /etc/kamailio/ 16 | 17 | ADD boot_run.sh /etc/ 18 | 19 | WORKDIR /etc/kamailio/ 20 | 21 | RUN mkdir /etc/kamailio/certs 22 | 23 | ADD conf/etc/certs/* /etc/kamailio/certs/ 24 | 25 | EXPOSE $SIP_PORT $SIP_PORT/udp $TLS_PORT 26 | 27 | RUN chmod a+x /etc/boot_run.sh 28 | 29 | ENTRYPOINT ["/etc/boot_run.sh"] 30 | -------------------------------------------------------------------------------- /alpine_kamailio_sqlite_rpi/Makefile: -------------------------------------------------------------------------------- 1 | NAME = voipnovatos/alpine-kamailio-dbtext-rpi 2 | VERSION = latest 3 | 4 | .PHONY: all build run 5 | 6 | all: build 7 | 8 | build: 9 | 10 | @docker build -t $(NAME):$(VERSION) . 11 | 12 | run: 13 | @docker run -dt -p 5060:5060 -p 5060:5060/udp -p 5061:5061 -e ADVERTISED_IP="10.0.200.94" --name=kamailio -h "kamailio.local" voipnovatos/alpine-kamailio-dbtext-rpi 14 | 15 | 16 | -------------------------------------------------------------------------------- /alpine_kamailio_sqlite_rpi/boot_run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MYSQL_PWD=${MYSQL_PWD:-"passwd"} 4 | 5 | ADVERTISED_IP=${ADVERTISED_IP:-"127.0.0.1"} 6 | 7 | HOST_IP=$(ip route get 8.8.8.8 | awk '{print $NF; exit}') 8 | 9 | SIP_PORT=5060 10 | 11 | TLS_PORT=5061 12 | 13 | echo "Your IP : ${HOST_IP}" 14 | 15 | echo -e "Your Advertised IP : ${ADVERTISED_IP}\n\n" 16 | 17 | echo -e "Your Kamailio SIP Port : ${SIP_PORT}\n\n" 18 | 19 | # Configure kamailio.cfg 20 | 21 | sed -i "s/alias=.*/alias=\"${ADVERTISED_IP}\"/g" /etc/kamailio/kamailio.cfg 22 | 23 | sed -i "s/listen=udp.*/listen=udp:${HOST_IP}:5060 advertise ${ADVERTISED_IP}:5060/g" /etc/kamailio/kamailio.cfg 24 | 25 | sed -i "s/listen=tcp.*/listen=tcp:${HOST_IP}:5060 advertise ${ADVERTISED_IP}:5060/g" /etc/kamailio/kamailio.cfg 26 | 27 | sed -i "s/listen=tls.*/listen=tls:${HOST_IP}:5061 advertise ${ADVERTISED_IP}:5061/g" /etc/kamailio/kamailio.cfg 28 | 29 | #sed -i "s/port=.*/port=${SIP_PORT}/g" /usr/local/etc/kamailio/kamailio.cfg 30 | 31 | sed -i "s/SIP_DOMAIN=.*/SIP_DOMAIN=${ADVERTISED_IP}/g" /etc/kamailio/kamctlrc 32 | 33 | sed -i -e 's/\\ $/\\/' /usr/lib/kamailio//kamctl/kamdbctl.base 34 | 35 | #mkdir /var/spool/rtpengine 36 | 37 | #rtpengine -p /var/run/rtpengine.pid --interface=127.0.0.1!$ADVERTISED_IP -n 127.0.0.1:60000 -c 127.0.0.1:60001 -m 20000 -M 30000 -E -L 7 38 | 39 | # Auto Create Database 40 | 41 | kamdbctl create 42 | 43 | kamctl add 100 snom 44 | 45 | kamctl add 101 snom 46 | 47 | kamctl add 102 snom 48 | 49 | kamctl add 103 snom 50 | 51 | kamctl add 104 snom 52 | 53 | kamctl add 105 snom 54 | 55 | kamctl add 106 snom 56 | 57 | kamctl add 107 snom 58 | 59 | kamctl add 108 snom 60 | 61 | kamctl add 109 snom 62 | 63 | kamctl add 110 snom 64 | 65 | kamctl add 200 snom 66 | 67 | kamctl add 201 snom 68 | 69 | kamctl add 202 snom 70 | 71 | # Starting Kamailio process 72 | 73 | /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg 74 | 75 | /bin/bash -------------------------------------------------------------------------------- /alpine_kamailio_sqlite_rpi/build/modules.lst: -------------------------------------------------------------------------------- 1 | # this file is autogenerated by make modules-cfg 2 | 3 | # the list of sub-directories with modules 4 | modules_dirs:=modules 5 | 6 | # the list of module groups to compile 7 | cfg_group_include= 8 | 9 | # the list of extra modules to compile 10 | include_modules= stun outbound path uuid ctl xhttp kex tm tmx sl rr maxfwd siputils presence presence_conference presence_dialoginfo presence_mwi presence_profile presence_reginfo presence_xml websocket tls pua_dialoginfo snmpstats ctl cfg_rpc kex tm tmx sl rr maxfwd siputils sanity textops htable pv xlog mi_fifo uac uac_redirect db_text kazoo dispatcher rtimer timer sqlops 11 | 12 | # the list of static modules 13 | static_modules= 14 | 15 | # the list of modules to skip from compile list 16 | skip_modules= alias_db path corex mi_rpc async auth_diameter avpops avp benchmark blst call_control cfg_db counters db2_ops db_cluster db_flatstore debugger diversion dmq domainpolicy domain drouting enum exec group imc ipops malloc_test mangler matrix mediaproxy mi_datagram mqueue msilo msrp mtree nat_traversal pdb pdt pipelimit prefix_route print_lib print p_usrloc qos ratelimit rtpproxy sca sdpops seas sipcapture siptrace sms speeddial sst statistics tmrec topoh uid_auth_db uid_avp_db uid_domain uid_gflags uid_uri_db uri_db userblacklist xhttp_rpc xprint 17 | 18 | # the list of modules to exclude from compile list 19 | exclude_modules= acc_radius app_java app_lua app_mono app_perl app_python auth_ephemeral auth_identity auth_radius cdp cdp_avp cnxcc cpl-c crypto db2_ldap db_berkeley db_cassandra db_mongodb db_mysql db_oracle db_perlvdb db_postgres db_sqlite db_unixodbc dialplan dnssec evapi geoip geoip2 gzcompress h350 http_async_client http_client ims_auth ims_charging ims_dialog ims_icscf ims_isc ims_qos ims_registrar_pcscf ims_registrar_scscf ims_usrloc_pcscf ims_usrloc_scscf iptrtpproxy jansson janssonrpc-c json jsonrpc-c lcr ldap log_systemd memcached mi_xmlrpc misc_radius ndb_cassandra ndb_mongodb ndb_redis osp outbound peering pua pua_bla pua_dialoginfo pua_mi pua_reginfo pua_usrloc pua_xmpp purple regex rls sctp snmpstats tls utils uuid websocket xcap_client xcap_server xhttp_pi xmlops xmlrpc xmpp $(skip_modules) 20 | 21 | #enabled carrierroute erlang cfg_rpc 22 | 23 | modules_all= $(filter-out modules/CVS,$(wildcard modules/*)) 24 | modules_noinc= $(filter-out $(addprefix modules/, $(exclude_modules) $(static_modules)), $(modules_all)) 25 | modules= $(filter-out $(modules_noinc), $(addprefix modules/, $(include_modules) )) $(modules_noinc) 26 | modules_configured:=1 27 | -------------------------------------------------------------------------------- /alpine_kamailio_sqlite_rpi/conf/default/kamailio: -------------------------------------------------------------------------------- 1 | # 2 | # Kamailio startup options 3 | # 4 | 5 | # Set to yes to enable kamailio, once configured properly. 6 | RUN_KAMAILIO=yes 7 | 8 | # User to run as 9 | #USER=kamailio 10 | 11 | # Group to run as 12 | #GROUP=kamailio 13 | 14 | # Amount of shared and private memory to allocate 15 | # for the running Kamailio server (in Mb) 16 | #SHM_MEMORY=64 17 | #PKG_MEMORY=8 18 | 19 | # Config file 20 | #CFGFILE=/etc/kamailio/kamailio.cfg 21 | 22 | # Enable the server to leave a core file when it crashes. 23 | # Set this to 'yes' to enable Kamailio to leave a core file when it crashes 24 | # or 'no' to disable this feature. This option is case sensitive and only 25 | # accepts 'yes' and 'no' and only in lowercase letters. 26 | # On some systems it is necessary to specify a directory for the core files 27 | # to get a dump. Look into the kamailio init file for an example configuration. 28 | #DUMP_CORE=yes 29 | -------------------------------------------------------------------------------- /alpine_kamailio_sqlite_rpi/conf/default/kamailio.init: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | ### BEGIN INIT INFO 4 | # Provides: kamailio 5 | # Required-Start: $syslog $network $local_fs $remote_fs $time 6 | # Should-Start: $named slapd mysql postgresql snmpd radiusd 7 | # Should-Stop: $named slapd mysql postgresql snmpd radiusd 8 | # Required-Stop: $syslog $network $local_fs $remote_fs 9 | # Default-Start: 2 3 4 5 10 | # Default-Stop: 0 1 6 11 | # Short-Description: Start the Kamailio SIP proxy server 12 | # Description: Start the Kamailio SIP proxy server 13 | ### END INIT INFO 14 | 15 | . /lib/lsb/init-functions 16 | 17 | PATH=/sbin:/bin:/usr/sbin:/usr/bin 18 | DAEMON=/usr/local/sbin/kamailio 19 | CFGFILE=/usr/local/etc/kamailio/kamailio.cfg 20 | NAME=`basename "$0"` 21 | DESC="Kamailio SIP Server" 22 | HOMEDIR=/var/run/$NAME 23 | PIDFILE=$HOMEDIR/$NAME.pid 24 | DEFAULTS=/etc/default/$NAME 25 | RUN_KAMAILIO=no 26 | USER=kamailio 27 | GROUP=kamailio 28 | # Amount of shared and private memory to allocate 29 | # for the running Kamailio server (in Mb) 30 | SHM_MEMORY=64 31 | PKG_MEMORY=8 32 | DUMP_CORE=no 33 | 34 | # Do not start kamailio if fork=no is set in the config file 35 | # otherwise the boot process will just stop 36 | check_fork () 37 | { 38 | if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" $CFGFILE; then 39 | log_failure_msg "Not starting $DESC: fork=no specified in config file; run /etc/init.d/kamailio debug instead" 40 | exit 0 41 | fi 42 | } 43 | 44 | check_kamailio_config () 45 | { 46 | # Check if kamailio configuration is valid before starting the server 47 | set +e 48 | out=$($DAEMON -f $CFGFILE -M $PKG_MEMORY -c 2>&1 > /dev/null) 49 | retcode=$? 50 | set -e 51 | if [ "$retcode" != '0' ]; then 52 | log_failure_msg "Not starting $DESC: invalid configuration file!" 53 | log_failure_msg 54 | log_failure_msg "$out" 55 | log_failure_msg 56 | exit 1 57 | fi 58 | } 59 | 60 | create_radius_seqfile () 61 | { 62 | # Create a radius sequence file to be used by the radius client if 63 | # radius accounting is enabled. This is needed to avoid any issue 64 | # with the file not being writable if kamailio first starts as user 65 | # root because DUMP_CORE is enabled and creates this file as user 66 | # root and then later it switches back to user kamailio and cannot 67 | # write to the file. If the file exists before kamailio starts, it 68 | # won't change it's ownership and will be writable for both root 69 | # and kamailio, no matter what options are chosen at install time 70 | RADIUS_SEQ_FILE="$HOMEDIR/kamailio_radius.seq" 71 | if [ -d $HOMEDIR ]; then 72 | chown ${USER}:${GROUP} $HOMEDIR 73 | 74 | if [ ! -f $RADIUS_SEQ_FILE ]; then 75 | touch $RADIUS_SEQ_FILE 76 | fi 77 | 78 | chown ${USER}:${GROUP} $RADIUS_SEQ_FILE 79 | chmod 660 $RADIUS_SEQ_FILE 80 | fi 81 | } 82 | 83 | test -f $DAEMON || exit 0 84 | 85 | # Load startup options if available 86 | if [ -f $DEFAULTS ]; then 87 | . $DEFAULTS || true 88 | fi 89 | 90 | if [ "$RUN_KAMAILIO" != "yes" ]; then 91 | log_failure_msg "Kamailio not yet configured. Edit /etc/default/$NAME first." 92 | exit 0 93 | fi 94 | 95 | set -e 96 | 97 | SHM_MEMORY=$((`echo $SHM_MEMORY | sed -e 's/[^0-9]//g'`)) 98 | PKG_MEMORY=$((`echo $PKG_MEMORY | sed -e 's/[^0-9]//g'`)) 99 | [ -z "$USER" ] && USER=kamailio 100 | [ -z "$GROUP" ] && GROUP=kamailio 101 | [ $SHM_MEMORY -le 0 ] && SHM_MEMORY=64 102 | [ $PKG_MEMORY -le 0 ] && PKG_MEMORY=4 103 | 104 | if test "$DUMP_CORE" = "yes" ; then 105 | # set proper ulimit 106 | ulimit -c unlimited 107 | 108 | # directory for the core dump files 109 | # COREDIR=/home/corefiles 110 | # [ -d $COREDIR ] || mkdir $COREDIR 111 | # chmod 777 $COREDIR 112 | # echo "$COREDIR/core.%e.sig%s.%p" > /proc/sys/kernel/core_pattern 113 | fi 114 | 115 | # /var/run can be a tmpfs 116 | if [ ! -d $HOMEDIR ]; then 117 | mkdir -p $HOMEDIR 118 | chown ${USER}:${GROUP} $HOMEDIR 119 | fi 120 | 121 | OPTIONS="-f $CFGFILE -P $PIDFILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP" 122 | 123 | case "$1" in 124 | start|debug) 125 | check_kamailio_config 126 | create_radius_seqfile 127 | 128 | if [ "$1" != "debug" ]; then 129 | check_fork 130 | fi 131 | 132 | log_daemon_msg "Starting $DESC: $NAME" 133 | start-stop-daemon --start --quiet --pidfile $PIDFILE \ 134 | --exec $DAEMON -- $OPTIONS || log_failure_msg " already running" 135 | log_end_msg 0 136 | ;; 137 | stop) 138 | log_daemon_msg "Stopping $DESC: $NAME" 139 | start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \ 140 | --exec $DAEMON 141 | log_end_msg 0 142 | ;; 143 | restart|force-reload) 144 | check_kamailio_config 145 | create_radius_seqfile 146 | 147 | $0 stop 148 | sleep 1 149 | $0 start 150 | ;; 151 | status) 152 | log_daemon_msg "Status of $DESC: " 153 | 154 | status_of_proc -p"$PIDFILE" $NAME $NAME 155 | ;; 156 | *) 157 | N=/etc/init.d/$NAME 158 | echo "Usage: $N {start|stop|restart|force-reload|status|debug}" >&2 159 | exit 1 160 | ;; 161 | esac 162 | 163 | exit 0 164 | -------------------------------------------------------------------------------- /alpine_kamailio_sqlite_rpi/conf/etc/certs/kamailio-selfsigned.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBANlHQ9WEqEpHwTs8 3 | OFj8tIp+z9Q9YRJflIbdhw5tEK8Vj9OPoqfvM8mXxFyd9FS79RzTJk0u7UWpazsw 4 | 5tdiqp9zy4uIcqyCqaQIeR+VyUq9pscTROHUeQSYDA23anXo75jVRPCwRvT2MpDu 5 | n5uDQEuWnz+u+aUhXGBCGOoZH9gvAgMBAAECgYAO+2oDBBWyoYYCdqGQCUTNs/bS 6 | tLTH1o1gS1Avv3eCCyOSu/nESKsygGOK211oplk9dpXShqTXw9ngB/wy59vJ6Eo/ 7 | KDHJZDOdymZEYqvbpHJychkv6zzENLy69orTM2vB3BVGGqSP1m7B6PzmHKRysTKO 8 | X75kChS0ty4rVwm6sQJBAP9nSn/Z1y1WEyaXbzBYpZOSZ7YPaQWUiTu74dUGVkMO 9 | JIUFq1og3cRmwiUPTBm7G6HFKsQ/1Z2hnEbmAIdXx3kCQQDZyS2w6A2WTZ5AMzhb 10 | 6LmKfgfAtOBIewgbSG1poD5Wks8EyD09hmyt4cS319pmX3COpEnsjUvVfU/pllwa 11 | eSrnAkEAh9o9enw5RNhAH4r1jdXZXQHHQMQ5rMoxpSBvI4zXXZusOUWmu643yDyQ 12 | kH3ukNFCBW6HLRR3X/2SzvOQ3G0IoQJBALi3u7tKdwu+tbS6PNknoQdoMecvAvQ2 13 | 9f8+BR8LvRPs3Q2vUNH4TAGHdjSALkuaM3uouNKcXW+sI7V5xJDnqI0CQDtCI3A+ 14 | V09BXhd9GHLg9AiajFDCtbCX9gyjYL9eVei6J4nkwJk8CcBXpwr8FA7t1oYlG8ii 15 | EF4qtGd/6LFAmM8= 16 | -----END PRIVATE KEY----- 17 | -------------------------------------------------------------------------------- /alpine_kamailio_sqlite_rpi/conf/etc/certs/kamailio-selfsigned.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICmzCCAgQCCQCPEDnYk9mhaTANBgkqhkiG9w0BAQUFADCBkTEtMCsGA1UEChMk 3 | U2VsZi1zaWduZWQgY2VydGlmaWNhdGUgZm9yIGthbWFpbGlvMQ8wDQYDVQQLEwZt 4 | YWNwcGMxITAfBgNVBAMTGG1hY3BwYy5wb3J0cy5vcGVuYnNkLm9yZzEsMCoGCSqG 5 | SIb3DQEJARYdcm9vdEBtYWNwcGMucG9ydHMub3BlbmJzZC5vcmcwHhcNMTIwODEw 6 | MTE1MDE2WhcNMTMwODEwMTE1MDE2WjCBkTEtMCsGA1UEChMkU2VsZi1zaWduZWQg 7 | Y2VydGlmaWNhdGUgZm9yIGthbWFpbGlvMQ8wDQYDVQQLEwZtYWNwcGMxITAfBgNV 8 | BAMTGG1hY3BwYy5wb3J0cy5vcGVuYnNkLm9yZzEsMCoGCSqGSIb3DQEJARYdcm9v 9 | dEBtYWNwcGMucG9ydHMub3BlbmJzZC5vcmcwgZ8wDQYJKoZIhvcNAQEBBQADgY0A 10 | MIGJAoGBANlHQ9WEqEpHwTs8OFj8tIp+z9Q9YRJflIbdhw5tEK8Vj9OPoqfvM8mX 11 | xFyd9FS79RzTJk0u7UWpazsw5tdiqp9zy4uIcqyCqaQIeR+VyUq9pscTROHUeQSY 12 | DA23anXo75jVRPCwRvT2MpDun5uDQEuWnz+u+aUhXGBCGOoZH9gvAgMBAAEwDQYJ 13 | KoZIhvcNAQEFBQADgYEAwKOB5sDunJ0KnuBZ/Y2twy0htT0ST/hPFif37BDAZdb0 14 | e0mzeLOe8cJ9F51o8prbbLUiqkaey44LSrfE45AQOVEEuFVxpaFjO3Z/vXsXzk9t 15 | UcrATorqpAMf0eih0EMaaRox+K3gUauAPtnYNphGK3G4X3yvt4TmgqOJ6S+t72I= 16 | -----END CERTIFICATE----- 17 | -------------------------------------------------------------------------------- /alpine_kamailio_sqlite_rpi/conf/etc/dictionary.kamailio: -------------------------------------------------------------------------------- 1 | # 2 | # $Id$ 3 | # 4 | # SIP RADIUS attributes 5 | # 6 | # Proprietary indicates an attribute that hasn't 7 | # been standardized 8 | # 9 | # 10 | # NOTE: All standard (IANA registered) attributes are 11 | # defined in the default dictionary of the 12 | # radiusclient-ng library. 13 | # 14 | 15 | 16 | #### Attributes ### 17 | ATTRIBUTE Sip-Uri-User 208 string # Proprietary, auth_radius 18 | ATTRIBUTE Sip-Group 211 string # Proprietary, group_radius 19 | ATTRIBUTE Sip-Rpid 213 string # Proprietary, auth_radius 20 | ATTRIBUTE SIP-AVP 225 string # Proprietary, avp_radius 21 | 22 | ### Acct-Status-Type Values ### 23 | #VALUE Acct-Status-Type Failed 15 # RFC2866, acc 24 | 25 | ### Service-Type Values ### 26 | #VALUE Service-Type Call-Check 10 # RFC2865, uri_radius 27 | VALUE Service-Type Group-Check 12 # Proprietary, group_radius 28 | ##VALUE Service-Type Sip-Session 15 # Schulzrinne, acc, auth_radius 29 | VALUE Service-Type SIP-Caller-AVPs 30 # Proprietary, avp_radius 30 | VALUE Service-Type SIP-Callee-AVPs 31 # Proprietary, avp_radius 31 | 32 | ### Sip-Method Values ### 33 | VALUE Sip-Method Undefined 0 34 | VALUE Sip-Method Invite 1 35 | VALUE Sip-Method Cancel 2 36 | VALUE Sip-Method Ack 4 37 | VALUE Sip-Method Bye 8 38 | VALUE Sip-Method Info 16 39 | VALUE Sip-Method Options 32 40 | VALUE Sip-Method Update 64 41 | VALUE Sip-Method Register 128 42 | VALUE Sip-Method Message 256 43 | VALUE Sip-Method Subscribe 512 44 | VALUE Sip-Method Notify 1024 45 | VALUE Sip-Method Prack 2048 46 | VALUE Sip-Method Refer 4096 47 | VALUE Sip-Method Other 8192 48 | 49 | 50 | -------------------------------------------------------------------------------- /alpine_kamailio_sqlite_rpi/conf/etc/kamctlrc: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | # 3 | # The Kamailio configuration file for the control tools. 4 | # 5 | # Here you can set variables used in the kamctl and kamdbctl setup 6 | # scripts. Per default all variables here are commented out, the control tools 7 | # will use their internal default values. 8 | 9 | ## your SIP domain 10 | SIP_DOMAIN=10.0.200.94 11 | 12 | ## chrooted directory 13 | # $CHROOT_DIR="/path/to/chrooted/directory" 14 | 15 | ## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, DBTEXT, or SQLITE 16 | # by default none is loaded 17 | # 18 | # If you want to setup a database with kamdbctl, you must at least specify 19 | # this parameter. 20 | 21 | DBENGINE=SQLITE 22 | 23 | ## database host 24 | 25 | #DBHOST=127.0.0.1 26 | 27 | ## database name (for ORACLE this is TNS name) 28 | #DBNAME=kamailio 29 | 30 | # database path used by dbtext, db_berkeley or sqlite 31 | DB_PATH="db.sqlite" 32 | #USERCOL="username" 33 | 34 | ## database read/write user 35 | 36 | #DBRWUSER="kamailio" 37 | 38 | ## password for database read/write user 39 | #DBRWPW="kamailiorw" 40 | 41 | ## database read only user 42 | #DBROUSER="kamailioro" 43 | 44 | ## password for database read only user 45 | #DBROPW="kamailioro" 46 | 47 | ## database access host (from where is kamctl used) 48 | # DBACCESSHOST=192.168.0.1 49 | 50 | ## database super user (for ORACLE this is 'scheme-creator' user) 51 | #DBROOTUSER="root" 52 | 53 | # user name column 54 | # USERCOL="username" 55 | 56 | 57 | # SQL definitions 58 | # If you change this definitions here, then you must change them 59 | # in db/schema/entities.xml too. 60 | # FIXME 61 | 62 | # FOREVER="2030-05-28 21:32:15" 63 | # DEFAULT_Q="1.0" 64 | 65 | 66 | # Program to calculate a message-digest fingerprint 67 | # MD5="md5sum" 68 | 69 | # awk tool 70 | # AWK="awk" 71 | 72 | # gdb tool 73 | # GDB="gdb" 74 | 75 | # If you use a system with a grep and egrep that is not 100% gnu grep compatible, 76 | # e.g. solaris, install the gnu grep (ggrep) and specify this below. 77 | # 78 | # grep tool 79 | # GREP="grep" 80 | 81 | # egrep tool 82 | # EGREP="egrep" 83 | 84 | # sed tool 85 | # SED="sed" 86 | 87 | # tail tool 88 | # LAST_LINE="tail -n 1" 89 | 90 | # expr tool 91 | # EXPR="expr" 92 | 93 | 94 | # Describe what additional tables to install. Valid values for the variables 95 | # below are yes/no/ask. With ask (default) it will interactively ask the user 96 | # for an answer, while yes/no allow for automated, unassisted installs. 97 | # 98 | 99 | # If to install tables for the modules in the EXTRA_MODULES variable. 100 | INSTALL_EXTRA_TABLES=yes 101 | 102 | # If to install presence related tables. 103 | INSTALL_PRESENCE_TABLES=yes 104 | 105 | # If to install uid modules related tables. 106 | INSTALL_DBUID_TABLES=yes 107 | 108 | # Define what module tables should be installed. 109 | # If you use the postgres database and want to change the installed tables, then you 110 | # must also adjust the STANDARD_TABLES or EXTRA_TABLES variable accordingly in the 111 | # kamdbctl.base script. 112 | 113 | # Kamailio standard modules 114 | #STANDARD_MODULES="presence_dialoginfo pua pua_dialoginfo pua_usrloc db_text dialplan nth presence presence_xml xml tls" 115 | # standard acc lcr domain group permissions registrar usrloc msilo 116 | # alias_db uri_db speeddial avpops auth_db pdt dialog dispatcher 117 | # dialplan" 118 | 119 | # Kamailio extra modules 120 | # EXTRA_MODULES="imc cpl siptrace domainpolicy carrierroute userblacklist htable purple sca" 121 | 122 | 123 | ## type of aliases used: DB - database aliases; UL - usrloc aliases 124 | ## - default: none 125 | # ALIASES_TYPE="DB" 126 | 127 | ## control engine: FIFO or UNIXSOCK 128 | ## - default FIFO 129 | # CTLENGINE="FIFO" 130 | 131 | ## path to FIFO file 132 | FIFOPATH="/var/run/kamailio/kamailio_fifo" 133 | 134 | ## check ACL names; default on (1); off (0) 135 | # VERIFY_ACL=1 136 | 137 | ## ACL names - if VERIFY_ACL is set, only the ACL names from below list 138 | ## are accepted 139 | # ACL_GROUPS="local ld int voicemail free-pstn" 140 | 141 | ## verbose - debug purposes - default '0' 142 | # VERBOSE=1 143 | 144 | ## do (1) or don't (0) store plaintext passwords 145 | ## in the subscriber table - default '1' 146 | # STORE_PLAINTEXT_PW=0 147 | 148 | ## Kamailio START Options 149 | ## PID file path - default is: /var/run/kamailio.pid 150 | PID_FILE=/var/run/kamailio/kamailio.pid 151 | 152 | ## Extra start options - default is: not set 153 | # example: start Kamailio with 64MB share memory: STARTOPTIONS="-m 64" 154 | # STARTOPTIONS= 155 | -------------------------------------------------------------------------------- /alpine_kamailio_sqlite_rpi/conf/etc/subscriber: -------------------------------------------------------------------------------- 1 | id(int,auto) username(string) domain(string) password(string) ha1(string) ha1b(string) email_address(string,null) rpid(string,null) 2 | -------------------------------------------------------------------------------- /alpine_kamailio_sqlite_rpi/conf/etc/tls.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # Example Kamailio TLS Configuration File 3 | # 4 | 5 | # This is the default server domain, settings 6 | # in this domain will be used for all incoming 7 | # connections that do not match any other server 8 | # domain in this configuration file. 9 | # 10 | # We do not enable anything else than TLSv1 11 | # over the public internet. Clients do not have 12 | # to present client certificates by default. 13 | # 14 | [server:default] 15 | method = TLSv1 16 | verify_certificate = no 17 | require_certificate = no 18 | private_key = /etc/kamailio/certs/kamailio-selfsigned.key 19 | certificate = /etc/kamailio/certs/kamailio-selfsigned.pem 20 | #ca_list = /usr/local/etc/kamailio/ca.pem 21 | #crl = ./modules/tls/crl.pem 22 | 23 | # This is the default client domain, settings 24 | # in this domain will be used for all outgoing 25 | # TLS connections that do not match any other 26 | # client domain in this configuration file. 27 | # We require that servers present valid certificate. 28 | # 29 | [client:default] 30 | verify_certificate = no 31 | require_certificate = no 32 | 33 | # This is an example server domain for TLS connections 34 | # received from the loopback interface. We allow 35 | # the use of SSLv2 and SSLv3 protocols here, we do 36 | # not require that clients present client certificates 37 | # but if they present it it must be valid. We also use 38 | # a special certificate and CA list for loopback 39 | # interface. 40 | # 41 | #[server:127.0.0.1:5061] 42 | #method = SSLv23 43 | #verify_certificate = yes 44 | #require_certificate = no 45 | #private_key = ./modules/tls/local_key.pem 46 | #certificate = ./modules/tls/local_cert.pem 47 | #verify_depth = 3 48 | #ca_list = local_ca.pem 49 | #crl = local_crl.pem 50 | 51 | # Special settings for the iptel.org public SIP 52 | # server. We do not verify the certificate of the 53 | # server because it can be expired. The server 54 | # implements authentication using SSL client 55 | # certificates so configure the client certificate 56 | # that was given to use by iptel.org staff here. 57 | # 58 | #[client:195.37.77.101:5061] 59 | #verify_certificate = no 60 | #certificate = ./modules/tls/iptel_client.pem 61 | #private_key = ./modules/tls/iptel_key.pem 62 | #ca_list = ./modules/tls/iptel_ca.pem 63 | #crl = ./modules/tls/iptel_crl.pem 64 | -------------------------------------------------------------------------------- /alpine_nginx_snom_provisioning_rpi/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM armhf/alpine 2 | 3 | RUN apk --update add --no-cache pcre-dev openssl-dev openssl zlib-dev curl nginx joe 4 | 5 | COPY etc/nginx.conf /etc/nginx/nginx.conf 6 | 7 | COPY etc/local.conf /etc/nginx/conf.d/local.conf 8 | 9 | RUN mkdir -p /etc/nginx/ssl 10 | 11 | RUN openssl genrsa -out /etc/nginx/ssl/dummy.key 2048 12 | 13 | RUN openssl req -new -key /etc/nginx/ssl/dummy.key -out /etc/nginx/ssl/dummy.csr -subj "/C=DE" 14 | 15 | RUN openssl x509 -req -days 3650 -in /etc/nginx/ssl/dummy.csr -signkey /etc/nginx/ssl/dummy.key -out /etc/nginx/ssl/dummy.crt 16 | 17 | COPY etc/certs.crt /etc/nginx/ssl/certs.crt 18 | 19 | EXPOSE 80 443 20 | 21 | ENTRYPOINT ["nginx", "-g", "daemon off;"] 22 | 23 | -------------------------------------------------------------------------------- /alpine_nginx_snom_provisioning_rpi/Makefile: -------------------------------------------------------------------------------- 1 | NAME = voipnovatos/alpine-nginx-provisioning-snom-rpi 2 | VERSION = latest 3 | 4 | .PHONY: all build run 5 | 6 | all: build 7 | 8 | build: 9 | 10 | docker build -t $(NAME):$(VERSION) . 11 | 12 | run: 13 | 14 | docker run -dt -p 80:80 -p 443:443 --name=nginx -h "nginx.local" -v /home/pirate/xml:/var/www/localhost/htdocs voipnovatos/alpine-nginx-provisioning-snom-rpi 15 | 16 | 17 | -------------------------------------------------------------------------------- /alpine_nginx_snom_provisioning_rpi/etc/certs.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIEnzCCA4egAwIBAgIBAjANBgkqhkiG9w0BAQsFADCBljELMAkGA1UEBhMCREUx 3 | DzANBgNVBAgTBkJlcmxpbjEPMA0GA1UEBxMGQmVybGluMRswGQYDVQQKExJzbm9t 4 | IHRlY2hub2xvZ3kgQUcxJjAkBgNVBAMTHXNub20gdGVjaG5vbG9neSBBRyBTSEEt 5 | MjU2IENBMSAwHgYJKoZIhvcNAQkBFhFzZWN1cml0eUBzbm9tLmNvbTAeFw0xNjAy 6 | MTExNTE5NTJaFw0zNzEyMzExNTE5NTJaMIGNMQswCQYDVQQGEwJERTEPMA0GA1UE 7 | CBMGQmVybGluMQ8wDQYDVQQHEwZCZXJsaW4xGzAZBgNVBAoTEnNub20gdGVjaG5v 8 | bG9neSBBRzEdMBsGA1UEAxMUU25vbSBQaG9uZSAxIFNIQS0yNTYxIDAeBgkqhkiG 9 | 9w0BCQEWEXNlY3VyaXR5QHNub20uY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A 10 | MIIBCgKCAQEAw7cSn4iIjtx6yMAFQ4FGSq4bsBboct+M2s6rL0fJ8HI4AG7PH/0H 11 | 4qzJ5f8nsvUuH8UIS15Rg9R7DGnZzQLA0ZFDqS1wT83uprHmSzIwWGq3c7YIhAFR 12 | LKhz3iXb5sWPc1uh5dqW2nw0K7DNF1acPpd5EVPg8tXVW/V1zzQFnI6rJmv+jblZ 13 | y9RTyXR0vquDvMayQDR4Z8ksSy+1kGxwEpq8T+duCOs7WxSWb7KgSxmXwy7DJflt 14 | /BYbJIKbecoxGnkq4s++4LBuhdws67Tx4sdxFgGT86RqPBRqS9kQajtsiUEMv0rA 15 | tnuvIMRfZRsMa9cIerlOZIJFwnEGfj+CFQIDAQABo4H+MIH7MB0GA1UdDgQWBBTo 16 | coJBs7dgv54OiJQfSDhUA8jKgDCBywYDVR0jBIHDMIHAgBRah6FMs37vWFCm9sg5 17 | f5sZDVeB6qGBnKSBmTCBljELMAkGA1UEBhMCREUxDzANBgNVBAgTBkJlcmxpbjEP 18 | MA0GA1UEBxMGQmVybGluMRswGQYDVQQKExJzbm9tIHRlY2hub2xvZ3kgQUcxJjAk 19 | BgNVBAMTHXNub20gdGVjaG5vbG9neSBBRyBTSEEtMjU2IENBMSAwHgYJKoZIhvcN 20 | AQkBFhFzZWN1cml0eUBzbm9tLmNvbYIJAO7phqgzq0PHMAwGA1UdEwQFMAMBAf8w 21 | DQYJKoZIhvcNAQELBQADggEBAAJ10Vcsrrq/zPzQS+Lbl6uCXty7z2ftNRpWyFvq 22 | jWtUsm2z/ziDH0YOltLcYNcYD50jc9fjnZVf1A8stLOxIN1E52Z85CJwxEK11RIO 23 | Nnd/52ynCLJr6oYSQ6ArNr3SmutBYvQq7jHWkHb61VNjd8HDmGSD+/yMKsGu+vch 24 | bib8LBcB9gQAwmuwTYwXf7uYAzDthP4N0ZImDiWZSTqYa3wt+1JfYOFF8koyYEvR 25 | kPnKjq+/f/fVSedxAm8X2Px5huRg6T2EBzcaIIXbxeqAm2ukolEiAlFFxabTeqFb 26 | Oe9javHJ6UW92lewU8SfDrJCjKpWyLRZR7X3f3aA2TcvvwI= 27 | -----END CERTIFICATE----- 28 | -------------------------------------------------------------------------------- /alpine_nginx_snom_provisioning_rpi/etc/local.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name SERVER_NAME; 4 | return 301 https://$host$request_uri; 5 | } 6 | 7 | server { 8 | listen 443 ssl; 9 | server_name SERVER_NAME; 10 | 11 | ssl_certificate /etc/nginx/ssl/dummy.crt; 12 | ssl_certificate_key /etc/nginx/ssl/dummy.key; 13 | ssl_client_certificate /etc/nginx/ssl/certs.crt; 14 | ssl_ciphers ALL:-RC4+SSLv2; 15 | ssl_verify_client on; 16 | ssl_verify_depth 2; 17 | set $ssl_client_s_dn_cn ""; 18 | 19 | location / { root /var/www/localhost/htdocs; } 20 | 21 | 22 | } -------------------------------------------------------------------------------- /alpine_nginx_snom_provisioning_rpi/etc/nginx.conf: -------------------------------------------------------------------------------- 1 | 2 | user nginx; 3 | worker_processes 1; 4 | 5 | error_log /var/log/nginx/error.log warn; 6 | pid /var/run/nginx.pid; 7 | 8 | 9 | events { 10 | worker_connections 1024; 11 | } 12 | 13 | 14 | http { 15 | include /etc/nginx/mime.types; 16 | default_type application/octet-stream; 17 | 18 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 19 | '$status $body_bytes_sent "$http_referer" ' 20 | '"$http_user_agent" "$http_x_forwarded_for"'; 21 | 22 | access_log /var/log/nginx/access.log main; 23 | 24 | sendfile off; 25 | #tcp_nopush on; 26 | 27 | keepalive_timeout 65; 28 | 29 | #gzip on; 30 | 31 | 32 | include /etc/nginx/conf.d/*.conf; 33 | } 34 | -------------------------------------------------------------------------------- /asterisk_13.10.0/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | MAINTAINER Alberto Sagredo 4 | 5 | ENV build_date 2016-07-25 6 | 7 | ENV DEBIAN_FRONTEND noninteractive 8 | 9 | ENV SIP_PORT 5080 10 | 11 | ENV RTP_PORT_START 10000 12 | 13 | ENV RTP_PORT_END 10150 14 | 15 | RUN apt-get update 16 | 17 | RUN apt-get install -y build-essential openssl libxml2-dev libncurses5-dev uuid-dev sqlite3 libsqlite3-dev pkg-config curl libjansson-dev 18 | 19 | RUN curl -s http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-13.10.0.tar.gz | tar xvz 20 | 21 | WORKDIR /asterisk-13.10.0 22 | 23 | RUN ./configure; make; make install; make samples ; make config 24 | 25 | COPY conf/config.sh /root/ 26 | 27 | RUN chmod a+x /root/config.sh 28 | 29 | CMD ["/root/config.sh"] 30 | 31 | EXPOSE $SIP_PORT/udp 32 | -------------------------------------------------------------------------------- /asterisk_13.10.0/conf/config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [ -z "$ENV SIP_PORT" ]; then 6 | echo "Default SIP PORT" 7 | else 8 | echo "SIP Port changed" 9 | sed -i "s/udpbindaddr=0.0.0.0/udpbindaddr=0.0.0.0:$SIP_PORT/g" /etc/asterisk/sip.conf 10 | fi 11 | 12 | if [ -z "$ENV RTP_PORT_START" ]; then 13 | echo "Default RTP Port Start" 14 | else 15 | echo "SIP RTP Start changed" 16 | sed -i "s/rtpstart=10000/rtpstart=$RTP_PORT_START/g" /etc/asterisk/rtp.conf 17 | fi 18 | 19 | if [ -z "$ENV RTP_PORT_END" ]; then 20 | echo "Default RTP Port End" 21 | else 22 | echo "SIP RTP END changed" 23 | sed -i "s/rtpend=20000/rtpend=$RTP_PORT_END/g" /etc/asterisk/rtp.conf 24 | fi 25 | 26 | /usr/sbin/asterisk -vvvvvvv 27 | 28 | -------------------------------------------------------------------------------- /asterisk_14.0.0/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | MAINTAINER Alberto Sagredo 4 | 5 | ENV build_date 2016-09-27 6 | 7 | ENV DEBIAN_FRONTEND noninteractive 8 | 9 | ENV SIP_PORT 5080 10 | 11 | ENV RTP_PORT_START 10000 12 | 13 | ENV RTP_PORT_END 10150 14 | 15 | RUN apt-get clean && apt-get update 16 | 17 | RUN apt-get install -y build-essential openssl libxml2-dev libncurses5-dev uuid-dev sqlite3 libsqlite3-dev pkg-config curl libjansson-dev wget unzip 18 | 19 | RUN curl -s http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-14.0.0.tar.gz | tar xvz 20 | 21 | WORKDIR /asterisk-14.0.0 22 | 23 | RUN ./configure; make; make install; make samples ; make config 24 | 25 | COPY conf/config.sh /root/ 26 | 27 | RUN chmod a+x /root/config.sh 28 | 29 | CMD ["/root/config.sh"] 30 | 31 | EXPOSE $SIP_PORT/udp 32 | 33 | #CMD ["/usr/sbin/asterisk", "-vvvvvvv"] 34 | 35 | -------------------------------------------------------------------------------- /asterisk_14.0.0/build.sh: -------------------------------------------------------------------------------- 1 | echo "Building image..." 2 | docker build -t voipnovatos/asterisk-14 . 3 | -------------------------------------------------------------------------------- /asterisk_14.0.0/config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [ -z "$ENV SIP_PORT" ]; then 6 | echo "Default SIP PORT" 7 | else 8 | echo "SIP Port changed" 9 | sed -i "s/udpbindaddr=0.0.0.0/udpbindaddr=0.0.0.0:$SIP_PORT/g" /etc/asterisk/sip.conf 10 | fi 11 | 12 | if [ -z "$ENV RTP_PORT_START" ]; then 13 | echo "Default RTP Port Start" 14 | else 15 | echo "SIP RTP Start changed" 16 | sed -i "s/rtpstart=10000/rtpstart=$RTP_PORT_START/g" /etc/asterisk/rtp.conf 17 | fi 18 | 19 | if [ -z "$ENV RTP_PORT_END" ]; then 20 | echo "Default RTP Port End" 21 | else 22 | echo "SIP RTP END changed" 23 | sed -i "s/rtpend=20000/rtpend=$RTP_PORT_END/g" /etc/asterisk/rtp.conf 24 | fi 25 | 26 | /usr/sbin/asterisk -vvvvvvv 27 | 28 | -------------------------------------------------------------------------------- /asterisk_rpi_hypriot/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM resin/rpi-raspbian:jessie 2 | 3 | MAINTAINER Alberto Sagredo 4 | 5 | ENV build_date 2016-08-02 6 | 7 | ENV DEBIAN_FRONTEND noninteractive 8 | 9 | ENV SIP_PORT 5080 10 | 11 | ENV RTP_PORT_START 10000 12 | 13 | ENV RTP_PORT_END 10150 14 | 15 | RUN apt-get update 16 | 17 | RUN apt-get install -y build-essential openssl libxml2-dev libncurses5-dev uuid-dev sqlite3 libsqlite3-dev pkg-config curl libjansson-dev wget curl unzip wget 18 | 19 | RUN curl -s http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13.10.0.tar.gz | tar xvz 20 | 21 | WORKDIR /asterisk-13.10.0 22 | 23 | RUN ./configure; make; make install; make samples ; make config 24 | 25 | COPY conf/config.sh /root/ 26 | 27 | RUN chmod a+x /root/config.sh 28 | 29 | CMD ["/root/config.sh"] 30 | 31 | EXPOSE $SIP_PORT/udp 32 | 33 | #CMD ["/usr/sbin/asterisk", "-vvvvvvv"] 34 | 35 | -------------------------------------------------------------------------------- /asterisk_rpi_hypriot/conf/config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [ -z "$ENV SIP_PORT" ]; then 6 | echo "Default SIP PORT" 7 | else 8 | echo "SIP Port changed" 9 | sed -i "s/udpbindaddr=0.0.0.0/udpbindaddr=0.0.0.0:$SIP_PORT/g" /etc/asterisk/sip.conf 10 | fi 11 | 12 | if [ -z "$ENV RTP_PORT_START" ]; then 13 | echo "Default RTP Port Start" 14 | else 15 | echo "SIP RTP Start changed" 16 | sed -i "s/rtpstart=10000/rtpstart=$RTP_PORT_START/g" /etc/asterisk/rtp.conf 17 | fi 18 | 19 | if [ -z "$ENV RTP_PORT_END" ]; then 20 | echo "Default RTP Port End" 21 | else 22 | echo "SIP RTP END changed" 23 | sed -i "s/rtpend=20000/rtpend=$RTP_PORT_END/g" /etc/asterisk/rtp.conf 24 | fi 25 | 26 | /usr/sbin/asterisk -vvvvvvv 27 | 28 | -------------------------------------------------------------------------------- /kamailio_4.4.4_rpi/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM resin/rpi-raspbian:jessie 2 | 3 | MAINTAINER Alberto Sagredo 4 | 5 | ENV build_date 2016-11-08 6 | 7 | ENV DEBIAN_FRONTEND noninteractive 8 | 9 | ENV SIP_PORT 5060 10 | 11 | RUN rm -rf /var/lib/apt/lists/* 12 | 13 | RUN echo "mysql-server mysql-server/root_password password passwd" | debconf-set-selections && \ 14 | echo "mysql-server mysql-server/root_password_again password passwd" | debconf-set-selections 15 | 16 | RUN apt-get update && apt-get install --assume-yes mysql-server joe git gcc automake build-essential flex bison libncurses5-dev unixodbc-dev xsltproc libssl-dev libmysqlclient-dev make libssl-dev libcurl4-openssl-dev libxml2-dev libpcre3-dev uuid-dev libicu-dev libunistring-dev libsnmp-dev libevent-dev autoconf libtool wget libconfuse-dev libjsoncpp-dev iproute expect 17 | 18 | WORKDIR /usr/src/kamailio 19 | 20 | RUN mkdir -p /usr/local/src/kamailio-4.4 21 | 22 | RUN cd /usr/local/src/kamailio-4.4 23 | 24 | RUN git clone --depth 1 --no-single-branch git://git.kamailio.org/kamailio -b 4.4 /usr/src/kamailio 25 | 26 | WORKDIR /usr/src/kamailio 27 | 28 | RUN make cfg 29 | 30 | RUN make include_modules="presence_dialoginfo presence_reginfo pua pua_dialoginfo pua_usrloc pua_reginfo db_mysql dialplan nth presence presence_xml xml websocket tls" cfg && \ 31 | make Q=0 all && \ 32 | make install 33 | 34 | ADD conf/etc/* /usr/local/etc/kamailio/ 35 | 36 | ADD boot_run.sh /etc/ 37 | 38 | COPY create_database.sh /etc/ 39 | 40 | RUN chmod a+x /etc/create_database.sh 41 | 42 | RUN mkdir /usr/local/etc/kamailio/certs 43 | 44 | ADD conf/etc/certs/* /usr/local/etc/kamailio/certs/ 45 | 46 | #ADD conf/default/kamailio /etc/default/kamailio/ 47 | 48 | #COPY conf/default/kamailio.init /etc/init.d/kamailio 49 | 50 | #RUN chmod 755 /etc/init.d/kamailio 51 | 52 | RUN mkdir -p /var/run/kamailio 53 | 54 | EXPOSE $SIP_PORT/udp 55 | 56 | RUN chmod a+x /etc/boot_run.sh 57 | 58 | ENTRYPOINT ["/etc/boot_run.sh"] 59 | -------------------------------------------------------------------------------- /kamailio_4.4.4_rpi/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a generic Makefile. It use to build Docker images. 3 | # 4 | 5 | all: build 6 | 7 | build: 8 | @docker build -t voipnovatos/kamailio-rpi 9 | quickstart: 10 | @echo "Quick starting sample" 11 | @ddocker run -dt -p 5060:5680/udp -e ADVERTISED_IP="10.0.1.93” voipnovatos/kamailio-rpi 12 | -------------------------------------------------------------------------------- /kamailio_4.4.4_rpi/boot_run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | MYSQL_PWD=${MYSQL_PWD:-"passwd"} 5 | ADVERTISED_IP=${ADVERTISED_IP:-"127.0.0.1"} 6 | HOST_IP=$(ip route get 8.8.8.8 | awk '{print $NF; exit}') 7 | SIP_PORT=5060 8 | 9 | echo "Your IP : ${HOST_IP}" 10 | echo -e "Your Advertised IP : ${ADVERTISED_IP}\n\n" 11 | echo -e "Your Kamailio SIP Port : ${SIP_PORT}\n\n" 12 | 13 | # Starting MySQL 14 | 15 | service mysql start 16 | 17 | # Auto Create Database 18 | 19 | /etc/create_database.sh 20 | 21 | # Configure kamailio.cfg 22 | 23 | sed -i "s/alias=.*/alias=\"${ADVERTISED_IP}\"/g" /usr/local/etc/kamailio/kamailio.cfg 24 | 25 | sed -i "s/listen=.*/listen=udp:${HOST_IP}:5060 advertise ${ADVERTISED_IP}:5060/g" /usr/local/etc/kamailio/kamailio.cfg 26 | 27 | sed -i "s/port=.*/port=${SIP_PORT}/g" /usr/local/etc/kamailio/kamailio.cfg 28 | 29 | #mkdir /var/spool/rtpengine 30 | 31 | #rtpengine -p /var/run/rtpengine.pid --interface=127.0.0.1!$ADVERTISED_IP -n 127.0.0.1:60000 -c 127.0.0.1:60001 -m 20000 -M 30000 -E -L 7 32 | 33 | # Starting Kamailio process 34 | 35 | kamctl add 100 snom 36 | 37 | kamctl add 101 snom 38 | 39 | kamctl add 102 snom 40 | 41 | kamctl add 103 snom 42 | 43 | kamctl add 104 snom 44 | 45 | kamctl add 105 snom 46 | 47 | kamctl add 106 snom 48 | 49 | kamctl add 107 snom 50 | 51 | kamctl add 108 snom 52 | 53 | kamctl add 109 snom 54 | 55 | kamctl add 110 snom 56 | 57 | kamctl add 200 snom 58 | 59 | kamctl add 201 snom 60 | 61 | kamctl add 202 snom 62 | 63 | /usr/local/sbin/kamailio -DD -P/var/run/kamailio/kamailio.pid -f /usr/local/etc/kamailio/kamailio.cfg 64 | 65 | /bin/bash 66 | -------------------------------------------------------------------------------- /kamailio_4.4.4_rpi/build/modules.lst: -------------------------------------------------------------------------------- 1 | # this file is autogenerated by make modules-cfg 2 | 3 | # the list of sub-directories with modules 4 | modules_dirs:=modules 5 | 6 | # the list of module groups to compile 7 | cfg_group_include= 8 | 9 | # the list of extra modules to compile 10 | include_modules= stun outbound path uuid ctl xhttp kex tm tmx sl rr maxfwd siputils presence presence_conference presence_dialoginfo presence_mwi presence_profile presence_reginfo presence_xml websocket tls pua_dialoginfo snmpstats ctl cfg_rpc kex tm tmx sl rr maxfwd siputils sanity textops htable pv xlog mi_fifo uac uac_redirect db_text kazoo dispatcher rtimer timer sqlops 11 | 12 | # the list of static modules 13 | static_modules= 14 | 15 | # the list of modules to skip from compile list 16 | skip_modules= alias_db path corex mi_rpc async auth_diameter avpops avp benchmark blst call_control cfg_db counters db2_ops db_cluster db_flatstore debugger diversion dmq domainpolicy domain drouting enum exec group imc ipops malloc_test mangler matrix mediaproxy mi_datagram mqueue msilo msrp mtree nat_traversal pdb pdt pipelimit prefix_route print_lib print p_usrloc qos ratelimit rtpproxy sca sdpops seas sipcapture siptrace sms speeddial sst statistics tmrec topoh uid_auth_db uid_avp_db uid_domain uid_gflags uid_uri_db uri_db userblacklist xhttp_rpc xprint 17 | 18 | # the list of modules to exclude from compile list 19 | exclude_modules= acc_radius app_java app_lua app_mono app_perl app_python auth_ephemeral auth_identity auth_radius cdp cdp_avp cnxcc cpl-c crypto db2_ldap db_berkeley db_cassandra db_mongodb db_mysql db_oracle db_perlvdb db_postgres db_sqlite db_unixodbc dialplan dnssec evapi geoip geoip2 gzcompress h350 http_async_client http_client ims_auth ims_charging ims_dialog ims_icscf ims_isc ims_qos ims_registrar_pcscf ims_registrar_scscf ims_usrloc_pcscf ims_usrloc_scscf iptrtpproxy jansson janssonrpc-c json jsonrpc-c lcr ldap log_systemd memcached mi_xmlrpc misc_radius ndb_cassandra ndb_mongodb ndb_redis osp outbound peering pua pua_bla pua_dialoginfo pua_mi pua_reginfo pua_usrloc pua_xmpp purple regex rls sctp snmpstats tls utils uuid websocket xcap_client xcap_server xhttp_pi xmlops xmlrpc xmpp $(skip_modules) 20 | 21 | #enabled carrierroute erlang cfg_rpc 22 | 23 | modules_all= $(filter-out modules/CVS,$(wildcard modules/*)) 24 | modules_noinc= $(filter-out $(addprefix modules/, $(exclude_modules) $(static_modules)), $(modules_all)) 25 | modules= $(filter-out $(modules_noinc), $(addprefix modules/, $(include_modules) )) $(modules_noinc) 26 | modules_configured:=1 27 | -------------------------------------------------------------------------------- /kamailio_4.4.4_rpi/conf/default/kamailio: -------------------------------------------------------------------------------- 1 | # 2 | # Kamailio startup options 3 | # 4 | 5 | # Set to yes to enable kamailio, once configured properly. 6 | RUN_KAMAILIO=yes 7 | 8 | # User to run as 9 | #USER=kamailio 10 | 11 | # Group to run as 12 | #GROUP=kamailio 13 | 14 | # Amount of shared and private memory to allocate 15 | # for the running Kamailio server (in Mb) 16 | #SHM_MEMORY=64 17 | #PKG_MEMORY=8 18 | 19 | # Config file 20 | #CFGFILE=/etc/kamailio/kamailio.cfg 21 | 22 | # Enable the server to leave a core file when it crashes. 23 | # Set this to 'yes' to enable Kamailio to leave a core file when it crashes 24 | # or 'no' to disable this feature. This option is case sensitive and only 25 | # accepts 'yes' and 'no' and only in lowercase letters. 26 | # On some systems it is necessary to specify a directory for the core files 27 | # to get a dump. Look into the kamailio init file for an example configuration. 28 | #DUMP_CORE=yes 29 | -------------------------------------------------------------------------------- /kamailio_4.4.4_rpi/conf/default/kamailio.init: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | ### BEGIN INIT INFO 4 | # Provides: kamailio 5 | # Required-Start: $syslog $network $local_fs $remote_fs $time 6 | # Should-Start: $named slapd mysql postgresql snmpd radiusd 7 | # Should-Stop: $named slapd mysql postgresql snmpd radiusd 8 | # Required-Stop: $syslog $network $local_fs $remote_fs 9 | # Default-Start: 2 3 4 5 10 | # Default-Stop: 0 1 6 11 | # Short-Description: Start the Kamailio SIP proxy server 12 | # Description: Start the Kamailio SIP proxy server 13 | ### END INIT INFO 14 | 15 | . /lib/lsb/init-functions 16 | 17 | PATH=/sbin:/bin:/usr/sbin:/usr/bin 18 | DAEMON=/usr/local/sbin/kamailio 19 | CFGFILE=/usr/local/etc/kamailio/kamailio.cfg 20 | NAME=`basename "$0"` 21 | DESC="Kamailio SIP Server" 22 | HOMEDIR=/var/run/$NAME 23 | PIDFILE=$HOMEDIR/$NAME.pid 24 | DEFAULTS=/etc/default/$NAME 25 | RUN_KAMAILIO=no 26 | USER=kamailio 27 | GROUP=kamailio 28 | # Amount of shared and private memory to allocate 29 | # for the running Kamailio server (in Mb) 30 | SHM_MEMORY=64 31 | PKG_MEMORY=8 32 | DUMP_CORE=no 33 | 34 | # Do not start kamailio if fork=no is set in the config file 35 | # otherwise the boot process will just stop 36 | check_fork () 37 | { 38 | if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" $CFGFILE; then 39 | log_failure_msg "Not starting $DESC: fork=no specified in config file; run /etc/init.d/kamailio debug instead" 40 | exit 0 41 | fi 42 | } 43 | 44 | check_kamailio_config () 45 | { 46 | # Check if kamailio configuration is valid before starting the server 47 | set +e 48 | out=$($DAEMON -f $CFGFILE -M $PKG_MEMORY -c 2>&1 > /dev/null) 49 | retcode=$? 50 | set -e 51 | if [ "$retcode" != '0' ]; then 52 | log_failure_msg "Not starting $DESC: invalid configuration file!" 53 | log_failure_msg 54 | log_failure_msg "$out" 55 | log_failure_msg 56 | exit 1 57 | fi 58 | } 59 | 60 | create_radius_seqfile () 61 | { 62 | # Create a radius sequence file to be used by the radius client if 63 | # radius accounting is enabled. This is needed to avoid any issue 64 | # with the file not being writable if kamailio first starts as user 65 | # root because DUMP_CORE is enabled and creates this file as user 66 | # root and then later it switches back to user kamailio and cannot 67 | # write to the file. If the file exists before kamailio starts, it 68 | # won't change it's ownership and will be writable for both root 69 | # and kamailio, no matter what options are chosen at install time 70 | RADIUS_SEQ_FILE="$HOMEDIR/kamailio_radius.seq" 71 | if [ -d $HOMEDIR ]; then 72 | chown ${USER}:${GROUP} $HOMEDIR 73 | 74 | if [ ! -f $RADIUS_SEQ_FILE ]; then 75 | touch $RADIUS_SEQ_FILE 76 | fi 77 | 78 | chown ${USER}:${GROUP} $RADIUS_SEQ_FILE 79 | chmod 660 $RADIUS_SEQ_FILE 80 | fi 81 | } 82 | 83 | test -f $DAEMON || exit 0 84 | 85 | # Load startup options if available 86 | if [ -f $DEFAULTS ]; then 87 | . $DEFAULTS || true 88 | fi 89 | 90 | if [ "$RUN_KAMAILIO" != "yes" ]; then 91 | log_failure_msg "Kamailio not yet configured. Edit /etc/default/$NAME first." 92 | exit 0 93 | fi 94 | 95 | set -e 96 | 97 | SHM_MEMORY=$((`echo $SHM_MEMORY | sed -e 's/[^0-9]//g'`)) 98 | PKG_MEMORY=$((`echo $PKG_MEMORY | sed -e 's/[^0-9]//g'`)) 99 | [ -z "$USER" ] && USER=kamailio 100 | [ -z "$GROUP" ] && GROUP=kamailio 101 | [ $SHM_MEMORY -le 0 ] && SHM_MEMORY=64 102 | [ $PKG_MEMORY -le 0 ] && PKG_MEMORY=4 103 | 104 | if test "$DUMP_CORE" = "yes" ; then 105 | # set proper ulimit 106 | ulimit -c unlimited 107 | 108 | # directory for the core dump files 109 | # COREDIR=/home/corefiles 110 | # [ -d $COREDIR ] || mkdir $COREDIR 111 | # chmod 777 $COREDIR 112 | # echo "$COREDIR/core.%e.sig%s.%p" > /proc/sys/kernel/core_pattern 113 | fi 114 | 115 | # /var/run can be a tmpfs 116 | if [ ! -d $HOMEDIR ]; then 117 | mkdir -p $HOMEDIR 118 | chown ${USER}:${GROUP} $HOMEDIR 119 | fi 120 | 121 | OPTIONS="-f $CFGFILE -P $PIDFILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP" 122 | 123 | case "$1" in 124 | start|debug) 125 | check_kamailio_config 126 | create_radius_seqfile 127 | 128 | if [ "$1" != "debug" ]; then 129 | check_fork 130 | fi 131 | 132 | log_daemon_msg "Starting $DESC: $NAME" 133 | start-stop-daemon --start --quiet --pidfile $PIDFILE \ 134 | --exec $DAEMON -- $OPTIONS || log_failure_msg " already running" 135 | log_end_msg 0 136 | ;; 137 | stop) 138 | log_daemon_msg "Stopping $DESC: $NAME" 139 | start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \ 140 | --exec $DAEMON 141 | log_end_msg 0 142 | ;; 143 | restart|force-reload) 144 | check_kamailio_config 145 | create_radius_seqfile 146 | 147 | $0 stop 148 | sleep 1 149 | $0 start 150 | ;; 151 | status) 152 | log_daemon_msg "Status of $DESC: " 153 | 154 | status_of_proc -p"$PIDFILE" $NAME $NAME 155 | ;; 156 | *) 157 | N=/etc/init.d/$NAME 158 | echo "Usage: $N {start|stop|restart|force-reload|status|debug}" >&2 159 | exit 1 160 | ;; 161 | esac 162 | 163 | exit 0 164 | -------------------------------------------------------------------------------- /kamailio_4.4.4_rpi/conf/etc/certs/.placeholder: -------------------------------------------------------------------------------- 1 | ensure certs directory gets created -------------------------------------------------------------------------------- /kamailio_4.4.4_rpi/conf/etc/certs/ca.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIID3TCCAsWgAwIBAgIJAILY4WXBo089MA0GCSqGSIb3DQEBCwUAMIGEMQswCQYD 3 | VQQGEwJFUzEMMAoGA1UECAwDQkNOMRIwEAYDVQQHDAlCYXJjZWxvbmExETAPBgNV 4 | BAoMCENvemVudGljMRgwFgYDVQQDDA9zaXAuY296ZW50aWMuZXMxJjAkBgkqhkiG 5 | 9w0BCQEWF2RhdmlkLnJvZGFAY296ZW50aWMuY29tMB4XDTE2MDMxODIyNDQxMloX 6 | DTI2MDMxNjIyNDQxMlowgYQxCzAJBgNVBAYTAkVTMQwwCgYDVQQIDANCQ04xEjAQ 7 | BgNVBAcMCUJhcmNlbG9uYTERMA8GA1UECgwIQ296ZW50aWMxGDAWBgNVBAMMD3Np 8 | cC5jb3plbnRpYy5lczEmMCQGCSqGSIb3DQEJARYXZGF2aWQucm9kYUBjb3plbnRp 9 | Yy5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzyM9Xh3ser29v 10 | y/igrrYwfBHrjW5g+jaQqvjLLQDZB8s8DIj9tWI3jqSF0GXrZDWp9yjOCqkMUhpo 11 | lVFbCptSK7VUpXnS40p7bkm8FhCTrCxXKddxRT3tPd7Y758BLwREeFDYxKgkxo/9 12 | m96cRF4kMCa9dOzjk9+pSQqJC6QaJQEIIxpNZYMwQcQwdUnEtGVKg+0bIv7xQkeN 13 | yhF4ikygWcRnBExTmq/TV6mu/R6TGGEO2fxFWu4S4DQkpeScaaWuJeS0kBMn5xar 14 | V+4W7qbODKkw4XNxW56YprSZFk3EQZDUK5rdE19Dlg5xirkGTbZdbQ0nVmxtEXtx 15 | 9K5hN9AhAgMBAAGjUDBOMB0GA1UdDgQWBBSUr9/8K6s0BwVEz5SFtV90rdRzoTAf 16 | BgNVHSMEGDAWgBSUr9/8K6s0BwVEz5SFtV90rdRzoTAMBgNVHRMEBTADAQH/MA0G 17 | CSqGSIb3DQEBCwUAA4IBAQBTxkPr1VY/DsnWcA7DjiPO8bMc6IYSiFA/X8bD1dAP 18 | h5GE9FUmPbiobid1wxWGqdYs80dRAPW+ITu0Gcuq+taUvkqznsati0B99l1qNlQe 19 | 13ek8WyT6QJ7+15kZIoNWr6fht06gJRYEUL+WL7QTq6j2/xVZXEiLPIajDL8VbgC 20 | vZypGuF1gR6YCqz3nSFB3Zj6DjStcR8AM5dze+v3bTqddSuha+ajggqwysUYwfZA 21 | yv4R29MOxQVU/uJt8EPnp8X1OKZciViS48PadbZoiTIPCqDcyqI3FFxtkBbL1Syy 22 | Qr0/iFva/o7tdMBuMWisBFZCu5y6KJXMRt5i6+tswALo 23 | -----END CERTIFICATE----- 24 | -------------------------------------------------------------------------------- /kamailio_4.4.4_rpi/conf/etc/certs/req.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE REQUEST----- 2 | MIIC4zCCAcsCAQAwgYQxCzAJBgNVBAYTAkVTMQwwCgYDVQQIDANCQ04xEjAQBgNV 3 | BAcMCUJhcmNlbG9uYTERMA8GA1UECgwIQ296ZW50aWMxGDAWBgNVBAMMD3NpcC5j 4 | b3plbnRpYy5lczEmMCQGCSqGSIb3DQEJARYXZGF2aWQucm9kYUBjb3plbnRpYy5j 5 | b20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCho3UYnDnXD/Ab1iif 6 | VzxSUx7QKZz2wwerlzS3OsgCV0bYev57gu7CxxOlEdTFMM3RWOo4j/wCjvFXDDrE 7 | 3KS4At2WUkQY9NJCnJUYztR0pkqHtVXnZgT6hsdM326DP7qpho9LQnIg/f/qkesP 8 | 9LPRG7FPmXloIkEhaLX6GcWJWcabJfG8rTE5xWtWzHRqVc6c9MJc/RY5VAbzxF65 9 | I+ZY3+T8J9T+TDtI8qUFD4m7ZDzFno7xIn3z5UEuxHbj5gIVCiUE3DzJxXRWaO0/ 10 | SKdv4CK331wBFUqSJT1/dXxKZN9kmLCffE0ie4veHQcvx6U8wBFwnao6Hr1caXB/ 11 | exwbAgMBAAGgGTAXBgkqhkiG9w0BCQcxCgwIY296ZW50aWMwDQYJKoZIhvcNAQEL 12 | BQADggEBAGjO8oE/46USr39clrilvDKGThxeuPh79D5unB76MdXj71lpus1Q26iD 13 | 1fOz2pcuu6aHbUx1ZLmtNSu3RH5YJkK6QFOczA5IMklLwRAoh+z+WlKDVScr9omj 14 | fHgyfTE/lyRuMb2HhmJzvD11gEtuC7dCa80OT1hpwRna3pYSGlhGye6rFDd/VVtG 15 | cZgFSmh8/iFxalVyqo/68tosstFl80Q5NxDYyZVqAOEKqIU97HKSWVfEMvtGOVn3 16 | 7bOtoja4Uu3KCnmSndl0V/8FZGsiEsWBpi/oPXmbH7Pfz0NHG/H329kfDdTa75A+ 17 | hlFl7HOg+28xX7gc6xlAuFXTmXUP1UA= 18 | -----END CERTIFICATE REQUEST----- 19 | -------------------------------------------------------------------------------- /kamailio_4.4.4_rpi/conf/etc/dictionary.kamailio: -------------------------------------------------------------------------------- 1 | # 2 | # $Id$ 3 | # 4 | # SIP RADIUS attributes 5 | # 6 | # Proprietary indicates an attribute that hasn't 7 | # been standardized 8 | # 9 | # 10 | # NOTE: All standard (IANA registered) attributes are 11 | # defined in the default dictionary of the 12 | # radiusclient-ng library. 13 | # 14 | 15 | 16 | #### Attributes ### 17 | ATTRIBUTE Sip-Uri-User 208 string # Proprietary, auth_radius 18 | ATTRIBUTE Sip-Group 211 string # Proprietary, group_radius 19 | ATTRIBUTE Sip-Rpid 213 string # Proprietary, auth_radius 20 | ATTRIBUTE SIP-AVP 225 string # Proprietary, avp_radius 21 | 22 | ### Acct-Status-Type Values ### 23 | #VALUE Acct-Status-Type Failed 15 # RFC2866, acc 24 | 25 | ### Service-Type Values ### 26 | #VALUE Service-Type Call-Check 10 # RFC2865, uri_radius 27 | VALUE Service-Type Group-Check 12 # Proprietary, group_radius 28 | ##VALUE Service-Type Sip-Session 15 # Schulzrinne, acc, auth_radius 29 | VALUE Service-Type SIP-Caller-AVPs 30 # Proprietary, avp_radius 30 | VALUE Service-Type SIP-Callee-AVPs 31 # Proprietary, avp_radius 31 | 32 | ### Sip-Method Values ### 33 | VALUE Sip-Method Undefined 0 34 | VALUE Sip-Method Invite 1 35 | VALUE Sip-Method Cancel 2 36 | VALUE Sip-Method Ack 4 37 | VALUE Sip-Method Bye 8 38 | VALUE Sip-Method Info 16 39 | VALUE Sip-Method Options 32 40 | VALUE Sip-Method Update 64 41 | VALUE Sip-Method Register 128 42 | VALUE Sip-Method Message 256 43 | VALUE Sip-Method Subscribe 512 44 | VALUE Sip-Method Notify 1024 45 | VALUE Sip-Method Prack 2048 46 | VALUE Sip-Method Refer 4096 47 | VALUE Sip-Method Other 8192 48 | 49 | 50 | -------------------------------------------------------------------------------- /kamailio_4.4.4_rpi/conf/etc/kamailio.cfg: -------------------------------------------------------------------------------- 1 | #!KAMAILIO 2 | 3 | #!define WITH_MYSQL 4 | ##!define WITH_AUTH 5 | ##!define WITH_USRLOCDB 6 | #!define WITH_PRESENCE 7 | ##!define WITH_DEBUG 8 | # 9 | # Kamailio (OpenSER) SIP Server v4.3 - default configuration script 10 | # - web: http://www.kamailio.org 11 | # - git: http://sip-router.org 12 | # 13 | # Direct your questions about this file to: 14 | # 15 | # Refer to the Core CookBook at http://www.kamailio.org/wiki/ 16 | # for an explanation of possible statements, functions and parameters. 17 | # 18 | # Several features can be enabled using '#!define WITH_FEATURE' directives: 19 | # 20 | # *** To run in debug mode: 21 | # - define WITH_DEBUG 22 | # 23 | # *** To enable mysql: 24 | # - define WITH_MYSQL 25 | # 26 | # *** To enable authentication execute: 27 | # - enable mysql 28 | # - define WITH_AUTH 29 | # - add users using 'kamctl' 30 | # 31 | # *** To enable IP authentication execute: 32 | # - enable mysql 33 | # - enable authentication 34 | # - define WITH_IPAUTH 35 | # - add IP addresses with group id '1' to 'address' table 36 | # 37 | # *** To enable persistent user location execute: 38 | # - enable mysql 39 | # - define WITH_USRLOCDB 40 | # 41 | # *** To enable presence server execute: 42 | # - enable mysql 43 | # - define WITH_PRESENCE 44 | # 45 | # *** To enable nat traversal execute: 46 | # - define WITH_NAT 47 | # - install RTPProxy: http://www.rtpproxy.org 48 | # - start RTPProxy: 49 | # rtpproxy -l _your_public_ip_ -s udp:localhost:7722 50 | # - option for NAT SIP OPTIONS keepalives: WITH_NATSIPPING 51 | # 52 | # *** To enable PSTN gateway routing execute: 53 | # - define WITH_PSTN 54 | # - set the value of pstn.gw_ip 55 | # - check route[PSTN] for regexp routing condition 56 | # 57 | # *** To enable database aliases lookup execute: 58 | # - enable mysql 59 | # - define WITH_ALIASDB 60 | # 61 | # *** To enable speed dial lookup execute: 62 | # - enable mysql 63 | # - define WITH_SPEEDDIAL 64 | # 65 | # *** To enable multi-domain support execute: 66 | # - enable mysql 67 | # - define WITH_MULTIDOMAIN 68 | # 69 | # *** To enable TLS support execute: 70 | # - adjust CFGDIR/tls.cfg as needed 71 | # - define WITH_TLS 72 | # 73 | # *** To enable XMLRPC support execute: 74 | # - define WITH_XMLRPC 75 | # - adjust route[XMLRPC] for access policy 76 | # 77 | # *** To enable anti-flood detection execute: 78 | # - adjust pike and htable=>ipban settings as needed (default is 79 | # block if more than 16 requests in 2 seconds and ban for 300 seconds) 80 | # - define WITH_ANTIFLOOD 81 | # 82 | # *** To block 3XX redirect replies execute: 83 | # - define WITH_BLOCK3XX 84 | # 85 | # *** To enable VoiceMail routing execute: 86 | # - define WITH_VOICEMAIL 87 | # - set the value of voicemail.srv_ip 88 | # - adjust the value of voicemail.srv_port 89 | # 90 | # *** To enhance accounting execute: 91 | # - enable mysql 92 | # - define WITH_ACCDB 93 | # - add following columns to database 94 | #!ifdef ACCDB_COMMENT 95 | ALTER TABLE acc ADD COLUMN src_user VARCHAR(64) NOT NULL DEFAULT ''; 96 | ALTER TABLE acc ADD COLUMN src_domain VARCHAR(128) NOT NULL DEFAULT ''; 97 | ALTER TABLE acc ADD COLUMN src_ip varchar(64) NOT NULL default ''; 98 | ALTER TABLE acc ADD COLUMN dst_ouser VARCHAR(64) NOT NULL DEFAULT ''; 99 | ALTER TABLE acc ADD COLUMN dst_user VARCHAR(64) NOT NULL DEFAULT ''; 100 | ALTER TABLE acc ADD COLUMN dst_domain VARCHAR(128) NOT NULL DEFAULT ''; 101 | ALTER TABLE missed_calls ADD COLUMN src_user VARCHAR(64) NOT NULL DEFAULT ''; 102 | ALTER TABLE missed_calls ADD COLUMN src_domain VARCHAR(128) NOT NULL DEFAULT ''; 103 | ALTER TABLE missed_calls ADD COLUMN src_ip varchar(64) NOT NULL default ''; 104 | ALTER TABLE missed_calls ADD COLUMN dst_ouser VARCHAR(64) NOT NULL DEFAULT ''; 105 | ALTER TABLE missed_calls ADD COLUMN dst_user VARCHAR(64) NOT NULL DEFAULT ''; 106 | ALTER TABLE missed_calls ADD COLUMN dst_domain VARCHAR(128) NOT NULL DEFAULT ''; 107 | #!endif 108 | 109 | ####### Include Local Config If Exists ######### 110 | import_file "kamailio-local.cfg" 111 | 112 | ####### Defined Values ######### 113 | 114 | # *** Value defines - IDs used later in config 115 | #!ifdef WITH_MYSQL 116 | # - database URL - used to connect to database server by modules such 117 | # as: auth_db, acc, usrloc, a.s.o. 118 | #!ifndef DBURL 119 | #!define DBURL "mysql://kamailio:kamailiorw@localhost/kamailio" 120 | #!endif 121 | #!endif 122 | #!ifdef WITH_MULTIDOMAIN 123 | # - the value for 'use_domain' parameters 124 | #!define MULTIDOMAIN 1 125 | #!else 126 | #!define MULTIDOMAIN 0 127 | #!endif 128 | 129 | # - flags 130 | # FLT_ - per transaction (message) flags 131 | # FLB_ - per branch flags 132 | #!define FLT_ACC 1 133 | #!define FLT_ACCMISSED 2 134 | #!define FLT_ACCFAILED 3 135 | #!define FLT_NATS 5 136 | #!define FLT_DLG 9 137 | #!define FLT_DLGINFO 10 138 | 139 | #!define FLB_NATB 6 140 | #!define FLB_NATSIPPING 7 141 | 142 | ####### Global Parameters ######### 143 | 144 | ### LOG Levels: 3=DBG, 2=INFO, 1=NOTICE, 0=WARN, -1=ERR 145 | #!ifdef WITH_DEBUG 146 | debug=4 147 | log_stderror=yes 148 | #!else 149 | debug=2 150 | log_stderror=no 151 | #!endif 152 | 153 | memdbg=5 154 | memlog=5 155 | 156 | log_facility=LOG_LOCAL0 157 | 158 | fork=yes 159 | children=2 160 | 161 | /* uncomment the next line to disable TCP (default on) */ 162 | #disable_tcp=yes 163 | 164 | /* uncomment the next line to disable the auto discovery of local aliases 165 | based on reverse DNS on IPs (default on) */ 166 | #auto_aliases=no 167 | 168 | /* add local domain aliases */ 169 | alias="127.0.0.1" 170 | 171 | /* uncomment and configure the following line if you want Kamailio to 172 | bind on a specific interface/port/proto (default bind on all available) */ 173 | 174 | listen=udp:127.0.0.1:5060 175 | 176 | /* port to listen to */ 177 | port=5060 178 | 179 | 180 | #!ifdef WITH_TLS 181 | enable_tls=yes 182 | #!endif 183 | 184 | # life time of TCP connection when there is no traffic 185 | # - a bit higher than registration expires to cope with UA behind NAT 186 | tcp_connection_lifetime=3605 187 | 188 | ####### Custom Parameters ######### 189 | 190 | # These parameters can be modified runtime via RPC interface 191 | # - see the documentation of 'cfg_rpc' module. 192 | # 193 | # Format: group.id = value 'desc' description 194 | # Access: $sel(cfg_get.group.id) or @cfg_get.group.id 195 | # 196 | 197 | #!ifdef WITH_PSTN 198 | # PSTN GW Routing 199 | # 200 | # - pstn.gw_ip: valid IP or hostname as string value, example: 201 | # pstn.gw_ip = "10.0.0.101" desc "My PSTN GW Address" 202 | # 203 | # - by default is empty to avoid misrouting 204 | pstn.gw_ip = "" desc "PSTN GW Address" 205 | pstn.gw_port = "" desc "PSTN GW Port" 206 | #!endif 207 | 208 | #!ifdef WITH_VOICEMAIL 209 | # VoiceMail Routing on offline, busy or no answer 210 | # 211 | # - by default Voicemail server IP is empty to avoid misrouting 212 | voicemail.srv_ip = "" desc "VoiceMail IP Address" 213 | voicemail.srv_port = "5060" desc "VoiceMail Port" 214 | #!endif 215 | 216 | ####### Modules Section ######## 217 | 218 | # set paths to location of modules (to sources or installation folders) 219 | #!ifdef WITH_SRCPATH 220 | mpath="modules/" 221 | #!else 222 | mpath="/usr/local/lib/kamailio/modules/" 223 | #!endif 224 | 225 | #!ifdef WITH_MYSQL 226 | loadmodule "db_mysql.so" 227 | #!endif 228 | 229 | loadmodule "mi_fifo.so" 230 | loadmodule "kex.so" 231 | loadmodule "corex.so" 232 | loadmodule "tm.so" 233 | loadmodule "tmx.so" 234 | loadmodule "sl.so" 235 | loadmodule "rr.so" 236 | loadmodule "pv.so" 237 | loadmodule "maxfwd.so" 238 | loadmodule "usrloc.so" 239 | loadmodule "registrar.so" 240 | loadmodule "textops.so" 241 | loadmodule "siputils.so" 242 | loadmodule "xlog.so" 243 | loadmodule "sanity.so" 244 | loadmodule "ctl.so" 245 | loadmodule "cfg_rpc.so" 246 | loadmodule "mi_rpc.so" 247 | loadmodule "acc.so" 248 | 249 | #!ifdef WITH_AUTH 250 | loadmodule "auth.so" 251 | loadmodule "auth_db.so" 252 | #!ifdef WITH_IPAUTH 253 | loadmodule "permissions.so" 254 | #!endif 255 | #!endif 256 | 257 | #!ifdef WITH_ALIASDB 258 | loadmodule "alias_db.so" 259 | #!endif 260 | 261 | #!ifdef WITH_SPEEDDIAL 262 | loadmodule "speeddial.so" 263 | #!endif 264 | 265 | #!ifdef WITH_MULTIDOMAIN 266 | loadmodule "domain.so" 267 | #!endif 268 | 269 | #!ifdef WITH_PRESENCE 270 | loadmodule "presence.so" 271 | loadmodule "presence_xml.so" 272 | loadmodule "presence_dialoginfo.so" 273 | loadmodule "pua.so" 274 | loadmodule "pua_dialoginfo.so" 275 | 276 | #!endif 277 | 278 | #!ifdef WITH_NAT 279 | loadmodule "nathelper.so" 280 | loadmodule "rtpproxy.so" 281 | #!endif 282 | 283 | #!ifdef WITH_TLS 284 | loadmodule "tls.so" 285 | #!endif 286 | 287 | #!ifdef WITH_ANTIFLOOD 288 | loadmodule "htable.so" 289 | loadmodule "pike.so" 290 | #!endif 291 | 292 | #!ifdef WITH_XMLRPC 293 | loadmodule "xmlrpc.so" 294 | #!endif 295 | 296 | #!ifdef WITH_DEBUG 297 | loadmodule "debugger.so" 298 | #!endif 299 | 300 | loadmodule "dialog.so" 301 | 302 | # ----------------- setting module-specific parameters --------------- 303 | 304 | 305 | # ----- mi_fifo params ----- 306 | modparam("mi_fifo", "fifo_name", "/var/run/kamailio/kamailio_fifo") 307 | 308 | # ----- tm params ----- 309 | # auto-discard branches from previous serial forking leg 310 | modparam("tm", "failure_reply_mode", 3) 311 | # default retransmission timeout: 30sec 312 | modparam("tm", "fr_timer", 30000) 313 | # default invite retransmission timeout after 1xx: 120sec 314 | modparam("tm", "fr_inv_timer", 120000) 315 | 316 | 317 | # ----- rr params ----- 318 | # set next param to 1 to add value to ;lr param (helps with some UAs) 319 | modparam("rr", "enable_full_lr", 0) 320 | # do not append from tag to the RR (no need for this script) 321 | modparam("rr", "append_fromtag", 0) 322 | 323 | 324 | # ----- registrar params ----- 325 | modparam("registrar", "method_filtering", 1) 326 | /* uncomment the next line to disable parallel forking via location */ 327 | # modparam("registrar", "append_branches", 0) 328 | /* uncomment the next line not to allow more than 10 contacts per AOR */ 329 | #modparam("registrar", "max_contacts", 10) 330 | # max value for expires of registrations 331 | modparam("registrar", "max_expires", 3600) 332 | # set it to 1 to enable GRUU 333 | modparam("registrar", "gruu_enabled", 0) 334 | 335 | 336 | # ----- acc params ----- 337 | /* what special events should be accounted ? */ 338 | modparam("acc", "early_media", 0) 339 | modparam("acc", "report_ack", 0) 340 | modparam("acc", "report_cancels", 0) 341 | /* by default ww do not adjust the direct of the sequential requests. 342 | if you enable this parameter, be sure the enable "append_fromtag" 343 | in "rr" module */ 344 | modparam("acc", "detect_direction", 0) 345 | /* account triggers (flags) */ 346 | modparam("acc", "log_flag", FLT_ACC) 347 | modparam("acc", "log_missed_flag", FLT_ACCMISSED) 348 | modparam("acc", "log_extra", 349 | "src_user=$fU;src_domain=$fd;src_ip=$si;" 350 | "dst_ouser=$tU;dst_user=$rU;dst_domain=$rd") 351 | modparam("acc", "failed_transaction_flag", FLT_ACCFAILED) 352 | /* enhanced DB accounting */ 353 | #!ifdef WITH_ACCDB 354 | modparam("acc", "db_flag", FLT_ACC) 355 | modparam("acc", "db_missed_flag", FLT_ACCMISSED) 356 | modparam("acc", "db_url", DBURL) 357 | modparam("acc", "db_extra", 358 | "src_user=$fU;src_domain=$fd;src_ip=$si;" 359 | "dst_ouser=$tU;dst_user=$rU;dst_domain=$rd") 360 | #!endif 361 | 362 | 363 | # ----- usrloc params ----- 364 | /* enable DB persistency for location entries */ 365 | #!ifdef WITH_USRLOCDB 366 | modparam("usrloc", "db_url", DBURL) 367 | modparam("usrloc", "db_mode", 2) 368 | modparam("usrloc", "use_domain", MULTIDOMAIN) 369 | #!endif 370 | 371 | 372 | # ----- auth_db params ----- 373 | #!ifdef WITH_AUTH 374 | modparam("auth_db", "db_url", DBURL) 375 | modparam("auth_db", "calculate_ha1", yes) 376 | modparam("auth_db", "password_column", "password") 377 | modparam("auth_db", "load_credentials", "") 378 | modparam("auth_db", "use_domain", MULTIDOMAIN) 379 | 380 | # ----- permissions params ----- 381 | #!ifdef WITH_IPAUTH 382 | modparam("permissions", "db_url", DBURL) 383 | modparam("permissions", "db_mode", 1) 384 | #!endif 385 | 386 | #!endif 387 | 388 | 389 | # ----- alias_db params ----- 390 | #!ifdef WITH_ALIASDB 391 | modparam("alias_db", "db_url", DBURL) 392 | modparam("alias_db", "use_domain", MULTIDOMAIN) 393 | #!endif 394 | 395 | 396 | # ----- speeddial params ----- 397 | #!ifdef WITH_SPEEDDIAL 398 | modparam("speeddial", "db_url", DBURL) 399 | modparam("speeddial", "use_domain", MULTIDOMAIN) 400 | #!endif 401 | 402 | 403 | # ----- domain params ----- 404 | #!ifdef WITH_MULTIDOMAIN 405 | modparam("domain", "db_url", DBURL) 406 | # register callback to match myself condition with domains list 407 | modparam("domain", "register_myself", 1) 408 | #!endif 409 | 410 | 411 | #!ifdef WITH_PRESENCE 412 | # ----- presence params ----- 413 | modparam("presence", "db_url", DBURL) 414 | #modparam("presence", "server_address", "sip:10.0.1.93:5060" ) 415 | modparam("presence", "send_fast_notify", 0) 416 | modparam("presence", "db_update_period", 20) 417 | modparam("presence", "clean_period", 40) 418 | modparam("presence", "subs_db_mode", 2) 419 | modparam("presence", "fetch_rows", 1000) 420 | 421 | # ----- presence_xml params ----- 422 | modparam("presence_xml", "db_url", DBURL) 423 | modparam("presence_xml", "force_active", 1) 424 | 425 | # ----- presence_dialoginfo params ----- 426 | modparam("presence_dialoginfo", "force_single_dialog", 0) 427 | 428 | # ----- pua params ----- 429 | modparam("pua", "db_url", DBURL) 430 | modparam("pua", "db_mode", 2) 431 | modparam("pua", "update_period", 60) 432 | modparam("pua", "dlginfo_increase_version", 0) 433 | modparam("pua", "reginfo_increase_version", 0) 434 | modparam("pua", "check_remote_contact", 1) 435 | modparam("pua", "fetch_rows", 1000) 436 | 437 | # ----- pua_dialoginfo params ----- 438 | modparam("pua_dialoginfo", "include_callid", 1) 439 | modparam("pua_dialoginfo", "send_publish_flag", FLT_DLGINFO) 440 | modparam("pua_dialoginfo", "caller_confirmed", 0) 441 | modparam("pua_dialoginfo", "include_tags", 1) 442 | modparam("pua_dialoginfo", "override_lifetime", 124) 443 | 444 | #!endif 445 | 446 | # ----- dialog params ----- 447 | modparam("dialog", "db_url", DBURL) 448 | modparam("dialog", "enable_stats", 1) 449 | modparam("dialog", "db_mode", 1) 450 | modparam("dialog", "dlg_flag", FLT_DLG) 451 | 452 | #!ifdef WITH_NAT 453 | # ----- rtpproxy params ----- 454 | modparam("rtpproxy", "rtpproxy_sock", "udp:127.0.0.1:7722") 455 | 456 | # ----- nathelper params ----- 457 | modparam("nathelper", "natping_interval", 30) 458 | modparam("nathelper", "ping_nated_only", 1) 459 | modparam("nathelper", "sipping_bflag", FLB_NATSIPPING) 460 | modparam("nathelper", "sipping_from", "sip:pinger@kamailio.org") 461 | 462 | # params needed for NAT traversal in other modules 463 | modparam("nathelper|registrar", "received_avp", "$avp(RECEIVED)") 464 | modparam("usrloc", "nat_bflag", FLB_NATB) 465 | #!endif 466 | 467 | 468 | #!ifdef WITH_TLS 469 | # ----- tls params ----- 470 | modparam("tls", "config", "/usr/local/etc/kamailio/tls.cfg") 471 | #!endif 472 | 473 | #!ifdef WITH_ANTIFLOOD 474 | # ----- pike params ----- 475 | modparam("pike", "sampling_time_unit", 2) 476 | modparam("pike", "reqs_density_per_unit", 16) 477 | modparam("pike", "remove_latency", 4) 478 | 479 | # ----- htable params ----- 480 | # ip ban htable with autoexpire after 5 minutes 481 | modparam("htable", "htable", "ipban=>size=8;autoexpire=300;") 482 | #!endif 483 | 484 | #!ifdef WITH_XMLRPC 485 | # ----- xmlrpc params ----- 486 | modparam("xmlrpc", "route", "XMLRPC"); 487 | modparam("xmlrpc", "url_match", "^/RPC") 488 | #!endif 489 | 490 | #!ifdef WITH_DEBUG 491 | # ----- debugger params ----- 492 | modparam("debugger", "cfgtrace", 1) 493 | modparam("debugger", "log_level_name", "exec") 494 | #!endif 495 | 496 | ####### Routing Logic ######## 497 | 498 | 499 | # Main SIP request routing logic 500 | # - processing of any incoming SIP request starts with this route 501 | # - note: this is the same as route { ... } 502 | request_route { 503 | 504 | # per request initial checks 505 | route(REQINIT); 506 | 507 | # NAT detection 508 | route(NATDETECT); 509 | 510 | # CANCEL processing 511 | if (is_method("CANCEL")) { 512 | if (t_check_trans()) { 513 | route(RELAY); 514 | } 515 | exit; 516 | } 517 | 518 | # handle requests within SIP dialogs 519 | route(WITHINDLG); 520 | 521 | ### only initial requests (no To tag) 522 | 523 | # handle retransmissions 524 | if(t_precheck_trans()) { 525 | t_check_trans(); 526 | exit; 527 | } 528 | t_check_trans(); 529 | 530 | # authentication 531 | route(AUTH); 532 | 533 | # record routing for dialog forming requests (in case they are routed) 534 | # - remove preloaded route headers 535 | remove_hf("Route"); 536 | if (is_method("INVITE|SUBSCRIBE")) 537 | record_route(); 538 | 539 | # account only INVITEs 540 | if (is_method("INVITE")) { 541 | setflag(FLT_ACC); # do accounting 542 | } 543 | 544 | # dispatch requests to foreign domains 545 | route(SIPOUT); 546 | 547 | ### requests for my local domains 548 | 549 | # handle presence related requests 550 | route(PRESENCE); 551 | 552 | # handle registrations 553 | route(REGISTRAR); 554 | 555 | if ($rU==$null) { 556 | # request with no Username in RURI 557 | sl_send_reply("484","Address Incomplete"); 558 | exit; 559 | } 560 | 561 | # dispatch destinations to PSTN 562 | route(PSTN); 563 | 564 | # user location service 565 | route(LOCATION); 566 | } 567 | 568 | # Wrapper for relaying requests 569 | route[RELAY] { 570 | 571 | # enable additional event routes for forwarded requests 572 | # - serial forking, RTP relaying handling, a.s.o. 573 | if (is_method("INVITE|BYE|SUBSCRIBE|UPDATE")) { 574 | if(!t_is_set("branch_route")) t_on_branch("MANAGE_BRANCH"); 575 | } 576 | if (is_method("INVITE|SUBSCRIBE|UPDATE")) { 577 | if(!t_is_set("onreply_route")) t_on_reply("MANAGE_REPLY"); 578 | } 579 | if (is_method("INVITE")) { 580 | if(!t_is_set("failure_route")) t_on_failure("MANAGE_FAILURE"); 581 | } 582 | 583 | if(is_method("INVITE|BYE|UPDATE|CANCEL|ACK")) { 584 | setflag(FLT_DLGINFO); 585 | dlg_manage(); 586 | } 587 | 588 | if (!t_relay()) { 589 | sl_reply_error(); 590 | } 591 | exit; 592 | } 593 | 594 | # Per SIP request initial checks 595 | route[REQINIT] { 596 | #!ifdef WITH_ANTIFLOOD 597 | # flood dection from same IP and traffic ban for a while 598 | # be sure you exclude checking trusted peers, such as pstn gateways 599 | # - local host excluded (e.g., loop to self) 600 | if(src_ip!=myself) { 601 | if($sht(ipban=>$si)!=$null) { 602 | # ip is already blocked 603 | xdbg("request from blocked IP - $rm from $fu (IP:$si:$sp)\n"); 604 | exit; 605 | } 606 | if (!pike_check_req()) { 607 | xlog("L_ALERT","ALERT: pike blocking $rm from $fu (IP:$si:$sp)\n"); 608 | $sht(ipban=>$si) = 1; 609 | exit; 610 | } 611 | } 612 | if($ua =~ "friendly-scanner") { 613 | sl_send_reply("200", "OK"); 614 | exit; 615 | } 616 | #!endif 617 | 618 | if (!mf_process_maxfwd_header("10")) { 619 | sl_send_reply("483","Too Many Hops"); 620 | exit; 621 | } 622 | 623 | if(is_method("OPTIONS") && uri==myself && $rU==$null) { 624 | sl_send_reply("200","Keepalive"); 625 | exit; 626 | } 627 | 628 | if(!sanity_check("1511", "7")) { 629 | xlog("Malformed SIP message from $si:$sp\n"); 630 | exit; 631 | } 632 | } 633 | 634 | # Handle requests within SIP dialogs 635 | route[WITHINDLG] { 636 | if (!has_totag()) return; 637 | 638 | # sequential request withing a dialog should 639 | # take the path determined by record-routing 640 | if (loose_route()) { 641 | route(DLGURI); 642 | if (is_method("BYE")) { 643 | setflag(FLT_ACC); # do accounting ... 644 | setflag(FLT_ACCFAILED); # ... even if the transaction fails 645 | } 646 | else if ( is_method("ACK") ) { 647 | # ACK is forwarded statelessy 648 | route(NATMANAGE); 649 | } 650 | else if ( is_method("NOTIFY") ) { 651 | # Add Record-Route for in-dialog NOTIFY as per RFC 6665. 652 | record_route(); 653 | } 654 | route(RELAY); 655 | exit; 656 | } 657 | 658 | if (is_method("SUBSCRIBE") && uri == myself) { 659 | # in-dialog subscribe requests 660 | route(PRESENCE); 661 | exit; 662 | } 663 | if ( is_method("ACK") ) { 664 | if ( t_check_trans() ) { 665 | # no loose-route, but stateful ACK; 666 | # must be an ACK after a 487 667 | # or e.g. 404 from upstream server 668 | route(RELAY); 669 | exit; 670 | } else { 671 | # ACK without matching transaction ... ignore and discard 672 | exit; 673 | } 674 | } 675 | sl_send_reply("404","Not here"); 676 | exit; 677 | } 678 | 679 | # Handle SIP registrations 680 | route[REGISTRAR] { 681 | if (!is_method("REGISTER")) return; 682 | 683 | if(isflagset(FLT_NATS)) { 684 | setbflag(FLB_NATB); 685 | #!ifdef WITH_NATSIPPING 686 | # do SIP NAT pinging 687 | setbflag(FLB_NATSIPPING); 688 | #!endif 689 | } 690 | if (!save("location")) 691 | sl_reply_error(); 692 | exit; 693 | } 694 | 695 | # User location service 696 | route[LOCATION] { 697 | 698 | #!ifdef WITH_SPEEDDIAL 699 | # search for short dialing - 2-digit extension 700 | if($rU=~"^[0-9][0-9]$") 701 | if(sd_lookup("speed_dial")) 702 | route(SIPOUT); 703 | #!endif 704 | 705 | #!ifdef WITH_ALIASDB 706 | # search in DB-based aliases 707 | if(alias_db_lookup("dbaliases")) 708 | route(SIPOUT); 709 | #!endif 710 | 711 | $avp(oexten) = $rU; 712 | if (!lookup("location")) { 713 | $var(rc) = $rc; 714 | route(TOVOICEMAIL); 715 | t_newtran(); 716 | switch ($var(rc)) { 717 | case -1: 718 | case -3: 719 | send_reply("404", "Not Found"); 720 | exit; 721 | case -2: 722 | send_reply("405", "Method Not Allowed"); 723 | exit; 724 | } 725 | } 726 | 727 | # when routing via usrloc, log the missed calls also 728 | if (is_method("INVITE")) { 729 | setflag(FLT_ACCMISSED); 730 | } 731 | 732 | route(RELAY); 733 | exit; 734 | } 735 | 736 | # Presence server processing 737 | route[PRESENCE] { 738 | if(!is_method("PUBLISH|SUBSCRIBE")) 739 | return; 740 | 741 | if(is_method("SUBSCRIBE") && $hdr(Event)=="message-summary") { 742 | route(TOVOICEMAIL); 743 | # returns here if no voicemail server is configured 744 | sl_send_reply("404", "No voicemail service"); 745 | exit; 746 | } 747 | 748 | #!ifdef WITH_PRESENCE 749 | if (!t_newtran()) { 750 | sl_reply_error(); 751 | exit; 752 | } 753 | 754 | if(is_method("PUBLISH")) { 755 | handle_publish(); 756 | t_release(); 757 | } else if(is_method("SUBSCRIBE")) { 758 | handle_subscribe(); 759 | t_release(); 760 | } 761 | exit; 762 | #!endif 763 | 764 | # if presence enabled, this part will not be executed 765 | if (is_method("PUBLISH") || $rU==$null) { 766 | sl_send_reply("404", "Not here"); 767 | exit; 768 | } 769 | return; 770 | } 771 | 772 | # IP authorization and user uthentication 773 | route[AUTH] { 774 | #!ifdef WITH_AUTH 775 | 776 | #!ifdef WITH_IPAUTH 777 | if((!is_method("REGISTER")) && allow_source_address()) { 778 | # source IP allowed 779 | return; 780 | } 781 | #!endif 782 | 783 | if (is_method("REGISTER") || from_uri==myself) 784 | { 785 | # authenticate requests 786 | if (!auth_check("$fd", "subscriber", "1")) { 787 | auth_challenge("$fd", "0"); 788 | exit; 789 | } 790 | # user authenticated - remove auth header 791 | if(!is_method("REGISTER|PUBLISH")) 792 | consume_credentials(); 793 | } 794 | # if caller is not local subscriber, then check if it calls 795 | # a local destination, otherwise deny, not an open relay here 796 | if (from_uri!=myself && uri!=myself) { 797 | sl_send_reply("403","Not relaying"); 798 | exit; 799 | } 800 | 801 | #!endif 802 | return; 803 | } 804 | 805 | # Caller NAT detection 806 | route[NATDETECT] { 807 | #!ifdef WITH_NAT 808 | force_rport(); 809 | if (nat_uac_test("19")) { 810 | if (is_method("REGISTER")) { 811 | fix_nated_register(); 812 | } else { 813 | if(is_first_hop()) 814 | set_contact_alias(); 815 | } 816 | setflag(FLT_NATS); 817 | } 818 | #!endif 819 | return; 820 | } 821 | 822 | # RTPProxy control and singaling updates for NAT traversal 823 | route[NATMANAGE] { 824 | #!ifdef WITH_NAT 825 | if (is_request()) { 826 | if(has_totag()) { 827 | if(check_route_param("nat=yes")) { 828 | setbflag(FLB_NATB); 829 | } 830 | } 831 | } 832 | if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB))) 833 | return; 834 | 835 | rtpproxy_manage("co"); 836 | 837 | if (is_request()) { 838 | if (!has_totag()) { 839 | if(t_is_branch_route()) { 840 | add_rr_param(";nat=yes"); 841 | } 842 | } 843 | } 844 | if (is_reply()) { 845 | if(isbflagset(FLB_NATB)) { 846 | if(is_first_hop()) 847 | set_contact_alias(); 848 | } 849 | } 850 | #!endif 851 | return; 852 | } 853 | 854 | # URI update for dialog requests 855 | route[DLGURI] { 856 | #!ifdef WITH_NAT 857 | if(!isdsturiset()) { 858 | handle_ruri_alias(); 859 | } 860 | #!endif 861 | return; 862 | } 863 | 864 | # Routing to foreign domains 865 | route[SIPOUT] { 866 | if (uri==myself) return; 867 | 868 | append_hf("P-hint: outbound\r\n"); 869 | route(RELAY); 870 | exit; 871 | } 872 | 873 | # PSTN GW routing 874 | route[PSTN] { 875 | #!ifdef WITH_PSTN 876 | # check if PSTN GW IP is defined 877 | if (strempty($sel(cfg_get.pstn.gw_ip))) { 878 | xlog("SCRIPT: PSTN rotuing enabled but pstn.gw_ip not defined\n"); 879 | return; 880 | } 881 | 882 | # route to PSTN dialed numbers starting with '+' or '00' 883 | # (international format) 884 | # - update the condition to match your dialing rules for PSTN routing 885 | if(!($rU=~"^(\+|00)[1-9][0-9]{3,20}$")) 886 | return; 887 | 888 | # only local users allowed to call 889 | if(from_uri!=myself) { 890 | sl_send_reply("403", "Not Allowed"); 891 | exit; 892 | } 893 | 894 | if (strempty($sel(cfg_get.pstn.gw_port))) { 895 | $ru = "sip:" + $rU + "@" + $sel(cfg_get.pstn.gw_ip); 896 | } else { 897 | $ru = "sip:" + $rU + "@" + $sel(cfg_get.pstn.gw_ip) + ":" 898 | + $sel(cfg_get.pstn.gw_port); 899 | } 900 | 901 | route(RELAY); 902 | exit; 903 | #!endif 904 | 905 | return; 906 | } 907 | 908 | # XMLRPC routing 909 | #!ifdef WITH_XMLRPC 910 | route[XMLRPC] { 911 | # allow XMLRPC from localhost 912 | if ((method=="POST" || method=="GET") 913 | && (src_ip==127.0.0.1)) { 914 | # close connection only for xmlrpclib user agents (there is a bug in 915 | # xmlrpclib: it waits for EOF before interpreting the response). 916 | if ($hdr(User-Agent) =~ "xmlrpclib") 917 | set_reply_close(); 918 | set_reply_no_connect(); 919 | dispatch_rpc(); 920 | exit; 921 | } 922 | send_reply("403", "Forbidden"); 923 | exit; 924 | } 925 | #!endif 926 | 927 | # Routing to voicemail server 928 | route[TOVOICEMAIL] { 929 | #!ifdef WITH_VOICEMAIL 930 | if(!is_method("INVITE|SUBSCRIBE")) 931 | return; 932 | 933 | # check if VoiceMail server IP is defined 934 | if (strempty($sel(cfg_get.voicemail.srv_ip))) { 935 | xlog("SCRIPT: VoiceMail rotuing enabled but IP not defined\n"); 936 | return; 937 | } 938 | if(is_method("INVITE")) { 939 | if($avp(oexten)==$null) 940 | return; 941 | $ru = "sip:" + $avp(oexten) + "@" + $sel(cfg_get.voicemail.srv_ip) 942 | + ":" + $sel(cfg_get.voicemail.srv_port); 943 | } else { 944 | if($rU==$null) 945 | return; 946 | $ru = "sip:" + $rU + "@" + $sel(cfg_get.voicemail.srv_ip) 947 | + ":" + $sel(cfg_get.voicemail.srv_port); 948 | } 949 | route(RELAY); 950 | exit; 951 | #!endif 952 | 953 | return; 954 | } 955 | 956 | # Manage outgoing branches 957 | branch_route[MANAGE_BRANCH] { 958 | xdbg("new branch [$T_branch_idx] to $ru\n"); 959 | route(NATMANAGE); 960 | } 961 | 962 | # Manage incoming replies 963 | onreply_route[MANAGE_REPLY] { 964 | xdbg("incoming reply\n"); 965 | if(status=~"[12][0-9][0-9]") 966 | route(NATMANAGE); 967 | } 968 | 969 | # Manage failure routing cases 970 | failure_route[MANAGE_FAILURE] { 971 | route(NATMANAGE); 972 | 973 | if (t_is_canceled()) { 974 | exit; 975 | } 976 | 977 | #!ifdef WITH_BLOCK3XX 978 | # block call redirect based on 3xx replies. 979 | if (t_check_status("3[0-9][0-9]")) { 980 | t_reply("404","Not found"); 981 | exit; 982 | } 983 | #!endif 984 | 985 | #!ifdef WITH_VOICEMAIL 986 | # serial forking 987 | # - route to voicemail on busy or no answer (timeout) 988 | if (t_check_status("486|408")) { 989 | $du = $null; 990 | route(TOVOICEMAIL); 991 | exit; 992 | } 993 | #!endif 994 | } -------------------------------------------------------------------------------- /kamailio_4.4.4_rpi/conf/etc/kamctlrc: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | # 3 | # The Kamailio configuration file for the control tools. 4 | # 5 | # Here you can set variables used in the kamctl and kamdbctl setup 6 | # scripts. Per default all variables here are commented out, the control tools 7 | # will use their internal default values. 8 | 9 | ## your SIP domain 10 | #SIP_DOMAIN=10.0.100.26 11 | 12 | ## chrooted directory 13 | # $CHROOT_DIR="/path/to/chrooted/directory" 14 | 15 | ## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, DBTEXT, or SQLITE 16 | # by default none is loaded 17 | # 18 | # If you want to setup a database with kamdbctl, you must at least specify 19 | # this parameter. 20 | 21 | DBENGINE=MYSQL 22 | 23 | ## database host 24 | 25 | DBHOST=127.0.0.1 26 | 27 | ## database name (for ORACLE this is TNS name) 28 | DBNAME=kamailio 29 | 30 | # database path used by dbtext, db_berkeley or sqlite 31 | # DB_PATH="/usr/local/etc/kamailio/dbtext" 32 | 33 | ## database read/write user 34 | 35 | DBRWUSER="kamailio" 36 | 37 | ## password for database read/write user 38 | DBRWPW="kamailiorw" 39 | 40 | ## database read only user 41 | DBROUSER="kamailioro" 42 | 43 | ## password for database read only user 44 | DBROPW="kamailioro" 45 | 46 | ## database access host (from where is kamctl used) 47 | # DBACCESSHOST=192.168.0.1 48 | 49 | ## database super user (for ORACLE this is 'scheme-creator' user) 50 | DBROOTUSER="root" 51 | 52 | # user name column 53 | # USERCOL="username" 54 | 55 | 56 | # SQL definitions 57 | # If you change this definitions here, then you must change them 58 | # in db/schema/entities.xml too. 59 | # FIXME 60 | 61 | # FOREVER="2030-05-28 21:32:15" 62 | # DEFAULT_Q="1.0" 63 | 64 | 65 | # Program to calculate a message-digest fingerprint 66 | # MD5="md5sum" 67 | 68 | # awk tool 69 | # AWK="awk" 70 | 71 | # gdb tool 72 | # GDB="gdb" 73 | 74 | # If you use a system with a grep and egrep that is not 100% gnu grep compatible, 75 | # e.g. solaris, install the gnu grep (ggrep) and specify this below. 76 | # 77 | # grep tool 78 | # GREP="grep" 79 | 80 | # egrep tool 81 | # EGREP="egrep" 82 | 83 | # sed tool 84 | # SED="sed" 85 | 86 | # tail tool 87 | # LAST_LINE="tail -n 1" 88 | 89 | # expr tool 90 | # EXPR="expr" 91 | 92 | 93 | # Describe what additional tables to install. Valid values for the variables 94 | # below are yes/no/ask. With ask (default) it will interactively ask the user 95 | # for an answer, while yes/no allow for automated, unassisted installs. 96 | # 97 | 98 | # If to install tables for the modules in the EXTRA_MODULES variable. 99 | INSTALL_EXTRA_TABLES=yes 100 | 101 | # If to install presence related tables. 102 | INSTALL_PRESENCE_TABLES=yes 103 | 104 | # If to install uid modules related tables. 105 | INSTALL_DBUID_TABLES=yes 106 | 107 | # Define what module tables should be installed. 108 | # If you use the postgres database and want to change the installed tables, then you 109 | # must also adjust the STANDARD_TABLES or EXTRA_TABLES variable accordingly in the 110 | # kamdbctl.base script. 111 | 112 | # Kamailio standard modules 113 | # STANDARD_MODULES="standard acc lcr domain group permissions registrar usrloc msilo 114 | # alias_db uri_db speeddial avpops auth_db pdt dialog dispatcher 115 | # dialplan" 116 | 117 | # Kamailio extra modules 118 | # EXTRA_MODULES="imc cpl siptrace domainpolicy carrierroute userblacklist htable purple sca" 119 | 120 | 121 | ## type of aliases used: DB - database aliases; UL - usrloc aliases 122 | ## - default: none 123 | # ALIASES_TYPE="DB" 124 | 125 | ## control engine: FIFO or UNIXSOCK 126 | ## - default FIFO 127 | # CTLENGINE="FIFO" 128 | 129 | ## path to FIFO file 130 | FIFOPATH="/var/run/kamailio/kamailio_fifo" 131 | 132 | ## check ACL names; default on (1); off (0) 133 | # VERIFY_ACL=1 134 | 135 | ## ACL names - if VERIFY_ACL is set, only the ACL names from below list 136 | ## are accepted 137 | # ACL_GROUPS="local ld int voicemail free-pstn" 138 | 139 | ## verbose - debug purposes - default '0' 140 | # VERBOSE=1 141 | 142 | ## do (1) or don't (0) store plaintext passwords 143 | ## in the subscriber table - default '1' 144 | # STORE_PLAINTEXT_PW=0 145 | 146 | ## Kamailio START Options 147 | ## PID file path - default is: /var/run/kamailio.pid 148 | PID_FILE=/var/run/kamailio/kamailio.pid 149 | 150 | ## Extra start options - default is: not set 151 | # example: start Kamailio with 64MB share memory: STARTOPTIONS="-m 64" 152 | # STARTOPTIONS= 153 | -------------------------------------------------------------------------------- /kamailio_4.4.4_rpi/conf/etc/modules.lst: -------------------------------------------------------------------------------- 1 | # this file is autogenerated by make modules-cfg 2 | 3 | # the list of sub-directories with modules 4 | modules_dirs:=modules 5 | 6 | # the list of module groups to compile 7 | cfg_group_include= 8 | 9 | # the list of extra modules to compile 10 | include_modules= 11 | 12 | # the list of static modules 13 | static_modules= 14 | 15 | # the list of modules to skip from compile list 16 | skip_modules= 17 | 18 | # the list of modules to exclude from compile list 19 | exclude_modules= acc_radius app_java app_lua app_mono app_perl app_python auth_ephemeral auth_identity auth_radius cdp cdp_avp cnxcc cpl-c crypto db2_ldap db_berkeley db_cassandra db_mongodb db_oracle db_perlvdb db_postgres db_sqlite db_unixodbc dnssec erlang evapi gzcompress h350 http_async_client http_client ims_auth ims_charging ims_dialog ims_icscf ims_isc ims_qos ims_registrar_pcscf ims_registrar_scscf ims_usrloc_pcscf ims_usrloc_scscf iptrtpproxy jansson janssonrpc-c json jsonrpc-c kazoo lcr ldap log_systemd memcached mi_xmlrpc misc_radius ndb_cassandra ndb_mongodb ndb_redis osp peering presence presence_conference presence_dialoginfo presence_mwi presence_profile presence_reginfo presence_xml pua pua_bla pua_dialoginfo pua_mi pua_reginfo pua_usrloc pua_xmpp purple rls sctp snmpstats uuid websocket xcap_client xcap_server xhttp_pi xmlops xmlrpc xmpp geoip2 $(skip_modules) 20 | 21 | modules_all= $(filter-out modules/CVS,$(wildcard modules/*)) 22 | modules_noinc= $(filter-out $(addprefix modules/, $(exclude_modules) $(static_modules)), $(modules_all)) 23 | modules= $(filter-out $(modules_noinc), $(addprefix modules/, $(include_modules) )) $(modules_noinc) 24 | modules_configured:=1 25 | -------------------------------------------------------------------------------- /kamailio_4.4.4_rpi/conf/etc/tls.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # Example Kamailio TLS Configuration File 3 | # 4 | 5 | # This is the default server domain, settings 6 | # in this domain will be used for all incoming 7 | # connections that do not match any other server 8 | # domain in this configuration file. 9 | # 10 | # We do not enable anything else than TLSv1 11 | # over the public internet. Clients do not have 12 | # to present client certificates by default. 13 | # 14 | [server:default] 15 | method = TLSv1 16 | verify_certificate = no 17 | require_certificate = no 18 | private_key = /usr/local/etc/kamailio/key.pem 19 | certificate = /usr/local/etc/kamailio/cert.pem 20 | ca_list = /usr/local/etc/kamailio/ca.pem 21 | #crl = ./modules/tls/crl.pem 22 | 23 | # This is the default client domain, settings 24 | # in this domain will be used for all outgoing 25 | # TLS connections that do not match any other 26 | # client domain in this configuration file. 27 | # We require that servers present valid certificate. 28 | # 29 | [client:default] 30 | verify_certificate = no 31 | require_certificate = no 32 | 33 | # This is an example server domain for TLS connections 34 | # received from the loopback interface. We allow 35 | # the use of SSLv2 and SSLv3 protocols here, we do 36 | # not require that clients present client certificates 37 | # but if they present it it must be valid. We also use 38 | # a special certificate and CA list for loopback 39 | # interface. 40 | # 41 | #[server:127.0.0.1:5061] 42 | #method = SSLv23 43 | #verify_certificate = yes 44 | #require_certificate = no 45 | #private_key = ./modules/tls/local_key.pem 46 | #certificate = ./modules/tls/local_cert.pem 47 | #verify_depth = 3 48 | #ca_list = local_ca.pem 49 | #crl = local_crl.pem 50 | 51 | # Special settings for the iptel.org public SIP 52 | # server. We do not verify the certificate of the 53 | # server because it can be expired. The server 54 | # implements authentication using SSL client 55 | # certificates so configure the client certificate 56 | # that was given to use by iptel.org staff here. 57 | # 58 | #[client:195.37.77.101:5061] 59 | #verify_certificate = no 60 | #certificate = ./modules/tls/iptel_client.pem 61 | #private_key = ./modules/tls/iptel_key.pem 62 | #ca_list = ./modules/tls/iptel_ca.pem 63 | #crl = ./modules/tls/iptel_crl.pem 64 | -------------------------------------------------------------------------------- /kamailio_4.4.4_rpi/create_database.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/expect 2 | spawn /usr/local/sbin/kamdbctl create; 3 | expect "MySQL password for root: "; 4 | send "passwd\r"; 5 | expect "END"; 6 | -------------------------------------------------------------------------------- /kamailio_4.4/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | MAINTAINER Alberto Sagredo 4 | 5 | ENV build_date 2016-07-20 6 | 7 | ENV DEBIAN_FRONTEND noninteractive 8 | 9 | ENV SIP_PORT 5080 10 | 11 | USER root 12 | 13 | RUN apt-get update && \ 14 | echo "mysql-server mysql-server/root_password password passwd" | debconf-set-selections && \ 15 | echo "mysql-server mysql-server/root_password_again password passwd" | debconf-set-selections && \ 16 | apt-get install -y mysql-server git make bison flex libmysqlclient-dev \ 17 | libncurses5 libncurses5-dev mysql-client expect libxml2-dev tcpdump libmicrohttpd10 wget curl joe vim ngrep vim-nox git gcc automake build-essential flex bison libncurses5-dev unixodbc-dev xsltproc libssl-dev libmysqlclient-dev make libssl-dev libcurl4-openssl-dev libxml2-dev libpcre3-dev uuid-dev libicu-dev libunistring-dev libsnmp-dev libevent-dev autoconf libtool wget libconfuse-dev libpcre3-dev 18 | 19 | RUN PATH=$PATH:/usr/local/sbin 20 | 21 | RUN export PATH 22 | 23 | RUN mkdir -p /usr/local/src/kamailio-4.4 && \ 24 | cd /usr/local/src/kamailio-4.4 && \ 25 | git clone --depth 1 --no-single-branch git://git.kamailio.org/kamailio kamailio && \ 26 | cd kamailio && \ 27 | git checkout -b 4.4 origin/4.4 28 | 29 | RUN cd /usr/local/src/kamailio-4.4/kamailio && \ 30 | make include_modules="db_mysql dialplan nth presence xml websocket tls" cfg && \ 31 | make Q=0 all && \ 32 | make install 33 | 34 | RUN export DEBIAN_FRONTEND=noninteractive && \ 35 | git clone https://github.com/sipwise/rtpengine.git ~/rtpengine && \ 36 | cd ~/rtpengine && \ 37 | ./debian/flavors/no_ngcp && \ 38 | apt-get install -qqy dpkg-dev debhelper libevent-dev iptables-dev libcurl4-openssl-dev libglib2.0-dev libhiredis-dev libpcre3-dev libssl-dev libxmlrpc-core-c3-dev markdown zlib1g-dev module-assistant dkms gettext libbencode-perl libcrypt-rijndael-perl libdigest-hmac-perl libio-socket-inet6-perl libsocket6-perl netcat libpcap0.8-dev libpcap-dev && \ 39 | dpkg-buildpackage && \ 40 | dpkg -i ../*.deb && \ 41 | rm -rf rtpengine 42 | 43 | 44 | WORKDIR /usr/src/kamailio 45 | 46 | COPY conf/* /usr/local/etc/kamailio/ 47 | 48 | COPY boot_run.sh /etc/ 49 | 50 | COPY create_database.sh /etc/ 51 | 52 | RUN chmod a+x /etc/create_database.sh 53 | 54 | COPY default/kamailio /etc/default/kamailio 55 | 56 | COPY default/kamailio.init /etc/init.d/kamailio 57 | 58 | RUN ln -s /usr/local/lib64 /usr/lib64 59 | 60 | RUN chmod 755 /etc/init.d/kamailio 61 | 62 | RUN mkdir -p /var/run/kamailio 63 | 64 | EXPOSE 5080/udp 5081/udp 65 | 66 | ENTRYPOINT ["/etc/boot_run.sh"] 67 | 68 | -------------------------------------------------------------------------------- /kamailio_4.4/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a generic Makefile. It use to build Docker images. 3 | # 4 | 5 | all: build 6 | 7 | build: 8 | @docker build -t voipnovatos/kamailio 9 | quickstart: 10 | @echo "Quick starting sample" 11 | @ddocker run -dt -p 5080:5080/udp -e ADVERTISED_IP="10.0.100.26" voipnovatos/kamailio 12 | -------------------------------------------------------------------------------- /kamailio_4.4/boot_run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Program: 3 | # This program is install boot run script. 4 | 5 | MYSQL_PWD=${MYSQL_PWD:-"passwd"} 6 | ADVERTISED_IP=${ADVERTISED_IP:-"127.0.0.1"} 7 | HOST_IP=$(ip route get 8.8.8.8 | awk '{print $NF; exit}') 8 | SIP_PORT=5080 9 | 10 | echo "Your IP : ${HOST_IP}" 11 | echo -e "Your Advertised IP : ${ADVERTISED_IP}\n\n" 12 | echo -e "Your Kamailio SIP Port : ${SIP_PORT}\n\n" 13 | 14 | # Starting MySQL 15 | 16 | service mysql start 17 | 18 | # Auto Create Database 19 | 20 | /etc/create_database.sh 21 | 22 | # Configure kamailio.cfg 23 | 24 | sed -i "s/alias=.*/alias=\"${ADVERTISED_IP}\"/g" /usr/local/etc/kamailio/kamailio.cfg 25 | 26 | sed -i "s/listen=.*/listen=udp:${HOST_IP}:5080 advertise ${ADVERTISED_IP}:5080/g" /usr/local/etc/kamailio/kamailio.cfg 27 | 28 | sed -i "s/port=.*/port=${SIP_PORT}/g" /usr/local/etc/kamailio/kamailio.cfg 29 | 30 | mkdir /var/spool/rtpengine 31 | 32 | rtpengine -p /var/run/rtpengine.pid --interface=127.0.0.1!$ADVERTISED_IP -n 127.0.0.1:60000 -c 127.0.0.1:60001 -m 20000 -M 30000 -E -L 7 33 | 34 | # Starting Kamailio process 35 | 36 | /usr/local/sbin/kamailio -DD -P/var/run/kamailio/kamailio.pid -f /usr/local/etc/kamailio/kamailio.cfg 37 | 38 | /bin/bash -------------------------------------------------------------------------------- /kamailio_4.4/conf/ca.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIID3TCCAsWgAwIBAgIJAILY4WXBo089MA0GCSqGSIb3DQEBCwUAMIGEMQswCQYD 3 | VQQGEwJFUzEMMAoGA1UECAwDQkNOMRIwEAYDVQQHDAlCYXJjZWxvbmExETAPBgNV 4 | BAoMCENvemVudGljMRgwFgYDVQQDDA9zaXAuY296ZW50aWMuZXMxJjAkBgkqhkiG 5 | 9w0BCQEWF2RhdmlkLnJvZGFAY296ZW50aWMuY29tMB4XDTE2MDMxODIyNDQxMloX 6 | DTI2MDMxNjIyNDQxMlowgYQxCzAJBgNVBAYTAkVTMQwwCgYDVQQIDANCQ04xEjAQ 7 | BgNVBAcMCUJhcmNlbG9uYTERMA8GA1UECgwIQ296ZW50aWMxGDAWBgNVBAMMD3Np 8 | cC5jb3plbnRpYy5lczEmMCQGCSqGSIb3DQEJARYXZGF2aWQucm9kYUBjb3plbnRp 9 | Yy5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzyM9Xh3ser29v 10 | y/igrrYwfBHrjW5g+jaQqvjLLQDZB8s8DIj9tWI3jqSF0GXrZDWp9yjOCqkMUhpo 11 | lVFbCptSK7VUpXnS40p7bkm8FhCTrCxXKddxRT3tPd7Y758BLwREeFDYxKgkxo/9 12 | m96cRF4kMCa9dOzjk9+pSQqJC6QaJQEIIxpNZYMwQcQwdUnEtGVKg+0bIv7xQkeN 13 | yhF4ikygWcRnBExTmq/TV6mu/R6TGGEO2fxFWu4S4DQkpeScaaWuJeS0kBMn5xar 14 | V+4W7qbODKkw4XNxW56YprSZFk3EQZDUK5rdE19Dlg5xirkGTbZdbQ0nVmxtEXtx 15 | 9K5hN9AhAgMBAAGjUDBOMB0GA1UdDgQWBBSUr9/8K6s0BwVEz5SFtV90rdRzoTAf 16 | BgNVHSMEGDAWgBSUr9/8K6s0BwVEz5SFtV90rdRzoTAMBgNVHRMEBTADAQH/MA0G 17 | CSqGSIb3DQEBCwUAA4IBAQBTxkPr1VY/DsnWcA7DjiPO8bMc6IYSiFA/X8bD1dAP 18 | h5GE9FUmPbiobid1wxWGqdYs80dRAPW+ITu0Gcuq+taUvkqznsati0B99l1qNlQe 19 | 13ek8WyT6QJ7+15kZIoNWr6fht06gJRYEUL+WL7QTq6j2/xVZXEiLPIajDL8VbgC 20 | vZypGuF1gR6YCqz3nSFB3Zj6DjStcR8AM5dze+v3bTqddSuha+ajggqwysUYwfZA 21 | yv4R29MOxQVU/uJt8EPnp8X1OKZciViS48PadbZoiTIPCqDcyqI3FFxtkBbL1Syy 22 | Qr0/iFva/o7tdMBuMWisBFZCu5y6KJXMRt5i6+tswALo 23 | -----END CERTIFICATE----- 24 | -------------------------------------------------------------------------------- /kamailio_4.4/conf/dictionary.kamailio: -------------------------------------------------------------------------------- 1 | # 2 | # $Id$ 3 | # 4 | # SIP RADIUS attributes 5 | # 6 | # Proprietary indicates an attribute that hasn't 7 | # been standardized 8 | # 9 | # 10 | # NOTE: All standard (IANA registered) attributes are 11 | # defined in the default dictionary of the 12 | # radiusclient-ng library. 13 | # 14 | 15 | 16 | #### Attributes ### 17 | ATTRIBUTE Sip-Uri-User 208 string # Proprietary, auth_radius 18 | ATTRIBUTE Sip-Group 211 string # Proprietary, group_radius 19 | ATTRIBUTE Sip-Rpid 213 string # Proprietary, auth_radius 20 | ATTRIBUTE SIP-AVP 225 string # Proprietary, avp_radius 21 | 22 | ### Acct-Status-Type Values ### 23 | #VALUE Acct-Status-Type Failed 15 # RFC2866, acc 24 | 25 | ### Service-Type Values ### 26 | #VALUE Service-Type Call-Check 10 # RFC2865, uri_radius 27 | VALUE Service-Type Group-Check 12 # Proprietary, group_radius 28 | ##VALUE Service-Type Sip-Session 15 # Schulzrinne, acc, auth_radius 29 | VALUE Service-Type SIP-Caller-AVPs 30 # Proprietary, avp_radius 30 | VALUE Service-Type SIP-Callee-AVPs 31 # Proprietary, avp_radius 31 | 32 | ### Sip-Method Values ### 33 | VALUE Sip-Method Undefined 0 34 | VALUE Sip-Method Invite 1 35 | VALUE Sip-Method Cancel 2 36 | VALUE Sip-Method Ack 4 37 | VALUE Sip-Method Bye 8 38 | VALUE Sip-Method Info 16 39 | VALUE Sip-Method Options 32 40 | VALUE Sip-Method Update 64 41 | VALUE Sip-Method Register 128 42 | VALUE Sip-Method Message 256 43 | VALUE Sip-Method Subscribe 512 44 | VALUE Sip-Method Notify 1024 45 | VALUE Sip-Method Prack 2048 46 | VALUE Sip-Method Refer 4096 47 | VALUE Sip-Method Other 8192 48 | 49 | 50 | -------------------------------------------------------------------------------- /kamailio_4.4/conf/kamailio.cfg: -------------------------------------------------------------------------------- 1 | #!KAMAILIO 2 | # 3 | # Kamailio (OpenSER) SIP Server v4.4 - default configuration script 4 | # - web: http://www.kamailio.org 5 | # - git: http://sip-router.org 6 | # 7 | # Direct your questions about this file to: 8 | # 9 | # Refer to the Core CookBook at http://www.kamailio.org/wiki/ 10 | # for an explanation of possible statements, functions and parameters. 11 | # 12 | # Several features can be enabled using '#!define WITH_FEATURE' directives: 13 | # 14 | # *** To run in debug mode: 15 | # - define WITH_DEBUG 16 | # 17 | # *** To enable mysql: 18 | # - define WITH_MYSQL 19 | # 20 | # *** To enable authentication execute: 21 | # - enable mysql 22 | # - define WITH_AUTH 23 | # - add users using 'kamctl' 24 | # 25 | # *** To enable IP authentication execute: 26 | # - enable mysql 27 | # - enable authentication 28 | # - define WITH_IPAUTH 29 | # - add IP addresses with group id '1' to 'address' table 30 | # 31 | # *** To enable persistent user location execute: 32 | # - enable mysql 33 | # - define WITH_USRLOCDB 34 | # 35 | # *** To enable presence server execute: 36 | # - enable mysql 37 | # - define WITH_PRESENCE 38 | # 39 | # *** To enable nat traversal execute: 40 | # - define WITH_NAT 41 | # - install RTPProxy: http://www.rtpproxy.org 42 | # - start RTPProxy: 43 | # rtpproxy -l _your_public_ip_ -s udp:localhost:7722 44 | # - option for NAT SIP OPTIONS keepalives: WITH_NATSIPPING 45 | # 46 | # *** To enable PSTN gateway routing execute: 47 | # - define WITH_PSTN 48 | # - set the value of pstn.gw_ip 49 | # - check route[PSTN] for regexp routing condition 50 | # 51 | # *** To enable database aliases lookup execute: 52 | # - enable mysql 53 | # - define WITH_ALIASDB 54 | # 55 | # *** To enable speed dial lookup execute: 56 | # - enable mysql 57 | # - define WITH_SPEEDDIAL 58 | # 59 | # *** To enable multi-domain support execute: 60 | # - enable mysql 61 | # - define WITH_MULTIDOMAIN 62 | # 63 | # *** To enable TLS support execute: 64 | # - adjust CFGDIR/tls.cfg as needed 65 | # - define WITH_TLS 66 | # 67 | # *** To enable XMLRPC support execute: 68 | # - define WITH_XMLRPC 69 | # - adjust route[XMLRPC] for access policy 70 | # 71 | # *** To enable anti-flood detection execute: 72 | # - adjust pike and htable=>ipban settings as needed (default is 73 | # block if more than 16 requests in 2 seconds and ban for 300 seconds) 74 | # - define WITH_ANTIFLOOD 75 | # 76 | # *** To block 3XX redirect replies execute: 77 | # - define WITH_BLOCK3XX 78 | # 79 | # *** To enable VoiceMail routing execute: 80 | # - define WITH_VOICEMAIL 81 | # - set the value of voicemail.srv_ip 82 | # - adjust the value of voicemail.srv_port 83 | # 84 | # *** To enhance accounting execute: 85 | # - enable mysql 86 | # - define WITH_ACCDB 87 | # - add following columns to database 88 | #!ifdef ACCDB_COMMENT 89 | ALTER TABLE acc ADD COLUMN src_user VARCHAR(64) NOT NULL DEFAULT ''; 90 | ALTER TABLE acc ADD COLUMN src_domain VARCHAR(128) NOT NULL DEFAULT ''; 91 | ALTER TABLE acc ADD COLUMN src_ip varchar(64) NOT NULL default ''; 92 | ALTER TABLE acc ADD COLUMN dst_ouser VARCHAR(64) NOT NULL DEFAULT ''; 93 | ALTER TABLE acc ADD COLUMN dst_user VARCHAR(64) NOT NULL DEFAULT ''; 94 | ALTER TABLE acc ADD COLUMN dst_domain VARCHAR(128) NOT NULL DEFAULT ''; 95 | ALTER TABLE missed_calls ADD COLUMN src_user VARCHAR(64) NOT NULL DEFAULT ''; 96 | ALTER TABLE missed_calls ADD COLUMN src_domain VARCHAR(128) NOT NULL DEFAULT ''; 97 | ALTER TABLE missed_calls ADD COLUMN src_ip varchar(64) NOT NULL default ''; 98 | ALTER TABLE missed_calls ADD COLUMN dst_ouser VARCHAR(64) NOT NULL DEFAULT ''; 99 | ALTER TABLE missed_calls ADD COLUMN dst_user VARCHAR(64) NOT NULL DEFAULT ''; 100 | ALTER TABLE missed_calls ADD COLUMN dst_domain VARCHAR(128) NOT NULL DEFAULT ''; 101 | #!endif 102 | 103 | ####### Include Local Config If Exists ######### 104 | import_file "kamailio-local.cfg" 105 | 106 | ####### Defined Values ######### 107 | 108 | # *** Value defines - IDs used later in config 109 | #!ifdef WITH_MYSQL 110 | # - database URL - used to connect to database server by modules such 111 | # as: auth_db, acc, usrloc, a.s.o. 112 | #!ifndef DBURL 113 | #!define DBURL "mysql://kamailio:kamailiorw@localhost/kamailio" 114 | #!endif 115 | #!endif 116 | #!ifdef WITH_MULTIDOMAIN 117 | # - the value for 'use_domain' parameters 118 | #!define MULTIDOMAIN 1 119 | #!else 120 | #!define MULTIDOMAIN 0 121 | #!endif 122 | 123 | # - flags 124 | # FLT_ - per transaction (message) flags 125 | # FLB_ - per branch flags 126 | #!define FLT_ACC 1 127 | #!define FLT_ACCMISSED 2 128 | #!define FLT_ACCFAILED 3 129 | #!define FLT_NATS 5 130 | 131 | #!define FLB_NATB 6 132 | #!define FLB_NATSIPPING 7 133 | 134 | ####### Global Parameters ######### 135 | 136 | ### LOG Levels: 3=DBG, 2=INFO, 1=NOTICE, 0=WARN, -1=ERR 137 | #!ifdef WITH_DEBUG 138 | debug=4 139 | log_stderror=yes 140 | #!else 141 | debug=2 142 | log_stderror=no 143 | #!endif 144 | 145 | memdbg=5 146 | memlog=5 147 | 148 | log_facility=LOG_LOCAL0 149 | 150 | # number of SIP routing processes 151 | children=8 152 | 153 | /* uncomment the next line to disable TCP (default on) */ 154 | #disable_tcp=yes 155 | 156 | /* uncomment the next line to disable the auto discovery of local aliases 157 | based on reverse DNS on IPs (default on) */ 158 | #auto_aliases=no 159 | 160 | /* add local domain aliases */ 161 | alias="127.0.0.1" 162 | 163 | /* uncomment and configure the following line if you want Kamailio to 164 | bind on a specific interface/port/proto (default bind on all available) */ 165 | 166 | listen=udp:127.0.0.1:5080 167 | 168 | /* port to listen to */ 169 | port=5080 170 | 171 | #!ifdef WITH_TLS 172 | enable_tls=yes 173 | #!endif 174 | 175 | # life time of TCP connection when there is no traffic 176 | # - a bit higher than registration expires to cope with UA behind NAT 177 | tcp_connection_lifetime=3605 178 | 179 | ####### Custom Parameters ######### 180 | 181 | # These parameters can be modified runtime via RPC interface 182 | # - see the documentation of 'cfg_rpc' module. 183 | # 184 | # Format: group.id = value 'desc' description 185 | # Access: $sel(cfg_get.group.id) or @cfg_get.group.id 186 | # 187 | 188 | #!ifdef WITH_PSTN 189 | # PSTN GW Routing 190 | # 191 | # - pstn.gw_ip: valid IP or hostname as string value, example: 192 | # pstn.gw_ip = "10.0.0.101" desc "My PSTN GW Address" 193 | # 194 | # - by default is empty to avoid misrouting 195 | pstn.gw_ip = "" desc "PSTN GW Address" 196 | pstn.gw_port = "" desc "PSTN GW Port" 197 | #!endif 198 | 199 | #!ifdef WITH_VOICEMAIL 200 | # VoiceMail Routing on offline, busy or no answer 201 | # 202 | # - by default Voicemail server IP is empty to avoid misrouting 203 | voicemail.srv_ip = "" desc "VoiceMail IP Address" 204 | voicemail.srv_port = "5060" desc "VoiceMail Port" 205 | #!endif 206 | 207 | ####### Modules Section ######## 208 | 209 | # set paths to location of modules (to sources or installation folders) 210 | #!ifdef WITH_SRCPATH 211 | mpath="modules/" 212 | #!else 213 | mpath="/usr/local/lib64/kamailio/modules/" 214 | #!endif 215 | 216 | #!ifdef WITH_MYSQL 217 | loadmodule "db_mysql.so" 218 | #!endif 219 | 220 | loadmodule "mi_fifo.so" 221 | loadmodule "kex.so" 222 | loadmodule "corex.so" 223 | loadmodule "tm.so" 224 | loadmodule "tmx.so" 225 | loadmodule "sl.so" 226 | loadmodule "rr.so" 227 | loadmodule "pv.so" 228 | loadmodule "maxfwd.so" 229 | loadmodule "usrloc.so" 230 | loadmodule "registrar.so" 231 | loadmodule "textops.so" 232 | loadmodule "siputils.so" 233 | loadmodule "xlog.so" 234 | loadmodule "sanity.so" 235 | loadmodule "ctl.so" 236 | loadmodule "cfg_rpc.so" 237 | loadmodule "mi_rpc.so" 238 | loadmodule "acc.so" 239 | 240 | #!ifdef WITH_AUTH 241 | loadmodule "auth.so" 242 | loadmodule "auth_db.so" 243 | #!ifdef WITH_IPAUTH 244 | loadmodule "permissions.so" 245 | #!endif 246 | #!endif 247 | 248 | #!ifdef WITH_ALIASDB 249 | loadmodule "alias_db.so" 250 | #!endif 251 | 252 | #!ifdef WITH_SPEEDDIAL 253 | loadmodule "speeddial.so" 254 | #!endif 255 | 256 | #!ifdef WITH_MULTIDOMAIN 257 | loadmodule "domain.so" 258 | #!endif 259 | 260 | #!ifdef WITH_PRESENCE 261 | loadmodule "presence.so" 262 | loadmodule "presence_xml.so" 263 | #!endif 264 | 265 | #!ifdef WITH_NAT 266 | loadmodule "nathelper.so" 267 | loadmodule "rtpproxy.so" 268 | #!endif 269 | 270 | #!ifdef WITH_TLS 271 | loadmodule "tls.so" 272 | #!endif 273 | 274 | #!ifdef WITH_ANTIFLOOD 275 | loadmodule "htable.so" 276 | loadmodule "pike.so" 277 | #!endif 278 | 279 | #!ifdef WITH_XMLRPC 280 | loadmodule "xmlrpc.so" 281 | #!endif 282 | 283 | #!ifdef WITH_DEBUG 284 | loadmodule "debugger.so" 285 | #!endif 286 | 287 | # ----------------- setting module-specific parameters --------------- 288 | 289 | 290 | # ----- mi_fifo params ----- 291 | #modparam("mi_fifo", "fifo_name", "/var/run/kamailio/kamailio_fifo") 292 | 293 | # ----- ctl params ----- 294 | #modparam("ctl", "binrpc", "unix:/var/run/kamailio/kamailio_ctl") 295 | 296 | # ----- tm params ----- 297 | # auto-discard branches from previous serial forking leg 298 | modparam("tm", "failure_reply_mode", 3) 299 | # default retransmission timeout: 30sec 300 | modparam("tm", "fr_timer", 30000) 301 | # default invite retransmission timeout after 1xx: 120sec 302 | modparam("tm", "fr_inv_timer", 120000) 303 | 304 | 305 | # ----- rr params ----- 306 | # set next param to 1 to add value to ;lr param (helps with some UAs) 307 | modparam("rr", "enable_full_lr", 0) 308 | # do not append from tag to the RR (no need for this script) 309 | modparam("rr", "append_fromtag", 0) 310 | 311 | 312 | # ----- registrar params ----- 313 | modparam("registrar", "method_filtering", 1) 314 | /* uncomment the next line to disable parallel forking via location */ 315 | # modparam("registrar", "append_branches", 0) 316 | /* uncomment the next line not to allow more than 10 contacts per AOR */ 317 | #modparam("registrar", "max_contacts", 10) 318 | # max value for expires of registrations 319 | modparam("registrar", "max_expires", 3600) 320 | # set it to 1 to enable GRUU 321 | modparam("registrar", "gruu_enabled", 0) 322 | 323 | 324 | # ----- acc params ----- 325 | /* what special events should be accounted ? */ 326 | modparam("acc", "early_media", 0) 327 | modparam("acc", "report_ack", 0) 328 | modparam("acc", "report_cancels", 0) 329 | /* by default ww do not adjust the direct of the sequential requests. 330 | if you enable this parameter, be sure the enable "append_fromtag" 331 | in "rr" module */ 332 | modparam("acc", "detect_direction", 0) 333 | /* account triggers (flags) */ 334 | modparam("acc", "log_flag", FLT_ACC) 335 | modparam("acc", "log_missed_flag", FLT_ACCMISSED) 336 | modparam("acc", "log_extra", 337 | "src_user=$fU;src_domain=$fd;src_ip=$si;" 338 | "dst_ouser=$tU;dst_user=$rU;dst_domain=$rd") 339 | modparam("acc", "failed_transaction_flag", FLT_ACCFAILED) 340 | /* enhanced DB accounting */ 341 | #!ifdef WITH_ACCDB 342 | modparam("acc", "db_flag", FLT_ACC) 343 | modparam("acc", "db_missed_flag", FLT_ACCMISSED) 344 | modparam("acc", "db_url", DBURL) 345 | modparam("acc", "db_extra", 346 | "src_user=$fU;src_domain=$fd;src_ip=$si;" 347 | "dst_ouser=$tU;dst_user=$rU;dst_domain=$rd") 348 | #!endif 349 | 350 | 351 | # ----- usrloc params ----- 352 | /* enable DB persistency for location entries */ 353 | #!ifdef WITH_USRLOCDB 354 | modparam("usrloc", "db_url", DBURL) 355 | modparam("usrloc", "db_mode", 2) 356 | modparam("usrloc", "use_domain", MULTIDOMAIN) 357 | #!endif 358 | 359 | 360 | # ----- auth_db params ----- 361 | #!ifdef WITH_AUTH 362 | modparam("auth_db", "db_url", DBURL) 363 | modparam("auth_db", "calculate_ha1", yes) 364 | modparam("auth_db", "password_column", "password") 365 | modparam("auth_db", "load_credentials", "") 366 | modparam("auth_db", "use_domain", MULTIDOMAIN) 367 | 368 | # ----- permissions params ----- 369 | #!ifdef WITH_IPAUTH 370 | modparam("permissions", "db_url", DBURL) 371 | modparam("permissions", "db_mode", 1) 372 | #!endif 373 | 374 | #!endif 375 | 376 | 377 | # ----- alias_db params ----- 378 | #!ifdef WITH_ALIASDB 379 | modparam("alias_db", "db_url", DBURL) 380 | modparam("alias_db", "use_domain", MULTIDOMAIN) 381 | #!endif 382 | 383 | 384 | # ----- speeddial params ----- 385 | #!ifdef WITH_SPEEDDIAL 386 | modparam("speeddial", "db_url", DBURL) 387 | modparam("speeddial", "use_domain", MULTIDOMAIN) 388 | #!endif 389 | 390 | 391 | # ----- domain params ----- 392 | #!ifdef WITH_MULTIDOMAIN 393 | modparam("domain", "db_url", DBURL) 394 | # register callback to match myself condition with domains list 395 | modparam("domain", "register_myself", 1) 396 | #!endif 397 | 398 | 399 | #!ifdef WITH_PRESENCE 400 | # ----- presence params ----- 401 | modparam("presence", "db_url", DBURL) 402 | 403 | # ----- presence_xml params ----- 404 | modparam("presence_xml", "db_url", DBURL) 405 | modparam("presence_xml", "force_active", 1) 406 | #!endif 407 | 408 | 409 | #!ifdef WITH_NAT 410 | # ----- rtpproxy params ----- 411 | modparam("rtpproxy", "rtpproxy_sock", "udp:127.0.0.1:7722") 412 | 413 | # ----- nathelper params ----- 414 | modparam("nathelper", "natping_interval", 30) 415 | modparam("nathelper", "ping_nated_only", 1) 416 | modparam("nathelper", "sipping_bflag", FLB_NATSIPPING) 417 | modparam("nathelper", "sipping_from", "sip:pinger@kamailio.org") 418 | 419 | # params needed for NAT traversal in other modules 420 | modparam("nathelper|registrar", "received_avp", "$avp(RECEIVED)") 421 | modparam("usrloc", "nat_bflag", FLB_NATB) 422 | #!endif 423 | 424 | 425 | #!ifdef WITH_TLS 426 | # ----- tls params ----- 427 | modparam("tls", "config", "/usr/local/etc/kamailio/tls.cfg") 428 | #!endif 429 | 430 | #!ifdef WITH_ANTIFLOOD 431 | # ----- pike params ----- 432 | modparam("pike", "sampling_time_unit", 2) 433 | modparam("pike", "reqs_density_per_unit", 16) 434 | modparam("pike", "remove_latency", 4) 435 | 436 | # ----- htable params ----- 437 | # ip ban htable with autoexpire after 5 minutes 438 | modparam("htable", "htable", "ipban=>size=8;autoexpire=300;") 439 | #!endif 440 | 441 | #!ifdef WITH_XMLRPC 442 | # ----- xmlrpc params ----- 443 | modparam("xmlrpc", "route", "XMLRPC"); 444 | modparam("xmlrpc", "url_match", "^/RPC") 445 | #!endif 446 | 447 | #!ifdef WITH_DEBUG 448 | # ----- debugger params ----- 449 | modparam("debugger", "cfgtrace", 1) 450 | modparam("debugger", "log_level_name", "exec") 451 | #!endif 452 | 453 | ####### Routing Logic ######## 454 | 455 | 456 | # Main SIP request routing logic 457 | # - processing of any incoming SIP request starts with this route 458 | # - note: this is the same as route { ... } 459 | request_route { 460 | 461 | # per request initial checks 462 | route(REQINIT); 463 | 464 | # NAT detection 465 | route(NATDETECT); 466 | 467 | # CANCEL processing 468 | if (is_method("CANCEL")) { 469 | if (t_check_trans()) { 470 | route(RELAY); 471 | } 472 | exit; 473 | } 474 | 475 | # handle requests within SIP dialogs 476 | route(WITHINDLG); 477 | 478 | ### only initial requests (no To tag) 479 | 480 | # handle retransmissions 481 | if(t_precheck_trans()) { 482 | t_check_trans(); 483 | exit; 484 | } 485 | t_check_trans(); 486 | 487 | # authentication 488 | route(AUTH); 489 | 490 | # record routing for dialog forming requests (in case they are routed) 491 | # - remove preloaded route headers 492 | remove_hf("Route"); 493 | if (is_method("INVITE|SUBSCRIBE")) { 494 | record_route(); 495 | } 496 | 497 | # account only INVITEs 498 | if (is_method("INVITE")) { 499 | setflag(FLT_ACC); # do accounting 500 | } 501 | 502 | # dispatch requests to foreign domains 503 | route(SIPOUT); 504 | 505 | ### requests for my local domains 506 | 507 | # handle presence related requests 508 | route(PRESENCE); 509 | 510 | # handle registrations 511 | route(REGISTRAR); 512 | 513 | if ($rU==$null) { 514 | # request with no Username in RURI 515 | sl_send_reply("484","Address Incomplete"); 516 | exit; 517 | } 518 | 519 | # dispatch destinations to PSTN 520 | route(PSTN); 521 | 522 | # user location service 523 | route(LOCATION); 524 | } 525 | 526 | # Wrapper for relaying requests 527 | route[RELAY] { 528 | 529 | # enable additional event routes for forwarded requests 530 | # - serial forking, RTP relaying handling, a.s.o. 531 | if (is_method("INVITE|BYE|SUBSCRIBE|UPDATE")) { 532 | if(!t_is_set("branch_route")) t_on_branch("MANAGE_BRANCH"); 533 | } 534 | if (is_method("INVITE|SUBSCRIBE|UPDATE")) { 535 | if(!t_is_set("onreply_route")) t_on_reply("MANAGE_REPLY"); 536 | } 537 | if (is_method("INVITE")) { 538 | if(!t_is_set("failure_route")) t_on_failure("MANAGE_FAILURE"); 539 | } 540 | 541 | if (!t_relay()) { 542 | sl_reply_error(); 543 | } 544 | exit; 545 | } 546 | 547 | # Per SIP request initial checks 548 | route[REQINIT] { 549 | #!ifdef WITH_ANTIFLOOD 550 | # flood detection from same IP and traffic ban for a while 551 | # be sure you exclude checking trusted peers, such as pstn gateways 552 | # - local host excluded (e.g., loop to self) 553 | if(src_ip!=myself) { 554 | if($sht(ipban=>$si)!=$null) { 555 | # ip is already blocked 556 | xdbg("request from blocked IP - $rm from $fu (IP:$si:$sp)\n"); 557 | exit; 558 | } 559 | if (!pike_check_req()) { 560 | xlog("L_ALERT","ALERT: pike blocking $rm from $fu (IP:$si:$sp)\n"); 561 | $sht(ipban=>$si) = 1; 562 | exit; 563 | } 564 | } 565 | if($ua =~ "friendly-scanner|sipcli") { 566 | # silent drop for scanners - uncomment next line if want to reply 567 | # sl_send_reply("200", "OK"); 568 | exit; 569 | } 570 | #!endif 571 | 572 | if (!mf_process_maxfwd_header("10")) { 573 | sl_send_reply("483","Too Many Hops"); 574 | exit; 575 | } 576 | 577 | if(is_method("OPTIONS") && uri==myself && $rU==$null) { 578 | sl_send_reply("200","Keepalive"); 579 | exit; 580 | } 581 | 582 | if(!sanity_check("1511", "7")) { 583 | xlog("Malformed SIP message from $si:$sp\n"); 584 | exit; 585 | } 586 | } 587 | 588 | # Handle requests within SIP dialogs 589 | route[WITHINDLG] { 590 | if (!has_totag()) return; 591 | 592 | # sequential request withing a dialog should 593 | # take the path determined by record-routing 594 | if (loose_route()) { 595 | route(DLGURI); 596 | if (is_method("BYE")) { 597 | setflag(FLT_ACC); # do accounting ... 598 | setflag(FLT_ACCFAILED); # ... even if the transaction fails 599 | } else if ( is_method("ACK") ) { 600 | # ACK is forwarded statelessy 601 | route(NATMANAGE); 602 | } else if ( is_method("NOTIFY") ) { 603 | # Add Record-Route for in-dialog NOTIFY as per RFC 6665. 604 | record_route(); 605 | } 606 | route(RELAY); 607 | exit; 608 | } 609 | 610 | if (is_method("SUBSCRIBE") && uri == myself) { 611 | # in-dialog subscribe requests 612 | route(PRESENCE); 613 | exit; 614 | } 615 | if ( is_method("ACK") ) { 616 | if ( t_check_trans() ) { 617 | # no loose-route, but stateful ACK; 618 | # must be an ACK after a 487 619 | # or e.g. 404 from upstream server 620 | route(RELAY); 621 | exit; 622 | } else { 623 | # ACK without matching transaction ... ignore and discard 624 | exit; 625 | } 626 | } 627 | sl_send_reply("404","Not here"); 628 | exit; 629 | } 630 | 631 | # Handle SIP registrations 632 | route[REGISTRAR] { 633 | if (!is_method("REGISTER")) return; 634 | 635 | if(isflagset(FLT_NATS)) { 636 | setbflag(FLB_NATB); 637 | #!ifdef WITH_NATSIPPING 638 | # do SIP NAT pinging 639 | setbflag(FLB_NATSIPPING); 640 | #!endif 641 | } 642 | if (!save("location")) { 643 | sl_reply_error(); 644 | } 645 | exit; 646 | } 647 | 648 | # User location service 649 | route[LOCATION] { 650 | 651 | #!ifdef WITH_SPEEDDIAL 652 | # search for short dialing - 2-digit extension 653 | if($rU=~"^[0-9][0-9]$") { 654 | if(sd_lookup("speed_dial")) { 655 | route(SIPOUT); 656 | } 657 | } 658 | #!endif 659 | 660 | #!ifdef WITH_ALIASDB 661 | # search in DB-based aliases 662 | if(alias_db_lookup("dbaliases")) { 663 | route(SIPOUT); 664 | } 665 | #!endif 666 | 667 | $avp(oexten) = $rU; 668 | if (!lookup("location")) { 669 | $var(rc) = $rc; 670 | route(TOVOICEMAIL); 671 | t_newtran(); 672 | switch ($var(rc)) { 673 | case -1: 674 | case -3: 675 | send_reply("404", "Not Found"); 676 | exit; 677 | case -2: 678 | send_reply("405", "Method Not Allowed"); 679 | exit; 680 | } 681 | } 682 | 683 | # when routing via usrloc, log the missed calls also 684 | if (is_method("INVITE")) { 685 | setflag(FLT_ACCMISSED); 686 | } 687 | 688 | route(RELAY); 689 | exit; 690 | } 691 | 692 | # Presence server processing 693 | route[PRESENCE] { 694 | if(!is_method("PUBLISH|SUBSCRIBE")) return; 695 | 696 | if(is_method("SUBSCRIBE") && $hdr(Event)=="message-summary") { 697 | route(TOVOICEMAIL); 698 | # returns here if no voicemail server is configured 699 | sl_send_reply("404", "No voicemail service"); 700 | exit; 701 | } 702 | 703 | #!ifdef WITH_PRESENCE 704 | if (!t_newtran()) { 705 | sl_reply_error(); 706 | exit; 707 | } 708 | 709 | if(is_method("PUBLISH")) { 710 | handle_publish(); 711 | t_release(); 712 | } else if(is_method("SUBSCRIBE")) { 713 | handle_subscribe(); 714 | t_release(); 715 | } 716 | exit; 717 | #!endif 718 | 719 | # if presence enabled, this part will not be executed 720 | if (is_method("PUBLISH") || $rU==$null) { 721 | sl_send_reply("404", "Not here"); 722 | exit; 723 | } 724 | return; 725 | } 726 | 727 | # IP authorization and user authentication 728 | route[AUTH] { 729 | #!ifdef WITH_AUTH 730 | 731 | #!ifdef WITH_IPAUTH 732 | if((!is_method("REGISTER")) && allow_source_address()) { 733 | # source IP allowed 734 | return; 735 | } 736 | #!endif 737 | 738 | if (is_method("REGISTER") || from_uri==myself) { 739 | # authenticate requests 740 | if (!auth_check("$fd", "subscriber", "1")) { 741 | auth_challenge("$fd", "0"); 742 | exit; 743 | } 744 | # user authenticated - remove auth header 745 | if(!is_method("REGISTER|PUBLISH")) 746 | consume_credentials(); 747 | } 748 | # if caller is not local subscriber, then check if it calls 749 | # a local destination, otherwise deny, not an open relay here 750 | if (from_uri!=myself && uri!=myself) { 751 | sl_send_reply("403","Not relaying"); 752 | exit; 753 | } 754 | 755 | #!endif 756 | return; 757 | } 758 | 759 | # Caller NAT detection 760 | route[NATDETECT] { 761 | #!ifdef WITH_NAT 762 | force_rport(); 763 | if (nat_uac_test("19")) { 764 | if (is_method("REGISTER")) { 765 | fix_nated_register(); 766 | } else { 767 | if(is_first_hop()) { 768 | set_contact_alias(); 769 | } 770 | } 771 | setflag(FLT_NATS); 772 | } 773 | #!endif 774 | return; 775 | } 776 | 777 | # RTPProxy control and signaling updates for NAT traversal 778 | route[NATMANAGE] { 779 | #!ifdef WITH_NAT 780 | if (is_request()) { 781 | if(has_totag()) { 782 | if(check_route_param("nat=yes")) { 783 | setbflag(FLB_NATB); 784 | } 785 | } 786 | } 787 | if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB))) return; 788 | 789 | if(nat_uac_test("8")) { 790 | rtpproxy_manage("co"); 791 | } else { 792 | rtpproxy_manage("cor"); 793 | } 794 | 795 | if (is_request()) { 796 | if (!has_totag()) { 797 | if(t_is_branch_route()) { 798 | add_rr_param(";nat=yes"); 799 | } 800 | } 801 | } 802 | if (is_reply()) { 803 | if(isbflagset(FLB_NATB)) { 804 | if(is_first_hop()) 805 | set_contact_alias(); 806 | } 807 | } 808 | #!endif 809 | return; 810 | } 811 | 812 | # URI update for dialog requests 813 | route[DLGURI] { 814 | #!ifdef WITH_NAT 815 | if(!isdsturiset()) { 816 | handle_ruri_alias(); 817 | } 818 | #!endif 819 | return; 820 | } 821 | 822 | # Routing to foreign domains 823 | route[SIPOUT] { 824 | if (uri==myself) return; 825 | 826 | append_hf("P-hint: outbound\r\n"); 827 | route(RELAY); 828 | exit; 829 | } 830 | 831 | # PSTN GW routing 832 | route[PSTN] { 833 | #!ifdef WITH_PSTN 834 | # check if PSTN GW IP is defined 835 | if (strempty($sel(cfg_get.pstn.gw_ip))) { 836 | xlog("SCRIPT: PSTN routing enabled but pstn.gw_ip not defined\n"); 837 | return; 838 | } 839 | 840 | # route to PSTN dialed numbers starting with '+' or '00' 841 | # (international format) 842 | # - update the condition to match your dialing rules for PSTN routing 843 | if(!($rU=~"^(\+|00)[1-9][0-9]{3,20}$")) return; 844 | 845 | # only local users allowed to call 846 | if(from_uri!=myself) { 847 | sl_send_reply("403", "Not Allowed"); 848 | exit; 849 | } 850 | 851 | if (strempty($sel(cfg_get.pstn.gw_port))) { 852 | $ru = "sip:" + $rU + "@" + $sel(cfg_get.pstn.gw_ip); 853 | } else { 854 | $ru = "sip:" + $rU + "@" + $sel(cfg_get.pstn.gw_ip) + ":" 855 | + $sel(cfg_get.pstn.gw_port); 856 | } 857 | 858 | route(RELAY); 859 | exit; 860 | #!endif 861 | 862 | return; 863 | } 864 | 865 | # XMLRPC routing 866 | #!ifdef WITH_XMLRPC 867 | route[XMLRPC] { 868 | # allow XMLRPC from localhost 869 | if ((method=="POST" || method=="GET") 870 | && (src_ip==127.0.0.1)) { 871 | # close connection only for xmlrpclib user agents (there is a bug in 872 | # xmlrpclib: it waits for EOF before interpreting the response). 873 | if ($hdr(User-Agent) =~ "xmlrpclib") 874 | set_reply_close(); 875 | set_reply_no_connect(); 876 | dispatch_rpc(); 877 | exit; 878 | } 879 | send_reply("403", "Forbidden"); 880 | exit; 881 | } 882 | #!endif 883 | 884 | # Routing to voicemail server 885 | route[TOVOICEMAIL] { 886 | #!ifdef WITH_VOICEMAIL 887 | if(!is_method("INVITE|SUBSCRIBE")) return; 888 | 889 | # check if VoiceMail server IP is defined 890 | if (strempty($sel(cfg_get.voicemail.srv_ip))) { 891 | xlog("SCRIPT: VoiceMail routing enabled but IP not defined\n"); 892 | return; 893 | } 894 | if(is_method("INVITE")) { 895 | if($avp(oexten)==$null) return; 896 | 897 | $ru = "sip:" + $avp(oexten) + "@" + $sel(cfg_get.voicemail.srv_ip) 898 | + ":" + $sel(cfg_get.voicemail.srv_port); 899 | } else { 900 | if($rU==$null) return; 901 | 902 | $ru = "sip:" + $rU + "@" + $sel(cfg_get.voicemail.srv_ip) 903 | + ":" + $sel(cfg_get.voicemail.srv_port); 904 | } 905 | route(RELAY); 906 | exit; 907 | #!endif 908 | 909 | return; 910 | } 911 | 912 | # Manage outgoing branches 913 | branch_route[MANAGE_BRANCH] { 914 | xdbg("new branch [$T_branch_idx] to $ru\n"); 915 | route(NATMANAGE); 916 | } 917 | 918 | # Manage incoming replies 919 | onreply_route[MANAGE_REPLY] { 920 | xdbg("incoming reply\n"); 921 | if(status=~"[12][0-9][0-9]") { 922 | route(NATMANAGE); 923 | } 924 | } 925 | 926 | # Manage failure routing cases 927 | failure_route[MANAGE_FAILURE] { 928 | route(NATMANAGE); 929 | 930 | if (t_is_canceled()) exit; 931 | 932 | #!ifdef WITH_BLOCK3XX 933 | # block call redirect based on 3xx replies. 934 | if (t_check_status("3[0-9][0-9]")) { 935 | t_reply("404","Not found"); 936 | exit; 937 | } 938 | #!endif 939 | 940 | #!ifdef WITH_VOICEMAIL 941 | # serial forking 942 | # - route to voicemail on busy or no answer (timeout) 943 | if (t_check_status("486|408")) { 944 | $du = $null; 945 | route(TOVOICEMAIL); 946 | exit; 947 | } 948 | #!endif 949 | } 950 | -------------------------------------------------------------------------------- /kamailio_4.4/conf/kamctlrc: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | # 3 | # The Kamailio configuration file for the control tools. 4 | # 5 | # Here you can set variables used in the kamctl and kamdbctl setup 6 | # scripts. Per default all variables here are commented out, the control tools 7 | # will use their internal default values. 8 | 9 | ## your SIP domain 10 | SIP_DOMAIN=10.0.100.26 11 | 12 | ## chrooted directory 13 | # $CHROOT_DIR="/path/to/chrooted/directory" 14 | 15 | ## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, DBTEXT, or SQLITE 16 | # by default none is loaded 17 | # 18 | # If you want to setup a database with kamdbctl, you must at least specify 19 | # this parameter. 20 | 21 | DBENGINE=MYSQL 22 | 23 | ## database host 24 | 25 | DBHOST=127.0.0.1 26 | 27 | ## database name (for ORACLE this is TNS name) 28 | DBNAME=kamailio 29 | 30 | # database path used by dbtext, db_berkeley or sqlite 31 | # DB_PATH="/usr/local/etc/kamailio/dbtext" 32 | 33 | ## database read/write user 34 | 35 | DBRWUSER="kamailio" 36 | 37 | ## password for database read/write user 38 | DBRWPW="kamailiorw" 39 | 40 | ## database read only user 41 | DBROUSER="kamailioro" 42 | 43 | ## password for database read only user 44 | DBROPW="kamailioro" 45 | 46 | ## database access host (from where is kamctl used) 47 | # DBACCESSHOST=192.168.0.1 48 | 49 | ## database super user (for ORACLE this is 'scheme-creator' user) 50 | DBROOTUSER="root" 51 | 52 | # user name column 53 | # USERCOL="username" 54 | 55 | 56 | # SQL definitions 57 | # If you change this definitions here, then you must change them 58 | # in db/schema/entities.xml too. 59 | # FIXME 60 | 61 | # FOREVER="2030-05-28 21:32:15" 62 | # DEFAULT_Q="1.0" 63 | 64 | 65 | # Program to calculate a message-digest fingerprint 66 | # MD5="md5sum" 67 | 68 | # awk tool 69 | # AWK="awk" 70 | 71 | # gdb tool 72 | # GDB="gdb" 73 | 74 | # If you use a system with a grep and egrep that is not 100% gnu grep compatible, 75 | # e.g. solaris, install the gnu grep (ggrep) and specify this below. 76 | # 77 | # grep tool 78 | # GREP="grep" 79 | 80 | # egrep tool 81 | # EGREP="egrep" 82 | 83 | # sed tool 84 | # SED="sed" 85 | 86 | # tail tool 87 | # LAST_LINE="tail -n 1" 88 | 89 | # expr tool 90 | # EXPR="expr" 91 | 92 | 93 | # Describe what additional tables to install. Valid values for the variables 94 | # below are yes/no/ask. With ask (default) it will interactively ask the user 95 | # for an answer, while yes/no allow for automated, unassisted installs. 96 | # 97 | 98 | # If to install tables for the modules in the EXTRA_MODULES variable. 99 | INSTALL_EXTRA_TABLES=yes 100 | 101 | # If to install presence related tables. 102 | INSTALL_PRESENCE_TABLES=yes 103 | 104 | # If to install uid modules related tables. 105 | INSTALL_DBUID_TABLES=yes 106 | 107 | # Define what module tables should be installed. 108 | # If you use the postgres database and want to change the installed tables, then you 109 | # must also adjust the STANDARD_TABLES or EXTRA_TABLES variable accordingly in the 110 | # kamdbctl.base script. 111 | 112 | # Kamailio standard modules 113 | # STANDARD_MODULES="standard acc lcr domain group permissions registrar usrloc msilo 114 | # alias_db uri_db speeddial avpops auth_db pdt dialog dispatcher 115 | # dialplan" 116 | 117 | # Kamailio extra modules 118 | # EXTRA_MODULES="imc cpl siptrace domainpolicy carrierroute userblacklist htable purple sca" 119 | 120 | 121 | ## type of aliases used: DB - database aliases; UL - usrloc aliases 122 | ## - default: none 123 | # ALIASES_TYPE="DB" 124 | 125 | ## control engine: FIFO or UNIXSOCK 126 | ## - default FIFO 127 | # CTLENGINE="FIFO" 128 | 129 | ## path to FIFO file 130 | FIFOPATH="/var/run/kamailio/kamailio_fifo" 131 | 132 | ## check ACL names; default on (1); off (0) 133 | # VERIFY_ACL=1 134 | 135 | ## ACL names - if VERIFY_ACL is set, only the ACL names from below list 136 | ## are accepted 137 | # ACL_GROUPS="local ld int voicemail free-pstn" 138 | 139 | ## verbose - debug purposes - default '0' 140 | # VERBOSE=1 141 | 142 | ## do (1) or don't (0) store plaintext passwords 143 | ## in the subscriber table - default '1' 144 | # STORE_PLAINTEXT_PW=0 145 | 146 | ## Kamailio START Options 147 | ## PID file path - default is: /var/run/kamailio.pid 148 | PID_FILE=/var/run/kamailio/kamailio.pid 149 | 150 | ## Extra start options - default is: not set 151 | # example: start Kamailio with 64MB share memory: STARTOPTIONS="-m 64" 152 | # STARTOPTIONS= 153 | -------------------------------------------------------------------------------- /kamailio_4.4/conf/modules.lst: -------------------------------------------------------------------------------- 1 | # this file is autogenerated by make modules-cfg 2 | 3 | # the list of sub-directories with modules 4 | modules_dirs:=modules 5 | 6 | # the list of module groups to compile 7 | cfg_group_include= 8 | 9 | # the list of extra modules to compile 10 | include_modules= 11 | 12 | # the list of static modules 13 | static_modules= 14 | 15 | # the list of modules to skip from compile list 16 | skip_modules= 17 | 18 | # the list of modules to exclude from compile list 19 | exclude_modules= acc_radius app_java app_lua app_mono app_perl app_python auth_ephemeral auth_identity auth_radius cdp cdp_avp cnxcc cpl-c crypto db2_ldap db_berkeley db_cassandra db_mongodb db_oracle db_perlvdb db_postgres db_sqlite db_unixodbc dnssec erlang evapi gzcompress h350 http_async_client http_client ims_auth ims_charging ims_dialog ims_icscf ims_isc ims_qos ims_registrar_pcscf ims_registrar_scscf ims_usrloc_pcscf ims_usrloc_scscf iptrtpproxy jansson janssonrpc-c json jsonrpc-c kazoo lcr ldap log_systemd memcached mi_xmlrpc misc_radius ndb_cassandra ndb_mongodb ndb_redis osp peering presence presence_conference presence_dialoginfo presence_mwi presence_profile presence_reginfo presence_xml pua pua_bla pua_dialoginfo pua_mi pua_reginfo pua_usrloc pua_xmpp purple rls sctp snmpstats uuid websocket xcap_client xcap_server xhttp_pi xmlops xmlrpc xmpp geoip2 $(skip_modules) 20 | 21 | modules_all= $(filter-out modules/CVS,$(wildcard modules/*)) 22 | modules_noinc= $(filter-out $(addprefix modules/, $(exclude_modules) $(static_modules)), $(modules_all)) 23 | modules= $(filter-out $(modules_noinc), $(addprefix modules/, $(include_modules) )) $(modules_noinc) 24 | modules_configured:=1 25 | -------------------------------------------------------------------------------- /kamailio_4.4/conf/req.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE REQUEST----- 2 | MIIC4zCCAcsCAQAwgYQxCzAJBgNVBAYTAkVTMQwwCgYDVQQIDANCQ04xEjAQBgNV 3 | BAcMCUJhcmNlbG9uYTERMA8GA1UECgwIQ296ZW50aWMxGDAWBgNVBAMMD3NpcC5j 4 | b3plbnRpYy5lczEmMCQGCSqGSIb3DQEJARYXZGF2aWQucm9kYUBjb3plbnRpYy5j 5 | b20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCho3UYnDnXD/Ab1iif 6 | VzxSUx7QKZz2wwerlzS3OsgCV0bYev57gu7CxxOlEdTFMM3RWOo4j/wCjvFXDDrE 7 | 3KS4At2WUkQY9NJCnJUYztR0pkqHtVXnZgT6hsdM326DP7qpho9LQnIg/f/qkesP 8 | 9LPRG7FPmXloIkEhaLX6GcWJWcabJfG8rTE5xWtWzHRqVc6c9MJc/RY5VAbzxF65 9 | I+ZY3+T8J9T+TDtI8qUFD4m7ZDzFno7xIn3z5UEuxHbj5gIVCiUE3DzJxXRWaO0/ 10 | SKdv4CK331wBFUqSJT1/dXxKZN9kmLCffE0ie4veHQcvx6U8wBFwnao6Hr1caXB/ 11 | exwbAgMBAAGgGTAXBgkqhkiG9w0BCQcxCgwIY296ZW50aWMwDQYJKoZIhvcNAQEL 12 | BQADggEBAGjO8oE/46USr39clrilvDKGThxeuPh79D5unB76MdXj71lpus1Q26iD 13 | 1fOz2pcuu6aHbUx1ZLmtNSu3RH5YJkK6QFOczA5IMklLwRAoh+z+WlKDVScr9omj 14 | fHgyfTE/lyRuMb2HhmJzvD11gEtuC7dCa80OT1hpwRna3pYSGlhGye6rFDd/VVtG 15 | cZgFSmh8/iFxalVyqo/68tosstFl80Q5NxDYyZVqAOEKqIU97HKSWVfEMvtGOVn3 16 | 7bOtoja4Uu3KCnmSndl0V/8FZGsiEsWBpi/oPXmbH7Pfz0NHG/H329kfDdTa75A+ 17 | hlFl7HOg+28xX7gc6xlAuFXTmXUP1UA= 18 | -----END CERTIFICATE REQUEST----- 19 | -------------------------------------------------------------------------------- /kamailio_4.4/conf/tls.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # Example Kamailio TLS Configuration File 3 | # 4 | 5 | # This is the default server domain, settings 6 | # in this domain will be used for all incoming 7 | # connections that do not match any other server 8 | # domain in this configuration file. 9 | # 10 | # We do not enable anything else than TLSv1 11 | # over the public internet. Clients do not have 12 | # to present client certificates by default. 13 | # 14 | [server:default] 15 | method = TLSv1 16 | verify_certificate = no 17 | require_certificate = no 18 | private_key = /usr/local/etc/kamailio/key.pem 19 | certificate = /usr/local/etc/kamailio/cert.pem 20 | ca_list = /usr/local/etc/kamailio/ca.pem 21 | #crl = ./modules/tls/crl.pem 22 | 23 | # This is the default client domain, settings 24 | # in this domain will be used for all outgoing 25 | # TLS connections that do not match any other 26 | # client domain in this configuration file. 27 | # We require that servers present valid certificate. 28 | # 29 | [client:default] 30 | verify_certificate = no 31 | require_certificate = no 32 | 33 | # This is an example server domain for TLS connections 34 | # received from the loopback interface. We allow 35 | # the use of SSLv2 and SSLv3 protocols here, we do 36 | # not require that clients present client certificates 37 | # but if they present it it must be valid. We also use 38 | # a special certificate and CA list for loopback 39 | # interface. 40 | # 41 | #[server:127.0.0.1:5061] 42 | #method = SSLv23 43 | #verify_certificate = yes 44 | #require_certificate = no 45 | #private_key = ./modules/tls/local_key.pem 46 | #certificate = ./modules/tls/local_cert.pem 47 | #verify_depth = 3 48 | #ca_list = local_ca.pem 49 | #crl = local_crl.pem 50 | 51 | # Special settings for the iptel.org public SIP 52 | # server. We do not verify the certificate of the 53 | # server because it can be expired. The server 54 | # implements authentication using SSL client 55 | # certificates so configure the client certificate 56 | # that was given to use by iptel.org staff here. 57 | # 58 | #[client:195.37.77.101:5061] 59 | #verify_certificate = no 60 | #certificate = ./modules/tls/iptel_client.pem 61 | #private_key = ./modules/tls/iptel_key.pem 62 | #ca_list = ./modules/tls/iptel_ca.pem 63 | #crl = ./modules/tls/iptel_crl.pem 64 | -------------------------------------------------------------------------------- /kamailio_4.4/create_database.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/expect 2 | spawn /usr/local/sbin/kamdbctl create; 3 | expect "MySQL password for root: "; 4 | send "passwd\r"; 5 | expect "END"; 6 | -------------------------------------------------------------------------------- /kamailio_4.4/default/kamailio: -------------------------------------------------------------------------------- 1 | # 2 | # Kamailio startup options 3 | # 4 | 5 | # Set to yes to enable kamailio, once configured properly. 6 | RUN_KAMAILIO=yes 7 | 8 | # User to run as 9 | #USER=kamailio 10 | 11 | # Group to run as 12 | #GROUP=kamailio 13 | 14 | # Amount of shared and private memory to allocate 15 | # for the running Kamailio server (in Mb) 16 | #SHM_MEMORY=64 17 | #PKG_MEMORY=8 18 | 19 | # Config file 20 | #CFGFILE=/etc/kamailio/kamailio.cfg 21 | 22 | # Enable the server to leave a core file when it crashes. 23 | # Set this to 'yes' to enable Kamailio to leave a core file when it crashes 24 | # or 'no' to disable this feature. This option is case sensitive and only 25 | # accepts 'yes' and 'no' and only in lowercase letters. 26 | # On some systems it is necessary to specify a directory for the core files 27 | # to get a dump. Look into the kamailio init file for an example configuration. 28 | #DUMP_CORE=yes 29 | -------------------------------------------------------------------------------- /kamailio_4.4/default/kamailio.init: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | ### BEGIN INIT INFO 4 | # Provides: kamailio 5 | # Required-Start: $syslog $network $local_fs $remote_fs $time 6 | # Should-Start: $named slapd mysql postgresql snmpd radiusd 7 | # Should-Stop: $named slapd mysql postgresql snmpd radiusd 8 | # Required-Stop: $syslog $network $local_fs $remote_fs 9 | # Default-Start: 2 3 4 5 10 | # Default-Stop: 0 1 6 11 | # Short-Description: Start the Kamailio SIP proxy server 12 | # Description: Start the Kamailio SIP proxy server 13 | ### END INIT INFO 14 | 15 | . /lib/lsb/init-functions 16 | 17 | PATH=/sbin:/bin:/usr/sbin:/usr/bin 18 | DAEMON=/usr/local/sbin/kamailio 19 | CFGFILE=/usr/local/etc/kamailio/kamailio.cfg 20 | NAME=`basename "$0"` 21 | DESC="Kamailio SIP Server" 22 | HOMEDIR=/var/run/$NAME 23 | PIDFILE=$HOMEDIR/$NAME.pid 24 | DEFAULTS=/etc/default/$NAME 25 | RUN_KAMAILIO=no 26 | USER=kamailio 27 | GROUP=kamailio 28 | # Amount of shared and private memory to allocate 29 | # for the running Kamailio server (in Mb) 30 | SHM_MEMORY=64 31 | PKG_MEMORY=8 32 | DUMP_CORE=no 33 | 34 | # Do not start kamailio if fork=no is set in the config file 35 | # otherwise the boot process will just stop 36 | check_fork () 37 | { 38 | if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" $CFGFILE; then 39 | log_failure_msg "Not starting $DESC: fork=no specified in config file; run /etc/init.d/kamailio debug instead" 40 | exit 0 41 | fi 42 | } 43 | 44 | check_kamailio_config () 45 | { 46 | # Check if kamailio configuration is valid before starting the server 47 | set +e 48 | out=$($DAEMON -f $CFGFILE -M $PKG_MEMORY -c 2>&1 > /dev/null) 49 | retcode=$? 50 | set -e 51 | if [ "$retcode" != '0' ]; then 52 | log_failure_msg "Not starting $DESC: invalid configuration file!" 53 | log_failure_msg 54 | log_failure_msg "$out" 55 | log_failure_msg 56 | exit 1 57 | fi 58 | } 59 | 60 | create_radius_seqfile () 61 | { 62 | # Create a radius sequence file to be used by the radius client if 63 | # radius accounting is enabled. This is needed to avoid any issue 64 | # with the file not being writable if kamailio first starts as user 65 | # root because DUMP_CORE is enabled and creates this file as user 66 | # root and then later it switches back to user kamailio and cannot 67 | # write to the file. If the file exists before kamailio starts, it 68 | # won't change it's ownership and will be writable for both root 69 | # and kamailio, no matter what options are chosen at install time 70 | RADIUS_SEQ_FILE="$HOMEDIR/kamailio_radius.seq" 71 | if [ -d $HOMEDIR ]; then 72 | chown ${USER}:${GROUP} $HOMEDIR 73 | 74 | if [ ! -f $RADIUS_SEQ_FILE ]; then 75 | touch $RADIUS_SEQ_FILE 76 | fi 77 | 78 | chown ${USER}:${GROUP} $RADIUS_SEQ_FILE 79 | chmod 660 $RADIUS_SEQ_FILE 80 | fi 81 | } 82 | 83 | test -f $DAEMON || exit 0 84 | 85 | # Load startup options if available 86 | if [ -f $DEFAULTS ]; then 87 | . $DEFAULTS || true 88 | fi 89 | 90 | if [ "$RUN_KAMAILIO" != "yes" ]; then 91 | log_failure_msg "Kamailio not yet configured. Edit /etc/default/$NAME first." 92 | exit 0 93 | fi 94 | 95 | set -e 96 | 97 | SHM_MEMORY=$((`echo $SHM_MEMORY | sed -e 's/[^0-9]//g'`)) 98 | PKG_MEMORY=$((`echo $PKG_MEMORY | sed -e 's/[^0-9]//g'`)) 99 | [ -z "$USER" ] && USER=kamailio 100 | [ -z "$GROUP" ] && GROUP=kamailio 101 | [ $SHM_MEMORY -le 0 ] && SHM_MEMORY=64 102 | [ $PKG_MEMORY -le 0 ] && PKG_MEMORY=4 103 | 104 | if test "$DUMP_CORE" = "yes" ; then 105 | # set proper ulimit 106 | ulimit -c unlimited 107 | 108 | # directory for the core dump files 109 | # COREDIR=/home/corefiles 110 | # [ -d $COREDIR ] || mkdir $COREDIR 111 | # chmod 777 $COREDIR 112 | # echo "$COREDIR/core.%e.sig%s.%p" > /proc/sys/kernel/core_pattern 113 | fi 114 | 115 | # /var/run can be a tmpfs 116 | if [ ! -d $HOMEDIR ]; then 117 | mkdir -p $HOMEDIR 118 | chown ${USER}:${GROUP} $HOMEDIR 119 | fi 120 | 121 | OPTIONS="-f $CFGFILE -P $PIDFILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP" 122 | 123 | case "$1" in 124 | start|debug) 125 | check_kamailio_config 126 | create_radius_seqfile 127 | 128 | if [ "$1" != "debug" ]; then 129 | check_fork 130 | fi 131 | 132 | log_daemon_msg "Starting $DESC: $NAME" 133 | start-stop-daemon --start --quiet --pidfile $PIDFILE \ 134 | --exec $DAEMON -- $OPTIONS || log_failure_msg " already running" 135 | log_end_msg 0 136 | ;; 137 | stop) 138 | log_daemon_msg "Stopping $DESC: $NAME" 139 | start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \ 140 | --exec $DAEMON 141 | log_end_msg 0 142 | ;; 143 | restart|force-reload) 144 | check_kamailio_config 145 | create_radius_seqfile 146 | 147 | $0 stop 148 | sleep 1 149 | $0 start 150 | ;; 151 | status) 152 | log_daemon_msg "Status of $DESC: " 153 | 154 | status_of_proc -p"$PIDFILE" $NAME $NAME 155 | ;; 156 | *) 157 | N=/etc/init.d/$NAME 158 | echo "Usage: $N {start|stop|restart|force-reload|status|debug}" >&2 159 | exit 1 160 | ;; 161 | esac 162 | 163 | exit 0 164 | -------------------------------------------------------------------------------- /kamailio_4.4/default/kamailio~: -------------------------------------------------------------------------------- 1 | # 2 | # Kamailio startup options 3 | # 4 | 5 | # Set to yes to enable kamailio, once configured properly. 6 | RUN_KAMAILIO=yes 7 | 8 | # User to run as 9 | USER=kamailio 10 | 11 | # Group to run as 12 | GROUP=kamailio 13 | 14 | # Amount of shared and private memory to allocate 15 | # for the running Kamailio server (in Mb) 16 | #SHM_MEMORY=64 17 | #PKG_MEMORY=8 18 | 19 | # Config file 20 | #CFGFILE=/etc/kamailio/kamailio.cfg 21 | 22 | # Enable the server to leave a core file when it crashes. 23 | # Set this to 'yes' to enable Kamailio to leave a core file when it crashes 24 | # or 'no' to disable this feature. This option is case sensitive and only 25 | # accepts 'yes' and 'no' and only in lowercase letters. 26 | # On some systems it is necessary to specify a directory for the core files 27 | # to get a dump. Look into the kamailio init file for an example configuration. 28 | #DUMP_CORE=yes 29 | -------------------------------------------------------------------------------- /kamailio_4.4_dbtext_rpi/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM resin/rpi-raspbian:jessie 2 | 3 | MAINTAINER Alberto Sagredo 4 | 5 | ENV build_date 2016-11-11 6 | 7 | ENV DEBIAN_FRONTEND noninteractive 8 | 9 | ENV SIP_PORT 5060 10 | 11 | ENV TLS_PORT 5061 12 | 13 | RUN rm -rf /var/lib/apt/lists/* 14 | 15 | RUN apt-get update && apt-get install --assume-yes joe git gcc automake build-essential flex bison libncurses5-dev xsltproc libssl-dev make libssl-dev libcurl4-openssl-dev libxml2-dev libpcre3-dev uuid-dev libicu-dev libunistring-dev libevent-dev autoconf libtool wget libconfuse-dev iproute expect python 16 | 17 | WORKDIR /usr/local/src/kamailio-4.4 18 | 19 | RUN mkdir -p /usr/local/src/kamailio-4.4 20 | 21 | RUN cd /usr/local/src/kamailio-4.4 22 | 23 | RUN git clone --depth 1 --no-single-branch git://git.kamailio.org/kamailio -b 4.4 /usr/local/src/kamailio-4.4 24 | 25 | WORKDIR /usr/local/src/kamailio-4.4 26 | 27 | RUN make cfg 28 | 29 | RUN make include_modules="presence_dialoginfo pua pua_dialoginfo pua_usrloc db_text dialplan nth presence presence_xml xml tls" cfg && \ 30 | make Q=0 all && \ 31 | make install 32 | 33 | ADD conf/etc/* /usr/local/etc/kamailio/ 34 | 35 | ADD boot_run.sh /etc/ 36 | 37 | WORKDIR /usr/local/etc/kamailio/ 38 | 39 | RUN mkdir /usr/local/etc/kamailio/certs 40 | 41 | ADD conf/etc/certs/* /usr/local/etc/kamailio/certs/ 42 | 43 | COPY conf/default/kamailio /etc/default/kamailio 44 | 45 | COPY conf/default/kamailio.init /etc/init.d/kamailio 46 | 47 | RUN chmod 755 /etc/init.d/kamailio 48 | 49 | RUN mkdir -p /var/run/kamailio 50 | 51 | # Patch to use kamctl to add sip extensiones 52 | 53 | COPY conf/etc/subscriber /usr/local/share/kamailio/dbtext/kamailio/subscriber 54 | 55 | RUN chmod a+x /usr/local/share/kamailio/dbtext/kamailio/subscriber 56 | 57 | EXPOSE $SIP_PORT $SIP_PORT/udp $TLS_PORT 58 | 59 | RUN chmod a+x /etc/boot_run.sh 60 | 61 | ENTRYPOINT ["/etc/boot_run.sh"] 62 | -------------------------------------------------------------------------------- /kamailio_4.4_dbtext_rpi/Makefile: -------------------------------------------------------------------------------- 1 | NAME = voipnovatos/kamailio-rpi-dbtext 2 | VERSION = latest 3 | 4 | .PHONY: all build run 5 | 6 | all: build 7 | 8 | build: 9 | 10 | @docker build -t $(NAME):$(VERSION) . 11 | 12 | run: 13 | @docker run -dt -p 5060:5060 -p 5060:5060/udp -p 5061:5061 -e ADVERTISED_IP="10.0.200.94" --name=kamailio -h "kamailio.local" voipnovatos/kamailio-rpi-dbtext 14 | 15 | 16 | -------------------------------------------------------------------------------- /kamailio_4.4_dbtext_rpi/boot_run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MYSQL_PWD=${MYSQL_PWD:-"passwd"} 4 | 5 | ADVERTISED_IP=${ADVERTISED_IP:-"127.0.0.1"} 6 | 7 | HOST_IP=$(ip route get 8.8.8.8 | awk '{print $NF; exit}') 8 | 9 | SIP_PORT=5060 10 | 11 | TLS_PORT=5061 12 | 13 | echo "Your IP : ${HOST_IP}" 14 | 15 | echo -e "Your Advertised IP : ${ADVERTISED_IP}\n\n" 16 | 17 | echo -e "Your Kamailio SIP Port : ${SIP_PORT}\n\n" 18 | 19 | # Configure kamailio.cfg 20 | 21 | sed -i "s/alias=.*/alias=\"${ADVERTISED_IP}\"/g" /usr/local/etc/kamailio/kamailio.cfg 22 | 23 | sed -i "s/listen=udp.*/listen=udp:${HOST_IP}:5060 advertise ${ADVERTISED_IP}:5060/g" /usr/local/etc/kamailio/kamailio.cfg 24 | 25 | sed -i "s/listen=tcp.*/listen=tcp:${HOST_IP}:5060 advertise ${ADVERTISED_IP}:5060/g" /usr/local/etc/kamailio/kamailio.cfg 26 | 27 | sed -i "s/listen=tls.*/listen=tls:${HOST_IP}:5061 advertise ${ADVERTISED_IP}:5061/g" /usr/local/etc/kamailio/kamailio.cfg 28 | 29 | #sed -i "s/port=.*/port=${SIP_PORT}/g" /usr/local/etc/kamailio/kamailio.cfg 30 | 31 | sed -i "s/SIP_DOMAIN=.*/SIP_DOMAIN=${ADVERTISED_IP}/g" /usr/local/etc/kamailio/kamctlrc 32 | 33 | #mkdir /var/spool/rtpengine 34 | 35 | #rtpengine -p /var/run/rtpengine.pid --interface=127.0.0.1!$ADVERTISED_IP -n 127.0.0.1:60000 -c 127.0.0.1:60001 -m 20000 -M 30000 -E -L 7 36 | 37 | # Auto Create Database 38 | 39 | kamdbctl create 40 | 41 | kamctl add 100 snom 42 | 43 | kamctl add 101 snom 44 | 45 | kamctl add 102 snom 46 | 47 | kamctl add 103 snom 48 | 49 | kamctl add 104 snom 50 | 51 | kamctl add 105 snom 52 | 53 | kamctl add 106 snom 54 | 55 | kamctl add 107 snom 56 | 57 | kamctl add 108 snom 58 | 59 | kamctl add 109 snom 60 | 61 | kamctl add 110 snom 62 | 63 | kamctl add 200 snom 64 | 65 | kamctl add 201 snom 66 | 67 | kamctl add 202 snom 68 | 69 | # Starting Kamailio process 70 | 71 | /usr/local/sbin/kamailio -DD -P/var/run/kamailio/kamailio.pid -f /usr/local/etc/kamailio/kamailio.cfg 72 | 73 | /bin/bash -------------------------------------------------------------------------------- /kamailio_4.4_dbtext_rpi/build/modules.lst: -------------------------------------------------------------------------------- 1 | # this file is autogenerated by make modules-cfg 2 | 3 | # the list of sub-directories with modules 4 | modules_dirs:=modules 5 | 6 | # the list of module groups to compile 7 | cfg_group_include= 8 | 9 | # the list of extra modules to compile 10 | include_modules= stun outbound path uuid ctl xhttp kex tm tmx sl rr maxfwd siputils presence presence_conference presence_dialoginfo presence_mwi presence_profile presence_reginfo presence_xml websocket tls pua_dialoginfo snmpstats ctl cfg_rpc kex tm tmx sl rr maxfwd siputils sanity textops htable pv xlog mi_fifo uac uac_redirect db_text kazoo dispatcher rtimer timer sqlops 11 | 12 | # the list of static modules 13 | static_modules= 14 | 15 | # the list of modules to skip from compile list 16 | skip_modules= alias_db path corex mi_rpc async auth_diameter avpops avp benchmark blst call_control cfg_db counters db2_ops db_cluster db_flatstore debugger diversion dmq domainpolicy domain drouting enum exec group imc ipops malloc_test mangler matrix mediaproxy mi_datagram mqueue msilo msrp mtree nat_traversal pdb pdt pipelimit prefix_route print_lib print p_usrloc qos ratelimit rtpproxy sca sdpops seas sipcapture siptrace sms speeddial sst statistics tmrec topoh uid_auth_db uid_avp_db uid_domain uid_gflags uid_uri_db uri_db userblacklist xhttp_rpc xprint 17 | 18 | # the list of modules to exclude from compile list 19 | exclude_modules= acc_radius app_java app_lua app_mono app_perl app_python auth_ephemeral auth_identity auth_radius cdp cdp_avp cnxcc cpl-c crypto db2_ldap db_berkeley db_cassandra db_mongodb db_mysql db_oracle db_perlvdb db_postgres db_sqlite db_unixodbc dialplan dnssec evapi geoip geoip2 gzcompress h350 http_async_client http_client ims_auth ims_charging ims_dialog ims_icscf ims_isc ims_qos ims_registrar_pcscf ims_registrar_scscf ims_usrloc_pcscf ims_usrloc_scscf iptrtpproxy jansson janssonrpc-c json jsonrpc-c lcr ldap log_systemd memcached mi_xmlrpc misc_radius ndb_cassandra ndb_mongodb ndb_redis osp outbound peering pua pua_bla pua_dialoginfo pua_mi pua_reginfo pua_usrloc pua_xmpp purple regex rls sctp snmpstats tls utils uuid websocket xcap_client xcap_server xhttp_pi xmlops xmlrpc xmpp $(skip_modules) 20 | 21 | #enabled carrierroute erlang cfg_rpc 22 | 23 | modules_all= $(filter-out modules/CVS,$(wildcard modules/*)) 24 | modules_noinc= $(filter-out $(addprefix modules/, $(exclude_modules) $(static_modules)), $(modules_all)) 25 | modules= $(filter-out $(modules_noinc), $(addprefix modules/, $(include_modules) )) $(modules_noinc) 26 | modules_configured:=1 27 | -------------------------------------------------------------------------------- /kamailio_4.4_dbtext_rpi/conf/default/kamailio: -------------------------------------------------------------------------------- 1 | # 2 | # Kamailio startup options 3 | # 4 | 5 | # Set to yes to enable kamailio, once configured properly. 6 | RUN_KAMAILIO=yes 7 | 8 | # User to run as 9 | #USER=kamailio 10 | 11 | # Group to run as 12 | #GROUP=kamailio 13 | 14 | # Amount of shared and private memory to allocate 15 | # for the running Kamailio server (in Mb) 16 | #SHM_MEMORY=64 17 | #PKG_MEMORY=8 18 | 19 | # Config file 20 | #CFGFILE=/etc/kamailio/kamailio.cfg 21 | 22 | # Enable the server to leave a core file when it crashes. 23 | # Set this to 'yes' to enable Kamailio to leave a core file when it crashes 24 | # or 'no' to disable this feature. This option is case sensitive and only 25 | # accepts 'yes' and 'no' and only in lowercase letters. 26 | # On some systems it is necessary to specify a directory for the core files 27 | # to get a dump. Look into the kamailio init file for an example configuration. 28 | #DUMP_CORE=yes 29 | -------------------------------------------------------------------------------- /kamailio_4.4_dbtext_rpi/conf/default/kamailio.init: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | ### BEGIN INIT INFO 4 | # Provides: kamailio 5 | # Required-Start: $syslog $network $local_fs $remote_fs $time 6 | # Should-Start: $named slapd mysql postgresql snmpd radiusd 7 | # Should-Stop: $named slapd mysql postgresql snmpd radiusd 8 | # Required-Stop: $syslog $network $local_fs $remote_fs 9 | # Default-Start: 2 3 4 5 10 | # Default-Stop: 0 1 6 11 | # Short-Description: Start the Kamailio SIP proxy server 12 | # Description: Start the Kamailio SIP proxy server 13 | ### END INIT INFO 14 | 15 | . /lib/lsb/init-functions 16 | 17 | PATH=/sbin:/bin:/usr/sbin:/usr/bin 18 | DAEMON=/usr/local/sbin/kamailio 19 | CFGFILE=/usr/local/etc/kamailio/kamailio.cfg 20 | NAME=`basename "$0"` 21 | DESC="Kamailio SIP Server" 22 | HOMEDIR=/var/run/$NAME 23 | PIDFILE=$HOMEDIR/$NAME.pid 24 | DEFAULTS=/etc/default/$NAME 25 | RUN_KAMAILIO=no 26 | USER=kamailio 27 | GROUP=kamailio 28 | # Amount of shared and private memory to allocate 29 | # for the running Kamailio server (in Mb) 30 | SHM_MEMORY=64 31 | PKG_MEMORY=8 32 | DUMP_CORE=no 33 | 34 | # Do not start kamailio if fork=no is set in the config file 35 | # otherwise the boot process will just stop 36 | check_fork () 37 | { 38 | if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" $CFGFILE; then 39 | log_failure_msg "Not starting $DESC: fork=no specified in config file; run /etc/init.d/kamailio debug instead" 40 | exit 0 41 | fi 42 | } 43 | 44 | check_kamailio_config () 45 | { 46 | # Check if kamailio configuration is valid before starting the server 47 | set +e 48 | out=$($DAEMON -f $CFGFILE -M $PKG_MEMORY -c 2>&1 > /dev/null) 49 | retcode=$? 50 | set -e 51 | if [ "$retcode" != '0' ]; then 52 | log_failure_msg "Not starting $DESC: invalid configuration file!" 53 | log_failure_msg 54 | log_failure_msg "$out" 55 | log_failure_msg 56 | exit 1 57 | fi 58 | } 59 | 60 | create_radius_seqfile () 61 | { 62 | # Create a radius sequence file to be used by the radius client if 63 | # radius accounting is enabled. This is needed to avoid any issue 64 | # with the file not being writable if kamailio first starts as user 65 | # root because DUMP_CORE is enabled and creates this file as user 66 | # root and then later it switches back to user kamailio and cannot 67 | # write to the file. If the file exists before kamailio starts, it 68 | # won't change it's ownership and will be writable for both root 69 | # and kamailio, no matter what options are chosen at install time 70 | RADIUS_SEQ_FILE="$HOMEDIR/kamailio_radius.seq" 71 | if [ -d $HOMEDIR ]; then 72 | chown ${USER}:${GROUP} $HOMEDIR 73 | 74 | if [ ! -f $RADIUS_SEQ_FILE ]; then 75 | touch $RADIUS_SEQ_FILE 76 | fi 77 | 78 | chown ${USER}:${GROUP} $RADIUS_SEQ_FILE 79 | chmod 660 $RADIUS_SEQ_FILE 80 | fi 81 | } 82 | 83 | test -f $DAEMON || exit 0 84 | 85 | # Load startup options if available 86 | if [ -f $DEFAULTS ]; then 87 | . $DEFAULTS || true 88 | fi 89 | 90 | if [ "$RUN_KAMAILIO" != "yes" ]; then 91 | log_failure_msg "Kamailio not yet configured. Edit /etc/default/$NAME first." 92 | exit 0 93 | fi 94 | 95 | set -e 96 | 97 | SHM_MEMORY=$((`echo $SHM_MEMORY | sed -e 's/[^0-9]//g'`)) 98 | PKG_MEMORY=$((`echo $PKG_MEMORY | sed -e 's/[^0-9]//g'`)) 99 | [ -z "$USER" ] && USER=kamailio 100 | [ -z "$GROUP" ] && GROUP=kamailio 101 | [ $SHM_MEMORY -le 0 ] && SHM_MEMORY=64 102 | [ $PKG_MEMORY -le 0 ] && PKG_MEMORY=4 103 | 104 | if test "$DUMP_CORE" = "yes" ; then 105 | # set proper ulimit 106 | ulimit -c unlimited 107 | 108 | # directory for the core dump files 109 | # COREDIR=/home/corefiles 110 | # [ -d $COREDIR ] || mkdir $COREDIR 111 | # chmod 777 $COREDIR 112 | # echo "$COREDIR/core.%e.sig%s.%p" > /proc/sys/kernel/core_pattern 113 | fi 114 | 115 | # /var/run can be a tmpfs 116 | if [ ! -d $HOMEDIR ]; then 117 | mkdir -p $HOMEDIR 118 | chown ${USER}:${GROUP} $HOMEDIR 119 | fi 120 | 121 | OPTIONS="-f $CFGFILE -P $PIDFILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP" 122 | 123 | case "$1" in 124 | start|debug) 125 | check_kamailio_config 126 | create_radius_seqfile 127 | 128 | if [ "$1" != "debug" ]; then 129 | check_fork 130 | fi 131 | 132 | log_daemon_msg "Starting $DESC: $NAME" 133 | start-stop-daemon --start --quiet --pidfile $PIDFILE \ 134 | --exec $DAEMON -- $OPTIONS || log_failure_msg " already running" 135 | log_end_msg 0 136 | ;; 137 | stop) 138 | log_daemon_msg "Stopping $DESC: $NAME" 139 | start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \ 140 | --exec $DAEMON 141 | log_end_msg 0 142 | ;; 143 | restart|force-reload) 144 | check_kamailio_config 145 | create_radius_seqfile 146 | 147 | $0 stop 148 | sleep 1 149 | $0 start 150 | ;; 151 | status) 152 | log_daemon_msg "Status of $DESC: " 153 | 154 | status_of_proc -p"$PIDFILE" $NAME $NAME 155 | ;; 156 | *) 157 | N=/etc/init.d/$NAME 158 | echo "Usage: $N {start|stop|restart|force-reload|status|debug}" >&2 159 | exit 1 160 | ;; 161 | esac 162 | 163 | exit 0 164 | -------------------------------------------------------------------------------- /kamailio_4.4_dbtext_rpi/conf/etc/certs/.placeholder: -------------------------------------------------------------------------------- 1 | ensure certs directory gets created -------------------------------------------------------------------------------- /kamailio_4.4_dbtext_rpi/conf/etc/certs/ca.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIID3TCCAsWgAwIBAgIJAILY4WXBo089MA0GCSqGSIb3DQEBCwUAMIGEMQswCQYD 3 | VQQGEwJFUzEMMAoGA1UECAwDQkNOMRIwEAYDVQQHDAlCYXJjZWxvbmExETAPBgNV 4 | BAoMCENvemVudGljMRgwFgYDVQQDDA9zaXAuY296ZW50aWMuZXMxJjAkBgkqhkiG 5 | 9w0BCQEWF2RhdmlkLnJvZGFAY296ZW50aWMuY29tMB4XDTE2MDMxODIyNDQxMloX 6 | DTI2MDMxNjIyNDQxMlowgYQxCzAJBgNVBAYTAkVTMQwwCgYDVQQIDANCQ04xEjAQ 7 | BgNVBAcMCUJhcmNlbG9uYTERMA8GA1UECgwIQ296ZW50aWMxGDAWBgNVBAMMD3Np 8 | cC5jb3plbnRpYy5lczEmMCQGCSqGSIb3DQEJARYXZGF2aWQucm9kYUBjb3plbnRp 9 | Yy5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzyM9Xh3ser29v 10 | y/igrrYwfBHrjW5g+jaQqvjLLQDZB8s8DIj9tWI3jqSF0GXrZDWp9yjOCqkMUhpo 11 | lVFbCptSK7VUpXnS40p7bkm8FhCTrCxXKddxRT3tPd7Y758BLwREeFDYxKgkxo/9 12 | m96cRF4kMCa9dOzjk9+pSQqJC6QaJQEIIxpNZYMwQcQwdUnEtGVKg+0bIv7xQkeN 13 | yhF4ikygWcRnBExTmq/TV6mu/R6TGGEO2fxFWu4S4DQkpeScaaWuJeS0kBMn5xar 14 | V+4W7qbODKkw4XNxW56YprSZFk3EQZDUK5rdE19Dlg5xirkGTbZdbQ0nVmxtEXtx 15 | 9K5hN9AhAgMBAAGjUDBOMB0GA1UdDgQWBBSUr9/8K6s0BwVEz5SFtV90rdRzoTAf 16 | BgNVHSMEGDAWgBSUr9/8K6s0BwVEz5SFtV90rdRzoTAMBgNVHRMEBTADAQH/MA0G 17 | CSqGSIb3DQEBCwUAA4IBAQBTxkPr1VY/DsnWcA7DjiPO8bMc6IYSiFA/X8bD1dAP 18 | h5GE9FUmPbiobid1wxWGqdYs80dRAPW+ITu0Gcuq+taUvkqznsati0B99l1qNlQe 19 | 13ek8WyT6QJ7+15kZIoNWr6fht06gJRYEUL+WL7QTq6j2/xVZXEiLPIajDL8VbgC 20 | vZypGuF1gR6YCqz3nSFB3Zj6DjStcR8AM5dze+v3bTqddSuha+ajggqwysUYwfZA 21 | yv4R29MOxQVU/uJt8EPnp8X1OKZciViS48PadbZoiTIPCqDcyqI3FFxtkBbL1Syy 22 | Qr0/iFva/o7tdMBuMWisBFZCu5y6KJXMRt5i6+tswALo 23 | -----END CERTIFICATE----- 24 | -------------------------------------------------------------------------------- /kamailio_4.4_dbtext_rpi/conf/etc/certs/kamailio-selfsigned.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBANlHQ9WEqEpHwTs8 3 | OFj8tIp+z9Q9YRJflIbdhw5tEK8Vj9OPoqfvM8mXxFyd9FS79RzTJk0u7UWpazsw 4 | 5tdiqp9zy4uIcqyCqaQIeR+VyUq9pscTROHUeQSYDA23anXo75jVRPCwRvT2MpDu 5 | n5uDQEuWnz+u+aUhXGBCGOoZH9gvAgMBAAECgYAO+2oDBBWyoYYCdqGQCUTNs/bS 6 | tLTH1o1gS1Avv3eCCyOSu/nESKsygGOK211oplk9dpXShqTXw9ngB/wy59vJ6Eo/ 7 | KDHJZDOdymZEYqvbpHJychkv6zzENLy69orTM2vB3BVGGqSP1m7B6PzmHKRysTKO 8 | X75kChS0ty4rVwm6sQJBAP9nSn/Z1y1WEyaXbzBYpZOSZ7YPaQWUiTu74dUGVkMO 9 | JIUFq1og3cRmwiUPTBm7G6HFKsQ/1Z2hnEbmAIdXx3kCQQDZyS2w6A2WTZ5AMzhb 10 | 6LmKfgfAtOBIewgbSG1poD5Wks8EyD09hmyt4cS319pmX3COpEnsjUvVfU/pllwa 11 | eSrnAkEAh9o9enw5RNhAH4r1jdXZXQHHQMQ5rMoxpSBvI4zXXZusOUWmu643yDyQ 12 | kH3ukNFCBW6HLRR3X/2SzvOQ3G0IoQJBALi3u7tKdwu+tbS6PNknoQdoMecvAvQ2 13 | 9f8+BR8LvRPs3Q2vUNH4TAGHdjSALkuaM3uouNKcXW+sI7V5xJDnqI0CQDtCI3A+ 14 | V09BXhd9GHLg9AiajFDCtbCX9gyjYL9eVei6J4nkwJk8CcBXpwr8FA7t1oYlG8ii 15 | EF4qtGd/6LFAmM8= 16 | -----END PRIVATE KEY----- 17 | -------------------------------------------------------------------------------- /kamailio_4.4_dbtext_rpi/conf/etc/certs/kamailio-selfsigned.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICmzCCAgQCCQCPEDnYk9mhaTANBgkqhkiG9w0BAQUFADCBkTEtMCsGA1UEChMk 3 | U2VsZi1zaWduZWQgY2VydGlmaWNhdGUgZm9yIGthbWFpbGlvMQ8wDQYDVQQLEwZt 4 | YWNwcGMxITAfBgNVBAMTGG1hY3BwYy5wb3J0cy5vcGVuYnNkLm9yZzEsMCoGCSqG 5 | SIb3DQEJARYdcm9vdEBtYWNwcGMucG9ydHMub3BlbmJzZC5vcmcwHhcNMTIwODEw 6 | MTE1MDE2WhcNMTMwODEwMTE1MDE2WjCBkTEtMCsGA1UEChMkU2VsZi1zaWduZWQg 7 | Y2VydGlmaWNhdGUgZm9yIGthbWFpbGlvMQ8wDQYDVQQLEwZtYWNwcGMxITAfBgNV 8 | BAMTGG1hY3BwYy5wb3J0cy5vcGVuYnNkLm9yZzEsMCoGCSqGSIb3DQEJARYdcm9v 9 | dEBtYWNwcGMucG9ydHMub3BlbmJzZC5vcmcwgZ8wDQYJKoZIhvcNAQEBBQADgY0A 10 | MIGJAoGBANlHQ9WEqEpHwTs8OFj8tIp+z9Q9YRJflIbdhw5tEK8Vj9OPoqfvM8mX 11 | xFyd9FS79RzTJk0u7UWpazsw5tdiqp9zy4uIcqyCqaQIeR+VyUq9pscTROHUeQSY 12 | DA23anXo75jVRPCwRvT2MpDun5uDQEuWnz+u+aUhXGBCGOoZH9gvAgMBAAEwDQYJ 13 | KoZIhvcNAQEFBQADgYEAwKOB5sDunJ0KnuBZ/Y2twy0htT0ST/hPFif37BDAZdb0 14 | e0mzeLOe8cJ9F51o8prbbLUiqkaey44LSrfE45AQOVEEuFVxpaFjO3Z/vXsXzk9t 15 | UcrATorqpAMf0eih0EMaaRox+K3gUauAPtnYNphGK3G4X3yvt4TmgqOJ6S+t72I= 16 | -----END CERTIFICATE----- 17 | -------------------------------------------------------------------------------- /kamailio_4.4_dbtext_rpi/conf/etc/certs/req.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE REQUEST----- 2 | MIIC4zCCAcsCAQAwgYQxCzAJBgNVBAYTAkVTMQwwCgYDVQQIDANCQ04xEjAQBgNV 3 | BAcMCUJhcmNlbG9uYTERMA8GA1UECgwIQ296ZW50aWMxGDAWBgNVBAMMD3NpcC5j 4 | b3plbnRpYy5lczEmMCQGCSqGSIb3DQEJARYXZGF2aWQucm9kYUBjb3plbnRpYy5j 5 | b20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCho3UYnDnXD/Ab1iif 6 | VzxSUx7QKZz2wwerlzS3OsgCV0bYev57gu7CxxOlEdTFMM3RWOo4j/wCjvFXDDrE 7 | 3KS4At2WUkQY9NJCnJUYztR0pkqHtVXnZgT6hsdM326DP7qpho9LQnIg/f/qkesP 8 | 9LPRG7FPmXloIkEhaLX6GcWJWcabJfG8rTE5xWtWzHRqVc6c9MJc/RY5VAbzxF65 9 | I+ZY3+T8J9T+TDtI8qUFD4m7ZDzFno7xIn3z5UEuxHbj5gIVCiUE3DzJxXRWaO0/ 10 | SKdv4CK331wBFUqSJT1/dXxKZN9kmLCffE0ie4veHQcvx6U8wBFwnao6Hr1caXB/ 11 | exwbAgMBAAGgGTAXBgkqhkiG9w0BCQcxCgwIY296ZW50aWMwDQYJKoZIhvcNAQEL 12 | BQADggEBAGjO8oE/46USr39clrilvDKGThxeuPh79D5unB76MdXj71lpus1Q26iD 13 | 1fOz2pcuu6aHbUx1ZLmtNSu3RH5YJkK6QFOczA5IMklLwRAoh+z+WlKDVScr9omj 14 | fHgyfTE/lyRuMb2HhmJzvD11gEtuC7dCa80OT1hpwRna3pYSGlhGye6rFDd/VVtG 15 | cZgFSmh8/iFxalVyqo/68tosstFl80Q5NxDYyZVqAOEKqIU97HKSWVfEMvtGOVn3 16 | 7bOtoja4Uu3KCnmSndl0V/8FZGsiEsWBpi/oPXmbH7Pfz0NHG/H329kfDdTa75A+ 17 | hlFl7HOg+28xX7gc6xlAuFXTmXUP1UA= 18 | -----END CERTIFICATE REQUEST----- 19 | -------------------------------------------------------------------------------- /kamailio_4.4_dbtext_rpi/conf/etc/dictionary.kamailio: -------------------------------------------------------------------------------- 1 | # 2 | # $Id$ 3 | # 4 | # SIP RADIUS attributes 5 | # 6 | # Proprietary indicates an attribute that hasn't 7 | # been standardized 8 | # 9 | # 10 | # NOTE: All standard (IANA registered) attributes are 11 | # defined in the default dictionary of the 12 | # radiusclient-ng library. 13 | # 14 | 15 | 16 | #### Attributes ### 17 | ATTRIBUTE Sip-Uri-User 208 string # Proprietary, auth_radius 18 | ATTRIBUTE Sip-Group 211 string # Proprietary, group_radius 19 | ATTRIBUTE Sip-Rpid 213 string # Proprietary, auth_radius 20 | ATTRIBUTE SIP-AVP 225 string # Proprietary, avp_radius 21 | 22 | ### Acct-Status-Type Values ### 23 | #VALUE Acct-Status-Type Failed 15 # RFC2866, acc 24 | 25 | ### Service-Type Values ### 26 | #VALUE Service-Type Call-Check 10 # RFC2865, uri_radius 27 | VALUE Service-Type Group-Check 12 # Proprietary, group_radius 28 | ##VALUE Service-Type Sip-Session 15 # Schulzrinne, acc, auth_radius 29 | VALUE Service-Type SIP-Caller-AVPs 30 # Proprietary, avp_radius 30 | VALUE Service-Type SIP-Callee-AVPs 31 # Proprietary, avp_radius 31 | 32 | ### Sip-Method Values ### 33 | VALUE Sip-Method Undefined 0 34 | VALUE Sip-Method Invite 1 35 | VALUE Sip-Method Cancel 2 36 | VALUE Sip-Method Ack 4 37 | VALUE Sip-Method Bye 8 38 | VALUE Sip-Method Info 16 39 | VALUE Sip-Method Options 32 40 | VALUE Sip-Method Update 64 41 | VALUE Sip-Method Register 128 42 | VALUE Sip-Method Message 256 43 | VALUE Sip-Method Subscribe 512 44 | VALUE Sip-Method Notify 1024 45 | VALUE Sip-Method Prack 2048 46 | VALUE Sip-Method Refer 4096 47 | VALUE Sip-Method Other 8192 48 | 49 | 50 | -------------------------------------------------------------------------------- /kamailio_4.4_dbtext_rpi/conf/etc/kamctlrc: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | # 3 | # The Kamailio configuration file for the control tools. 4 | # 5 | # Here you can set variables used in the kamctl and kamdbctl setup 6 | # scripts. Per default all variables here are commented out, the control tools 7 | # will use their internal default values. 8 | 9 | ## your SIP domain 10 | SIP_DOMAIN=10.0.200.94 11 | 12 | ## chrooted directory 13 | # $CHROOT_DIR="/path/to/chrooted/directory" 14 | 15 | ## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, DBTEXT, or SQLITE 16 | # by default none is loaded 17 | # 18 | # If you want to setup a database with kamdbctl, you must at least specify 19 | # this parameter. 20 | 21 | DBENGINE=DBTEXT 22 | 23 | ## database host 24 | 25 | #DBHOST=127.0.0.1 26 | 27 | ## database name (for ORACLE this is TNS name) 28 | #DBNAME=kamailio 29 | 30 | # database path used by dbtext, db_berkeley or sqlite 31 | DB_PATH="/usr/local/share/kamailio/dbtext/kamailio/" 32 | USERCOL="username" 33 | 34 | ## database read/write user 35 | 36 | #DBRWUSER="kamailio" 37 | 38 | ## password for database read/write user 39 | #DBRWPW="kamailiorw" 40 | 41 | ## database read only user 42 | #DBROUSER="kamailioro" 43 | 44 | ## password for database read only user 45 | #DBROPW="kamailioro" 46 | 47 | ## database access host (from where is kamctl used) 48 | # DBACCESSHOST=192.168.0.1 49 | 50 | ## database super user (for ORACLE this is 'scheme-creator' user) 51 | #DBROOTUSER="root" 52 | 53 | # user name column 54 | # USERCOL="username" 55 | 56 | 57 | # SQL definitions 58 | # If you change this definitions here, then you must change them 59 | # in db/schema/entities.xml too. 60 | # FIXME 61 | 62 | # FOREVER="2030-05-28 21:32:15" 63 | # DEFAULT_Q="1.0" 64 | 65 | 66 | # Program to calculate a message-digest fingerprint 67 | # MD5="md5sum" 68 | 69 | # awk tool 70 | # AWK="awk" 71 | 72 | # gdb tool 73 | # GDB="gdb" 74 | 75 | # If you use a system with a grep and egrep that is not 100% gnu grep compatible, 76 | # e.g. solaris, install the gnu grep (ggrep) and specify this below. 77 | # 78 | # grep tool 79 | # GREP="grep" 80 | 81 | # egrep tool 82 | # EGREP="egrep" 83 | 84 | # sed tool 85 | # SED="sed" 86 | 87 | # tail tool 88 | # LAST_LINE="tail -n 1" 89 | 90 | # expr tool 91 | # EXPR="expr" 92 | 93 | 94 | # Describe what additional tables to install. Valid values for the variables 95 | # below are yes/no/ask. With ask (default) it will interactively ask the user 96 | # for an answer, while yes/no allow for automated, unassisted installs. 97 | # 98 | 99 | # If to install tables for the modules in the EXTRA_MODULES variable. 100 | INSTALL_EXTRA_TABLES=yes 101 | 102 | # If to install presence related tables. 103 | INSTALL_PRESENCE_TABLES=yes 104 | 105 | # If to install uid modules related tables. 106 | INSTALL_DBUID_TABLES=yes 107 | 108 | # Define what module tables should be installed. 109 | # If you use the postgres database and want to change the installed tables, then you 110 | # must also adjust the STANDARD_TABLES or EXTRA_TABLES variable accordingly in the 111 | # kamdbctl.base script. 112 | 113 | # Kamailio standard modules 114 | STANDARD_MODULES="presence_dialoginfo pua pua_dialoginfo pua_usrloc db_text dialplan nth presence presence_xml xml tls" 115 | # standard acc lcr domain group permissions registrar usrloc msilo 116 | # alias_db uri_db speeddial avpops auth_db pdt dialog dispatcher 117 | # dialplan" 118 | 119 | # Kamailio extra modules 120 | # EXTRA_MODULES="imc cpl siptrace domainpolicy carrierroute userblacklist htable purple sca" 121 | 122 | 123 | ## type of aliases used: DB - database aliases; UL - usrloc aliases 124 | ## - default: none 125 | # ALIASES_TYPE="DB" 126 | 127 | ## control engine: FIFO or UNIXSOCK 128 | ## - default FIFO 129 | # CTLENGINE="FIFO" 130 | 131 | ## path to FIFO file 132 | FIFOPATH="/var/run/kamailio/kamailio_fifo" 133 | 134 | ## check ACL names; default on (1); off (0) 135 | # VERIFY_ACL=1 136 | 137 | ## ACL names - if VERIFY_ACL is set, only the ACL names from below list 138 | ## are accepted 139 | # ACL_GROUPS="local ld int voicemail free-pstn" 140 | 141 | ## verbose - debug purposes - default '0' 142 | # VERBOSE=1 143 | 144 | ## do (1) or don't (0) store plaintext passwords 145 | ## in the subscriber table - default '1' 146 | # STORE_PLAINTEXT_PW=0 147 | 148 | ## Kamailio START Options 149 | ## PID file path - default is: /var/run/kamailio.pid 150 | PID_FILE=/var/run/kamailio/kamailio.pid 151 | 152 | ## Extra start options - default is: not set 153 | # example: start Kamailio with 64MB share memory: STARTOPTIONS="-m 64" 154 | # STARTOPTIONS= 155 | -------------------------------------------------------------------------------- /kamailio_4.4_dbtext_rpi/conf/etc/subscriber: -------------------------------------------------------------------------------- 1 | id(int,auto) username(string) domain(string) password(string) ha1(string) ha1b(string) email_address(string,null) rpid(string,null) 2 | -------------------------------------------------------------------------------- /kamailio_4.4_dbtext_rpi/conf/etc/tls.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # Example Kamailio TLS Configuration File 3 | # 4 | 5 | # This is the default server domain, settings 6 | # in this domain will be used for all incoming 7 | # connections that do not match any other server 8 | # domain in this configuration file. 9 | # 10 | # We do not enable anything else than TLSv1 11 | # over the public internet. Clients do not have 12 | # to present client certificates by default. 13 | # 14 | [server:default] 15 | method = TLSv1 16 | verify_certificate = no 17 | require_certificate = no 18 | private_key = /usr/local/etc/kamailio/certs/kamailio-selfsigned.key 19 | certificate = /usr/local/etc/kamailio/certs/kamailio-selfsigned.pem 20 | #ca_list = /usr/local/etc/kamailio/ca.pem 21 | #crl = ./modules/tls/crl.pem 22 | 23 | # This is the default client domain, settings 24 | # in this domain will be used for all outgoing 25 | # TLS connections that do not match any other 26 | # client domain in this configuration file. 27 | # We require that servers present valid certificate. 28 | # 29 | [client:default] 30 | verify_certificate = no 31 | require_certificate = no 32 | 33 | # This is an example server domain for TLS connections 34 | # received from the loopback interface. We allow 35 | # the use of SSLv2 and SSLv3 protocols here, we do 36 | # not require that clients present client certificates 37 | # but if they present it it must be valid. We also use 38 | # a special certificate and CA list for loopback 39 | # interface. 40 | # 41 | #[server:127.0.0.1:5061] 42 | #method = SSLv23 43 | #verify_certificate = yes 44 | #require_certificate = no 45 | #private_key = ./modules/tls/local_key.pem 46 | #certificate = ./modules/tls/local_cert.pem 47 | #verify_depth = 3 48 | #ca_list = local_ca.pem 49 | #crl = local_crl.pem 50 | 51 | # Special settings for the iptel.org public SIP 52 | # server. We do not verify the certificate of the 53 | # server because it can be expired. The server 54 | # implements authentication using SSL client 55 | # certificates so configure the client certificate 56 | # that was given to use by iptel.org staff here. 57 | # 58 | #[client:195.37.77.101:5061] 59 | #verify_certificate = no 60 | #certificate = ./modules/tls/iptel_client.pem 61 | #private_key = ./modules/tls/iptel_key.pem 62 | #ca_list = ./modules/tls/iptel_ca.pem 63 | #crl = ./modules/tls/iptel_crl.pem 64 | -------------------------------------------------------------------------------- /opensips_2.2/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | MAINTAINER "Alberto Sagredo info@voipnovatos.es" 4 | 5 | USER root 6 | 7 | RUN apt-get update && \ 8 | echo "mysql-server mysql-server/root_password password passwd" | debconf-set-selections && \ 9 | echo "mysql-server mysql-server/root_password_again password passwd" | debconf-set-selections && \ 10 | apt-get install -y mysql-server git make bison flex libmysqlclient-dev \ 11 | libncurses5 libncurses5-dev mysql-client expect libxml2-dev libcurl4-gnutls-dev tcpdump libmicrohttpd10 wget curl joe vim ngrep 12 | 13 | RUN git clone https://github.com/OpenSIPS/opensips.git -b 2.2 ~/opensips_2_2 && \ 14 | sed -i 's/include_modules?=/include_modules?= presence presence_dialoginfo presence_mwi presence_xml xcap db_mysql pua pua_bla pua_dialoginfo/g' ~/opensips_2_2/Makefile.conf.template && \ 15 | cd ~/opensips_2_2 && \ 16 | make all && make install && \ 17 | cd .. && rm -rf ~/opensips_2_2 18 | 19 | RUN export DEBIAN_FRONTEND=noninteractive && \ 20 | git clone https://github.com/sipwise/rtpengine.git ~/rtpengine && \ 21 | cd ~/rtpengine && \ 22 | ./debian/flavors/no_ngcp && \ 23 | apt-get install -qqy dpkg-dev debhelper libevent-dev iptables-dev libcurl4-openssl-dev libglib2.0-dev libhiredis-dev libpcre3-dev libssl-dev libxmlrpc-core-c3-dev markdown zlib1g-dev module-assistant dkms gettext libbencode-perl libcrypt-rijndael-perl libdigest-hmac-perl libio-socket-inet6-perl libsocket6-perl netcat libpcap0.8-dev libpcap-dev && \ 24 | dpkg-buildpackage && \ 25 | dpkg -i ../*.deb && \ 26 | rm -rf rtpengine 27 | 28 | RUN apt-get purge -y bison build-essential ca-certificates flex git m4 pkg-config && \ 29 | apt-get autoremove -y && \ 30 | apt-get clean 31 | 32 | RUN chmod 777 /var 33 | 34 | RUN chmod 777 /var/run 35 | 36 | RUN chmod 755 /usr/local/etc/opensips/opensips.cfg 37 | 38 | COPY conf/opensipsctlrc /usr/local/etc/opensips/opensipsctlrc 39 | 40 | COPY conf/opensips.cfg /usr/local/etc/opensips/opensips.cfg 41 | 42 | COPY boot_run.sh /etc/boot_run.sh 43 | 44 | RUN chown root.root /etc/boot_run.sh && chmod 700 /etc/boot_run.sh 45 | 46 | EXPOSE 5060/udp 47 | 48 | ENTRYPOINT ["/etc/boot_run.sh"] 49 | 50 | -------------------------------------------------------------------------------- /opensips_2.2/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a generic Makefile. It use to build Docker images. 3 | # 4 | 5 | all: build 6 | 7 | build: 8 | @docker build -t voipnovatos/opensips 9 | quickstart: 10 | @echo "Quick starting sample" 11 | @docker run --name opensips -d -p 5060:5060/udp \ 12 | -e ADVERTISED_IP=“10.0.100.26” \ 13 | voipnovatos/opensips 14 | -------------------------------------------------------------------------------- /opensips_2.2/boot_run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Program: 3 | # This program is install boot run script. 4 | # History: 5 | # 2016/04/08 Kyle Bai Release 6 | # 7 | 8 | MYSQL_PWD=${MYSQL_PWD:-"passwd"} 9 | ADVERTISED_IP=${ADVERTISED_IP:-"127.0.0.1"} 10 | HOST_IP=$(ip route get 8.8.8.8 | awk '{print $NF; exit}') 11 | 12 | echo "Your IP : ${HOST_IP}" 13 | echo -e "Your Advertised IP : ${ADVERTISED_IP}\n\n" 14 | 15 | # Starting MySQL 16 | 17 | service mysql start 18 | 19 | # Auto Create Database 20 | 21 | expect -c " 22 | spawn /usr/local/sbin/opensipsdbctl create \"\" 23 | expect \"MySQL password for root: \" 24 | send \"${MYSQL_PWD}\r\" 25 | expect \"Install presence related tables? (y/n):\" 26 | send \"y\r\" 27 | expect \"Install tables for imc cpl siptrace domainpolicy carrierroute userblacklist b2b cachedb_sql registrant call_center fraud_detection emergency? (y/n)\" 28 | send \"y\r\" 29 | 30 | expect \"END\" 31 | " 32 | 33 | # Configure opensips.cfg 34 | 35 | sed -i "s/advertised_address=.*/advertised_address=\"${ADVERTISED_IP}\"/g" /usr/local/etc/opensips/opensips.cfg 36 | sed -i "s/alias=.*/alias=\"${ADVERTISED_IP}\"/g" /usr/local/etc/opensips/opensips.cfg 37 | sed -i "s/listen=.*/listen=udp:${HOST_IP}:5060/g" /usr/local/etc/opensips/opensips.cfg 38 | 39 | mkdir /var/spool/rtpengine 40 | 41 | rtpengine -p /var/run/rtpengine.pid --interface=127.0.0.1!$ADVERTISED_IP -n 127.0.0.1:60000 -c 127.0.0.1:60001 -m 20000 -M 30000 -E -L 7 42 | 43 | # Starting OpenSIPS process 44 | 45 | #/usr/local/sbin/opensips -f /usr/local/etc/opensips/opensips.cfg 46 | 47 | /usr/local/sbin/opensips -c 48 | 49 | /usr/local/sbin/opensipsctl start 50 | 51 | /bin/bash -------------------------------------------------------------------------------- /opensips_2.2/conf/opensips.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # $Id$ 3 | # 4 | # OpenSIPS residential configuration script 5 | # by OpenSIPS Solutions 6 | # 7 | # This script was generated via "make menuconfig", from 8 | # the "Residential" scenario. 9 | # You can enable / disable more features / functionalities by 10 | # re-generating the scenario with different options.# 11 | # 12 | # Please refer to the Core CookBook at: 13 | # http://www.opensips.org/Resources/DocsCookbooks 14 | # for a explanation of possible statements, functions and parameters. 15 | # 16 | 17 | 18 | ####### 19 | 20 | log_level=0 21 | log_stderror=no 22 | log_facility=LOG_LOCAL0 23 | 24 | debug_mode=no 25 | children=4 26 | 27 | /* uncomment the following lines to enable debugging */ 28 | #debug=6 29 | #fork=no 30 | #log_stderror=yes 31 | 32 | /* uncomment the next line to enable the auto temporary blacklisting of 33 | not available destinations (default disabled) */ 34 | #disable_dns_blacklist=no 35 | 36 | /* uncomment the next line to enable IPv6 lookup after IPv4 dns 37 | lookup failures (default disabled) */ 38 | #dns_try_ipv6=yes 39 | 40 | /* comment the next line to enable the auto discovery of local aliases 41 | based on revers DNS on IPs */ 42 | auto_aliases=no 43 | 44 | advertised_address="10.0.100.26" 45 | alias="10.0.100.26" 46 | 47 | listen=udp:10.0.10.11:5060 48 | 49 | ####### Modules Section ######## 50 | 51 | #set module path 52 | mpath="/usr/local//lib64/opensips/modules/" 53 | 54 | #### MYSQL module 55 | loadmodule "db_mysql.so" 56 | 57 | #### SIGNALING module 58 | loadmodule "signaling.so" 59 | 60 | #### StateLess module 61 | loadmodule "sl.so" 62 | 63 | #### Transaction Module 64 | loadmodule "tm.so" 65 | modparam("tm", "fr_timeout", 5) 66 | modparam("tm", "fr_inv_timeout", 30) 67 | modparam("tm", "restart_fr_on_each_reply", 0) 68 | modparam("tm", "onreply_avp_mode", 1) 69 | 70 | #### Record Route Module 71 | loadmodule "rr.so" 72 | /* do not append from tag to the RR (no need for this script) */ 73 | modparam("rr", "append_fromtag", 0) 74 | 75 | #### MAX ForWarD module 76 | loadmodule "maxfwd.so" 77 | 78 | #### SIP MSG OPerationS module 79 | loadmodule "sipmsgops.so" 80 | 81 | #### FIFO Management Interface 82 | loadmodule "mi_fifo.so" 83 | modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo") 84 | modparam("mi_fifo", "fifo_mode", 0666) 85 | 86 | 87 | #### URI module 88 | loadmodule "uri.so" 89 | modparam("uri", "use_uri_table", 0) 90 | 91 | #### USeR LOCation module 92 | loadmodule "usrloc.so" 93 | modparam("usrloc", "nat_bflag", "NAT") 94 | modparam("usrloc", "db_mode", 0) 95 | 96 | #### REGISTRAR module 97 | loadmodule "registrar.so" 98 | 99 | /* uncomment the next line not to allow more than 10 contacts per AOR */ 100 | #modparam("registrar", "max_contacts", 10) 101 | 102 | #### ACCounting module 103 | loadmodule "acc.so" 104 | /* what special events should be accounted ? */ 105 | modparam("acc", "early_media", 0) 106 | modparam("acc", "report_cancels", 0) 107 | /* by default we do not adjust the direct of the sequential requests. 108 | if you enable this parameter, be sure the enable "append_fromtag" 109 | in "rr" module */ 110 | modparam("acc", "detect_direction", 0) 111 | #modparam("acc", "failed_transaction_flag", "ACC_FAILED") 112 | /* account triggers (flags) */ 113 | #modparam("acc", "log_flag", "ACC_DO") 114 | #modparam("acc", "log_missed_flag", "ACC_MISSED") 115 | 116 | 117 | #### UDP protocol 118 | loadmodule "proto_udp.so" 119 | 120 | #### PRESENCE modules 121 | loadmodule "xcap.so" 122 | loadmodule "dialog.so" 123 | loadmodule "presence.so" 124 | loadmodule "presence_xml.so" 125 | loadmodule "presence_dialoginfo.so" 126 | loadmodule "presence_mwi.so" 127 | loadmodule "pua.so" 128 | loadmodule "pua_dialoginfo.so" 129 | 130 | 131 | modparam("xcap|presence", "db_url","mysql://opensips:opensipsrw@localhost:3306/opensips") 132 | modparam("presence_xml", "force_active", 1) 133 | modparam("presence", "server_address", "sip:10.0.100.26:5060") 134 | 135 | modparam("pua","db_url","mysql://opensips:opensipsrw@localhost/opensips") 136 | modparam("pua_dialoginfo", "presence_server", "sip:sa@10.0.100.26:5060") 137 | 138 | 139 | 140 | ####### Routing Logic ######## 141 | 142 | # main request routing logic 143 | 144 | route{ 145 | if (!mf_process_maxfwd_header("10")) { 146 | sl_send_reply("483","Too Many Hops"); 147 | exit; 148 | } 149 | 150 | if (has_totag()) { 151 | # sequential requests within a dialog should 152 | # take the path determined by record-routing 153 | if (loose_route()) { 154 | 155 | if (is_method("BYE")) { 156 | setflag(ACC_DO); # do accounting ... 157 | setflag(ACC_FAILED); # ... even if the transaction fails 158 | } else if (is_method("INVITE")) { 159 | # even if in most of the cases is useless, do RR for 160 | # re-INVITEs alos, as some buggy clients do change route set 161 | # during the dialog. 162 | record_route(); 163 | } 164 | 165 | # route it out to whatever destination was set by loose_route() 166 | # in $du (destination URI). 167 | route(relay); 168 | } else { 169 | 170 | if (is_method("SUBSCRIBE") && uri==myself) { 171 | # in-dialog subscribe requests 172 | route(handle_presence); 173 | exit; 174 | 175 | } else if ( is_method("ACK") ) { 176 | if ( t_check_trans() ) { 177 | # non loose-route, but stateful ACK; must be an ACK after 178 | # a 487 or e.g. 404 from upstream server 179 | t_relay(); 180 | exit; 181 | } else { 182 | # ACK without matching transaction -> 183 | # ignore and discard 184 | exit; 185 | } 186 | } 187 | sl_send_reply("404","Not here"); 188 | } 189 | exit; 190 | } 191 | 192 | # CANCEL processing 193 | if (is_method("CANCEL")) 194 | { 195 | if (t_check_trans()) 196 | t_relay(); 197 | exit; 198 | } 199 | 200 | t_check_trans(); 201 | 202 | if ( !(is_method("REGISTER") ) ) { 203 | if (from_uri==myself) 204 | { 205 | } else { 206 | # if caller is not local, then called number must be local 207 | if (!uri==myself) { 208 | send_reply("403","Rely forbidden"); 209 | exit; 210 | } 211 | } 212 | } 213 | 214 | # preloaded route checking 215 | if (loose_route()) { 216 | xlog("L_ERR", 217 | "Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]"); 218 | if (!is_method("ACK")) 219 | sl_send_reply("403","Preload Route denied"); 220 | exit; 221 | } 222 | 223 | # record routing 224 | if (!is_method("REGISTER|MESSAGE")) 225 | record_route(); 226 | 227 | # account only INVITEs 228 | if (is_method("INVITE")) { 229 | dialoginfo_set(); 230 | create_dialog(); 231 | # setflag(ACC_DO); # do accounting 232 | # publish for both legs 233 | } 234 | 235 | if (!uri==myself) { 236 | append_hf("P-hint: outbound\r\n"); 237 | route(relay); 238 | } 239 | 240 | # requests for my domain 241 | if (is_method("PUBLISH|SUBSCRIBE")) 242 | { 243 | route(handle_presence); 244 | exit; 245 | } 246 | 247 | if (is_method("REGISTER")) 248 | { 249 | if (!save("location")) 250 | sl_reply_error(); 251 | 252 | exit; 253 | } 254 | 255 | if ($rU==NULL) { 256 | # request with no Username in RURI 257 | sl_send_reply("484","Address Incomplete"); 258 | exit; 259 | } 260 | 261 | # do lookup with method filtering 262 | if (!lookup("location","m")) { 263 | t_newtran(); 264 | t_reply("404", "Not Found"); 265 | exit; 266 | } 267 | 268 | # when routing via usrloc, log the missed calls also 269 | setflag(ACC_MISSED); 270 | route(relay); 271 | } 272 | 273 | 274 | route[relay] { 275 | # for INVITEs enable some additional helper routes 276 | if (is_method("INVITE")) { 277 | t_on_branch("per_branch_ops"); 278 | t_on_reply("handle_nat"); 279 | t_on_failure("missed_call"); 280 | } 281 | 282 | if (!t_relay()) { 283 | send_reply("500","Internal Error"); 284 | }; 285 | exit; 286 | } 287 | 288 | route[handle_presence] 289 | { 290 | if (!t_newtran()) { 291 | sl_reply_error(); 292 | exit; 293 | } 294 | 295 | if(is_method("PUBLISH")) { 296 | handle_publish(); 297 | } else if( is_method("SUBSCRIBE")) { 298 | handle_subscribe(); 299 | } 300 | 301 | exit; 302 | } 303 | 304 | 305 | branch_route[per_branch_ops] { 306 | xlog("new branch at $ru\n"); 307 | } 308 | 309 | 310 | onreply_route[handle_nat] { 311 | 312 | xlog("incoming reply\n"); 313 | } 314 | 315 | 316 | failure_route[missed_call] { 317 | if (t_was_cancelled()) { 318 | exit; 319 | } 320 | 321 | # uncomment the following lines if you want to block client 322 | # redirect based on 3xx replies. 323 | ##if (t_check_status("3[0-9][0-9]")) { 324 | ##t_reply("404","Not found"); 325 | ## exit; 326 | ##} 327 | 328 | } 329 | -------------------------------------------------------------------------------- /opensips_2.2/conf/opensipsctlrc: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | # 3 | # The OpenSIPS configuration file for the control tools. 4 | # 5 | # Here you can set variables used in the opensipsctl and opensipsdbctl setup 6 | # scripts. Per default all variables here are commented out, the control tools 7 | # will use their internal default values. 8 | 9 | ## your SIP domain 10 | SIP_DOMAIN=ubuntu.studio 11 | 12 | ## chrooted directory 13 | # $CHROOT_DIR="/path/to/chrooted/directory" 14 | 15 | ## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, or DBTEXT, 16 | ## by default none is loaded 17 | # If you want to setup a database with opensipsdbctl, you must at least specify 18 | # this parameter. 19 | DBENGINE=MYSQL 20 | 21 | ## database host 22 | DBHOST=localhost 23 | 24 | ## database name (for ORACLE this is TNS name) 25 | DBNAME=opensips 26 | 27 | # database path used by dbtext or db_berkeley 28 | DB_PATH="/usr/local/etc/opensips/dbtext" 29 | 30 | ## database read/write user 31 | DBRWUSER=opensips 32 | 33 | ## password for database read/write user 34 | DBRWPW="opensipsrw" 35 | 36 | ## engine type for the MySQL/MariaDB tabels (default InnoDB) 37 | # MYSQL_ENGINE="MyISAM" 38 | 39 | ## database super user (for ORACLE this is 'scheme-creator' user) 40 | DBROOTUSER="root" 41 | 42 | # user name column 43 | USERCOL="username" 44 | 45 | ## for testing / development 46 | #ETCDIR=etc/ 47 | 48 | # SQL definitions 49 | # If you change this definitions here, then you must change them 50 | # in db/schema/entities.xml too. 51 | # FIXME 52 | 53 | # FOREVER="2020-05-28 21:32:15" 54 | # DEFAULT_ALIASES_EXPIRES=$FOREVER 55 | # DEFAULT_Q="1.0" 56 | # DEFAULT_CALLID="Default-Call-ID" 57 | # DEFAULT_CSEQ="13" 58 | # DEFAULT_LOCATION_EXPIRES=$FOREVER 59 | 60 | 61 | # Program to calculate a message-digest fingerprint 62 | # MD5="md5sum" 63 | 64 | # awk tool 65 | # AWK="awk" 66 | 67 | # gdb tool 68 | # GDB="gdb" 69 | 70 | # grep tool 71 | # GREP="grep" 72 | 73 | # sed tool 74 | # SED="sed" 75 | 76 | 77 | # Describe what additional tables to install. Valid values for the variables 78 | # below are yes/no/ask. With ask (default) it will interactively ask the user 79 | # for an answer, while yes/no allow for automated, unassisted installs. 80 | # 81 | 82 | # If to install tables for the modules in the EXTRA_MODULES variable. 83 | # INSTALL_EXTRA_TABLES=ask 84 | 85 | # If to install presence related tables. 86 | # INSTALL_PRESENCE_TABLES=ask 87 | 88 | # Define what module tables should be installed. 89 | # If you use the postgres database and want to change the installed tables, 90 | # then you must also adjust the STANDARD_TABLES or EXTRA_TABLES variable 91 | # accordingly in the opensipsdbctl.base script. 92 | 93 | # opensips standard modules 94 | # STANDARD_MODULES="standard acc domain group permissions registrar usrloc 95 | # msilo alias_db uri_db speeddial avpops auth_db pdt dialog 96 | # dispatcher dialplan drouting nathelper load_balancer" 97 | 98 | # opensips extra modules 99 | # EXTRA_MODULES="imc cpl siptrace domainpolicy carrierroute userblacklist 100 | # b2b registrant call_center fraud_detection cachedb_sql" 101 | 102 | 103 | ## type of aliases used: DB - database aliases; UL - usrloc aliases 104 | ## - default: none 105 | # ALIASES_TYPE="DB" 106 | 107 | ## control engine: FIFO or UNIXSOCK 108 | ## - default FIFO 109 | # CTLENGINE=xmlrpc 110 | 111 | ## path to FIFO file 112 | # OSIPS_FIFO="/tmp/opensips_fifo" 113 | 114 | ## MI_CONNECTOR control engine: FIFO, UNIXSOCK, UDP, XMLRPC 115 | # MI_CONNECTOR=FIFO:/tmp/opensips_fifo 116 | # MI_CONNECTOR=UNIXSOCK:/tmp/opensips.sock 117 | # MI_CONNECTOR=UDP:192.168.2.133:8000 118 | # MI_CONNECTOR=XMLRPC:192.168.2.133:8000 119 | 120 | ## check ACL names; default on (1); off (0) 121 | # VERIFY_ACL=1 122 | 123 | ## ACL names - if VERIFY_ACL is set, only the ACL names from below list 124 | ## are accepted 125 | # ACL_GROUPS="local ld int voicemail free-pstn" 126 | 127 | ## verbose - debug purposes - default '0' 128 | # VERBOSE=1 129 | 130 | ## do (1) or don't (0) store plaintext passwords 131 | ## in the subscriber table - default '1' 132 | # STORE_PLAINTEXT_PW=0 133 | 134 | ## do not display the output highlighted 135 | # NOHLPRINT=1 136 | 137 | ## OPENSIPS START Options 138 | ## PID file path - default is: /var/run/opensips.pid 139 | # PID_FILE=/var/run/opensips.pid 140 | 141 | ## Extra start options - default is: not set 142 | # example: start opensips with 64MB share memory: STARTOPTIONS="-m 64" 143 | # STARTOPTIONS= 144 | -------------------------------------------------------------------------------- /snom-flic-io-rpi/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM resin/rpi-raspbian 2 | 3 | MAINTAINER Alberto Sagredo 4 | 5 | ENV build_date 2016-09-27 6 | 7 | ENV SNOMIP 10.0.1.37 8 | 9 | ENV SNOMUSER snom 10 | 11 | ENV SNOMPASS flicio 12 | 13 | ENV DEBIAN_FRONTEND noninteractive 14 | 15 | RUN apt-get update 16 | 17 | RUN apt-get update && apt-get install -y wget libsqlite3-0 libglib2.0-0 libical1a libudev1 libjson-glib-1.0-0 libc6 libncurses5 libncurses5-dbg libtinfo5 libtinfo5-dbg libstdc++6 libpcrecpp0 libselinux1 libffi6 libsoup2.4-1 libglib2.0-dev libdbus-1-dev libudev-dev automake libtool libical-dev libreadline-dev git make dbus python-setuptools python3 build-essential joe python-pip python3-pip 18 | 19 | WORKDIR /home/snom/ 20 | 21 | RUN cd /home/snom && wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.37.tar.xz && tar xvf bluez-5.37.tar.xz 22 | 23 | RUN rm /home/snom/*.tar.xz 24 | 25 | RUN cd /home/snom/bluez-5.37 && ./configure --enable-experimental --enable-library 26 | 27 | RUN cd /home/snom/bluez-5.37 && make 28 | 29 | RUN cd /home/snom/bluez-5.37 && make install 30 | 31 | RUN mkdir /home/snom/flic && cd /home/snom/flic && wget --no-check-certificate https://github.com/50ButtonsEach/fliclib-linux-hci/archive/0.3.tar.gz 32 | 33 | WORKDIR /home/snom/flic 34 | 35 | RUN tar -zxvf 0.3.tar.gz 36 | 37 | RUN rm /home/snom/flic/*.tar.gz 38 | 39 | COPY /boot.sh /home/snom 40 | 41 | RUN chmod a+x /home/snom/boot.sh 42 | 43 | COPY /phone.py /home/snom 44 | 45 | RUN chmod a+x /home/snom/phone.py 46 | 47 | RUN cp /home/snom/flic/fliclib-linux-hci-0.3/clientlib/python/fliclib.py /home/snom 48 | 49 | RUN pip3 install requests 50 | 51 | RUN apt-get clean 52 | 53 | RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 54 | 55 | ENTRYPOINT ["/home/snom/boot.sh"] -------------------------------------------------------------------------------- /snom-flic-io-rpi/boot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | /etc/init.d/dbus start 4 | 5 | hciconfig hci0 up 6 | 7 | hciconfig hci0 8 | 9 | /home/snom/bluez-5.37/src/bluetoothd -nEd & 10 | 11 | /home/snom/flic/fliclib-linux-hci-0.3/bin/armv6l/flicd -f flic.sqlite3 -d 12 | 13 | 14 | -------------------------------------------------------------------------------- /snom-flic-io-rpi/build.sh: -------------------------------------------------------------------------------- 1 | echo "Building image..." 2 | docker build -t voipnovatos/snom-flic-io-rpi . 3 | -------------------------------------------------------------------------------- /snom-flic-io-rpi/phone.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Test Client application. 4 | # 5 | # This program attempts to connect to all previously verified Flic buttons by this server. 6 | # Once connected, it prints Down and Up when a button is pressed or released. 7 | # It also monitors when new buttons are verified and connects to them as well. For example, run this program and at the same time the scan_wizard.py program. 8 | 9 | import fliclib 10 | import requests 11 | 12 | tipo=None 13 | 14 | client = fliclib.FlicClient("localhost") 15 | 16 | def got_button(bd_addr): 17 | cc = fliclib.ButtonConnectionChannel(bd_addr) 18 | cc.on_button_click_or_hold = lambda channel, click_type, was_queued, time_diff: \ 19 | requests.get('http://10.0.1.31/command.htm?key=ENTER') if str(click_type) == 'ClickType.ButtonClick' else requests.get('http://10.0.1.31/command.htm?key=CANCEL') 20 | 21 | cc.on_connection_status_changed = lambda channel, connection_status, disconnect_reason: \ 22 | print(channel.bd_addr + " " + str(connection_status) + (" " + str(disconnect_reason) if connection_status == fliclib.ConnectionStatus.Disconnected else "")) 23 | client.add_connection_channel(cc) 24 | 25 | def got_info(items): 26 | print(items) 27 | for bd_addr in items["bd_addr_of_verified_buttons"]: 28 | got_button(bd_addr) 29 | 30 | client.get_info(got_info) 31 | 32 | client.on_new_verified_button = got_button 33 | 34 | client.handle_events() 35 | -------------------------------------------------------------------------------- /snom_enviro_phat_rpi/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alexellis2/python-gpio:armv6 2 | 3 | MAINTAINER Alberto Sagredo 4 | 5 | ENV build_date 2016-09-26 6 | 7 | ENV IP 10.0.1.153 8 | 9 | ENV PORT 8888 10 | 11 | ENV DEBIAN_FRONTEND noninteractive 12 | 13 | RUN apt-get update && \ 14 | apt-get -qy install python-smbus i2c-tools git python-pip python-dev 15 | 16 | WORKDIR /home/snom/ 17 | 18 | RUN git clone https://github.com/pimoroni/enviro-phat.git 19 | 20 | COPY /snom_xmlserver.py /home/snom 21 | 22 | COPY /boot.sh /home/snom 23 | 24 | RUN chmod a+x /home/snom/boot.sh 25 | 26 | RUN pip install envirophat 27 | 28 | RUN pip install RPi.GPIO 29 | 30 | ENTRYPOINT ["/home/snom/boot.sh"] 31 | -------------------------------------------------------------------------------- /snom_enviro_phat_rpi/boot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sed -i "s/HOST, PORT =.*/HOST, PORT = '', ${PORT}/g" snom_xmlserver.py 4 | 5 | sed -i "s,http://10.0.1.153:8888,http://${IP}:${PORT},g" snom_xmlserver.py 6 | 7 | sudo python /home/snom/snom_xmlserver.py 8 | 9 | -------------------------------------------------------------------------------- /snom_enviro_phat_rpi/build.sh: -------------------------------------------------------------------------------- 1 | echo "Building image..." 2 | docker build -t snom-enviro-phat-rpi . 3 | -------------------------------------------------------------------------------- /snom_enviro_phat_rpi/snom_xmlserver.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import socket 4 | import time 5 | 6 | from envirophat import weather, leds , light 7 | 8 | HOST, PORT = '', 8888 9 | 10 | listen_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 11 | listen_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) 12 | listen_socket.bind((HOST, PORT)) 13 | listen_socket.listen(1) 14 | print 'Serving HTTP on port %s ...' % PORT 15 | 16 | while True: 17 | temperature = weather.temperature() 18 | pressure = weather.pressure() 19 | lightvalue = light.light() 20 | client_connection, client_address = listen_socket.accept() 21 | request = client_connection.recv(2048) 22 | first_line = request.split('\r\n') 23 | path = first_line[0].split(' ') 24 | path_clean = path[1].split('?') 25 | print request 26 | 27 | if path_clean[0] == "/pressure": 28 | 29 | humidi = "Pressure: %.2f hPa" % pressure 30 | http_response = \ 31 | "HTTP/1.1 200 OK\n"\ 32 | "Content-Type: text/xml\n\n"\ 33 | ""\ 34 | ""\ 35 | "\tAlicante"\ 36 | "\t55"\ 37 | "\t32"\ 38 | "\t"\ 39 | +humidi+\ 40 | "
"\ 41 | "\t
"\ 42 | "\t"\ 43 | "\t\t2"\ 44 | "\t\t23"\ 45 | "\t\thttp://www.omkarsupra.com/images/icons/high-pressure.png"\ 46 | "\t"\ 47 | "\t"\ 48 | "\t\tF1"\ 49 | "\t\t"\ 50 | "\t\thttp://10.0.1.153:8888/pressure"\ 51 | "\t"\ 52 | "\t"\ 53 | "\t\tF2"\ 54 | "\t\t"\ 55 | "\t\thttp://10.0.1.153:8888/temperature"\ 56 | "\t"\ 57 | "\t"\ 58 | "\t\tF3"\ 59 | "\t\t"\ 60 | "\t\thttp://10.0.1.153:8888/light"\ 61 | "\t"\ 62 | "
" 63 | 64 | 65 | elif path_clean[0] == "/temperature": 66 | 67 | temp = "Temperature: %.2f C" % temperature 68 | http_response = \ 69 | "HTTP/1.1 200 OK\n"\ 70 | "Content-Type: text/xml\n\n"\ 71 | ""\ 72 | ""\ 73 | "\tAlicante"\ 74 | "\t55"\ 75 | "\t32"\ 76 | "\t"\ 77 | +temp+\ 78 | "
"\ 79 | "\t
"\ 80 | "\t"\ 81 | "\t\t2"\ 82 | "\t\t23"\ 83 | "\t\thttp://www.tommytape.com/wp-content/assets/icons/red-icon-temp.png"\ 84 | "\t"\ 85 | "\t"\ 86 | "\t\tF1"\ 87 | "\t\t"\ 88 | "\t\thttp://10.0.1.153:8888/temperature"\ 89 | "\t"\ 90 | "\t"\ 91 | "\t\tF2"\ 92 | "\t\t"\ 93 | "\t\thttp://10.0.1.153:8888/pressure"\ 94 | "\t"\ 95 | "\t"\ 96 | "\t\tF3"\ 97 | "\t\t"\ 98 | "\t\thttp://10.0.1.153:8888/light"\ 99 | "\t"\ 100 | "
" 101 | 102 | 103 | 104 | elif path_clean[0] == "/light": 105 | 106 | lightnum = "Light: %.2f " % lightvalue 107 | http_response = \ 108 | "HTTP/1.1 200 OK\n"\ 109 | "Content-Type: text/xml\n\n"\ 110 | ""\ 111 | ""\ 112 | "\tAlicante"\ 113 | "\t55"\ 114 | "\t32"\ 115 | "\t"\ 116 | +lightnum+\ 117 | "
"\ 118 | "\t
"\ 119 | "\t"\ 120 | "\t\t2"\ 121 | "\t\t23"\ 122 | "\t\thttps://ae01.alicdn.com/kf/HTB1Sv9UJFXXXXXPXVXXq6xXFXXXn/14W-Light-sensor-energy-saving-lamp-dusk-to-dawn-CFL-ESL.jpg_50x50.jpg"\ 123 | "\t"\ 124 | "\t"\ 125 | "\t\tF1"\ 126 | "\t\t"\ 127 | "\t\thttp://10.0.1.153:8888/light"\ 128 | "\t"\ 129 | "\t"\ 130 | "\t\tF2"\ 131 | "\t\t"\ 132 | "\t\thttp://10.0.1.153:8888/pressure"\ 133 | "\t"\ 134 | "\t"\ 135 | "\t\tF3"\ 136 | "\t\t"\ 137 | "\t\thttp://10.0.1.153:8888/temperature"\ 138 | "\t"\ 139 | "
" 140 | 141 | 142 | else : 143 | 144 | http_response = \ 145 | "HTTP/1.1 200 OK\n"\ 146 | "Content-Type: text/xml\n\n"\ 147 | 148 | 149 | client_connection.sendall(http_response) 150 | client_connection.close() 151 | --------------------------------------------------------------------------------