int stasis_cache_init(void) { ast_register_cleanup(stasis_cache_cleanup); if (STASIS_MESSAGE_TYPE_INIT(stasis_cache_clear_type) != 0) { return -1; } if (STASIS_MESSAGE_TYPE_INIT(stasis_cache_update_type) != 0) { return -1; } return 0; }
int ast_pickup_init(void) { STASIS_MESSAGE_TYPE_INIT(ast_call_pickup_type); ast_register_atexit(pickup_shutdown); return 0; }
int ast_endpoint_stasis_init(void) { int res = 0; ast_register_cleanup(endpoints_stasis_cleanup); endpoint_cache_all = stasis_cp_all_create("endpoint_topic_all", endpoint_snapshot_get_id); if (!endpoint_cache_all) { return -1; } res |= STASIS_MESSAGE_TYPE_INIT(ast_endpoint_snapshot_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_endpoint_state_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_endpoint_contact_state_type); return res; }
static int load_module(void) { if (STASIS_MESSAGE_TYPE_INIT(stasis_test_message_type) != 0) { return AST_MODULE_LOAD_FAILURE; } return AST_MODULE_LOAD_SUCCESS; }
int stasis_wait_init(void) { ast_register_cleanup(wait_cleanup); if (STASIS_MESSAGE_TYPE_INIT(cache_guarantee_type) != 0) { return -1; } return 0; }
int ast_local_init(void) { if (STASIS_MESSAGE_TYPE_INIT(ast_local_optimization_begin_type)) { return -1; } if (STASIS_MESSAGE_TYPE_INIT(ast_local_optimization_end_type)) { return -1; } if (STASIS_MESSAGE_TYPE_INIT(ast_local_bridge_type)) { return -1; } if (!(local_tech.capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) { return -1; } ast_format_cap_append_by_type(local_tech.capabilities, AST_MEDIA_TYPE_UNKNOWN); locals = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, locals_cmp_cb); if (!locals) { ao2_cleanup(local_tech.capabilities); local_tech.capabilities = NULL; return -1; } /* Make sure we can register our channel type */ if (ast_channel_register(&local_tech)) { ast_log(LOG_ERROR, "Unable to register channel class 'Local'\n"); ao2_ref(locals, -1); ao2_cleanup(local_tech.capabilities); local_tech.capabilities = NULL; return -1; } ast_cli_register_multiple(cli_local, ARRAY_LEN(cli_local)); ast_manager_register_xml_core("LocalOptimizeAway", EVENT_FLAG_SYSTEM|EVENT_FLAG_CALL, manager_optimize_away); ast_register_cleanup(local_shutdown); return 0; }
static int load_module(void) { int r; r = STASIS_MESSAGE_TYPE_INIT(stasis_app_recording_snapshot_type); if (r != 0) { return AST_MODULE_LOAD_FAILURE; } recordings = ao2_container_alloc(RECORDING_BUCKETS, recording_hash, recording_cmp); if (!recordings) { return AST_MODULE_LOAD_FAILURE; } return AST_MODULE_LOAD_SUCCESS; }
static int load_module(void) { RAII_VAR(struct stasis_message_router *, router, ast_cdr_message_router(), ao2_cleanup); int res = 0; if (!router) { return AST_MODULE_LOAD_FAILURE; } res |= STASIS_MESSAGE_TYPE_INIT(appcdr_message_type); res |= ast_register_application_xml(nocdr_app, nocdr_exec); res |= ast_register_application_xml(resetcdr_app, resetcdr_exec); res |= stasis_message_router_add(router, appcdr_message_type(), appcdr_callback, NULL); if (res) { return AST_MODULE_LOAD_FAILURE; } return AST_MODULE_LOAD_SUCCESS; }
int ast_stasis_channels_init(void) { int res = 0; ast_register_cleanup(stasis_channels_cleanup); channel_cache_all = stasis_cp_all_create("ast_channel_topic_all", channel_snapshot_get_id); if (!channel_cache_all) { return -1; } res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_agent_login_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_agent_logoff_type); channel_cache_by_name = stasis_cache_create(channel_snapshot_get_name); if (!channel_cache_by_name) { return -1; } /* This should be initialized before the caching topic */ res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_snapshot_type); channel_by_name_topic = stasis_caching_topic_create( stasis_cp_all_topic(channel_cache_all), channel_cache_by_name); if (!channel_by_name_topic) { return -1; } res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_dial_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_varset_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_user_event_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_hangup_request_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_dtmf_begin_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_dtmf_end_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_hold_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_unhold_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_chanspy_start_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_chanspy_stop_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_fax_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_hangup_handler_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_moh_start_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_moh_stop_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_monitor_start_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_monitor_stop_type); return res; }
int manager_confbridge_init(void) { STASIS_MESSAGE_TYPE_INIT(confbridge_start_type); STASIS_MESSAGE_TYPE_INIT(confbridge_end_type); STASIS_MESSAGE_TYPE_INIT(confbridge_join_type); STASIS_MESSAGE_TYPE_INIT(confbridge_leave_type); STASIS_MESSAGE_TYPE_INIT(confbridge_start_record_type); STASIS_MESSAGE_TYPE_INIT(confbridge_stop_record_type); STASIS_MESSAGE_TYPE_INIT(confbridge_mute_type); STASIS_MESSAGE_TYPE_INIT(confbridge_unmute_type); STASIS_MESSAGE_TYPE_INIT(confbridge_talking_type); bridge_state_router = stasis_message_router_create( ast_bridge_topic_all_cached()); if (!bridge_state_router) { return -1; } if (stasis_message_router_add(bridge_state_router, confbridge_start_type(), confbridge_start_cb, NULL)) { manager_confbridge_shutdown(); return -1; } if (stasis_message_router_add(bridge_state_router, confbridge_end_type(), confbridge_end_cb, NULL)) { manager_confbridge_shutdown(); return -1; } if (stasis_message_router_add(bridge_state_router, confbridge_join_type(), confbridge_join_cb, NULL)) { manager_confbridge_shutdown(); return -1; } if (stasis_message_router_add(bridge_state_router, confbridge_leave_type(), confbridge_leave_cb, NULL)) { manager_confbridge_shutdown(); return -1; } if (stasis_message_router_add(bridge_state_router, confbridge_start_record_type(), confbridge_start_record_cb, NULL)) { manager_confbridge_shutdown(); return -1; } if (stasis_message_router_add(bridge_state_router, confbridge_stop_record_type(), confbridge_stop_record_cb, NULL)) { manager_confbridge_shutdown(); return -1; } if (stasis_message_router_add(bridge_state_router, confbridge_mute_type(), confbridge_mute_cb, NULL)) { manager_confbridge_shutdown(); return -1; } if (stasis_message_router_add(bridge_state_router, confbridge_unmute_type(), confbridge_unmute_cb, NULL)) { manager_confbridge_shutdown(); return -1; } if (stasis_message_router_add(bridge_state_router, confbridge_talking_type(), confbridge_talking_cb, NULL)) { manager_confbridge_shutdown(); return -1; } channel_state_router = stasis_message_router_create( ast_channel_topic_all_cached()); if (!channel_state_router) { manager_confbridge_shutdown(); return -1; } if (stasis_message_router_add(channel_state_router, confbridge_start_type(), confbridge_start_cb, NULL)) { manager_confbridge_shutdown(); return -1; } if (stasis_message_router_add(channel_state_router, confbridge_end_type(), confbridge_end_cb, NULL)) { manager_confbridge_shutdown(); return -1; } if (stasis_message_router_add(channel_state_router, confbridge_join_type(), confbridge_join_cb, NULL)) { manager_confbridge_shutdown(); return -1; } if (stasis_message_router_add(channel_state_router, confbridge_leave_type(), confbridge_leave_cb, NULL)) { manager_confbridge_shutdown(); return -1; } if (stasis_message_router_add(channel_state_router, confbridge_start_record_type(), confbridge_start_record_cb, NULL)) { manager_confbridge_shutdown(); return -1; } if (stasis_message_router_add(channel_state_router, confbridge_stop_record_type(), confbridge_stop_record_cb, NULL)) { manager_confbridge_shutdown(); return -1; } if (stasis_message_router_add(channel_state_router, confbridge_mute_type(), confbridge_mute_cb, NULL)) { manager_confbridge_shutdown(); return -1; } if (stasis_message_router_add(channel_state_router, confbridge_unmute_type(), confbridge_unmute_cb, NULL)) { manager_confbridge_shutdown(); return -1; } if (stasis_message_router_add(channel_state_router, confbridge_talking_type(), confbridge_talking_cb, NULL)) { manager_confbridge_shutdown(); return -1; } return 0; }
/*! \brief Initialize the system level items for \ref stasis */ int ast_stasis_system_init(void) { ast_register_cleanup(stasis_system_cleanup); system_topic = stasis_topic_create("ast_system"); if (!system_topic) { return 1; } if (STASIS_MESSAGE_TYPE_INIT(ast_network_change_type) != 0) { return -1; } if (STASIS_MESSAGE_TYPE_INIT(ast_system_registry_type) != 0) { return -1; } if (STASIS_MESSAGE_TYPE_INIT(ast_cc_available_type) != 0) { return -1; } if (STASIS_MESSAGE_TYPE_INIT(ast_cc_offertimerstart_type) != 0) { return -1; } if (STASIS_MESSAGE_TYPE_INIT(ast_cc_requested_type) != 0) { return -1; } if (STASIS_MESSAGE_TYPE_INIT(ast_cc_requestacknowledged_type) != 0) { return -1; } if (STASIS_MESSAGE_TYPE_INIT(ast_cc_callerstopmonitoring_type) != 0) { return -1; } if (STASIS_MESSAGE_TYPE_INIT(ast_cc_callerstartmonitoring_type) != 0) { return -1; } if (STASIS_MESSAGE_TYPE_INIT(ast_cc_callerrecalling_type) != 0) { return -1; } if (STASIS_MESSAGE_TYPE_INIT(ast_cc_recallcomplete_type) != 0) { return -1; } if (STASIS_MESSAGE_TYPE_INIT(ast_cc_failure_type) != 0) { return -1; } if (STASIS_MESSAGE_TYPE_INIT(ast_cc_monitorfailed_type) != 0) { return -1; } return 0; }