mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 04:11:08 +00:00
ccss: Remove silly usage of RAII_VAR.
Change-Id: I5ce40035e0a940e4e56f6322c1dcd47fbd509b98
This commit is contained in:
47
main/ccss.c
47
main/ccss.c
@@ -1022,9 +1022,9 @@ void ast_set_cc_callback_sub(struct ast_cc_config_params *config, const char * c
|
|||||||
|
|
||||||
static int cc_publish(struct stasis_message_type *message_type, int core_id, struct ast_json *extras)
|
static int cc_publish(struct stasis_message_type *message_type, int core_id, struct ast_json *extras)
|
||||||
{
|
{
|
||||||
RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
|
struct ast_json *blob;
|
||||||
RAII_VAR(struct ast_json_payload *, payload, NULL, ao2_cleanup);
|
struct ast_json_payload *payload;
|
||||||
RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
|
struct stasis_message *message;
|
||||||
|
|
||||||
if (!message_type) {
|
if (!message_type) {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1040,121 +1040,138 @@ static int cc_publish(struct stasis_message_type *message_type, int core_id, str
|
|||||||
ast_json_object_update(blob, extras);
|
ast_json_object_update(blob, extras);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(payload = ast_json_payload_create(blob))) {
|
payload = ast_json_payload_create(blob);
|
||||||
|
ast_json_unref(blob);
|
||||||
|
|
||||||
|
if (!payload) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(message = stasis_message_create(message_type, payload))) {
|
message = stasis_message_create(message_type, payload);
|
||||||
|
ao2_ref(payload, -1);
|
||||||
|
|
||||||
|
if (!message) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
stasis_publish(ast_system_topic(), message);
|
stasis_publish(ast_system_topic(), message);
|
||||||
|
ao2_ref(message, -1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cc_publish_available(int core_id, const char *callee, const char *service)
|
static void cc_publish_available(int core_id, const char *callee, const char *service)
|
||||||
{
|
{
|
||||||
RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
|
struct ast_json *extras;
|
||||||
|
|
||||||
extras = ast_json_pack("{s: s, s: s}",
|
extras = ast_json_pack("{s: s, s: s}",
|
||||||
"callee", callee,
|
"callee", callee,
|
||||||
"service", service);
|
"service", service);
|
||||||
|
|
||||||
cc_publish(ast_cc_available_type(), core_id, extras);
|
cc_publish(ast_cc_available_type(), core_id, extras);
|
||||||
|
ast_json_unref(extras);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cc_publish_offertimerstart(int core_id, const char *caller, unsigned int expires)
|
static void cc_publish_offertimerstart(int core_id, const char *caller, unsigned int expires)
|
||||||
{
|
{
|
||||||
RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
|
struct ast_json *extras;
|
||||||
|
|
||||||
extras = ast_json_pack("{s: s, s: i}",
|
extras = ast_json_pack("{s: s, s: i}",
|
||||||
"caller", caller,
|
"caller", caller,
|
||||||
"expires", expires);
|
"expires", expires);
|
||||||
|
|
||||||
cc_publish(ast_cc_offertimerstart_type(), core_id, extras);
|
cc_publish(ast_cc_offertimerstart_type(), core_id, extras);
|
||||||
|
ast_json_unref(extras);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cc_publish_requested(int core_id, const char *caller, const char *callee)
|
static void cc_publish_requested(int core_id, const char *caller, const char *callee)
|
||||||
{
|
{
|
||||||
RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
|
struct ast_json *extras;
|
||||||
|
|
||||||
extras = ast_json_pack("{s: s, s: s}",
|
extras = ast_json_pack("{s: s, s: s}",
|
||||||
"caller", caller,
|
"caller", caller,
|
||||||
"callee", callee);
|
"callee", callee);
|
||||||
|
|
||||||
cc_publish(ast_cc_requested_type(), core_id, extras);
|
cc_publish(ast_cc_requested_type(), core_id, extras);
|
||||||
|
ast_json_unref(extras);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cc_publish_requestacknowledged(int core_id, const char *caller)
|
static void cc_publish_requestacknowledged(int core_id, const char *caller)
|
||||||
{
|
{
|
||||||
RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
|
struct ast_json *extras;
|
||||||
|
|
||||||
extras = ast_json_pack("{s: s}",
|
extras = ast_json_pack("{s: s}",
|
||||||
"caller", caller);
|
"caller", caller);
|
||||||
|
|
||||||
cc_publish(ast_cc_requestacknowledged_type(), core_id, extras);
|
cc_publish(ast_cc_requestacknowledged_type(), core_id, extras);
|
||||||
|
ast_json_unref(extras);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cc_publish_callerstopmonitoring(int core_id, const char *caller)
|
static void cc_publish_callerstopmonitoring(int core_id, const char *caller)
|
||||||
{
|
{
|
||||||
RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
|
struct ast_json *extras;
|
||||||
|
|
||||||
extras = ast_json_pack("{s: s}",
|
extras = ast_json_pack("{s: s}",
|
||||||
"caller", caller);
|
"caller", caller);
|
||||||
|
|
||||||
cc_publish(ast_cc_callerstopmonitoring_type(), core_id, extras);
|
cc_publish(ast_cc_callerstopmonitoring_type(), core_id, extras);
|
||||||
|
ast_json_unref(extras);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cc_publish_callerstartmonitoring(int core_id, const char *caller)
|
static void cc_publish_callerstartmonitoring(int core_id, const char *caller)
|
||||||
{
|
{
|
||||||
RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
|
struct ast_json *extras;
|
||||||
|
|
||||||
extras = ast_json_pack("{s: s}",
|
extras = ast_json_pack("{s: s}",
|
||||||
"caller", caller);
|
"caller", caller);
|
||||||
|
|
||||||
cc_publish(ast_cc_callerstartmonitoring_type(), core_id, extras);
|
cc_publish(ast_cc_callerstartmonitoring_type(), core_id, extras);
|
||||||
|
ast_json_unref(extras);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cc_publish_callerrecalling(int core_id, const char *caller)
|
static void cc_publish_callerrecalling(int core_id, const char *caller)
|
||||||
{
|
{
|
||||||
RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
|
struct ast_json *extras;
|
||||||
|
|
||||||
extras = ast_json_pack("{s: s}",
|
extras = ast_json_pack("{s: s}",
|
||||||
"caller", caller);
|
"caller", caller);
|
||||||
|
|
||||||
cc_publish(ast_cc_callerrecalling_type(), core_id, extras);
|
cc_publish(ast_cc_callerrecalling_type(), core_id, extras);
|
||||||
|
ast_json_unref(extras);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cc_publish_recallcomplete(int core_id, const char *caller)
|
static void cc_publish_recallcomplete(int core_id, const char *caller)
|
||||||
{
|
{
|
||||||
RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
|
struct ast_json *extras;
|
||||||
|
|
||||||
extras = ast_json_pack("{s: s}",
|
extras = ast_json_pack("{s: s}",
|
||||||
"caller", caller);
|
"caller", caller);
|
||||||
|
|
||||||
cc_publish(ast_cc_recallcomplete_type(), core_id, extras);
|
cc_publish(ast_cc_recallcomplete_type(), core_id, extras);
|
||||||
|
ast_json_unref(extras);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cc_publish_failure(int core_id, const char *caller, const char *reason)
|
static void cc_publish_failure(int core_id, const char *caller, const char *reason)
|
||||||
{
|
{
|
||||||
RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
|
struct ast_json *extras;
|
||||||
|
|
||||||
extras = ast_json_pack("{s: s, s: s}",
|
extras = ast_json_pack("{s: s, s: s}",
|
||||||
"caller", caller,
|
"caller", caller,
|
||||||
"reason", reason);
|
"reason", reason);
|
||||||
|
|
||||||
cc_publish(ast_cc_failure_type(), core_id, extras);
|
cc_publish(ast_cc_failure_type(), core_id, extras);
|
||||||
|
ast_json_unref(extras);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cc_publish_monitorfailed(int core_id, const char *callee)
|
static void cc_publish_monitorfailed(int core_id, const char *callee)
|
||||||
{
|
{
|
||||||
RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
|
struct ast_json *extras;
|
||||||
|
|
||||||
extras = ast_json_pack("{s: s}",
|
extras = ast_json_pack("{s: s}",
|
||||||
"callee", callee);
|
"callee", callee);
|
||||||
|
|
||||||
cc_publish(ast_cc_monitorfailed_type(), core_id, extras);
|
cc_publish(ast_cc_monitorfailed_type(), core_id, extras);
|
||||||
|
ast_json_unref(extras);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct cc_monitor_backend {
|
struct cc_monitor_backend {
|
||||||
|
Reference in New Issue
Block a user