Module init function */
| 419 | |
| 420 | /** Module init function */ |
| 421 | static 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; |
nothing calls this directly
no test coverage detected