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

Function mod_init

modules/b2b_logic/b2b_logic.c:421–760  ·  view source on GitHub ↗

Module init function */

Source from the content-addressed store, hash-verified

419
420/** Module init function */
421static int mod_init(void)
422{
423 char* p = NULL;
424 char* flags = NULL;
425 int regexp_flags = 0;
426 int i = 0, j;
427 pv_spec_t avp_spec;
428
429 LM_DBG("start\n");
430
431 /* load b2b_entities api */
432 if(load_b2b_api(&b2b_api)< 0)
433 {
434 LM_ERR("Failed to load b2b api\n");
435 return -1;
436 }
437
438 if(b2bl_hsize< 1 || b2bl_hsize> 20)
439 {
440 LM_ERR("Wrong hash size. Needs to be greater than 1"
441 " and smaller than 20. Be aware that you should set the log 2"
442 " value of the real size\n");
443 return -1;
444 }
445 b2bl_hsize = 1<<b2bl_hsize;
446
447 if (server_address.s)
448 {
449 server_address.len = strlen(server_address.s);
450 if(pv_parse_format(&server_address, &server_address_pve) < 0)
451 {
452 LM_ERR("failed to parse server_address [%.*s]\n", server_address.len, server_address.s);
453 return E_CFG;
454 }
455 }
456
457 if (script_req_route) {
458 global_req_rt_ref = ref_script_route_by_name(script_req_route,
459 sroutes->request, RT_NO, REQUEST_ROUTE, 0);
460 if (!ref_script_route_is_valid(global_req_rt_ref)) {
461 LM_ERR("route <%s> does not exist\n", script_req_route);
462 return -1;
463 }
464 }
465
466 if (script_reply_route) {
467 global_reply_rt_ref = ref_script_route_by_name(script_reply_route,
468 sroutes->request, RT_NO, REQUEST_ROUTE, 0);
469 if (!ref_script_route_is_valid(global_reply_rt_ref)) {
470 LM_ERR("route <%s> does not exist\n",script_reply_route);
471 return -1;
472 }
473 }
474
475 if(init_b2bl_htable() < 0)
476 {
477 LM_ERR("Failed to initialize b2b logic hash table\n");
478 return -1;

Callers

nothing calls this directly

Calls 15

load_b2b_apiFunction · 0.85
pv_parse_formatFunction · 0.85
ref_script_route_by_nameFunction · 0.85
init_b2bl_htableFunction · 0.85
db_bind_modFunction · 0.85
db_check_table_versionFunction · 0.85
b2bl_db_initFunction · 0.85
b2b_logic_restoreFunction · 0.85
cachedb_bind_modFunction · 0.85
pv_parse_specFunction · 0.85
pv_get_avp_nameFunction · 0.85
__parse_csv_recordFunction · 0.85

Tested by

no test coverage detected