aboutsummaryrefslogtreecommitdiffstats
path: root/package/owsip
diff options
context:
space:
mode:
authorblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-10-05 10:12:53 +0000
committerblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-10-05 10:12:53 +0000
commit5c105d9f3fd086aff195d3849dcf847d6b0bd927 (patch)
tree1229a11f725bfa58aa7c57a76898553bb5f6654a /package/owsip
downloadopenwrt-5c105d9f3fd086aff195d3849dcf847d6b0bd927.tar.gz
openwrt-5c105d9f3fd086aff195d3849dcf847d6b0bd927.zip
branch Attitude Adjustment
git-svn-id: svn://svn.openwrt.org/openwrt/branches/attitude_adjustment@33625 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/owsip')
-rw-r--r--package/owsip/Makefile73
-rw-r--r--package/owsip/files/telephony.conf32
-rwxr-xr-xpackage/owsip/files/telephony.defaults55
-rw-r--r--package/owsip/files/telephony.init33
4 files changed, 193 insertions, 0 deletions
diff --git a/package/owsip/Makefile b/package/owsip/Makefile
new file mode 100644
index 000000000..4dcf1efdf
--- /dev/null
+++ b/package/owsip/Makefile
@@ -0,0 +1,73 @@
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+OWSIP_VERSION=2012-02-14
+OWSIP_RELEASE=1
+
+PKG_NAME:=owsip
+PKG_VERSION:=$(OWSIP_VERSION)$(if $(OWSIP_RELEASE),.$(OWSIP_RELEASE))
+PKG_RELEASE:=1
+PKG_REV:=da53a53db28b47ca1714ffba72d0df5bea357706
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=git://nbd.name/owsip.git
+PKG_SOURCE_SUBDIR:=owsip-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_PROTO:=git
+PKG_MIRROR_MD5SUM:=74b0ab930321c4f85f220ff3852e210a
+
+include $(INCLUDE_DIR)/ltqtapi.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/owsip-template
+ SUBMENU:=Telephony
+ SECTION:=net
+ CATEGORY:=Network
+ TITLE:=owsip using $(2)
+ VARIANT:=$(1)
+ DEPENDS:=+librt +libuci +libubox +pjsip-$(1) $(3)
+endef
+
+Package/owsip-oss=$(call Package/owsip-template,oss,OSS,BROKEN)
+Package/owsip-ltq-tapi=$(call Package/owsip-template,ltq-tapi,Lantiq VMMC,$(LTQ_TAPI_DEPENDS) +kmod-ltq-kpi2udp)
+
+define Package/owsip-$(BUILD_VARIANT)/description
+ OpenWrt sip daemon - $(BUILD_VARIANT)
+endef
+
+USE_LOCAL=$(shell ls ./src/ 2>/dev/null >/dev/null && echo 1)
+ifneq ($(USE_LOCAL),)
+define Build/Prepare
+ $(CP) ./src/* $(PKG_BUILD_DIR)/
+endef
+endif
+
+EXTRA_CFLAGS=-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include \
+ -I$(STAGING_DIR)/usr/pjsip-$(BUILD_VARIANT)/include
+EXTRA_LDFLAGS=-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/usr/pjsip-$(BUILD_VARIANT)/lib
+
+define Build/Compile
+ PKG_CONFIG_PATH=$(STAGING_DIR)/usr/pjsip-$(BUILD_VARIANT)/lib/pkgconfig \
+ BACKEND=$(BUILD_VARIANT) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS="$(EXTRA_LDFLAGS)" $(MAKE) -C $(PKG_BUILD_DIR) $(TARGET_CONFIGURE_OPTS)
+endef
+
+define Package/owsip-$(BUILD_VARIANT)/conffiles
+/etc/config/telephony.conf
+endef
+
+define Package/owsip-$(BUILD_VARIANT)/install
+ $(INSTALL_DIR) $(1)/usr/bin $(1)/etc/init.d $(1)/etc/config $(1)/etc/uci-defaults
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/owsip_ua $(1)/usr/bin
+ $(INSTALL_BIN) ./files/telephony.init $(1)/etc/init.d/telephony
+ $(INSTALL_DATA) ./files/telephony.conf $(1)/etc/config/telephony
+ $(INSTALL_DATA) ./files/telephony.defaults $(1)/etc/uci-defaults/telephony
+endef
+
+$(eval $(call BuildPackage,owsip-oss))
+$(eval $(call BuildPackage,owsip-ltq-tapi))
diff --git a/package/owsip/files/telephony.conf b/package/owsip/files/telephony.conf
new file mode 100644
index 000000000..7cc1e9f0f
--- /dev/null
+++ b/package/owsip/files/telephony.conf
@@ -0,0 +1,32 @@
+config general general
+ option name owsip
+ option backend ltq_tapi
+ option ossdev 0
+ option log_level 3
+ option interface nas0
+ option local_port 5060
+ option rtp_port 4000
+ option locale germany
+
+config stun stun
+ option host stun.myrealm.com
+ option port 3478
+
+config account example1
+ option realm myrealm1.com
+ option username myuser1
+ option password mypass1
+ option disabled 1
+
+config account example2
+ option realm myrealm2.com
+ option username myuser2
+ option password mypass2
+ option disabled 1
+
+config contact
+ option desc "example contact description"
+ option code "example"
+ option dial "0123456789"
+ option type realm
+
diff --git a/package/owsip/files/telephony.defaults b/package/owsip/files/telephony.defaults
new file mode 100755
index 000000000..bec2878a0
--- /dev/null
+++ b/package/owsip/files/telephony.defaults
@@ -0,0 +1,55 @@
+#!/bin/sh
+#
+# Copyright (C) 2011 OpenWrt.org
+# based on ar71xx
+#
+
+COMMIT_TELEPHONY=0
+
+set_relay() {
+ local cfg="relay_$1"
+ local gpio=$1
+ local val=$2
+
+ uci -q get telephony.$cfg && return 0
+
+ uci batch <<EOF
+set telephony.$cfg='relay'
+set telephony.$cfg.gpio='$gpio'
+set telephony.$cfg.value='$val'
+EOF
+ COMMIT_TELEPHONY=1
+}
+
+set_port() {
+ local cfg="port$1"
+ local id=$1
+ local led=$2
+
+ uci -q get telephony.$cfg && return 0
+
+ uci batch <<EOF
+set telephony.$cfg='port'
+set telephony.$cfg.id='$id'
+set telephony.$cfg.led='$led'
+set telephony.$cfg.noring='0'
+set telephony.$cfg.nodial='0'
+EOF
+ COMMIT_TELEPHONY=1
+}
+
+. /lib/lantiq.sh
+
+board=$(lantiq_board_name)
+
+case "$board" in
+ARV7525PW)
+ set_relay 31 1
+ set_port 0 "soc:green:fxs1"
+ #set_port 1 "soc:green:fxs2"
+ ;;
+esac
+
+[ "$COMMIT_TELEPHONY" == "1" ] && uci commit telephony
+
+exit 0
diff --git a/package/owsip/files/telephony.init b/package/owsip/files/telephony.init
new file mode 100644
index 000000000..90909e625
--- /dev/null
+++ b/package/owsip/files/telephony.init
@@ -0,0 +1,33 @@
+#!/bin/sh /etc/rc.common
+START=80
+
+SERVICE_WRITE_PID=1
+SERVICE_DAEMONIZE=1
+SERVICE_PID_FILE=/var/run/owsip.pid
+
+. /lib/functions.sh
+
+relay_set () {
+ local cfg="$1"
+ local gpio value
+
+ config_get gpio "$cfg" gpio
+ config_get value "$cfg" value
+ [ -n "gpio" ] || return 0
+ [ ! -f "/sys/class/gpio/gpio$gpio/direction" ] &&
+ echo "$gpio" > /sys/class/gpio/export
+ [ -f "/sys/class/gpio/gpio$gpio/direction" ] && {
+ echo "out" > /sys/class/gpio/gpio$gpio/direction
+ echo "$value" > /sys/class/gpio/gpio$gpio/value
+ }
+}
+
+start() {
+ config_load telephony
+ config_foreach relay_set relay
+ service_start /usr/bin/owsip_ua
+}
+
+stop() {
+ service_stop /usr/bin/owsip_ua
+}