From: Sebastian Kemper Date: Sun, 27 Aug 2017 18:58:19 +0000 (+0200) Subject: asterisk-chan-dongle: overhaul X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=fbda98058b0ed17c01ffc9818f458fb8a323b085;p=feed%2Ftelephony.git asterisk-chan-dongle: overhaul - Make the Makefile use BUILD_VARIANT so the package can be built for different Asterisk versions. This is also the reason why the folder is renamed from asterisk-11.x-chan-dongle to asterisk-chan-dongle. - Change source URI from upstream to the fork of wdoekes. Upstream doesn't update the repo anymore, wdoekes does. - Remove dep on libiconv-full, make the package use toolchain's iconv (compile-tested with musl). - Drop patches that are already upstream. - Update flags. Signed-off-by: Sebastian Kemper --- diff --git a/net/asterisk-11.x-chan-dongle/Makefile b/net/asterisk-11.x-chan-dongle/Makefile deleted file mode 100644 index 8c21b8a..0000000 --- a/net/asterisk-11.x-chan-dongle/Makefile +++ /dev/null @@ -1,78 +0,0 @@ -# -# Copyright (C) 2013 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:=asterisk11-chan-dongle -PKG_VERSION:=1.1r35 -PKG_REV:=28a46567a88cebdc365db6f294e682246fd2dd7b -PKG_RELEASE:=6 - -PKG_SOURCE_SUBDIR:=asterisk11-chan-dongle-$(PKG_VERSION) -PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz -PKG_SOURCE_URL:=https://github.com/jstasiak/asterisk-chan-dongle.git -PKG_SOURCE_PROTO:=git -PKG_SOURCE_VERSION:=$(PKG_REV) - -PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) - -PKG_FIXUP:=autoreconf - -PKG_LICENSE:=GPL-2.0 -PKG_LICENSE_FILES:=COPYRIGHT.txt LICENSE.txt -PKG_MAINTAINER:=Jiri Slachta - -include $(INCLUDE_DIR)/package.mk - -define Package/asterisk11-chan-dongle - SUBMENU:=Telephony - SECTION:=net - CATEGORY:=Network - URL:=https://code.google.com/p/asterisk-chan-dongle/ - DEPENDS:= asterisk11 +libiconv-full +kmod-usb-acm +kmod-usb-serial +kmod-usb-serial-option +libusb-1.0 +usb-modeswitch - TITLE:=Huawei UMTS 3G dongle support -endef - -define Package/asterisk11-chan-dongle/description - Asterisk channel driver for Huawei UMTS 3G dongle. -endef - -MAKE_ARGS:= \ - CC="$(TARGET_CC)" \ - LD="$(TARGET_CC)" \ - CFLAGS="$(TARGET_CFLAGS) -DASTERISK_VERSION_NUM=110000 -DLOW_MEMORY -D_GNU_SOURCE -D_XOPEN_SOURCE=600 $(TARGET_CPPFLAGS) -I$(STAGING_DIR)/usr/lib/libiconv-full/include -I$(STAGING_DIR)/usr/include/asterisk-11/include -DHAVE_CONFIG_H -I. -fPIC" \ - LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib/libiconv-full/lib -liconv" \ - DESTDIR="$(PKG_INSTALL_DIR)/usr/lib/asterisk/modules" - -CONFIGURE_VARS += \ - ac_cv_type_size_t=yes \ - ac_cv_type_ssize_t=yes - -define Build/Configure - $(call Build/Configure/Default, \ - --with-asterisk=$(STAGING_DIR)/usr/include/asterisk-11/include \ - $(MAKE_ARGS) \ - ) -endef - -define Build/Compile - mkdir -p $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules - $(MAKE) -C "$(PKG_BUILD_DIR)" $(MAKE_ARGS) all install -endef - -define Package/asterisk11-chan-dongle/conffiles -/etc/asterisk/dongle.conf -endef - -define Package/asterisk11-chan-dongle/install - $(INSTALL_DIR) $(1)/etc/asterisk - $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/dongle.conf $(1)/etc/asterisk/ - $(INSTALL_DIR) $(1)/usr/lib/asterisk/modules - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_dongle.so $(1)/usr/lib/asterisk/modules/ -endef - -$(eval $(call BuildPackage,asterisk11-chan-dongle)) diff --git a/net/asterisk-11.x-chan-dongle/patches/001-add-send-ussd.patch b/net/asterisk-11.x-chan-dongle/patches/001-add-send-ussd.patch deleted file mode 100644 index bc59bf9..0000000 --- a/net/asterisk-11.x-chan-dongle/patches/001-add-send-ussd.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- a/app.c -+++ b/app.c -@@ -114,7 +114,44 @@ static int app_send_sms_exec (attribute_ - return !status; - } - -+static int app_send_ussd_exec (attribute_unused struct ast_channel* channel, const char* data) -+{ -+ char* parse; -+ const char* msg; -+ int status; -+ void * msgid; - -+ AST_DECLARE_APP_ARGS (args, -+ AST_APP_ARG (device); -+ AST_APP_ARG (ussd); -+ ); -+ -+ if (ast_strlen_zero (data)) -+ { -+ return -1; -+ } -+ -+ parse = ast_strdupa (data); -+ -+ AST_STANDARD_APP_ARGS (args, parse); -+ -+ if (ast_strlen_zero (args.device)) -+ { -+ ast_log (LOG_ERROR, "NULL device for ussd -- USSD will not be sent\n"); -+ return -1; -+ } -+ -+ if (ast_strlen_zero (args.ussd)) -+ { -+ ast_log (LOG_ERROR, "NULL ussd command -- USSD will not be sent\n"); -+ return -1; -+ } -+ -+ msg = send_ussd(args.device, args.ussd, &status, &msgid); -+ if(!status) -+ ast_log (LOG_ERROR, "[%s] %s with id %p\n", args.device, msg, msgid); -+ return !status; -+} - - static const struct dongle_application - { -@@ -144,7 +181,15 @@ static const struct dongle_application - " Message - text of the message\n" - " Validity - Validity period in minutes\n" - " Report - Boolean flag for report request\n" -- } -+ }, -+ { -+ "DongleSendUSSD", -+ app_send_ussd_exec, -+ "DongleSendUSSD(Device,USSD)", -+ "DongleSendUSSD(Device,USSD)\n" -+ " Device - Id of device from dongle.conf\n" -+ " USSD - ussd command\n" -+ } - }; - - #if ASTERISK_VERSION_NUM >= 10800 diff --git a/net/asterisk-11.x-chan-dongle/patches/050-add-E1752-to-seven_bit_modems.patch b/net/asterisk-11.x-chan-dongle/patches/050-add-E1752-to-seven_bit_modems.patch deleted file mode 100644 index a2c490c..0000000 --- a/net/asterisk-11.x-chan-dongle/patches/050-add-E1752-to-seven_bit_modems.patch +++ /dev/null @@ -1,19 +0,0 @@ -From da5cd41e8554eaf1133f85282c253da2c74ff7eb Mon Sep 17 00:00:00 2001 -From: "bg_one@mail.ru" -Date: Fri, 6 Sep 2013 19:37:05 +0000 -Subject: [PATCH] added E1752 to seven_bit_modems - ---- - at_response.c | 1 + - 1 files changed, 1 insertions(+), 0 deletion(-) - ---- a/at_response.c -+++ b/at_response.c -@@ -1590,6 +1590,7 @@ static int at_response_cgmm (struct pvt* - "E171", - "E153", - "E156B", -+ "E1752", - }; - - ast_copy_string (pvt->model, str, sizeof (pvt->model)); diff --git a/net/asterisk-11.x-chan-dongle/patches/051-bump-package-revision.patch b/net/asterisk-11.x-chan-dongle/patches/051-bump-package-revision.patch deleted file mode 100644 index 3d85dd6..0000000 --- a/net/asterisk-11.x-chan-dongle/patches/051-bump-package-revision.patch +++ /dev/null @@ -1,20 +0,0 @@ -From da5cd41e8554eaf1133f85282c253da2c74ff7eb Mon Sep 17 00:00:00 2001 -From: "bg_one@mail.ru" -Date: Fri, 6 Sep 2013 19:37:05 +0000 -Subject: [PATCH] added E1752 to seven_bit_modems - ---- - configure.in | 2 +- - 1 files changed, 1 insertions(+), 1 deletion(-) - ---- a/configure.in -+++ b/configure.in -@@ -2,7 +2,7 @@ dnl init - dnl AC_REVISION($Revision: 1.30 $) - AC_PREREQ([2.60]) - AC_INIT([chan_dongle],[1.1],[http://code.google.com/p/asterisk-chan-dongle/issues/list],[chan_dongle],[http://code.google.com/p/asterisk-chan-dongle]) --PACKAGE_REVISION="34" -+PACKAGE_REVISION="35" - AC_CANONICAL_TARGET - AM_INIT_AUTOMAKE - AC_CONFIG_HEADERS([config.h]) diff --git a/net/asterisk-11.x-chan-dongle/patches/100-fix-audio-on-big-endian-systems.patch b/net/asterisk-11.x-chan-dongle/patches/100-fix-audio-on-big-endian-systems.patch deleted file mode 100644 index a6b1c07..0000000 --- a/net/asterisk-11.x-chan-dongle/patches/100-fix-audio-on-big-endian-systems.patch +++ /dev/null @@ -1,46 +0,0 @@ ---- a/channel.c -+++ b/channel.c -@@ -495,6 +495,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) - { -@@ -522,6 +535,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) - { -@@ -535,6 +549,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 - { -@@ -544,6 +559,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; - } - diff --git a/net/asterisk-chan-dongle/Makefile b/net/asterisk-chan-dongle/Makefile new file mode 100644 index 0000000..822dbbf --- /dev/null +++ b/net/asterisk-chan-dongle/Makefile @@ -0,0 +1,121 @@ +# +# 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:=asterisk-chan-dongle +PKG_VERSION:=1.1-20170724 +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_PROTO:=git + +PKG_FIXUP:=autoreconf + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYRIGHT.txt LICENSE.txt +PKG_MAINTAINER:=Jiri Slachta + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/asterisk-chan-dongle/Default + SUBMENU:=Telephony + SECTION:=net + CATEGORY:=Network + URL:=https://code.google.com/p/asterisk-chan-dongle + DEPENDS:=+kmod-usb-acm +kmod-usb-serial +kmod-usb-serial-option +libusb-1.0 +usb-modeswitch + TITLE:=Huawei UMTS 3G dongle support +endef + +define Package/asterisk11-chan-dongle +$(call Package/asterisk-chan-dongle/Default) + DEPENDS+=asterisk11 + VARIANT:=asterisk11 +endef + +define Package/asterisk13-chan-dongle +$(call Package/asterisk-chan-dongle/Default) + DEPENDS+=asterisk13 + VARIANT:=asterisk13 +endef + +define Package/description/Default + Asterisk channel driver for Huawei UMTS 3G dongle. +endef + +Package/asterisk11-chan-dongle/description = $(Package/description/Default) +Package/asterisk13-chan-dongle/description = $(Package/description/Default) + +ifeq ($(BUILD_VARIANT),asterisk11) + CHAN_DONGLE_AST_HEADERS:=$(STAGING_DIR)/usr/include/asterisk-11/include + CONFIGURE_ARGS+= \ + --with-astversion=11 +endif + +ifeq ($(BUILD_VARIANT),asterisk13) + CHAN_DONGLE_AST_HEADERS:=$(STAGING_DIR)/usr/include/asterisk-13/include + CONFIGURE_ARGS+= \ + --with-astversion=13 +endif + +CONFIGURE_ARGS+= \ + --with-asterisk=$(CHAN_DONGLE_AST_HEADERS) + +TARGET_CFLAGS+= \ + -I$(CHAN_DONGLE_AST_HEADERS) + +# -DAST_MODULE_SELF_SYM=__internal_chan_dongle_self to fix Asterisk 14 +# compile issues +CHAN_DONGLE_EXTRA_CFLAGS:= \ + -Wno-old-style-declaration \ + -I$(PKG_BUILD_DIR) \ + -DAST_MODULE_SELF_SYM=__internal_chan_dongle_self \ + $(TARGET_CPPFLAGS) \ + -D_GNU_SOURCE \ + -DHAVE_CONFIG_H \ + $(FPIC) + +MAKE_ARGS:= \ + CC="$(TARGET_CC)" \ + LD="$(TARGET_CC)" \ + CFLAGS="$(TARGET_CFLAGS) $(CHAN_DONGLE_EXTRA_CFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" + +# $TOOLCHAIN_DIR used by 200-fix-iconv-detection.patch +CONFIGURE_VARS += \ + TOOLCHAIN_DIR=$(TOOLCHAIN_DIR) \ + ac_cv_type_size_t=yes \ + ac_cv_type_ssize_t=yes + +define Build/Compile + $(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" $(MAKE_ARGS) +endef + +define Package/conffiles/Default +/etc/asterisk/dongle.conf +endef + +Package/asterisk11-chan-dongle/conffiles = $(Package/conffiles/Default) +Package/asterisk13-chan-dongle/conffiles = $(Package/conffiles/Default) + +define Package/Install/Default + $(INSTALL_DIR) $(1)/etc/asterisk + $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/dongle.conf $(1)/etc/asterisk + $(INSTALL_DIR) $(1)/usr/lib/asterisk/modules + $(INSTALL_BIN) $(PKG_BUILD_DIR)/chan_dongle.so $(1)/usr/lib/asterisk/modules +endef + +Package/asterisk11-chan-dongle/install = $(Package/Install/Default) +Package/asterisk13-chan-dongle/install = $(Package/Install/Default) + +$(eval $(call BuildPackage,asterisk11-chan-dongle)) +$(eval $(call BuildPackage,asterisk13-chan-dongle)) 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 new file mode 100644 index 0000000..768782b --- /dev/null +++ b/net/asterisk-chan-dongle/patches/100-fix-audio-on-big-endian-systems.patch @@ -0,0 +1,46 @@ +--- 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; + } + diff --git a/net/asterisk-chan-dongle/patches/200-fix-iconv-detection.patch b/net/asterisk-chan-dongle/patches/200-fix-iconv-detection.patch new file mode 100644 index 0000000..bc9d94d --- /dev/null +++ b/net/asterisk-chan-dongle/patches/200-fix-iconv-detection.patch @@ -0,0 +1,11 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -102,7 +102,7 @@ AC_DEFUN([AC_HEADER_FIND], [ + ) + + AC_HEADER_FIND([asterisk.h], $with_asterisk) +-AC_HEADER_FIND([iconv.h], /usr/include /usr/local/include /opt/local/include) ++AC_HEADER_FIND([iconv.h], "${TOOLCHAIN_DIR}/include") + + AC_DEFINE([ICONV_CONST],[], [Define to const if you has iconv() const declaration of input buffer]) + AC_MSG_CHECKING([for iconv use const inbuf])