diff options
author | Timo Teräs <timo.teras@iki.fi> | 2012-07-10 08:41:03 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2012-07-10 08:41:03 +0300 |
commit | a39a3677c072e1a760f29e1654a8622aab913a88 (patch) | |
tree | 934d3f9839ece96ff0133215cb41af9458da3cf7 /testing | |
parent | 70e9c90bc331ba852359a8f76adfdb6c3d477fbb (diff) | |
download | aports-a39a3677c072e1a760f29e1654a8622aab913a88.tar.bz2 aports-a39a3677c072e1a760f29e1654a8622aab913a88.tar.xz |
testing/asterisk-dongle: new aport
asterisk dongle (usb gsm modem) channel driver
http://code.google.com/p/asterisk-chan-dongle/
Diffstat (limited to 'testing')
-rw-r--r-- | testing/asterisk-dongle/APKBUILD | 47 | ||||
-rw-r--r-- | testing/asterisk-dongle/issue46.patch | 238 |
2 files changed, 285 insertions, 0 deletions
diff --git a/testing/asterisk-dongle/APKBUILD b/testing/asterisk-dongle/APKBUILD new file mode 100644 index 000000000..4a7e12bbf --- /dev/null +++ b/testing/asterisk-dongle/APKBUILD @@ -0,0 +1,47 @@ +# Contributor: Timo Teräs <timo.teras@iki.fi> +# Maintainer: Timo Teräs <timo.teras@iki.fi> +SVNREV=27 +pkgname=asterisk-dongle +pkgver=1.1.$SVNREV +pkgrel=0 +pkgdesc="GSM modem dongle channel driver" +url="http://code.google.com/p/asterisk-chan-dongle/" +arch="all" +license="GPLv2" +depends="asterisk" +depends_dev="" +makedepends="$depends_dev asterisk-dev subversion automake autoconf" +install="" +subpackages="" +source="issue46.patch" + +_builddir="$srcdir/$pkgname-$pkgver" +prepare() { + local i + + svn checkout http://asterisk-chan-dongle.googlecode.com/svn/trunk/@$REV "$_builddir" + + cd "$_builddir" + + for i in $source; do + case $i in + *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; + esac + done +} + +build() { + cd "$_builddir" + aclocal && autoconf && automake -a + ./configure || exit 1 + make +} + +package() { + cd "$_builddir" + mkdir -p "$pkgdir"/usr/lib/asterisk/modules "$pkgdir"/etc/asterisk + install -m644 etc/dongle.conf "$pkgdir"/etc/asterisk/dongle.conf.sample + install -m755 chan_dongle.so "$pkgdir"/usr/lib/asterisk/modules +} + +md5sums="73321cca36d8f25f8de687b5600e7b73 issue46.patch" diff --git a/testing/asterisk-dongle/issue46.patch b/testing/asterisk-dongle/issue46.patch new file mode 100644 index 000000000..1bc0056e9 --- /dev/null +++ b/testing/asterisk-dongle/issue46.patch @@ -0,0 +1,238 @@ +Issue 46 from asterisk-chan-dongle bug tracker + +Fixes to build with Asterisk 10+ + +http://asterisk-chan-dongle.googlecode.com/issues/attachment?aid=460006000&name=patch3.patch.txt&token=VQW7Irk8LNc422UzWgcczezUNaY%3A1341828783939 + +--- a/chan_dongle_o.c 2011-11-23 14:04:57.270633822 +0200 ++++ b/chan_dongle.c 2011-11-23 14:07:05.740251209 +0200 +@@ -43,6 +43,7 @@ + #include <asterisk.h> + ASTERISK_FILE_VERSION(__FILE__, "$Rev: " PACKAGE_REVISION " $") + ++#include <asterisk/version.h> + #include <asterisk/stringfields.h> /* AST_DECLARE_STRING_FIELDS for asterisk/manager.h */ + #include <asterisk/manager.h> + #include <asterisk/dsp.h> +@@ -71,6 +72,8 @@ + + EXPORT_DEF const char * const dev_state_strs[4] = { "stop", "restart", "remove", "start" }; + EXPORT_DEF public_state_t * gpublic; ++EXPORT_DEF struct ast_format chan_dongle_format; ++EXPORT_DEF struct ast_format_cap * chan_dongle_format_cap; + + + static int public_state_init(struct public_state * state); +@@ -1640,6 +1643,16 @@ + rv = AST_MODULE_LOAD_FAILURE; + if(discovery_restart(state) == 0) + { ++#if ASTERISK_VERSION_NUM >= 100000 /* 10+ */ ++ /* set preferred capabilities */ ++ ast_format_set(&chan_dongle_format, AST_FORMAT_SLINEAR, 0); ++ if (!(channel_tech.capabilities = ast_format_cap_alloc())) { ++ return AST_MODULE_LOAD_FAILURE; ++ } ++ ast_format_cap_add(channel_tech.capabilities, &chan_dongle_format); ++ chan_dongle_format_cap = channel_tech.capabilities; ++#endif ++ + /* register our channel type */ + if(ast_channel_register(&channel_tech) == 0) + { +@@ -1652,6 +1665,9 @@ + } + else + { ++#if ASTERISK_VERSION_NUM >= 100000 /* 10+ */ ++ channel_tech.capabilities = ast_format_cap_destroy(channel_tech.capabilities); ++#endif + ast_log (LOG_ERROR, "Unable to register channel class %s\n", channel_tech.type); + } + discovery_stop(state); +@@ -1679,6 +1695,9 @@ + { + /* First, take us out of the channel loop */ + ast_channel_unregister (&channel_tech); ++#if ASTERISK_VERSION_NUM >= 100000 /* 10+ */ ++ channel_tech.capabilities = ast_format_cap_destroy(channel_tech.capabilities); ++#endif + + /* Unregister the CLI & APP & MANAGER */ + +--- a/han_dongle_o.h 2011-11-23 14:05:35.031639222 +0200 ++++ b/chan_dongle.h 2011-11-23 14:06:24.608334634 +0200 +@@ -33,6 +33,9 @@ + return enum2str(state, states, ITEMS_OF(states)); + } + ++/* Only linear is allowed */ ++EXPORT_DECL struct ast_format chan_dongle_format; ++EXPORT_DECL struct ast_format_cap * chan_dongle_format_cap; + + typedef enum { + RESTATE_TIME_NOW = 0, +--- a/channel_o.c 2011-11-23 14:05:08.279344414 +0200 ++++ b/channel.c 2011-11-23 14:06:24.610334645 +0200 +@@ -95,20 +95,24 @@ + return 0; + } + +-#if ASTERISK_VERSION_NUM >= 10800 ++#if ASTERISK_VERSION_NUM >= 100000 /* 10+ */ ++ ++static struct ast_channel * channel_request (attribute_unused const char * type, struct ast_format_cap * cap, const struct ast_channel *requestor, void * data, int * cause) ++ ++#elif ASTERISK_VERSION_NUM >= 10800 /* 1.8+ */ + // TODO: simplify by move common code to functions + static struct ast_channel * channel_request (attribute_unused const char * type, format_t format, const struct ast_channel * requestor, void * data, int * cause) + +-#else /* #if ASTERISK_VERSION_NUM >= 10800 */ ++#else /* 1.8- */ + /* TODO: add check when request 'holdother' what requestor is not on same device for 1.6 */ + + static struct ast_channel * channel_request (attribute_unused const char * type, int format, void * data, int * cause) + +-#endif /* #if ASTERISK_VERSION_NUM >= 10800 */ ++#endif + { +-#if ASTERISK_VERSION_NUM >= 10800 ++#if ASTERISK_VERSION_NUM >= 10800 && ASTERISK_VERSION_NUM < 100000 /* 1.8+ .. 10- */ + format_t oldformat; +-#else ++#elif ASTERISK_VERSION_NUM < 10800 /* 1.8- */ + int oldformat; + const struct ast_channel * requestor = NULL; + #endif +@@ -126,11 +130,18 @@ + return NULL; + } + ++#if ASTERISK_VERSION_NUM >= 100000 /* 10+ */ ++ if (!ast_format_cap_iscompatible(cap, &chan_dongle_format)) ++#else + oldformat = format; + format &= AST_FORMAT_SLINEAR; + if (!format) ++#endif + { +-#if ASTERISK_VERSION_NUM >= 10800 ++#if ASTERISK_VERSION_NUM >= 100000 /* 10+ */ ++ char buf[255]; ++ ast_log (LOG_WARNING, "Asked to get a channel of unsupported format '%s'\n", ast_getformatname_multiple (buf, 255, cap)); ++#elif ASTERISK_VERSION_NUM >= 10800 /* 1.8+ */ + ast_log (LOG_WARNING, "Asked to get a channel of unsupported format '%s'\n", ast_getformatname (oldformat)); + #else + ast_log (LOG_WARNING, "Asked to get a channel of unsupported format '%d'\n", oldformat); +@@ -571,10 +582,12 @@ + + } + +-#if ASTERISK_VERSION_NUM >= 10800 ++#if ASTERISK_VERSION_NUM >= 100000 /* 10+ */ ++#define subclass_integer subclass.integer ++#elif ASTERISK_VERSION_NUM >= 10800 /* 1.8+ */ + #define subclass_codec subclass.codec + #define subclass_integer subclass.integer +-#else ++#else /* 1.8- */ + #define subclass_codec subclass + #define subclass_integer subclass + #endif +@@ -618,7 +631,11 @@ + memset (&cpvt->a_read_frame, 0, sizeof (cpvt->a_read_frame)); + + cpvt->a_read_frame.frametype = AST_FRAME_VOICE; +- cpvt->a_read_frame.subclass_codec= AST_FORMAT_SLINEAR; ++#if ASTERISK_VERSION_NUM >= 100000 /* 10+ */ ++ ast_format_copy(&cpvt->a_read_frame.subclass.format, &chan_dongle_format); ++#else ++ cpvt->a_read_frame.subclass_codec = AST_FORMAT_SLINEAR; ++#endif + cpvt->a_read_frame.data.ptr = cpvt->a_read_buf + AST_FRIENDLY_OFFSET; + cpvt->a_read_frame.offset = AST_FRIENDLY_OFFSET; + cpvt->a_read_frame.src = AST_MODULE; +@@ -732,7 +749,11 @@ + size_t count; + int gains[2]; + ++#if ASTERISK_VERSION_NUM >= 100000 /* 10+ */ ++ if (f->frametype != AST_FRAME_VOICE || f->subclass.format.id != AST_FORMAT_SLINEAR) ++#else /* 10- */ + if (f->frametype != AST_FRAME_VOICE || f->subclass_codec != AST_FORMAT_SLINEAR) ++#endif + { + return 0; + } +@@ -1148,9 +1169,15 @@ + + channel->tech_pvt = cpvt; + channel->tech = &channel_tech; ++#if ASTERISK_VERSION_NUM >= 100000 /* 10+ */ ++ ast_format_cap_add(channel->nativeformats, &chan_dongle_format); ++ ast_format_copy(&channel->writeformat, &chan_dongle_format); ++ ast_format_copy(&channel->readformat, &chan_dongle_format); ++#else /* 10- */ + channel->nativeformats = AST_FORMAT_SLINEAR; + channel->writeformat = AST_FORMAT_SLINEAR; + channel->readformat = AST_FORMAT_SLINEAR; ++#endif + + if (ast_state == AST_STATE_RING) + { +@@ -1238,9 +1265,11 @@ + + snprintf (channel_name, sizeof (channel_name), "%s@%s", exten, CONF_SHARED(pvt, context)); + +-#if ASTERISK_VERSION_NUM >= 10800 ++#if ASTERISK_VERSION_NUM >= 100000 /* 10+ */ ++ channel = ast_request ("Local", chan_dongle_format_cap, NULL, channel_name, &cause); ++#elif ASTERISK_VERSION_NUM >= 10800 /* 1.8+ */ + channel = ast_request ("Local", AST_FORMAT_AUDIO_MASK, NULL, channel_name, &cause); +-#else ++#else /* 1.8- */ + channel = ast_request ("Local", AST_FORMAT_AUDIO_MASK, channel_name, &cause); + #endif + if (channel) +@@ -1314,7 +1343,6 @@ + static int channel_func_write(struct ast_channel* channel, const char* function, char* data, const char* value) + { + struct cpvt* cpvt = channel->tech_pvt; +- struct pvt* pvt; + call_state_t newstate, oldstate; + int ret = 0; + +@@ -1323,7 +1351,6 @@ + ast_log (LOG_WARNING, "call on unreferenced %s\n", channel->name); + return -1; + } +- pvt = cpvt->pvt; + + if (!strcasecmp(data, "callstate")) + { +@@ -1366,11 +1393,13 @@ + return ret; + } + +-EXPORT_DEF const struct ast_channel_tech channel_tech = ++EXPORT_DEF struct ast_channel_tech channel_tech = + { + .type = "Dongle", + .description = MODULE_DESCRIPTION, ++#if ASTERISK_VERSION_NUM < 100000 /* 10- */ + .capabilities = AST_FORMAT_SLINEAR, ++#endif + .requester = channel_request, + .call = channel_call, + .hangup = channel_hangup, +--- a/channel_o.h 2011-11-23 14:05:43.206424916 +0200 ++++ b/channel.h 2011-11-23 14:06:24.611334658 +0200 +@@ -19,7 +19,7 @@ + struct pvt; + struct cpvt; + +-EXPORT_DECL const struct ast_channel_tech channel_tech; ++EXPORT_DECL struct ast_channel_tech channel_tech; + + EXPORT_DECL struct ast_channel* new_channel (struct pvt * pvt, int ast_state, const char * cid_num, int call_idx, unsigned dir, unsigned state, const char * exten, const struct ast_channel * requestor); + EXPORT_DECL int queue_control_channel (struct cpvt * cpvt, enum ast_control_frame_type control); |