浏览代码

modules/tmx: added $T_reply_flags pv and fixed bug in t_reuse_branch()

Juha Heinanen 11 年之前
父节点
当前提交
9051ab74c9
共有 3 个文件被更改,包括 21 次插入1 次删除
  1. 15 0
      modules/tmx/t_var.c
  2. 2 0
      modules/tmx/t_var.h
  3. 4 1
      modules/tmx/tmx_mod.c

+ 15 - 0
modules/tmx/t_var.c

@@ -322,6 +322,21 @@ int pv_get_t_var_rpl(struct sip_msg *msg,  pv_param_t *param,
 	return pv_get_spec_value(&_pv_trpl.msg, pv, res);
 	return pv_get_spec_value(&_pv_trpl.msg, pv, res);
 }
 }
 
 
+int pv_get_t_var_branch(struct sip_msg *msg,  pv_param_t *param,
+		pv_value_t *res)
+{
+	pv_spec_t *pv=NULL;
+
+	if(pv_t_update_rpl(msg))
+		return pv_get_null(msg, param, res);
+
+	pv = (pv_spec_t*)param->pvn.u.dname;
+	if(pv==NULL || pv_alter_context(pv))
+		return pv_get_null(msg, param, res);
+
+	return pv_get_spec_value(&_pv_trpl.msg, pv, res);
+}
+
 int pv_get_t_var_inv(struct sip_msg *msg,  pv_param_t *param,
 int pv_get_t_var_inv(struct sip_msg *msg,  pv_param_t *param,
 		pv_value_t *res)
 		pv_value_t *res)
 {
 {

+ 2 - 0
modules/tmx/t_var.h

@@ -40,6 +40,8 @@ int pv_get_tm_branch_idx(struct sip_msg *msg, pv_param_t *param,
 		pv_value_t *res);
 		pv_value_t *res);
 int pv_get_tm_reply_ruid(struct sip_msg *msg, pv_param_t *param,
 int pv_get_tm_reply_ruid(struct sip_msg *msg, pv_param_t *param,
 		pv_value_t *res);
 		pv_value_t *res);
+int pv_get_tm_reply_flags(struct sip_msg *msg, pv_param_t *param,
+		pv_value_t *res);
 int pv_get_tm_reply_code(struct sip_msg *msg, pv_param_t *param,
 int pv_get_tm_reply_code(struct sip_msg *msg, pv_param_t *param,
 		pv_value_t *res);
 		pv_value_t *res);
 int pv_get_tm_reply_reason(struct sip_msg *msg, pv_param_t *param,
 int pv_get_tm_reply_reason(struct sip_msg *msg, pv_param_t *param,

+ 4 - 1
modules/tmx/tmx_mod.c

@@ -124,6 +124,9 @@ static pv_export_t mod_pvs[] = {
 	{ {"T_reply_ruid", sizeof("T_reply_ruid")-1}, PVT_OTHER,
 	{ {"T_reply_ruid", sizeof("T_reply_ruid")-1}, PVT_OTHER,
 		pv_get_tm_reply_ruid, 0,
 		pv_get_tm_reply_ruid, 0,
 		 0, 0, 0, 0 },
 		 0, 0, 0, 0 },
+	{ {"T_reply_flags", sizeof("T_reply_flags")-1}, PVT_OTHER,
+		pv_get_tm_reply_flags, 0,
+		 0, 0, 0, 0 },
 	{ {"T_reply_code", sizeof("T_reply_code")-1}, PVT_OTHER,
 	{ {"T_reply_code", sizeof("T_reply_code")-1}, PVT_OTHER,
 		pv_get_tm_reply_code, 0,
 		pv_get_tm_reply_code, 0,
 		 0, 0, 0, 0 },
 		 0, 0, 0, 0 },
@@ -611,7 +614,7 @@ static int w_t_reuse_branch(struct sip_msg* msg, char *p1, char *p2)
 	    } else {
 	    } else {
 		reset_path_vector(msg);
 		reset_path_vector(msg);
 	    }
 	    }
-	    setbflagsval(0, t->uac[branch].flags);
+	    setbflagsval(0, t->uac[branch].branch_flags);
 	    set_instance(msg, &(t->uac[branch].instance));
 	    set_instance(msg, &(t->uac[branch].instance));
 	    return 1;
 	    return 1;
 	default:
 	default: