static int module_init(void) { int err = 0; err = mqueue_alloc(&mod_obj.mq, mqueue_handler, &mod_obj); if (err) return err; aufilt_register(baresip_aufiltl(), &vumeter); #ifdef USE_NOTIFICATIONS err = message_listen(&mod_obj.message, baresip_message(), message_handler, &mod_obj); if (err) { warning("gtk: message_init failed (%m)\n", err); return err; } #endif err = cmd_register(baresip_commands(), cmdv, ARRAY_SIZE(cmdv)); if (err) return err; /* start the thread last */ err = pthread_create(&mod_obj.thread, NULL, gtk_thread, &mod_obj); if (err) return err; return err; }
static int module_close(void) { cmd_unregister(baresip_commands(), cmdv); list_flush(contact_list(baresip_contacts())); return 0; }
static int module_close(void) { cmd_unregister(baresip_commands(), cmdv); if (mod_obj.run) { gdk_threads_enter(); gtk_main_quit(); gdk_threads_leave(); } if (mod_obj.thread) pthread_join(mod_obj.thread, NULL); mod_obj.mq = mem_deref(mod_obj.mq); aufilt_unregister(&vumeter); mod_obj.message = mem_deref(mod_obj.message); #ifdef USE_LIBNOTIFY if (notify_is_initted()) notify_uninit(); #endif g_slist_free(mod_obj.accounts_menu_group); g_slist_free(mod_obj.call_windows); g_slist_free(mod_obj.incoming_call_menus); uag_event_unregister(ua_event_handler); return 0; }
static int module_init(void) { struct contacts *contacts = baresip_contacts(); char path[256] = "", file[256] = ""; int err; err = conf_path_get(path, sizeof(path)); if (err) return err; if (re_snprintf(file, sizeof(file), "%s/contacts", path) < 0) return ENOMEM; if (!conf_fileexist(file)) { (void)fs_mkdir(path, 0700); err = write_template(file); if (err) return err; } err = conf_parse(file, confline_handler, contacts); if (err) return err; err = cmd_register(baresip_commands(), cmdv, ARRAY_SIZE(cmdv)); if (err) return err; info("Populated %u contacts\n", list_count(contact_list(contacts))); return err; }
static int module_close(void) { cmd_unregister(baresip_commands(), cmdv); menc_unregister(&menc_zrtp); if (zrtp_global) { zrtp_down(zrtp_global); zrtp_global = NULL; } return 0; }
static int module_init(void) { int err; start_ticks = tmr_jiffies(); (void)time(&start_time); err = cmd_register(baresip_commands(), debugcmdv, ARRAY_SIZE(debugcmdv)); return err; }
static int module_init(void) { zrtp_status_t s; char config_path[256] = ""; char zrtp_zid_path[256] = ""; FILE *f; int ret, err; (void)conf_get_bool(conf_cur(), "zrtp_hash", &use_sig_hash); zrtp_log_set_log_engine(zrtp_log); zrtp_config_defaults(&zrtp_config); str_ncpy(zrtp_config.client_id, "baresip/zrtp", sizeof(zrtp_config.client_id)); zrtp_config.lic_mode = ZRTP_LICENSE_MODE_UNLIMITED; zrtp_config.cb.misc_cb.on_send_packet = on_send_packet; zrtp_config.cb.event_cb.on_zrtp_secure = on_zrtp_secure; zrtp_config.cb.event_cb.on_zrtp_security_event = on_zrtp_security_event; err = conf_path_get(config_path, sizeof(config_path)); if (err) { warning("zrtp: could not get config path: %m\n", err); return err; } ret = re_snprintf(zrtp_config.def_cache_path.buffer, zrtp_config.def_cache_path.max_length, "%s/zrtp_cache.dat", config_path); if (ret < 0) { warning("zrtp: could not write cache path\n"); return ENOMEM; } zrtp_config.def_cache_path.length = ret; if (re_snprintf(zrtp_zid_path, sizeof(zrtp_zid_path), "%s/zrtp_zid", config_path) < 0) return ENOMEM; if ((f = fopen(zrtp_zid_path, "rb")) != NULL) { if (fread(zid, sizeof(zid), 1, f) != 1) { if (feof(f) || ferror(f)) { warning("zrtp: invalid zrtp_zid file\n"); } } } else if ((f = fopen(zrtp_zid_path, "wb")) != NULL) { rand_bytes(zid, sizeof(zid)); if (fwrite(zid, sizeof(zid), 1, f) != 1) { warning("zrtp: zrtp_zid file write failed\n"); } info("zrtp: generated new persistent ZID (%s)\n", zrtp_zid_path); } else { err = errno; warning("zrtp: fopen() %s (%m)\n", zrtp_zid_path, err); } if (f) (void) fclose(f); s = zrtp_init(&zrtp_config, &zrtp_global); if (zrtp_status_ok != s) { warning("zrtp: zrtp_init() failed (status = %d)\n", s); return ENOSYS; } menc_register(baresip_mencl(), &menc_zrtp); debug("zrtp: cache_file: %s\n", zrtp_config.def_cache_path.buffer); debug(" zid_file: %s\n", zrtp_zid_path); debug(" zid: %w\n", zid, sizeof(zid)); return cmd_register(baresip_commands(), cmdv, ARRAY_SIZE(cmdv)); }
static int module_close(void) { auloop_stop(NULL, NULL); cmd_unregister(baresip_commands(), cmdv); return 0; }
static int module_init(void) { return cmd_register(baresip_commands(), cmdv, ARRAY_SIZE(cmdv)); }
static int module_close(void) { cmd_unregister(baresip_commands(), debugcmdv); return 0; }