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

Function next_branches

serialize.c:275–422  ·  view source on GitHub ↗

! \brief * Adds to request a destination set that includes all highest priority * class contacts in "serial_avp" AVP. If called from a route block, * rewrites the request uri with first contact and adds the remaining * contacts as branches. If called from failure route block, adds all * contacts as brances. Removes added contacts from "serial_avp" AVP. */

Source from the content-addressed store, hash-verified

273 * contacts as brances. Removes added contacts from "serial_avp" AVP.
274 */
275int next_branches( struct sip_msg *msg)
276{
277 struct msg_branch branch;
278 struct usr_avp *avp, *prev;
279 int_str val;
280 struct socket_info *sock_info;
281 qvalue_t q;
282 str uri, dst_uri, path, path_dst;
283 char *p;
284 unsigned int flags, last_parallel_fork;
285 int rval;
286
287 if (route_type != REQUEST_ROUTE && route_type != FAILURE_ROUTE ) {
288 /* unsupported route type */
289 LM_ERR("called from unsupported route type %d\n", route_type);
290 goto error;
291 }
292
293 /* Find first avp */
294 avp = search_first_avp(0, serial_avp, &val, 0);
295
296 if (!avp) {
297 LM_DBG("no AVPs -- we are done!\n");
298 goto error;
299 }
300
301 if (!val.s.s) {
302 LM_ERR("invalid avp value\n");
303 goto error;
304 }
305
306 /* *sock_info, flags, q, uri, 0, dst_uri, 0, path, 0,... */
307
308 p = val.s.s;
309 unseras(&sock_info, p, long);
310 p += sizeof(long);
311 unseras(&flags, p, long);
312 p += sizeof(long);
313 unseras(&q, p, long);
314 p += sizeof(long);
315 uri.s = p;
316 uri.len = strlen(p);
317 p += uri.len + 1;
318 dst_uri.s = p;
319 dst_uri.len = strlen(p);
320 p += dst_uri.len + 1;
321 path.s = p;
322 path.len = strlen(p);
323
324 /* set PATH and DURI */
325 if (path.s && path.len) {
326 if (get_path_dst_uri(&path, &path_dst) < 0) {
327 LM_ERR("failed to get first hop from Path\n");
328 goto error1;
329 }
330 if (set_path_vector( msg, &path) < 0) {
331 LM_ERR("failed to set path vector\n");
332 goto error1;

Callers 1

w_next_branchesFunction · 0.85

Calls 8

search_first_avpFunction · 0.85
get_path_dst_uriFunction · 0.85
set_path_vectorFunction · 0.85
set_dst_uriFunction · 0.85
set_ruriFunction · 0.85
search_next_avpFunction · 0.85
destroy_avpFunction · 0.85
append_msg_branchFunction · 0.85

Tested by

no test coverage detected