json: Take advantage of new API's.

* Use "o*" format specifier for optional fields in ast_json_party_id.
* Stop using ast_json_deep_copy on immutable objects, it is now thread
  safe to just use ast_json_ref.

Additional changes to ast_json_pack calls in the vicinity:
* Use "O" when an object needs to be bumped.  This was previously
  avoided as it was not thread safe.
* Use "o?" and "O?" to replace NULL with ast_json_null().  The
  "?" is a new feature of ast_json_pack starting with Asterisk 16.

Change-Id: I8382d28d7d83ee0ce13334e51ae45dbc0bdaef48
This commit is contained in:
Corey Farrell
2018-07-16 23:55:02 -04:00
parent 3ddfeccf35
commit 7b0dbda936
6 changed files with 19 additions and 41 deletions

View File

@@ -111,9 +111,9 @@ static struct ast_json *playback_to_json(struct stasis_message *message,
return NULL;
}
return ast_json_pack("{s: s, s: o}",
return ast_json_pack("{s: s, s: O}",
"type", type,
"playback", ast_json_deep_copy(blob));
"playback", blob);
}
STASIS_MESSAGE_TYPE_DEFN(stasis_app_playback_snapshot_type,