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 <sebastian_ml@gmx.net>
This commit is contained in:
Sebastian Kemper 2017-08-27 20:58:19 +02:00
parent dc7edf43cd
commit fbda98058b
7 changed files with 136 additions and 185 deletions

View file

@ -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 <jiri@slachta.eu>
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))

View file

@ -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

View file

@ -1,19 +0,0 @@
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));

View file

@ -1,20 +0,0 @@
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])

View file

@ -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 <jiri@slachta.eu>
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))

View file

@ -1,6 +1,6 @@
--- a/channel.c
+++ b/channel.c
@@ -495,6 +495,19 @@ again:
@@ -539,6 +539,19 @@ again:
}
}
@ -20,7 +20,7 @@
#/* */
static void timing_write (struct pvt* pvt)
{
@@ -522,6 +535,7 @@ static void timing_write (struct pvt* pv
@@ -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);
@ -28,7 +28,7 @@
}
else if (used > 0)
{
@@ -535,6 +549,7 @@ static void timing_write (struct pvt* pv
@@ -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++;
@ -36,7 +36,7 @@
}
else
{
@@ -544,6 +559,7 @@ static void timing_write (struct pvt* pv
@@ -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;

View file

@ -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])