MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / pv_get_tm_branch_avp

Function pv_get_tm_branch_avp

modules/tm/tm.c:2095–2236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2093
2094
2095int pv_get_tm_branch_avp(struct sip_msg *msg, pv_param_t *param,
2096 pv_value_t *val)
2097{
2098 int avp_name;
2099 int_str avp_value;
2100 unsigned short name_type;
2101 int idx, idxf, res=0;
2102 struct usr_avp **old_list=NULL;
2103 struct usr_avp **avp_list=NULL;
2104 struct usr_avp *avp;
2105 int_str avp_value0;
2106 struct usr_avp *avp0;
2107 int n=0;
2108 char *p;
2109
2110 if (!msg || !val)
2111 goto error;
2112
2113 avp_list = pv_get_bavp_list();
2114 if (!avp_list) {
2115 pv_get_null(msg, param, val);
2116 goto success;
2117 }
2118
2119 if (!param) {
2120 LM_ERR("bad parameters\n");
2121 goto error;
2122 }
2123
2124 if (pv_get_avp_name(msg, param, &avp_name, &name_type)) {
2125 LM_ALERT("BUG in getting bavp name\n");
2126 goto error;
2127 }
2128
2129 /* get the index */
2130 if(pv_get_spec_index(msg, param, &idx, &idxf)!=0) {
2131 LM_ERR("invalid index\n");
2132 goto error;
2133 }
2134
2135 /* setting the avp head */
2136 old_list = set_avp_list(avp_list);
2137 if (!old_list) {
2138 LM_CRIT("no bavp head list found\n");
2139 goto error;
2140 }
2141
2142 if ((avp=search_first_avp(name_type, avp_name, &avp_value, 0))==0) {
2143 pv_get_null(msg, param, val);
2144 goto success;
2145 }
2146 val->flags = PV_VAL_STR;
2147 if ( (idxf==0 || idxf==PV_IDX_INT) && idx==0) {
2148 if(avp->flags & AVP_VAL_STR) {
2149 val->rs = avp_value.s;
2150 } else {
2151 val->rs.s = sint2str(avp_value.n, &val->rs.len);
2152 val->ri = avp_value.n;

Callers

nothing calls this directly

Calls 7

pv_get_bavp_listFunction · 0.85
pv_get_nullFunction · 0.85
pv_get_avp_nameFunction · 0.85
pv_get_spec_indexFunction · 0.85
set_avp_listFunction · 0.85
search_first_avpFunction · 0.85
sint2strFunction · 0.85

Tested by

no test coverage detected