]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
json: Support older jansson versions.
authorJoshua C. Colp <jcolp@sangoma.com>
Tue, 17 Dec 2019 01:18:37 +0000 (21:18 -0400)
committerJoshua C. Colp <jcolp@sangoma.com>
Tue, 17 Dec 2019 14:14:17 +0000 (08:14 -0600)
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

main/json.c
res/res_stasis_playback.c
res/res_stasis_recording.c
res/stasis/app.c

index 16137e0c2085257fc6e863f250c0e1e2c4980d73..dd2910e8a4f69d8c58d42a040f6c026ce4f82b8d 100644 (file)
@@ -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(
                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()
                );
 }
 
index 8145e400c48f2fbfcbdef179739ebe7024db3999..9e8311fb89e7763db0ccfd959940f27b3bcd51cd 100644 (file)
@@ -105,7 +105,7 @@ static struct ast_json *playback_to_json(struct stasis_message *message,
                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);
index c21af2ae02971417ff0603c4161371f8381dcc64..48057031ad2c301e80991ad0b33c52ea9cc837ad 100644 (file)
@@ -91,7 +91,7 @@ static struct ast_json *recording_to_json(struct stasis_message *message,
                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);
index 8e719a16aab08317454b264aa801345232aefb72..c1b7fae3a0b4dfc37f58d1abf79c0481da0e55a2 100644 (file)
@@ -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);
 
-               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);