From: <abe...@us...> - 2014-08-30 23:25:51
|
Revision: 6679 http://sourceforge.net/p/astlinux/code/6679 Author: abelbeck Date: 2014-08-30 23:25:47 +0000 (Sat, 30 Aug 2014) Log Message: ----------- kamailio, start rtpproxy automatically when WITH_NAT is defined, add RTPPROXY_PORT_RANGE, RTPPROXY_LISTEN_IP and RTPPROXY_LISTEN_IPV6 variables, remove RTPPROXY_IP and RTPPROXY_TOS variables Modified Paths: -------------- branches/1.0/package/kamailio/kamailio.init branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf Modified: branches/1.0/package/kamailio/kamailio.init =================================================================== --- branches/1.0/package/kamailio/kamailio.init 2014-08-29 23:41:17 UTC (rev 6678) +++ branches/1.0/package/kamailio/kamailio.init 2014-08-30 23:25:47 UTC (rev 6679) @@ -19,6 +19,26 @@ fi } +rtpproxy_enabled() +{ + local WITH_NAT='^#!define[ ][ ]*WITH_NAT[ ]*$' + + if [ ! -x /usr/bin/rtpproxy ]; then + return 1 + fi + + if [ -f /etc/kamailio/kamailio-local.cfg ]; then + if grep -q -e "$WITH_NAT" /etc/kamailio/kamailio-local.cfg; then + return 0 + fi + fi + if grep -q -e "$WITH_NAT" /etc/kamailio/kamailio.cfg; then + return 0 + fi + + return 1 +} + init () { if [ -d /mnt/kd/kamailio ]; then @@ -58,13 +78,18 @@ if [ -f /etc/kamailio/kamailio.cfg ]; then - if [ -x /usr/bin/rtpproxy -a -n "$RTPPROXY_IP" ]; then + if rtpproxy_enabled; then echo "Starting rtpproxy..." rtpproxy_socket="${RTPPROXY_SOCKET:-udp:127.0.0.1:7722}" - rtpproxy_tos="${RTPPROXY_TOS:-0x18}" + min_port="$(echo "$RTPPROXY_PORT_RANGE" | cut -s -d':' -f1)" + min_port="${min_port:-16384}" + max_port="$(echo "$RTPPROXY_PORT_RANGE" | cut -s -d':' -f2)" + max_port="${max_port:-16639}" - rtpproxy -l "$RTPPROXY_IP" -s "$rtpproxy_socket" -t "$rtpproxy_tos" -u "kamailio:kamailio" + rtpproxy -u "kamailio:kamailio" -s "$rtpproxy_socket" -m "$min_port" -M "$max_port" \ + ${RTPPROXY_LISTEN_IP:+-l "$RTPPROXY_LISTEN_IP"} \ + ${RTPPROXY_LISTEN_IPV6:+-6 "$RTPPROXY_LISTEN_IPV6"} fi echo "Starting kamailio..." Modified: branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf =================================================================== --- branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf 2014-08-29 23:41:17 UTC (rev 6678) +++ branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf 2014-08-30 23:25:47 UTC (rev 6679) @@ -520,6 +520,13 @@ #LDAP_SERVER_CERT="" # Defaults to "/mnt/kd/ldap/certs/server.crt" using SIP-TLS cert #LDAP_SERVER_KEY="" # Defaults to "/mnt/kd/ldap/certs/server.key" using SIP-TLS key +## RTPproxy +## RTPproxy is automatically enabled by Kamailio if installed +#RTPPROXY_SOCKET="udp:127.0.0.1:7722" # Must match what Kamailio expects, defaults to "udp:127.0.0.1:7722" +#RTPPROXY_PORT_RANGE="16384:16639" # UDP port range, defaults to 16384 through 16639 +#RTPPROXY_LISTEN_IP="0.0.0.0" # IPv4 listen address, defaults to "0.0.0.0" +#RTPPROXY_LISTEN_IPV6="" # IPv6 listen address, defaults to none + ## Proxy ENV variables (http_proxy, ftp_proxy, etc.) for curl, wget, etc. ## Format: http://user:pass@proxyhost:proxyport" ## The "user" and "pass" are optional This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |