From 90341d730b30fae23e347e453708c6d3e32b4ec3 Mon Sep 17 00:00:00 2001 From: Karl Anderson Date: Thu, 17 Feb 2011 12:38:04 -0800 Subject: [PATCH 01/11] updates to the confs, fix the proxy list, update the logging, enable siptrace, disable any auto-restarts, and update the avaliable params for sofia as well as switch.conf.xml --- autoload_configs/acl.conf.xml | 7 +- autoload_configs/logfile.conf.xml | 11 ++ autoload_configs/modules.conf.xml | 4 +- autoload_configs/sofia.conf.xml | 7 +- autoload_configs/switch.conf.xml | 28 ++-- sip_profiles/sipinterface_1.xml | 213 +++++++++++++++++------------ sip_profiles/sipinterface_2.xml | 215 ++++++++++++++++++------------ 7 files changed, 297 insertions(+), 188 deletions(-) diff --git a/autoload_configs/acl.conf.xml b/autoload_configs/acl.conf.xml index 42df2f3..a1bd075 100644 --- a/autoload_configs/acl.conf.xml +++ b/autoload_configs/acl.conf.xml @@ -1,11 +1,8 @@ - - - - - + + diff --git a/autoload_configs/logfile.conf.xml b/autoload_configs/logfile.conf.xml index 3f918f2..f0d031b 100644 --- a/autoload_configs/logfile.conf.xml +++ b/autoload_configs/logfile.conf.xml @@ -52,5 +52,16 @@ + + + + + + + + + + + diff --git a/autoload_configs/modules.conf.xml b/autoload_configs/modules.conf.xml index 06d4110..30d0aea 100644 --- a/autoload_configs/modules.conf.xml +++ b/autoload_configs/modules.conf.xml @@ -26,10 +26,10 @@ - + - + diff --git a/autoload_configs/sofia.conf.xml b/autoload_configs/sofia.conf.xml index 0a23942..54dcb29 100644 --- a/autoload_configs/sofia.conf.xml +++ b/autoload_configs/sofia.conf.xml @@ -1,8 +1,11 @@ - + + - + + + diff --git a/autoload_configs/switch.conf.xml b/autoload_configs/switch.conf.xml index b79b01a..36cfed8 100644 --- a/autoload_configs/switch.conf.xml +++ b/autoload_configs/switch.conf.xml @@ -16,21 +16,33 @@ - - - - - - + + + + + + + - + + + + + + + + + + + + + - \ No newline at end of file diff --git a/sip_profiles/sipinterface_1.xml b/sip_profiles/sipinterface_1.xml index a38b814..8bd60cf 100644 --- a/sip_profiles/sipinterface_1.xml +++ b/sip_profiles/sipinterface_1.xml @@ -1,131 +1,174 @@ - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + - + + - + + + + - + - - - - - - - - - - - + + - - + + - - - - - - - + + + + + + + + + - - + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + - - - + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - + --> + + + + + + + + - - + + diff --git a/sip_profiles/sipinterface_2.xml b/sip_profiles/sipinterface_2.xml index fc38a92..1a6cf94 100644 --- a/sip_profiles/sipinterface_2.xml +++ b/sip_profiles/sipinterface_2.xml @@ -1,131 +1,174 @@ - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + - + + - + + + + - + - - - - - - - - - - - + + - - + + - - - - - - - + + + + + + + + + - - + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + - - - + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - + --> + + + + + + + + - - + + From f61cffa0c1ea6d84fec8b959b543ade54d695aef Mon Sep 17 00:00:00 2001 From: Karl Anderson Date: Thu, 17 Feb 2011 13:00:56 -0800 Subject: [PATCH 02/11] auto-rotate if the logs grow larger than 25mb --- autoload_configs/logfile.conf.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/autoload_configs/logfile.conf.xml b/autoload_configs/logfile.conf.xml index f0d031b..0fae47f 100644 --- a/autoload_configs/logfile.conf.xml +++ b/autoload_configs/logfile.conf.xml @@ -7,7 +7,7 @@ - + @@ -18,7 +18,7 @@ - + @@ -29,7 +29,7 @@ - + @@ -40,7 +40,7 @@ - + @@ -56,7 +56,7 @@ - + From 0dcfff289219c34ac035b42bfc5c7eadfaacc7f2 Mon Sep 17 00:00:00 2001 From: Karl Anderson Date: Thu, 17 Feb 2011 13:11:22 -0800 Subject: [PATCH 03/11] helps to properly name the interfaces --- sip_profiles/sipinterface_2.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sip_profiles/sipinterface_2.xml b/sip_profiles/sipinterface_2.xml index 1a6cf94..03d8423 100644 --- a/sip_profiles/sipinterface_2.xml +++ b/sip_profiles/sipinterface_2.xml @@ -1,6 +1,6 @@ - + From b6e16ca40c0dd60b7a334186358f282d218aef03 Mon Sep 17 00:00:00 2001 From: Karl Anderson Date: Thu, 17 Feb 2011 13:14:44 -0800 Subject: [PATCH 04/11] enable media bypass by default --- sip_profiles/sipinterface_1.xml | 2 +- sip_profiles/sipinterface_2.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sip_profiles/sipinterface_1.xml b/sip_profiles/sipinterface_1.xml index 8bd60cf..19acaeb 100644 --- a/sip_profiles/sipinterface_1.xml +++ b/sip_profiles/sipinterface_1.xml @@ -69,7 +69,7 @@ - + diff --git a/sip_profiles/sipinterface_2.xml b/sip_profiles/sipinterface_2.xml index 03d8423..4de6b92 100644 --- a/sip_profiles/sipinterface_2.xml +++ b/sip_profiles/sipinterface_2.xml @@ -69,7 +69,7 @@ - + From 12a5ac2ce708e75c7160b5e54fce93286aed5aac Mon Sep 17 00:00:00 2001 From: Karl Anderson Date: Thu, 17 Feb 2011 13:30:41 -0800 Subject: [PATCH 05/11] see if we can properly create a log of siptraces --- autoload_configs/sofia.conf.xml | 4 ++-- sip_profiles/sipinterface_1.xml | 2 +- sip_profiles/sipinterface_2.xml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/autoload_configs/sofia.conf.xml b/autoload_configs/sofia.conf.xml index 54dcb29..b1339fd 100644 --- a/autoload_configs/sofia.conf.xml +++ b/autoload_configs/sofia.conf.xml @@ -1,7 +1,7 @@ - - + + diff --git a/sip_profiles/sipinterface_1.xml b/sip_profiles/sipinterface_1.xml index 19acaeb..df80a29 100644 --- a/sip_profiles/sipinterface_1.xml +++ b/sip_profiles/sipinterface_1.xml @@ -167,7 +167,7 @@ - + diff --git a/sip_profiles/sipinterface_2.xml b/sip_profiles/sipinterface_2.xml index 4de6b92..a58f0d2 100644 --- a/sip_profiles/sipinterface_2.xml +++ b/sip_profiles/sipinterface_2.xml @@ -167,7 +167,7 @@ - + From a73044bba524a06254dbba9d9238158d64ccf816 Mon Sep 17 00:00:00 2001 From: Karl Anderson Date: Thu, 17 Feb 2011 14:01:22 -0800 Subject: [PATCH 06/11] lets try using the proxy acl and the x-auth-ip header so we can auth via IPs in erlang later --- autoload_configs/acl.conf.xml | 9 ++++++--- sip_profiles/sipinterface_1.xml | 4 ++-- sip_profiles/sipinterface_2.xml | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/autoload_configs/acl.conf.xml b/autoload_configs/acl.conf.xml index a1bd075..606da7f 100644 --- a/autoload_configs/acl.conf.xml +++ b/autoload_configs/acl.conf.xml @@ -1,10 +1,13 @@ - + + + + + + - - diff --git a/sip_profiles/sipinterface_1.xml b/sip_profiles/sipinterface_1.xml index df80a29..46bab36 100644 --- a/sip_profiles/sipinterface_1.xml +++ b/sip_profiles/sipinterface_1.xml @@ -6,8 +6,8 @@ - - + + diff --git a/sip_profiles/sipinterface_2.xml b/sip_profiles/sipinterface_2.xml index a58f0d2..a14640f 100644 --- a/sip_profiles/sipinterface_2.xml +++ b/sip_profiles/sipinterface_2.xml @@ -6,8 +6,8 @@ - - + + From 0dad24679e57ce0235759c0380bfa76b74cb11b3 Mon Sep 17 00:00:00 2001 From: Karl Anderson Date: Thu, 17 Feb 2011 15:02:36 -0800 Subject: [PATCH 07/11] this will have to do for now... --- opensips/dispatcher.list | 11 + opensips/dispatcher.sh | 53 ++++ opensips/opensips.cfg | 559 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 623 insertions(+) create mode 100644 opensips/dispatcher.list create mode 100644 opensips/dispatcher.sh create mode 100644 opensips/opensips.cfg diff --git a/opensips/dispatcher.list b/opensips/dispatcher.list new file mode 100644 index 0000000..3f5b04b --- /dev/null +++ b/opensips/dispatcher.list @@ -0,0 +1,11 @@ +# setit(integer) destination(sip uri) flags (integer, optional) +1 sip:184.106.179.143:5060 2 +1 sip:184.106.169.42:5060 2 +1 sip:209.114.34.232:5060 2 +1 sip:209.114.32.203:5060 2 +#1 sip:184.106.189.9:5060 2 +#1 sip:184.106.170.41:5060 2 +#1 sip:184.73.45.119:5060 2 +#1 sip:50.16.89.56:5060 2 +#1 sip:67.202.51.166:5060 2 +#1 sip:50.17.16.247:5060 2 diff --git a/opensips/dispatcher.sh b/opensips/dispatcher.sh new file mode 100644 index 0000000..c8f2e47 --- /dev/null +++ b/opensips/dispatcher.sh @@ -0,0 +1,53 @@ +#!/bin/bash +DISPATCHER_FILE="/usr/local/etc/opensips/dispatcher.list" +OSIP_CTL="/usr/local/etc/opensips/opensipsctl" + +fUsage () { + echo "Usage: $0 [Media Server IP] [-a active] [-i inactive] [-p probing] [-r reload]" + exit 1 +} + +cd `dirname $0` + +[[ ! $1 == -* ]] && server=$1 && shift + +while [ -n "$*" ]; do + case "x$1" in + x-a) + action="a" + ;; + x-i) + action="i" + ;; + x-p) + action="p" + ;; + x-r) + action="r" + ;; + x--help) + fUsage + ;; + *) + fUsage + ;; + esac + shift +done + +if [ -z $action ]; then + echo "# $OSIP_CTL fifo ds_list" + $OSIP_CTL fifo ds_list + exit 0 +elif [ $action == "r" ]; then + echo "# $OSIP_CTL fifo ds_reload" + $OSIP_CTL fifo ds_reload + exit 0 +elif grep -q $server $DISPATCHER_FILE; then + echo "# $OSIP_CTL fifo ds_set_state $action `grep $server $DISPATCHER_FILE | cut -d' ' -f 1` `grep $server $DISPATCHER_FILE | cut -d' ' -f 2`" + $OSIP_CTL fifo ds_set_state $action `grep $server $DISPATCHER_FILE | cut -d' ' -f 1` `grep $server $DISPATCHER_FILE | cut -d' ' -f 2` + exit 0 +else + echo "ERROR: Could not locate $server in $DISPATCHER_FILE" + exit 1 +fi diff --git a/opensips/opensips.cfg b/opensips/opensips.cfg new file mode 100644 index 0000000..a95fcc4 --- /dev/null +++ b/opensips/opensips.cfg @@ -0,0 +1,559 @@ +###################################################################### +## Core Parameters +###################################################################### +# chroot= +# group="opensips" +# user="opensips" +# dbversion_table= +disable_core_dump=no +max_while_loops=100 +maxbuffer=262144 +memdump=3 +memlog=2 +# open_files_limit=2048 +server_signature=no +server_header="Server: 2600hz Trunk Store" +user_agent_header="User-Agent: 2600hz Trunk Store" + +###################################################################### +## Core Fork Parameters +###################################################################### +fork=yes +children=8 +tcp_children=8 + +###################################################################### +## Core Logging Parameters +###################################################################### +debug=4 +sip_warning=0 +log_stderror=no +log_facility=LOG_LOCAL0 +log_name="opensips" + +###################################################################### +## Aliases +###################################################################### +auto_aliases=no +alias=localhost +alias=localhost.localdomain + +###################################################################### +## Connectivity +###################################################################### +listen=udp:eth0:5060 +# listen=udp:eth1:5060 +tos=IPTOS_LOWDELAY +# advertised_address=174.129.131.38 +# advertised_port=5060 +mcast_loopback=no +mcast_ttl=1 +mhomed=0 +# tcp_accept_aliases +tcp_connect_timeout=3 +tcp_connection_lifetime=120 +tcp_max_connections=2048 +# tcp_poll_method=select + +###################################################################### +## DNS +###################################################################### +dns=no +dns_retr_time=1 +dns_retr_no=3 +# dns_servers_no=2 +dns_try_ipv6=no +disable_dns_blacklist=yes +disable_dns_failover=no +dns_use_search_list=no +rev_dns=no + +###################################################################### +## SIP +###################################################################### +check_via=0 +#! disable_503_translation=no +disable_stateless_fwd=no +disable_tcp=no +# disable_tls=no +#! reply_to_via=1 + +###################################################################### +## TLS +###################################################################### +# disable_tls=no +# listen=tls:your_IP:5061 +# tls_verify_server=1 +# tls_verify_client=1 +# tls_require_client_certificate=0 +# tls_method=TLSv1 +# tls_certificate="/usr/local/etc/opensips/tls/user/user-cert.pem" +# tls_private_key="/usr/local/etc/opensips/tls/user/user-privkey.pem" +# tls_ca_list="/usr/local/etc/opensips/tls/user/user-calist.pem" + +###################################################################### +## Destination Blacklist +###################################################################### +# dst_blacklist=gw:{( tcp , 192.168.2.100 , 5060 , "" ),( any , 192.168.2.101 , 0 , "" )} +# dst_blacklist=net_filter2:{ !( any , 192.168.30.0/255.255.255.0 , 0 , "" )} + +###################################################################### +## Attribute Value Pairs +###################################################################### +# avp_aliases="uuid=I:660;email=s:email_addr;fwd=i:753" + +###################################################################### +## Module Loading +###################################################################### +mpath="/usr/local/lib64/opensips/modules/" +loadmodule "memcached.so" +loadmodule "signaling.so" +loadmodule "sl.so" +loadmodule "tm.so" +loadmodule "maxfwd.so" +loadmodule "rr.so" +loadmodule "path.so" +loadmodule "uri.so" +loadmodule "textops.so" +loadmodule "usrloc.so" +loadmodule "nathelper.so" +loadmodule "dispatcher.so" +loadmodule "mi_fifo.so" +# loadmodule "mi_datagram.so" +# loadmodule "xlog.so" + +###################################################################### +## Memcached Module Parameters +###################################################################### +modparam("memcached", "server", "callid_hash = 127.0.0.1:11211") + +###################################################################### +## Stateless UA Module Parameters +###################################################################### +modparam("sl", "enable_stats", 1) + +###################################################################### +## SIP Transaction UA Module Parameters +###################################################################### +modparam("tm", "fr_timer", 5) +# modparam("tm", "fr_inv_timer", 60) +# modparam("tm", "wt_timer", 5) +# modparam("tm", "delete_timer", 2) +# modparam("tm", "T1_timer", 500) +# modparam("tm", "T2_timer", 4000) +# modparam("tm", "ruri_matching", 1) +# modparam("tm", "via1_matching", 1) +# modparam("tm", "unix_tx_timeout", 2) +# modparam("tm", "restart_fr_on_each_reply", 1) +# modparam("tm", "fr_timer_avp", "$avp(i:24)") +# modparam("tm", "fr_inv_timer_avp", "$avp(i:25)") +# modparam("tm", "tw_append", +# "test: ua=$hdr(User-Agent) ;avp=$avp(i:10);$rb;time=$Ts") +# modparam("tm", "pass_provisional_replies", 0) +# modparam("tm", "syn_branch", 1) +# modparam("tm", "onreply_avp_mode", 0) +# modparam("tm", "disable_6xx_block", 0) +# modparam("tm", "enable_stats", 1) +# modparam("tm", "minor_branch_flag", 3) + +###################################################################### +## Max Forward Module Parameters +###################################################################### +modparam("maxfwd", "max_limit", 30) + +###################################################################### +## Record Route Module Parameters +###################################################################### +modparam("rr", "enable_full_lr", 1) +modparam("rr", "append_fromtag", 1) +modparam("rr", "enable_double_rr", 0) +modparam("rr", "add_username", 0) + +###################################################################### +## Path Module Parameters +###################################################################### +modparam("path", "use_received", 1) + +###################################################################### +## URI Module Parameters +###################################################################### +# modparam("uri", "aaa_url", "radius:/etc/radiusclient-ng/radiusclient.conf") +modparam("uri", "use_sip_uri_host", 0) +modparam("uri", "use_uri_table", 0) +modparam("uri", "service_type", 10) +modparam("uri", "use_domain", 1) +modparam("uri", "use_uri_table", 0) +# modparam("uri", "db_url", "mysql://username:password@localhost/opensips") +# modparam("uri", "db_table", "uri") +# modparam("uri", "user_column", "username") +# modparam("uri", "domain_column", "domain") +# modparam("uri", "uriuser_column", "uri_user") + +###################################################################### +## User Location Module Parameters +###################################################################### +modparam("usrloc", "nat_bflag", 6) +modparam("usrloc", "use_domain", 1) +modparam("usrloc", "desc_time_order", 0) +modparam("usrloc", "timer_interval", 60) +modparam("usrloc", "matching_mode", 0) +modparam("usrloc", "cseq_delay", 20) +modparam("usrloc", "hash_size", 9) +modparam("usrloc", "db_mode", 0) +# modparam("usrloc", "db_url", "dbdriver://username:password@dbhost/dbname") +modparam("usrloc", "fetch_rows", 2000) +modparam("usrloc", "user_column", "username") +modparam("usrloc", "domain_column", "domain") +modparam("usrloc", "contact_column", "contact") +modparam("usrloc", "expires_column", "expires") +modparam("usrloc", "q_column", "q") +modparam("usrloc", "callid_column", "callid") +modparam("usrloc", "cseq_column", "cseq") +modparam("usrloc", "methods_column", "methods") +modparam("usrloc", "flags_column", "flags") +modparam("usrloc", "cflags_column", "cflags") +modparam("usrloc", "user_agent_column", "user_agent") +modparam("usrloc", "received_column", "received") +modparam("usrloc", "socket_column", "socket") +modparam("usrloc", "path_column", "path") + +###################################################################### +## Nathelper Module Parameters +###################################################################### +# modparam("nathelper", "rtpproxy_sock", "udp:127.0.0.1:7890") +modparam("nathelper", "natping_interval", 30) +modparam("nathelper", "ping_nated_only", 1) +# modparam("nathelper", "natping_processes", 3) +modparam("nathelper", "sipping_bflag", 7) +modparam("nathelper", "sipping_from", "sip:sipcheck@184.106.172.9 ") +# modparam("nathelper", "sipping_method", "INFO") + +###################################################################### +## Dispatcher Module Parameters +###################################################################### +modparam("dispatcher", "list_file", "/usr/local/etc/opensips/dispatcher.list") +modparam("dispatcher", "flags", 2) +modparam("dispatcher", "use_default", 0) +modparam("dispatcher", "force_dst", 1) +modparam("dispatcher", "dst_avp", "$avp(i:271)") +modparam("dispatcher", "attrs_avp", "$avp(i:272)") +modparam("dispatcher", "grp_avp", "$avp(i:273)") +modparam("dispatcher", "cnt_avp", "$avp(i:274)") +modparam("dispatcher", "hash_pvar", "$avp(i:273)") +# modparam("dispatcher", "setid_pvar", "$var(setid)") +modparam("dispatcher", "ds_ping_method", "OPTIONS") +modparam("dispatcher", "ds_ping_from", "sip:sipcheck@184.106.172.9:5060") +modparam("dispatcher", "ds_ping_interval", 10) +# modparam("dispatcher", "ds_ping_sock", "udp:10.80.25.168:5080") +modparam("dispatcher", "ds_probing_threshhold", 3) +modparam("dispatcher", "ds_probing_mode", 0) +modparam("dispatcher", "options_reply_codes", "501, 403, 404, 400") + +###################################################################### +## MI-FIFO Module Parameters +###################################################################### +modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo") + +###################################################################### +## MI-Datagram Module Parameters +###################################################################### +# modparam("mi_datagram", "socket_name", "udp:10.180.180.230:8889") +# modparam("mi_datagram", "children_count", 1) +# modparam("mi_datagram", "unix_socket_mode", 0600) +# modparam("mi_datagram", "unix_socket_group", "root") +# modparam("mi_datagram", "unix_socket_user", "root") +# modparam("mi_datagram", "socket_timeout", 2000) +# modparam("mi_datagram", "reply_indent", "\t") + +###################################################################### +## XLog Module Parameters +###################################################################### +# modparam("xlog", "buf_size", 4096) +# modparam("xlog", "force_color", 0) + +###################################################################### +## Multiple Module Parameters +###################################################################### + + +###################################################################### +## Main Request Routing +###################################################################### +route +{ + if (!mf_process_maxfwd_header("10")) + { + xlog("L_WARN", "To many hops to [$ou] from [$si:$sp]"); + + sl_send_reply("483", "We refuse to process this endless imbroglio"); + + exit; + } + + xlog("L_INFO", "Received [$rm] [$ou] from [$si:$sp]"); + xlog("L_DBG", " From: [$fu]"); + xlog("L_DBG", " To: [$tu]"); + + if (is_method("OPTIONS")) + { + xlog("L_NOTICE", " Method [$rm] is not supported, sending 503 to [$si:$sp]"); + + sl_send_reply("503", "Rawr!!"); + + exit; + } + + t_on_reply("1"); + + if (nat_uac_test("18")) + { + xlog("L_INFO", " Source port is different from the port in Via, force rport"); + + force_rport(); + + fix_nated_contact(); + + if (has_body("application/sdp")) + { + xlog("L_INFO", " Fixing nated SDP, rewritting media and origin with [$si]"); + + fix_nated_sdp("10"); + } + + # If this leads to a sucessfull register then flag 5 will cause nat=yes to be append to the contact + # and (when appropriate) the use of the nat_compensator reply branch + setflag(5); + } + + if (has_totag()) + { + if (subst_uri('/(sip:.*);nat=yes/\1/')) + { + xlog("L_INFO", " Set reply branch for NAT compensation on this message in the existing dialog"); + + t_on_reply("nat_compensator"); + } + + # sequential request withing a dialog should + # take the path determined by record-routing + if (loose_route()) + { + if (is_method("INVITE")) + { + # even if in most of the cases is useless, do RR for + # re-INVITEs alos, as some buggy clients do change route set + # during the dialog. + xlog("L_INFO", " Record route for loosely routed INVITE on an existing dialog"); + + #record_route(); + } + + # route it out to whatever destination was set by loose_route() + # in $du (destination URI). + route(1); + } + else + { + if ( is_method("ACK") ) + { + if ( t_check_trans() ) + { + # non loose-route, but stateful ACK; must be an ACK after + # a 487 or e.g. 404 from upstream server + xlog("L_INFO", " Forwarding a stateful ACK for a known dialog"); + + t_relay(); + + exit; + } + else + { + # ACK without matching transaction -> + # ignore and discard + xlog("L_NOTICE", " Recieved ACK from [$si:$sp] for unknown dialog, ignoring"); + + exit; + } + } + + xlog("L_WARN", " Recieved [$rm] for a dialog but the RR is invalid, sending 486 to [$si:$sp]"); + + sl_send_reply("486", "PC Load Letter"); + } + + exit; + } + + # CANCEL processing + if (is_method("CANCEL")) + { + # If this cancel is part of a transaction + # then pass it along to concerned parties + if (t_check_trans()) + { + t_relay(); + } + + exit; + } + + # If this is a retransmission it will break/stop the script + # and do standard processing of the message + t_check_trans(); + + # Since it is possible to suppress a second provisional response, the first one can be sent pre-emptively + sl_send_reply("100", "Thinking about it..."); + + # preloaded route checking + if (loose_route()) + { + if (!is_method("ACK")) + { + xlog("L_WARN", " Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci] from [$si:$sp]"); + + sl_send_reply("403", "Please leave the routing up to us"); + + exit; + } + } + + if (is_method("REGISTER")) + { + if (!add_path_received()) + { + xlog("L_ERR", " Unable to add path for [$rm] [$tu] from [$si:$sp], sending 503"); + + sl_send_reply("503", "Internal path befuddlement"); + + exit; + } + } + + # is not from media servers + if (!ds_is_in_list("$si", "$sp", "1")) + { + if(cache_fetch("memcached_callid_hash", "$ci", $avp(i:55))) + { + $rd = $avp(i:55); + + xlog("L_INFO", " Reconized call-id [$ci] as belonging to media server [$rd]"); + } + else + { + xlog("L_INFO", " Selecting domain from set 1 using round-robin"); + + ds_select_domain("1", "4"); + + xlog("L_INFO", " Selecting domain from set 1 using round-robin [$rd]"); + + t_on_failure("1"); + } + + append_hf("X-AUTH-IP: $si\r\n"); + + if (isflagset(5)) + { + xlog("L_INFO", " This contact is behind NAT, appending nat=yes to the Contact header"); + + # "nat=yes" is added to help with in-dialog re-INVITE, UPDATE, etc. + search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes'); + } + } + + # record routing + if (!is_method("REGISTER|MESSAGE")) + { + # Record the route that this request has taken + # so we remain in the signaling path + xlog("L_INFO", " Adding record route to this message"); + + record_route(); + } + + route(1); +} + +route[1] +{ + if (!t_relay()) + { + xlog("L_ERR", " Unable to relay [$rm] [$ru] to [$du], sending 500"); + + sl_reply_error(); + } + + xlog("L_INFO", " Sent [$rm] [$ru] to [$rd]"); + + exit; +} + +onreply_route[1] +{ + if (t_check_status("(407)|(401)")) + { + cache_store("memcached_callid_hash", "$ci ", "$si", 60); + + xlog("L_INFO", " Stored call-id [$ci] as belonging to media server [$si]"); + } +} + +onreply_route[nat_compensator] +{ + xlog("L_INFO ", " Compensating reply from NATed message [$rs] [$rr]"); + + if (t_check_status("(407)|(401)")) + { + cache_store("memcached_callid_hash", "$ci ", "$si", 60); + + xlog("L_INFO", " Stored call-id [$ci] for NATed reply as belonging to media server [$si]"); + } + + if (has_body("application/sdp")) + { + xlog("L_INFO", " Fixing nated reply SDP, rewritting media and origin with [$si]"); + + fix_nated_sdp("10"); + } + + if (is_present_hf("Contact")) + { + xlog("L_INFO", " Fixing nated reply contact header"); + + fix_nated_contact(); + #search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes'); + } +} + +failure_route[1] +{ + if (t_was_cancelled()) + { + exit; + } + + if (t_check_status("(408)|(5[0-9][0-9])")) + { + xlog("L_ERR", " Media server [$rd] did not reply, disabling"); + + ds_mark_dst(); + + if (ds_next_domain()) + { + xlog("L_ERR", " Hunting for avaliable media server..."); + + xlog("L_INFO", " Sent [$rm] [$ru] to [$rd]"); + + t_relay(); + + exit; + } + } + else if (isbflagset(16) && t_check_status("[34][0-9][0-9]")) + { + xlog("L_INFO", " Failed to route call from carrier, sending 486"); + + t_reply("486", "The ratio of people to cake is too big"); + } + + exit; +} From 0da24622cc926a82611f08068460b14968cacac4 Mon Sep 17 00:00:00 2001 From: Karl Anderson Date: Thu, 17 Feb 2011 17:43:58 -0800 Subject: [PATCH 08/11] we dont need this anymore --- sip_profiles/sipinterface_2.xml | 175 -------------------------------- 1 file changed, 175 deletions(-) delete mode 100644 sip_profiles/sipinterface_2.xml diff --git a/sip_profiles/sipinterface_2.xml b/sip_profiles/sipinterface_2.xml deleted file mode 100644 index a14640f..0000000 --- a/sip_profiles/sipinterface_2.xml +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> - - - - - - - - - - - - - - - From 02c1a144861a6322cd30a2c232540e04e1ac996b Mon Sep 17 00:00:00 2001 From: Lum Date: Sat, 19 Feb 2011 22:27:34 +0000 Subject: [PATCH 09/11] added velocity ip to acl for carriers --- autoload_configs/acl.conf.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autoload_configs/acl.conf.xml b/autoload_configs/acl.conf.xml index 606da7f..c4801d5 100644 --- a/autoload_configs/acl.conf.xml +++ b/autoload_configs/acl.conf.xml @@ -1,9 +1,10 @@ - + + From 87e0ce00489cc3b2c26081f69a0054af818d5c4f Mon Sep 17 00:00:00 2001 From: Karl Anderson Date: Wed, 2 Mar 2011 13:17:52 -0800 Subject: [PATCH 10/11] write to the syslogger --- autoload_configs/modules.conf.xml | 2 +- autoload_configs/syslog.conf.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/autoload_configs/modules.conf.xml b/autoload_configs/modules.conf.xml index 30d0aea..5cb1b90 100644 --- a/autoload_configs/modules.conf.xml +++ b/autoload_configs/modules.conf.xml @@ -3,7 +3,7 @@ - + diff --git a/autoload_configs/syslog.conf.xml b/autoload_configs/syslog.conf.xml index 423428e..a2fe46c 100644 --- a/autoload_configs/syslog.conf.xml +++ b/autoload_configs/syslog.conf.xml @@ -1,8 +1,8 @@ - + - + From 88bc742ae0648909fc7768fd1b9b3e5b525a4187 Mon Sep 17 00:00:00 2001 From: Karl Anderson Date: Mon, 14 Mar 2011 11:58:23 -0700 Subject: [PATCH 11/11] slight tweaks to the opensips.cfg --- opensips/opensips.cfg | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/opensips/opensips.cfg b/opensips/opensips.cfg index a95fcc4..bc9249f 100644 --- a/opensips/opensips.cfg +++ b/opensips/opensips.cfg @@ -25,7 +25,7 @@ tcp_children=8 ###################################################################### ## Core Logging Parameters ###################################################################### -debug=4 +debug=3 sip_warning=0 log_stderror=no log_facility=LOG_LOCAL0 @@ -430,7 +430,7 @@ route } # is not from media servers - if (!ds_is_in_list("$si", "$sp", "1")) + if (!ds_is_in_list("$si", "$sp", "1") and !ds_is_in_list("$si", "$sp", "2")) { if(cache_fetch("memcached_callid_hash", "$ci", $avp(i:55))) { @@ -444,8 +444,6 @@ route ds_select_domain("1", "4"); - xlog("L_INFO", " Selecting domain from set 1 using round-robin [$rd]"); - t_on_failure("1"); } @@ -533,9 +531,9 @@ failure_route[1] if (t_check_status("(408)|(5[0-9][0-9])")) { - xlog("L_ERR", " Media server [$rd] did not reply, disabling"); + xlog("L_ERR", " Media server [$rd] replied with error [$rs] for [$ru], disabling"); - ds_mark_dst(); + ds_mark_dst("p"); if (ds_next_domain()) { @@ -548,7 +546,7 @@ failure_route[1] exit; } } - else if (isbflagset(16) && t_check_status("[34][0-9][0-9]")) + else if(!cache_fetch("memcached_callid_hash", "$ci", $avp(i:55))) { xlog("L_INFO", " Failed to route call from carrier, sending 486");