diff --git a/main/sofia-sip/APKBUILD b/main/sofia-sip/APKBUILD
index 833c5665957e77abf6b3fea1080b5021b559baa8..02df6e9ac3f758a3458b29201e03afe8360d0ea2 100644
--- a/main/sofia-sip/APKBUILD
+++ b/main/sofia-sip/APKBUILD
@@ -2,7 +2,7 @@
 # Maintainer: Francesco Colista <fcolista@alpinelinux.org>
 pkgname=sofia-sip
 pkgver=1.13.14
-pkgrel=1
+pkgrel=2
 pkgdesc="RFC3261 compliant SIP User-Agent library"
 url="https://github.com/freeswitch/sofia-sip"
 arch="all"
@@ -12,7 +12,8 @@ makedepends="automake autoconf libtool m4
 glib-dev openssl-dev>3 lksctp-tools-dev"
 checkdepends="check-dev"
 subpackages="$pkgname-dev"
-source="$pkgname-$pkgver.tar.gz::https://github.com/freeswitch/sofia-sip/archive/v$pkgver.tar.gz"
+source="$pkgname-$pkgver.tar.gz::https://github.com/freeswitch/sofia-sip/archive/v$pkgver.tar.gz
+fix-unexpected-482-merge-request.patch"
 
 # secfixes:
 #   1.13.11-r0:
@@ -51,4 +52,5 @@ doc() {
 }
 sha512sums="
 0a0b30e99251f32a3e4d5c1b0e167ae7cffaf93f2e8b9c84ecc96543181418da000a3bc7ea933da42b2943a66e2cef6c690aeda5504e2ead381c9448c77fcf2c  sofia-sip-1.13.14.tar.gz
+6763a295be4e450e1806be14f22ab4813af238b6ee75d95dbc20b38f7e98d4aa49b8e67a97007e6a4015f8abf54b5d4ae62e38951762e8701ffa2afe90a049d4  fix-unexpected-482-merge-request.patch
 "
diff --git a/main/sofia-sip/fix-unexpected-482-merge-request.patch b/main/sofia-sip/fix-unexpected-482-merge-request.patch
new file mode 100644
index 0000000000000000000000000000000000000000..d8249c998de92f89f33696b1a71d71a9bf334683
--- /dev/null
+++ b/main/sofia-sip/fix-unexpected-482-merge-request.patch
@@ -0,0 +1,68 @@
+From 016cfe1b6abe8e96f4bf0b27ed9ed422267bc3ad Mon Sep 17 00:00:00 2001
+From: Ilkka Nurlund <ilkka.nurlund@posteo.ee>
+Date: Mon, 10 Apr 2023 06:36:04 +0000
+Subject: [PATCH 1/2] nta.c/leg_find: Fix 'by method' leg matching condition
+
+  In certain cases 'leg_method' might be null so the IF statement:
+
+    if (leg_method && method_name && !su_casematch(method_name, leg_method))
+      continue;
+
+  is not working at all despite 'method_name' is not null. It leads to
+  leg matching process returns false positive at:
+
+    if (loose_match == NULL)
+      loose_match = leg;
+---
+ libsofia-sip-ua/nta/nta.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libsofia-sip-ua/nta/nta.c b/libsofia-sip-ua/nta/nta.c
+index e360b7ed..f0ad0539 100644
+--- a/libsofia-sip-ua/nta/nta.c
++++ b/libsofia-sip-ua/nta/nta.c
+@@ -5120,7 +5120,7 @@ nta_leg_t *leg_find(nta_agent_t const *sa,
+
+     if (leg_url && request_uri && url_cmp(leg_url, request_uri))
+       continue;
+-    if (leg_method && method_name && !su_casematch(method_name, leg_method))
++    if (leg_method == NULL || method_name && !su_casematch(method_name, leg_method))
+       continue;
+
+     /* Perfect match if both local and To have tag
+
+From 6cf8d6a6e2fb3d7fa10657fd9b9d63017093bce1 Mon Sep 17 00:00:00 2001
+From: Ilkka Nurlund <ilkka.nurlund@posteo.ee>
+Date: Mon, 10 Apr 2023 08:13:22 +0000
+Subject: [PATCH 2/2] nta.c/incoming_find: Fix "Merged Request" case matching
+ /RFC3261 8.2.2.2; 17.2.3/
+
+  Implements missing matching rules (17.2.3.1 and 17.2.3.2)
+---
+ libsofia-sip-ua/nta/nta.c | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/libsofia-sip-ua/nta/nta.c b/libsofia-sip-ua/nta/nta.c
+index f0ad0539..d6d4d748 100644
+--- a/libsofia-sip-ua/nta/nta.c
++++ b/libsofia-sip-ua/nta/nta.c
+@@ -6238,10 +6238,16 @@ static nta_incoming_t *incoming_find(nta_agent_t const *agent,
+
+     /* RFC3261 - section 8.2.2.2 Merged Requests */
+     if (return_merge) {
+-      if (irq->irq_cseq->cs_method == cseq->cs_method &&
+-	  strcmp(irq->irq_cseq->cs_method_name,
+-		 cseq->cs_method_name) == 0)
+-	*return_merge = irq, return_merge = NULL;
++      /* RFC3261 - section 17.2.3 Matching Requests to Server Transactions */
++      if (irq->irq_via->v_branch &&
++	  su_casematch(irq->irq_via->v_branch, v->v_branch) &&
++	  su_casematch(irq->irq_via->v_host, v->v_host) &&
++	  su_strmatch(irq->irq_via->v_port, v->v_port)) {
++        if (irq->irq_cseq->cs_method == cseq->cs_method &&
++	    strcmp(irq->irq_cseq->cs_method_name,
++		   cseq->cs_method_name) == 0)
++	  *return_merge = irq, return_merge = NULL;
++      }
+     }
+   }