diff --git a/main/asterisk/APKBUILD b/main/asterisk/APKBUILD
index 785a9653bc70b012d6d75aca02b54264da735164..efaf9654ca3db1a9b455b8c563a217c5046c9e45 100644
--- a/main/asterisk/APKBUILD
+++ b/main/asterisk/APKBUILD
@@ -4,7 +4,7 @@
 # Maintainer: Timo Teras <timo.teras@iki.fi>
 pkgname=asterisk
 pkgver=18.2.2
-pkgrel=2
+pkgrel=3
 pkgdesc="Modular Open Source PBX System"
 pkgusers="asterisk"
 pkggroups="asterisk"
@@ -12,23 +12,57 @@ url="https://www.asterisk.org/"
 arch="all"
 license="GPL-2.0-only WITH OpenSSL-Exception"
 options="!check"  # Test suite is separate, and require separate build
-makedepends="findutils tar bsd-compat-headers libtool
-	ncurses-dev popt-dev newt-dev zlib-dev libedit-dev tiff-dev curl-dev
-	openssl-dev lua-dev libcap-dev jansson-dev util-linux-dev
-	sqlite-dev postgresql-dev unixodbc-dev freetds-dev mariadb-connector-c-dev
-	alsa-lib-dev pjproject-dev dahdi-tools-dev libpri-dev libsrtp-dev
-	spandsp-dev libresample speex-dev speexdsp-dev libogg-dev
-	bluez-dev libxml2-dev imap-dev unbound-dev"
+makedepends="
+	alsa-lib-dev
+	bluez-dev
+	bsd-compat-headers
+	curl-dev
+	dahdi-tools-dev
+	findutils
+	freetds-dev
+	imap-dev
+	jansson-dev
+	libcap-dev
+	libedit-dev
+	libogg-dev
+	libpri-dev
+	libresample
+	libsrtp-dev
+	libtool
+	libxml2-dev
+	lua-dev
+	mariadb-connector-c-dev
+	ncurses-dev
+	newt-dev
+	openssl-dev
+	opus-dev
+	opusfile-dev
+	pjproject-dev
+	popt-dev
+	postgresql-dev
+	spandsp-dev
+	speexdsp-dev
+	speex-dev
+	sqlite-dev
+	tar
+	tiff-dev
+	unbound-dev
+	unixodbc-dev
+	util-linux-dev
+	zlib-dev
+	"
 install="$pkgname.pre-install $pkgname.pre-upgrade"
 subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc $pkgname-pgsql $pkgname-odbc
 	$pkgname-tds $pkgname-fax $pkgname-sample-config:config:noarch
 	$pkgname-sounds-moh:sound_moh:noarch $pkgname-sounds-en:sound_en:noarch
 	$pkgname-mobile $pkgname-curl:_curl $pkgname-srtp $pkgname-dahdi
-	$pkgname-speex $pkgname-alsa $pkgname-cdr-mysql:cdr_mysql $pkgname-openrc"
+	$pkgname-speex $pkgname-opus $pkgname-alsa $pkgname-cdr-mysql:cdr_mysql
+	$pkgname-openrc"
 
 _download="https://downloads.asterisk.org/pub/telephony/asterisk/releases"
 source="$_download/asterisk-$pkgver.tar.gz
 	https://dev.alpinelinux.org/~tteras/asterisk-addon-mp3-r201.patch.gz
+	https://github.com/traud/asterisk-opus/archive/asterisk-13.7.tar.gz
 	10-musl-mutex-init.patch
 	20-musl-astmm-fix.patch
 	30-asterisk-mariadb.patch
@@ -36,7 +70,8 @@ source="$_download/asterisk-$pkgver.tar.gz
 	CVE-2021-32558.patch
 	asterisk.initd
 	asterisk.confd
-	asterisk.logrotate"
+	asterisk.logrotate
+	"
 
 # secfixes:
 #   18.2.2-r2:
@@ -71,6 +106,10 @@ prepare() {
 	# asteriskssl does not have direct references to libssl, but looks up
 	# symbols from it using dlsym(RTLD_NEXT), so use --no-as-needed for it.
 	sed -i -e 's/ASTSSL_LIBS:=$(OPENSSL_LIB)/ASTSSL_LIBS:=-Wl,--no-as-needed $(OPENSSL_LIB) -Wl,--as-needed/g' main/Makefile
+
+	# copy codec_opus_open_source files
+	# res/* and include/asterisk/* are not needed as asterisk is new enough
+	cp --verbose ../asterisk-opus*/codecs/* codecs
 }
 
 build() {
@@ -107,6 +146,8 @@ build() {
 		--with-libedit \
 		--with-srtp \
 		--with-imap=system \
+		--with-opus \
+		--with-opusfile \
 		CFLAGS="$CFLAGS -DENABLE_SRTP_AES_256"
 
 	# get default modules to build
@@ -120,6 +161,7 @@ build() {
 		--enable cdr_mysql \
 		--disable BUILD_NATIVE \
 		--enable IMAP_STORAGE \
+		--enable codec_opus_open_source \
 		menuselect.makeopts
 
 	# build
@@ -165,6 +207,7 @@ cdr_mysql() { amove usr/lib/asterisk/modules/*cdr_mysql*; }
 srtp() { amove usr/lib/asterisk/modules/*_srtp*; }
 dahdi() { amove usr/lib/asterisk/modules/*_dahdi*; }
 speex() { amove usr/lib/asterisk/modules/*_speex*; }
+opus() { amove usr/lib/asterisk/modules/codec_opus_open_source.so; }
 alsa() { amove usr/lib/asterisk/modules/*_alsa*; }
 
 config() {
@@ -195,6 +238,7 @@ sound_en() {
 sha512sums="
 e15fe3c7f46d49991bcb6f6f565f15e4af0d658b4cd6b091079209dd95a8027858effdc2f2314d72ed46a73cdebc089d3c27d5cf8db50d2d21f3c317a8a4a546  asterisk-18.2.2.tar.gz
 aacef3f4796fb1abd33266998b53909cb4b36e7cc5ad2f7bac68bdc43e9a9072d9a4e2e7e681bddfa31f3d04575eb248afe6ea95da780c67e4829c1e22adfe1b  asterisk-addon-mp3-r201.patch.gz
+156fa77b2864c439fbdfd4be302657dc8264bfc1d5a8f3647a9a5184f5c8651913038dc917db0d2d396dc173d6f1491065a7c81e25b2a67e1bea22c79f5b640e  asterisk-13.7.tar.gz
 771237ba6d42ab62d914f2702234b23fd0bc8c22f2aa33b0e745c9170163c8046f6d48ecb299faab3d6fb397f1aa046421083c3cc88510c9779861c522f357dd  10-musl-mutex-init.patch
 0fae11b42894ab3d405bc50e9275b9084712b482fbf9b4259ea938667fc5cbe413655f3ff83da0f607151bb2b6e49c2f741b5ada6944dbb478f076ef8d86380a  20-musl-astmm-fix.patch
 616de74bdd3c4a6e899128c73e31f5ff219095d2afe321f85a51f518ec2e9dac9b63396eed8e2568c295f1beb90f9a506c72d28211a973b35185bfffd24af37e  30-asterisk-mariadb.patch