diff --git a/main/kamailio/APKBUILD b/main/kamailio/APKBUILD
index d457da00534acb5cfc3321ca9720d72e10da16c3..2c55c1644cb2cb9e017ad9fed64b89bc13ccdfe9 100644
--- a/main/kamailio/APKBUILD
+++ b/main/kamailio/APKBUILD
@@ -5,7 +5,7 @@
 
 pkgname=kamailio
 pkgver=5.4.2
-pkgrel=2
+pkgrel=3
 
 # If building from a git snapshot, specify the gitcommit
 # If building a proper release, leave gitcommit blank or commented
@@ -34,6 +34,7 @@ makedepends="bison db-dev flex freeradius-client-dev expat-dev
 	# librdkafka-dev dnssec-tools-dev
 source="kamailio-${pkgver}$_suffix.tar.gz::https://github.com/kamailio/kamailio/archive/$_gitcommit.tar.gz
 	tm-proper-fill-of-From-To-URI-tag-values-using-parsed.patch
+	mohqueue-1.8.patch
 	kamailio.initd
 	"
 
@@ -560,4 +561,5 @@ sipdump() {
 
 sha512sums="944eb54fe5ec1408def842f3f1f909002ba274863ea68baa85fc70aa9abd7331647f75813ccd264ed659a794570c6d8b9c89108684de603e90b0713f33412502  kamailio-5.4.2.tar.gz
 b82dc389dc294cc09b0089ef2e846d308b937a9984a53574f0a434180341725dc025222d2bd9d9b0bb01b05bebd106412cfaf81e3150e338393a6a4012f1deb0  tm-proper-fill-of-From-To-URI-tag-values-using-parsed.patch
+bfd0c3462cc95145b3eedf2e4e66ef856c503392d330c204291f5dae16e29803b05f2f1b3627cad85fd7505a58a34952fb1fa198c22e48ed245fd0a6bd731714  mohqueue-1.8.patch
 0c87bfb78481568c03e603049eb8597a90d24ae2941fc81694181b2326fa9db89fbddaaa3cf08c7bc2f5fa0e7ffac4cf4e2d010d08c4faa6cf6df98593432539  kamailio.initd"
diff --git a/main/kamailio/mohqueue-1.8.patch b/main/kamailio/mohqueue-1.8.patch
new file mode 100644
index 0000000000000000000000000000000000000000..1f490a08c348d80e1b2ca01ac784d3c7ee7bed9d
--- /dev/null
+++ b/main/kamailio/mohqueue-1.8.patch
@@ -0,0 +1,485 @@
+From c576631b899ded661bbfede48fa92fd03dbc7e88 Mon Sep 17 00:00:00 2001
+From: Robert Boisvert <Robert.Boisvert@sequentialtech.com>
+Date: Mon, 22 Mar 2021 10:43:12 -0400
+Subject: [PATCH] mohqueue: use ptime
+
+- version 1.7
+- match ptime of incoming call; otherwise, default to 20ms
+- update copyright dates
+---
+ src/modules/mohqueue/README                 |   2 +-
+ src/modules/mohqueue/doc/mohqueue.xml       |   2 +-
+ src/modules/mohqueue/doc/mohqueue_admin.xml |  11 +-
+ src/modules/mohqueue/mohq_common.h          |   2 +-
+ src/modules/mohqueue/mohq_db.c              |   2 +-
+ src/modules/mohqueue/mohq_db.h              |   2 +-
+ src/modules/mohqueue/mohq_funcs.c           | 112 +++++++++++++-------
+ src/modules/mohqueue/mohq_funcs.h           |   2 +-
+ src/modules/mohqueue/mohq_locks.c           |   2 +-
+ src/modules/mohqueue/mohq_locks.h           |   2 +-
+ src/modules/mohqueue/mohqueue_mod.c         |   4 +-
+ src/modules/mohqueue/mohqueue_mod.h         |   2 +-
+ 12 files changed, 93 insertions(+), 52 deletions(-)
+
+diff --git a/src/modules/mohqueue/README b/src/modules/mohqueue/README
+index fa845da0f8..a0f30357ae 100644
+--- a/src/modules/mohqueue/README
++++ b/src/modules/mohqueue/README
+@@ -2,7 +2,7 @@ mohqueue Module
+ 
+ Robert Boisvert
+ 
+-   Copyright © 2013-2019 Robert Boisvert, rdbprog@gmail.com
++   Copyright © 2013-2021 Robert Boisvert, rdbprog@gmail.com
+      __________________________________________________________________
+ 
+    Table of Contents
+diff --git a/src/modules/mohqueue/doc/mohqueue.xml b/src/modules/mohqueue/doc/mohqueue.xml
+index e4c1563c66..5498c1b57b 100644
+--- a/src/modules/mohqueue/doc/mohqueue.xml
++++ b/src/modules/mohqueue/doc/mohqueue.xml
+@@ -21,7 +21,7 @@
+       </author>
+     </authorgroup>
+     <copyright>
+-      <year>2013-2019</year>
++      <year>2013-2021</year>
+       <holder>Robert Boisvert, rdbprog@gmail.com</holder>
+     </copyright>
+   </bookinfo>
+diff --git a/src/modules/mohqueue/doc/mohqueue_admin.xml b/src/modules/mohqueue/doc/mohqueue_admin.xml
+index 112b1f4fa4..37cc02e1a0 100644
+--- a/src/modules/mohqueue/doc/mohqueue_admin.xml
++++ b/src/modules/mohqueue/doc/mohqueue_admin.xml
+@@ -387,10 +387,13 @@ Duplicate names are not allowed.
+           </listitem>
+           <listitem>
+ <emphasis>uri</emphasis> (100-character string, required): the URI of
+-the queue. It should not include any parameters or headers (e.g.
+-"sip:user@host;maddr=239.255.255.1" or "sip:user@host?subject=project")
+-although it will match any RURI that contains this URI even if the
+-RURI has parameters or headers. Duplicates are not allowed.
++the queue. Duplicates are not allowed. It should not include any parameters
++or headers (e.g. "sip:user@host;maddr=239.255.255.1" or
++"sip:user@host?subject=project") although it will match any RURI that
++contains this URI even if the RURI has parameters or headers. The server
++name of the URI must uniquely identify the server. If the RURI server name
++does not uniquely identify the server then it should be rewritten to one
++the does before calling mohq_send ().
+           </listitem>
+           <listitem>
+ <emphasis>mohdir</emphasis> (100-character string, optional): path to
+diff --git a/src/modules/mohqueue/mohq_common.h b/src/modules/mohqueue/mohq_common.h
+index 88fed7fc51..228587cc98 100644
+--- a/src/modules/mohqueue/mohq_common.h
++++ b/src/modules/mohqueue/mohq_common.h
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (C) 2013-19 Robert Boisvert
++ * Copyright (C) 2013-21 Robert Boisvert
+  *
+  * This file is part of the mohqueue module for Kamailio, a free SIP server.
+  *
+diff --git a/src/modules/mohqueue/mohq_db.c b/src/modules/mohqueue/mohq_db.c
+index 3f70b0bf11..7c62ee6d4c 100644
+--- a/src/modules/mohqueue/mohq_db.c
++++ b/src/modules/mohqueue/mohq_db.c
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (C) 2013-19 Robert Boisvert
++ * Copyright (C) 2013-21 Robert Boisvert
+  *
+  * This file is part of the mohqueue module for Kamailio, a free SIP server.
+  *
+diff --git a/src/modules/mohqueue/mohq_db.h b/src/modules/mohqueue/mohq_db.h
+index 41b0a3f24c..565f0ae141 100644
+--- a/src/modules/mohqueue/mohq_db.h
++++ b/src/modules/mohqueue/mohq_db.h
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (C) 2013-19 Robert Boisvert
++ * Copyright (C) 2013-21 Robert Boisvert
+  *
+  * This file is part of the mohqueue module for Kamailio, a free SIP server.
+  *
+diff --git a/src/modules/mohqueue/mohq_funcs.c b/src/modules/mohqueue/mohq_funcs.c
+index 54ee87486c..c9c8d6704e 100644
+--- a/src/modules/mohqueue/mohq_funcs.c
++++ b/src/modules/mohqueue/mohq_funcs.c
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (C) 2013-19 Robert Boisvert
++ * Copyright (C) 2013-21 Robert Boisvert
+  *
+  * This file is part of the mohqueue module for Kamailio, a free SIP server.
+  *
+@@ -32,7 +32,7 @@
+ #define ALLOWHDR "Allow: INVITE, ACK, BYE, CANCEL, NOTIFY, PRACK"
+ #define CLENHDR "Content-Length"
+ #define SIPEOL  "\r\n"
+-#define USRAGNT "Kamailio MOH Queue v1.6"
++#define USRAGNT "Kamailio MOH Queue v1.7"
+ 
+ /**********
+ * local constants
+@@ -122,17 +122,6 @@ char prefermsg [] =
+   "Referred-By: <%s>" SIPEOL
+   };
+ 
+-char preinvitemsg [] =
+-  {
+-  "%s"
+-  "Max-Forwards: 70" SIPEOL
+-  "Contact: <%s>" SIPEOL
+-  ALLOWHDR SIPEOL
+-  "Supported: 100rel" SIPEOL
+-  "Accept-Language: en" SIPEOL
+-  "Content-Type: application/sdp" SIPEOL
+-  };
+-
+ char prtpsdp [] =
+   {
+   "v=0" SIPEOL
+@@ -185,7 +174,6 @@ void ack_msg (sip_msg_t *pmsg, call_lst *pcall)
+ char *pfncname = "ack_msg: ";
+ struct cell *ptrans;
+ tm_api_t *ptm = pmod_data->ptm;
+-tm_cell_t *t = 0;
+ if (pcall->call_state != CLSTA_INVITED)
+   {
+   /**********
+@@ -203,9 +191,7 @@ if (pcall->call_state != CLSTA_INVITED)
+   }
+ 
+ /**********
+-* o release INVITE transaction
+-* o save SDP address info
+-* o put in queue
++* release INVITE transaction
+ **********/
+ 
+ if (ptm->t_lookup_ident (&ptrans, pcall->call_hash, pcall->call_label) < 0)
+@@ -216,28 +202,39 @@ if (ptm->t_lookup_ident (&ptrans, pcall->call_hash, pcall->call_label) < 0)
+   }
+ else
+   {
+-  t = ptm->t_gett();
+-  if (t==NULL || t==T_UNDEFINED)
++  /**********
++  * create new transaction if current missing
++  **********/
++
++  tm_cell_t *ptcell;
++  ptcell = ptm->t_gett ();
++  if ((ptcell == NULL) || (ptcell == T_UNDEFINED))
+     {
+-      if (ptm->t_newtran(pmsg)<0)
+-        {
+-          LM_ERR("cannot create the transaction\n");
+-          return;
+-        }
+-      t = ptm->t_gett();
+-      if (t==NULL || t==T_UNDEFINED)
+-        {
+-          LM_ERR("cannot lookup the transaction\n");
+-          return;
+-        }
++    if (ptm->t_newtran (pmsg) < 0)
++      {
++      LM_ERR ("%sUnable to create temporary transaction!\n", pfncname);
++      return;
++      }
++    ptcell = ptm->t_gett ();
++  if ((ptcell == NULL) || (ptcell == T_UNDEFINED))
++      {
++      LM_ERR ("%sUnable to find temporary transaction!\n", pfncname);
++      return;
++      }
+     }
+-  if (ptm->t_release_transaction(t) < 0)
++  if (ptm->t_release (ptcell) < 0)
+     {
+     LM_ERR ("%sRelease transaction failed for call (%s)!\n",
+       pfncname, pcall->call_from);
+     return;
+     }
+   }
++
++/**********
++* o save SDP address info
++* o put in queue
++**********/
++
+ pcall->call_hash = pcall->call_label = 0;
+ sprintf (pcall->call_addr, "%s %s",
+   pmsg->rcv.dst_ip.af == AF_INET ? "IP4" : "IP6",
+@@ -538,14 +535,19 @@ int
+ create_call (sip_msg_t *pmsg, call_lst *pcall, int ncall_idx, int mohq_idx)
+ 
+ {
++char *pfncname = "create_call: ";
++char *pbuf;
++str *pstr;
++
+ /**********
+ * add values to new entry
++* o call ID
++* o from
+ **********/
+ 
+-char *pfncname = "create_call: ";
+ pcall->pmohq = &pmod_data->pmohq_lst [mohq_idx];
+-str *pstr = &pmsg->callid->body;
+-char *pbuf = pcall->call_buffer;
++pstr = &pmsg->callid->body;
++pbuf = pcall->call_buffer;
+ pcall->call_buflen = sizeof (pcall->call_buffer);
+ pcall->call_id = pbuf;
+ if (!addstrbfr (pstr->s, pstr->len, &pbuf, &pcall->call_buflen, 1))
+@@ -1036,7 +1038,6 @@ char *pfncname = "first_invite_msg: ";
+ /**********
+ * o SDP exists?
+ * o accepts REFER?
+-* o send RTP offer
+ **********/
+ 
+ if (!(pmsg->msg_flags & FL_SDP_BODY))
+@@ -1069,6 +1070,11 @@ if (pmsg->allow)
+     return;
+     }
+   }
++
++/**********
++* send RTP offer
++**********/
++
+ mohq_debug (pcall->pmohq,
+   "%sMaking offer for RTP link for call (%s) from queue (%s)",
+   pfncname, pcall->call_from, pcall->pmohq->mohq_name);
+@@ -2146,6 +2152,38 @@ struct sip_msg pnmsg [1];
+ build_sip_msg_from_buf (pnmsg, pbuf->s, pbuf->len, 0);
+ memcpy (&pnmsg->rcv, &pmsg->rcv, sizeof (struct receive_info));
+ 
++/**********
++* ptime set?
++**********/
++
++int nsession;
++sdp_session_cell_t *psession;
++char pflagbuf [5];
++strcpy (pflagbuf, "z20");
++fparam_t pzflag [1] = {0, FPARAM_STRING, {pflagbuf}, 0};
++for (nsession = 0; (psession = get_sdp_session (pmsg, nsession)); nsession++)
++  {
++  int nstream;
++  sdp_stream_cell_t *pstream;
++  for (nstream = 0; (pstream = get_sdp_stream (pmsg, nsession, nstream));
++    nstream++)
++    {
++    /**********
++    * ptime set?
++    **********/
++
++    if ((pstream->ptime.len < 1) || (pstream->ptime.len > 3))
++      { continue; }
++    strncpy (&pzflag->v.asciiz [1], pstream->ptime.s, pstream->ptime.len);
++    pzflag->v.asciiz [pstream->ptime.len + 1] = 0;
++    mohq_debug (pcall->pmohq,
++      "%sSet ptime (%s) for RTP link for call (%s) from queue (%s)",
++      pfncname,
++      &pzflag->v.asciiz [1], pcall->call_from, pcall->pmohq->mohq_name);
++    break;
++    }
++  }
++
+ /**********
+ * o send RTP answer
+ * o form stream file
+@@ -2154,7 +2192,7 @@ memcpy (&pnmsg->rcv, &pmsg->rcv, sizeof (struct receive_info));
+ 
+ mohq_debug (pcall->pmohq, "%sAnswering RTP link for call (%s)",
+   pfncname, pcall->call_from);
+-if (pmod_data->fn_rtp_answer (pnmsg, 0, 0) != 1)
++if (pmod_data->fn_rtp_answer (pnmsg, (char *) pzflag, 0) != 1)
+   {
+   LM_ERR ("%srtpproxy_answer refused for call (%s)!\n",
+     pfncname, pcall->call_from);
+@@ -2961,4 +2999,4 @@ if (pmod_data->ptm->t_relay (pmsg, 0, 0) < 0)
+   return -1;
+   }
+ return 1;
+-}
++}
+\ No newline at end of file
+diff --git a/src/modules/mohqueue/mohq_funcs.h b/src/modules/mohqueue/mohq_funcs.h
+index cc99185306..35d55edaa0 100644
+--- a/src/modules/mohqueue/mohq_funcs.h
++++ b/src/modules/mohqueue/mohq_funcs.h
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (C) 2013-19 Robert Boisvert
++ * Copyright (C) 2013-21 Robert Boisvert
+  *
+  * This file is part of the mohqueue module for Kamailio, a free SIP server.
+  *
+diff --git a/src/modules/mohqueue/mohq_locks.c b/src/modules/mohqueue/mohq_locks.c
+index 080dd39486..b31e052cb8 100644
+--- a/src/modules/mohqueue/mohq_locks.c
++++ b/src/modules/mohqueue/mohq_locks.c
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (C) 2013-19 Robert Boisvert
++ * Copyright (C) 2013-21 Robert Boisvert
+  *
+  * This file is part of the mohqueue module for Kamailio, a free SIP server.
+  *
+diff --git a/src/modules/mohqueue/mohq_locks.h b/src/modules/mohqueue/mohq_locks.h
+index 2ae41b7192..20deed8b02 100644
+--- a/src/modules/mohqueue/mohq_locks.h
++++ b/src/modules/mohqueue/mohq_locks.h
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (C) 2013-19 Robert Boisvert
++ * Copyright (C) 2013-21 Robert Boisvert
+  *
+  * This file is part of the mohqueue module for Kamailio, a free SIP server.
+  *
+diff --git a/src/modules/mohqueue/mohqueue_mod.c b/src/modules/mohqueue/mohqueue_mod.c
+index a9ec155097..8a17dfc45e 100644
+--- a/src/modules/mohqueue/mohqueue_mod.c
++++ b/src/modules/mohqueue/mohqueue_mod.c
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (C) 2013-19 Robert Boisvert
++ * Copyright (C) 2013-21 Robert Boisvert
+  *
+  * This file is part of the mohqueue module for Kamailio, a free SIP server.
+  *
+@@ -313,7 +313,7 @@ int mod_child_init (int rank)
+ 
+ {
+ /**********
+-* o make sure DB initialized
++* make sure DB initialized
+ **********/
+ 
+ if (rank == PROC_INIT || rank == PROC_TCP_MAIN || rank == PROC_MAIN)
+diff --git a/src/modules/mohqueue/mohqueue_mod.h b/src/modules/mohqueue/mohqueue_mod.h
+index b783b03f40..61d2f98c9c 100644
+--- a/src/modules/mohqueue/mohqueue_mod.h
++++ b/src/modules/mohqueue/mohqueue_mod.h
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (C) 2013-19 Robert Boisvert
++ * Copyright (C) 2013-21 Robert Boisvert
+  *
+  * This file is part of the mohqueue module for Kamailio, a free SIP server.
+  *
+From 1001e9e1dbfdec525f4a5f96f7dd3fcc22e51888 Mon Sep 17 00:00:00 2001
+From: Robert Boisvert <rdboisvert@gmail.com>
+Date: Wed, 24 Mar 2021 12:17:20 -0400
+Subject: [PATCH] mohqueue: use ptime
+
+    - version 1.7
+    - match ptime of incoming call; otherwise, default to 20ms
+    - update copyright dates
+---
+ src/modules/mohqueue/mohq_funcs.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/modules/mohqueue/mohq_funcs.c b/src/modules/mohqueue/mohq_funcs.c
+index c9c8d6704e..dd9f105bfc 100644
+--- a/src/modules/mohqueue/mohq_funcs.c
++++ b/src/modules/mohqueue/mohq_funcs.c
+@@ -222,7 +222,7 @@ else
+       return;
+       }
+     }
+-  if (ptm->t_release (ptcell) < 0)
++  if (ptm->t_release_transaction (ptcell) < 0)
+     {
+     LM_ERR ("%sRelease transaction failed for call (%s)!\n",
+       pfncname, pcall->call_from);
+@@ -2160,7 +2160,7 @@ int nsession;
+ sdp_session_cell_t *psession;
+ char pflagbuf [5];
+ strcpy (pflagbuf, "z20");
+-fparam_t pzflag [1] = {0, FPARAM_STRING, {pflagbuf}, 0};
++fparam_t pzflag [1] = {"", FPARAM_STRING, {pflagbuf}, 0};
+ for (nsession = 0; (psession = get_sdp_session (pmsg, nsession)); nsession++)
+   {
+   int nstream;
+From c7781edcb37a35193ccdb9414183919aaa614d3a Mon Sep 17 00:00:00 2001
+From: Sergey Safarov <s.safarov@gmail.com>
+Date: Tue, 27 Apr 2021 12:58:49 +0300
+Subject: [PATCH] mohqueue: fixed compiler warning about array initialization
+
+---
+ src/modules/mohqueue/mohq_funcs.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/modules/mohqueue/mohq_funcs.c b/src/modules/mohqueue/mohq_funcs.c
+index dd9f105bfc..1f72c58c5a 100644
+--- a/src/modules/mohqueue/mohq_funcs.c
++++ b/src/modules/mohqueue/mohq_funcs.c
+@@ -2160,7 +2160,9 @@ int nsession;
+ sdp_session_cell_t *psession;
+ char pflagbuf [5];
+ strcpy (pflagbuf, "z20");
+-fparam_t pzflag [1] = {"", FPARAM_STRING, {pflagbuf}, 0};
++fparam_t pzflag [1] = {
++    {"", FPARAM_STRING, {pflagbuf}, 0}
++};
+ for (nsession = 0; (psession = get_sdp_session (pmsg, nsession)); nsession++)
+   {
+   int nstream;
+From 0e51ce1075f206a4441333f72c69fcc56f8d6855 Mon Sep 17 00:00:00 2001
+From: Robert Boisvert <rdboisvert@gmail.com>
+Date: Wed, 19 May 2021 16:19:24 -0400
+Subject: [PATCH] modules/mohqueue: force RTP to follow SDP
+
+  - version 1.8
+  - use rtpproxy r flag to force RTP to follow SDP
+  - fixed compiler warnings
+---
+ src/modules/mohqueue/mohq_funcs.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/modules/mohqueue/mohq_funcs.c b/src/modules/mohqueue/mohq_funcs.c
+index 1f72c58c5a..c46cb51a75 100644
+--- a/src/modules/mohqueue/mohq_funcs.c
++++ b/src/modules/mohqueue/mohq_funcs.c
+@@ -32,7 +32,7 @@
+ #define ALLOWHDR "Allow: INVITE, ACK, BYE, CANCEL, NOTIFY, PRACK"
+ #define CLENHDR "Content-Length"
+ #define SIPEOL  "\r\n"
+-#define USRAGNT "Kamailio MOH Queue v1.7"
++#define USRAGNT "Kamailio MOH Queue v1.8"
+ 
+ /**********
+ * local constants
+@@ -1075,10 +1075,11 @@ if (pmsg->allow)
+ * send RTP offer
+ **********/
+ 
++fparam_t rflag = {.orig="", .type=FPARAM_STRING, {.asciiz="r"}, .fixed=0};
+ mohq_debug (pcall->pmohq,
+   "%sMaking offer for RTP link for call (%s) from queue (%s)",
+   pfncname, pcall->call_from, pcall->pmohq->mohq_name);
+-if (pmod_data->fn_rtp_offer (pmsg, 0, 0) != 1)
++if (pmod_data->fn_rtp_offer (pmsg, (char *) &rflag, 0) != 1)
+   {
+   if (pmod_data->psl->freply (pmsg, 486, presp_busy) < 0)
+     {
+@@ -2160,9 +2161,8 @@ int nsession;
+ sdp_session_cell_t *psession;
+ char pflagbuf [5];
+ strcpy (pflagbuf, "z20");
+-fparam_t pzflag [1] = {
+-    {"", FPARAM_STRING, {pflagbuf}, 0}
+-};
++fparam_t zflag = {.orig="", .type=FPARAM_STRING, {.asciiz=pflagbuf}, .fixed=0};
++fparam_t *pzflag = &zflag;
+ for (nsession = 0; (psession = get_sdp_session (pmsg, nsession)); nsession++)
+   {
+   int nstream;