[Asterisk-code-review] json: Support older jansson versions. (asterisk[13])

Joshua C. Colp asteriskteam at digium.com
Mon Dec 16 19:23:50 CST 2019


Joshua C. Colp has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/13450 )


Change subject: json: Support older jansson versions.
......................................................................

json: Support older jansson versions.

The use of 's?' is a fairly new addition to jansson and is not
widely supported yet. This returns to the previous behavior of
creating a string or using a null as appropriate when creating
a dialplan cep object.

ASTERISK-28663

Change-Id: I6d596007ae85e8724d928865d99968f679be1142
---
M main/json.c
1 file changed, 5 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/50/13450/1

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()
 		);
 }
 

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/13450
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I6d596007ae85e8724d928865d99968f679be1142
Gerrit-Change-Number: 13450
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua C. Colp <jcolp at sangoma.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20191216/5e092f4a/attachment-0001.html>


More information about the asterisk-code-review mailing list