summaryrefslogtreecommitdiff
path: root/net-misc/asterisk
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-05-11 19:55:43 +0100
committerV3n3RiX <venerix@redcorelinux.org>2021-05-11 19:55:43 +0100
commit185fa19bbf68a4d4dca534d2b46729207a177f16 (patch)
treea8a537b82fda83a0799c2ca9887f212558363aa7 /net-misc/asterisk
parentc8fd0d84af0bfd1949542adc2cbb735b1d28f9ed (diff)
gentoo resync : 11.05.2021
Diffstat (limited to 'net-misc/asterisk')
-rw-r--r--net-misc/asterisk/Manifest7
-rw-r--r--net-misc/asterisk/asterisk-13.38.2-r2.ebuild (renamed from net-misc/asterisk/asterisk-13.38.2-r1.ebuild)1
-rw-r--r--net-misc/asterisk/asterisk-16.18.0.ebuild318
-rw-r--r--net-misc/asterisk/asterisk-18.4.0.ebuild361
-rw-r--r--net-misc/asterisk/files/asterisk-13.38.2-r2-func_odbc_minargs-ARGC.patch180
5 files changed, 866 insertions, 1 deletions
diff --git a/net-misc/asterisk/Manifest b/net-misc/asterisk/Manifest
index c2794e1802af..5cf70699ceae 100644
--- a/net-misc/asterisk/Manifest
+++ b/net-misc/asterisk/Manifest
@@ -3,6 +3,7 @@ AUX asterisk-13.18.1-r2-autoconf-2.70.patch 535 BLAKE2B 06f880515f27166a75738bde
AUX asterisk-13.38.1-r1-autoconf-lua-version.patch 2320 BLAKE2B 5f9a4b4063286f964da0756698134ce9127a3ae854e19ccec098fb554f4835cbb1698da6ac76293dcb1af3dfd8ea741e9450d58b61c7da440ff3077c848dae68 SHA512 dae3daad5a6755a8a932b40c5d209c348a72266c139a2e05420ea4b8f292062832cf791bc8d41de4bf8c1e0516e8699efdb80724a5afb2d017ab707073d7fca8
AUX asterisk-13.38.1-r1-func_lock-fix-races.patch 9580 BLAKE2B 174aa69b0738c87f02692c2eec978171216b2117218a54b9785a836d0b72b779ed1aa48a3c3b624deb9e16e3485d60a8390b60019c90524f6248665d1ae0ff44 SHA512 bff6f20a677eef837a6727859c1c90309e6f012621743b7e8b6b92ad17cf44c9b94aa75a0b64550ae39a6260210a944725d9e9603fbe0ca7bcbd4fd61d991748
AUX asterisk-13.38.2-r1-menuselect-exitcodes.patch 1736 BLAKE2B 32f18fe623c6a9ba4db24001bc6669a2bc0838f2b757a2bcacde6eeb6b63f31881af877ce25cf7f38f6b7c010d92b5a1065d22b3f7526bcdc22799a09b22a975 SHA512 c4888e24051f0913c7dd13dbadbc38e7638bdedfee36b6f6cee047f6113d39cd09d79d9ecbfbb38f72ae6c9092e1423a0eff885118cfa44d4995f11d95c4a1d3
+AUX asterisk-13.38.2-r2-func_odbc_minargs-ARGC.patch 7091 BLAKE2B bd00ce7a49b946cd6f2f170edf777a3b7f61bc02882096536dd4e05f2d9c279d1ff5c4501f65eb1c64edbca8b9f283ac7cf542722478dca2c2fcc1e9d9decf83 SHA512 a5a160f5a93e64f6780e56c4af248aa33739bdacc80cfb0f224060c7bbe57633d84368ddac291306f6ec41989cfe619771f55d1c415fc80db3f0597b6058e553
AUX asterisk-16.15.1-r2-autoconf-2.70.patch 499 BLAKE2B d52c6514d3cd120402298322dac081d88821035a13a5210bddf8574dfe69ec1e6eca1f3335dbd2976e870a8dfc634d1883b3e0db707557581da38b074f7359e6 SHA512 a55725377a874ee15a722076fc63323d73a976592aad524e56bdff5f4164eaa7e533723f5add93b738f39532392541bd2615fc39b3a4fd55a49f57f584d82846
AUX asterisk-16.16.2-no-var-run-install.patch 728 BLAKE2B 25fc61c4aa68d9e3243d1161e68e0b61b14b5505eadd00fdf46e1c3977e7fb536afd42dc6c9a07f400a686c19afd04fd8f00fc1cb916978783a9e54ecfe81dd4 SHA512 ab1e7ac700711125162396c4ebe590eb000f4ad6c4cbe8845794f5d06353a4a52167fcc83ee97860f38540089cad6d45f2e8589c1f30098e85479a2b4c722f75
AUX asterisk-historic-no-var-run-install.patch 790 BLAKE2B 6fb753a3dc1b557b4cca8df1dc93eba3de70114f0bb206692461a3faf4068ffbf641740fa51e5010cabf0cbb64d8856dd9a830eba802b1988208b8a185a1fc57 SHA512 9c941d49a1ea10f702b7ce2c9c4a120c0e8ea297f13ecaa9d2a9b059cf4452a981aa0e0eabd5c4711c222311e3f9a52ee1135c59433ba878a9bd3a979be852fd
@@ -17,13 +18,17 @@ AUX initd-16.16.2-r1 9986 BLAKE2B 4b1c9537ef85c9de1d0064a851472163576480f08b5738
DIST asterisk-13.38.2.tar.gz 33708267 BLAKE2B f8c188f6500a01e807982518486972c18f8f903285910e64b4d8e2a4f553d42534f910696a02ab13e371dbd83dfd932c5cb7a6cea08817862ecaddcc7afd99d2 SHA512 bd9755503048cd8dcf8e39947dd5cfb617c20c4b1ad5033ae297499a4967c06ba11b6e43233c1ae0d33f8f11a81dbb9b4487f16a1f4786007172028caf1ee051
DIST asterisk-16.16.2.tar.gz 27808852 BLAKE2B dc05fe7c797f9b848c918121ffe7e7648bca75fccb70412fcd39f37beb3fd33e7d64cd198919cb6ae2867cd685651497ae15a30fb280988a9c7184e80de235ae SHA512 9e47ea2906a2c0d1a2f527d106ef6200a8d0cce76a31a6cfb3ca720a2ef7b5f723ae5c6266c74b0bdfd5718346e8d01a30fc346981463fa4ee7a4b7c99a67928
DIST asterisk-16.17.0.tar.gz 27836573 BLAKE2B f01b499cdd9659403df2d422dc4140f3ade66384fc4bf72b220c4179ada5723e2ce07f0c76c473d9fb5bd14a83357c55145c7d5c840ef29c754b05d337f8709e SHA512 ea142028974beffc6e8e87a780eb3928c4542eb7886246eb689fc4f61191e4bf05477aabd24c98f14e69504e5afec29cea33aeab4fefcc8fbd48c72592b630c2
+DIST asterisk-16.18.0.tar.gz 27843069 BLAKE2B 643c371b4747111e233c0758efb529e7f54f1deeff10e65fb05f3a1a58c4ba5c139bdb583d2a2552e29aacac5d0f3980fd9aeb19fda2513843fbe0c849dec217 SHA512 025a30a1eed1d2cd14eb1345e1e0edfcc23b4c517e0d33da7d06d97b3ffa3c9ce9c2fe9449109eefade6d62b6205b598fecb69245adb04f03bd53f8482fbd7ad
DIST asterisk-18.2.2.tar.gz 27888521 BLAKE2B 5837b6434568a8e9f7a8963098994ccb487cfe9b85d59b30e5866e4eb67d222c4ac2c77036f7d461de72acc6ffd07fcd2d56bcaa618f4aecdbdba60d609eeb93 SHA512 e15fe3c7f46d49991bcb6f6f565f15e4af0d658b4cd6b091079209dd95a8027858effdc2f2314d72ed46a73cdebc089d3c27d5cf8db50d2d21f3c317a8a4a546
DIST asterisk-18.3.0.tar.gz 27917957 BLAKE2B df4589291a1b8c815acc63650c1a1c6febef4147b849114fad13c84754f23c8a960b1ebc865c4e4fa33e63a841c11f2d0a5474980a406df94a654622b4a4b6f0 SHA512 7625d6c2c1069acde8dcb94f54dc3016cbb63c70eab7e0a86768be79ffe2286691367cd32df372d695e63f58919246e5c2dca98bec9389d7a4b09dced5bf8ecb
-EBUILD asterisk-13.38.2-r1.ebuild 10732 BLAKE2B 1f78589be4062805a77e827c0ef0934becc566336c2a8818c774f1cbf54c5137396d2dc3078d6f96f25d2b03aa6ad9aad559b69f6d1147c119cab76305d268c9 SHA512 c71fb95fef071d1b4704b77b896e1ffb4ceeae15c688003e9fabe8488b6cc5d7eeb35fba3d9a483b596992e2db4fabdfdd268a0fc565e36ab08602504975ae84
+DIST asterisk-18.4.0.tar.gz 27926601 BLAKE2B 1a4089ee274732462a8e480d449e4043f7393a6df0b78dd3ea341d3996b9e433066e6d7c53b3ab334db5946a4b847ac02abb4afc5747b6f541cad81a6d58d468 SHA512 024d0a5c75d55fe614ba6219aece62778e9522a0f8365d57192aa5aa22be94d45a3bed69ac14659738e97dd98967533c13096a855366083e6df2b7800e684602
+EBUILD asterisk-13.38.2-r2.ebuild 10793 BLAKE2B 80fafcb1cb0e73db4d3d8fa386d7db287ee952d583d7a014f85e979622d908edc2aa853719feeddab915577a012a75931c242b0f7b4dbceaa8e4ef5be6cfecab SHA512 88d94fc242a934089788a1cde7d7ed30880a9b0bec03c3c5c5fb5c04cdf4f3abe866b7b8c06588739143f83ad41395e99446a4610d6e5e8914269def23e9382c
EBUILD asterisk-13.38.2.ebuild 9664 BLAKE2B 7b5018e14e5fd93fe92b96a2ba20c39e061dee93a7c3491601ac1a051498fefa6914b5c259576537e1d9c96be1ef45e85d7b742bdc62d40390d824f08cb617cb SHA512 5c82cef460eebf4fb1cf1bbc1824b050855dfb2e8d8a8b0e42cfbff85a761e97843a1ff4bfc38dcb235475db7f2ea36536e031978dd861a9de4d84cddba829f3
EBUILD asterisk-16.16.2-r1.ebuild 11297 BLAKE2B 70d3e6454e089576316d562b0fe92e9b146c673d129479b90c5c108def4be9cc6ee2f1491210ae753934132ba3472a1833fc1c7cadfc0edfc603c86e0ba49593 SHA512 cade051bcc31019a1a8a831f23deb7a9dfdf54585c158ff798bcb3132b5683f7534a3c1aedacab9062596b22d9c70a510426abb8338bebaaa1691616cf37125e
EBUILD asterisk-16.16.2.ebuild 9855 BLAKE2B d83137ba59e6497549c60202332615cc8ca7fc7aa80fb69691fe7269fc43e47f6713264ed8328dcdad58886cf7e9b1e84ca3c65a9ef7e8e9ae8e4a4dfbf957dd SHA512 6ac7bdaa50bfaf06b7d45daa4b3349765b1ee89d838681afcc9a3b2a92bbc489273ce6d09635fcd2ac951b234fdcb1371365bbf7fee1eb4de8a80a814d6e43f9
EBUILD asterisk-16.17.0.ebuild 9859 BLAKE2B cdf9fcbba362fbe821e9bb93bb5ddaf159b650187b1a3d94986554d3afaa9a01c1d14b6ae883defe98c8e6ec72f470203656129f1be2375aff84c69f4f3c7f48 SHA512 fef880641ac72ee4988371d4130c2fdae283f9c9da958d6a66377b56f6f81e46d228145864d3f5b1da77c2314b0b26ced599be8f604340e547dbde43d208a3c1
+EBUILD asterisk-16.18.0.ebuild 9800 BLAKE2B dd4a96b4104359bfea9bb46eec7f8b4453e40e043035b5e8ffc6bd9b1e66bde0583ba701d03450604fb94e76b101951bec0c214871fc3bc35323deb5f8b6ffa3 SHA512 18bcd403796ce850783592df92a927d8c5a31023601d830a4951de2ec6995571a9a54b9ab554781683248a4944e128fc979b1a51da99b0c386b0d491de1378c7
EBUILD asterisk-18.2.2.ebuild 11270 BLAKE2B bb3522c9a90506fdcf22dd243edee97550d4af8d70d5d6393b2005e6ce71adbc3fd1c23b53b618651888aab14557a1d5c6fe774ac89fcb6a20e264ad52d1b3df SHA512 fbbfa6d86aa3fb6734a68844a7724f234b239c74b4c43232af9cb08077af0824a0475ce11ae365ef399f1419299324e63a50ec6106a47b9403aa7f259fd7397c
EBUILD asterisk-18.3.0.ebuild 11218 BLAKE2B efeba024aeedee227df0c4f94b4f611b8bdd49a45dc350d23c7fd5042f329a60a79b77210b0f990cf66dcbaf7a4244b0f01ebad632a25ef9186ddb554f691b60 SHA512 05343e131eb0e84b0a73e7a7cc0a16ff386bc1a4fd0914ab49e8fa84a5b6e69449aba2dbcc56087ac0bf18d6037f41eb006ecd321b0c750c1ba06c610afda895
+EBUILD asterisk-18.4.0.ebuild 11159 BLAKE2B 0f13f7d155054688e97bfa5dc892f5d6f80b8d9bf0f952356d76be3f907716803ee6fb8978a9c03ae0791dc1d0932fe6ddb66119e6c05c6251177ef6c9b278e1 SHA512 7bbd41f0b4a2767ec4b36ebed02498b3b2fa35145b376a20b44c0750d71edb21c0ebe0d30f7300112a3e2c626820799e948ed17c55200a96bd55d030656a700d
MISC metadata.xml 1482 BLAKE2B 71a7d51199cb53116efd36963d5881264faa13f8beb375ab68074c3ab560443c3ea9cb021c5c03c9c55fdfa9fc27425c90b4313d3a3bd680079add6ebf5763d1 SHA512 df1f06ccc232488d08202b9f6bfc62e17769ef740a2c1da9ee8a2c48d40d7a293f522b6c9c899c7ae202ba7c6b207fc25e69730d2983bb307921f82c070a09ee
diff --git a/net-misc/asterisk/asterisk-13.38.2-r1.ebuild b/net-misc/asterisk/asterisk-13.38.2-r2.ebuild
index f5cfeb45ac9c..44754c3a017f 100644
--- a/net-misc/asterisk/asterisk-13.38.2-r1.ebuild
+++ b/net-misc/asterisk/asterisk-13.38.2-r2.ebuild
@@ -32,6 +32,7 @@ PATCHES=(
"${FILESDIR}/${PN}-13.38.1-r1-func_lock-fix-races.patch"
"${FILESDIR}/${PN}-13.18.1-r2-autoconf-2.70.patch"
"${FILESDIR}/${PN}-13.38.2-r1-menuselect-exitcodes.patch"
+ "${FILESDIR}/${PN}-13.38.2-r2-func_odbc_minargs-ARGC.patch"
)
DEPEND="acct-user/asterisk
diff --git a/net-misc/asterisk/asterisk-16.18.0.ebuild b/net-misc/asterisk/asterisk-16.18.0.ebuild
new file mode 100644
index 000000000000..fd51937b8461
--- /dev/null
+++ b/net-misc/asterisk/asterisk-16.18.0.ebuild
@@ -0,0 +1,318 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+LUA_COMPAT=( lua5-{1..4} )
+
+inherit autotools linux-info lua-single systemd toolchain-funcs tmpfiles
+
+DESCRIPTION="Asterisk: A Modular Open Source PBX System"
+HOMEPAGE="https://www.asterisk.org/"
+SRC_URI="https://downloads.asterisk.org/pub/telephony/asterisk/releases/${P}.tar.gz"
+LICENSE="GPL-2"
+SLOT="0/${PV%%.*}"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86"
+
+IUSE_VOICEMAIL_STORAGE=(
+ +voicemail_storage_file
+ voicemail_storage_odbc
+ voicemail_storage_imap
+)
+IUSE="${IUSE_VOICEMAIL_STORAGE[*]} alsa blocks bluetooth calendar +caps cluster codec2 curl dahdi debug doc freetds gtalk http iconv ilbc ldap lua mysql newt odbc oss pjproject portaudio postgres radius selinux snmp span speex srtp +ssl static statsd syslog unbound vorbis xmpp"
+IUSE_EXPAND="VOICEMAIL_STORAGE"
+REQUIRED_USE="gtalk? ( xmpp )
+ lua? ( ${LUA_REQUIRED_USE} )
+ ^^ ( ${IUSE_VOICEMAIL_STORAGE[*]//+/} )
+ voicemail_storage_odbc? ( odbc )
+"
+
+PATCHES=(
+ "${FILESDIR}/asterisk-16.16.2-no-var-run-install.patch"
+)
+
+DEPEND="acct-user/asterisk
+ acct-group/asterisk
+ dev-db/sqlite:3
+ dev-libs/popt
+ >=dev-libs/jansson-2.11
+ dev-libs/libedit
+ dev-libs/libxml2:2
+ dev-libs/libxslt
+ sys-apps/util-linux
+ sys-libs/ncurses:0=
+ sys-libs/zlib
+ alsa? ( media-libs/alsa-lib )
+ bluetooth? ( net-wireless/bluez:= )
+ calendar? (
+ net-libs/neon:=
+ dev-libs/libical:=
+ dev-libs/iksemel
+ )
+ caps? ( sys-libs/libcap )
+ blocks? ( sys-libs/blocksruntime )
+ cluster? ( sys-cluster/corosync )
+ codec2? ( media-libs/codec2:= )
+ curl? ( net-misc/curl )
+ dahdi? (
+ net-libs/libpri
+ net-misc/dahdi-tools
+ )
+ freetds? ( dev-db/freetds )
+ gtalk? ( dev-libs/iksemel )
+ http? ( dev-libs/gmime:2.6 )
+ iconv? ( virtual/libiconv )
+ ilbc? ( media-libs/libilbc )
+ ldap? ( net-nds/openldap )
+ lua? ( ${LUA_DEPS} )
+ mysql? ( dev-db/mysql-connector-c:= )
+ newt? ( dev-libs/newt )
+ odbc? ( dev-db/unixODBC )
+ pjproject? ( >=net-libs/pjproject-2.9 )
+ portaudio? ( media-libs/portaudio )
+ postgres? ( dev-db/postgresql:* )
+ radius? ( net-dialup/freeradius-client )
+ snmp? ( net-analyzer/net-snmp:= )
+ span? ( media-libs/spandsp )
+ speex? (
+ media-libs/libogg
+ media-libs/speex
+ media-libs/speexdsp
+ )
+ srtp? ( net-libs/libsrtp:0 )
+ ssl? (
+ dev-libs/openssl:0=
+ )
+ unbound? ( net-dns/unbound )
+ vorbis? (
+ media-libs/libogg
+ media-libs/libvorbis
+ )
+ voicemail_storage_imap? ( virtual/imap-c-client )
+ xmpp? ( dev-libs/iksemel )
+"
+
+RDEPEND="${DEPEND}
+ net-misc/asterisk-core-sounds
+ net-misc/asterisk-extra-sounds
+ net-misc/asterisk-moh-opsound
+ selinux? ( sec-policy/selinux-asterisk )
+ syslog? ( virtual/logger )"
+
+BDEPEND="dev-libs/libxml2:2
+ virtual/pkgconfig"
+
+QA_DT_NEEDED="/usr/lib.*/libasteriskssl[.]so[.][0-9]\+"
+
+pkg_pretend() {
+ CONFIG_CHECK="~!NF_CONNTRACK_SIP"
+ local WARNING_NF_CONNTRACK_SIP="SIP (NAT) connection tracking is enabled. Some users
+ have reported that this module dropped critical SIP packets in their deployments. You
+ may want to disable it if you see such problems."
+ check_extra_config
+
+ [[ "${MERGE_TYPE}" == binary ]] && return
+
+ if tc-is-clang; then
+ use blocks || die "CC=clang requires USE=blocks"
+ else
+ use blocks && die "USE=blocks can only be used with CC=clang"
+ fi
+}
+
+pkg_setup() {
+ use lua && lua-single_pkg_setup
+}
+
+src_prepare() {
+ default
+ AT_M4DIR="autoconf third-party third-party/pjproject third-party/jansson" eautoreconf
+}
+
+src_configure() {
+ local vmst
+
+ econf \
+ LUA_VERSION="${ELUA#lua}" \
+ --libdir="/usr/$(get_libdir)" \
+ --localstatedir="/var" \
+ --with-crypto \
+ --with-gsm=internal \
+ --with-popt \
+ --with-z \
+ --with-libedit \
+ --without-jansson-bundled \
+ --without-pjproject-bundled \
+ $(use_with caps cap) \
+ $(use_with codec2) \
+ $(use_with lua lua) \
+ $(use_with http gmime) \
+ $(use_with newt) \
+ $(use_with pjproject) \
+ $(use_with portaudio) \
+ $(use_with ssl) \
+ $(use_with unbound)
+
+ _menuselect() {
+ menuselect/menuselect "$@" || die "menuselect $* failed."
+ }
+
+ _use_select() {
+ local state=$(use "$1" && echo enable || echo disable)
+ shift # remove use from parameters
+
+ while [[ -n $1 ]]; do
+ _menuselect --${state} "$1" menuselect.makeopts
+ shift
+ done
+ }
+
+ # Blank out sounds/sounds.xml file to prevent
+ # asterisk from installing sounds files (we pull them in via
+ # asterisk-{core,extra}-sounds and asterisk-moh-opsound.
+ >"${S}"/sounds/sounds.xml
+
+ # That NATIVE_ARCH chatter really is quite bothersome
+ sed -i 's/NATIVE_ARCH=/NATIVE_ARCH=0/' build_tools/menuselect-deps || die "Unable to squelch noisy build system"
+
+ # Compile menuselect binary for optional components
+ emake NOISY_BUILD=yes menuselect.makeopts
+
+ # Disable BUILD_NATIVE (bug #667498)
+ _menuselect --disable build_native menuselect.makeopts
+
+ # Broken functionality is forcibly disabled (bug #360143)
+ _menuselect --disable chan_misdn menuselect.makeopts
+ _menuselect --disable chan_ooh323 menuselect.makeopts
+
+ # Utility set is forcibly enabled (bug #358001)
+ _menuselect --enable smsq menuselect.makeopts
+ _menuselect --enable streamplayer menuselect.makeopts
+ _menuselect --enable aelparse menuselect.makeopts
+ _menuselect --enable astman menuselect.makeopts
+
+ # this is connected, otherwise it would not find
+ # ast_pktccops_gate_alloc symbol
+ _menuselect --enable chan_mgcp menuselect.makeopts
+ _menuselect --enable res_pktccops menuselect.makeopts
+
+ # SSL is forcibly enabled, IAX2 & DUNDI are expected to be available
+ _menuselect --enable pbx_dundi menuselect.makeopts
+ _menuselect --enable func_aes menuselect.makeopts
+ _menuselect --enable chan_iax2 menuselect.makeopts
+
+ # SQlite3 is now the main database backend, enable related features
+ _menuselect --enable cdr_sqlite3_custom menuselect.makeopts
+ _menuselect --enable cel_sqlite3_custom menuselect.makeopts
+
+ # The others are based on USE-flag settings
+ _use_select alsa chan_alsa
+ _use_select bluetooth chan_mobile
+ _use_select calendar res_calendar res_calendar_{caldav,ews,exchange,icalendar}
+ _use_select cluster res_corosync
+ _use_select codec2 codec_codec2
+ _use_select curl func_curl res_config_curl res_curl
+ _use_select dahdi app_dahdiras app_meetme chan_dahdi codec_dahdi res_timing_dahdi
+ _use_select freetds {cdr,cel}_tds
+ _use_select gtalk chan_motif
+ _use_select http res_http_post
+ _use_select iconv func_iconv
+ _use_select ilbc codec_ilbc format_ilbc
+ _use_select ldap res_config_ldap
+ _use_select lua pbx_lua
+ _use_select mysql app_mysql cdr_mysql res_config_mysql
+ _use_select odbc cdr_adaptive_odbc res_config_odbc {cdr,cel,res,func}_odbc
+ _use_select oss chan_oss
+ _use_select postgres {cdr,cel}_pgsql res_config_pgsql
+ _use_select radius {cdr,cel}_radius
+ _use_select snmp res_snmp
+ _use_select span res_fax_spandsp
+ _use_select speex {codec,func}_speex
+ _use_select speex format_ogg_speex
+ _use_select srtp res_srtp
+ _use_select statsd res_statsd res_{endpoint,chan}_stats
+ _use_select syslog cdr_syslog
+ _use_select vorbis format_ogg_vorbis
+ _use_select xmpp res_xmpp
+
+ # Voicemail storage ...
+ for vmst in "${IUSE_VOICEMAIL_STORAGE[@]}"; do
+ if use "${vmst#+}"; then
+ _menuselect --enable "$(echo "${vmst##*_}" | tr '[:lower:]' '[:upper:]')_STORAGE" menuselect.makeopts
+ fi
+ done
+
+ if use debug; then
+ for o in DONT_OPTIMIZE DEBUG_THREADS BETTER_BACKTRACES; do
+ _menuselect --enable "${o}" menuselect.makeopts
+ done
+ fi
+}
+
+src_compile() {
+ emake ASTCFLAGS="${CFLAGS}" ASTLDFLAGS="${LDFLAGS}" NOISY_BUILD=yes
+}
+
+src_install() {
+ local d
+
+ dodir "/usr/$(get_libdir)/pkgconfig"
+ emake DESTDIR="${D}" NOISY_BUILD=yes install
+
+ if use radius; then
+ insinto /etc/radiusclient/
+ doins contrib/dictionary.digium
+ fi
+ diropts -m 0750 -o root -g asterisk
+ keepdir /etc/asterisk
+ emake NOISY_BUILD=yes DESTDIR="${D}" CONFIG_SRC=configs/samples CONFIG_EXTEN=.sample install-configs
+ chown root:root "${ED}/etc/asterisk/"* || die "chown root:root of config files failed."
+ chmod 644 "${ED}/etc/asterisk/"* || die "chmod 644 of config files failed."
+
+ # keep directories
+ diropts -m 0750 -o asterisk -g root
+ keepdir /var/lib/asterisk
+ keepdir /var/spool/asterisk
+ keepdir /var/spool/asterisk/{system,tmp,meetme,monitor,dictate,voicemail,recording}
+ diropts -m 0750 -o asterisk -g asterisk
+ keepdir /var/log/asterisk/{cdr-csv,cdr-custom}
+
+ newinitd "${FILESDIR}"/initd-13.32.0-r1 asterisk
+ newconfd "${FILESDIR}"/confd-13.32.0 asterisk
+
+ systemd_dounit "${FILESDIR}"/asterisk.service
+ newtmpfiles "${FILESDIR}"/asterisk.tmpfiles2.conf asterisk.conf
+ systemd_install_serviced "${FILESDIR}"/asterisk.service.conf
+
+ # Reset diropts else dodoc uses it for doc installations.
+ diropts -m0755
+
+ # install the upgrade documentation
+ dodoc UPGRADE* BUGS CREDITS
+
+ # install extra documentation
+ use doc && dodoc doc/*.{txt,pdf}
+
+ # install logrotate snippet; bug #329281
+ #
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/1.6.2/asterisk.logrotate4" asterisk
+
+ # Asterisk installs a few folders that's empty by design,
+ # but still required. This finds them, and marks them for
+ # portage.
+ while read d < <(find "${ED}"/var -type d -empty || die "Find failed."); do
+ keepdir "${d#${ED}}"
+ done
+}
+
+pkg_postinst() {
+ if [ -z "${REPLACING_VERSIONS}" ]; then
+ elog "Asterisk Wiki: https://wiki.asterisk.org/wiki/"
+ elog "Gentoo VoIP IRC Channel: #gentoo-voip @ irc.freenode.net"
+ elif [ "$(ver_cut 1 "${REPLACING_VERSIONS}")" != "$(ver_cut 1)" ]; then
+ elog "You are updating from Asterisk $(ver_cut 1 "${REPLACING_VERSIONS}") upgrade document:"
+ elog "https://wiki.asterisk.org/wiki/display/AST/Upgrading+to+Asterisk+$(ver_cut 1)"
+ elog "Gentoo VoIP IRC Channel: #gentoo-voip @ irc.freenode.net"
+ fi
+}
diff --git a/net-misc/asterisk/asterisk-18.4.0.ebuild b/net-misc/asterisk/asterisk-18.4.0.ebuild
new file mode 100644
index 000000000000..7af5c494233a
--- /dev/null
+++ b/net-misc/asterisk/asterisk-18.4.0.ebuild
@@ -0,0 +1,361 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+LUA_COMPAT=( lua5-{1..4} )
+
+inherit autotools linux-info lua-single systemd toolchain-funcs tmpfiles
+
+DESCRIPTION="Asterisk: A Modular Open Source PBX System"
+HOMEPAGE="https://www.asterisk.org/"
+SRC_URI="https://downloads.asterisk.org/pub/telephony/asterisk/releases/${P}.tar.gz"
+LICENSE="GPL-2"
+SLOT="0/${PV%%.*}"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86"
+
+IUSE_VOICEMAIL_STORAGE=(
+ voicemail_storage_odbc
+ voicemail_storage_imap
+)
+IUSE="${IUSE_VOICEMAIL_STORAGE[*]} alsa blocks bluetooth calendar +caps cluster codec2 curl dahdi debug -deprecated doc freetds gtalk http iconv ilbc ldap lua mysql newt odbc oss pjproject portaudio postgres radius selinux snmp span speex srtp +ssl static statsd syslog systemd unbound vorbis xmpp"
+IUSE_EXPAND="VOICEMAIL_STORAGE"
+REQUIRED_USE="gtalk? ( xmpp )
+ lua? ( ${LUA_REQUIRED_USE} )
+ voicemail_storage_odbc? ( odbc )
+"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-16.16.2-no-var-run-install.patch"
+)
+
+DEPEND="acct-user/asterisk
+ acct-group/asterisk
+ dev-db/sqlite:3
+ dev-libs/popt
+ >=dev-libs/jansson-2.11
+ dev-libs/libedit
+ dev-libs/libxml2:2
+ dev-libs/libxslt
+ sys-apps/util-linux
+ sys-libs/zlib
+ alsa? ( media-libs/alsa-lib )
+ bluetooth? ( net-wireless/bluez:= )
+ calendar? (
+ net-libs/neon:=
+ dev-libs/libical:=
+ dev-libs/iksemel
+ )
+ caps? ( sys-libs/libcap )
+ blocks? ( sys-libs/blocksruntime )
+ cluster? ( sys-cluster/corosync )
+ codec2? ( media-libs/codec2:= )
+ curl? ( net-misc/curl )
+ dahdi? (
+ net-libs/libpri
+ net-misc/dahdi-tools
+ )
+ freetds? ( dev-db/freetds )
+ gtalk? ( dev-libs/iksemel )
+ http? ( dev-libs/gmime:2.6 )
+ iconv? ( virtual/libiconv )
+ ilbc? ( media-libs/libilbc )
+ ldap? ( net-nds/openldap )
+ lua? ( ${LUA_DEPS} )
+ mysql? ( dev-db/mysql-connector-c:= )
+ newt? ( dev-libs/newt )
+ odbc? ( dev-db/unixODBC )
+ pjproject? ( >=net-libs/pjproject-2.9:= )
+ portaudio? ( media-libs/portaudio )
+ postgres? ( dev-db/postgresql:* )
+ radius? ( net-dialup/freeradius-client )
+ snmp? ( net-analyzer/net-snmp:= )
+ span? ( media-libs/spandsp )
+ speex? (
+ media-libs/libogg
+ media-libs/speex
+ media-libs/speexdsp
+ )
+ srtp? ( net-libs/libsrtp:0 )
+ ssl? (
+ dev-libs/openssl:0=
+ )
+ systemd? ( sys-apps/systemd )
+ !systemd? ( !sys-apps/systemd )
+ unbound? ( net-dns/unbound )
+ vorbis? (
+ media-libs/libogg
+ media-libs/libvorbis
+ )
+ voicemail_storage_imap? ( virtual/imap-c-client )
+ xmpp? ( dev-libs/iksemel )
+"
+
+RDEPEND="${DEPEND}
+ net-misc/asterisk-core-sounds
+ net-misc/asterisk-extra-sounds
+ net-misc/asterisk-moh-opsound
+ selinux? ( sec-policy/selinux-asterisk )
+ syslog? ( virtual/logger )"
+
+BDEPEND="dev-libs/libxml2:2
+ virtual/pkgconfig"
+
+QA_DT_NEEDED="/usr/lib.*/libasteriskssl[.]so[.][0-9]\+"
+
+_make_args=(
+ "NOISY_BUILD=yes"
+ "ASTDBDIR=\$(ASTDATADIR)/astdb"
+ "ASTCACHEDIR=/var/cache/asterisk"
+ "OPTIMIZE="
+ "DEBUG="
+ "DESTDIR=${D}"
+ "CONFIG_SRC=configs/samples"
+ "CONFIG_EXTEN=.sample"
+)
+
+pkg_pretend() {
+ CONFIG_CHECK="~!NF_CONNTRACK_SIP"
+ local WARNING_NF_CONNTRACK_SIP="SIP (NAT) connection tracking is enabled. Some users
+ have reported that this module dropped critical SIP packets in their deployments. You
+ may want to disable it if you see such problems."
+ check_extra_config
+
+ [[ "${MERGE_TYPE}" == binary ]] && return
+
+ if tc-is-clang; then
+ use blocks || die "CC=clang requires USE=blocks"
+ else
+ use blocks && die "USE=blocks can only be used with CC=clang"
+ fi
+}
+
+pkg_setup() {
+ use lua && lua-single_pkg_setup
+}
+
+src_prepare() {
+ default
+ AT_M4DIR="autoconf third-party third-party/pjproject third-party/jansson" eautoreconf
+}
+
+src_configure() {
+ local vmst
+ local copt cstate
+
+ econf \
+ LUA_VERSION="${ELUA#lua}" \
+ --libdir="/usr/$(get_libdir)" \
+ --localstatedir="/var" \
+ --with-crypto \
+ --with-gsm=internal \
+ --with-popt \
+ --with-z \
+ --with-libedit \
+ --without-jansson-bundled \
+ --without-pjproject-bundled \
+ $(use_with caps cap) \
+ $(use_with codec2) \
+ $(use_with lua lua) \
+ $(use_with http gmime) \
+ $(use_with newt) \
+ $(use_with pjproject) \
+ $(use_with portaudio) \
+ $(use_with ssl) \
+ $(use_with unbound)
+
+ _menuselect() {
+ menuselect/menuselect "$@" || die "menuselect $* failed."
+ }
+
+ _use_select() {
+ local state=$(use "$1" && echo enable || echo disable)
+ shift # remove use from parameters
+
+ while [[ -n $1 ]]; do
+ _menuselect --${state} "$1" menuselect.makeopts
+ shift
+ done
+ }
+
+ # Blank out sounds/sounds.xml file to prevent
+ # asterisk from installing sounds files (we pull them in via
+ # asterisk-{core,extra}-sounds and asterisk-moh-opsound.
+ >"${S}"/sounds/sounds.xml
+
+ # That NATIVE_ARCH chatter really is quite bothersome
+ sed -i 's/NATIVE_ARCH=/NATIVE_ARCH=0/' build_tools/menuselect-deps || die "Unable to squelch noisy build system"
+
+ # Compile menuselect binary for optional components
+ emake "${_make_args[@]}" menuselect.makeopts
+
+ # Disable BUILD_NATIVE (bug #667498)
+ _menuselect --disable build_native menuselect.makeopts
+
+ # Broken functionality is forcibly disabled (bug #360143)
+ _menuselect --disable chan_misdn menuselect.makeopts
+ _menuselect --disable chan_ooh323 menuselect.makeopts
+
+ # Utility set is forcibly enabled (bug #358001)
+ _menuselect --enable smsq menuselect.makeopts
+ _menuselect --enable streamplayer menuselect.makeopts
+ _menuselect --enable aelparse menuselect.makeopts
+ _menuselect --enable astman menuselect.makeopts
+
+ # this is connected, otherwise it would not find
+ # ast_pktccops_gate_alloc symbol
+ _menuselect --enable chan_mgcp menuselect.makeopts
+ _menuselect --enable res_pktccops menuselect.makeopts
+
+ # SSL is forcibly enabled, IAX2 & DUNDI are expected to be available
+ _menuselect --enable pbx_dundi menuselect.makeopts
+ _menuselect --enable func_aes menuselect.makeopts
+ _menuselect --enable chan_iax2 menuselect.makeopts
+
+ # SQlite3 is now the main database backend, enable related features
+ _menuselect --enable cdr_sqlite3_custom menuselect.makeopts
+ _menuselect --enable cel_sqlite3_custom menuselect.makeopts
+
+ # The others are based on USE-flag settings
+ _use_select alsa chan_alsa
+ _use_select bluetooth chan_mobile
+ _use_select calendar res_calendar res_calendar_{caldav,ews,exchange,icalendar}
+ _use_select cluster res_corosync
+ _use_select codec2 codec_codec2
+ _use_select curl func_curl res_config_curl res_curl
+ _use_select dahdi app_dahdiras app_meetme chan_dahdi codec_dahdi res_timing_dahdi
+ _use_select deprecated app_macro
+ _use_select freetds {cdr,cel}_tds
+ _use_select gtalk chan_motif
+ _use_select http res_http_post
+ _use_select iconv func_iconv
+ _use_select ilbc codec_ilbc format_ilbc
+ _use_select ldap res_config_ldap
+ _use_select lua pbx_lua
+ _use_select mysql app_mysql cdr_mysql res_config_mysql
+ _use_select odbc cdr_adaptive_odbc res_config_odbc {cdr,cel,res,func}_odbc
+ _use_select oss chan_oss
+ _use_select postgres {cdr,cel}_pgsql res_config_pgsql
+ _use_select radius {cdr,cel}_radius
+ _use_select snmp res_snmp
+ _use_select span res_fax_spandsp
+ _use_select speex {codec,func}_speex
+ _use_select speex format_ogg_speex
+ _use_select srtp res_srtp
+ _use_select statsd res_statsd res_{endpoint,chan}_stats
+ _use_select syslog cdr_syslog
+ _use_select vorbis format_ogg_vorbis
+ _use_select xmpp res_xmpp
+
+ # Voicemail storage ...
+ _menuselect --enable app_voicemail menuselect.makeopts
+ for vmst in "${IUSE_VOICEMAIL_STORAGE[@]}"; do
+ if use "${vmst#+}"; then
+ _menuselect --enable "app_voicemail_${vmst##*_}" menuselect.makeopts
+ fi
+ done
+
+ if use debug; then
+ for o in DONT_OPTIMIZE DEBUG_FD_LEAKS MALLOC_DEBUG BETTER_BACKTRACES; do
+ _menuselect --enable "${o}" menuselect.makeopts
+ done
+ fi
+
+ if [[ -n "${GENTOO_ASTERISK_CUSTOM_MENUSELECT:+yes}" ]]; then
+ for copt in ${GENTOO_ASTERISK_CUSTOM_MENUSELECT}; do
+ cstate=--enable
+ [[ "${copt}" == -* ]] && cstate=--disable
+ ebegin "Custom option ${copt#[-+]} ${cstate:2}d"
+ _menuselect ${cstate} "${copt#[-+]}"
+ eend $?
+ done
+ fi
+}
+
+src_compile() {
+ emake "${_make_args[@]}"
+}
+
+src_install() {
+ local d
+
+ dodir "/usr/$(get_libdir)/pkgconfig"
+
+ diropts -m 0750 -o root -g asterisk
+ dodir /etc/asterisk
+
+ emake "${_make_args[@]}" install install-headers install-configs
+
+ fowners asterisk: /var/lib/asterisk/astdb
+
+ if use radius; then
+ insinto /etc/radiusclient/
+ doins contrib/dictionary.digium
+ fi
+
+ # keep directories
+ diropts -m 0750 -o asterisk -g root
+ keepdir /var/spool/asterisk/{system,tmp,meetme,monitor,dictate,voicemail,recording}
+ diropts -m 0750 -o asterisk -g asterisk
+ keepdir /var/log/asterisk/{cdr-csv,cdr-custom}
+
+ newinitd "${FILESDIR}"/initd-16.16.2-r1 asterisk
+ newconfd "${FILESDIR}"/confd-16.16.2-r1 asterisk
+
+ systemd_dounit "${FILESDIR}"/asterisk.service
+ newtmpfiles "${FILESDIR}"/asterisk.tmpfiles3.conf asterisk.conf
+ systemd_install_serviced "${FILESDIR}"/asterisk.service.conf
+
+ # Reset diropts else dodoc uses it for doc installations.
+ diropts -m0755
+
+ # install the upgrade documentation
+ dodoc UPGRADE* BUGS CREDITS
+
+ # install extra documentation
+ use doc && dodoc doc/*.{txt,pdf}
+
+ # install logrotate snippet; bug #329281
+ #
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/1.6.2/asterisk.logrotate4" asterisk
+
+ # Asterisk installs a few folders that's empty by design,
+ # but still required. This finds them, and marks them for
+ # portage.
+ while read d < <(find "${ED}"/var -type d -empty || die "Find failed."); do
+ keepdir "${d#${ED}}"
+ done
+}
+
+pkg_postinst() {
+ if [ -z "${REPLACING_VERSIONS}" ]; then
+ elog "Asterisk Wiki: https://wiki.asterisk.org/wiki/"
+ elog "Gentoo VoIP IRC Channel: #gentoo-voip @ irc.freenode.net"
+ elif [ "$(ver_cut 1 "${REPLACING_VERSIONS}")" != "$(ver_cut 1)" ]; then
+ elog "You are updating from Asterisk $(ver_cut 1 "${REPLACING_VERSIONS}") upgrade document:"
+ elog "https://wiki.asterisk.org/wiki/display/AST/Upgrading+to+Asterisk+$(ver_cut 1)"
+ elog "Gentoo VoIP IRC Channel: #gentoo-voip @ irc.freenode.net"
+ fi
+
+ if use deprecated; then
+ ewarn "You really aught to port whatever code you have that depends on this since these are going to go away."
+ ewarn "Refer: https://wiki.asterisk.org/wiki/display/AST/Module+Deprecation"
+ fi
+
+ if [[ -n "${GENTOO_ASTERISK_CUSTOM_MENUSELECT:+yes}" ]]; then
+ ewarn "You are using GENTOO_ASTERISK_CUSTOM_MENUSELECT, this should only be used"
+ ewarn "for debugging, for anything else, please file a bug on https://bugs.gentoo.org"
+ fi
+
+ if [[ -f /var/lib/asterisk/astdb.sqlite3 ]]; then
+ ewarn "Default astdb location has changed from /var/lib/asterisk to /var/lib/asterisk/astdb"
+ ewarn "You still have a /var/lib/asterisk/astdb.sqlite file. You need to either set"
+ ewarn "astdbdir in /etc/asterisk/asterisk.conf to /var/lib/asterisk or follow these"
+ ewarn "steps to migrate:"
+ ewarn "1. /etc/init.d/asterisk stop"
+ ewarn "2. mv /var/lib/asterisk/astdb.sqlite /var/lib/asterisk/astdb/"
+ ewarn "3. /etc/init.d/asterisk start"
+ ewarn "This update was done partly for security reasons so that /var/lib/asterisk can be root owned."
+ fi
+}
diff --git a/net-misc/asterisk/files/asterisk-13.38.2-r2-func_odbc_minargs-ARGC.patch b/net-misc/asterisk/files/asterisk-13.38.2-r2-func_odbc_minargs-ARGC.patch
new file mode 100644
index 000000000000..db3817b5242b
--- /dev/null
+++ b/net-misc/asterisk/files/asterisk-13.38.2-r2-func_odbc_minargs-ARGC.patch
@@ -0,0 +1,180 @@
+From d847f7e8f8736e5f51fd11df2992fac87131c1d8 Mon Sep 17 00:00:00 2001
+From: Jaco Kroon <jaco@uls.co.za>
+Date: Wed, 17 Feb 2021 22:51:17 +0200
+Subject: [PATCH] func_odbc: Introduce minargs config and expose ARGC in
+ addition to ARGn.
+
+minargs enables enforcing of minimum count of arguments to pass to
+func_odbc, so if you're unconditionally using ARG1 through ARG4 then
+this should be set to 4. func_odbc will generate an error in this case,
+so for example
+
+[FOO]
+minargs = 4
+
+and ODBC_FOO(a,b,c) in dialplan will now error out instead of using a
+potentially leaked ARG4 from Gosub().
+
+ARGC is needed if you're using optional argument, to verify whether or
+not an argument has been passed, else it's possible to use a leaked ARGn
+from Gosub (app_stack). So now you can safely do
+${IF($[${ARGC}>3]?${ARGV}:default value)} kind of thing.
+
+Change-Id: I6ca0b137d90b03f6aa9c496991f6cbf1518f6c24
+Signed-off-by: Jaco Kroon <jaco@uls.co.za>
+---
+ configs/samples/func_odbc.conf.sample | 11 +++++++
+ .../func_odbc_ARGC_minargs.txt | 20 ++++++++++++
+ funcs/func_odbc.c | 31 +++++++++++++++++--
+ 3 files changed, 60 insertions(+), 2 deletions(-)
+ create mode 100644 doc/CHANGES-staging/func_odbc_ARGC_minargs.txt
+
+diff --git a/configs/samples/func_odbc.conf.sample b/configs/samples/func_odbc.conf.sample
+index c467f7ec06..b825974ea7 100644
+--- a/configs/samples/func_odbc.conf.sample
++++ b/configs/samples/func_odbc.conf.sample
+@@ -23,6 +23,10 @@
+ ; For substitution, you have ${ARG1}, ${ARG2} ... ${ARGn}
+ ; for the arguments to each SQL statement.
+ ;
++; Additionally you can use ${ARGC} to determine the number of arguments that
++; was actually passed (or risk using leaked ARGn variables from the channel).
++; Also reference the minargs configuration option.
++;
+ ; In addition, for write statements, you have ${VAL1}, ${VAL2} ... ${VALn}
+ ; parsed, just like arguments, for the values. In addition, if you want the
+ ; whole value, never mind the parsing, you can get that with ${VALUE}.
+@@ -87,6 +91,13 @@
+ ; These additional rows can be returned by using the name of the
+ ; function which was called to retrieve the first row as an
+ ; argument to ODBC_FETCH().
++; minargs The minimum number of ARGUMENTS that has to be passed to the
++; function. If fewer arguments than this is passed, then the call
++; will fail. It is important to note that unlike Gosub() and friends,
++; func_odbc will not mask out ARGn variables that it's not actively
++; using, as such, without this, it's entirely possible to use say
++; ARG2 from the Gosub() inside func_odbc when the intent was to
++; use an argument passed to func_odbc, but it simply was never passed.
+
+
+ ; ODBC_SQL - Allow an SQL statement to be built entirely in the dialplan
+diff --git a/doc/CHANGES-staging/func_odbc_ARGC_minargs.txt b/doc/CHANGES-staging/func_odbc_ARGC_minargs.txt
+new file mode 100644
+index 0000000000..0984b5022d
+--- /dev/null
++++ b/doc/CHANGES-staging/func_odbc_ARGC_minargs.txt
+@@ -0,0 +1,20 @@
++Subject: func_odbc
++
++Introduce an ARGC variable for func_odbc functions, along with a minargs
++per-function configuration option.
++
++minargs enables enforcing of minimum count of arguments to pass to
++func_odbc, so if you're unconditionally using ARG1 through ARG4 then
++this should be set to 4. func_odbc will generate an error in this case,
++so for example
++
++[FOO]
++minargs = 4
++
++and ODBC_FOO(a,b,c) in dialplan will now error out instead of using a
++potentially leaked ARG4 from Gosub().
++
++ARGC is needed if you're using optional argument, to verify whether or
++not an argument has been passed, else it's possible to use a leaked ARGn
++from Gosub (app_stack). So now you can safely do
++${IF($[${ARGC}>3]?${ARGV}:default value)} kind of thing.
+diff --git a/funcs/func_odbc.c b/funcs/func_odbc.c
+index 5cc0faaa98..9d6d0fc304 100644
+--- a/funcs/func_odbc.c
++++ b/funcs/func_odbc.c
+@@ -120,6 +120,7 @@ struct acf_odbc_query {
+ char *sql_insert;
+ unsigned int flags;
+ int rowlimit;
++ int minargs;
+ struct ast_custom_function *acf;
+ };
+
+@@ -545,6 +546,14 @@ static int acf_odbc_write(struct ast_channel *chan, const char *cmd, char *s, co
+ return -1;
+ }
+
++ AST_STANDARD_APP_ARGS(args, s);
++ if (args.argc < query->minargs) {
++ ast_log(LOG_ERROR, "%d arguments supplied to '%s' requiring minimum %d\n",
++ args.argc, cmd, query->minargs);
++ AST_RWLIST_UNLOCK(&queries);
++ return -1;
++ }
++
+ if (!chan) {
+ if (!(chan = ast_dummy_channel_alloc())) {
+ AST_RWLIST_UNLOCK(&queries);
+@@ -578,7 +587,8 @@ static int acf_odbc_write(struct ast_channel *chan, const char *cmd, char *s, co
+ return -1;
+ }
+
+- AST_STANDARD_APP_ARGS(args, s);
++ snprintf(varname, sizeof(varname), "%u", args.argc);
++ pbx_builtin_pushvar_helper(chan, "ARGC", varname);
+ for (i = 0; i < args.argc; i++) {
+ snprintf(varname, sizeof(varname), "ARG%d", i + 1);
+ pbx_builtin_pushvar_helper(chan, varname, args.field[i]);
+@@ -603,6 +613,8 @@ static int acf_odbc_write(struct ast_channel *chan, const char *cmd, char *s, co
+ chan = ast_channel_unref(chan);
+ } else {
+ /* Restore prior values */
++ pbx_builtin_setvar_helper(chan, "ARGC", NULL);
++
+ for (i = 0; i < args.argc; i++) {
+ snprintf(varname, sizeof(varname), "ARG%d", i + 1);
+ pbx_builtin_setvar_helper(chan, varname, NULL);
+@@ -756,6 +768,14 @@ static int acf_odbc_read(struct ast_channel *chan, const char *cmd, char *s, cha
+ return -1;
+ }
+
++ AST_STANDARD_APP_ARGS(args, s);
++ if (args.argc < query->minargs) {
++ ast_log(LOG_ERROR, "%d arguments supplied to '%s' requiring minimum %d\n",
++ args.argc, cmd, query->minargs);
++ AST_RWLIST_UNLOCK(&queries);
++ return -1;
++ }
++
+ if (!chan) {
+ if (!(chan = ast_dummy_channel_alloc())) {
+ AST_RWLIST_UNLOCK(&queries);
+@@ -768,7 +788,8 @@ static int acf_odbc_read(struct ast_channel *chan, const char *cmd, char *s, cha
+ ast_autoservice_start(chan);
+ }
+
+- AST_STANDARD_APP_ARGS(args, s);
++ snprintf(varname, sizeof(varname), "%u", args.argc);
++ pbx_builtin_pushvar_helper(chan, "ARGC", varname);
+ for (x = 0; x < args.argc; x++) {
+ snprintf(varname, sizeof(varname), "ARG%d", x + 1);
+ pbx_builtin_pushvar_helper(chan, varname, args.field[x]);
+@@ -780,6 +801,8 @@ static int acf_odbc_read(struct ast_channel *chan, const char *cmd, char *s, cha
+ chan = ast_channel_unref(chan);
+ } else {
+ /* Restore prior values */
++ pbx_builtin_setvar_helper(chan, "ARGC", NULL);
++
+ for (x = 0; x < args.argc; x++) {
+ snprintf(varname, sizeof(varname), "ARG%d", x + 1);
+ pbx_builtin_setvar_helper(chan, varname, NULL);
+@@ -1290,6 +1313,10 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
+ sscanf(tmp, "%30d", &((*query)->rowlimit));
+ }
+
++ if ((tmp = ast_variable_retrieve(cfg, catg, "minargs"))) {
++ sscanf(tmp, "%30d", &((*query)->minargs));
++ }
++
+ (*query)->acf = ast_calloc(1, sizeof(struct ast_custom_function));
+ if (!(*query)->acf) {
+ free_acf_query(*query);
+--
+2.26.3
+