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_NAME:=asterisk-chan-dongle
+PKG_VERSION:=1.1-20170913
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=https://github.com/wdoekes/asterisk-chan-dongle.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=4ef5ad7eea7245a031101875be08b924aa1e151b
PKG_SOURCE_PROTO:=git
-PKG_SOURCE_VERSION:=$(PKG_REV)
-PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
PKG_FIXUP:=autoreconf
include $(INCLUDE_DIR)/package.mk
-define Package/asterisk11-chan-dongle
+define Package/asterisk-chan-dongle/Default
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
+ URL:=https://github.com/wdoekes/asterisk-chan-dongle
+ DEPENDS:=+USE_UCLIBC: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
+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)
+
+# musl and glibc include their own iconv, but uclibc does not
+ifneq ($(CONFIG_USE_UCLIBC),)
+TARGET_CPPFLAGS+= \
+ -I$(STAGING_DIR)/usr/lib/libiconv-full/include
+endif
+
+CHAN_DONGLE_EXTRA_CFLAGS:= \
+ -Wno-old-style-declaration \
+ -I$(PKG_BUILD_DIR) \
+ $(TARGET_CPPFLAGS) \
+ -D_GNU_SOURCE \
+ -DHAVE_CONFIG_H \
+ $(FPIC)
+
MAKE_ARGS:= \
CC="$(TARGET_CC)" \
LD="$(TARGET_CC)" \
- CFLAGS="$(TARGET_CFLAGS) -DASTERISK_VERSION_NUM=110000 -DLOW_MEMORY -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"
+ CFLAGS="$(TARGET_CFLAGS) $(CHAN_DONGLE_EXTRA_CFLAGS)" \
+ LDFLAGS="$(TARGET_LDFLAGS) $(if $(CONFIG_USE_UCLIBC),-L$(STAGING_DIR)/usr/lib/libiconv-full/lib -liconv)"
+# $CHAN_DONGLE_ICONV_INC used by 200-fix-iconv-detection.patch
CONFIGURE_VARS += \
+ CHAN_DONGLE_ICONV_INC="$(TOOLCHAIN_DIR)/include $(STAGING_DIR)/usr/lib/libiconv-full/include" \
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
+ $(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" $(MAKE_ARGS)
endef
-define Package/asterisk11-chan-dongle/conffiles
+define Package/conffiles/Default
/etc/asterisk/dongle.conf
endef
-define Package/asterisk11-chan-dongle/install
+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_INSTALL_DIR)/usr/lib/asterisk/modules/chan_dongle.so $(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))
+++ /dev/null
---- 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
+++ /dev/null
-From da5cd41e8554eaf1133f85282c253da2c74ff7eb Mon Sep 17 00:00:00 2001
-From: "bg_one@mail.ru" <bg111@users.noreply.github.com>
-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));
+++ /dev/null
-From da5cd41e8554eaf1133f85282c253da2c74ff7eb Mon Sep 17 00:00:00 2001
-From: "bg_one@mail.ru" <bg111@users.noreply.github.com>
-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])
+++ /dev/null
---- 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;
- }
-
--- /dev/null
+--- 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], ${CHAN_DONGLE_ICONV_INC})
+
+ AC_DEFINE([ICONV_CONST],[], [Define to const if you has iconv() const declaration of input buffer])
+ AC_MSG_CHECKING([for iconv use const inbuf])