summaryrefslogtreecommitdiff
path: root/net-misc/asterisk
diff options
context:
space:
mode:
Diffstat (limited to 'net-misc/asterisk')
-rw-r--r--net-misc/asterisk/Manifest16
-rw-r--r--net-misc/asterisk/asterisk-13.38.2-r3.ebuild (renamed from net-misc/asterisk/asterisk-16.16.2-r1.ebuild)46
-rw-r--r--net-misc/asterisk/asterisk-16.17.0.ebuild319
-rw-r--r--net-misc/asterisk/asterisk-16.18.0-r1.ebuild (renamed from net-misc/asterisk/asterisk-16.16.2.ebuild)4
-rw-r--r--net-misc/asterisk/asterisk-16.18.0.ebuild318
-rw-r--r--net-misc/asterisk/asterisk-18.2.2.ebuild363
-rw-r--r--net-misc/asterisk/asterisk-18.3.0.ebuild362
-rw-r--r--net-misc/asterisk/asterisk-18.4.0-r1.ebuild (renamed from net-misc/asterisk/asterisk-18.4.0.ebuild)1
-rw-r--r--net-misc/asterisk/files/asterisk-13.38.2-r3-func_lock-fix-races.patch421
-rw-r--r--net-misc/asterisk/files/asterisk-16.18.0-r1-func_lock-fix-races.patch177
10 files changed, 621 insertions, 1406 deletions
diff --git a/net-misc/asterisk/Manifest b/net-misc/asterisk/Manifest
index 2982739083ee..6a7c32d5b326 100644
--- a/net-misc/asterisk/Manifest
+++ b/net-misc/asterisk/Manifest
@@ -4,8 +4,10 @@ AUX asterisk-13.38.1-r1-autoconf-lua-version.patch 2320 BLAKE2B 5f9a4b4063286f96
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-13.38.2-r3-func_lock-fix-races.patch 13721 BLAKE2B ad0ec83d10cd41aaf7fdd9a3b72c59e64c110a3b694e3ef5bd383efbf3fb7403f3f7b42cf61d9470c097cfb69a5445764134f00e590c022b8f9e7ce20ccf851e SHA512 0d13c50bf14351ed85305f737372c825ee950a760ad523b5f4976afd98c9d2907e6c0161621278598ab5ea507720146eaddebede59725e80f4632a7f9d77aa04
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-16.18.0-r1-func_lock-fix-races.patch 6085 BLAKE2B e53b5debccbd54505a51a38cc63f64fec10603abc47fbb86b171268ea3a90b6e041984eb8802efafae8df4bb2aa6098c78c0b6473cd0a0aac61cd233cbd322df SHA512 aa3cd2d1ddec0c0ca57bc6b7131b09c0aa691fd01cffa17b7797cc023627dba8b3a329cbdd6b72e51d73689a82682814e954906ea9fdd9716f1f7cb26d606224
AUX asterisk-historic-no-var-run-install.patch 790 BLAKE2B 6fb753a3dc1b557b4cca8df1dc93eba3de70114f0bb206692461a3faf4068ffbf641740fa51e5010cabf0cbb64d8856dd9a830eba802b1988208b8a185a1fc57 SHA512 9c941d49a1ea10f702b7ce2c9c4a120c0e8ea297f13ecaa9d2a9b059cf4452a981aa0e0eabd5c4711c222311e3f9a52ee1135c59433ba878a9bd3a979be852fd
AUX asterisk.service 456 BLAKE2B 4a5da9f0e45aa3b1eff29d59317d09e061e0a0e3c0e38cd39732e7880e96b7f34a68b44001d2608a7636b1259803f567b94bdb85ef15428727427fa1081ee385 SHA512 d443c3821d50e78a76b7cad8906f560ab0f4b58007f6c9322256626bc4a502bdbd844f1ee48cdaf86d499bf78f50cebb0cfc88a0cab0c4876f4e853bc2e76aa8
AUX asterisk.service.conf 324 BLAKE2B b802f69897f050f661412631da7ddc6e3207ff0d776ad2c2cfb13677049b8e3fce8c565103057745a48a4245f8c660f805088844fdea7fb042facd32b5ec13b7 SHA512 94be3b27f9d862d357b62d14b9d59ca47487bfd4987ce3b0ea2bb862c6d03e1d3c8b536590f20295fd085166da3efdff869c4cfc37542a31933d22b6d9b73da3
@@ -16,19 +18,11 @@ AUX confd-16.16.2-r1 4078 BLAKE2B 9d49eb95660f5cb92d62d34a262d77909ab9acd68afa35
AUX initd-13.32.0-r1 9945 BLAKE2B 231bb632b6634fbe1455ba9e6312562c00a14552a2a38fe88dce5655e36628644e38f07984e305c706b167ec3674eec63933fb889586b78a9386c16bb3765766 SHA512 6c31c7627e30b15a35540d9eabad310841b5f740f8f361fc01630fd6ab389bae02f0d1092ee35e6375b5ae93a7d8d71d03cb06201045d084882177a2ce49a4da
AUX initd-16.16.2-r1 9986 BLAKE2B 4b1c9537ef85c9de1d0064a851472163576480f08b573839db7860fd10828f444aef0f08d189a4e129a5545538424c1698e7d9d980cdbb44da2e68ff73dd0c75 SHA512 81747f6e6b4142b341797a8b2e9b212a48870d8db661669759020cc4c3ab0b66996a37dbd35afaa842dc00cd43aa834d3146021420b3f29b0d2f8b6e11d3fca7
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
DIST asterisk-18.4.0.tar.gz 27926601 BLAKE2B 1a4089ee274732462a8e480d449e4043f7393a6df0b78dd3ea341d3996b9e433066e6d7c53b3ab334db5946a4b847ac02abb4afc5747b6f541cad81a6d58d468 SHA512 024d0a5c75d55fe614ba6219aece62778e9522a0f8365d57192aa5aa22be94d45a3bed69ac14659738e97dd98967533c13096a855366083e6df2b7800e684602
EBUILD asterisk-13.38.2-r2.ebuild 10791 BLAKE2B 378bdbcd0cc936a195a72d61ad3bd8e074130fbb6bb7bf2b41eaffe89c2ced1606a53fe8d9d1fab986bedf12622d323bc46395e0914792b7b03911d9384c6193 SHA512 12caa9d74f34658a6888c043a3ce682a67671dfe1528a91712f8a72c73686ddcd881f138c8eff34f6fa4d1fdd0fc43e7a69a9c4e41ee11463e770681200d8192
+EBUILD asterisk-13.38.2-r3.ebuild 10793 BLAKE2B 9882ff88ad7d5afa2dc9372d4dec8975b5def601ad3b590df91cdeeb3c189f6672ed93781e73ccaef76fe1decd15421a8434aad92ace456dfc92e4dfe0c8007a SHA512 9ce8934d879c44e4218701390e35475eea4f7e5a336a113cc5067720d6ab1b5bc0f01a5b49083b55ad8b1ac2af936ff0330a2b618981a54fb52e6ccbe900eebd
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
+EBUILD asterisk-16.18.0-r1.ebuild 9855 BLAKE2B d17ca05051bfb2a28c4bac764226bcc285dfbc01d60e409ed1cc4ec00e430a0ba68768352dc66924bc8627f2f797be074f150b74da6176a319b069761d8081f4 SHA512 4db4384d0adf42c5201529fc032e7ce7570900cf83c16708841f64341b5673cf5adc7a4ee1f1306b6542049fd24f2bdc0669789ac0ab57a66c38952d40f9dd5d
+EBUILD asterisk-18.4.0-r1.ebuild 11217 BLAKE2B bb978a4fda8ef5f398d6b28c0bd6a9c0c3c021ff96396fedb94f4af831dcb4210393d44b312540ad14774007a083b006747ce4a26238d220fd57efe8aa96e05a SHA512 cb84fab3ce287ac75aa3f4fa391b5efff5606e2c9c5708ff3e0929e44ac0ef7b54d347db424e856a257a40839e1a9ccaeed8e615f56d8e21e216f4804a2bd767
MISC metadata.xml 1482 BLAKE2B 71a7d51199cb53116efd36963d5881264faa13f8beb375ab68074c3ab560443c3ea9cb021c5c03c9c55fdfa9fc27425c90b4313d3a3bd680079add6ebf5763d1 SHA512 df1f06ccc232488d08202b9f6bfc62e17769ef740a2c1da9ee8a2c48d40d7a293f522b6c9c899c7ae202ba7c6b207fc25e69730d2983bb307921f82c070a09ee
diff --git a/net-misc/asterisk/asterisk-16.16.2-r1.ebuild b/net-misc/asterisk/asterisk-13.38.2-r3.ebuild
index 26a46df8f972..c41ddbf6577a 100644
--- a/net-misc/asterisk/asterisk-16.16.2-r1.ebuild
+++ b/net-misc/asterisk/asterisk-13.38.2-r3.ebuild
@@ -19,8 +19,7 @@ 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"
+IUSE="${IUSE_VOICEMAIL_STORAGE[*]} alsa blocks bluetooth calendar +caps cluster 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 systemd vorbis xmpp"
REQUIRED_USE="gtalk? ( xmpp )
lua? ( ${LUA_REQUIRED_USE} )
^^ ( ${IUSE_VOICEMAIL_STORAGE[*]//+/} )
@@ -28,20 +27,22 @@ REQUIRED_USE="gtalk? ( xmpp )
"
PATCHES=(
- "${FILESDIR}/${PN}-16.16.2-no-var-run-install.patch"
- "${FILESDIR}/${PN}-16.15.1-r2-autoconf-2.70.patch"
+ "${FILESDIR}/${PN}-historic-no-var-run-install.patch"
+ "${FILESDIR}/${PN}-13.38.1-r1-autoconf-lua-version.patch"
+ "${FILESDIR}/${PN}-13.38.2-r3-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
acct-group/asterisk
dev-db/sqlite:3
dev-libs/popt
- >=dev-libs/jansson-2.11
+ dev-libs/jansson
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:= )
@@ -53,7 +54,6 @@ DEPEND="acct-user/asterisk
caps? ( sys-libs/libcap )
blocks? ( sys-libs/blocksruntime )
cluster? ( sys-cluster/corosync )
- codec2? ( media-libs/codec2:= )
curl? ( net-misc/curl )
dahdi? (
net-libs/libpri
@@ -69,14 +69,13 @@ DEPEND="acct-user/asterisk
mysql? ( dev-db/mysql-connector-c:= )
newt? ( dev-libs/newt )
odbc? ( dev-db/unixODBC )
- pjproject? ( >=net-libs/pjproject-2.9:= )
+ pjproject? ( net-libs/pjproject:= )
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
)
@@ -86,7 +85,6 @@ DEPEND="acct-user/asterisk
)
systemd? ( sys-apps/systemd )
!systemd? ( !sys-apps/systemd )
- unbound? ( net-dns/unbound )
vorbis? (
media-libs/libogg
media-libs/libvorbis
@@ -110,7 +108,6 @@ 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}"
@@ -156,24 +153,20 @@ src_configure() {
--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)
+ $(use_with ssl)
_menuselect() {
menuselect/menuselect "$@" || die "menuselect $* failed."
}
_use_select() {
- local state=$(use "$1" && echo enable || echo disable)
+ local state=$(usex "$1" enable disable)
shift # remove use from parameters
while [[ -n $1 ]]; do
@@ -225,10 +218,8 @@ src_configure() {
_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
@@ -244,7 +235,6 @@ src_configure() {
_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
@@ -260,7 +250,7 @@ src_configure() {
if use debug; then
for o in DONT_OPTIMIZE DEBUG_FD_LEAKS MALLOC_DEBUG BETTER_BACKTRACES; do
- _menuselect --enable "${o}" menuselect.makeopts
+ _menuselect --enable $o menuselect.makeopts
done
fi
@@ -283,9 +273,8 @@ src_install() {
local d
dodir "/usr/$(get_libdir)/pkgconfig"
-
diropts -m 0750 -o root -g asterisk
- dodir /etc/asterisk
+ dodir /etc/asterisk
emake "${_make_args[@]}" install install-configs
@@ -302,11 +291,11 @@ src_install() {
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
+ newinitd "${FILESDIR}"/initd-13.32.0-r1 asterisk
+ newconfd "${FILESDIR}"/confd-13.32.0 asterisk
systemd_dounit "${FILESDIR}"/asterisk.service
- newtmpfiles "${FILESDIR}"/asterisk.tmpfiles3.conf asterisk.conf
+ newtmpfiles "${FILESDIR}"/asterisk.tmpfiles2.conf asterisk.conf
systemd_install_serviced "${FILESDIR}"/asterisk.service.conf
# Reset diropts else dodoc uses it for doc installations.
@@ -341,11 +330,6 @@ pkg_postinst() {
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"
diff --git a/net-misc/asterisk/asterisk-16.17.0.ebuild b/net-misc/asterisk/asterisk-16.17.0.ebuild
deleted file mode 100644
index 2daad3a7ab31..000000000000
--- a/net-misc/asterisk/asterisk-16.17.0.ebuild
+++ /dev/null
@@ -1,319 +0,0 @@
-# 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"
- "${FILESDIR}/${PN}-13.38.2-r1-menuselect-exitcodes.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-16.16.2.ebuild b/net-misc/asterisk/asterisk-16.18.0-r1.ebuild
index c69374145886..520bcc0b1569 100644
--- a/net-misc/asterisk/asterisk-16.16.2.ebuild
+++ b/net-misc/asterisk/asterisk-16.18.0-r1.ebuild
@@ -28,8 +28,8 @@ REQUIRED_USE="gtalk? ( xmpp )
"
PATCHES=(
- "${FILESDIR}/asterisk-16.16.2-no-var-run-install.patch"
- "${FILESDIR}/asterisk-16.15.1-r2-autoconf-2.70.patch"
+ "${FILESDIR}/${PN}-16.16.2-no-var-run-install.patch"
+ "${FILESDIR}/${PN}-16.18.0-r1-func_lock-fix-races.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
deleted file mode 100644
index fd51937b8461..000000000000
--- a/net-misc/asterisk/asterisk-16.18.0.ebuild
+++ /dev/null
@@ -1,318 +0,0 @@
-# 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.2.2.ebuild b/net-misc/asterisk/asterisk-18.2.2.ebuild
deleted file mode 100644
index bd70db646a93..000000000000
--- a/net-misc/asterisk/asterisk-18.2.2.ebuild
+++ /dev/null
@@ -1,363 +0,0 @@
-# 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"
- "${FILESDIR}/${PN}-16.15.1-r2-autoconf-2.70.patch"
- "${FILESDIR}/${PN}-13.38.2-r1-menuselect-exitcodes.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/asterisk-18.3.0.ebuild b/net-misc/asterisk/asterisk-18.3.0.ebuild
deleted file mode 100644
index 15706359eafa..000000000000
--- a/net-misc/asterisk/asterisk-18.3.0.ebuild
+++ /dev/null
@@ -1,362 +0,0 @@
-# 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"
- "${FILESDIR}/${PN}-13.38.2-r1-menuselect-exitcodes.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/asterisk-18.4.0.ebuild b/net-misc/asterisk/asterisk-18.4.0-r1.ebuild
index 7af5c494233a..ad920ebb0ab2 100644
--- a/net-misc/asterisk/asterisk-18.4.0.ebuild
+++ b/net-misc/asterisk/asterisk-18.4.0-r1.ebuild
@@ -27,6 +27,7 @@ REQUIRED_USE="gtalk? ( xmpp )
PATCHES=(
"${FILESDIR}/${PN}-16.16.2-no-var-run-install.patch"
+ "${FILESDIR}/${PN}-16.18.0-r1-func_lock-fix-races.patch"
)
DEPEND="acct-user/asterisk
diff --git a/net-misc/asterisk/files/asterisk-13.38.2-r3-func_lock-fix-races.patch b/net-misc/asterisk/files/asterisk-13.38.2-r3-func_lock-fix-races.patch
new file mode 100644
index 000000000000..3d3c7b101d47
--- /dev/null
+++ b/net-misc/asterisk/files/asterisk-13.38.2-r3-func_lock-fix-races.patch
@@ -0,0 +1,421 @@
+From b35211fd58afcf430a0d95a243dc7a086d72b2b8 Mon Sep 17 00:00:00 2001
+From: Jaco Kroon <jaco@uls.co.za>
+Date: Fri, 21 May 2021 20:11:59 +0200
+Subject: [PATCH] Replacement patch for v13.
+
+Change-Id: I30236d7d7229f317c681fb7c6d7944d6108acd08
+---
+ funcs/func_lock.c | 234 +++++++++++++++++++++++++---------------------
+ 1 file changed, 126 insertions(+), 108 deletions(-)
+
+diff --git a/funcs/func_lock.c b/funcs/func_lock.c
+index a006a574eb..c472504f52 100644
+--- a/funcs/func_lock.c
++++ b/funcs/func_lock.c
+@@ -44,6 +44,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+ #include "asterisk/linkedlists.h"
+ #include "asterisk/astobj2.h"
+ #include "asterisk/utils.h"
++#include "asterisk/cli.h"
+
+ /*** DOCUMENTATION
+ <function name="LOCK" language="en_US">
+@@ -112,7 +113,6 @@ static AST_LIST_HEAD_STATIC(locklist, lock_frame);
+ static void lock_free(void *data);
+ static void lock_fixup(void *data, struct ast_channel *oldchan, struct ast_channel *newchan);
+ static int unloading = 0;
+-static pthread_t broker_tid = AST_PTHREADT_NULL;
+
+ static const struct ast_datastore_info lock_info = {
+ .type = "MUTEX",
+@@ -126,8 +126,8 @@ struct lock_frame {
+ ast_cond_t cond;
+ /*! count is needed so if a recursive mutex exits early, we know how many times to unlock it. */
+ unsigned int count;
+- /*! Container of requesters for the named lock */
+- struct ao2_container *requesters;
++ /*! Count of waiting of requesters for the named lock */
++ unsigned int requesters;
+ /*! who owns us */
+ struct ast_channel *owner;
+ /*! name of the lock */
+@@ -149,14 +149,19 @@ static void lock_free(void *data)
+ while ((clframe = AST_LIST_REMOVE_HEAD(oldlist, list))) {
+ /* Only unlock if we own the lock */
+ if (clframe->channel == clframe->lock_frame->owner) {
++ ast_mutex_lock(&clframe->lock_frame->mutex);
+ clframe->lock_frame->count = 0;
+ clframe->lock_frame->owner = NULL;
++ ast_cond_signal(&clframe->lock_frame->cond);
++ ast_mutex_unlock(&clframe->lock_frame->mutex);
+ }
+ ast_free(clframe);
+ }
+ AST_LIST_UNLOCK(oldlist);
+ AST_LIST_HEAD_DESTROY(oldlist);
+ ast_free(oldlist);
++
++ ast_module_unref(ast_module_info->self);
+ }
+
+ static void lock_fixup(void *data, struct ast_channel *oldchan, struct ast_channel *newchan)
+@@ -175,54 +180,11 @@ static void lock_fixup(void *data, struct ast_channel *oldchan, struct ast_chann
+ if (clframe->lock_frame->owner == oldchan) {
+ clframe->lock_frame->owner = newchan;
+ }
+- /* We don't move requesters, because the thread stack is different */
+ clframe->channel = newchan;
+ }
+ AST_LIST_UNLOCK(list);
+ }
+
+-static void *lock_broker(void *unused)
+-{
+- struct lock_frame *frame;
+- struct timespec forever = { 1000000, 0 };
+- for (;;) {
+- int found_requester = 0;
+-
+- /* Test for cancel outside of the lock */
+- pthread_testcancel();
+- AST_LIST_LOCK(&locklist);
+-
+- AST_LIST_TRAVERSE(&locklist, frame, entries) {
+- if (ao2_container_count(frame->requesters)) {
+- found_requester++;
+- ast_mutex_lock(&frame->mutex);
+- if (!frame->owner) {
+- ast_cond_signal(&frame->cond);
+- }
+- ast_mutex_unlock(&frame->mutex);
+- }
+- }
+-
+- AST_LIST_UNLOCK(&locklist);
+- pthread_testcancel();
+-
+- /* If there are no requesters, then wait for a signal */
+- if (!found_requester) {
+- nanosleep(&forever, NULL);
+- } else {
+- sched_yield();
+- }
+- }
+- /* Not reached */
+- return NULL;
+-}
+-
+-static int ast_channel_cmp_cb(void *obj, void *arg, int flags)
+-{
+- struct ast_channel *chan = obj, *cmp_args = arg;
+- return strcasecmp(ast_channel_name(chan), ast_channel_name(cmp_args)) ? 0 : CMP_MATCH;
+-}
+-
+ static int get_lock(struct ast_channel *chan, char *lockname, int trylock)
+ {
+ struct ast_datastore *lock_store = ast_channel_datastore_find(chan, &lock_info, NULL);
+@@ -234,7 +196,12 @@ static int get_lock(struct ast_channel *chan, char *lockname, int trylock)
+ struct timeval now;
+
+ if (!lock_store) {
+- ast_debug(1, "Channel %s has no lock datastore, so we're allocating one.\n", ast_channel_name(chan));
++ if (unloading) {
++ ast_log(LOG_ERROR, "%sLOCK has no datastore and func_lock is unloading, failing.\n",
++ trylock ? "TRY" : "");
++ return -1;
++ }
++
+ lock_store = ast_datastore_alloc(&lock_info, NULL);
+ if (!lock_store) {
+ ast_log(LOG_ERROR, "Unable to allocate new datastore. No locks will be obtained.\n");
+@@ -253,6 +220,9 @@ static int get_lock(struct ast_channel *chan, char *lockname, int trylock)
+ lock_store->data = list;
+ AST_LIST_HEAD_INIT(list);
+ ast_channel_datastore_add(chan, lock_store);
++
++ /* We cannot unload until this channel has released the lock_store */
++ ast_module_ref(ast_module_info->self);
+ } else
+ list = lock_store->data;
+
+@@ -266,6 +236,9 @@ static int get_lock(struct ast_channel *chan, char *lockname, int trylock)
+
+ if (!current) {
+ if (unloading) {
++ ast_log(LOG_ERROR,
++ "Lock doesn't exist whilst unloading. %sLOCK will fail.\n",
++ trylock ? "TRY" : "");
+ /* Don't bother */
+ AST_LIST_UNLOCK(&locklist);
+ return -1;
+@@ -292,17 +265,12 @@ static int get_lock(struct ast_channel *chan, char *lockname, int trylock)
+ AST_LIST_UNLOCK(&locklist);
+ return -1;
+ }
+- current->requesters = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0,
+- NULL, ast_channel_cmp_cb);
+- if (!current->requesters) {
+- ast_mutex_destroy(&current->mutex);
+- ast_cond_destroy(&current->cond);
+- ast_free(current);
+- AST_LIST_UNLOCK(&locklist);
+- return -1;
+- }
+ AST_LIST_INSERT_TAIL(&locklist, current, entries);
+ }
++ /* Add to requester list */
++ ast_mutex_lock(&current->mutex);
++ current->requesters++;
++ ast_mutex_unlock(&current->mutex);
+ AST_LIST_UNLOCK(&locklist);
+
+ /* Found lock or created one - now find or create the corresponding link in the channel */
+@@ -315,7 +283,13 @@ static int get_lock(struct ast_channel *chan, char *lockname, int trylock)
+
+ if (!clframe) {
+ if (unloading) {
++ ast_log(LOG_ERROR,
++ "Busy unloading. %sLOCK will fail.\n",
++ trylock ? "TRY" : "");
+ /* Don't bother */
++ ast_mutex_lock(&current->mutex);
++ current->requesters--;
++ ast_mutex_unlock(&current->mutex);
+ AST_LIST_UNLOCK(list);
+ return -1;
+ }
+@@ -324,6 +298,9 @@ static int get_lock(struct ast_channel *chan, char *lockname, int trylock)
+ ast_log(LOG_ERROR,
+ "Unable to allocate channel lock frame. %sLOCK will fail.\n",
+ trylock ? "TRY" : "");
++ ast_mutex_lock(&current->mutex);
++ current->requesters--;
++ ast_mutex_unlock(&current->mutex);
+ AST_LIST_UNLOCK(list);
+ return -1;
+ }
+@@ -339,44 +316,44 @@ static int get_lock(struct ast_channel *chan, char *lockname, int trylock)
+ * the same amount, before we'll release this one.
+ */
+ if (current->owner == chan) {
++ /* We're not a requester, we already have it */
++ ast_mutex_lock(&current->mutex);
++ current->requesters--;
++ ast_mutex_unlock(&current->mutex);
+ current->count++;
+ return 0;
+ }
+
+- /* Okay, we have both frames, so now we need to try to lock.
+- *
+- * Locking order: always lock locklist first. We need the
+- * locklist lock because the broker thread counts whether
+- * there are requesters with the locklist lock held, and we
+- * need to hold it, so that when we send our signal, below,
+- * to wake up the broker thread, it definitely will see that
+- * a requester exists at that point in time. Otherwise, we
+- * could add to the requesters after it has already seen that
+- * that lock is unoccupied and wait forever for another signal.
+- */
+- AST_LIST_LOCK(&locklist);
+- ast_mutex_lock(&current->mutex);
+- /* Add to requester list */
+- ao2_link(current->requesters, chan);
+- pthread_kill(broker_tid, SIGURG);
+- AST_LIST_UNLOCK(&locklist);
+-
+ /* Wait up to three seconds from now for LOCK. */
+ now = ast_tvnow();
+ timeout.tv_sec = now.tv_sec + 3;
+ timeout.tv_nsec = now.tv_usec * 1000;
+
+- if (!current->owner
+- || (!trylock
+- && !(res = ast_cond_timedwait(&current->cond, &current->mutex, &timeout)))) {
+- res = 0;
++ ast_mutex_lock(&current->mutex);
++
++ res = 0;
++ while (!trylock && !res && current->owner) {
++ res = ast_cond_timedwait(&current->cond, &current->mutex, &timeout);
++ }
++ if (current->owner) {
++ ast_log(LOG_ERROR, "%sLOCK failed to obtain lock %s.\n", trylock ? "TRY" : "",
++ lockname);
++ /* timeout;
++ * trylock; or
++ * cond_timedwait failed.
++ *
++ * either way, we fail to obtain the lock.
++ */
++ res = -1;
++ } else {
+ current->owner = chan;
+ current->count++;
+- } else {
+- res = -1;
++ res = 0;
+ }
+ /* Remove from requester list */
+- ao2_unlink(current->requesters, chan);
++ current->requesters--;
++ if (res && unloading)
++ ast_cond_signal(&current->cond);
+ ast_mutex_unlock(&current->mutex);
+
+ return res;
+@@ -400,7 +377,7 @@ static int unlock_read(struct ast_channel *chan, const char *cmd, char *data, ch
+ }
+
+ if (!(list = lock_store->data)) {
+- ast_debug(1, "This should NEVER happen\n");
++ ast_log(LOG_ERROR, "Datastore's data member is NULL ... this should be impossible.");
+ ast_copy_string(buf, "0", len);
+ return 0;
+ }
+@@ -419,12 +396,17 @@ static int unlock_read(struct ast_channel *chan, const char *cmd, char *data, ch
+
+ if (!clframe) {
+ /* We didn't have this lock in the first place */
++ ast_log(LOG_WARNING, "Attempting to UNLOCK(%s) - a lock this channel never owned.\n",
++ data);
+ ast_copy_string(buf, "0", len);
+ return 0;
+ }
+
+ if (--clframe->lock_frame->count == 0) {
++ ast_mutex_lock(&clframe->lock_frame->mutex);
+ clframe->lock_frame->owner = NULL;
++ ast_cond_signal(&clframe->lock_frame->cond);
++ ast_mutex_unlock(&clframe->lock_frame->mutex);
+ }
+
+ ast_copy_string(buf, "1", len);
+@@ -455,6 +437,37 @@ static int trylock_read(struct ast_channel *chan, const char *cmd, char *data, c
+ return 0;
+ }
+
++static char *handle_cli_locks_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
++{
++ int c = 0;
++ struct lock_frame* current;
++ switch (cmd) {
++ case CLI_INIT:
++ e->command = "locks show";
++ e->usage =
++ "Usage: locks show\n"
++ " List all locks known to func_lock, along with their current status.\n";
++ return NULL;
++ case CLI_GENERATE:
++ return NULL;
++ }
++
++ ast_cli(a->fd, "func_lock locks:\n");
++ ast_cli(a->fd, "%-40s Requesters Owner\n", "Name");
++ AST_LIST_LOCK(&locklist);
++ AST_LIST_TRAVERSE(&locklist, current, entries) {
++ ast_mutex_lock(&current->mutex);
++ ast_cli(a->fd, "%-40s %-10d %s\n", current->name, current->requesters,
++ current->owner ? ast_channel_name(current->owner) : "(unlocked)");
++ ast_mutex_unlock(&current->mutex);
++ c++;
++ }
++ AST_LIST_UNLOCK(&locklist);
++ ast_cli(a->fd, "%d total locks listed.\n", c);
++
++ return 0;
++}
++
+ static struct ast_custom_function lock_function = {
+ .name = "LOCK",
+ .read = lock_read,
+@@ -473,6 +486,8 @@ static struct ast_custom_function unlock_function = {
+ .read_max = 2,
+ };
+
++static struct ast_cli_entry cli_locks_show = AST_CLI_DEFINE(handle_cli_locks_show, "List func_lock locks.");
++
+ static int unload_module(void)
+ {
+ struct lock_frame *current;
+@@ -480,34 +495,43 @@ static int unload_module(void)
+ /* Module flag */
+ unloading = 1;
+
++ /* Make it impossible for new requesters to be added
++ * NOTE: channels could already be in get_lock() */
++ ast_custom_function_unregister(&lock_function);
++ ast_custom_function_unregister(&trylock_function);
++
++ ast_cli_unregister(&cli_locks_show);
++
+ AST_LIST_LOCK(&locklist);
+ while ((current = AST_LIST_REMOVE_HEAD(&locklist, entries))) {
+- /* If any locks are currently in use, then we cannot unload this module */
+- if (current->owner || ao2_container_count(current->requesters)) {
+- /* Put it back */
+- AST_LIST_INSERT_HEAD(&locklist, current, entries);
+- AST_LIST_UNLOCK(&locklist);
+- unloading = 0;
+- return -1;
++ int warned = 0;
++ ast_mutex_lock(&current->mutex);
++ while (current->owner || current->requesters) {
++ if (!warned) {
++ ast_log(LOG_WARNING, "Waiting for %d requesters for %s lock %s.\n",
++ current->requesters, current->owner ? "locked" : "unlocked",
++ current->name);
++ warned = 1;
++ }
++ /* either the mutex is locked, or other parties are currently in get_lock,
++ * we need to wait for all of those to clear first */
++ ast_cond_wait(&current->cond, &current->mutex);
+ }
++ ast_mutex_unlock(&current->mutex);
++ /* At this point we know:
++ * 1. the lock has been released,
++ * 2. there are no requesters (nor should any be able to sneak in).
++ */
+ ast_mutex_destroy(&current->mutex);
+- ao2_ref(current->requesters, -1);
++ ast_cond_destroy(&current->cond);
+ ast_free(current);
+ }
++ AST_LIST_UNLOCK(&locklist);
++ AST_LIST_HEAD_DESTROY(&locklist);
+
+- /* No locks left, unregister functions */
+- ast_custom_function_unregister(&lock_function);
+- ast_custom_function_unregister(&trylock_function);
++ /* At this point we can safely stop access to UNLOCK */
+ ast_custom_function_unregister(&unlock_function);
+
+- if (broker_tid != AST_PTHREADT_NULL) {
+- pthread_cancel(broker_tid);
+- pthread_kill(broker_tid, SIGURG);
+- pthread_join(broker_tid, NULL);
+- }
+-
+- AST_LIST_UNLOCK(&locklist);
+-
+ return 0;
+ }
+
+@@ -516,13 +540,7 @@ static int load_module(void)
+ int res = ast_custom_function_register_escalating(&lock_function, AST_CFE_READ);
+ res |= ast_custom_function_register_escalating(&trylock_function, AST_CFE_READ);
+ res |= ast_custom_function_register_escalating(&unlock_function, AST_CFE_READ);
+-
+- if (ast_pthread_create_background(&broker_tid, NULL, lock_broker, NULL)) {
+- ast_log(LOG_ERROR, "Failed to start lock broker thread. Unloading func_lock module.\n");
+- broker_tid = AST_PTHREADT_NULL;
+- unload_module();
+- return AST_MODULE_LOAD_DECLINE;
+- }
++ res |= ast_cli_register(&cli_locks_show);
+
+ return res;
+ }
+--
+2.26.3
+
diff --git a/net-misc/asterisk/files/asterisk-16.18.0-r1-func_lock-fix-races.patch b/net-misc/asterisk/files/asterisk-16.18.0-r1-func_lock-fix-races.patch
new file mode 100644
index 000000000000..a18ef34d499c
--- /dev/null
+++ b/net-misc/asterisk/files/asterisk-16.18.0-r1-func_lock-fix-races.patch
@@ -0,0 +1,177 @@
+Combined patch from upstream (All authored by myself):
+
+https://gerrit.asterisk.org/c/asterisk/+/15942 (CLI: locks show)
+https://gerrit.asterisk.org/c/asterisk/+/15943 (unload memory corruption)
+https://gerrit.asterisk.org/c/asterisk/+/15944 (error path ref counting)
+https://gerrit.asterisk.org/c/asterisk/+/15945 (ast_module_ref usage)
+
+The cause of my nightmares was the unload memory corruption, however,
+the other two whilst much less likely to occur are just as serious.
+
+Fixes on all has been well tested. The individual patches are quite small.
+
+Signed-off-by: Jaco Kroon <jaco@uls.co.za>
+---
+diff --git a/funcs/func_lock.c b/funcs/func_lock.c
+index 072640751e..31a7fcda29 100644
+--- a/funcs/func_lock.c
++++ b/funcs/func_lock.c
+@@ -42,6 +42,7 @@
+ #include "asterisk/linkedlists.h"
+ #include "asterisk/astobj2.h"
+ #include "asterisk/utils.h"
++#include "asterisk/cli.h"
+
+ /*** DOCUMENTATION
+ <function name="LOCK" language="en_US">
+@@ -157,6 +158,8 @@ static void lock_free(void *data)
+ AST_LIST_UNLOCK(oldlist);
+ AST_LIST_HEAD_DESTROY(oldlist);
+ ast_free(oldlist);
++
++ ast_module_unref(ast_module_info->self);
+ }
+
+ static void lock_fixup(void *data, struct ast_channel *oldchan, struct ast_channel *newchan)
+@@ -191,7 +194,12 @@ static int get_lock(struct ast_channel *chan, char *lockname, int trylock)
+ struct timeval now;
+
+ if (!lock_store) {
+- ast_debug(1, "Channel %s has no lock datastore, so we're allocating one.\n", ast_channel_name(chan));
++ if (unloading) {
++ ast_log(LOG_ERROR, "%sLOCK has no datastore and func_lock is unloading, failing.\n",
++ trylock ? "TRY" : "");
++ return -1;
++ }
++
+ lock_store = ast_datastore_alloc(&lock_info, NULL);
+ if (!lock_store) {
+ ast_log(LOG_ERROR, "Unable to allocate new datastore. No locks will be obtained.\n");
+@@ -210,6 +218,9 @@ static int get_lock(struct ast_channel *chan, char *lockname, int trylock)
+ lock_store->data = list;
+ AST_LIST_HEAD_INIT(list);
+ ast_channel_datastore_add(chan, lock_store);
++
++ /* We cannot unload until this channel has released the lock_store */
++ ast_module_ref(ast_module_info->self);
+ } else
+ list = lock_store->data;
+
+@@ -223,6 +234,9 @@ static int get_lock(struct ast_channel *chan, char *lockname, int trylock)
+
+ if (!current) {
+ if (unloading) {
++ ast_log(LOG_ERROR,
++ "Lock doesn't exist whilst unloading. %sLOCK will fail.\n",
++ trylock ? "TRY" : "");
+ /* Don't bother */
+ AST_LIST_UNLOCK(&locklist);
+ return -1;
+@@ -249,7 +263,6 @@ static int get_lock(struct ast_channel *chan, char *lockname, int trylock)
+ AST_LIST_UNLOCK(&locklist);
+ return -1;
+ }
+- current->requesters = 0;
+ AST_LIST_INSERT_TAIL(&locklist, current, entries);
+ }
+ /* Add to requester list */
+@@ -268,7 +281,13 @@ static int get_lock(struct ast_channel *chan, char *lockname, int trylock)
+
+ if (!clframe) {
+ if (unloading) {
++ ast_log(LOG_ERROR,
++ "Busy unloading. %sLOCK will fail.\n",
++ trylock ? "TRY" : "");
+ /* Don't bother */
++ ast_mutex_lock(&current->mutex);
++ current->requesters--;
++ ast_mutex_unlock(&current->mutex);
+ AST_LIST_UNLOCK(list);
+ return -1;
+ }
+@@ -277,6 +296,9 @@ static int get_lock(struct ast_channel *chan, char *lockname, int trylock)
+ ast_log(LOG_ERROR,
+ "Unable to allocate channel lock frame. %sLOCK will fail.\n",
+ trylock ? "TRY" : "");
++ ast_mutex_lock(&current->mutex);
++ current->requesters--;
++ ast_mutex_unlock(&current->mutex);
+ AST_LIST_UNLOCK(list);
+ return -1;
+ }
+@@ -409,6 +431,37 @@ static int trylock_read(struct ast_channel *chan, const char *cmd, char *data, c
+ return 0;
+ }
+
++static char *handle_cli_locks_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
++{
++ int c = 0;
++ struct lock_frame* current;
++ switch (cmd) {
++ case CLI_INIT:
++ e->command = "locks show";
++ e->usage =
++ "Usage: locks show\n"
++ " List all locks known to func_lock, along with their current status.\n";
++ return NULL;
++ case CLI_GENERATE:
++ return NULL;
++ }
++
++ ast_cli(a->fd, "func_lock locks:\n");
++ ast_cli(a->fd, "%-40s Requesters Owner\n", "Name");
++ AST_LIST_LOCK(&locklist);
++ AST_LIST_TRAVERSE(&locklist, current, entries) {
++ ast_mutex_lock(&current->mutex);
++ ast_cli(a->fd, "%-40s %-10d %s\n", current->name, current->requesters,
++ current->owner ? ast_channel_name(current->owner) : "(unlocked)");
++ ast_mutex_unlock(&current->mutex);
++ c++;
++ }
++ AST_LIST_UNLOCK(&locklist);
++ ast_cli(a->fd, "%d total locks listed.\n", c);
++
++ return 0;
++}
++
+ static struct ast_custom_function lock_function = {
+ .name = "LOCK",
+ .read = lock_read,
+@@ -427,6 +480,8 @@ static struct ast_custom_function unlock_function = {
+ .read_max = 2,
+ };
+
++static struct ast_cli_entry cli_locks_show = AST_CLI_DEFINE(handle_cli_locks_show, "List func_lock locks.");
++
+ static int unload_module(void)
+ {
+ struct lock_frame *current;
+@@ -439,10 +494,19 @@ static int unload_module(void)
+ ast_custom_function_unregister(&lock_function);
+ ast_custom_function_unregister(&trylock_function);
+
++ ast_cli_unregister(&cli_locks_show);
++
+ AST_LIST_LOCK(&locklist);
+- AST_LIST_TRAVERSE(&locklist, current, entries) {
++ while ((current = AST_LIST_REMOVE_HEAD(&locklist, entries))) {
++ int warned = 0;
+ ast_mutex_lock(&current->mutex);
+ while (current->owner || current->requesters) {
++ if (!warned) {
++ ast_log(LOG_WARNING, "Waiting for %d requesters for %s lock %s.\n",
++ current->requesters, current->owner ? "locked" : "unlocked",
++ current->name);
++ warned = 1;
++ }
+ /* either the mutex is locked, or other parties are currently in get_lock,
+ * we need to wait for all of those to clear first */
+ ast_cond_wait(&current->cond, &current->mutex);
+@@ -470,6 +534,7 @@ static int load_module(void)
+ int res = ast_custom_function_register_escalating(&lock_function, AST_CFE_READ);
+ res |= ast_custom_function_register_escalating(&trylock_function, AST_CFE_READ);
+ res |= ast_custom_function_register_escalating(&unlock_function, AST_CFE_READ);
++ res |= ast_cli_register(&cli_locks_show);
+
+ return res;
+ }