Module: kamailio
Branch: master
Commit: 4790358d58aaf3716a1c78aa1723fd5bee27b910
URL: 
https://github.com/kamailio/kamailio/commit/4790358d58aaf3716a1c78aa1723fd5bee27b910

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-01-08T09:04:19+01:00

tmx: updates for t-uac via-body flags

---

Modified: src/modules/tmx/tmx_mod.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/4790358d58aaf3716a1c78aa1723fd5bee27b910.diff
Patch: 
https://github.com/kamailio/kamailio/commit/4790358d58aaf3716a1c78aa1723fd5bee27b910.patch

---

diff --git a/src/modules/tmx/tmx_mod.c b/src/modules/tmx/tmx_mod.c
index 89d8b993345..d20e82c4814 100644
--- a/src/modules/tmx/tmx_mod.c
+++ b/src/modules/tmx/tmx_mod.c
@@ -1000,7 +1000,11 @@ static int ki_t_vbflag_is_set(sip_msg_t *msg, int fval)
        if(bidx == T_BR_UNDEFINED) {
                return -1;
        }
-       if(msg->vbflags & (fval << 1)) {
+       if(bidx != 0 && bidx >= t->nr_of_outgoings) {
+               return -1;
+       }
+
+       if(t->uac[bidx].vbflags & (fval << 1)) {
                return 1;
        }
        return -1;
@@ -1024,9 +1028,25 @@ static int w_t_vbflag_is_set(sip_msg_t *msg, char *flag, 
char *s2)
  */
 static int ki_t_vbflag_reset(sip_msg_t *msg, int fval)
 {
-       if((flag_t)fval > MAX_FLAG)
+       int bidx = T_BR_UNDEFINED;
+       tm_cell_t *t = NULL;
+
+       if((flag_t)fval > MAX_FLAG) {
+               return -1;
+       }
+       t = _tmx_tmb.t_gett();
+       if(t == NULL || t == T_UNDEFINED) {
                return -1;
-       msg->vbflags &= ~(1 << fval);
+       }
+       bidx = tmx_get_branch_idx(msg);
+       if(bidx == T_BR_UNDEFINED) {
+               return -1;
+       }
+       if(bidx != 0 && bidx >= t->nr_of_outgoings) {
+               return -1;
+       }
+
+       t->uac[bidx].vbflags &= ~(1 << fval);
        return 1;
 }
 
@@ -1048,9 +1068,25 @@ static int w_t_vbflag_reset(sip_msg_t *msg, char *flag, 
char *s2)
  */
 static int ki_t_vbflag_set(sip_msg_t *msg, int fval)
 {
-       if((flag_t)fval > MAX_FLAG)
+       int bidx = T_BR_UNDEFINED;
+       tm_cell_t *t = NULL;
+
+       if((flag_t)fval > MAX_FLAG) {
+               return -1;
+       }
+       t = _tmx_tmb.t_gett();
+       if(t == NULL || t == T_UNDEFINED) {
                return -1;
-       msg->vbflags |= (1 << fval);
+       }
+       bidx = tmx_get_branch_idx(msg);
+       if(bidx == T_BR_UNDEFINED) {
+               return -1;
+       }
+       if(bidx != 0 && bidx >= t->nr_of_outgoings) {
+               return -1;
+       }
+
+       t->uac[bidx].vbflags |= (1 << fval);
        return 1;
 }
 

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to