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

Function mod_init

modules/imc/imc.c:357–420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355
356
357static int mod_init(void)
358{
359
360 LM_INFO("initializing ...\n");
361
362 if(imc_hash_size <= 0)
363 {
364 LM_ERR("invalid hash size\n");
365 return -1;
366 }
367
368 imc_hash_size = 1 << imc_hash_size;
369
370 if(imc_htable_init() < 0)
371 {
372 LM_ERR("initializing hash table\n");
373 return -1;
374 }
375
376 imc_cmd_start_str.len = strlen(imc_cmd_start_str.s);
377
378 if(outbound_proxy.s)
379 outbound_proxy.len = strlen(outbound_proxy.s);
380
381 rooms_table.len = strlen(rooms_table.s);
382 members_table.len = strlen(members_table.s);
383
384 /* binding to mysql module */
385 init_db_url( db_url , 0 /*cannot be null*/);
386 LM_DBG("db_url=%s\n", db_url_escape(&db_url));
387
388 if (db_bind_mod(&db_url, &imc_dbf))
389 {
390 LM_DBG("database module not found\n");
391 return -1;
392 }
393
394 imc_db = imc_dbf.init(&db_url);
395 if (!imc_db)
396 {
397 LM_ERR("failed to connect to the database\n");
398 return -1;
399 }
400 /* read the informations stored in db */
401 if(add_from_db() <0)
402 {
403 LM_ERR("failed to get information from db\n");
404 return -1;
405 }
406
407 /* load TM API */
408 if (load_tm_api(&tmb)!=0) {
409 LM_ERR("unable to load tm api\n");
410 return -1;
411 }
412
413 imc_cmd_start_char = imc_cmd_start_str.s[0];
414

Callers

nothing calls this directly

Calls 5

imc_htable_initFunction · 0.85
db_url_escapeFunction · 0.85
db_bind_modFunction · 0.85
add_from_dbFunction · 0.85
load_tm_apiFunction · 0.85

Tested by

no test coverage detected