From b55daa66c968495adcd44b9279ed632c737aac75 Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Thu, 14 Sep 2017 20:56:35 +0200 Subject: [PATCH 1/2] asterisk-chan-dongle: sync up with master, fix endian issue - Sync module to master. - Drop big endian patch as it was included upstream. - This fixes endian issue reported at https://github.com/wdoekes/asterisk-chan-dongle/issues/44. Signed-off-by: Sebastian Kemper --- net/asterisk-chan-dongle/Makefile | 4 +- .../100-fix-audio-on-big-endian-systems.patch | 46 ------------------- 2 files changed, 2 insertions(+), 48 deletions(-) delete mode 100644 net/asterisk-chan-dongle/patches/100-fix-audio-on-big-endian-systems.patch diff --git a/net/asterisk-chan-dongle/Makefile b/net/asterisk-chan-dongle/Makefile index 43ed2d3..1e53e9e 100644 --- a/net/asterisk-chan-dongle/Makefile +++ b/net/asterisk-chan-dongle/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=asterisk-chan-dongle -PKG_VERSION:=1.1-20170724 +PKG_VERSION:=1.1-20170913 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=git://github.com/wdoekes/asterisk-chan-dongle.git PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=1e452f7598266be0970cec582ba32dbc5568868d +PKG_SOURCE_VERSION:=4ef5ad7eea7245a031101875be08b924aa1e151b PKG_SOURCE_PROTO:=git PKG_FIXUP:=autoreconf diff --git a/net/asterisk-chan-dongle/patches/100-fix-audio-on-big-endian-systems.patch b/net/asterisk-chan-dongle/patches/100-fix-audio-on-big-endian-systems.patch deleted file mode 100644 index 768782b..0000000 --- a/net/asterisk-chan-dongle/patches/100-fix-audio-on-big-endian-systems.patch +++ /dev/null @@ -1,46 +0,0 @@ ---- a/channel.c -+++ b/channel.c -@@ -539,6 +539,19 @@ again: - } - } - -+// see https://github.com/openwrt/telephony/issues/7 -+static inline void change_audio_endianness_to_le(struct iovec *iov, int iovcnt) -+{ -+#if __BYTE_ORDER == __LITTLE_ENDIAN -+ return; // nothing to do -+#else -+ for(;iovcnt-->0;iov++) -+ { -+ ast_swapcopy_samples(iov->iov_base, iov->iov_base, iov->iov_len/2); -+ } -+#endif -+} -+ - #/* */ - static void timing_write (struct pvt* pvt) - { -@@ -566,6 +579,7 @@ static void timing_write (struct pvt* pv - iovcnt = mixb_read_n_iov (&pvt->a_write_mixb, iov, FRAME_SIZE); - mixb_read_n_iov (&pvt->a_write_mixb, iov, FRAME_SIZE); - mixb_read_upd (&pvt->a_write_mixb, FRAME_SIZE); -+ change_audio_endianness_to_le(iov, iovcnt); - } - else if (used > 0) - { -@@ -579,6 +593,7 @@ static void timing_write (struct pvt* pv - iov[iovcnt].iov_base = silence_frame; - iov[iovcnt].iov_len = FRAME_SIZE - used; - iovcnt++; -+ change_audio_endianness_to_le(iov, iovcnt); - } - else - { -@@ -588,6 +603,7 @@ static void timing_write (struct pvt* pv - iov[0].iov_base = silence_frame; - iov[0].iov_len = FRAME_SIZE; - iovcnt = 1; -+ // ignore endianness for zeros - // continue; - } - From fe2f6f996bf0066f4462502926478aab1e4cce73 Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Thu, 14 Sep 2017 21:02:57 +0200 Subject: [PATCH 2/2] asterisk-chan-lantiq: Move to separate package Currently chan-lantiq doesn't build on the build bots and users end up having to build it themselves. The reason for this was explained by Mathias Kresin here: http://lists.infradead.org/pipermail/lede-dev/2017-September/008886.html. To fix this put chan-lantiq into its own package and set PKG_FLAGS:=nonshared. The new package uses variants already, so it is easily extendable in the future. Signed-off-by: Sebastian Kemper --- net/asterisk-13.x/Makefile | 34 -------- net/asterisk-chan-lantiq/Makefile | 87 +++++++++++++++++++ .../files/chan_lantiq-asterisk13.c} | 0 .../files/default.exports | 8 ++ .../files/lantiq-asterisk13.conf.sample} | 0 5 files changed, 95 insertions(+), 34 deletions(-) create mode 100644 net/asterisk-chan-lantiq/Makefile rename net/{asterisk-13.x/src-lantiq/channels/chan_lantiq.c => asterisk-chan-lantiq/files/chan_lantiq-asterisk13.c} (100%) create mode 100644 net/asterisk-chan-lantiq/files/default.exports rename net/{asterisk-13.x/src-lantiq/configs/samples/lantiq.conf.sample => asterisk-chan-lantiq/files/lantiq-asterisk13.conf.sample} (100%) diff --git a/net/asterisk-13.x/Makefile b/net/asterisk-13.x/Makefile index 299faa4..b98ab9b 100644 --- a/net/asterisk-13.x/Makefile +++ b/net/asterisk-13.x/Makefile @@ -81,32 +81,6 @@ $(foreach b,$(8),$(call Package/asterisk13/install/sbin,$$(1),$(b));) $$(eval $$(call BuildPackage,asterisk13-$(1))) endef -define BuildAsterisk13NonSharedModule - define Package/asterisk13-$(1) - $$(call Package/asterisk13/Default) - TITLE:=$(2) support - DEPENDS:= asterisk13 $(patsubst +%,+PACKAGE_asterisk13-$(1):%,$(4)) - PKG_FLAGS:=nonshared - endef - - define Package/asterisk13-$(1)/conffiles -$(subst $(space),$(newline),$(foreach c,$(5),/etc/asterisk/$(c))) - endef - - define Package/asterisk13-$(1)/description -This package provides support for '$(3)' in Asterisk. - endef - - define Package/asterisk13-$(1)/install -$(foreach c,$(5),$(call Package/asterisk13/install/conffile,$$(1),$(c));) -$(foreach m,$(6),$(call Package/asterisk13/install/module,$$(1),$(m));) -$(foreach s,$(7),$(call Package/asterisk13/install/sounds,$$(1),$(s));) -$(foreach b,$(8),$(call Package/asterisk13/install/sbin,$$(1),$(b));) - endef - - $$(eval $$(call BuildPackage,asterisk13-$(1))) -endef - define Package/asterisk13/Default SUBMENU:=Telephony SECTION:=net @@ -276,13 +250,6 @@ AST_MENUSELECT_OPTS = \ --without-curses \ --with-libxml2="$(STAGING_DIR_HOSTPKG)/usr" -define Build/Prepare - $(call Build/Prepare/Default) -ifneq ($(CONFIG_TARGET_lantiq),) - $(CP) ./src-lantiq/* $(PKG_BUILD_DIR)/ -endif -endef - define Build/Configure cd $(PKG_BUILD_DIR); \ ./bootstrap.sh @@ -375,7 +342,6 @@ $(eval $(call BuildAsterisk13Module,cdr-sqlite3,Provides CDR SQLITE3,Call Detail $(eval $(call BuildAsterisk13Module,chan-alsa,ALSA channel,the channel chan_alsa,+alsa-lib,alsa.conf,chan_alsa,,)) $(eval $(call BuildAsterisk13Module,chan-dahdi,DAHDI channel,DAHDI channel support,+dahdi-tools-libtonezone +kmod-dahdi +libpri @!aarch64,chan_dahdi.conf,chan_dahdi,,)) $(eval $(call BuildAsterisk13Module,chan-iax2,IAX2 channel,IAX support,+asterisk13-res-timing-timerfd,iax.conf iaxprov.conf,chan_iax2,,)) -$(eval $(call BuildAsterisk13NonSharedModule,chan-lantiq,Lantiq TAPI channel,An implementation of Lantiq TAPI channel,@TARGET_lantiq +kmod-ltq-vmmc,lantiq.conf,chan_lantiq,,)) $(eval $(call BuildAsterisk13Module,chan-motif,Jingle channel,Motif Jingle Channel Driver,+asterisk13-res-xmpp,motif.conf,chan_motif,,)) $(eval $(call BuildAsterisk13Module,chan-oss,OSS channel,the channel chan_oss,,oss.conf,chan_oss,,)) $(eval $(call BuildAsterisk13Module,chan-sip,SIP channel,the channel chan_sip,+asterisk13-app-confbridge,sip.conf sip_notify.conf,chan_sip,,)) diff --git a/net/asterisk-chan-lantiq/Makefile b/net/asterisk-chan-lantiq/Makefile new file mode 100644 index 0000000..9ab35e3 --- /dev/null +++ b/net/asterisk-chan-lantiq/Makefile @@ -0,0 +1,87 @@ +# +# Copyright (C) 2017 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=chan-lantiq +PKG_VERSION:=1.0 +PKG_RELEASE:=1 + +PKG_LICENSE:=GPL-2.0 +PKG_MAINTAINER:=Jiri Slachta + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +PKG_FLAGS:=nonshared + +include $(INCLUDE_DIR)/package.mk + +define Package/$(PKG_NAME)/Default + SUBMENU:=Telephony + SECTION:=net + CATEGORY:=Network + TITLE:=Lantiq channel driver + URL:=https://github.com/kochstefan/asterisk_channel_lantiq + DEPENDS:=@(TARGET_lantiq_falcon||TARGET_lantiq_xway||TARGET_lantiq_xrx200) +kmod-ltq-vmmc +endef + +define Package/asterisk13-$(PKG_NAME) +$(call Package/$(PKG_NAME)/Default) + DEPENDS+=asterisk13 + VARIANT:=asterisk13 +endef + +define Package/description/Default +An implementation of a Lantiq TAPI channel driver for Asterisk. +endef + +Package/asterisk13-$(PKG_NAME)/description = $(Package/description/Default) + +define Package/conffiles/Default +/etc/asterisk/lantiq.conf +endef + +Package/asterisk13-$(PKG_NAME)/conffiles = $(Package/conffiles/Default) + +define Package/Install/Default + $(INSTALL_DIR) $(1)/etc/asterisk + $(INSTALL_CONF) $(SOURCE)/files/lantiq-$(BUILD_VARIANT).conf.sample \ + $(1)/etc/asterisk/lantiq.conf + $(INSTALL_DIR) $(1)/usr/lib/asterisk/modules + $(INSTALL_BIN) $(PKG_BUILD_DIR)/chan_lantiq.so \ + $(1)/usr/lib/asterisk/modules +endef + +Package/asterisk13-$(PKG_NAME)/install = $(Package/Install/Default) + +ifeq ($(BUILD_VARIANT),asterisk13) +CHAN_LANTIQ_AST_INCLUDES:=-I$(STAGING_DIR)/usr/include/asterisk-13/include +endif + +define Build/Prepare + $(CP) $(SOURCE)/files/chan_lantiq-$(BUILD_VARIANT).c $(PKG_BUILD_DIR)/chan_lantiq.c + $(CP) $(SOURCE)/files/default.exports $(PKG_BUILD_DIR)/chan_lantiq.exports +endef + +define Build/Configure +endef + +define Build/Compile + cd $(PKG_BUILD_DIR) && \ + $(TARGET_CC) -o chan_lantiq.o -c chan_lantiq.c -MD -MT chan_lantiq.o \ + -MF .chan_lantiq.o.d -MP -pthread \ + $(CHAN_LANTIQ_AST_INCLUDES) \ + $(TARGET_CFLAGS) \ + $(TARGET_CPPFLAGS) \ + -Wall -Wstrict-prototypes -Wmissing-prototypes \ + -Wmissing-declarations $(FPIC) -DAST_MODULE=\"chan_lantiq\" && \ + $(TARGET_CC) -o chan_lantiq.so -pthread $(TARGET_LDFLAGS) -shared \ + -Wl,--version-script,chan_lantiq.exports,--warn-common \ + chan_lantiq.o +endef + +$(eval $(call BuildPackage,asterisk13-$(PKG_NAME))) diff --git a/net/asterisk-13.x/src-lantiq/channels/chan_lantiq.c b/net/asterisk-chan-lantiq/files/chan_lantiq-asterisk13.c similarity index 100% rename from net/asterisk-13.x/src-lantiq/channels/chan_lantiq.c rename to net/asterisk-chan-lantiq/files/chan_lantiq-asterisk13.c diff --git a/net/asterisk-chan-lantiq/files/default.exports b/net/asterisk-chan-lantiq/files/default.exports new file mode 100644 index 0000000..6d9344d --- /dev/null +++ b/net/asterisk-chan-lantiq/files/default.exports @@ -0,0 +1,8 @@ +{ + global: + /* See main/asterisk.exports.in for an explanation why this is + * needed. */ + _IO_stdin_used; + local: + *; +}; diff --git a/net/asterisk-13.x/src-lantiq/configs/samples/lantiq.conf.sample b/net/asterisk-chan-lantiq/files/lantiq-asterisk13.conf.sample similarity index 100% rename from net/asterisk-13.x/src-lantiq/configs/samples/lantiq.conf.sample rename to net/asterisk-chan-lantiq/files/lantiq-asterisk13.conf.sample