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

Function build_rt_info

modules/drouting/routing.c:345–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

343
344
345rt_info_t*
346build_rt_info(
347 int id,
348 int priority,
349 tmrec_expr *trec,
350 /* script routing table index */
351 char *route_name,
352 /* list of destinations indexes */
353 char* dstlst,
354 char* sort_alg,
355 int qr_profile,
356 char* attrs,
357 rt_data_t* rd,
358 osips_malloc_f mf,
359 osips_free_f ff
360 )
361{
362 int i;
363 void * qr_rule = NULL;
364 struct dr_reg_param rdp;
365 struct dr_link_rule_params lrp;
366 struct dr_reg_init_rule_params irp;
367 rt_info_t* rt = NULL;
368 pgw_list_t *p = NULL;
369 sort_cb_type alg;
370
371 rt = (rt_info_t*)func_malloc(mf, sizeof(rt_info_t) +
372 (attrs?strlen(attrs):0) );
373 if (rt==NULL) {
374 LM_ERR("no more mem(1)\n");
375 goto err_exit;
376 }
377 memset(rt, 0, sizeof(rt_info_t));
378
379 rt->id = id;
380 rt->priority = priority;
381 rt->time_rec = trec;
382
383 alg = dr_get_sort_alg(sort_alg[0]);
384 rt->sort_alg = alg;
385
386 if (attrs && strlen(attrs)) {
387 rt->attrs.s = (char*)(rt+1);
388 rt->attrs.len = strlen(attrs);
389 memcpy(rt->attrs.s,attrs,rt->attrs.len);
390 }
391 if (route_name && strlen(route_name)) {
392 rt->route_ref = ref_script_route_by_name( route_name, sroutes->request,
393 RT_NO, REQUEST_ROUTE, 1/*in_shm*/);
394 if (rt->route_ref==NULL)
395 LM_ERR("failed to get ref to route <%s>, ignoring it\n",
396 route_name);
397 else if (rt->route_ref->idx==-1) {
398 LM_WARN("route <%s> not found for now, not running it\n",
399 route_name);
400 }
401 }
402

Callers 1

dr_load_routing_infoFunction · 0.85

Calls 5

dr_get_sort_algFunction · 0.85
ref_script_route_by_nameFunction · 0.85
parse_destination_listFunction · 0.85
run_dr_cbsFunction · 0.85
shm_freeFunction · 0.85

Tested by

no test coverage detected