update libosip2 and siproxd (patch by Alina Friedrichsen)
authorFelix Fietkau <nbd@openwrt.org>
Mon, 4 Feb 2008 22:22:57 +0000 (22:22 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 4 Feb 2008 22:22:57 +0000 (22:22 +0000)
SVN-Revision: 10385

libs/libosip2/Makefile
net/siproxd/Makefile
net/siproxd/files/siproxd.config [new file with mode: 0644]
net/siproxd/files/siproxd.init

index b57c283..eb12963 100644 (file)
@@ -4,17 +4,17 @@
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
-# $Id$
+# $Id: Makefile 9947 2007-12-27 02:12:04Z nbd $
 
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libosip2
-PKG_VERSION:=2.2.0
+PKG_VERSION:=3.0.3
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@GNU/osip
-PKG_MD5SUM:=f1237af0250c59b318bd64a59f5750ea
+PKG_MD5SUM:=f90ae77075fbd8693af7c78998fcf151
 
 PKG_FIXUP = libtool
 
@@ -41,14 +41,8 @@ CONFIGURE_ARGS+= \
        --enable-semaphore \
        --enable-ntimer \
 
-define Build/Configure
-       $(call Build/Configure/Default)
-endef
-
 define Build/Compile
-       $(MAKE) -C $(PKG_BUILD_DIR) all
-       $(call libtool_fixup_libdir,$(PKG_INSTALL_DIR))
-       $(MAKE) -C $(PKG_BUILD_DIR) DESTDIR="$(PKG_INSTALL_DIR)" install
+       $(MAKE) -C $(PKG_BUILD_DIR) DESTDIR="$(PKG_INSTALL_DIR)" all install
 endef
 
 define Build/InstallDev
@@ -62,7 +56,7 @@ endef
 
 define Package/libosip2/install
        $(INSTALL_DIR) $(1)/usr/lib
-       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libosip{,parser}2.so.* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libosip{,parser}2.so $(PKG_INSTALL_DIR)/usr/lib/libosip{,parser}2.so.* $(1)/usr/lib/
 endef
 
 $(eval $(call BuildPackage,libosip2))
index de78300..fdcc9a2 100644 (file)
@@ -4,17 +4,17 @@
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
-# $Id$
+# $Id: Makefile 9695 2007-12-09 18:59:01Z nbd $
 
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=siproxd
-PKG_VERSION:=0.5.13
+PKG_VERSION:=0.7.0
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@SF/siproxd
-PKG_MD5SUM:=91a572f80dd5a9af5a0f7f207fd34478
+PKG_MD5SUM:=6c978eef0d00160e50073e2e2fd8c23d
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
@@ -29,12 +29,12 @@ define Package/siproxd
   URL:=http://siproxd.sourceforge.net/
 endef
 
-define Package/siproxd/conffiles
-/etc/siproxd.conf
-endef
+#define Package/siproxd/conffiles
+#/etc/siproxd.conf
+#endef
 
 # uses GNU configure
-       
+
 define Build/Compile
        $(MAKE) -C $(PKG_BUILD_DIR) \
                DESTDIR="$(PKG_INSTALL_DIR)" \
@@ -45,9 +45,11 @@ endef
 define Package/siproxd/install
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/siproxd $(1)/usr/sbin/
-       $(INSTALL_DIR) $(1)/etc
-       $(INSTALL_DATA) $(PKG_BUILD_DIR)/doc/siproxd.conf.example $(1)/etc/siproxd.conf
-       $(INSTALL_CONF) $(PKG_BUILD_DIR)/doc/siproxd_passwd.cfg $(1)/etc/
+#      $(INSTALL_DIR) $(1)/etc
+#      $(INSTALL_DATA) $(PKG_BUILD_DIR)/doc/siproxd.conf.example $(1)/etc/siproxd.conf
+#      $(INSTALL_CONF) $(PKG_BUILD_DIR)/doc/siproxd_passwd.cfg $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/siproxd.config $(1)/etc/config/siproxd
        $(INSTALL_DIR) $(1)/etc/init.d
        $(INSTALL_BIN) ./files/siproxd.init $(1)/etc/init.d/siproxd
 endef
diff --git a/net/siproxd/files/siproxd.config b/net/siproxd/files/siproxd.config
new file mode 100644 (file)
index 0000000..3904b91
--- /dev/null
@@ -0,0 +1,3 @@
+config siproxd general
+       option if_inbound       'lan'
+       option if_outbound      'wan'
index eaec551..03fb58b 100644 (file)
 #!/bin/sh /etc/rc.common
-# Copyright (C) 2006 OpenWrt.org
-START=50
+# Copyright (C) 2008 Alina Friedrichsen
 
-BIN=siproxd
-DEFAULT=/etc/default/$BIN
-RUN_D=/var/run
-PID_F=$RUN_D/$BIN.pid
+START=50
 
 start() {
-       [ -f $DEFAULT ] && . $DEFAULT
-       mkdir -p $RUN_D
-       $BIN $OPTIONS
+       local ifname
+       local cfgt
+
+       option_cb() {
+               local varname="$1"
+               local value="$2"
+               local cfg="$CONFIG_SECTION"
+               local cfgt
+               local item
+               local c
+
+               config_get cfgt "$cfg" TYPE
+
+               if [ "$cfgt" == siproxd ]; then
+                       if [ "$varname" == config_file ]; then
+                               CONFIG_FILE="$value"
+                       elif [ "$varname" == if_inbound ]; then
+                               IF_INBOUND="$value"
+                       elif [ "$varname" == if_outbound ]; then
+                               IF_OUTBOUND="$value"
+                       elif [ "$varname" == mask_host ]; then
+                               c=0
+                               for item in $value
+                               do
+                                       if [ "$((c % 2))" -eq 0 ]; then
+                                               printf '%s\n' "mask_host = $item" >> /var/etc/siproxd.conf
+                                       else
+                                               printf '%s\n' "masked_host = $item" >> /var/etc/siproxd.conf
+                                       fi
+                                       c=$((c + 1))
+                               done
+                       elif [ "$varname" == outbound_domain ]; then
+                               c=0
+                               for item in $value
+                               do
+                                       if [ "$((c % 3))" -eq 0 ]; then
+                                               printf '%s\n' "outbound_domain_name = $item" >> /var/etc/siproxd.conf
+                                       elif [ "$((c % 3))" -eq 1 ]; then
+                                               printf '%s\n' "outbound_domain_host = $item" >> /var/etc/siproxd.conf
+                                       else
+                                               printf '%s\n' "outbound_domain_port = $item" >> /var/etc/siproxd.conf
+                                       fi
+                                       c=$((c + 1))
+                               done
+                       elif [ "$varname" == pi_shortdial_entry ]; then
+                               for item in $value
+                               do
+                                       printf '%s\n' "pi_shortdial_entry = $item" >> /var/etc/siproxd.conf
+                               done
+                       else
+                               if [ "$varname" == hosts_allow_reg -o "$varname" == hosts_allow_sip -o "$varname" == hosts_deny_sip ]; then
+                                       value=$(printf '%s' "$value" | tr -s '\t ' ',')
+                               fi
+                               [ "$varname" == sip_listen_port ] && SIP_LISTEN_PORT=""
+                               [ "$varname" == daemonize ] && DAEMONIZE=""
+                               [ "$varname" == silence_log ] && SILENCE_LOG=""
+                               [ "$varname" == log_calls ] && LOG_CALLS=""
+                               [ "$varname" == user ] && USER=""
+                               [ "$varname" == registration_file ] && REGISTRATION_FILE=""
+                               [ "$varname" == pid_file ] && PID_FILE=""
+                               [ "$varname" == rtp_proxy_enable ] && RTP_PROXY_ENABLE=""
+                               [ "$varname" == rtp_port_low ] && RTP_PORT_LOW=""
+                               [ "$varname" == rtp_port_high ] && RTP_PORT_HIGH=""
+                               [ "$varname" == rtp_timeout ] && RTP_TIMEOUT=""
+                               [ "$varname" == default_expires ] && DEFAULT_EXPIRES=""
+                               [ "$varname" == debug_level ] && DEBUG_LEVEL=""
+                               [ "$varname" == debug_port ] && DEBUG_PORT=""
+                               printf '%s\n' "$varname = $value" >> /var/etc/siproxd.conf
+                       fi
+               fi
+       }
+
+       mkdir -p /var/etc
+       > /var/etc/siproxd.conf
+       mkdir -p /var/lib/siproxd
+       chmod 777 /var/lib/siproxd
+       mkdir -p /var/run/siproxd
+       chmod 777 /var/run/siproxd
+       CONFIG_FILE=/var/etc/siproxd.conf
+       SIP_LISTEN_PORT=5060
+       DAEMONIZE=1
+       SILENCE_LOG=0
+       LOG_CALLS=1
+       USER=nobody
+       REGISTRATION_FILE=/var/lib/siproxd/siproxd_registrations
+       PID_FILE=/var/run/siproxd/siproxd.pid
+       RTP_PROXY_ENABLE=1
+       RTP_PORT_LOW=7070
+       RTP_PORT_HIGH=7089
+       RTP_TIMEOUT=300
+       DEFAULT_EXPIRES=600
+       DEBUG_LEVEL=0x00000000
+       DEBUG_PORT=0
+       config_load siproxd
+       [ -n "$SIP_LISTEN_PORT" ] && printf '%s\n' "sip_listen_port = $SIP_LISTEN_PORT" >> /var/etc/siproxd.conf
+       [ -n "$DAEMONIZE" ] && printf '%s\n' "daemonize = $DAEMONIZE" >> /var/etc/siproxd.conf
+       [ -n "$SILENCE_LOG" ] && printf '%s\n' "silence_log = $SILENCE_LOG" >> /var/etc/siproxd.conf
+       [ -n "$LOG_CALLS" ] && printf '%s\n' "log_calls = $LOG_CALLS" >> /var/etc/siproxd.conf
+       [ -n "$USER" ] && printf '%s\n' "user = $USER" >> /var/etc/siproxd.conf
+       [ -n "$REGISTRATION_FILE" ] && printf '%s\n' "registration_file = $REGISTRATION_FILE" >> /var/etc/siproxd.conf
+       [ -n "$PID_FILE" ] && printf '%s\n' "pid_file = $PID_FILE" >> /var/etc/siproxd.conf
+       [ -n "$RTP_PROXY_ENABLE" ] && printf '%s\n' "rtp_proxy_enable = $RTP_PROXY_ENABLE" >> /var/etc/siproxd.conf
+       [ -n "$RTP_PORT_LOW" ] && printf '%s\n' "rtp_port_low = $RTP_PORT_LOW" >> /var/etc/siproxd.conf
+       [ -n "$RTP_PORT_HIGH" ] && printf '%s\n' "rtp_port_high = $RTP_PORT_HIGH" >> /var/etc/siproxd.conf
+       [ -n "$RTP_TIMEOUT" ] && printf '%s\n' "rtp_timeout = $RTP_TIMEOUT" >> /var/etc/siproxd.conf
+       [ -n "$DEFAULT_EXPIRES" ] && printf '%s\n' "default_expires = $DEFAULT_EXPIRES" >> /var/etc/siproxd.conf
+       [ -n "$DEBUG_LEVEL" ] && printf '%s\n' "debug_level = $DEBUG_LEVEL" >> /var/etc/siproxd.conf
+       [ -n "$DEBUG_PORT" ] && printf '%s\n' "debug_port = $DEBUG_PORT" >> /var/etc/siproxd.conf
+       reset_cb
+       include /lib/network
+       scan_interfaces
+       config_load /var/state/network
+       if [ -n "$IF_INBOUND" ]; then
+               config_get IF_INBOUND "$IF_INBOUND" ifname
+               printf '%s\n' "if_inbound = $IF_INBOUND" >> /var/etc/siproxd.conf
+       fi
+       if [ -n "$IF_OUTBOUND" ]; then
+               config_get IF_OUTBOUND "$IF_OUTBOUND" ifname
+               printf '%s\n' "if_outbound = $IF_OUTBOUND" >> /var/etc/siproxd.conf
+       fi
+       /usr/sbin/siproxd --config "$CONFIG_FILE"
 }
 
 stop() {
-       [ -f $PID_F ] && kill $(cat $PID_F)
+       killall siproxd
 }
-