Module: kamailio Branch: master Commit: 12b3cfe6fb6c48de28a9aee0420328c6ae863663 URL: https://github.com/kamailio/kamailio/commit/12b3cfe6fb6c48de28a9aee0420328c6...
Author: Emmanuel Schmidbauer eschmidbauer@gmail.com Committer: GitHub noreply@github.com Date: 2020-06-24T14:59:45-04:00
Merge pull request #2373 from kamailio/mohqueue-issue-2370
mohqueue: use t_newtran() if transaction does not exist
---
Modified: src/modules/mohqueue/mohq_funcs.c
---
Diff: https://github.com/kamailio/kamailio/commit/12b3cfe6fb6c48de28a9aee0420328c6... Patch: https://github.com/kamailio/kamailio/commit/12b3cfe6fb6c48de28a9aee0420328c6...
---
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 +}