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

Function pv_set_tm_branch_avp

modules/tm/tm.c:2238–2327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2236}
2237
2238int pv_set_tm_branch_avp(struct sip_msg *msg, pv_param_t *param, int op,
2239 pv_value_t *val)
2240{
2241 int avp_name;
2242 int_str avp_val;
2243 int flags, res=0;
2244 unsigned short name_type;
2245 int idx, idxf;
2246 struct usr_avp **old_list=NULL;
2247 struct usr_avp **avp_list=NULL;
2248
2249 if (!msg) {
2250 LM_ERR("bavp set but no msg found!\n");
2251 goto error;
2252 }
2253
2254 if (!param) {
2255 LM_ERR("bad parameters\n");
2256 goto error;
2257 }
2258
2259 avp_list = pv_get_bavp_list();
2260 if (!avp_list) {
2261 LM_DBG("cannot find the branch avp list!\n");
2262 return -2;
2263 }
2264
2265 if (pv_get_avp_name(msg, param, &avp_name, &name_type)) {
2266 LM_ALERT("BUG in getting bavp name\n");
2267 goto error;
2268 }
2269
2270 /* get the index */
2271 if(pv_get_spec_index(msg, param, &idx, &idxf)!=0) {
2272 LM_ERR("invalid index\n");
2273 goto error;
2274 }
2275
2276 /* setting the avp head */
2277 old_list = set_avp_list(avp_list);
2278 if (!old_list) {
2279 LM_CRIT("no bavp head list found\n");
2280 goto error;
2281 }
2282
2283 if(val == NULL) {
2284 if(op == COLONEQ_T || idxf == PV_IDX_ALL)
2285 destroy_avps(name_type, avp_name, 1);
2286 else {
2287 if(idx < 0) {
2288 LM_ERR("index with negative value\n");
2289 goto error;
2290 }
2291 destroy_index_avp(name_type, avp_name, idx);
2292 }
2293 /* restoring head */
2294 goto success;
2295 }

Callers

nothing calls this directly

Calls 8

pv_get_bavp_listFunction · 0.85
pv_get_avp_nameFunction · 0.85
pv_get_spec_indexFunction · 0.85
set_avp_listFunction · 0.85
destroy_avpsFunction · 0.85
destroy_index_avpFunction · 0.85
replace_avpFunction · 0.85
add_avpFunction · 0.85

Tested by

no test coverage detected