kamailio
Este commit está contenido en:
56
production/kamailio/docker-compose.yml
Archivo normal
56
production/kamailio/docker-compose.yml
Archivo normal
@@ -0,0 +1,56 @@
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
kamailio:
|
||||
build: ./kamailio
|
||||
restart: always
|
||||
hostname: kamailio
|
||||
container_name: kamailio
|
||||
entrypoint:
|
||||
- /bin/bash
|
||||
- /etc/kamailio/entrypoint.sh
|
||||
volumes:
|
||||
- ./kamailio:/etc/kamailio
|
||||
- /opt/docker/secure/fullchain.pem:/etc/kamailio/kamailio.pem:ro
|
||||
- /opt/docker/secure/privkey.pem:/etc/kamailio/kamailio.key:ro
|
||||
- ./kamailio/kamailio:/etc/default/kamailio
|
||||
- ./kamailio/rtpproxy:/etc/default/rtpproxy
|
||||
# ports:
|
||||
# - "5060:5060/tcp"
|
||||
# - "5060:5060/udp"
|
||||
# - "5061:5061/tcp"
|
||||
# - "5061:5061/udp"
|
||||
# - "35000-35400:35000-35400/tcp"
|
||||
# - "35000-35400:35000-35400/udp"
|
||||
# ulimits:
|
||||
# nofile:
|
||||
# soft: 65536
|
||||
# hard: 65536
|
||||
network_mode: "host"
|
||||
|
||||
nodekami:
|
||||
build: ./nodekami
|
||||
restart: always
|
||||
hostname: nodekami
|
||||
container_name: nodekami
|
||||
entrypoint:
|
||||
- node
|
||||
- index
|
||||
volumes:
|
||||
- ./nodekami/confi.json:/nodekami/app/confi.json
|
||||
- ./nodekami/index.js:/nodekami/app/index.js
|
||||
- ./nodekami/publicindex.js:/nodekami/app/public/js/index.js
|
||||
- ./nodekami/rsaprivada.pem:/nodekami/app/rsaprivada.pem
|
||||
- ./kamailio/kamailio.sqlite:/nodekami/app/kamailio.sqlite
|
||||
expose:
|
||||
- 3000
|
||||
networks:
|
||||
mynet:
|
||||
ipv4_address: 172.127.0.101
|
||||
|
||||
networks:
|
||||
mynet:
|
||||
driver: bridge
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.127.0.0/24
|
||||
57
production/kamailio/kamailio/Dockerfile
Archivo normal
57
production/kamailio/kamailio/Dockerfile
Archivo normal
@@ -0,0 +1,57 @@
|
||||
FROM debian:sid-slim
|
||||
RUN mkdir /usr/share/man/man1 /usr/share/man/man5 /usr/share/man/man7 /usr/share/man/man8
|
||||
RUN apt update && apt -y upgrade && apt -y install \
|
||||
openssl \
|
||||
kamailio \
|
||||
kamailio-autheph-modules \
|
||||
kamailio-berkeley-bin \
|
||||
kamailio-berkeley-modules \
|
||||
kamailio-cnxcc-modules \
|
||||
kamailio-cpl-modules \
|
||||
kamailio-erlang-modules \
|
||||
kamailio-extra-modules \
|
||||
kamailio-geoip-modules \
|
||||
kamailio-geoip2-modules \
|
||||
kamailio-ims-modules \
|
||||
kamailio-json-modules \
|
||||
kamailio-kazoo-modules \
|
||||
kamailio-ldap-modules \
|
||||
kamailio-lua-modules \
|
||||
kamailio-memcached-modules \
|
||||
kamailio-mongodb-modules \
|
||||
kamailio-mono-modules \
|
||||
kamailio-mysql-modules \
|
||||
kamailio-outbound-modules \
|
||||
kamailio-perl-modules \
|
||||
kamailio-phonenum-modules \
|
||||
kamailio-postgres-modules \
|
||||
kamailio-presence-modules \
|
||||
#kamailio-python-modules \
|
||||
kamailio-python3-modules \
|
||||
kamailio-rabbitmq-modules \
|
||||
kamailio-radius-modules \
|
||||
kamailio-redis-modules \
|
||||
kamailio-ruby-modules \
|
||||
kamailio-sctp-modules \
|
||||
kamailio-snmpstats-modules \
|
||||
kamailio-sqlite-modules \
|
||||
kamailio-systemd-modules \
|
||||
kamailio-tls-modules \
|
||||
kamailio-unixodbc-modules \
|
||||
kamailio-utils-modules \
|
||||
kamailio-websocket-modules \
|
||||
kamailio-xml-modules \
|
||||
kamailio-xmpp-modules \
|
||||
kamcli \
|
||||
sqlite3 \
|
||||
gnutls-bin \
|
||||
git \
|
||||
build-essential \
|
||||
sudo \
|
||||
rtpproxy \
|
||||
libsctp1 \
|
||||
&& apt clean
|
||||
#RUN git clone -b master https://github.com/sippy/rtpproxy /rtpproxy
|
||||
#RUN git -C rtpproxy submodule update --init --recursive
|
||||
#WORKDIR /rtpproxy
|
||||
#RUN ./configure && make && make install
|
||||
49
production/kamailio/kamailio/Dockerfile.orig
Archivo normal
49
production/kamailio/kamailio/Dockerfile.orig
Archivo normal
@@ -0,0 +1,49 @@
|
||||
FROM debian:sid-slim
|
||||
RUN mkdir /usr/share/man/man1 /usr/share/man/man5 /usr/share/man/man7 /usr/share/man/man8
|
||||
RUN apt update && apt -y upgrade && apt -y install \
|
||||
openssl \
|
||||
kamailio \
|
||||
kamailio-autheph-modules \
|
||||
kamailio-berkeley-bin \
|
||||
kamailio-berkeley-modules \
|
||||
kamailio-cnxcc-modules \
|
||||
kamailio-cpl-modules \
|
||||
kamailio-erlang-modules \
|
||||
kamailio-extra-modules \
|
||||
kamailio-geoip-modules \
|
||||
kamailio-geoip2-modules \
|
||||
kamailio-ims-modules \
|
||||
kamailio-json-modules \
|
||||
kamailio-kazoo-modules \
|
||||
kamailio-ldap-modules \
|
||||
kamailio-lua-modules \
|
||||
kamailio-memcached-modules \
|
||||
kamailio-mongodb-modules \
|
||||
kamailio-mono-modules \
|
||||
kamailio-mysql-modules \
|
||||
kamailio-outbound-modules \
|
||||
kamailio-perl-modules \
|
||||
kamailio-phonenum-modules \
|
||||
kamailio-postgres-modules \
|
||||
kamailio-presence-modules \
|
||||
kamailio-python-modules \
|
||||
kamailio-python3-modules \
|
||||
kamailio-rabbitmq-modules \
|
||||
kamailio-radius-modules \
|
||||
kamailio-redis-modules \
|
||||
kamailio-ruby-modules \
|
||||
kamailio-sctp-modules \
|
||||
kamailio-snmpstats-modules \
|
||||
kamailio-sqlite-modules \
|
||||
kamailio-systemd-modules \
|
||||
kamailio-tls-modules \
|
||||
kamailio-unixodbc-modules \
|
||||
kamailio-utils-modules \
|
||||
kamailio-websocket-modules \
|
||||
kamailio-xml-modules \
|
||||
kamailio-xmpp-modules \
|
||||
kamcli \
|
||||
sqlite3 \
|
||||
gnutls-bin \
|
||||
rtpproxy \
|
||||
&& apt clean
|
||||
49
production/kamailio/kamailio/dictionary.kamailio
Archivo normal
49
production/kamailio/kamailio/dictionary.kamailio
Archivo normal
@@ -0,0 +1,49 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# SIP RADIUS attributes
|
||||
#
|
||||
# Proprietary indicates an attribute that hasn't
|
||||
# been standardized
|
||||
#
|
||||
#
|
||||
# NOTE: All standard (IANA registered) attributes are
|
||||
# defined in the default dictionary of the
|
||||
# radiusclient-ng library.
|
||||
#
|
||||
|
||||
|
||||
#### Attributes ###
|
||||
ATTRIBUTE Sip-Uri-User 208 string # Proprietary, auth_radius
|
||||
ATTRIBUTE Sip-Group 211 string # Proprietary, group_radius
|
||||
ATTRIBUTE Sip-Rpid 213 string # Proprietary, auth_radius
|
||||
ATTRIBUTE SIP-AVP 225 string # Proprietary, avp_radius
|
||||
|
||||
### Acct-Status-Type Values ###
|
||||
#VALUE Acct-Status-Type Failed 15 # RFC2866, acc
|
||||
|
||||
### Service-Type Values ###
|
||||
#VALUE Service-Type Call-Check 10 # RFC2865, uri_radius
|
||||
VALUE Service-Type Group-Check 12 # Proprietary, group_radius
|
||||
##VALUE Service-Type Sip-Session 15 # Schulzrinne, acc, auth_radius
|
||||
VALUE Service-Type SIP-Caller-AVPs 30 # Proprietary, avp_radius
|
||||
VALUE Service-Type SIP-Callee-AVPs 31 # Proprietary, avp_radius
|
||||
|
||||
### Sip-Method Values ###
|
||||
VALUE Sip-Method Undefined 0
|
||||
VALUE Sip-Method Invite 1
|
||||
VALUE Sip-Method Cancel 2
|
||||
VALUE Sip-Method Ack 4
|
||||
VALUE Sip-Method Bye 8
|
||||
VALUE Sip-Method Info 16
|
||||
VALUE Sip-Method Options 32
|
||||
VALUE Sip-Method Update 64
|
||||
VALUE Sip-Method Register 128
|
||||
VALUE Sip-Method Message 256
|
||||
VALUE Sip-Method Subscribe 512
|
||||
VALUE Sip-Method Notify 1024
|
||||
VALUE Sip-Method Prack 2048
|
||||
VALUE Sip-Method Refer 4096
|
||||
VALUE Sip-Method Other 8192
|
||||
|
||||
|
||||
7
production/kamailio/kamailio/entrypoint.sh
Archivo normal
7
production/kamailio/kamailio/entrypoint.sh
Archivo normal
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
/etc/init.d/rtpproxy start
|
||||
adduser kamailio rtpproxy
|
||||
#mkdir /var/run/rtpproxy
|
||||
#rtpproxy -s unix:/var/run/rtpproxy/rtpproxy.sock -F -l 82.223.3.135 -m 35000 -M 35400 -d INFO
|
||||
#chown kamailio.kamailio /var/run/rtpproxy/rtpproxy.sock
|
||||
sudo -u kamailio kamailio -DD -E
|
||||
28
production/kamailio/kamailio/kamailio
Archivo normal
28
production/kamailio/kamailio/kamailio
Archivo normal
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# Kamailio startup options
|
||||
#
|
||||
|
||||
# Set to yes to enable kamailio, once configured properly.
|
||||
RUN_KAMAILIO=yes
|
||||
|
||||
# User to run as
|
||||
#USER=kamailio
|
||||
|
||||
# Group to run as
|
||||
#GROUP=kamailio
|
||||
|
||||
# Amount of shared and private memory to allocate
|
||||
# for the running Kamailio server (in Mb)
|
||||
#SHM_MEMORY=64
|
||||
#PKG_MEMORY=8
|
||||
|
||||
# Config file
|
||||
#CFGFILE=/etc/kamailio/kamailio.cfg
|
||||
|
||||
# Enable the server to leave a core file when it crashes.
|
||||
# Set this to 'yes' to enable Kamailio to leave a core file when it crashes
|
||||
# or 'no' to disable this feature. This option is case sensitive and only
|
||||
# accepts 'yes' and 'no' and only in lowercase letters.
|
||||
# On some systems it is necessary to specify a directory for the core files
|
||||
# to get a dump. Look into the kamailio init file for an example configuration.
|
||||
#DUMP_CORE=yes
|
||||
992
production/kamailio/kamailio/kamailio.cfg
Archivo normal
992
production/kamailio/kamailio/kamailio.cfg
Archivo normal
@@ -0,0 +1,992 @@
|
||||
#!KAMAILIO
|
||||
#
|
||||
# Kamailio (OpenSER) SIP Server v5.2 - default configuration script
|
||||
# - web: https://www.kamailio.org
|
||||
# - git: https://github.com/kamailio/kamailio
|
||||
#
|
||||
# Direct your questions about this file to: <sr-users@lists.kamailio.org>
|
||||
#
|
||||
# Refer to the Core CookBook at https://www.kamailio.org/wiki/
|
||||
# for an explanation of possible statements, functions and parameters.
|
||||
#
|
||||
# Note: the comments can be:
|
||||
# - lines starting with #, but not the pre-processor directives,
|
||||
# which start with #!, like #!define, #!ifdef, #!endif, #!else, #!trydef,
|
||||
# #!subst, #!substdef, ...
|
||||
# - lines starting with //
|
||||
# - blocks enclosed in between /* */
|
||||
#
|
||||
# Several features can be enabled using '#!define WITH_FEATURE' directives:
|
||||
#!define WITH_SQLITE
|
||||
#!define WITH_AUTH
|
||||
#!define WITH_USRLOCDB
|
||||
#!define WITH_NAT
|
||||
#!define WITH_TLS
|
||||
#!define WITH_NATSIPPING
|
||||
#
|
||||
# *** To run in debug mode:
|
||||
# - define WITH_DEBUG
|
||||
#
|
||||
# *** To enable mysql:
|
||||
# - define WITH_MYSQL
|
||||
#
|
||||
# *** To enable authentication execute:
|
||||
# - enable mysql
|
||||
# - define WITH_AUTH
|
||||
# - add users using 'kamctl'
|
||||
#
|
||||
# *** To enable IP authentication execute:
|
||||
# - enable mysql
|
||||
# - enable authentication
|
||||
# - define WITH_IPAUTH
|
||||
# - add IP addresses with group id '1' to 'address' table
|
||||
#
|
||||
# *** To enable persistent user location execute:
|
||||
# - enable mysql
|
||||
# - define WITH_USRLOCDB
|
||||
#
|
||||
# *** To enable presence server execute:
|
||||
# - enable mysql
|
||||
# - define WITH_PRESENCE
|
||||
#
|
||||
# *** To enable nat traversal execute:
|
||||
# - define WITH_NAT
|
||||
# - install RTPProxy: http://www.rtpproxy.org
|
||||
# - start RTPProxy:
|
||||
# rtpproxy -l _your_public_ip_ -s udp:localhost:7722
|
||||
# - option for NAT SIP OPTIONS keepalives: WITH_NATSIPPING
|
||||
#
|
||||
# *** To enable PSTN gateway routing execute:
|
||||
# - define WITH_PSTN
|
||||
# - set the value of pstn.gw_ip
|
||||
# - check route[PSTN] for regexp routing condition
|
||||
#
|
||||
# *** To enable database aliases lookup execute:
|
||||
# - enable mysql
|
||||
# - define WITH_ALIASDB
|
||||
#
|
||||
# *** To enable speed dial lookup execute:
|
||||
# - enable mysql
|
||||
# - define WITH_SPEEDDIAL
|
||||
#
|
||||
# *** To enable multi-domain support execute:
|
||||
# - enable mysql
|
||||
# - define WITH_MULTIDOMAIN
|
||||
#
|
||||
# *** To enable TLS support execute:
|
||||
# - adjust CFGDIR/tls.cfg as needed
|
||||
# - define WITH_TLS
|
||||
#
|
||||
# *** To enable XMLRPC support execute:
|
||||
# - define WITH_XMLRPC
|
||||
# - adjust route[XMLRPC] for access policy
|
||||
#
|
||||
# *** To enable anti-flood detection execute:
|
||||
# - adjust pike and htable=>ipban settings as needed (default is
|
||||
# block if more than 16 requests in 2 seconds and ban for 300 seconds)
|
||||
# - define WITH_ANTIFLOOD
|
||||
#
|
||||
# *** To block 3XX redirect replies execute:
|
||||
# - define WITH_BLOCK3XX
|
||||
#
|
||||
# *** To block 401 and 407 authentication replies execute:
|
||||
# - define WITH_BLOCK401407
|
||||
#
|
||||
# *** To enable VoiceMail routing execute:
|
||||
# - define WITH_VOICEMAIL
|
||||
# - set the value of voicemail.srv_ip
|
||||
# - adjust the value of voicemail.srv_port
|
||||
#
|
||||
# *** To enhance accounting execute:
|
||||
# - enable mysql
|
||||
# - define WITH_ACCDB
|
||||
# - add following columns to database
|
||||
#!ifdef ACCDB_COMMENT
|
||||
ALTER TABLE acc ADD COLUMN src_user VARCHAR(64) NOT NULL DEFAULT '';
|
||||
ALTER TABLE acc ADD COLUMN src_domain VARCHAR(128) NOT NULL DEFAULT '';
|
||||
ALTER TABLE acc ADD COLUMN src_ip varchar(64) NOT NULL default '';
|
||||
ALTER TABLE acc ADD COLUMN dst_ouser VARCHAR(64) NOT NULL DEFAULT '';
|
||||
ALTER TABLE acc ADD COLUMN dst_user VARCHAR(64) NOT NULL DEFAULT '';
|
||||
ALTER TABLE acc ADD COLUMN dst_domain VARCHAR(128) NOT NULL DEFAULT '';
|
||||
ALTER TABLE missed_calls ADD COLUMN src_user VARCHAR(64) NOT NULL DEFAULT '';
|
||||
ALTER TABLE missed_calls ADD COLUMN src_domain VARCHAR(128) NOT NULL DEFAULT '';
|
||||
ALTER TABLE missed_calls ADD COLUMN src_ip varchar(64) NOT NULL default '';
|
||||
ALTER TABLE missed_calls ADD COLUMN dst_ouser VARCHAR(64) NOT NULL DEFAULT '';
|
||||
ALTER TABLE missed_calls ADD COLUMN dst_user VARCHAR(64) NOT NULL DEFAULT '';
|
||||
ALTER TABLE missed_calls ADD COLUMN dst_domain VARCHAR(128) NOT NULL DEFAULT '';
|
||||
#!endif
|
||||
|
||||
####### Include Local Config If Exists #########
|
||||
import_file "kamailio-local.cfg"
|
||||
|
||||
####### Defined Values #########
|
||||
|
||||
# *** Value defines - IDs used later in config
|
||||
#!ifdef WITH_MYSQL
|
||||
# - database URL - used to connect to database server by modules such
|
||||
# as: auth_db, acc, usrloc, a.s.o.
|
||||
#!ifndef DBURL
|
||||
#!define DBURL "mysql://kamailio:kamailiorw@localhost/kamailio"
|
||||
#!endif
|
||||
#!endif
|
||||
#!ifdef WITH_MULTIDOMAIN
|
||||
# - the value for 'use_domain' parameters
|
||||
#!define MULTIDOMAIN 1
|
||||
#!else
|
||||
#!define MULTIDOMAIN 0
|
||||
#!endif
|
||||
|
||||
# - flags
|
||||
# FLT_ - per transaction (message) flags
|
||||
# FLB_ - per branch flags
|
||||
#!define FLT_ACC 1
|
||||
#!define FLT_ACCMISSED 2
|
||||
#!define FLT_ACCFAILED 3
|
||||
#!define FLT_NATS 5
|
||||
|
||||
#!define FLB_NATB 6
|
||||
#!define FLB_NATSIPPING 7
|
||||
|
||||
####### Global Parameters #########
|
||||
|
||||
### LOG Levels: 3=DBG, 2=INFO, 1=NOTICE, 0=WARN, -1=ERR
|
||||
#!ifdef WITH_DEBUG
|
||||
debug=4
|
||||
log_stderror=yes
|
||||
#!else
|
||||
debug=2
|
||||
log_stderror=no
|
||||
#!endif
|
||||
|
||||
memdbg=5
|
||||
memlog=5
|
||||
|
||||
log_facility=LOG_LOCAL0
|
||||
log_prefix="{$mt $hdr(CSeq) $ci} "
|
||||
|
||||
/* number of SIP routing processes */
|
||||
children=8
|
||||
|
||||
/* uncomment the next line to disable TCP (default on) */
|
||||
# disable_tcp=yes
|
||||
|
||||
/* uncomment the next line to disable the auto discovery of local aliases
|
||||
* based on reverse DNS on IPs (default on) */
|
||||
auto_aliases=no
|
||||
|
||||
/* add local domain aliases */
|
||||
# alias="sip.mydomain.com"
|
||||
alias=hatthieves.es:5060
|
||||
alias=hatthieves.es:5061
|
||||
alias=82.223.3.135:5060
|
||||
alias=82.223.3.135:5061
|
||||
#mhomed=0
|
||||
|
||||
/* uncomment and configure the following line if you want Kamailio to
|
||||
* bind on a specific interface/port/proto (default bind on all available) */
|
||||
|
||||
listen=udp:82.223.3.135:5060
|
||||
listen=tls:82.223.3.135:5061
|
||||
|
||||
#!ifdef WITH_TLS
|
||||
enable_tls=yes
|
||||
#!endif
|
||||
|
||||
/* life time of TCP connection when there is no traffic
|
||||
* - a bit higher than registration expires to cope with UA behind NAT */
|
||||
tcp_connection_lifetime=3605
|
||||
|
||||
####### Custom Parameters #########
|
||||
|
||||
/* These parameters can be modified runtime via RPC interface
|
||||
* - see the documentation of 'cfg_rpc' module.
|
||||
*
|
||||
* Format: group.id = value 'desc' description
|
||||
* Access: $sel(cfg_get.group.id) or @cfg_get.group.id */
|
||||
|
||||
#!ifdef WITH_PSTN
|
||||
/* PSTN GW Routing
|
||||
*
|
||||
* - pstn.gw_ip: valid IP or hostname as string value, example:
|
||||
* pstn.gw_ip = "10.0.0.101" desc "My PSTN GW Address"
|
||||
*
|
||||
* - by default is empty to avoid misrouting */
|
||||
pstn.gw_ip = "" desc "PSTN GW Address"
|
||||
pstn.gw_port = "" desc "PSTN GW Port"
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_VOICEMAIL
|
||||
/* VoiceMail Routing on offline, busy or no answer
|
||||
*
|
||||
* - by default Voicemail server IP is empty to avoid misrouting */
|
||||
voicemail.srv_ip = "" desc "VoiceMail IP Address"
|
||||
voicemail.srv_port = "5060" desc "VoiceMail Port"
|
||||
#!endif
|
||||
|
||||
####### Modules Section ########
|
||||
|
||||
/* set paths to location of modules */
|
||||
# mpath="/usr/lib/x86_64-linux-gnu/kamailio/modules/"
|
||||
|
||||
#!ifdef WITH_MYSQL
|
||||
loadmodule "db_mysql.so"
|
||||
#!endif
|
||||
|
||||
loadmodule "jsonrpcs.so"
|
||||
loadmodule "kex.so"
|
||||
loadmodule "corex.so"
|
||||
loadmodule "tm.so"
|
||||
loadmodule "tmx.so"
|
||||
loadmodule "sl.so"
|
||||
loadmodule "rr.so"
|
||||
loadmodule "pv.so"
|
||||
loadmodule "maxfwd.so"
|
||||
loadmodule "usrloc.so"
|
||||
loadmodule "registrar.so"
|
||||
loadmodule "textops.so"
|
||||
loadmodule "siputils.so"
|
||||
loadmodule "xlog.so"
|
||||
loadmodule "sanity.so"
|
||||
loadmodule "ctl.so"
|
||||
loadmodule "cfg_rpc.so"
|
||||
loadmodule "acc.so"
|
||||
loadmodule "counters.so"
|
||||
loadmodule "db_sqlite.so"
|
||||
loadmodule "sctp.so"
|
||||
|
||||
#!ifdef WITH_AUTH
|
||||
loadmodule "auth.so"
|
||||
loadmodule "auth_db.so"
|
||||
#!ifdef WITH_IPAUTH
|
||||
loadmodule "permissions.so"
|
||||
#!endif
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_ALIASDB
|
||||
loadmodule "alias_db.so"
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_SPEEDDIAL
|
||||
loadmodule "speeddial.so"
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_MULTIDOMAIN
|
||||
loadmodule "domain.so"
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_PRESENCE
|
||||
loadmodule "presence.so"
|
||||
loadmodule "presence_xml.so"
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_NAT
|
||||
loadmodule "nathelper.so"
|
||||
loadmodule "rtpproxy.so"
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_TLS
|
||||
loadmodule "tls.so"
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_ANTIFLOOD
|
||||
loadmodule "htable.so"
|
||||
loadmodule "pike.so"
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_XMLRPC
|
||||
loadmodule "xmlrpc.so"
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_DEBUG
|
||||
loadmodule "debugger.so"
|
||||
#!endif
|
||||
|
||||
# ----------------- setting module-specific parameters ---------------
|
||||
|
||||
#!ifdef WITH_SQLITE
|
||||
modparam("auth_db", "db_url", "sqlite:///etc/kamailio/kamailio.sqlite")
|
||||
#!define DBURL "sqlite:///etc/kamailio/kamailio.sqlite"
|
||||
#!endif
|
||||
|
||||
|
||||
# ----- jsonrpcs params -----
|
||||
modparam("jsonrpcs", "pretty_format", 1)
|
||||
/* set the path to RPC fifo control file */
|
||||
# modparam("jsonrpcs", "fifo_name", "/var/run/kamailio/kamailio_rpc.fifo")
|
||||
/* set the path to RPC unix socket control file */
|
||||
# modparam("jsonrpcs", "dgram_socket", "/var/run/kamailio/kamailio_rpc.sock")
|
||||
|
||||
# ----- ctl params -----
|
||||
/* set the path to RPC unix socket control file */
|
||||
# modparam("ctl", "binrpc", "unix:/var/run/kamailio/kamailio_ctl")
|
||||
|
||||
# ----- tm params -----
|
||||
# auto-discard branches from previous serial forking leg
|
||||
modparam("tm", "failure_reply_mode", 3)
|
||||
# default retransmission timeout: 30sec
|
||||
modparam("tm", "fr_timer", 30000)
|
||||
# default invite retransmission timeout after 1xx: 120sec
|
||||
modparam("tm", "fr_inv_timer", 120000)
|
||||
|
||||
# ----- rr params -----
|
||||
# set next param to 1 to add value to ;lr param (helps with some UAs)
|
||||
modparam("rr", "enable_full_lr", 0)
|
||||
# do not append from tag to the RR (no need for this script)
|
||||
modparam("rr", "append_fromtag", 0)
|
||||
|
||||
# ----- registrar params -----
|
||||
modparam("registrar", "method_filtering", 1)
|
||||
/* uncomment the next line to disable parallel forking via location */
|
||||
# modparam("registrar", "append_branches", 0)
|
||||
/* uncomment the next line not to allow more than 10 contacts per AOR */
|
||||
# modparam("registrar", "max_contacts", 10)
|
||||
/* max value for expires of registrations */
|
||||
modparam("registrar", "max_expires", 3600)
|
||||
/* set it to 1 to enable GRUU */
|
||||
modparam("registrar", "gruu_enabled", 0)
|
||||
|
||||
# ----- acc params -----
|
||||
/* what special events should be accounted ? */
|
||||
modparam("acc", "early_media", 0)
|
||||
modparam("acc", "report_ack", 0)
|
||||
modparam("acc", "report_cancels", 0)
|
||||
/* by default ww do not adjust the direct of the sequential requests.
|
||||
* if you enable this parameter, be sure the enable "append_fromtag"
|
||||
* in "rr" module */
|
||||
modparam("acc", "detect_direction", 0)
|
||||
/* account triggers (flags) */
|
||||
modparam("acc", "log_flag", FLT_ACC)
|
||||
modparam("acc", "log_missed_flag", FLT_ACCMISSED)
|
||||
modparam("acc", "log_extra",
|
||||
"src_user=$fU;src_domain=$fd;src_ip=$si;"
|
||||
"dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
|
||||
modparam("acc", "failed_transaction_flag", FLT_ACCFAILED)
|
||||
/* enhanced DB accounting */
|
||||
#!ifdef WITH_ACCDB
|
||||
modparam("acc", "db_flag", FLT_ACC)
|
||||
modparam("acc", "db_missed_flag", FLT_ACCMISSED)
|
||||
modparam("acc", "db_url", DBURL)
|
||||
modparam("acc", "db_extra",
|
||||
"src_user=$fU;src_domain=$fd;src_ip=$si;"
|
||||
"dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
|
||||
#!endif
|
||||
|
||||
# ----- usrloc params -----
|
||||
/* enable DB persistency for location entries */
|
||||
#!ifdef WITH_USRLOCDB
|
||||
modparam("usrloc", "db_url", DBURL)
|
||||
modparam("usrloc", "db_mode", 2)
|
||||
modparam("usrloc", "use_domain", MULTIDOMAIN)
|
||||
#!endif
|
||||
|
||||
# ----- auth_db params -----
|
||||
#!ifdef WITH_AUTH
|
||||
modparam("auth_db", "db_url", DBURL)
|
||||
modparam("auth_db", "calculate_ha1", 0)
|
||||
modparam("auth_db", "password_column", "ha1")
|
||||
modparam("auth_db", "load_credentials", "")
|
||||
modparam("auth_db", "use_domain", MULTIDOMAIN)
|
||||
|
||||
# ----- permissions params -----
|
||||
#!ifdef WITH_IPAUTH
|
||||
modparam("permissions", "db_url", DBURL)
|
||||
modparam("permissions", "db_mode", 1)
|
||||
#!endif
|
||||
|
||||
#!endif
|
||||
|
||||
# ----- alias_db params -----
|
||||
#!ifdef WITH_ALIASDB
|
||||
modparam("alias_db", "db_url", DBURL)
|
||||
modparam("alias_db", "use_domain", MULTIDOMAIN)
|
||||
#!endif
|
||||
|
||||
# ----- speeddial params -----
|
||||
#!ifdef WITH_SPEEDDIAL
|
||||
modparam("speeddial", "db_url", DBURL)
|
||||
modparam("speeddial", "use_domain", MULTIDOMAIN)
|
||||
#!endif
|
||||
|
||||
# ----- domain params -----
|
||||
#!ifdef WITH_MULTIDOMAIN
|
||||
modparam("domain", "db_url", DBURL)
|
||||
/* register callback to match myself condition with domains list */
|
||||
modparam("domain", "register_myself", 1)
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_PRESENCE
|
||||
# ----- presence params -----
|
||||
modparam("presence", "db_url", DBURL)
|
||||
|
||||
# ----- presence_xml params -----
|
||||
modparam("presence_xml", "db_url", DBURL)
|
||||
modparam("presence_xml", "force_active", 1)
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_NAT
|
||||
# ----- rtpproxy params -----
|
||||
modparam("rtpproxy", "rtpproxy_sock", "unix:/var/run/rtpproxy/rtpproxy.sock")
|
||||
|
||||
# ----- nathelper params -----
|
||||
modparam("nathelper", "natping_interval", 30)
|
||||
modparam("nathelper", "ping_nated_only", 1)
|
||||
modparam("nathelper", "sipping_bflag", FLB_NATSIPPING)
|
||||
modparam("nathelper", "sipping_from", "sip:pinger@hatthieves.es")
|
||||
|
||||
# params needed for NAT traversal in other modules
|
||||
modparam("nathelper|registrar", "received_avp", "$avp(RECEIVED)")
|
||||
modparam("usrloc", "nat_bflag", FLB_NATB)
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_TLS
|
||||
# ----- tls params -----
|
||||
modparam("tls", "config", "/etc/kamailio/tls.cfg")
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_ANTIFLOOD
|
||||
# ----- pike params -----
|
||||
modparam("pike", "sampling_time_unit", 2)
|
||||
modparam("pike", "reqs_density_per_unit", 16)
|
||||
modparam("pike", "remove_latency", 4)
|
||||
|
||||
# ----- htable params -----
|
||||
/* ip ban htable with autoexpire after 5 minutes */
|
||||
modparam("htable", "htable", "ipban=>size=8;autoexpire=300;")
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_XMLRPC
|
||||
# ----- xmlrpc params -----
|
||||
modparam("xmlrpc", "route", "XMLRPC");
|
||||
modparam("xmlrpc", "url_match", "^/RPC")
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_DEBUG
|
||||
# ----- debugger params -----
|
||||
modparam("debugger", "cfgtrace", 1)
|
||||
modparam("debugger", "log_level_name", "exec")
|
||||
#!endif
|
||||
|
||||
####### Routing Logic ########
|
||||
|
||||
|
||||
/* Main SIP request routing logic
|
||||
* - processing of any incoming SIP request starts with this route
|
||||
* - note: this is the same as route { ... } */
|
||||
request_route {
|
||||
|
||||
# per request initial checks
|
||||
route(REQINIT);
|
||||
|
||||
# NAT detection
|
||||
route(NATDETECT);
|
||||
|
||||
# CANCEL processing
|
||||
if (is_method("CANCEL")) {
|
||||
if (t_check_trans()) {
|
||||
route(RELAY);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
# handle retransmissions
|
||||
if (!is_method("ACK")) {
|
||||
if(t_precheck_trans()) {
|
||||
t_check_trans();
|
||||
exit;
|
||||
}
|
||||
t_check_trans();
|
||||
}
|
||||
|
||||
# handle requests within SIP dialogs
|
||||
route(WITHINDLG);
|
||||
|
||||
### only initial requests (no To tag)
|
||||
|
||||
# authentication
|
||||
route(AUTH);
|
||||
|
||||
# record routing for dialog forming requests (in case they are routed)
|
||||
# - remove preloaded route headers
|
||||
remove_hf("Route");
|
||||
if (is_method("INVITE|SUBSCRIBE")) {
|
||||
record_route();
|
||||
}
|
||||
|
||||
# account only INVITEs
|
||||
if (is_method("INVITE")) {
|
||||
setflag(FLT_ACC); # do accounting
|
||||
}
|
||||
|
||||
# dispatch requests to foreign domains
|
||||
route(SIPOUT);
|
||||
|
||||
### requests for my local domains
|
||||
|
||||
# handle presence related requests
|
||||
route(PRESENCE);
|
||||
|
||||
# handle registrations
|
||||
route(REGISTRAR);
|
||||
|
||||
if ($rU==$null) {
|
||||
# request with no Username in RURI
|
||||
sl_send_reply("484","Address Incomplete");
|
||||
exit;
|
||||
}
|
||||
|
||||
# dispatch destinations to PSTN
|
||||
route(PSTN);
|
||||
|
||||
# user location service
|
||||
route(LOCATION);
|
||||
}
|
||||
|
||||
# Wrapper for relaying requests
|
||||
route[RELAY] {
|
||||
|
||||
# enable additional event routes for forwarded requests
|
||||
# - serial forking, RTP relaying handling, a.s.o.
|
||||
if (is_method("INVITE|BYE|SUBSCRIBE|UPDATE")) {
|
||||
if(!t_is_set("branch_route")) t_on_branch("MANAGE_BRANCH");
|
||||
}
|
||||
if (is_method("INVITE|SUBSCRIBE|UPDATE")) {
|
||||
if(!t_is_set("onreply_route")) t_on_reply("MANAGE_REPLY");
|
||||
}
|
||||
if (is_method("INVITE")) {
|
||||
if(!t_is_set("failure_route")) t_on_failure("MANAGE_FAILURE");
|
||||
}
|
||||
|
||||
if (!t_relay()) {
|
||||
sl_reply_error();
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
# Per SIP request initial checks
|
||||
route[REQINIT] {
|
||||
#!ifdef WITH_ANTIFLOOD
|
||||
# flood detection from same IP and traffic ban for a while
|
||||
# be sure you exclude checking trusted peers, such as pstn gateways
|
||||
# - local host excluded (e.g., loop to self)
|
||||
if(src_ip!=myself) {
|
||||
if($sht(ipban=>$si)!=$null) {
|
||||
# ip is already blocked
|
||||
xdbg("request from blocked IP - $rm from $fu (IP:$si:$sp)\n");
|
||||
exit;
|
||||
}
|
||||
if (!pike_check_req()) {
|
||||
xlog("L_ALERT","ALERT: pike blocking $rm from $fu (IP:$si:$sp)\n");
|
||||
$sht(ipban=>$si) = 1;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
#!endif
|
||||
if($ua =~ "friendly-scanner|sipcli|VaxSIPUserAgent") {
|
||||
# silent drop for scanners - uncomment next line if want to reply
|
||||
# sl_send_reply("200", "OK");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!mf_process_maxfwd_header("10")) {
|
||||
sl_send_reply("483","Too Many Hops");
|
||||
exit;
|
||||
}
|
||||
|
||||
if(is_method("OPTIONS") && uri==myself && $rU==$null) {
|
||||
sl_send_reply("200","Keepalive");
|
||||
exit;
|
||||
}
|
||||
|
||||
if(!sanity_check("17895", "7")) {
|
||||
xlog("Malformed SIP message from $si:$sp\n");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
# Handle requests within SIP dialogs
|
||||
route[WITHINDLG] {
|
||||
if (!has_totag()) return;
|
||||
|
||||
# sequential request withing a dialog should
|
||||
# take the path determined by record-routing
|
||||
if (loose_route()) {
|
||||
route(DLGURI);
|
||||
if (is_method("BYE")) {
|
||||
setflag(FLT_ACC); # do accounting ...
|
||||
setflag(FLT_ACCFAILED); # ... even if the transaction fails
|
||||
} else if ( is_method("ACK") ) {
|
||||
# ACK is forwarded statelessly
|
||||
route(NATMANAGE);
|
||||
} else if ( is_method("NOTIFY") ) {
|
||||
# Add Record-Route for in-dialog NOTIFY as per RFC 6665.
|
||||
record_route();
|
||||
}
|
||||
route(RELAY);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (is_method("SUBSCRIBE") && uri == myself) {
|
||||
# in-dialog subscribe requests
|
||||
route(PRESENCE);
|
||||
exit;
|
||||
}
|
||||
if ( is_method("ACK") ) {
|
||||
if ( t_check_trans() ) {
|
||||
# no loose-route, but stateful ACK;
|
||||
# must be an ACK after a 487
|
||||
# or e.g. 404 from upstream server
|
||||
route(RELAY);
|
||||
exit;
|
||||
} else {
|
||||
# ACK without matching transaction ... ignore and discard
|
||||
exit;
|
||||
}
|
||||
}
|
||||
sl_send_reply("404","Not here");
|
||||
exit;
|
||||
}
|
||||
|
||||
# Handle SIP registrations
|
||||
route[REGISTRAR] {
|
||||
if (!is_method("REGISTER")) return;
|
||||
|
||||
if(isflagset(FLT_NATS)) {
|
||||
setbflag(FLB_NATB);
|
||||
#!ifdef WITH_NATSIPPING
|
||||
# do SIP NAT pinging
|
||||
setbflag(FLB_NATSIPPING);
|
||||
#!endif
|
||||
}
|
||||
if (!save("location")) {
|
||||
sl_reply_error();
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
# User location service
|
||||
route[LOCATION] {
|
||||
|
||||
#!ifdef WITH_SPEEDDIAL
|
||||
# search for short dialing - 2-digit extension
|
||||
if($rU=~"^[0-9][0-9]$") {
|
||||
if(sd_lookup("speed_dial")) {
|
||||
route(SIPOUT);
|
||||
}
|
||||
}
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_ALIASDB
|
||||
# search in DB-based aliases
|
||||
if(alias_db_lookup("dbaliases")) {
|
||||
route(SIPOUT);
|
||||
}
|
||||
#!endif
|
||||
|
||||
$avp(oexten) = $rU;
|
||||
if (!lookup("location")) {
|
||||
$var(rc) = $rc;
|
||||
route(TOVOICEMAIL);
|
||||
t_newtran();
|
||||
switch ($var(rc)) {
|
||||
case -1:
|
||||
case -3:
|
||||
send_reply("404", "Not Found");
|
||||
exit;
|
||||
case -2:
|
||||
send_reply("405", "Method Not Allowed");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
# when routing via usrloc, log the missed calls also
|
||||
if (is_method("INVITE")) {
|
||||
setflag(FLT_ACCMISSED);
|
||||
}
|
||||
|
||||
route(RELAY);
|
||||
exit;
|
||||
}
|
||||
|
||||
# Presence server processing
|
||||
route[PRESENCE] {
|
||||
if(!is_method("PUBLISH|SUBSCRIBE")) return;
|
||||
|
||||
if(is_method("SUBSCRIBE") && $hdr(Event)=="message-summary") {
|
||||
route(TOVOICEMAIL);
|
||||
# returns here if no voicemail server is configured
|
||||
sl_send_reply("404", "No voicemail service");
|
||||
exit;
|
||||
}
|
||||
|
||||
#!ifdef WITH_PRESENCE
|
||||
if (!t_newtran()) {
|
||||
sl_reply_error();
|
||||
exit;
|
||||
}
|
||||
|
||||
if(is_method("PUBLISH")) {
|
||||
handle_publish();
|
||||
t_release();
|
||||
} else if(is_method("SUBSCRIBE")) {
|
||||
handle_subscribe();
|
||||
t_release();
|
||||
}
|
||||
exit;
|
||||
#!endif
|
||||
|
||||
# if presence enabled, this part will not be executed
|
||||
if (is_method("PUBLISH") || $rU==$null) {
|
||||
sl_send_reply("404", "Not here");
|
||||
exit;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
# IP authorization and user authentication
|
||||
route[AUTH] {
|
||||
#!ifdef WITH_AUTH
|
||||
|
||||
#!ifdef WITH_IPAUTH
|
||||
if((!is_method("REGISTER")) && allow_source_address()) {
|
||||
# source IP allowed
|
||||
return;
|
||||
}
|
||||
#!endif
|
||||
|
||||
if (is_method("REGISTER") || from_uri==myself) {
|
||||
# authenticate requests
|
||||
if (!auth_check("$fd", "subscriber", "1")) {
|
||||
auth_challenge("$fd", "0");
|
||||
exit;
|
||||
}
|
||||
# user authenticated - remove auth header
|
||||
if(!is_method("REGISTER|PUBLISH"))
|
||||
consume_credentials();
|
||||
}
|
||||
# if caller is not local subscriber, then check if it calls
|
||||
# a local destination, otherwise deny, not an open relay here
|
||||
if (from_uri!=myself && uri!=myself) {
|
||||
sl_send_reply("403","Not relaying");
|
||||
exit;
|
||||
}
|
||||
|
||||
#!else
|
||||
|
||||
# authentication not enabled - do not relay at all to foreign networks
|
||||
if(uri!=myself) {
|
||||
sl_send_reply("403","Not relaying");
|
||||
exit;
|
||||
}
|
||||
|
||||
#!endif
|
||||
return;
|
||||
}
|
||||
|
||||
# Caller NAT detection
|
||||
route[NATDETECT] {
|
||||
#!ifdef WITH_NAT
|
||||
force_rport();
|
||||
if (nat_uac_test("19")) {
|
||||
if (is_method("REGISTER")) {
|
||||
fix_nated_register();
|
||||
} else {
|
||||
if(is_first_hop()) {
|
||||
set_contact_alias();
|
||||
}
|
||||
}
|
||||
setflag(FLT_NATS);
|
||||
}
|
||||
#!endif
|
||||
return;
|
||||
}
|
||||
|
||||
# RTPProxy control and signaling updates for NAT traversal
|
||||
route[NATMANAGE] {
|
||||
#!ifdef WITH_NAT
|
||||
if (is_request()) {
|
||||
if(has_totag()) {
|
||||
if(check_route_param("nat=yes")) {
|
||||
setbflag(FLB_NATB);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB))) return;
|
||||
|
||||
if(nat_uac_test("8")) {
|
||||
rtpproxy_manage("co");
|
||||
} else {
|
||||
rtpproxy_manage("cor");
|
||||
}
|
||||
|
||||
if (is_request()) {
|
||||
if (!has_totag()) {
|
||||
if(t_is_branch_route()) {
|
||||
add_rr_param(";nat=yes");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_reply()) {
|
||||
if(isbflagset(FLB_NATB)) {
|
||||
if(is_first_hop())
|
||||
set_contact_alias();
|
||||
}
|
||||
}
|
||||
#!endif
|
||||
return;
|
||||
}
|
||||
|
||||
# URI update for dialog requests
|
||||
route[DLGURI] {
|
||||
#!ifdef WITH_NAT
|
||||
if(!isdsturiset()) {
|
||||
handle_ruri_alias();
|
||||
}
|
||||
#!endif
|
||||
return;
|
||||
}
|
||||
|
||||
# Routing to foreign domains
|
||||
route[SIPOUT] {
|
||||
if (uri==myself) return;
|
||||
|
||||
append_hf("P-hint: outbound\r\n");
|
||||
route(RELAY);
|
||||
exit;
|
||||
}
|
||||
|
||||
# PSTN GW routing
|
||||
route[PSTN] {
|
||||
#!ifdef WITH_PSTN
|
||||
# check if PSTN GW IP is defined
|
||||
if (strempty($sel(cfg_get.pstn.gw_ip))) {
|
||||
xlog("SCRIPT: PSTN routing enabled but pstn.gw_ip not defined\n");
|
||||
return;
|
||||
}
|
||||
|
||||
# route to PSTN dialed numbers starting with '+' or '00'
|
||||
# (international format)
|
||||
# - update the condition to match your dialing rules for PSTN routing
|
||||
if(!($rU=~"^(\+|00)[1-9][0-9]{3,20}$")) return;
|
||||
|
||||
# only local users allowed to call
|
||||
if(from_uri!=myself) {
|
||||
sl_send_reply("403", "Not Allowed");
|
||||
exit;
|
||||
}
|
||||
|
||||
# normalize target number for pstn gateway
|
||||
# - convert leading 00 to +
|
||||
if (starts_with("$rU", "00")) {
|
||||
strip(2);
|
||||
prefix("+");
|
||||
}
|
||||
|
||||
if (strempty($sel(cfg_get.pstn.gw_port))) {
|
||||
$ru = "sip:" + $rU + "@" + $sel(cfg_get.pstn.gw_ip);
|
||||
} else {
|
||||
$ru = "sip:" + $rU + "@" + $sel(cfg_get.pstn.gw_ip) + ":"
|
||||
+ $sel(cfg_get.pstn.gw_port);
|
||||
}
|
||||
|
||||
route(RELAY);
|
||||
exit;
|
||||
#!endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
# XMLRPC routing
|
||||
#!ifdef WITH_XMLRPC
|
||||
route[XMLRPC] {
|
||||
# allow XMLRPC from localhost
|
||||
if ((method=="POST" || method=="GET")
|
||||
&& (src_ip==127.0.0.1)) {
|
||||
# close connection only for xmlrpclib user agents (there is a bug in
|
||||
# xmlrpclib: it waits for EOF before interpreting the response).
|
||||
if ($hdr(User-Agent) =~ "xmlrpclib")
|
||||
set_reply_close();
|
||||
set_reply_no_connect();
|
||||
dispatch_rpc();
|
||||
exit;
|
||||
}
|
||||
send_reply("403", "Forbidden");
|
||||
exit;
|
||||
}
|
||||
#!endif
|
||||
|
||||
# Routing to voicemail server
|
||||
route[TOVOICEMAIL] {
|
||||
#!ifdef WITH_VOICEMAIL
|
||||
if(!is_method("INVITE|SUBSCRIBE")) return;
|
||||
|
||||
# check if VoiceMail server IP is defined
|
||||
if (strempty($sel(cfg_get.voicemail.srv_ip))) {
|
||||
xlog("SCRIPT: VoiceMail routing enabled but IP not defined\n");
|
||||
return;
|
||||
}
|
||||
if(is_method("INVITE")) {
|
||||
if($avp(oexten)==$null) return;
|
||||
|
||||
$ru = "sip:" + $avp(oexten) + "@" + $sel(cfg_get.voicemail.srv_ip)
|
||||
+ ":" + $sel(cfg_get.voicemail.srv_port);
|
||||
} else {
|
||||
if($rU==$null) return;
|
||||
|
||||
$ru = "sip:" + $rU + "@" + $sel(cfg_get.voicemail.srv_ip)
|
||||
+ ":" + $sel(cfg_get.voicemail.srv_port);
|
||||
}
|
||||
route(RELAY);
|
||||
exit;
|
||||
#!endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
# Manage outgoing branches
|
||||
branch_route[MANAGE_BRANCH] {
|
||||
xdbg("new branch [$T_branch_idx] to $ru\n");
|
||||
route(NATMANAGE);
|
||||
}
|
||||
|
||||
# Manage incoming replies
|
||||
onreply_route[MANAGE_REPLY] {
|
||||
xdbg("incoming reply\n");
|
||||
if(status=~"[12][0-9][0-9]") {
|
||||
route(NATMANAGE);
|
||||
}
|
||||
}
|
||||
|
||||
# Manage failure routing cases
|
||||
failure_route[MANAGE_FAILURE] {
|
||||
route(NATMANAGE);
|
||||
|
||||
if (t_is_canceled()) exit;
|
||||
|
||||
#!ifdef WITH_BLOCK3XX
|
||||
# block call redirect based on 3xx replies.
|
||||
if (t_check_status("3[0-9][0-9]")) {
|
||||
t_reply("404","Not found");
|
||||
exit;
|
||||
}
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_BLOCK401407
|
||||
# block call redirect based on 401, 407 replies.
|
||||
if (t_check_status("401|407")) {
|
||||
t_reply("404","Not found");
|
||||
exit;
|
||||
}
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_VOICEMAIL
|
||||
# serial forking
|
||||
# - route to voicemail on busy or no answer (timeout)
|
||||
if (t_check_status("486|408")) {
|
||||
$du = $null;
|
||||
route(TOVOICEMAIL);
|
||||
exit;
|
||||
}
|
||||
#!endif
|
||||
}
|
||||
|
||||
enable_sctp = 1
|
||||
970
production/kamailio/kamailio/kamailio.cfg.BAK
Archivo normal
970
production/kamailio/kamailio/kamailio.cfg.BAK
Archivo normal
@@ -0,0 +1,970 @@
|
||||
#!KAMAILIO
|
||||
#
|
||||
# Kamailio (OpenSER) SIP Server v5.2 - default configuration script
|
||||
# - web: https://www.kamailio.org
|
||||
# - git: https://github.com/kamailio/kamailio
|
||||
#
|
||||
# Direct your questions about this file to: <sr-users@lists.kamailio.org>
|
||||
#
|
||||
# Refer to the Core CookBook at https://www.kamailio.org/wiki/
|
||||
# for an explanation of possible statements, functions and parameters.
|
||||
#
|
||||
# Note: the comments can be:
|
||||
# - lines starting with #, but not the pre-processor directives,
|
||||
# which start with #!, like #!define, #!ifdef, #!endif, #!else, #!trydef,
|
||||
# #!subst, #!substdef, ...
|
||||
# - lines starting with //
|
||||
# - blocks enclosed in between /* */
|
||||
#
|
||||
# Several features can be enabled using '#!define WITH_FEATURE' directives:
|
||||
#
|
||||
# *** To run in debug mode:
|
||||
# - define WITH_DEBUG
|
||||
#
|
||||
# *** To enable mysql:
|
||||
# - define WITH_MYSQL
|
||||
#
|
||||
# *** To enable authentication execute:
|
||||
# - enable mysql
|
||||
# - define WITH_AUTH
|
||||
# - add users using 'kamctl'
|
||||
#
|
||||
# *** To enable IP authentication execute:
|
||||
# - enable mysql
|
||||
# - enable authentication
|
||||
# - define WITH_IPAUTH
|
||||
# - add IP addresses with group id '1' to 'address' table
|
||||
#
|
||||
# *** To enable persistent user location execute:
|
||||
# - enable mysql
|
||||
# - define WITH_USRLOCDB
|
||||
#
|
||||
# *** To enable presence server execute:
|
||||
# - enable mysql
|
||||
# - define WITH_PRESENCE
|
||||
#
|
||||
# *** To enable nat traversal execute:
|
||||
# - define WITH_NAT
|
||||
# - install RTPProxy: http://www.rtpproxy.org
|
||||
# - start RTPProxy:
|
||||
# rtpproxy -l _your_public_ip_ -s udp:localhost:7722
|
||||
# - option for NAT SIP OPTIONS keepalives: WITH_NATSIPPING
|
||||
#
|
||||
# *** To enable PSTN gateway routing execute:
|
||||
# - define WITH_PSTN
|
||||
# - set the value of pstn.gw_ip
|
||||
# - check route[PSTN] for regexp routing condition
|
||||
#
|
||||
# *** To enable database aliases lookup execute:
|
||||
# - enable mysql
|
||||
# - define WITH_ALIASDB
|
||||
#
|
||||
# *** To enable speed dial lookup execute:
|
||||
# - enable mysql
|
||||
# - define WITH_SPEEDDIAL
|
||||
#
|
||||
# *** To enable multi-domain support execute:
|
||||
# - enable mysql
|
||||
# - define WITH_MULTIDOMAIN
|
||||
#
|
||||
# *** To enable TLS support execute:
|
||||
# - adjust CFGDIR/tls.cfg as needed
|
||||
# - define WITH_TLS
|
||||
#
|
||||
# *** To enable XMLRPC support execute:
|
||||
# - define WITH_XMLRPC
|
||||
# - adjust route[XMLRPC] for access policy
|
||||
#
|
||||
# *** To enable anti-flood detection execute:
|
||||
# - adjust pike and htable=>ipban settings as needed (default is
|
||||
# block if more than 16 requests in 2 seconds and ban for 300 seconds)
|
||||
# - define WITH_ANTIFLOOD
|
||||
#
|
||||
# *** To block 3XX redirect replies execute:
|
||||
# - define WITH_BLOCK3XX
|
||||
#
|
||||
# *** To block 401 and 407 authentication replies execute:
|
||||
# - define WITH_BLOCK401407
|
||||
#
|
||||
# *** To enable VoiceMail routing execute:
|
||||
# - define WITH_VOICEMAIL
|
||||
# - set the value of voicemail.srv_ip
|
||||
# - adjust the value of voicemail.srv_port
|
||||
#
|
||||
# *** To enhance accounting execute:
|
||||
# - enable mysql
|
||||
# - define WITH_ACCDB
|
||||
# - add following columns to database
|
||||
#!ifdef ACCDB_COMMENT
|
||||
ALTER TABLE acc ADD COLUMN src_user VARCHAR(64) NOT NULL DEFAULT '';
|
||||
ALTER TABLE acc ADD COLUMN src_domain VARCHAR(128) NOT NULL DEFAULT '';
|
||||
ALTER TABLE acc ADD COLUMN src_ip varchar(64) NOT NULL default '';
|
||||
ALTER TABLE acc ADD COLUMN dst_ouser VARCHAR(64) NOT NULL DEFAULT '';
|
||||
ALTER TABLE acc ADD COLUMN dst_user VARCHAR(64) NOT NULL DEFAULT '';
|
||||
ALTER TABLE acc ADD COLUMN dst_domain VARCHAR(128) NOT NULL DEFAULT '';
|
||||
ALTER TABLE missed_calls ADD COLUMN src_user VARCHAR(64) NOT NULL DEFAULT '';
|
||||
ALTER TABLE missed_calls ADD COLUMN src_domain VARCHAR(128) NOT NULL DEFAULT '';
|
||||
ALTER TABLE missed_calls ADD COLUMN src_ip varchar(64) NOT NULL default '';
|
||||
ALTER TABLE missed_calls ADD COLUMN dst_ouser VARCHAR(64) NOT NULL DEFAULT '';
|
||||
ALTER TABLE missed_calls ADD COLUMN dst_user VARCHAR(64) NOT NULL DEFAULT '';
|
||||
ALTER TABLE missed_calls ADD COLUMN dst_domain VARCHAR(128) NOT NULL DEFAULT '';
|
||||
#!endif
|
||||
|
||||
####### Include Local Config If Exists #########
|
||||
import_file "kamailio-local.cfg"
|
||||
|
||||
####### Defined Values #########
|
||||
|
||||
# *** Value defines - IDs used later in config
|
||||
#!ifdef WITH_MYSQL
|
||||
# - database URL - used to connect to database server by modules such
|
||||
# as: auth_db, acc, usrloc, a.s.o.
|
||||
#!ifndef DBURL
|
||||
#!define DBURL "mysql://kamailio:kamailiorw@localhost/kamailio"
|
||||
#!endif
|
||||
#!endif
|
||||
#!ifdef WITH_MULTIDOMAIN
|
||||
# - the value for 'use_domain' parameters
|
||||
#!define MULTIDOMAIN 1
|
||||
#!else
|
||||
#!define MULTIDOMAIN 0
|
||||
#!endif
|
||||
|
||||
# - flags
|
||||
# FLT_ - per transaction (message) flags
|
||||
# FLB_ - per branch flags
|
||||
#!define FLT_ACC 1
|
||||
#!define FLT_ACCMISSED 2
|
||||
#!define FLT_ACCFAILED 3
|
||||
#!define FLT_NATS 5
|
||||
|
||||
#!define FLB_NATB 6
|
||||
#!define FLB_NATSIPPING 7
|
||||
|
||||
####### Global Parameters #########
|
||||
|
||||
### LOG Levels: 3=DBG, 2=INFO, 1=NOTICE, 0=WARN, -1=ERR
|
||||
#!ifdef WITH_DEBUG
|
||||
debug=4
|
||||
log_stderror=yes
|
||||
#!else
|
||||
debug=2
|
||||
log_stderror=no
|
||||
#!endif
|
||||
|
||||
memdbg=5
|
||||
memlog=5
|
||||
|
||||
log_facility=LOG_LOCAL0
|
||||
log_prefix="{$mt $hdr(CSeq) $ci} "
|
||||
|
||||
/* number of SIP routing processes */
|
||||
children=8
|
||||
|
||||
/* uncomment the next line to disable TCP (default on) */
|
||||
# disable_tcp=yes
|
||||
|
||||
/* uncomment the next line to disable the auto discovery of local aliases
|
||||
* based on reverse DNS on IPs (default on) */
|
||||
# auto_aliases=no
|
||||
|
||||
/* add local domain aliases */
|
||||
# alias="sip.mydomain.com"
|
||||
|
||||
/* uncomment and configure the following line if you want Kamailio to
|
||||
* bind on a specific interface/port/proto (default bind on all available) */
|
||||
# listen=udp:10.0.0.10:5060
|
||||
|
||||
#!ifdef WITH_TLS
|
||||
enable_tls=yes
|
||||
#!endif
|
||||
|
||||
/* life time of TCP connection when there is no traffic
|
||||
* - a bit higher than registration expires to cope with UA behind NAT */
|
||||
tcp_connection_lifetime=3605
|
||||
|
||||
####### Custom Parameters #########
|
||||
|
||||
/* These parameters can be modified runtime via RPC interface
|
||||
* - see the documentation of 'cfg_rpc' module.
|
||||
*
|
||||
* Format: group.id = value 'desc' description
|
||||
* Access: $sel(cfg_get.group.id) or @cfg_get.group.id */
|
||||
|
||||
#!ifdef WITH_PSTN
|
||||
/* PSTN GW Routing
|
||||
*
|
||||
* - pstn.gw_ip: valid IP or hostname as string value, example:
|
||||
* pstn.gw_ip = "10.0.0.101" desc "My PSTN GW Address"
|
||||
*
|
||||
* - by default is empty to avoid misrouting */
|
||||
pstn.gw_ip = "" desc "PSTN GW Address"
|
||||
pstn.gw_port = "" desc "PSTN GW Port"
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_VOICEMAIL
|
||||
/* VoiceMail Routing on offline, busy or no answer
|
||||
*
|
||||
* - by default Voicemail server IP is empty to avoid misrouting */
|
||||
voicemail.srv_ip = "" desc "VoiceMail IP Address"
|
||||
voicemail.srv_port = "5060" desc "VoiceMail Port"
|
||||
#!endif
|
||||
|
||||
####### Modules Section ########
|
||||
|
||||
/* set paths to location of modules */
|
||||
# mpath="/usr/lib/x86_64-linux-gnu/kamailio/modules/"
|
||||
|
||||
#!ifdef WITH_MYSQL
|
||||
loadmodule "db_mysql.so"
|
||||
#!endif
|
||||
|
||||
loadmodule "jsonrpcs.so"
|
||||
loadmodule "kex.so"
|
||||
loadmodule "corex.so"
|
||||
loadmodule "tm.so"
|
||||
loadmodule "tmx.so"
|
||||
loadmodule "sl.so"
|
||||
loadmodule "rr.so"
|
||||
loadmodule "pv.so"
|
||||
loadmodule "maxfwd.so"
|
||||
loadmodule "usrloc.so"
|
||||
loadmodule "registrar.so"
|
||||
loadmodule "textops.so"
|
||||
loadmodule "siputils.so"
|
||||
loadmodule "xlog.so"
|
||||
loadmodule "sanity.so"
|
||||
loadmodule "ctl.so"
|
||||
loadmodule "cfg_rpc.so"
|
||||
loadmodule "acc.so"
|
||||
loadmodule "counters.so"
|
||||
|
||||
#!ifdef WITH_AUTH
|
||||
loadmodule "auth.so"
|
||||
loadmodule "auth_db.so"
|
||||
#!ifdef WITH_IPAUTH
|
||||
loadmodule "permissions.so"
|
||||
#!endif
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_ALIASDB
|
||||
loadmodule "alias_db.so"
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_SPEEDDIAL
|
||||
loadmodule "speeddial.so"
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_MULTIDOMAIN
|
||||
loadmodule "domain.so"
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_PRESENCE
|
||||
loadmodule "presence.so"
|
||||
loadmodule "presence_xml.so"
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_NAT
|
||||
loadmodule "nathelper.so"
|
||||
loadmodule "rtpproxy.so"
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_TLS
|
||||
loadmodule "tls.so"
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_ANTIFLOOD
|
||||
loadmodule "htable.so"
|
||||
loadmodule "pike.so"
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_XMLRPC
|
||||
loadmodule "xmlrpc.so"
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_DEBUG
|
||||
loadmodule "debugger.so"
|
||||
#!endif
|
||||
|
||||
# ----------------- setting module-specific parameters ---------------
|
||||
|
||||
|
||||
# ----- jsonrpcs params -----
|
||||
modparam("jsonrpcs", "pretty_format", 1)
|
||||
/* set the path to RPC fifo control file */
|
||||
# modparam("jsonrpcs", "fifo_name", "/var/run/kamailio/kamailio_rpc.fifo")
|
||||
/* set the path to RPC unix socket control file */
|
||||
# modparam("jsonrpcs", "dgram_socket", "/var/run/kamailio/kamailio_rpc.sock")
|
||||
|
||||
# ----- ctl params -----
|
||||
/* set the path to RPC unix socket control file */
|
||||
# modparam("ctl", "binrpc", "unix:/var/run/kamailio/kamailio_ctl")
|
||||
|
||||
# ----- tm params -----
|
||||
# auto-discard branches from previous serial forking leg
|
||||
modparam("tm", "failure_reply_mode", 3)
|
||||
# default retransmission timeout: 30sec
|
||||
modparam("tm", "fr_timer", 30000)
|
||||
# default invite retransmission timeout after 1xx: 120sec
|
||||
modparam("tm", "fr_inv_timer", 120000)
|
||||
|
||||
# ----- rr params -----
|
||||
# set next param to 1 to add value to ;lr param (helps with some UAs)
|
||||
modparam("rr", "enable_full_lr", 0)
|
||||
# do not append from tag to the RR (no need for this script)
|
||||
modparam("rr", "append_fromtag", 0)
|
||||
|
||||
# ----- registrar params -----
|
||||
modparam("registrar", "method_filtering", 1)
|
||||
/* uncomment the next line to disable parallel forking via location */
|
||||
# modparam("registrar", "append_branches", 0)
|
||||
/* uncomment the next line not to allow more than 10 contacts per AOR */
|
||||
# modparam("registrar", "max_contacts", 10)
|
||||
/* max value for expires of registrations */
|
||||
modparam("registrar", "max_expires", 3600)
|
||||
/* set it to 1 to enable GRUU */
|
||||
modparam("registrar", "gruu_enabled", 0)
|
||||
|
||||
# ----- acc params -----
|
||||
/* what special events should be accounted ? */
|
||||
modparam("acc", "early_media", 0)
|
||||
modparam("acc", "report_ack", 0)
|
||||
modparam("acc", "report_cancels", 0)
|
||||
/* by default ww do not adjust the direct of the sequential requests.
|
||||
* if you enable this parameter, be sure the enable "append_fromtag"
|
||||
* in "rr" module */
|
||||
modparam("acc", "detect_direction", 0)
|
||||
/* account triggers (flags) */
|
||||
modparam("acc", "log_flag", FLT_ACC)
|
||||
modparam("acc", "log_missed_flag", FLT_ACCMISSED)
|
||||
modparam("acc", "log_extra",
|
||||
"src_user=$fU;src_domain=$fd;src_ip=$si;"
|
||||
"dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
|
||||
modparam("acc", "failed_transaction_flag", FLT_ACCFAILED)
|
||||
/* enhanced DB accounting */
|
||||
#!ifdef WITH_ACCDB
|
||||
modparam("acc", "db_flag", FLT_ACC)
|
||||
modparam("acc", "db_missed_flag", FLT_ACCMISSED)
|
||||
modparam("acc", "db_url", DBURL)
|
||||
modparam("acc", "db_extra",
|
||||
"src_user=$fU;src_domain=$fd;src_ip=$si;"
|
||||
"dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
|
||||
#!endif
|
||||
|
||||
# ----- usrloc params -----
|
||||
/* enable DB persistency for location entries */
|
||||
#!ifdef WITH_USRLOCDB
|
||||
modparam("usrloc", "db_url", DBURL)
|
||||
modparam("usrloc", "db_mode", 2)
|
||||
modparam("usrloc", "use_domain", MULTIDOMAIN)
|
||||
#!endif
|
||||
|
||||
# ----- auth_db params -----
|
||||
#!ifdef WITH_AUTH
|
||||
modparam("auth_db", "db_url", DBURL)
|
||||
modparam("auth_db", "calculate_ha1", yes)
|
||||
modparam("auth_db", "password_column", "password")
|
||||
modparam("auth_db", "load_credentials", "")
|
||||
modparam("auth_db", "use_domain", MULTIDOMAIN)
|
||||
|
||||
# ----- permissions params -----
|
||||
#!ifdef WITH_IPAUTH
|
||||
modparam("permissions", "db_url", DBURL)
|
||||
modparam("permissions", "db_mode", 1)
|
||||
#!endif
|
||||
|
||||
#!endif
|
||||
|
||||
# ----- alias_db params -----
|
||||
#!ifdef WITH_ALIASDB
|
||||
modparam("alias_db", "db_url", DBURL)
|
||||
modparam("alias_db", "use_domain", MULTIDOMAIN)
|
||||
#!endif
|
||||
|
||||
# ----- speeddial params -----
|
||||
#!ifdef WITH_SPEEDDIAL
|
||||
modparam("speeddial", "db_url", DBURL)
|
||||
modparam("speeddial", "use_domain", MULTIDOMAIN)
|
||||
#!endif
|
||||
|
||||
# ----- domain params -----
|
||||
#!ifdef WITH_MULTIDOMAIN
|
||||
modparam("domain", "db_url", DBURL)
|
||||
/* register callback to match myself condition with domains list */
|
||||
modparam("domain", "register_myself", 1)
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_PRESENCE
|
||||
# ----- presence params -----
|
||||
modparam("presence", "db_url", DBURL)
|
||||
|
||||
# ----- presence_xml params -----
|
||||
modparam("presence_xml", "db_url", DBURL)
|
||||
modparam("presence_xml", "force_active", 1)
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_NAT
|
||||
# ----- rtpproxy params -----
|
||||
modparam("rtpproxy", "rtpproxy_sock", "udp:127.0.0.1:7722")
|
||||
|
||||
# ----- nathelper params -----
|
||||
modparam("nathelper", "natping_interval", 30)
|
||||
modparam("nathelper", "ping_nated_only", 1)
|
||||
modparam("nathelper", "sipping_bflag", FLB_NATSIPPING)
|
||||
modparam("nathelper", "sipping_from", "sip:pinger@kamailio.org")
|
||||
|
||||
# params needed for NAT traversal in other modules
|
||||
modparam("nathelper|registrar", "received_avp", "$avp(RECEIVED)")
|
||||
modparam("usrloc", "nat_bflag", FLB_NATB)
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_TLS
|
||||
# ----- tls params -----
|
||||
modparam("tls", "config", "/etc/kamailio/tls.cfg")
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_ANTIFLOOD
|
||||
# ----- pike params -----
|
||||
modparam("pike", "sampling_time_unit", 2)
|
||||
modparam("pike", "reqs_density_per_unit", 16)
|
||||
modparam("pike", "remove_latency", 4)
|
||||
|
||||
# ----- htable params -----
|
||||
/* ip ban htable with autoexpire after 5 minutes */
|
||||
modparam("htable", "htable", "ipban=>size=8;autoexpire=300;")
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_XMLRPC
|
||||
# ----- xmlrpc params -----
|
||||
modparam("xmlrpc", "route", "XMLRPC");
|
||||
modparam("xmlrpc", "url_match", "^/RPC")
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_DEBUG
|
||||
# ----- debugger params -----
|
||||
modparam("debugger", "cfgtrace", 1)
|
||||
modparam("debugger", "log_level_name", "exec")
|
||||
#!endif
|
||||
|
||||
####### Routing Logic ########
|
||||
|
||||
|
||||
/* Main SIP request routing logic
|
||||
* - processing of any incoming SIP request starts with this route
|
||||
* - note: this is the same as route { ... } */
|
||||
request_route {
|
||||
|
||||
# per request initial checks
|
||||
route(REQINIT);
|
||||
|
||||
# NAT detection
|
||||
route(NATDETECT);
|
||||
|
||||
# CANCEL processing
|
||||
if (is_method("CANCEL")) {
|
||||
if (t_check_trans()) {
|
||||
route(RELAY);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
# handle retransmissions
|
||||
if (!is_method("ACK")) {
|
||||
if(t_precheck_trans()) {
|
||||
t_check_trans();
|
||||
exit;
|
||||
}
|
||||
t_check_trans();
|
||||
}
|
||||
|
||||
# handle requests within SIP dialogs
|
||||
route(WITHINDLG);
|
||||
|
||||
### only initial requests (no To tag)
|
||||
|
||||
# authentication
|
||||
route(AUTH);
|
||||
|
||||
# record routing for dialog forming requests (in case they are routed)
|
||||
# - remove preloaded route headers
|
||||
remove_hf("Route");
|
||||
if (is_method("INVITE|SUBSCRIBE")) {
|
||||
record_route();
|
||||
}
|
||||
|
||||
# account only INVITEs
|
||||
if (is_method("INVITE")) {
|
||||
setflag(FLT_ACC); # do accounting
|
||||
}
|
||||
|
||||
# dispatch requests to foreign domains
|
||||
route(SIPOUT);
|
||||
|
||||
### requests for my local domains
|
||||
|
||||
# handle presence related requests
|
||||
route(PRESENCE);
|
||||
|
||||
# handle registrations
|
||||
route(REGISTRAR);
|
||||
|
||||
if ($rU==$null) {
|
||||
# request with no Username in RURI
|
||||
sl_send_reply("484","Address Incomplete");
|
||||
exit;
|
||||
}
|
||||
|
||||
# dispatch destinations to PSTN
|
||||
route(PSTN);
|
||||
|
||||
# user location service
|
||||
route(LOCATION);
|
||||
}
|
||||
|
||||
# Wrapper for relaying requests
|
||||
route[RELAY] {
|
||||
|
||||
# enable additional event routes for forwarded requests
|
||||
# - serial forking, RTP relaying handling, a.s.o.
|
||||
if (is_method("INVITE|BYE|SUBSCRIBE|UPDATE")) {
|
||||
if(!t_is_set("branch_route")) t_on_branch("MANAGE_BRANCH");
|
||||
}
|
||||
if (is_method("INVITE|SUBSCRIBE|UPDATE")) {
|
||||
if(!t_is_set("onreply_route")) t_on_reply("MANAGE_REPLY");
|
||||
}
|
||||
if (is_method("INVITE")) {
|
||||
if(!t_is_set("failure_route")) t_on_failure("MANAGE_FAILURE");
|
||||
}
|
||||
|
||||
if (!t_relay()) {
|
||||
sl_reply_error();
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
# Per SIP request initial checks
|
||||
route[REQINIT] {
|
||||
#!ifdef WITH_ANTIFLOOD
|
||||
# flood detection from same IP and traffic ban for a while
|
||||
# be sure you exclude checking trusted peers, such as pstn gateways
|
||||
# - local host excluded (e.g., loop to self)
|
||||
if(src_ip!=myself) {
|
||||
if($sht(ipban=>$si)!=$null) {
|
||||
# ip is already blocked
|
||||
xdbg("request from blocked IP - $rm from $fu (IP:$si:$sp)\n");
|
||||
exit;
|
||||
}
|
||||
if (!pike_check_req()) {
|
||||
xlog("L_ALERT","ALERT: pike blocking $rm from $fu (IP:$si:$sp)\n");
|
||||
$sht(ipban=>$si) = 1;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
#!endif
|
||||
if($ua =~ "friendly-scanner|sipcli|VaxSIPUserAgent") {
|
||||
# silent drop for scanners - uncomment next line if want to reply
|
||||
# sl_send_reply("200", "OK");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!mf_process_maxfwd_header("10")) {
|
||||
sl_send_reply("483","Too Many Hops");
|
||||
exit;
|
||||
}
|
||||
|
||||
if(is_method("OPTIONS") && uri==myself && $rU==$null) {
|
||||
sl_send_reply("200","Keepalive");
|
||||
exit;
|
||||
}
|
||||
|
||||
if(!sanity_check("17895", "7")) {
|
||||
xlog("Malformed SIP message from $si:$sp\n");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
# Handle requests within SIP dialogs
|
||||
route[WITHINDLG] {
|
||||
if (!has_totag()) return;
|
||||
|
||||
# sequential request withing a dialog should
|
||||
# take the path determined by record-routing
|
||||
if (loose_route()) {
|
||||
route(DLGURI);
|
||||
if (is_method("BYE")) {
|
||||
setflag(FLT_ACC); # do accounting ...
|
||||
setflag(FLT_ACCFAILED); # ... even if the transaction fails
|
||||
} else if ( is_method("ACK") ) {
|
||||
# ACK is forwarded statelessly
|
||||
route(NATMANAGE);
|
||||
} else if ( is_method("NOTIFY") ) {
|
||||
# Add Record-Route for in-dialog NOTIFY as per RFC 6665.
|
||||
record_route();
|
||||
}
|
||||
route(RELAY);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (is_method("SUBSCRIBE") && uri == myself) {
|
||||
# in-dialog subscribe requests
|
||||
route(PRESENCE);
|
||||
exit;
|
||||
}
|
||||
if ( is_method("ACK") ) {
|
||||
if ( t_check_trans() ) {
|
||||
# no loose-route, but stateful ACK;
|
||||
# must be an ACK after a 487
|
||||
# or e.g. 404 from upstream server
|
||||
route(RELAY);
|
||||
exit;
|
||||
} else {
|
||||
# ACK without matching transaction ... ignore and discard
|
||||
exit;
|
||||
}
|
||||
}
|
||||
sl_send_reply("404","Not here");
|
||||
exit;
|
||||
}
|
||||
|
||||
# Handle SIP registrations
|
||||
route[REGISTRAR] {
|
||||
if (!is_method("REGISTER")) return;
|
||||
|
||||
if(isflagset(FLT_NATS)) {
|
||||
setbflag(FLB_NATB);
|
||||
#!ifdef WITH_NATSIPPING
|
||||
# do SIP NAT pinging
|
||||
setbflag(FLB_NATSIPPING);
|
||||
#!endif
|
||||
}
|
||||
if (!save("location")) {
|
||||
sl_reply_error();
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
# User location service
|
||||
route[LOCATION] {
|
||||
|
||||
#!ifdef WITH_SPEEDDIAL
|
||||
# search for short dialing - 2-digit extension
|
||||
if($rU=~"^[0-9][0-9]$") {
|
||||
if(sd_lookup("speed_dial")) {
|
||||
route(SIPOUT);
|
||||
}
|
||||
}
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_ALIASDB
|
||||
# search in DB-based aliases
|
||||
if(alias_db_lookup("dbaliases")) {
|
||||
route(SIPOUT);
|
||||
}
|
||||
#!endif
|
||||
|
||||
$avp(oexten) = $rU;
|
||||
if (!lookup("location")) {
|
||||
$var(rc) = $rc;
|
||||
route(TOVOICEMAIL);
|
||||
t_newtran();
|
||||
switch ($var(rc)) {
|
||||
case -1:
|
||||
case -3:
|
||||
send_reply("404", "Not Found");
|
||||
exit;
|
||||
case -2:
|
||||
send_reply("405", "Method Not Allowed");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
# when routing via usrloc, log the missed calls also
|
||||
if (is_method("INVITE")) {
|
||||
setflag(FLT_ACCMISSED);
|
||||
}
|
||||
|
||||
route(RELAY);
|
||||
exit;
|
||||
}
|
||||
|
||||
# Presence server processing
|
||||
route[PRESENCE] {
|
||||
if(!is_method("PUBLISH|SUBSCRIBE")) return;
|
||||
|
||||
if(is_method("SUBSCRIBE") && $hdr(Event)=="message-summary") {
|
||||
route(TOVOICEMAIL);
|
||||
# returns here if no voicemail server is configured
|
||||
sl_send_reply("404", "No voicemail service");
|
||||
exit;
|
||||
}
|
||||
|
||||
#!ifdef WITH_PRESENCE
|
||||
if (!t_newtran()) {
|
||||
sl_reply_error();
|
||||
exit;
|
||||
}
|
||||
|
||||
if(is_method("PUBLISH")) {
|
||||
handle_publish();
|
||||
t_release();
|
||||
} else if(is_method("SUBSCRIBE")) {
|
||||
handle_subscribe();
|
||||
t_release();
|
||||
}
|
||||
exit;
|
||||
#!endif
|
||||
|
||||
# if presence enabled, this part will not be executed
|
||||
if (is_method("PUBLISH") || $rU==$null) {
|
||||
sl_send_reply("404", "Not here");
|
||||
exit;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
# IP authorization and user authentication
|
||||
route[AUTH] {
|
||||
#!ifdef WITH_AUTH
|
||||
|
||||
#!ifdef WITH_IPAUTH
|
||||
if((!is_method("REGISTER")) && allow_source_address()) {
|
||||
# source IP allowed
|
||||
return;
|
||||
}
|
||||
#!endif
|
||||
|
||||
if (is_method("REGISTER") || from_uri==myself) {
|
||||
# authenticate requests
|
||||
if (!auth_check("$fd", "subscriber", "1")) {
|
||||
auth_challenge("$fd", "0");
|
||||
exit;
|
||||
}
|
||||
# user authenticated - remove auth header
|
||||
if(!is_method("REGISTER|PUBLISH"))
|
||||
consume_credentials();
|
||||
}
|
||||
# if caller is not local subscriber, then check if it calls
|
||||
# a local destination, otherwise deny, not an open relay here
|
||||
if (from_uri!=myself && uri!=myself) {
|
||||
sl_send_reply("403","Not relaying");
|
||||
exit;
|
||||
}
|
||||
|
||||
#!else
|
||||
|
||||
# authentication not enabled - do not relay at all to foreign networks
|
||||
if(uri!=myself) {
|
||||
sl_send_reply("403","Not relaying");
|
||||
exit;
|
||||
}
|
||||
|
||||
#!endif
|
||||
return;
|
||||
}
|
||||
|
||||
# Caller NAT detection
|
||||
route[NATDETECT] {
|
||||
#!ifdef WITH_NAT
|
||||
force_rport();
|
||||
if (nat_uac_test("19")) {
|
||||
if (is_method("REGISTER")) {
|
||||
fix_nated_register();
|
||||
} else {
|
||||
if(is_first_hop()) {
|
||||
set_contact_alias();
|
||||
}
|
||||
}
|
||||
setflag(FLT_NATS);
|
||||
}
|
||||
#!endif
|
||||
return;
|
||||
}
|
||||
|
||||
# RTPProxy control and signaling updates for NAT traversal
|
||||
route[NATMANAGE] {
|
||||
#!ifdef WITH_NAT
|
||||
if (is_request()) {
|
||||
if(has_totag()) {
|
||||
if(check_route_param("nat=yes")) {
|
||||
setbflag(FLB_NATB);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB))) return;
|
||||
|
||||
if(nat_uac_test("8")) {
|
||||
rtpproxy_manage("co");
|
||||
} else {
|
||||
rtpproxy_manage("cor");
|
||||
}
|
||||
|
||||
if (is_request()) {
|
||||
if (!has_totag()) {
|
||||
if(t_is_branch_route()) {
|
||||
add_rr_param(";nat=yes");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_reply()) {
|
||||
if(isbflagset(FLB_NATB)) {
|
||||
if(is_first_hop())
|
||||
set_contact_alias();
|
||||
}
|
||||
}
|
||||
#!endif
|
||||
return;
|
||||
}
|
||||
|
||||
# URI update for dialog requests
|
||||
route[DLGURI] {
|
||||
#!ifdef WITH_NAT
|
||||
if(!isdsturiset()) {
|
||||
handle_ruri_alias();
|
||||
}
|
||||
#!endif
|
||||
return;
|
||||
}
|
||||
|
||||
# Routing to foreign domains
|
||||
route[SIPOUT] {
|
||||
if (uri==myself) return;
|
||||
|
||||
append_hf("P-hint: outbound\r\n");
|
||||
route(RELAY);
|
||||
exit;
|
||||
}
|
||||
|
||||
# PSTN GW routing
|
||||
route[PSTN] {
|
||||
#!ifdef WITH_PSTN
|
||||
# check if PSTN GW IP is defined
|
||||
if (strempty($sel(cfg_get.pstn.gw_ip))) {
|
||||
xlog("SCRIPT: PSTN routing enabled but pstn.gw_ip not defined\n");
|
||||
return;
|
||||
}
|
||||
|
||||
# route to PSTN dialed numbers starting with '+' or '00'
|
||||
# (international format)
|
||||
# - update the condition to match your dialing rules for PSTN routing
|
||||
if(!($rU=~"^(\+|00)[1-9][0-9]{3,20}$")) return;
|
||||
|
||||
# only local users allowed to call
|
||||
if(from_uri!=myself) {
|
||||
sl_send_reply("403", "Not Allowed");
|
||||
exit;
|
||||
}
|
||||
|
||||
# normalize target number for pstn gateway
|
||||
# - convert leading 00 to +
|
||||
if (starts_with("$rU", "00")) {
|
||||
strip(2);
|
||||
prefix("+");
|
||||
}
|
||||
|
||||
if (strempty($sel(cfg_get.pstn.gw_port))) {
|
||||
$ru = "sip:" + $rU + "@" + $sel(cfg_get.pstn.gw_ip);
|
||||
} else {
|
||||
$ru = "sip:" + $rU + "@" + $sel(cfg_get.pstn.gw_ip) + ":"
|
||||
+ $sel(cfg_get.pstn.gw_port);
|
||||
}
|
||||
|
||||
route(RELAY);
|
||||
exit;
|
||||
#!endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
# XMLRPC routing
|
||||
#!ifdef WITH_XMLRPC
|
||||
route[XMLRPC] {
|
||||
# allow XMLRPC from localhost
|
||||
if ((method=="POST" || method=="GET")
|
||||
&& (src_ip==127.0.0.1)) {
|
||||
# close connection only for xmlrpclib user agents (there is a bug in
|
||||
# xmlrpclib: it waits for EOF before interpreting the response).
|
||||
if ($hdr(User-Agent) =~ "xmlrpclib")
|
||||
set_reply_close();
|
||||
set_reply_no_connect();
|
||||
dispatch_rpc();
|
||||
exit;
|
||||
}
|
||||
send_reply("403", "Forbidden");
|
||||
exit;
|
||||
}
|
||||
#!endif
|
||||
|
||||
# Routing to voicemail server
|
||||
route[TOVOICEMAIL] {
|
||||
#!ifdef WITH_VOICEMAIL
|
||||
if(!is_method("INVITE|SUBSCRIBE")) return;
|
||||
|
||||
# check if VoiceMail server IP is defined
|
||||
if (strempty($sel(cfg_get.voicemail.srv_ip))) {
|
||||
xlog("SCRIPT: VoiceMail routing enabled but IP not defined\n");
|
||||
return;
|
||||
}
|
||||
if(is_method("INVITE")) {
|
||||
if($avp(oexten)==$null) return;
|
||||
|
||||
$ru = "sip:" + $avp(oexten) + "@" + $sel(cfg_get.voicemail.srv_ip)
|
||||
+ ":" + $sel(cfg_get.voicemail.srv_port);
|
||||
} else {
|
||||
if($rU==$null) return;
|
||||
|
||||
$ru = "sip:" + $rU + "@" + $sel(cfg_get.voicemail.srv_ip)
|
||||
+ ":" + $sel(cfg_get.voicemail.srv_port);
|
||||
}
|
||||
route(RELAY);
|
||||
exit;
|
||||
#!endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
# Manage outgoing branches
|
||||
branch_route[MANAGE_BRANCH] {
|
||||
xdbg("new branch [$T_branch_idx] to $ru\n");
|
||||
route(NATMANAGE);
|
||||
}
|
||||
|
||||
# Manage incoming replies
|
||||
onreply_route[MANAGE_REPLY] {
|
||||
xdbg("incoming reply\n");
|
||||
if(status=~"[12][0-9][0-9]") {
|
||||
route(NATMANAGE);
|
||||
}
|
||||
}
|
||||
|
||||
# Manage failure routing cases
|
||||
failure_route[MANAGE_FAILURE] {
|
||||
route(NATMANAGE);
|
||||
|
||||
if (t_is_canceled()) exit;
|
||||
|
||||
#!ifdef WITH_BLOCK3XX
|
||||
# block call redirect based on 3xx replies.
|
||||
if (t_check_status("3[0-9][0-9]")) {
|
||||
t_reply("404","Not found");
|
||||
exit;
|
||||
}
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_BLOCK401407
|
||||
# block call redirect based on 401, 407 replies.
|
||||
if (t_check_status("401|407")) {
|
||||
t_reply("404","Not found");
|
||||
exit;
|
||||
}
|
||||
#!endif
|
||||
|
||||
#!ifdef WITH_VOICEMAIL
|
||||
# serial forking
|
||||
# - route to voicemail on busy or no answer (timeout)
|
||||
if (t_check_status("486|408")) {
|
||||
$du = $null;
|
||||
route(TOVOICEMAIL);
|
||||
exit;
|
||||
}
|
||||
#!endif
|
||||
}
|
||||
162
production/kamailio/kamailio/kamctlrc
Archivo normal
162
production/kamailio/kamailio/kamctlrc
Archivo normal
@@ -0,0 +1,162 @@
|
||||
# The Kamailio configuration file for the control tools.
|
||||
#
|
||||
# Here you can set variables used in the kamctl and kamdbctl setup
|
||||
# scripts. Per default all variables here are commented out, the control tools
|
||||
# will use their internal default values.
|
||||
|
||||
## your SIP domain
|
||||
SIP_DOMAIN=hatthieves.es
|
||||
|
||||
## chrooted directory
|
||||
# $CHROOT_DIR="/path/to/chrooted/directory"
|
||||
|
||||
## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, DBTEXT, or SQLITE
|
||||
# by default none is loaded
|
||||
#
|
||||
# If you want to setup a database with kamdbctl, you must at least specify
|
||||
# this parameter.
|
||||
DBENGINE=SQLITE
|
||||
|
||||
## database host
|
||||
# DBHOST=localhost
|
||||
|
||||
## database host
|
||||
# DBPORT=3306
|
||||
|
||||
## database name (for ORACLE this is TNS name)
|
||||
# DBNAME=kamailio
|
||||
|
||||
# database path used by dbtext, db_berkeley or sqlite
|
||||
DB_PATH="/etc/kamailio/kamailio.sqlite"
|
||||
|
||||
## database read/write user
|
||||
# DBRWUSER="kamailio"
|
||||
|
||||
## password for database read/write user
|
||||
# DBRWPW="kamailiorw"
|
||||
|
||||
## database read only user
|
||||
# DBROUSER="kamailioro"
|
||||
|
||||
## password for database read only user
|
||||
# DBROPW="kamailioro"
|
||||
|
||||
## database access host (from where is kamctl used)
|
||||
# DBACCESSHOST=192.168.0.1
|
||||
|
||||
## database super user (for ORACLE this is 'scheme-creator' user)
|
||||
# DBROOTUSER="root"
|
||||
|
||||
## password for database super user
|
||||
## - important: this is insecure, targeting the use only for automatic testing
|
||||
## - known to work for: mysql
|
||||
# DBROOTPW="dbrootpw"
|
||||
|
||||
## database character set (used by MySQL when creating database)
|
||||
#CHARSET="latin1"
|
||||
|
||||
## user name column
|
||||
# USERCOL="username"
|
||||
|
||||
|
||||
# SQL definitions
|
||||
# If you change this definitions here, then you must change them
|
||||
# in db/schema/entities.xml too.
|
||||
# FIXME
|
||||
|
||||
# FOREVER="2030-05-28 21:32:15"
|
||||
# DEFAULT_Q="1.0"
|
||||
|
||||
|
||||
# Program to calculate a message-digest fingerprint
|
||||
# MD5="md5sum"
|
||||
|
||||
# awk tool
|
||||
# AWK="awk"
|
||||
|
||||
# gdb tool
|
||||
# GDB="gdb"
|
||||
|
||||
# If you use a system with a grep and egrep that is not 100% gnu grep compatible,
|
||||
# e.g. solaris, install the gnu grep (ggrep) and specify this below.
|
||||
#
|
||||
# grep tool
|
||||
# GREP="grep"
|
||||
|
||||
# egrep tool
|
||||
# EGREP="egrep"
|
||||
|
||||
# sed tool
|
||||
# SED="sed"
|
||||
|
||||
# tail tool
|
||||
# LAST_LINE="tail -n 1"
|
||||
|
||||
# expr tool
|
||||
# EXPR="expr"
|
||||
|
||||
|
||||
# Describe what additional tables to install. Valid values for the variables
|
||||
# below are yes/no/ask. With ask (default) it will interactively ask the user
|
||||
# for an answer, while yes/no allow for automated, unassisted installs.
|
||||
#
|
||||
|
||||
# If to install tables for the modules in the EXTRA_MODULES variable.
|
||||
# INSTALL_EXTRA_TABLES=ask
|
||||
|
||||
# If to install presence related tables.
|
||||
# INSTALL_PRESENCE_TABLES=ask
|
||||
|
||||
# If to install uid modules related tables.
|
||||
# INSTALL_DBUID_TABLES=ask
|
||||
|
||||
# Define what module tables should be installed.
|
||||
# If you use the postgres database and want to change the installed tables, then you
|
||||
# must also adjust the STANDARD_TABLES or EXTRA_TABLES variable accordingly in the
|
||||
# kamdbctl.base script.
|
||||
|
||||
# Kamailio standard modules
|
||||
# STANDARD_MODULES="standard acc lcr domain group permissions registrar usrloc msilo
|
||||
# alias_db uri_db speeddial avpops auth_db pdt dialog dispatcher
|
||||
# dialplan"
|
||||
|
||||
# Kamailio extra modules
|
||||
# EXTRA_MODULES="imc cpl siptrace domainpolicy carrierroute userblacklist htable purple sca"
|
||||
|
||||
|
||||
## type of aliases used: DB - database aliases; UL - usrloc aliases
|
||||
## - default: none
|
||||
# ALIASES_TYPE="DB"
|
||||
|
||||
## control engine: RPCFIFO
|
||||
## - default RPCFIFO
|
||||
# CTLENGINE="RPCFIFO"
|
||||
|
||||
## path to FIFO file for engine RPCFIFO
|
||||
# RPCFIFOPATH="/var/run/kamailio/kamailio_rpc_fifo"
|
||||
|
||||
## check ACL names; default on (1); off (0)
|
||||
# VERIFY_ACL=1
|
||||
|
||||
## ACL names - if VERIFY_ACL is set, only the ACL names from below list
|
||||
## are accepted
|
||||
# ACL_GROUPS="local ld int voicemail free-pstn"
|
||||
|
||||
## check if user exists (used by some commands such as acl);
|
||||
## - default on (1); off (0)
|
||||
# VERIFY_USER=1
|
||||
|
||||
## verbose - debug purposes - default '0'
|
||||
# VERBOSE=1
|
||||
|
||||
## do (1) or don't (0) store plaintext passwords
|
||||
## in the subscriber table - default '1'
|
||||
STORE_PLAINTEXT_PW=0
|
||||
|
||||
## Kamailio START Options
|
||||
## PID file path - default is: /var/run/kamailio/kamailio.pid
|
||||
# PID_FILE=/var/run/kamailio/kamailio.pid
|
||||
|
||||
## Extra start options - default is: not set
|
||||
# example: start Kamailio with 64MB share memory: STARTOPTIONS="-m 64"
|
||||
# STARTOPTIONS=
|
||||
162
production/kamailio/kamailio/kamctlrc.BAK
Archivo normal
162
production/kamailio/kamailio/kamctlrc.BAK
Archivo normal
@@ -0,0 +1,162 @@
|
||||
# The Kamailio configuration file for the control tools.
|
||||
#
|
||||
# Here you can set variables used in the kamctl and kamdbctl setup
|
||||
# scripts. Per default all variables here are commented out, the control tools
|
||||
# will use their internal default values.
|
||||
|
||||
## your SIP domain
|
||||
# SIP_DOMAIN=kamailio.org
|
||||
|
||||
## chrooted directory
|
||||
# $CHROOT_DIR="/path/to/chrooted/directory"
|
||||
|
||||
## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, DBTEXT, or SQLITE
|
||||
# by default none is loaded
|
||||
#
|
||||
# If you want to setup a database with kamdbctl, you must at least specify
|
||||
# this parameter.
|
||||
# DBENGINE=MYSQL
|
||||
|
||||
## database host
|
||||
# DBHOST=localhost
|
||||
|
||||
## database host
|
||||
# DBPORT=3306
|
||||
|
||||
## database name (for ORACLE this is TNS name)
|
||||
# DBNAME=kamailio
|
||||
|
||||
# database path used by dbtext, db_berkeley or sqlite
|
||||
# DB_PATH="/usr/local/etc/kamailio/dbtext"
|
||||
|
||||
## database read/write user
|
||||
# DBRWUSER="kamailio"
|
||||
|
||||
## password for database read/write user
|
||||
# DBRWPW="kamailiorw"
|
||||
|
||||
## database read only user
|
||||
# DBROUSER="kamailioro"
|
||||
|
||||
## password for database read only user
|
||||
# DBROPW="kamailioro"
|
||||
|
||||
## database access host (from where is kamctl used)
|
||||
# DBACCESSHOST=192.168.0.1
|
||||
|
||||
## database super user (for ORACLE this is 'scheme-creator' user)
|
||||
# DBROOTUSER="root"
|
||||
|
||||
## password for database super user
|
||||
## - important: this is insecure, targeting the use only for automatic testing
|
||||
## - known to work for: mysql
|
||||
# DBROOTPW="dbrootpw"
|
||||
|
||||
## database character set (used by MySQL when creating database)
|
||||
#CHARSET="latin1"
|
||||
|
||||
## user name column
|
||||
# USERCOL="username"
|
||||
|
||||
|
||||
# SQL definitions
|
||||
# If you change this definitions here, then you must change them
|
||||
# in db/schema/entities.xml too.
|
||||
# FIXME
|
||||
|
||||
# FOREVER="2030-05-28 21:32:15"
|
||||
# DEFAULT_Q="1.0"
|
||||
|
||||
|
||||
# Program to calculate a message-digest fingerprint
|
||||
# MD5="md5sum"
|
||||
|
||||
# awk tool
|
||||
# AWK="awk"
|
||||
|
||||
# gdb tool
|
||||
# GDB="gdb"
|
||||
|
||||
# If you use a system with a grep and egrep that is not 100% gnu grep compatible,
|
||||
# e.g. solaris, install the gnu grep (ggrep) and specify this below.
|
||||
#
|
||||
# grep tool
|
||||
# GREP="grep"
|
||||
|
||||
# egrep tool
|
||||
# EGREP="egrep"
|
||||
|
||||
# sed tool
|
||||
# SED="sed"
|
||||
|
||||
# tail tool
|
||||
# LAST_LINE="tail -n 1"
|
||||
|
||||
# expr tool
|
||||
# EXPR="expr"
|
||||
|
||||
|
||||
# Describe what additional tables to install. Valid values for the variables
|
||||
# below are yes/no/ask. With ask (default) it will interactively ask the user
|
||||
# for an answer, while yes/no allow for automated, unassisted installs.
|
||||
#
|
||||
|
||||
# If to install tables for the modules in the EXTRA_MODULES variable.
|
||||
# INSTALL_EXTRA_TABLES=ask
|
||||
|
||||
# If to install presence related tables.
|
||||
# INSTALL_PRESENCE_TABLES=ask
|
||||
|
||||
# If to install uid modules related tables.
|
||||
# INSTALL_DBUID_TABLES=ask
|
||||
|
||||
# Define what module tables should be installed.
|
||||
# If you use the postgres database and want to change the installed tables, then you
|
||||
# must also adjust the STANDARD_TABLES or EXTRA_TABLES variable accordingly in the
|
||||
# kamdbctl.base script.
|
||||
|
||||
# Kamailio standard modules
|
||||
# STANDARD_MODULES="standard acc lcr domain group permissions registrar usrloc msilo
|
||||
# alias_db uri_db speeddial avpops auth_db pdt dialog dispatcher
|
||||
# dialplan"
|
||||
|
||||
# Kamailio extra modules
|
||||
# EXTRA_MODULES="imc cpl siptrace domainpolicy carrierroute userblacklist htable purple sca"
|
||||
|
||||
|
||||
## type of aliases used: DB - database aliases; UL - usrloc aliases
|
||||
## - default: none
|
||||
# ALIASES_TYPE="DB"
|
||||
|
||||
## control engine: RPCFIFO
|
||||
## - default RPCFIFO
|
||||
# CTLENGINE="RPCFIFO"
|
||||
|
||||
## path to FIFO file for engine RPCFIFO
|
||||
# RPCFIFOPATH="/var/run/kamailio/kamailio_rpc_fifo"
|
||||
|
||||
## check ACL names; default on (1); off (0)
|
||||
# VERIFY_ACL=1
|
||||
|
||||
## ACL names - if VERIFY_ACL is set, only the ACL names from below list
|
||||
## are accepted
|
||||
# ACL_GROUPS="local ld int voicemail free-pstn"
|
||||
|
||||
## check if user exists (used by some commands such as acl);
|
||||
## - default on (1); off (0)
|
||||
# VERIFY_USER=1
|
||||
|
||||
## verbose - debug purposes - default '0'
|
||||
# VERBOSE=1
|
||||
|
||||
## do (1) or don't (0) store plaintext passwords
|
||||
## in the subscriber table - default '1'
|
||||
# STORE_PLAINTEXT_PW=0
|
||||
|
||||
## Kamailio START Options
|
||||
## PID file path - default is: /var/run/kamailio/kamailio.pid
|
||||
# PID_FILE=/var/run/kamailio/kamailio.pid
|
||||
|
||||
## Extra start options - default is: not set
|
||||
# example: start Kamailio with 64MB share memory: STARTOPTIONS="-m 64"
|
||||
# STARTOPTIONS=
|
||||
324
production/kamailio/kamailio/pi_framework.xml
Archivo normal
324
production/kamailio/kamailio/pi_framework.xml
Archivo normal
@@ -0,0 +1,324 @@
|
||||
<?xml version="1.0"?>
|
||||
<framework>
|
||||
<!-- Declare all db connections
|
||||
Each db connection MUST have:
|
||||
- an "id" to be identified by a tabe
|
||||
- a URL pointing to the actual database
|
||||
Supported databases:
|
||||
* berkeley
|
||||
* cassandra
|
||||
* cluster
|
||||
* flatstore
|
||||
* mysql
|
||||
* oracle
|
||||
* postgres
|
||||
* sqlite
|
||||
* text
|
||||
* unixodbc
|
||||
-->
|
||||
<db_url id="mysql">mysql://kamailio:kamailiorw@localhost/kamailio</db_url>
|
||||
<!--
|
||||
<db_url id="dbtext">text:///usr/local/etc/kamailio/dbtext</db_url>
|
||||
-->
|
||||
<!-- Declare all tables
|
||||
Each table MUST have:
|
||||
- an "id" to be identified by a command
|
||||
- a "table_name" pointing to the actual table name in the database
|
||||
- a "db_url_id" to identify the db connection
|
||||
- multiple "column" nodes with "field"i, "validation" and "type":
|
||||
/* type */
|
||||
DB1_INT, /**< represents an 32 bit integer number */
|
||||
DB1_BIGINT, /**< represents an 64 bit integer number */
|
||||
DB1_DOUBLE, /**< represents a floating point number */
|
||||
DB1_STRING, /**< represents a zero terminated const char* */
|
||||
DB1_STR, /**< represents a string of 'str' type */
|
||||
DB1_DATETIME, /**< represents date and time */
|
||||
DB1_BLOB, /**< represents a large binary object */
|
||||
DB1_BITMAP /**< an one-dimensional array of 32 flags */
|
||||
/* validation */
|
||||
P_HOST_PORT /**< represents [proto:]host[:port] */
|
||||
P_IPV4_PORT /**< represents [proto:]IPv4[:port] */
|
||||
IPV4 /**< represents an IPv4 */
|
||||
URI /**< represents a SIP URI */
|
||||
URI_IPV4HOST /**< represents a SIP URI w/ IPv4 as host */
|
||||
-->
|
||||
<db_table id="dispatcher"><table_name>dispatcher</table_name>
|
||||
<db_url_id>mysql</db_url_id>
|
||||
<column><field>id</field> <type>DB1_INT</type></column>
|
||||
<column><field>setid</field> <type>DB1_INT</type></column>
|
||||
<column><field>destination</field> <type>DB1_STR</type>
|
||||
<validate>URI_IPV4HOST</validate></column>
|
||||
<column><field>flags</field> <type>DB1_INT</type></column>
|
||||
<column><field>priority</field> <type>DB1_INT</type></column>
|
||||
<column><field>attrs</field> <type>DB1_STR</type></column>
|
||||
<column><field>description</field> <type>DB1_STR</type></column>
|
||||
</db_table>
|
||||
<db_table id="dialplan"><table_name>dialplan</table_name>
|
||||
<db_url_id>mysql</db_url_id>
|
||||
<column><field>id</field> <type>DB1_INT</type></column>
|
||||
<column><field>dpid</field> <type>DB1_INT</type></column>
|
||||
<column><field>pr</field> <type>DB1_INT</type></column>
|
||||
<column><field>match_op</field> <type>DB1_INT</type></column>
|
||||
<column><field>match_exp</field> <type>DB1_STR</type></column>
|
||||
<column><field>match_len</field> <type>DB1_INT</type></column>
|
||||
<column><field>subst_exp</field> <type>DB1_STR</type></column>
|
||||
<column><field>repl_exp</field> <type>DB1_STR</type></column>
|
||||
<column><field>attrs</field> <type>DB1_STRING</type></column>
|
||||
</db_table>
|
||||
<!-- Declare all mod
|
||||
Each mod must have:
|
||||
- a "mod_name"
|
||||
- at least one "cmd"
|
||||
Each cmd must have:
|
||||
- a "cmd_name"
|
||||
- a "db_table_id"
|
||||
- a "cmd_type": c q o
|
||||
DB1_QUERY ov m o
|
||||
DB1_INSERT - mv -
|
||||
DB1_DELETE mv - -
|
||||
DB1_UPDATE ov mv -
|
||||
DB1_REPLACE - mv -
|
||||
Clause cols can have the following operators:
|
||||
- "<" <
|
||||
- ">" >
|
||||
- "=" =
|
||||
- "<=" <=
|
||||
- ">=" >=
|
||||
- "!=" !=
|
||||
-->
|
||||
<!-- dispatcher provisioning -->
|
||||
<mod> <mod_name>dispatcher</mod_name>
|
||||
<cmd> <cmd_name>show_destinations_with_small_setid</cmd_name>
|
||||
<db_table_id>dispatcher</db_table_id>
|
||||
<cmd_type>DB1_QUERY</cmd_type>
|
||||
<clause_cols>
|
||||
<col><field>setid</field><operator><</operator></col>
|
||||
</clause_cols>
|
||||
<query_cols>
|
||||
<col><field>id</field></col>
|
||||
<col><field>setid</field></col>
|
||||
<col><field>destination</field></col>
|
||||
<col><field>description</field></col>
|
||||
</query_cols>
|
||||
</cmd>
|
||||
<cmd> <cmd_name>show_all</cmd_name>
|
||||
<db_table_id>dispatcher</db_table_id>
|
||||
<cmd_type>DB1_QUERY</cmd_type>
|
||||
<query_cols>
|
||||
<col><field>id</field></col>
|
||||
<col><field>setid</field></col>
|
||||
<col><field>destination</field></col>
|
||||
<col><field>flags</field></col>
|
||||
<col><field>priority</field></col>
|
||||
<col><field>attrs</field></col>
|
||||
<col><field>description</field></col>
|
||||
</query_cols>
|
||||
</cmd>
|
||||
<cmd> <cmd_name>update_setid</cmd_name>
|
||||
<db_table_id>dispatcher</db_table_id>
|
||||
<cmd_type>DB1_UPDATE</cmd_type>
|
||||
<clause_cols>
|
||||
<col><field>id</field><operator>=</operator></col>
|
||||
</clause_cols>
|
||||
<query_cols>
|
||||
<col><field>setid</field></col>
|
||||
</query_cols>
|
||||
</cmd>
|
||||
<cmd> <cmd_name>update_destination</cmd_name>
|
||||
<db_table_id>dispatcher</db_table_id>
|
||||
<cmd_type>DB1_UPDATE</cmd_type>
|
||||
<clause_cols>
|
||||
<col><field>id</field><operator>=</operator></col>
|
||||
</clause_cols>
|
||||
<query_cols>
|
||||
<col><field>destination</field></col>
|
||||
</query_cols>
|
||||
</cmd>
|
||||
<cmd> <cmd_name>update_attr</cmd_name>
|
||||
<db_table_id>dispatcher</db_table_id>
|
||||
<cmd_type>DB1_UPDATE</cmd_type>
|
||||
<clause_cols>
|
||||
<col><field>id</field><operator>=</operator></col>
|
||||
</clause_cols>
|
||||
<query_cols>
|
||||
<col><field>attrs</field></col>
|
||||
</query_cols>
|
||||
</cmd>
|
||||
<cmd> <cmd_name>update_description</cmd_name>
|
||||
<db_table_id>dispatcher</db_table_id>
|
||||
<cmd_type>DB1_UPDATE</cmd_type>
|
||||
<clause_cols>
|
||||
<col><field>id</field><operator>=</operator></col>
|
||||
</clause_cols>
|
||||
<query_cols>
|
||||
<col><field>description</field></col>
|
||||
</query_cols>
|
||||
</cmd>
|
||||
<cmd> <cmd_name>add_gw</cmd_name>
|
||||
<db_table_id>dispatcher</db_table_id>
|
||||
<cmd_type>DB1_INSERT</cmd_type>
|
||||
<query_cols>
|
||||
<col><field>setid</field></col>
|
||||
<col><field>destination</field></col>
|
||||
<!--<col><field>flags</field></col>-->
|
||||
<col><field>priority</field></col>
|
||||
<col><field>attrs</field></col>
|
||||
<col><field>description</field></col>
|
||||
</query_cols>
|
||||
</cmd>
|
||||
<cmd> <cmd_name>add_server_with_setid_100</cmd_name>
|
||||
<db_table_id>dispatcher</db_table_id>
|
||||
<cmd_type>DB1_INSERT</cmd_type>
|
||||
<query_cols>
|
||||
<col><field>setid</field>
|
||||
<value id="100">100</value>
|
||||
</col>
|
||||
<col><field>destination</field></col>
|
||||
<!--<col><field>flags</field></col>-->
|
||||
<col><field>priority</field></col>
|
||||
<col><field>attrs</field></col>
|
||||
<col><field>description</field></col>
|
||||
</query_cols>
|
||||
</cmd>
|
||||
<cmd> <cmd_name>delete_by_id</cmd_name>
|
||||
<db_table_id>dispatcher</db_table_id>
|
||||
<cmd_type>DB1_DELETE</cmd_type>
|
||||
<clause_cols>
|
||||
<col><field>id</field><operator>=</operator></col>
|
||||
</clause_cols>
|
||||
</cmd>
|
||||
</mod>
|
||||
|
||||
<!-- dialplan provisioning -->
|
||||
<mod> <mod_name>dialplan</mod_name>
|
||||
<cmd> <cmd_name>show_all</cmd_name>
|
||||
<db_table_id>dialplan</db_table_id>
|
||||
<cmd_type>DB1_QUERY</cmd_type>
|
||||
<query_cols>
|
||||
<col><field>id</field></col>
|
||||
<col><field>dpid</field></col>
|
||||
<col><field>pr</field></col>
|
||||
<col><field>match_op</field></col>
|
||||
<col><field>match_exp</field></col>
|
||||
<!--<col><field>match_len</field></col>-->
|
||||
<col><field>subst_exp</field></col>
|
||||
<col><field>repl_exp</field></col>
|
||||
<col><field>attrs</field></col>
|
||||
</query_cols>
|
||||
<order_by_cols><col><field>id</field></col></order_by_cols>
|
||||
</cmd>
|
||||
<cmd> <cmd_name>show_dpid</cmd_name>
|
||||
<db_table_id>dialplan</db_table_id>
|
||||
<cmd_type>DB1_QUERY</cmd_type>
|
||||
<clause_cols>
|
||||
<col><field>dpid</field><operator>=</operator></col>
|
||||
</clause_cols>
|
||||
<query_cols>
|
||||
<col><field>id</field></col>
|
||||
<col><field>dpid</field></col>
|
||||
<col><field>pr</field></col>
|
||||
<col><field>match_op</field></col>
|
||||
<col><field>match_exp</field></col>
|
||||
<col><field>match_len</field></col>
|
||||
<col><field>subst_exp</field></col>
|
||||
<col><field>repl_exp</field></col>
|
||||
<col><field>attrs</field></col>
|
||||
</query_cols>
|
||||
<order_by_cols><col><field>id</field></col></order_by_cols>
|
||||
</cmd>
|
||||
<cmd> <cmd_name>show_exact_matching</cmd_name>
|
||||
<db_table_id>dialplan</db_table_id>
|
||||
<cmd_type>DB1_QUERY</cmd_type>
|
||||
<clause_cols>
|
||||
<col><field>match_op</field><operator>=</operator>
|
||||
<value id="equal">0</value></col>
|
||||
</clause_cols>
|
||||
<query_cols>
|
||||
<col><field>id</field></col>
|
||||
<col><field>dpid</field></col>
|
||||
<col><field>pr</field></col>
|
||||
<col><field>match_op</field></col>
|
||||
<col><field>match_exp</field></col>
|
||||
<col><field>match_len</field></col>
|
||||
<col><field>subst_exp</field></col>
|
||||
<col><field>repl_exp</field></col>
|
||||
<col><field>attrs</field></col>
|
||||
</query_cols>
|
||||
</cmd>
|
||||
<cmd> <cmd_name>show_regex_matching</cmd_name>
|
||||
<db_table_id>dialplan</db_table_id>
|
||||
<cmd_type>DB1_QUERY</cmd_type>
|
||||
<clause_cols>
|
||||
<col><field>match_op</field><operator>=</operator>
|
||||
<value id="regex">1</value></col>
|
||||
</clause_cols>
|
||||
<query_cols>
|
||||
<col><field>id</field></col>
|
||||
<col><field>dpid</field></col>
|
||||
<col><field>pr</field></col>
|
||||
<col><field>match_op</field></col>
|
||||
<col><field>match_exp</field></col>
|
||||
<col><field>match_len</field></col>
|
||||
<col><field>subst_exp</field></col>
|
||||
<col><field>repl_exp</field></col>
|
||||
<col><field>attrs</field></col>
|
||||
</query_cols>
|
||||
</cmd>
|
||||
<cmd> <cmd_name>add</cmd_name>
|
||||
<db_table_id>dialplan</db_table_id>
|
||||
<cmd_type>DB1_INSERT</cmd_type>
|
||||
<query_cols>
|
||||
<col><field>dpid</field></col>
|
||||
<col><field>pr</field></col>
|
||||
<col><field>match_op</field>
|
||||
<value id="equal">0</value>
|
||||
<value id="regexp">1</value>
|
||||
</col>
|
||||
<col><field>match_exp</field></col>
|
||||
<col><field>match_len</field></col>
|
||||
<col><field>attrs</field></col>
|
||||
</query_cols>
|
||||
</cmd>
|
||||
<cmd> <cmd_name>delete</cmd_name>
|
||||
<db_table_id>dialplan</db_table_id>
|
||||
<cmd_type>DB1_DELETE</cmd_type>
|
||||
<clause_cols>
|
||||
<col><field>id</field><operator>=</operator></col>
|
||||
</clause_cols>
|
||||
</cmd>
|
||||
<cmd> <cmd_name>update_attr</cmd_name>
|
||||
<db_table_id>dialplan</db_table_id>
|
||||
<cmd_type>DB1_UPDATE</cmd_type>
|
||||
<clause_cols>
|
||||
<col><field>id</field><operator>=</operator></col>
|
||||
</clause_cols>
|
||||
<query_cols>
|
||||
<col><field>attrs</field></col>
|
||||
</query_cols>
|
||||
</cmd>
|
||||
<cmd> <cmd_name>update_repl_exp</cmd_name>
|
||||
<db_table_id>dialplan</db_table_id>
|
||||
<cmd_type>DB1_UPDATE</cmd_type>
|
||||
<clause_cols>
|
||||
<col><field>id</field><operator>=</operator></col>
|
||||
</clause_cols>
|
||||
<query_cols>
|
||||
<col><field>repl_exp</field></col>
|
||||
</query_cols>
|
||||
</cmd>
|
||||
<cmd> <cmd_name>replace</cmd_name>
|
||||
<db_table_id>dialplan</db_table_id>
|
||||
<cmd_type>DB1_REPLACE</cmd_type>
|
||||
<query_cols>
|
||||
<col><field>dpid</field></col>
|
||||
<col><field>pr</field></col>
|
||||
<col><field>match_op</field></col>
|
||||
<col><field>match_exp</field></col>
|
||||
<col><field>match_len</field></col>
|
||||
<col><field>subst_exp</field></col>
|
||||
<col><field>repl_exp</field></col>
|
||||
<col><field>attrs</field></col>
|
||||
</query_cols>
|
||||
</cmd>
|
||||
</mod>
|
||||
</framework>
|
||||
9
production/kamailio/kamailio/rtpproxy
Archivo normal
9
production/kamailio/kamailio/rtpproxy
Archivo normal
@@ -0,0 +1,9 @@
|
||||
# Defaults for rtpproxy
|
||||
|
||||
# The control socket.
|
||||
CONTROL_SOCK="unix:/var/run/rtpproxy/rtpproxy.sock"
|
||||
# To listen on an UDP socket, uncomment this line:
|
||||
#CONTROL_SOCK=udp:127.0.0.1:7722
|
||||
|
||||
# Additional options that are passed to the daemon.
|
||||
EXTRA_OPTS="-l 82.223.3.135 -m 35000 -M 35400 -d INFO"
|
||||
107
production/kamailio/kamailio/tls.cfg
Archivo normal
107
production/kamailio/kamailio/tls.cfg
Archivo normal
@@ -0,0 +1,107 @@
|
||||
#
|
||||
# Example Kamailio TLS Configuration File
|
||||
#
|
||||
|
||||
# ---
|
||||
# This is the default server domain profile.
|
||||
# Settings in this domain will be used for all incoming
|
||||
# connections that do not match any other server
|
||||
# domain in this configuration file.
|
||||
#
|
||||
# We do not enable anything else than TLSv1
|
||||
# over the public internet. Clients do not have
|
||||
# to present client certificates by default.
|
||||
#
|
||||
[server:default]
|
||||
method = TLSv1
|
||||
verify_certificate = no
|
||||
require_certificate = no
|
||||
private_key = /etc/kamailio/kamailio.key
|
||||
certificate = /etc/kamailio/kamailio.pem
|
||||
server_name = hatthieves.es
|
||||
#ca_list = /etc/kamailio/tls/cacert.pem
|
||||
#crl = /etc/kamailio/tls/crl.pem
|
||||
|
||||
# ---
|
||||
# This is the default client domain profile.
|
||||
# Settings in this domain will be used for all outgoing
|
||||
# TLS connections that do not match any other
|
||||
# client domain in this configuration file.
|
||||
# We require that servers present valid certificate.
|
||||
#
|
||||
[client:default]
|
||||
#method = TLSv1
|
||||
verify_certificate = no
|
||||
require_certificate = no
|
||||
|
||||
# ---
|
||||
# This is an example server domain for TLS connections
|
||||
# received from the loopback interface. We allow
|
||||
# the use of TLSv1 protocols here, we do
|
||||
# not require that clients present client certificates
|
||||
# but if they present it it must be valid. We also use
|
||||
# a special certificate and CA list for loopback
|
||||
# interface.
|
||||
#
|
||||
#[server:5.6.7.8:5061]
|
||||
#method = TLSv1
|
||||
#verify_certificate = yes
|
||||
#require_certificate = no
|
||||
#private_key = /etc/kamailio/tls/local_key.pem
|
||||
#certificate = /etc/kamailio/tls/local_cert.pem
|
||||
#verify_depth = 3
|
||||
#ca_list = /etc/kamailio/tls/local_ca.pem
|
||||
#crl = /etc/kamailio/tls/local_crl.pem
|
||||
#server_name = kamailio.org
|
||||
#server_id = kamailio.org
|
||||
|
||||
# ---
|
||||
# Special settings for connecting to the example.sip (1.2.3.4)
|
||||
# public SIP server. We do not verify the certificate of the
|
||||
# server because it can be expired. The server
|
||||
# implements authentication using SSL client
|
||||
# certificates so configure the client certificate
|
||||
# that was given to use by iptel.org staff here.
|
||||
#
|
||||
#[client:1.2.3.4:5061]
|
||||
#verify_certificate = no
|
||||
#private_key = /etc/kamailio/tls/example_key.pem
|
||||
#certificate = /etc/kamailio/tls/example_cert.pem
|
||||
#ca_list = /etc/kamailio/tls/example_ca.pem
|
||||
#crl = /etc/kamailio/tls/example_crl.pem
|
||||
#server_name = example.sip
|
||||
#server_id = example.sip
|
||||
|
||||
# ---
|
||||
# Example server profile for listening on any ip/port
|
||||
# - it requires to have 'server_name' to match on SNI (domain and subdomains)
|
||||
#
|
||||
#[server:any]
|
||||
#method = TLSv1
|
||||
#verify_certificate = yes
|
||||
#require_certificate = no
|
||||
#private_key = /etc/kamailio/tls/mysipserver_org_key.pem
|
||||
#certificate = /etc/kamailio/tls/mysipserver_org_cert.pem
|
||||
#verify_depth = 3
|
||||
#ca_list = /etc/kamailio/tls/mysipserver_org_ca.pem
|
||||
#crl = /etc/kamailio/tls/mysipserver_org_crl.pem
|
||||
#server_name = mysipserver.org
|
||||
#server_name_mode = 1
|
||||
#server_id = mysipserver.org
|
||||
|
||||
# ---
|
||||
# Example server profile for listening on any ip/port
|
||||
# - it requires to have 'server_name' to match on SNI (only subdomains)
|
||||
#
|
||||
#[server:any]
|
||||
#method = TLSv1
|
||||
#verify_certificate = yes
|
||||
#require_certificate = no
|
||||
#private_key = /etc/kamailio/tls/mysipserver_net_key.pem
|
||||
#certificate = /etc/kamailio/tls/mysipserver_net_cert.pem
|
||||
#verify_depth = 3
|
||||
#ca_list = /etc/kamailio/tls/mysipserver_net_ca.pem
|
||||
#crl = /etc/kamailio/tls/mysipserver_net_crl.pem
|
||||
#server_name = mysipserver.net
|
||||
#server_name_mode = 2
|
||||
#server_id = mysipserver.net
|
||||
106
production/kamailio/kamailio/tls.cfg.BAK
Archivo normal
106
production/kamailio/kamailio/tls.cfg.BAK
Archivo normal
@@ -0,0 +1,106 @@
|
||||
#
|
||||
# Example Kamailio TLS Configuration File
|
||||
#
|
||||
|
||||
# ---
|
||||
# This is the default server domain profile.
|
||||
# Settings in this domain will be used for all incoming
|
||||
# connections that do not match any other server
|
||||
# domain in this configuration file.
|
||||
#
|
||||
# We do not enable anything else than TLSv1
|
||||
# over the public internet. Clients do not have
|
||||
# to present client certificates by default.
|
||||
#
|
||||
[server:default]
|
||||
method = TLSv1
|
||||
verify_certificate = no
|
||||
require_certificate = no
|
||||
private_key = /etc/kamailio/kamailio-selfsigned.key
|
||||
certificate = /etc/kamailio/kamailio-selfsigned.pem
|
||||
#ca_list = /etc/kamailio/tls/cacert.pem
|
||||
#crl = /etc/kamailio/tls/crl.pem
|
||||
|
||||
# ---
|
||||
# This is the default client domain profile.
|
||||
# Settings in this domain will be used for all outgoing
|
||||
# TLS connections that do not match any other
|
||||
# client domain in this configuration file.
|
||||
# We require that servers present valid certificate.
|
||||
#
|
||||
[client:default]
|
||||
#method = TLSv1
|
||||
verify_certificate = yes
|
||||
require_certificate = yes
|
||||
|
||||
# ---
|
||||
# This is an example server domain for TLS connections
|
||||
# received from the loopback interface. We allow
|
||||
# the use of TLSv1 protocols here, we do
|
||||
# not require that clients present client certificates
|
||||
# but if they present it it must be valid. We also use
|
||||
# a special certificate and CA list for loopback
|
||||
# interface.
|
||||
#
|
||||
#[server:5.6.7.8:5061]
|
||||
#method = TLSv1
|
||||
#verify_certificate = yes
|
||||
#require_certificate = no
|
||||
#private_key = /etc/kamailio/tls/local_key.pem
|
||||
#certificate = /etc/kamailio/tls/local_cert.pem
|
||||
#verify_depth = 3
|
||||
#ca_list = /etc/kamailio/tls/local_ca.pem
|
||||
#crl = /etc/kamailio/tls/local_crl.pem
|
||||
#server_name = kamailio.org
|
||||
#server_id = kamailio.org
|
||||
|
||||
# ---
|
||||
# Special settings for connecting to the example.sip (1.2.3.4)
|
||||
# public SIP server. We do not verify the certificate of the
|
||||
# server because it can be expired. The server
|
||||
# implements authentication using SSL client
|
||||
# certificates so configure the client certificate
|
||||
# that was given to use by iptel.org staff here.
|
||||
#
|
||||
#[client:1.2.3.4:5061]
|
||||
#verify_certificate = no
|
||||
#private_key = /etc/kamailio/tls/example_key.pem
|
||||
#certificate = /etc/kamailio/tls/example_cert.pem
|
||||
#ca_list = /etc/kamailio/tls/example_ca.pem
|
||||
#crl = /etc/kamailio/tls/example_crl.pem
|
||||
#server_name = example.sip
|
||||
#server_id = example.sip
|
||||
|
||||
# ---
|
||||
# Example server profile for listening on any ip/port
|
||||
# - it requires to have 'server_name' to match on SNI (domain and subdomains)
|
||||
#
|
||||
#[server:any]
|
||||
#method = TLSv1
|
||||
#verify_certificate = yes
|
||||
#require_certificate = no
|
||||
#private_key = /etc/kamailio/tls/mysipserver_org_key.pem
|
||||
#certificate = /etc/kamailio/tls/mysipserver_org_cert.pem
|
||||
#verify_depth = 3
|
||||
#ca_list = /etc/kamailio/tls/mysipserver_org_ca.pem
|
||||
#crl = /etc/kamailio/tls/mysipserver_org_crl.pem
|
||||
#server_name = mysipserver.org
|
||||
#server_name_mode = 1
|
||||
#server_id = mysipserver.org
|
||||
|
||||
# ---
|
||||
# Example server profile for listening on any ip/port
|
||||
# - it requires to have 'server_name' to match on SNI (only subdomains)
|
||||
#
|
||||
#[server:any]
|
||||
#method = TLSv1
|
||||
#verify_certificate = yes
|
||||
#require_certificate = no
|
||||
#private_key = /etc/kamailio/tls/mysipserver_net_key.pem
|
||||
#certificate = /etc/kamailio/tls/mysipserver_net_cert.pem
|
||||
#verify_depth = 3
|
||||
#ca_list = /etc/kamailio/tls/mysipserver_net_ca.pem
|
||||
#crl = /etc/kamailio/tls/mysipserver_net_crl.pem
|
||||
#server_name = mysipserver.net
|
||||
#server_name_mode = 2
|
||||
#server_id = mysipserver.net
|
||||
7
production/kamailio/nodekami/Dockerfile
Archivo normal
7
production/kamailio/nodekami/Dockerfile
Archivo normal
@@ -0,0 +1,7 @@
|
||||
FROM node:8-slim
|
||||
RUN apt update && apt -y upgrade && apt install -y git python build-essential && apt clean
|
||||
RUN git clone https://github.com/gurumelo/nodekami /nodekami
|
||||
RUN chown node.node -R /nodekami
|
||||
USER node
|
||||
WORKDIR /nodekami/app
|
||||
RUN yarn
|
||||
8
production/kamailio/nodekami/confi.json
Archivo normal
8
production/kamailio/nodekami/confi.json
Archivo normal
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"dominio": "hatthieves.es",
|
||||
"ip": "172.127.0.101",
|
||||
"puerto": 3000,
|
||||
"secreto": "nohayclave",
|
||||
"bd": "kamailio.sqlite"
|
||||
}
|
||||
|
||||
139
production/kamailio/nodekami/index.js
Archivo normal
139
production/kamailio/nodekami/index.js
Archivo normal
@@ -0,0 +1,139 @@
|
||||
var confi = require('./confi.json');
|
||||
var express = require('express');
|
||||
var session = require('express-session');
|
||||
var bodyParser = require('body-parser');
|
||||
var validator = require('validator');
|
||||
var fs = require('fs');
|
||||
var ursa = require('ursa');
|
||||
var key = ursa.createPrivateKey(fs.readFileSync('./rsaprivada.pem'));
|
||||
var sqlite3 = require('sqlite3');
|
||||
var crypto = require('crypto');
|
||||
var bandera = 0;
|
||||
var app = express();
|
||||
|
||||
// Templates/vistas ejs
|
||||
app.set('views', __dirname + '/views');
|
||||
app.set('view engine', 'ejs');
|
||||
|
||||
// Servir directorio public
|
||||
app.use(express.static('./public'));
|
||||
|
||||
// Sesiones
|
||||
app.use(session({
|
||||
name: '',
|
||||
secret: confi.secreto,
|
||||
resave: false,
|
||||
saveUninitialized: false
|
||||
}));
|
||||
|
||||
// Body-parser
|
||||
app.use(bodyParser.json());
|
||||
app.use(bodyParser.urlencoded({extended: false}));
|
||||
|
||||
|
||||
// Función SQLITE
|
||||
var sentencia = function(lacontra, retrollamada) {
|
||||
bandera = 1;
|
||||
var db = new sqlite3.Database(confi.bd);
|
||||
|
||||
db.get("SELECT MAX(id) AS id FROM subscriber", function(err, row) {
|
||||
if (row.id == null) {
|
||||
var id = 1;
|
||||
} else {
|
||||
var id = row.id + 1;
|
||||
}
|
||||
var aha1 = id +':'+ confi.dominio +':'+ lacontra;
|
||||
var aha1b = id +'@'+ confi.dominio +':'+ confi.dominio +':'+ lacontra;
|
||||
var ha1 = crypto.createHash('md5').update(aha1).digest('hex');
|
||||
var ha1b = crypto.createHash('md5').update(aha1b).digest('hex');
|
||||
|
||||
db.run("INSERT INTO subscriber(username, domain, ha1, ha1b) VALUES (?, ?, ?, ?)", [ id, confi.dominio, ha1, ha1b ], function(error) {
|
||||
bandera = 0;
|
||||
retrollamada({ 'estado': 1, 'n': id });
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
db.close();
|
||||
|
||||
};
|
||||
|
||||
// banderas
|
||||
var vamosalla = function(lacontra,retrollamada) {
|
||||
if (bandera == 0) {
|
||||
sentencia(lacontra,retrollamada);
|
||||
} else {
|
||||
setTimeout(vamosalla, 50);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Sirve index
|
||||
app.get('/', function(req, res) {
|
||||
//Sesión
|
||||
sess = req.session;
|
||||
|
||||
// Creamos una variable con una cadena alfanumérica aleatoria.
|
||||
var aleatori = Math.random().toString(36).slice(2);
|
||||
|
||||
//Creamos variable de sesión
|
||||
sess.aleatori = aleatori;
|
||||
|
||||
// Se renderiza la vista enviando variable
|
||||
res.render('index', {
|
||||
aleatori: aleatori
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Procesa alta
|
||||
var cosa = { 'estado': 0 };
|
||||
|
||||
app.post('/t', function(req, res) {
|
||||
if ( (Object.keys(req.body).length == 3) && (validator.isBase64(req.body.contrasena)) && (validator.isBase64(req.body.paso)) && (validator.isBase64(req.body.aleatori)) ) {
|
||||
var paso = key.decrypt(req.body.paso,'base64', 'utf8', ursa.RSA_PKCS1_PADDING);
|
||||
if ( validator.isEmpty(paso) ) {
|
||||
// Puede que no sea un bot
|
||||
var aleatori = key.decrypt(req.body.aleatori,'base64', 'utf8', ursa.RSA_PKCS1_PADDING);
|
||||
//descifrar aleatori, comprobar que es alfanumérico y comprobar que es igual a la session.
|
||||
if ( validator.isAlphanumeric(aleatori) ) {
|
||||
sess = req.session;
|
||||
|
||||
if (sess.aleatori && sess.aleatori == aleatori) {
|
||||
var contrasena = key.decrypt(req.body.contrasena,'base64', 'utf8', ursa.RSA_PKCS1_PADDING);
|
||||
//mayor a 1 y menor a 25
|
||||
if ( validator.isLength(contrasena, 1, 25) ) {
|
||||
//SQLITE
|
||||
vamosalla(contrasena, function(numerito){
|
||||
res.send(numerito);
|
||||
});
|
||||
|
||||
req.session.destroy();
|
||||
|
||||
}
|
||||
else {
|
||||
res.send(cosa);
|
||||
}
|
||||
}
|
||||
else {
|
||||
res.send(cosa);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
res.send(cosa);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
res.send(cosa);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// A funcionar
|
||||
app.listen(confi.puerto, confi.ip);
|
||||
|
||||
75
production/kamailio/nodekami/publicindex.js
Archivo normal
75
production/kamailio/nodekami/publicindex.js
Archivo normal
@@ -0,0 +1,75 @@
|
||||
$('#crear').on('click', function() {
|
||||
$('#invi').slideDown(500,function() { $('#contrasena').focus(); });
|
||||
$('#crear').slideUp();
|
||||
});
|
||||
|
||||
$('#menu').on('click', function() {
|
||||
$('#cbp-spmenu-s1').toggleClass('cbp-spmenu-open');
|
||||
$('body').toggleClass('cbp-spmenu-push-toright');
|
||||
});
|
||||
|
||||
$(document).on('click', '#recuerda', function() {
|
||||
$(this).fadeOut('slow', function() {
|
||||
$(this).html(':)').fadeIn('slow');
|
||||
});
|
||||
$('#cbp-spmenu-s1').toggleClass('cbp-spmenu-open');
|
||||
$('body').toggleClass('cbp-spmenu-push-toright');
|
||||
});
|
||||
|
||||
|
||||
$('#t').submit( function(e) {
|
||||
e.preventDefault();
|
||||
var crypt = new JSEncrypt();
|
||||
crypt.setKey('-----BEGIN PUBLIC KEY-----MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvXjSYGTGw9kLoI6ui9mRhS2PQQNvhTRA47dXuv7dFRzG7ceL5/Ay8Uuupu2FqsKEDT3k7ADJY3FjomLANhtRmp/JI07M2SbyloRD9vegQzHEt1AaYMNMnvuL/iTjeUAHdvZNHx5GeWrGyUKs75AuiVQOzYGnAYZ0jM/wxnR5CwcTZLy8Yd7w2qGyVxUUElYMbPu2H2OWup+nqj9rvgmDQq7MgkQnsCeUnfdv93LaD1fQCxXMQ6rSjgUIy2nN5YfRGmqm8tjozqDILYIcNsn4GyNmiLobjX7gIpv7Z6Wqyn9kZJWGp2BQCRyZDC7bkjCU/FN1aMVsy36znqlQLTBsjwIDAQAB-----END PUBLIC KEY-----');
|
||||
var contrasena = $('#contrasena').val();
|
||||
var paso = $('#paso').val();
|
||||
var aleatori = $('#aleatori').val();
|
||||
var enccontrasena = crypt.encrypt(contrasena);
|
||||
var encpaso = crypt.encrypt(paso);
|
||||
var encaleatori = crypt.encrypt(aleatori);
|
||||
|
||||
$.ajax({
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: '/t',
|
||||
data: { contrasena: enccontrasena, paso: encpaso, aleatori: encaleatori },
|
||||
beforeSend: function() {
|
||||
$('#carga').show();
|
||||
$('#crearsubmit, #contrasena').attr('disabled', 'disabled');
|
||||
$('#crearsubmit').css('padding-right', '10px');
|
||||
}
|
||||
}).done( function(queviene) {
|
||||
if (queviene.estado == 1) {
|
||||
var resultante = 'Tu número<span class="azul">.</span><div style="font-size: 40px; text-shadow: 2px 1px 1px #000;"><a class="azul" href="sip:' + queviene.n + ':' + $("#contrasena").val() + '@hatthieves.es:5061;transport=TLS;method=SUBSCRIBE">' + queviene.n + '</a></div>Tu contraseña<span class="azul">.</span><div style="font-size: 45px; text-shadow: 2px 1px 1px #000;">*****</div><div id="recuerda" class="blinkime azul"><img src="img/menu.png" /></div>';
|
||||
$('#cajaf').html(resultante);
|
||||
|
||||
}
|
||||
if (queviene.estado == 0) {
|
||||
$('#err').html('Clave errónea<span class="azul">!</span>').css('display','inline-block');
|
||||
$('#carga').hide();
|
||||
$('#crearsubmit, #contrasena').removeAttr('disabled');
|
||||
$('#crearsubmit').css('padding-right', '28px');
|
||||
$('#err').on('click', function() {
|
||||
$(this).hide();
|
||||
});
|
||||
}
|
||||
}).fail(function() {
|
||||
$('#err').html('<span class="azul">¡</span>Error<span class="azul">!</span>').css('display','inline-block');
|
||||
$('#carga').hide();
|
||||
$('#crearsubmit, #contrasena').removeAttr('disabled');
|
||||
$('#crearsubmit').css('padding-right', '28px');
|
||||
$('#err').on('click', function() {
|
||||
$(this).hide();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#configlinux').on('click', function() {
|
||||
$('#configs').show();
|
||||
});
|
||||
$('#cerrar').on('click', function() {
|
||||
$('#configs').hide();
|
||||
});
|
||||
|
||||
Referencia en una nueva incidencia
Block a user