#!/bin/sh # $Id$ . /etc/sysconfig/config check_ppp() { # if [ "$WAIT_PPP" ]; then # sleep $WAIT_PPP # fi PPP_IP=none if [ -d /proc/sys/net/ipv4/conf/ppp0 ]; then PPP_IP=`/sbin/ifconfig ppp0 | while read str1 str2 str3; do if [ "${str1}" = "inet" ]; then echo ${str2} fi done | sed -e 's/addr://'` fi if [ "$PPP_IP" = "none" ]; then PPP_IP=`/sbin/ifconfig br0 | while read str1 str2 str3; do if [ "${str1}" = "inet" ]; then echo ${str2} fi done | sed -e 's/addr://'` fi } start() { /etc/rc.d/scripts/rmsdev stop check_ppp if [ "$VOIP_PROTO" = "H323" ]; then if [ "$VOIP_H323_GK" = "YES" ]; then sed -e 's/^MANUALRAS/#/' -e 's/^MANUALREG/#/' \ -e "s/^GKIP/+ ip = <$VOIP_H323_GK_ADDR>/" \ -e "s/^GKPORT/ port = $VOIP_H323_GK_PORT/" \ -e "s/^H323ID/+ h323-ID = \"$VOIP_H323_ID\"/" \ -e "s/^H323E164/+ e164 = \'$VOIP_H323_E164\'/" \ -e "s/^#3 doNotUseProperty = 0/2 localIPAddress = <$PPP_IP>/" \ /usr/share/h323/config.val > /tmp/config.val H323_OPTIONS="-g" else sed -e 's/^MANUALRAS/ manualRAS=1/' \ -e 's/^MANUALREG/ manualRegistration = 0/' \ -e "s/^GKIP/+ ip = [7f000001]/" \ -e "s/^GKPORT/ port = 1819/" \ -e "s/^H323ID/+ h323-ID = \"TEST\"/" \ -e "s/^H323E164/+ e164 = '12354'/" \ -e "s/^#3 doNotUseProperty = 0/2 localIPAddress = <$PPP_IP>/" \ /usr/share/h323/config.val > /tmp/config.val H323_OPTIONS="" fi cd /tmp /usr/sbin/h323 $H323_OPTIONS & else if [ "$VOIP_SIP_IF" = "" ]; then SIP=sip-br0 elif [ "$VOIP_SIP_IF" = "ppp0" ]; then if [ -d /proc/sys/net/ipv4/conf/ppp0 ]; then SIP=sip-ppp0 else SIP=sip-br0 fi elif [ "$VOIP_SIP_IF" = "br0" ]; then SIP=sip-br0 elif [ "$VOIP_SIP_IF" = "eth0" ]; then SIP=sip-eth0 fi if [ "$VOIP_SIP_RS" = "YES" ]; then # SIP_OPTION=" -r $VOIP_SIP_E164@$VOIP_SIP_RS_ADDR &" SIP_OPTION=" -r $VOIP_SIP_E164@$PPP_IP:15060 &" else SIP_OPTION="" fi cd /tmp /usr/sbin/$SIP $SIP_OPTION > /dev/null 2>&1 & fi sleep 5 /etc/rc.d/scripts/rmsdev start } stop() { killall h323 > /dev/null 2>&1 killall sip-br0 > /dev/null 2>&1 killall sip-eth0 > /dev/null 2>&1 killall sip-ppp0 > /dev/null 2>&1 } case "$1" in start) start ;; stop) stop ;; restart|reload) stop start ;; esac exit 0;