Example #1
0
static int ss7_load_module(void)
{
  if(load_config(0)) {
    return AST_MODULE_LOAD_FAILURE;
  }

  if (timers_init()) {
    ast_log(LOG_ERROR, "Unable to initialize timers.\n");
    return AST_MODULE_LOAD_FAILURE;
  }
  if (isup_init()) {
    ast_log(LOG_ERROR, "Unable to initialize ISUP.\n");
    return AST_MODULE_LOAD_FAILURE;
  }
#ifdef SCCP
  if (sccp_init()) {
    ast_log(LOG_ERROR, "Unable to initialize SCCP.\n");
    return AST_MODULE_LOAD_FAILURE;
  }
#endif

  if(mtp_init()) {
    ast_log(LOG_ERROR, "Unable to initialize MTP.\n");
    return AST_MODULE_LOAD_FAILURE;
  }
  if(start_mtp_thread()) {
    ast_log(LOG_ERROR, "Unable to start MTP thread.\n");
    return AST_MODULE_LOAD_FAILURE;
  }
  monitor_running = 1;          /* Otherwise there is a race, and
                                   monitor may exit immediately */
  if(ast_pthread_create(&monitor_thread, NULL, monitor_main, NULL) < 0) {
    ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
    monitor_running = 0;
    return AST_MODULE_LOAD_FAILURE;
  }


  cli_register();

  ast_verbose(VERBOSE_PREFIX_3 "SS7 channel loaded successfully.\n");
  return AST_MODULE_LOAD_SUCCESS;
}
Example #2
0
void on_load(void)
{
    log_category_duplicogram_init();
    ext_param_bucket_width_init();

    SLOG(LOG_INFO, "Duplicogram loaded");

    term_init(&handle_key);

    cli_register("Duplicogram plugin", duplicogram_opts, NB_ELEMS(duplicogram_opts));

    mutex_ctor(&dup_lock, "Duplicogram mutex");

    ext_function_ctor(&sg_get_duplicogram,
        "get-duplicogram", 0, 0, 0, g_get_duplicogram,
        "(get-duplicogram): fetch duplicogram data and reset internal state. Not for the casual user");

    hook_subscriber_ctor(&dup_hook, &dup_subscription, dup_callback);
    hook_subscriber_ctor(&proto_cap->hook, &cap_subscription, cap_callback);
}