From 89af95c9144cd15a996d61eeb8c5dd9c34a860ba Mon Sep 17 00:00:00 2001 From: karl anderson Date: Tue, 20 May 2014 17:26:20 -0400 Subject: [PATCH] KAZOO-1513: moving some things around since we must change local.cfg --- kamailio/dbtext/dispatcher | 4 +- kamailio/default.cfg | 42 ++--------- kamailio/dispatcher-role.cfg | 3 + kamailio/kamailio.cfg | 29 ++++++-- kamailio/kamctlrc | 104 -------------------------- kamailio/local.cfg | 127 +++++++++++++++++++------------- kamailio/nat-traversal-role.cfg | 2 + kamailio/presence-role.cfg | 13 ++-- kamailio/registrar-role.cfg | 7 +- kamailio/roles.cfg | 10 --- kamailio/substdef.cfg | 19 ----- kamailio/tls-role.cfg | 5 ++ kamailio/websockets-role.cfg | 2 +- 13 files changed, 125 insertions(+), 242 deletions(-) delete mode 100644 kamailio/kamctlrc delete mode 100644 kamailio/roles.cfg delete mode 100644 kamailio/substdef.cfg create mode 100644 kamailio/tls-role.cfg diff --git a/kamailio/dbtext/dispatcher b/kamailio/dbtext/dispatcher index f9e4194..e45a887 100644 --- a/kamailio/dbtext/dispatcher +++ b/kamailio/dbtext/dispatcher @@ -6,5 +6,5 @@ ### 20 - Registrar servers (if not locally handled) # setid(integer) destination(sip uri) flags (integer, optional) -1 sip:127.0.0.1:11000 0 -3 sips:127.0.0.1:11001 0 +1 sip:10.26.0.83:11000 0 +2 sip:10.26.0.84:11000 0 diff --git a/kamailio/default.cfg b/kamailio/default.cfg index 0bb9907..7d6edf0 100644 --- a/kamailio/default.cfg +++ b/kamailio/default.cfg @@ -1,23 +1,5 @@ ## NOTE: DO NOT CHANGE THIS FILE, EDIT local.cfg ## -#### Preprocessor Directives ######### -#!define L_ALERT -5 -#!define L_BUG -4 -#!define L_CRIT2 -3 -#!define L_CRIT -2 -#!define L_ERR -1 -#!define L_WARN 0 -#!define L_NOTICE 1 -#!define L_INFO 2 -#!define L_DBG 3 - -#!define AVP_RECV_PARAM "recv_param" -#!define AVP_LOG_LEVEL "log_level" -#!define AVP_ROUTE_CNT "route_cnt" -#!define AVP_ASSOCIATED_SERVER "associated_server" -#!define AVP_ASSOCIATE_CONTACT "associate_contact" -#!define AVP_REDIRECT_KEY "redirect_key" - ####### Flags ####### flags FLAG_INTERNALLY_SOURCED: 1, @@ -27,11 +9,6 @@ flags FLAG_TRUSTED_SOURCE: 5, FLAG_SESSION_PROGRESS: 6; -#!define FLB_NATB 1 -#!define FLB_NATSIPPING 2 -#!define FLB_UAC_REDIRECT 3 -#!define TRUSTED_ADR_GROUP 1 - ####### Global Parameters ######### fork = yes children = 25 @@ -101,8 +78,7 @@ dns_srv_lb = off ####### SCTP Parameters ######### disable_sctp = yes -####### Custom Parameters ######### - +####### Binding Parameters ######### ####### Modules Section ######## mpath="/usr/lib64/kamailio/modules/" @@ -173,16 +149,9 @@ loadmodule "pike.so" loadmodule "db_text.so" modparam("db_text", "db_mode", 1) -#!ifdef TLS-ROLE -####### TLS Parameters ######### -enable_tls = yes -loadmodule "tls.so" -modparam("tls", "config", "/etc/kazoo/kamailio/tls.cfg") -#!endif - ####### Kazoo Integration module ########## loadmodule "db_kazoo.so" -modparam("db_kazoo", "node_hostname", "kamailio.2600hz.com") +modparam("db_kazoo", "node_hostname", "MY_HOSTNAME") ####### Role Configurations ########## #!ifdef DISPATCHER-ROLE @@ -200,8 +169,9 @@ include_file "nat-traversal-role.cfg" #!ifdef WEBSOCKETS-ROLE include_file "websockets-role.cfg" #!endif - - +#!ifdef TLS-ROLE +include_file "tls-role.cfg" +#!endif ####### Permissions module ########## loadmodule "permissions.so" @@ -217,8 +187,6 @@ route xlog("L_INFO", "$ci|log|from $fu"); xlog("L_INFO", "$ci|log|to $tu"); - remove_hf_re("Diversion: .*"); - route(SANITY_CHECK); #!ifdef DISPATCHER-ROLE diff --git a/kamailio/dispatcher-role.cfg b/kamailio/dispatcher-role.cfg index 57423df..e16db39 100644 --- a/kamailio/dispatcher-role.cfg +++ b/kamailio/dispatcher-role.cfg @@ -18,6 +18,9 @@ modparam("dispatcher", "ds_ping_interval", 10) modparam("dispatcher", "ds_probing_threshhold", 3) modparam("dispatcher", "ds_probing_mode", 1) modparam("dispatcher", "ds_ping_reply_codes", "501,403,404,400,200") +modparam("dispatcher", "ds_ping_from", "sip:sipcheck@MY_IP_ADDRESS") +# modparam("dispatcher", "ds_ping_sock", "udp:MY_IP_ADDRESS:5060") + ## Dispatcher Groups: ## 1 - Primary media servers diff --git a/kamailio/kamailio.cfg b/kamailio/kamailio.cfg index 6452ef8..cc4ea79 100644 --- a/kamailio/kamailio.cfg +++ b/kamailio/kamailio.cfg @@ -1,15 +1,32 @@ ## NOTE: DO NOT CHANGE THIS FILE, EDIT local.cfg ## -####### Roles Configuration ###### -include_file "roles.cfg" +#### Preprocessor Directives ######### +#!define L_ALERT -5 +#!define L_BUG -4 +#!define L_CRIT2 -3 +#!define L_CRIT -2 +#!define L_ERR -1 +#!define L_WARN 0 +#!define L_NOTICE 1 +#!define L_INFO 2 +#!define L_DBG 3 -####### variables ##### -include_file "substdef.cfg" +#!define AVP_RECV_PARAM "recv_param" +#!define AVP_LOG_LEVEL "log_level" +#!define AVP_ROUTE_CNT "route_cnt" +#!define AVP_ASSOCIATED_SERVER "associated_server" +#!define AVP_ASSOCIATE_CONTACT "associate_contact" +#!define AVP_REDIRECT_KEY "redirect_key" -####### Default Configuration ###### -include_file "default.cfg" +#!define FLB_NATB 1 +#!define FLB_NATSIPPING 2 +#!define FLB_UAC_REDIRECT 3 +#!define TRUSTED_ADR_GROUP 1 ####### Local Configuration ######## include_file "local.cfg" +####### Default Configuration ###### +include_file "default.cfg" + # vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab diff --git a/kamailio/kamctlrc b/kamailio/kamctlrc deleted file mode 100644 index 85ef600..0000000 --- a/kamailio/kamctlrc +++ /dev/null @@ -1,104 +0,0 @@ -# $Id$ -# -# 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 -## chrooted directory -# $CHROOT_DIR="/path/to/chrooted/directory" - -## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, or DBTEXT, by default none is loaded -# If you want to setup a database with kamdbctl, you must at least specify -# this parameter. -DBENGINE=DBTEXT - -# database path used by dbtext or db_berkeley -DB_PATH="/etc/kazoo/kamailio/dbtext" -DBTEXT_PATH="/etc/kazoo/kamailio/dbtext" - - -# Program to calculate a message-digest fingerprint -# MD5="md5sum" - -# awk tool -# AWK="awk" - -# 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 - -# 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" - - -## type of aliases used: DB - database aliases; UL - usrloc aliases -## - default: none -# ALIASES_TYPE="DB" - -## control engine: FIFO or UNIXSOCK -## - default FIFO -# CTLENGINE="FIFO" - -## path to FIFO file -# OSER_FIFO="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" - -## 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 - -## OPENSER START Options -## PID file path - default is: /var/run/kamailio.pid -# PID_FILE=/var/run/kamailio.pid - -## Extra start options - default is: not set -# example: start Kamailio with 64MB share memory: STARTOPTIONS="-m 64" -STARTOPTIONS="-m 1024" diff --git a/kamailio/local.cfg b/kamailio/local.cfg index ec4cb61..d787adf 100644 --- a/kamailio/local.cfg +++ b/kamailio/local.cfg @@ -1,64 +1,89 @@ -####### Logging Parameters ######### +################################################################################ +## LOGGING +################################################################################ debug = L_INFO -####### Alias Parameters ######### -# alias = "mydomain.net" +################################################################################ +## ROLES +################################################################################ +## NOTE: Remove all but the last '#' to +## enable the named roled -####### UDP Parameters ######### -## NOTE: You must MATCH this to your network adapter!! -## If they do not match, all UDP packets over -## this limit WILL FAIL! -## E.g.: Add MTU=1472 to the /etc/sysconfig/network-scripts/XXX -# udp4_raw_mtu = 1472 - -####### Binding Parameters ######### -# mhomed=1 -listen=MY_TCP_ADDR_1 -listen=MY_UDP_ADDR_1 -listen=MY_TCP_ADDR_2 -listen=MY_UDP_ADDR_2 - -#!ifdef TLS-ROLE -listen=MY_TLS_ADDR -#!endif - -#!ifdef WEBSOCKETS-ROLE -listen=MY_WS_ADDR -#!ifdef TLS-ROLE -listen=MY_WSS_ADDR -#!endif -#!endif +## Enabled Roles +#!trydef DISPATCHER-ROLE +#!trydef NAT-TRAVERSAL-ROLE +#!trydef REGISTRAR-ROLE +#!trydef PRESENCE-ROLE +## Disabled Roles +# # #!trydef TRAFFIC-FILTER-ROLE +# # #!trydef WEBSOCKETS-ROLE +# # #!trydef TLS-ROLE +################################################################################ +## SERVER INFORMATION +################################################################################ +## NOTE: Change this to your servers hostname +#!substdef "!MY_HOSTNAME!kamailio.2600hz.com!g" +## NOTE: Change this to the IP address Kamailio +## should use, usually your public IP. If +## you need to listen on addtional ports or +## IPs add them in "Additional Binding Parameters". +#!substdef "!MY_IP_ADDRESS!127.0.0.1!g" +## NOTE: Change this to the AMQP URL of the +## primary RabbitMQ server in the zone +## that this server will service. +#!substdef "!MY_AMQP_URL!kazoo://guest:guest@127.0.0.1:5672!g" -####### Dispatcher module ######## -#!ifdef DISPATCHER-ROLE -modparam("dispatcher", "ds_ping_from", "sip:sipcheck@@MY_HOST_NAME") +#!ifdef WEBSOCKETS-ROLE +## NOTE: This parameter is only required if you are +## using websockets. This value must be present +## in the HTTP Origin header on a new websocket +## request or it will be rejected. +#!substdef "!MY_WEBSOCKET_DOMAIN!2600hz.com!g" #!endif -######## NAT Traversal module - signaling functions ######## -#!ifdef NAT-TRAVERSAL-ROLE -modparam("nathelper", "sipping_from", "sip:sipcheck@MY_HOST_NAME") -# modparam("nathelper", "natping_socket", "127.0.0.1:5060") -#!endif +################################################################################ +## UDP PARAMETERS +################################################################################ +## NOTE: This parameter is OPTIONAL, but if your +## UDP packets are dropped due to MTU you can +## try uncomment this option. However, you +## MUST match this to your network adapter! +## If they do not match, all UDP packets over +## this limit WILL FAIL! +## E.g.: Add MTU=1472 to the /etc/sysconfig/network-scripts/XXX +# udp4_raw_mtu = 1472 -####### Kazoo Integration module ########## -#!ifdef INCLUDE-DB-KAZOO -## NOTE: The hostname that should be advertised to Kazoo -modparam("db_kazoo", "node_hostname", "MY_HOST_NAME") -## NOTE: If you want a certain fs_path to be sent Kazoo, -## uncomment the next line and set the right value -# modparam("db_kazoo", "register_fs_path", "MY_HOST_NAME") -#!endif +################################################################################ +## BINDINGS +################################################################################ +## NOTE: You should not have to change these definitions +#!substdef "!UDP_SIP!udp:MY_IP_ADDRESS:5060!g" +#!substdef "!TCP_SIP!tcp:MY_IP_ADDRESS:5060!g" +#!substdef "!UDP_AGL_SIP!udp:MY_IP_ADDRESS:7000!g" +#!substdef "!TCP_AGL_SIP!tcp:MY_IP_ADDRESS:7000!g" +#!substdef "!TCP_WS!tcp:MY_IP_ADDRESS:8080!g" +#!substdef "!TCP_WSS!tcp:MY_IP_ADDRESS:8080!g" -####### Common Module Parameters ########## -#!ifdef REGISTRAR-ROLE -modparam("auth_db|usrloc", "db_url", "kazoo://guest:guest@MY_RABBIT_HOST_NAME:5672/callmgr") -#!endif -#!ifdef PRESENCE-ROLE -modparam("presence", "db_url", "kazoo://guest:guest@MY_RABBIT_HOST_NAME:5672/dialoginfo") -#!endif +## NOTE: This parameter is OPTIONAL. It will try to +## locate outbound interface on multihomed host. +## By default forward requests use the incoming +## socket disregarding the destination location. +## When enabled Kamailio will select a socket that +## can reach the destination. This reduces performance. +mhomed=0 -# vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab +## NOTE: These parameters are OPTIONAL. +## The configuration will listen on 5060 and 7000 +## of MY_IP_ADDRESS (configured above). If you +## have websockets role enabled it will +## listen on 8080. If you need additional ports +## or IPs add listen parameters bellow. +## E.g.: listen=udp:4.2.2.2:5060 +listen=UDP_SIP +listen=TCP_SIP +listen=UDP_AGL_SIP +listen=TCP_AGL_SIP diff --git a/kamailio/nat-traversal-role.cfg b/kamailio/nat-traversal-role.cfg index d5fe155..0a25b8c 100644 --- a/kamailio/nat-traversal-role.cfg +++ b/kamailio/nat-traversal-role.cfg @@ -3,6 +3,8 @@ loadmodule "nathelper.so" #!endif modparam("nathelper", "received_avp", "$avp(AVP_RECV_PARAM)") +modparam("nathelper", "sipping_from", "sip:sipcheck@MY_IP_ADDRESS") +# modparam("nathelper", "natping_socket", "MY_IP_ADDRESS:5060") ####### NAT Traversal Logic ######## route[NAT_TEST_AND_CORRECT] diff --git a/kamailio/presence-role.cfg b/kamailio/presence-role.cfg index 7ab393f..0dcd752 100644 --- a/kamailio/presence-role.cfg +++ b/kamailio/presence-role.cfg @@ -1,12 +1,6 @@ -#!trydef INCLUDE-DB-KAZOO - ######## Generic Hash Table container in shared memory ######## modparam("htable", "htable", "dbkp=>size=16;autoexpire=7200") -######## Presence User Agent module ######## -loadmodule "pua_dialoginfo.so" -modparam("pua_dialoginfo", "library_mode", 1) - ######## Presence server module ######## loadmodule "presence.so" loadmodule "presence_dialoginfo.so" @@ -16,13 +10,16 @@ modparam("presence", "expires_offset", 60) modparam("presence", "publ_cache", 0) #modparam("presence", "min_expires", 300) modparam("presence", "max_expires", 3600) +modparam("presence", "db_url", "MY_AMQP_URL/dialoginfo") +######## Presence User Agent module ######## loadmodule "pua.so" +loadmodule "pua_dialoginfo.so" +modparam("pua_dialoginfo", "library_mode", 1) modparam("pua", "db_url", "text:///etc/kazoo/kamailio/dbtext") modparam("pua", "db_mode", 0) -modparam("pua", "outbound_proxy", "sip:MY_IP_ADDR") modparam("pua", "min_expires", 300) - +modparam("pua", "outbound_proxy", "sip:MY_IP_ADDRESS") ####### Presence Logic ######## route[HANDLE_SUBSCRIBE] diff --git a/kamailio/registrar-role.cfg b/kamailio/registrar-role.cfg index 82cc083..8860bc5 100644 --- a/kamailio/registrar-role.cfg +++ b/kamailio/registrar-role.cfg @@ -1,5 +1,3 @@ -#!trydef INCLUDE-DB-KAZOO - ######## Generic Hash Table container in shared memory ######## modparam("htable", "htable", "auth_cache=>size=16;autoexpire=7200") modparam("htable", "htable", "failed_auth_hash=>size=14;autoexpire=180;") @@ -36,6 +34,9 @@ modparam("registrar", "received_avp", "$avp(AVP_RECV_PARAM)") modparam("registrar", "min_expires", 300) modparam("registrar", "max_expires", 3600) +####### Common Module Parameters ########## +modparam("auth_db|usrloc", "db_url", "MY_AMQP_URL/callmgr") + ####### Registrar Logic ######## route[HANDLE_REGISTER] { @@ -57,11 +58,9 @@ route[HANDLE_REGISTER] setbflag(FLB_NATB); setbflag(FLB_NATSIPPING); } - #!endif if (is_present_hf("Authorization")) { - #!ifdef TRAFFIC-FILTER-ROLE if (!route(PREVENT_BRUTEFORCE)) { auth_challenge("$fd", "0"); diff --git a/kamailio/roles.cfg b/kamailio/roles.cfg deleted file mode 100644 index f4a204d..0000000 --- a/kamailio/roles.cfg +++ /dev/null @@ -1,10 +0,0 @@ -####### Roles ######## -#!trydef DISPATCHER-ROLE -#!trydef NAT-TRAVERSAL-ROLE -#!trydef REGISTRAR-ROLE -#!trydef PRESENCE-ROLE -# # #!trydef TRAFFIC-FILTER-ROLE -# # #!trydef WEBSOCKETS-ROLE -# # #!trydef TLS-ROLE - -## vim:set tabstop=4 softtabstop=4 shiftwidth=4 expandtab diff --git a/kamailio/substdef.cfg b/kamailio/substdef.cfg deleted file mode 100644 index 84a9e81..0000000 --- a/kamailio/substdef.cfg +++ /dev/null @@ -1,19 +0,0 @@ -#!substdef "!MY_IP_ADDR!127.0.0.1!g" -#!substdef "!MY_HOST_NAME!fqdn.of.this.host!g" -#!substdef "!MY_RABBIT_HOST_NAME!fqdn.of.rabbit.host!g" -#!substdef "!MY_SIP_PORT_1!5060!g" -#!substdef "!MY_SIP_PORT_2!7000!g" -#!substdef "!MY_TLS_PORT!5061!g" -#!substdef "!MY_WS_PORT!80!g" -#!substdef "!MY_WSS_PORT!443!g" -#!substdef "!MY_MSRP_PORT!9000!g" -#!substdef "!MY_WS_ADDR!tcp:MY_IP_ADDR:MY_WS_PORT!g" -#!substdef "!MY_WSS_ADDR!tls:MY_IP_ADDR:MY_WSS_PORT!g" -#!substdef "!MY_MSRP_ADDR!tls:MY_IP_ADDR:MY_MSRP_PORT!g" -#!substdef "!MSRP_MIN_EXPIRES!1800!g" -#!substdef "!MSRP_MAX_EXPIRES!3600!g" -#!substdef "!MY_UDP_ADDR_1!udp:MY_IP_ADDR:MY_SIP_PORT_1!g" -#!substdef "!MY_UDP_ADDR_2!udp:MY_IP_ADDR:MY_SIP_PORT_2!g" -#!substdef "!MY_TCP_ADDR_1!tcp:MY_IP_ADDR:MY_SIP_PORT_1!g" -#!substdef "!MY_TCP_ADDR_2!tcp:MY_IP_ADDR:MY_SIP_PORT_2!g" -#!substdef "!MY_TLS_ADDR!tls:MY_IP_ADDR:MY_TLS_PORT!g" diff --git a/kamailio/tls-role.cfg b/kamailio/tls-role.cfg new file mode 100644 index 0000000..6752fab --- /dev/null +++ b/kamailio/tls-role.cfg @@ -0,0 +1,5 @@ +enable_tls = yes + +####### TLS Parameters ######### +loadmodule "tls.so" +modparam("tls", "config", "/etc/kazoo/kamailio/tls.cfg") diff --git a/kamailio/websockets-role.cfg b/kamailio/websockets-role.cfg index e24f6b3..7e4453d 100644 --- a/kamailio/websockets-role.cfg +++ b/kamailio/websockets-role.cfg @@ -1,4 +1,4 @@ -######## Websocket module ######## +listen=TCP_WS tcp_accept_no_cl=yes ######## Generic Hash Table container in shared memory ########