[Asterisk-code-review] json: Support older jansson versions. (asterisk[13.30])
Joshua C. Colp
asteriskteam at digium.com
Wed Dec 18 06:28:20 CST 2019
Joshua C. Colp has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/13473 )
Change subject: json: Support older jansson versions.
......................................................................
json: Support older jansson versions.
The use of '?' is a fairly new addition to jansson and is not
supported in the version of jansson that can be used by 13.
This change returns to previous supported behavior and removes
usage of '?'.
ASTERISK-28663
Change-Id: I6d596007ae85e8724d928865d99968f679be1142
---
M main/json.c
M res/res_stasis_playback.c
M res/res_stasis_recording.c
M res/stasis/app.c
4 files changed, 8 insertions(+), 8 deletions(-)
Approvals:
Corey Farrell: Looks good to me, but someone else must approve
Sean Bright: Looks good to me, but someone else must approve
Joshua C. Colp: Looks good to me, approved; Approved for Submit
diff --git a/main/json.c b/main/json.c
index 16137e0..dd2910e 100644
--- a/main/json.c
+++ b/main/json.c
@@ -895,12 +895,12 @@
struct ast_json *ast_json_dialplan_cep_app(
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?}",
- "context", context,
- "exten", exten,
+ return ast_json_pack("{s: o, s: o, s: o, s: o, s: o}",
+ "context", context ? ast_json_string_create(context) : ast_json_null(),
+ "exten", exten ? ast_json_string_create(exten) : ast_json_null(),
"priority", priority != -1 ? ast_json_integer_create(priority) : ast_json_null(),
- "app_name", app_name,
- "app_data", app_data
+ "app_name", app_name ? ast_json_string_create(app_name) : ast_json_null(),
+ "app_data", app_data ? ast_json_string_create(app_data) : ast_json_null()
);
}
diff --git a/res/res_stasis_playback.c b/res/res_stasis_playback.c
index 8145e40..9e8311f 100644
--- a/res/res_stasis_playback.c
+++ b/res/res_stasis_playback.c
@@ -105,7 +105,7 @@
return NULL;
}
- return ast_json_pack("{s: s, s: o?, s: O}",
+ return ast_json_pack("{s: s, s: o, s: O}",
"type", type,
"timestamp", ast_json_timeval(*stasis_message_timestamp(message), NULL),
"playback", blob);
diff --git a/res/res_stasis_recording.c b/res/res_stasis_recording.c
index c21af2a..4805703 100644
--- a/res/res_stasis_recording.c
+++ b/res/res_stasis_recording.c
@@ -91,7 +91,7 @@
return NULL;
}
- return ast_json_pack("{s: s, s: o?, s: O}",
+ return ast_json_pack("{s: s, s: o, s: O}",
"type", type,
"timestamp", ast_json_timeval(*stasis_message_timestamp(message), NULL),
"recording", blob);
diff --git a/res/stasis/app.c b/res/stasis/app.c
index 8e719a1..c1b7fae 100644
--- a/res/stasis/app.c
+++ b/res/stasis/app.c
@@ -1164,7 +1164,7 @@
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",
"timestamp", ast_json_timeval(ast_tvnow(), NULL),
"application", app->name);
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/13473
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13.30
Gerrit-Change-Id: I6d596007ae85e8724d928865d99968f679be1142
Gerrit-Change-Number: 13473
Gerrit-PatchSet: 2
Gerrit-Owner: Joshua C. Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua C. Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20191218/3fe75c9d/attachment.html>
More information about the asterisk-code-review
mailing list