mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 23:08:32 +00:00
Merge "json: Support older jansson versions." into 13
This commit is contained in:
10
main/json.c
10
main/json.c
@@ -895,12 +895,12 @@ struct ast_json *ast_json_name_number(const char *name, const char *number)
|
|||||||
struct ast_json *ast_json_dialplan_cep_app(
|
struct ast_json *ast_json_dialplan_cep_app(
|
||||||
const char *context, const char *exten, int priority, const char *app_name, const char *app_data)
|
const char *context, const char *exten, int priority, const char *app_name, const char *app_data)
|
||||||
{
|
{
|
||||||
return ast_json_pack("{s: s?, s: s?, s: o, s: s?, s: s?}",
|
return ast_json_pack("{s: o, s: o, s: o, s: o, s: o}",
|
||||||
"context", context,
|
"context", context ? ast_json_string_create(context) : ast_json_null(),
|
||||||
"exten", exten,
|
"exten", exten ? ast_json_string_create(exten) : ast_json_null(),
|
||||||
"priority", priority != -1 ? ast_json_integer_create(priority) : ast_json_null(),
|
"priority", priority != -1 ? ast_json_integer_create(priority) : ast_json_null(),
|
||||||
"app_name", app_name,
|
"app_name", app_name ? ast_json_string_create(app_name) : ast_json_null(),
|
||||||
"app_data", app_data
|
"app_data", app_data ? ast_json_string_create(app_data) : ast_json_null()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ static struct ast_json *playback_to_json(struct stasis_message *message,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ast_json_pack("{s: s, s: o?, s: O}",
|
return ast_json_pack("{s: s, s: o, s: O}",
|
||||||
"type", type,
|
"type", type,
|
||||||
"timestamp", ast_json_timeval(*stasis_message_timestamp(message), NULL),
|
"timestamp", ast_json_timeval(*stasis_message_timestamp(message), NULL),
|
||||||
"playback", blob);
|
"playback", blob);
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ static struct ast_json *recording_to_json(struct stasis_message *message,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ast_json_pack("{s: s, s: o?, s: O}",
|
return ast_json_pack("{s: s, s: o, s: O}",
|
||||||
"type", type,
|
"type", type,
|
||||||
"timestamp", ast_json_timeval(*stasis_message_timestamp(message), NULL),
|
"timestamp", ast_json_timeval(*stasis_message_timestamp(message), NULL),
|
||||||
"recording", blob);
|
"recording", blob);
|
||||||
|
|||||||
@@ -1164,7 +1164,7 @@ void app_update(struct stasis_app *app, stasis_app_cb handler, void *data)
|
|||||||
|
|
||||||
ast_verb(1, "Replacing Stasis app '%s'\n", app->name);
|
ast_verb(1, "Replacing Stasis app '%s'\n", app->name);
|
||||||
|
|
||||||
msg = ast_json_pack("{s: s, s: o?, s: s}",
|
msg = ast_json_pack("{s: s, s: o, s: s}",
|
||||||
"type", "ApplicationReplaced",
|
"type", "ApplicationReplaced",
|
||||||
"timestamp", ast_json_timeval(ast_tvnow(), NULL),
|
"timestamp", ast_json_timeval(ast_tvnow(), NULL),
|
||||||
"application", app->name);
|
"application", app->name);
|
||||||
|
|||||||
Reference in New Issue
Block a user