static void security_event_cb(const struct ast_event *event, void *data) { struct ast_str *str; enum ast_security_event_type event_type; if (!(str = ast_str_thread_get(&security_event_buf, SECURITY_EVENT_BUF_INIT_LEN))) { return; } /* Note that the event type is guaranteed to be valid here. */ event_type = ast_event_get_ie_uint(event, AST_EVENT_IE_SECURITY_EVENT); ast_assert(event_type >= 0 && event_type < AST_SECURITY_EVENT_NUM_TYPES); ast_str_set(&str, 0, "%s=\"%s\"", ast_event_get_ie_type_name(AST_EVENT_IE_SECURITY_EVENT), ast_security_event_get_name(event_type)); append_ies(&str, event, ast_security_event_get_required_ies(event_type), REQUIRED); append_ies(&str, event, ast_security_event_get_optional_ies(event_type), NOT_REQUIRED); ast_log_dynamic_level(LOG_SECURITY, "%s\n", ast_str_buffer(str)); }
static void security_event_stasis_cb(struct ast_json *json) { struct ast_str *str; struct ast_json *event_type_json; enum ast_security_event_type event_type; event_type_json = ast_json_object_get(json, "SecurityEvent"); event_type = ast_json_integer_get(event_type_json); ast_assert(event_type >= 0 && event_type < AST_SECURITY_EVENT_NUM_TYPES); if (!(str = ast_str_thread_get(&security_event_buf, SECURITY_EVENT_BUF_INIT_LEN))) { return; } ast_str_set(&str, 0, "SecurityEvent=\"%s\"", ast_security_event_get_name(event_type)); append_json(&str, json, ast_security_event_get_required_ies(event_type), REQUIRED); append_json(&str, json, ast_security_event_get_optional_ies(event_type), NOT_REQUIRED); ast_log_dynamic_level(LOG_SECURITY, "%s\n", ast_str_buffer(str)); }