[sr-dev] git:master:6b708e93: mohqueue: use t_newtran() if transaction does not exist

Emmanuel Schmidbauer eschmidbauer at gmail.com
Wed Jun 24 20:59:53 CEST 2020


Module: kamailio
Branch: master
Commit: 6b708e937d161101adc91a4de5a527bf190b55c0
URL: https://github.com/kamailio/kamailio/commit/6b708e937d161101adc91a4de5a527bf190b55c0

Author: Emmanuel Schmidbauer <eschmidbauer at gmail.com>
Committer: Emmanuel Schmidbauer <eschmidbauer at gmail.com>
Date: 2020-06-24T14:32:15-04:00

mohqueue: use t_newtran() if transaction does not exist

---

Modified: src/modules/mohqueue/mohq_funcs.c

---

Diff:  https://github.com/kamailio/kamailio/commit/6b708e937d161101adc91a4de5a527bf190b55c0.diff
Patch: https://github.com/kamailio/kamailio/commit/6b708e937d161101adc91a4de5a527bf190b55c0.patch

---

diff --git a/src/modules/mohqueue/mohq_funcs.c b/src/modules/mohqueue/mohq_funcs.c
index 384be185d3..54ee87486c 100644
--- a/src/modules/mohqueue/mohq_funcs.c
+++ b/src/modules/mohqueue/mohq_funcs.c
@@ -185,6 +185,7 @@ 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)
   {
   /**********
@@ -215,7 +216,22 @@ if (ptm->t_lookup_ident (&ptrans, pcall->call_hash, pcall->call_label) < 0)
   }
 else
   {
-  if (ptm->t_release (pcall->call_pmsg) < 0)
+  t = ptm->t_gett();
+  if (t==NULL || t==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_release_transaction(t) < 0)
     {
     LM_ERR ("%sRelease transaction failed for call (%s)!\n",
       pfncname, pcall->call_from);
@@ -2945,4 +2961,4 @@ if (pmod_data->ptm->t_relay (pmsg, 0, 0) < 0)
   return -1;
   }
 return 1;
-}
\ No newline at end of file
+}




More information about the sr-dev mailing list