Module: kamailio
Branch: master
Commit: 879e074c4517cdda7bbdad343191dcfc9dedcb3c
URL: 
https://github.com/kamailio/kamailio/commit/879e074c4517cdda7bbdad343191dcfc9dedcb3c

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2024-11-14T10:51:58+01:00

tm: backup and restore existing T-references for rpc tm.cancel

- GH #4011

---

Modified: src/modules/tm/t_cancel.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/879e074c4517cdda7bbdad343191dcfc9dedcb3c.diff
Patch: 
https://github.com/kamailio/kamailio/commit/879e074c4517cdda7bbdad343191dcfc9dedcb3c.patch

---

diff --git a/src/modules/tm/t_cancel.c b/src/modules/tm/t_cancel.c
index 753b261111e..5f733d71cc1 100644
--- a/src/modules/tm/t_cancel.c
+++ b/src/modules/tm/t_cancel.c
@@ -403,9 +403,10 @@ void rpc_cancel(rpc_t *rpc, void *c)
        static char cseq[128], callid[128];
        struct cancel_info cancel_data;
        int i, j;
-
        str cseq_s;       /* cseq */
        str callid_s; /* callid */
+       tm_cell_t *orig_t = NULL;
+       int orig_branch;
 
        cseq_s.s = cseq;
        callid_s.s = callid;
@@ -416,6 +417,8 @@ void rpc_cancel(rpc_t *rpc, void *c)
                return;
        }
 
+       orig_t = get_t();
+       orig_branch = get_t_branch();
        if(t_lookup_callid(&trans, callid_s, cseq_s) < 0) {
                LM_DBG("Lookup failed\n");
                rpc->fault(c, 400, "Transaction not found");
@@ -430,6 +433,7 @@ void rpc_cancel(rpc_t *rpc, void *c)
 
        /* t_lookup_callid REF`d the transaction for us, we must UNREF here! */
        UNREF(trans);
+       set_t(orig_t, orig_branch);
        j = 0;
        while(i) {
                j++;

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org

Reply via email to