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 6e1cf9de6b
commit 93777faf36
6 changed files with 19 additions and 41 deletions

View File

@@ -3430,10 +3430,10 @@ static struct ast_json *rtcp_report_to_json(struct stasis_message *msg,
}
}
return ast_json_pack("{s: o, s: o, s: o}",
"channel", payload->snapshot ? json_channel : ast_json_null(),
return ast_json_pack("{s: o?, s: o, s: O?}",
"channel", json_channel,
"rtcp_report", json_rtcp_report,
"blob", ast_json_deep_copy(payload->blob) ?: ast_json_null());
"blob", payload->blob);
}
static void rtp_rtcp_report_dtor(void *obj)