Asterisk - The Open Source Telephony Project GIT-master-d856a3e
|
JSON abstraction layer. More...
#include "asterisk.h"
#include "asterisk/json.h"
#include "asterisk/localtime.h"
#include "asterisk/module.h"
#include "asterisk/utils.h"
#include "asterisk/astobj2.h"
#include "asterisk/channel.h"
#include "asterisk/callerid.h"
#include <jansson.h>
#include <time.h>
Go to the source code of this file.
Functions | |
int | ast_json_array_append (struct ast_json *array, struct ast_json *value) |
Append to an array. More... | |
int | ast_json_array_clear (struct ast_json *array) |
Remove all elements from an array. More... | |
struct ast_json * | ast_json_array_create (void) |
Create a empty JSON array. More... | |
int | ast_json_array_extend (struct ast_json *array, struct ast_json *tail) |
Append all elements from tail to array. More... | |
struct ast_json * | ast_json_array_get (const struct ast_json *array, size_t index) |
Get an element from an array. More... | |
int | ast_json_array_insert (struct ast_json *array, size_t index, struct ast_json *value) |
Insert into an array. More... | |
int | ast_json_array_remove (struct ast_json *array, size_t index) |
Remove an element from an array. More... | |
int | ast_json_array_set (struct ast_json *array, size_t index, struct ast_json *value) |
Change an element in an array. More... | |
size_t | ast_json_array_size (const struct ast_json *array) |
Get the size of a JSON array. More... | |
struct ast_json * | ast_json_boolean (int value) |
Get the JSON boolean corresponding to value. More... | |
struct ast_json * | ast_json_channel_vars (struct varshead *channelvars) |
Construct a JSON object from a ast_var_t list. More... | |
struct ast_json * | ast_json_copy (const struct ast_json *value) |
Copy a JSON value, but not its children. More... | |
struct ast_json * | ast_json_deep_copy (const struct ast_json *value) |
Copy a JSON value, and its children. More... | |
struct ast_json * | ast_json_dialplan_cep (const char *context, const char *exten, int priority) |
Construct a context/exten/priority as JSON. More... | |
struct ast_json * | ast_json_dialplan_cep_app (const char *context, const char *exten, int priority, const char *app_name, const char *app_data) |
Construct a context/exten/priority/application/application_data as JSON. More... | |
int | ast_json_dump_file_format (struct ast_json *root, FILE *output, enum ast_json_encoding_format format) |
Encode a JSON value to a FILE . More... | |
int | ast_json_dump_new_file_format (struct ast_json *root, const char *path, enum ast_json_encoding_format format) |
Encode a JSON value to a file at the given location. More... | |
int | ast_json_dump_str_format (struct ast_json *root, struct ast_str **dst, enum ast_json_encoding_format format) |
Encode a JSON value to an ast_str. More... | |
char * | ast_json_dump_string_format (struct ast_json *root, enum ast_json_encoding_format format) |
Encode a JSON value to a string. More... | |
int | ast_json_equal (const struct ast_json *lhs, const struct ast_json *rhs) |
Compare two JSON objects. More... | |
struct ast_json * | ast_json_false (void) |
Get the JSON false value. More... | |
void | ast_json_free (void *p) |
Asterisk's custom JSON allocator. Exposed for use by unit tests. More... | |
int | ast_json_init (void) |
Initialize the JSON library. More... | |
struct ast_json * | ast_json_integer_create (intmax_t value) |
Create a JSON integer. More... | |
intmax_t | ast_json_integer_get (const struct ast_json *integer) |
Get the value from a JSON integer. More... | |
int | ast_json_integer_set (struct ast_json *integer, intmax_t value) |
Set the value of a JSON integer. More... | |
struct ast_json * | ast_json_ipaddr (const struct ast_sockaddr *addr, enum ast_transport transport_type) |
Construct an IP address as JSON. More... | |
int | ast_json_is_array (const struct ast_json *json) |
Check if value is JSON array. More... | |
int | ast_json_is_false (const struct ast_json *json) |
Check if value is JSON false. More... | |
int | ast_json_is_null (const struct ast_json *json) |
Check if value is JSON null. More... | |
int | ast_json_is_object (const struct ast_json *json) |
Check if value is JSON object. More... | |
int | ast_json_is_true (const struct ast_json *json) |
Check if value is JSON true. More... | |
struct ast_json * | ast_json_load_buf (const char *buffer, size_t buflen, struct ast_json_error *error) |
Parse buffer with known length into a JSON object or array. More... | |
struct ast_json * | ast_json_load_file (FILE *input, struct ast_json_error *error) |
Parse a FILE into JSON object or array. More... | |
struct ast_json * | ast_json_load_new_file (const char *path, struct ast_json_error *error) |
Parse file at path into JSON object or array. More... | |
struct ast_json * | ast_json_load_str (const struct ast_str *input, struct ast_json_error *error) |
Parse ast_str into a JSON object or array. More... | |
struct ast_json * | ast_json_load_string (const char *input, struct ast_json_error *error) |
Parse null terminated string into a JSON object or array. More... | |
void * | ast_json_malloc (size_t size) |
Asterisk's custom JSON allocator. Exposed for use by unit tests. More... | |
struct ast_json * | ast_json_name_number (const char *name, const char *number) |
Common JSON rendering functions for common 'objects'. More... | |
struct ast_json * | ast_json_null (void) |
Get the JSON null value. More... | |
int | ast_json_object_clear (struct ast_json *object) |
Delete all elements from a JSON object. More... | |
struct ast_json * | ast_json_object_create (void) |
Create a new JSON object. More... | |
struct ast_json * | ast_json_object_create_vars (const struct ast_variable *variables, const char *excludes) |
Create a new JSON object using the given variables. More... | |
int | ast_json_object_del (struct ast_json *object, const char *key) |
Delete a field from a JSON object. More... | |
struct ast_json * | ast_json_object_get (struct ast_json *object, const char *key) |
Get a field from a JSON object. More... | |
struct ast_json_iter * | ast_json_object_iter (struct ast_json *object) |
Get an iterator pointing to the first field in a JSON object. More... | |
struct ast_json_iter * | ast_json_object_iter_at (struct ast_json *object, const char *key) |
Get an iterator pointing to a specified key in object. More... | |
const char * | ast_json_object_iter_key (struct ast_json_iter *iter) |
Get the key from an iterator. More... | |
struct ast_json_iter * | ast_json_object_iter_next (struct ast_json *object, struct ast_json_iter *iter) |
Get the next iterator. More... | |
int | ast_json_object_iter_set (struct ast_json *object, struct ast_json_iter *iter, struct ast_json *value) |
Set the value of the field pointed to by an iterator. More... | |
struct ast_json * | ast_json_object_iter_value (struct ast_json_iter *iter) |
Get the value from an iterator. More... | |
int | ast_json_object_set (struct ast_json *object, const char *key, struct ast_json *value) |
Set a field in a JSON object. More... | |
size_t | ast_json_object_size (struct ast_json *object) |
Get size of JSON object. More... | |
int | ast_json_object_update (struct ast_json *object, struct ast_json *other) |
Update object with all of the fields of other. More... | |
int | ast_json_object_update_existing (struct ast_json *object, struct ast_json *other) |
Update existing fields in object with the fields of other. More... | |
int | ast_json_object_update_missing (struct ast_json *object, struct ast_json *other) |
Add new fields to object with the fields of other. More... | |
struct ast_json * | ast_json_pack (char const *format,...) |
Helper for creating complex JSON values. More... | |
struct ast_json * | ast_json_party_id (struct ast_party_id *party) |
Construct an ast_party_id as JSON. More... | |
struct ast_json_payload * | ast_json_payload_create (struct ast_json *json) |
Create an ao2 object to pass json blobs as data payloads for stasis. More... | |
struct ast_json * | ast_json_real_create (double value) |
Create a JSON real number. More... | |
double | ast_json_real_get (const struct ast_json *real) |
Get the value from a JSON real number. More... | |
int | ast_json_real_set (struct ast_json *real, double value) |
Set the value of a JSON real number. More... | |
struct ast_json * | ast_json_ref (struct ast_json *json) |
Increase refcount on value. More... | |
void | ast_json_reset_alloc_funcs (void) |
Change alloc funcs back to the resource module defaults. More... | |
void | ast_json_set_alloc_funcs (void *(*malloc_fn)(size_t), void(*free_fn)(void *)) |
Set custom allocators instead of the standard ast_malloc() and ast_free(). More... | |
struct ast_json * | ast_json_string_create (const char *value) |
Construct a JSON string from value. More... | |
const char * | ast_json_string_get (const struct ast_json *string) |
Get the value of a JSON string. More... | |
int | ast_json_string_set (struct ast_json *string, const char *value) |
Change the value of a JSON string. More... | |
struct ast_json * | ast_json_stringf (const char *format,...) |
Create a JSON string, printf style. More... | |
struct ast_json * | ast_json_timeval (const struct timeval tv, const char *zone) |
Construct a timeval as JSON. More... | |
enum ast_json_to_ast_vars_code | ast_json_to_ast_variables (struct ast_json *json_variables, struct ast_variable **variables) |
Convert a ast_json list of key/value pair tuples into a ast_variable list. More... | |
struct ast_json * | ast_json_true (void) |
Get the JSON true value. More... | |
const char * | ast_json_typename (enum ast_json_type type) |
Get the string name for the given type. More... | |
enum ast_json_type | ast_json_typeof (const struct ast_json *json) |
Get the type of value. More... | |
void | ast_json_unref (struct ast_json *json) |
Decrease refcount on value. If refcount reaches zero, value is freed. More... | |
int | ast_json_utf8_check (const char *str) |
Check the nul terminated string for UTF-8 format. More... | |
int | ast_json_utf8_check_len (const char *str, size_t len) |
Check the string of the given length for UTF-8 format. More... | |
struct ast_json * | ast_json_vpack (char const *format, va_list ap) |
Helper for creating complex JSON values simply. More... | |
struct ast_json * | ast_json_vstringf (const char *format, va_list args) |
Create a JSON string, vprintf style. More... | |
static void | copy_error (struct ast_json_error *error, const json_error_t *jansson_error) |
Copy Jansson error struct to ours. More... | |
static size_t | dump_flags (enum ast_json_encoding_format format) |
Default flags for JSON encoding. More... | |
static struct ast_json * | json_party_name (struct ast_party_name *name) |
static struct ast_json * | json_party_number (struct ast_party_number *number) |
static struct ast_json * | json_party_subaddress (struct ast_party_subaddress *subaddress) |
static void | json_payload_destructor (void *obj) |
static size_t | json_utf8_check_first (char byte) |
static size_t | json_utf8_check_full (const char *str, size_t len) |
static void | parse_error (struct ast_json_error *error, const char *text, const char *source) |
static int | write_to_ast_str (const char *buffer, size_t size, void *data) |
JSON abstraction layer.
This is a very thin wrapper around the Jansson API. For more details on it, see its docs at http://www.digip.org/jansson/doc/2.11/apiref.html.
Definition in file json.c.
Append to an array.
array | JSON array to modify. |
value | New JSON value to store at the end of array. |
0 | on success. |
-1 | on error. |
Definition at line 378 of file json.c.
References array(), and value.
Referenced by add_format_information_cb(), app_to_json(), append_json(), append_sound_cb(), ast_ari_bridges_list(), ast_ari_channels_list(), ast_ari_endpoints_list(), ast_ari_endpoints_list_by_tech(), ast_ari_recordings_list_stored(), ast_bucket_json(), ast_endpoint_snapshot_to_json(), AST_TEST_DEFINE(), conf_send_event_to_participants(), container_to_json_array(), device_to_json_cb(), generate_filenames_json(), json_array_from_list(), process_log_list(), process_module_list(), report_receive_fax_status(), return_sorcery_object(), rtcp_report_to_json(), s_to_json(), send_start_msg_snapshots(), stasis_app_device_states_to_json(), stasis_app_exec(), stasis_app_mailboxes_to_json(), test_handler(), and units_to_json().
int ast_json_array_clear | ( | struct ast_json * | array | ) |
Remove all elements from an array.
array | JSON array to clear. |
0 | on success. |
-1 | on error. |
Definition at line 390 of file json.c.
References array().
Referenced by AST_TEST_DEFINE().
struct ast_json * ast_json_array_create | ( | void | ) |
Create a empty JSON array.
NULL | on error. |
Definition at line 362 of file json.c.
Referenced by app_data_create(), ast_ari_applications_list(), ast_ari_asterisk_list_log_channels(), ast_ari_asterisk_list_modules(), ast_ari_bridges_list(), ast_ari_channels_list(), ast_ari_endpoints_list(), ast_ari_endpoints_list_by_tech(), ast_ari_recordings_list_stored(), ast_ari_sounds_list(), ast_bucket_json(), AST_TEST_DEFINE(), conf_send_event_to_participants(), container_to_json_array(), devices_to_json(), generate_filenames_json(), json_array_from_list(), pack_payload(), report_receive_fax_status(), return_sorcery_object(), rtcp_report_to_json(), s_to_json(), stasis_app_device_states_to_json(), stasis_app_event_filter_to_json(), stasis_app_mailboxes_to_json(), and units_to_json().
Append all elements from tail to array.
The tail argument is not changed, so ast_json_unref() it when you are done with it.
array | JSON array to modify. |
tail | JSON array with contents to append to array. |
0 | on success. |
-1 | on error. |
Definition at line 394 of file json.c.
References array().
Referenced by AST_TEST_DEFINE().
Get an element from an array.
The returned element is a borrowed reference; use ast_json_ref() to safely keep a pointer to it.
array | JSON array. |
index | Zero-based index into array. |
NULL | if array not an array. if index is out of bounds. |
Definition at line 370 of file json.c.
References array().
Referenced by app_event_filter_matched(), app_event_filter_set(), ast_ari_applications_subscribe_parse_body(), ast_ari_applications_unsubscribe_parse_body(), ast_ari_asterisk_get_info_parse_body(), ast_ari_asterisk_update_object(), ast_ari_bridges_add_channel_parse_body(), ast_ari_bridges_play_parse_body(), ast_ari_bridges_play_with_id_parse_body(), ast_ari_bridges_remove_channel_parse_body(), ast_ari_channels_play_parse_body(), ast_ari_channels_play_with_id_parse_body(), ast_ari_events_user_event_parse_body(), ast_ari_validate_list(), AST_TEST_DEFINE(), channel_fax_cb(), handle_response_setup(), handle_results(), json_decode_read(), manager_json_to_ast_str(), parse_node(), and speech_test_server_get().
Insert into an array.
array | JSON array to modify. |
index | Zero-based index into array. |
value | New JSON value to store in array at index. |
0 | on success. |
-1 | on error. |
Definition at line 382 of file json.c.
References array(), and value.
Referenced by AST_TEST_DEFINE().
int ast_json_array_remove | ( | struct ast_json * | array, |
size_t | index | ||
) |
Remove an element from an array.
array | JSON array to modify. |
index | Zero-based index into array. |
0 | on success. |
-1 | on error. |
Definition at line 386 of file json.c.
References array().
Referenced by AST_TEST_DEFINE().
Change an element in an array.
array | JSON array to modify. |
index | Zero-based index into array. |
value | New JSON value to store in array at index. |
0 | on success. |
-1 | on error. |
Definition at line 374 of file json.c.
References array(), and value.
Referenced by AST_TEST_DEFINE().
size_t ast_json_array_size | ( | const struct ast_json * | array | ) |
Get the size of a JSON array.
array | JSON array. |
0 | if array is not a JSON array. |
Definition at line 366 of file json.c.
References array().
Referenced by app_event_filter_matched(), app_event_filter_set(), ast_ari_applications_list(), ast_ari_applications_subscribe_parse_body(), ast_ari_applications_unsubscribe_parse_body(), ast_ari_asterisk_get_info_parse_body(), ast_ari_asterisk_update_object(), ast_ari_bridges_add_channel_parse_body(), ast_ari_bridges_play_parse_body(), ast_ari_bridges_play_with_id_parse_body(), ast_ari_bridges_remove_channel_parse_body(), ast_ari_channels_play_parse_body(), ast_ari_channels_play_with_id_parse_body(), ast_ari_events_user_event_parse_body(), ast_ari_sounds_list(), ast_ari_validate_list(), AST_TEST_DEFINE(), channel_fax_cb(), create_sound_blob(), handle_response_setup(), handle_results(), manager_json_to_ast_str(), and parse_node().
struct ast_json * ast_json_boolean | ( | int | value | ) |
Get the JSON boolean corresponding to value.
Definition at line 243 of file json.c.
References value.
Referenced by AST_TEST_DEFINE(), attended_transfer_to_json(), and blind_transfer_to_json().
Construct a JSON object from a ast_var_t
list.
channelvars | The list of ast_var_t to represent as JSON |
Definition at line 864 of file json.c.
References ast_json_object_create(), ast_json_object_set(), ast_json_string_create(), AST_LIST_TRAVERSE, ast_var_t::entries, and var.
Referenced by ast_channel_snapshot_to_json(), external_media_audiosocket_tcp(), and external_media_rtp_udp().
Copy a JSON value, but not its children.
If value is a JSON object or array, its children are shared with the returned copy.
value | JSON value to copy. |
NULL | on error. |
Definition at line 637 of file json.c.
References value.
Referenced by AST_TEST_DEFINE(), channel_blob_to_json(), channel_to_json(), and test_handler().
Copy a JSON value, and its children.
If value is a JSON object or array, they are also copied.
value | JSON value to copy. |
NULL | on error. |
Definition at line 641 of file json.c.
References value.
Referenced by AST_TEST_DEFINE().
struct ast_json * ast_json_dialplan_cep | ( | const char * | context, |
const char * | exten, | ||
int | priority | ||
) |
Construct a context/exten/priority as JSON.
If a NULL
is passed for context
or exten
, or -1 for priority
, the fields is set to ast_json_null().
context | Context name. |
exten | Extension. |
priority | Dialplan priority. |
context
, exten
and priority
fields Definition at line 665 of file json.c.
References ast_json_dialplan_cep_app(), voicemailpwcheck::context, and priority.
struct ast_json * ast_json_dialplan_cep_app | ( | const char * | context, |
const char * | exten, | ||
int | priority, | ||
const char * | app_name, | ||
const char * | app_data | ||
) |
Construct a context/exten/priority/application/application_data as JSON.
If a NULL
is passed for context
or exten
or app_name
or app_data
, or -1 for priority
, the fields is set to ast_json_null().
context | Context name. |
exten | Extension. |
priority | Dialplan priority. |
app_name | Application name. |
app_data | Application argument. |
context
, exten
and priority
app_name
app_data
fields Definition at line 653 of file json.c.
References app_name(), ast_json_integer_create(), ast_json_null(), ast_json_pack(), voicemailpwcheck::context, and priority.
Referenced by ast_channel_snapshot_to_json(), ast_json_dialplan_cep(), and AST_TEST_DEFINE().
int ast_json_dump_file_format | ( | struct ast_json * | root, |
FILE * | output, | ||
enum ast_json_encoding_format | format | ||
) |
Encode a JSON value to a FILE
.
root | JSON value. |
output | File to write JSON encoding to. |
format | encoding format type. |
0 | on success. |
-1 | on error. The contents of output are undefined. |
Definition at line 526 of file json.c.
References dump_flags().
int ast_json_dump_new_file_format | ( | struct ast_json * | root, |
const char * | path, | ||
enum ast_json_encoding_format | format | ||
) |
Encode a JSON value to a file at the given location.
root | JSON value. |
path | Path to file to write JSON encoding to. |
format | encoding format type. |
0 | on success. |
-1 | on error. The contents of output are undefined. |
Definition at line 533 of file json.c.
References dump_flags().
int ast_json_dump_str_format | ( | struct ast_json * | root, |
struct ast_str ** | dst, | ||
enum ast_json_encoding_format | format | ||
) |
Encode a JSON value to an ast_str.
If dst is too small, it will be grown as needed.
root | JSON value. |
dst | ast_str to store JSON encoding. |
format | encoding format type. |
0 | on success. |
-1 | on error. The contents of dst are undefined. |
Definition at line 520 of file json.c.
References dump_flags(), and write_to_ast_str().
Referenced by ast_ari_callback().
char * ast_json_dump_string_format | ( | struct ast_json * | root, |
enum ast_json_encoding_format | format | ||
) |
Encode a JSON value to a string.
Returned string must be freed by calling ast_json_free().
root | JSON value. |
format | encoding format type. |
NULL | on error. |
Definition at line 484 of file json.c.
References dump_flags().
Referenced by ast_ari_callback(), ast_ari_websocket_session_write(), pack_payload(), send_message(), and stasis_app_message_handler().
Compare two JSON objects.
Two JSON objects are equal if they are of the same type, and their contents are equal.
lhs | Value to compare. |
rhs | Other value to compare. |
True | (non-zero) if lhs and rhs are equal. |
False | (zero) if they are not. |
Definition at line 357 of file json.c.
Referenced by AST_TEST_DEFINE(), and test_name_number().
struct ast_json * ast_json_false | ( | void | ) |
Get the JSON false value.
The returned value is a singleton, and does not need to be ast_json_unref()'ed.
Definition at line 238 of file json.c.
Referenced by AST_TEST_DEFINE().
void ast_json_free | ( | void * | p | ) |
Asterisk's custom JSON allocator. Exposed for use by unit tests.
Definition at line 52 of file json.c.
References ast_free.
Referenced by ast_ari_callback(), ast_ari_events_event_websocket_ws_attempted_cb(), ast_ari_events_event_websocket_ws_established_cb(), ast_ari_websocket_session_write(), ast_cel_create_event_with_time(), ast_json_reset_alloc_funcs(), ast_stir_shaken_vs_verify(), asterisk_publication_send_refresh(), asterisk_publisher_devstate_cb(), asterisk_publisher_mwistate_cb(), beanstalk_put(), cel_bs_put(), format_log_json(), json_debug_free(), pack_payload(), parse_node(), persistence_generator_data_struct2str(), rtcp_message_handler(), send_message(), sorcery_astdb_create(), and stasis_app_message_handler().
int ast_json_init | ( | void | ) |
Initialize the JSON library.
Definition at line 726 of file json.c.
References ast_json_reset_alloc_funcs(), ast_log, LOG_ERROR, and NULL.
Referenced by asterisk_daemon().
struct ast_json * ast_json_integer_create | ( | intmax_t | value | ) |
Create a JSON integer.
value | Value of the new JSON integer. |
NULL | on error. |
Definition at line 327 of file json.c.
References value.
Referenced by alloc_security_event_json_object(), ast_ari_asterisk_get_info(), ast_endpoint_snapshot_to_json(), ast_json_dialplan_cep_app(), ast_rtp_convert_stats_json(), AST_TEST_DEFINE(), dialog_info_generate_body_content(), identify_module(), meetme_stasis_generate_msg(), pack_payload(), and stasis_app_recording_to_json().
intmax_t ast_json_integer_get | ( | const struct ast_json * | integer | ) |
Get the value from a JSON integer.
integer | JSON integer. |
0 | if integer is not a JSON integer. |
Definition at line 332 of file json.c.
Referenced by agent_logoff_to_ami(), ast_ari_bridges_play_parse_body(), ast_ari_bridges_play_with_id_parse_body(), ast_ari_bridges_record_parse_body(), ast_ari_channels_continue_in_dialplan_parse_body(), ast_ari_channels_dial_parse_body(), ast_ari_channels_originate_parse_body(), ast_ari_channels_originate_with_id_parse_body(), ast_ari_channels_play_parse_body(), ast_ari_channels_play_with_id_parse_body(), ast_ari_channels_record_parse_body(), ast_ari_channels_send_dtmf_parse_body(), ast_ari_mailboxes_update_parse_body(), AST_TEST_DEFINE(), asterisk_publication_devicestate(), asterisk_publication_mailboxstate(), cc_available_to_ami(), cc_callerrecalling_to_ami(), cc_callerstartmonitoring_to_ami(), cc_callerstopmonitoring_to_ami(), cc_failure_to_ami(), cc_monitorfailed_to_ami(), cc_offertimerstart_to_ami(), cc_recallcomplete_to_ami(), cc_requestacknowledged_to_ami(), cc_requested_to_ami(), cel_generic_cb(), channel_dtmf_end_cb(), channel_hangup_request_cb(), check_range(), dahdichannel_to_ami(), dialog_info_generate_body_content(), dtmf_end_to_json(), handle_local_optimization_begin(), handle_local_optimization_end(), local_message_to_ami(), manager_generic_msg_cb(), manager_json_value_str_append(), meetme_stasis_cb(), parse_node(), queue_agent_cb(), security_event_stasis_cb(), security_event_to_ami_blob(), and talking_stop_to_ami().
int ast_json_integer_set | ( | struct ast_json * | integer, |
intmax_t | value | ||
) |
Set the value of a JSON integer.
integer | JSON integer to modify. |
value | New value for integer. |
0 | on success. |
-1 | on error. |
Definition at line 337 of file json.c.
References value.
Referenced by AST_TEST_DEFINE().
struct ast_json * ast_json_ipaddr | ( | const struct ast_sockaddr * | addr, |
enum ast_transport | transport_type | ||
) |
Construct an IP address as JSON.
XXX some comments describing the need for this here
addr | ast_sockaddr to encode |
transport_type | ast_transport to include in the address string if any. Should just be one. |
NULL | on error. |
Definition at line 682 of file json.c.
References ast_json_string_create(), ast_sockaddr_is_ipv4(), ast_sockaddr_is_ipv4_mapped(), ast_sockaddr_stringify_addr(), ast_sockaddr_stringify_port(), ast_str_alloca, ast_str_append(), ast_str_buffer(), ast_str_set(), AST_TRANSPORT_TCP, AST_TRANSPORT_TLS, AST_TRANSPORT_UDP, AST_TRANSPORT_WS, AST_TRANSPORT_WSS, and NULL.
Referenced by add_ip_json_object().
int ast_json_is_array | ( | const struct ast_json * | value | ) |
int ast_json_is_false | ( | const struct ast_json * | value | ) |
Check if value is JSON false.
True | (non-zero) if value == ast_json_false(). |
False | (zero) otherwise. |
Definition at line 268 of file json.c.
Referenced by AST_TEST_DEFINE().
int ast_json_is_null | ( | const struct ast_json * | value | ) |
Check if value is JSON null.
True | (non-zero) if value == ast_json_false(). |
False | (zero) otherwise. |
Definition at line 273 of file json.c.
Referenced by aoc_publish_blob(), ast_ari_callback(), ast_manager_str_from_json_object(), AST_TEST_DEFINE(), and channel_blob_to_json().
int ast_json_is_object | ( | const struct ast_json * | value | ) |
Check if value is JSON object.
True | (non-zero) if value == ast_json_object(). |
False | (zero) otherwise.. |
Definition at line 258 of file json.c.
Referenced by json_decode_read().
int ast_json_is_true | ( | const struct ast_json * | value | ) |
Check if value is JSON true.
True | (non-zero) if value == ast_json_true(). |
False | (zero) otherwise.. |
Definition at line 263 of file json.c.
Referenced by ast_ari_bridges_add_channel_parse_body(), ast_ari_bridges_record_parse_body(), ast_ari_channels_record_parse_body(), ast_ari_endpoints_refer_parse_body(), ast_ari_endpoints_refer_to_endpoint_parse_body(), AST_TEST_DEFINE(), channel_hangup_request_cb(), channel_mixmonitor_mute_cb(), get_bool_header(), local_message_to_ami(), and parse_node().
struct ast_json * ast_json_load_buf | ( | const char * | buffer, |
size_t | buflen, | ||
struct ast_json_error * | error | ||
) |
Parse buffer with known length into a JSON object or array.
buffer | Buffer to parse. | |
buflen | Length of buffer. | |
[out] | error | Filled with information on error. |
NULL | on error. |
Definition at line 585 of file json.c.
References copy_error(), and error().
Referenced by ast_ari_websocket_session_read(), ast_http_get_json(), AST_TEST_DEFINE(), asterisk_publication_devicestate_state_change(), asterisk_publication_mwi_state_change(), message_json_deserialize(), and speech_test_server_handle_request().
struct ast_json * ast_json_load_file | ( | FILE * | input, |
struct ast_json_error * | error | ||
) |
Parse a FILE
into JSON object or array.
input | FILE to parse. | |
[out] | error | Filled with information on error. |
NULL | on error. |
Definition at line 592 of file json.c.
References copy_error(), error(), input(), NULL, and parse_error().
Referenced by AST_TEST_DEFINE().
struct ast_json * ast_json_load_new_file | ( | const char * | path, |
struct ast_json_error * | error | ||
) |
Parse file at path into JSON object or array.
path | Path of file to parse. | |
[out] | error | Filled with information on error. |
NULL | on error. |
Definition at line 604 of file json.c.
References copy_error(), and error().
Referenced by ast_ari_get_docs(), and AST_TEST_DEFINE().
struct ast_json * ast_json_load_str | ( | const struct ast_str * | input, |
struct ast_json_error * | error | ||
) |
Parse ast_str into a JSON object or array.
input | ast_str to parse. | |
[out] | error | Filled with information on error. |
NULL | on error. |
Definition at line 580 of file json.c.
References ast_json_load_string(), ast_str_buffer(), error(), and input().
Referenced by AST_TEST_DEFINE(), and json_decode_read().
struct ast_json * ast_json_load_string | ( | const char * | input, |
struct ast_json_error * | error | ||
) |
Parse null terminated string into a JSON object or array.
input | String to parse. | |
[out] | error | Filled with information on error. |
NULL | on error. |
Definition at line 567 of file json.c.
References copy_error(), error(), input(), NULL, and parse_error().
Referenced by ast_json_load_str(), ast_stir_shaken_vs_verify(), AST_TEST_DEFINE(), fetch_access_token(), fetch_google_access_token(), persistence_generator_data_str2struct(), sorcery_astdb_retrieve_fields_common(), sorcery_astdb_retrieve_id(), sorcery_astdb_retrieve_prefix(), and sorcery_astdb_retrieve_regex().
void * ast_json_malloc | ( | size_t | size | ) |
Asterisk's custom JSON allocator. Exposed for use by unit tests.
Definition at line 47 of file json.c.
References ast_malloc.
Referenced by ast_json_reset_alloc_funcs(), and json_debug_malloc().
struct ast_json * ast_json_name_number | ( | const char * | name, |
const char * | number | ||
) |
Common JSON rendering functions for common 'objects'.
Simple name/number pair.
name | Name |
number | Number |
NULL | on error (non-UTF8 characters, NULL inputs, etc.) |
Definition at line 646 of file json.c.
References ast_json_pack(), AST_JSON_UTF8_VALIDATE, and name.
Referenced by ast_channel_snapshot_to_json(), and test_name_number().
struct ast_json * ast_json_null | ( | void | ) |
Get the JSON null value.
The returned value is a singleton, and does not need to be ast_json_unref()'ed.
Definition at line 248 of file json.c.
Referenced by association_to_json(), ast_ari_callback(), ast_ari_recordings_get_stored_file(), ast_ari_response_accepted(), ast_ari_response_no_content(), ast_channel_publish_blob(), ast_channel_publish_cached_blob(), ast_endpoint_blob_create(), ast_json_dialplan_cep_app(), AST_TEST_DEFINE(), create_channel_blob_message(), local_optimization_finished_cb(), local_optimization_started_cb(), publish_chanspy_message(), rtcp_report_to_json(), s_to_json(), send_call_pickup_stasis_message(), send_message(), send_refer(), and units_to_json().
int ast_json_object_clear | ( | struct ast_json * | object | ) |
Delete all elements from a JSON object.
object | JSON object to clear. |
0 | on success. |
-1 | on error. |
Definition at line 422 of file json.c.
Referenced by AST_TEST_DEFINE().
struct ast_json * ast_json_object_create | ( | void | ) |
Create a new JSON object.
NULL | on error. |
Definition at line 399 of file json.c.
Referenced by alloc_security_event_json_object(), ast_ari_asterisk_get_info(), ast_ari_asterisk_get_module(), ast_bucket_file_json(), ast_json_channel_vars(), ast_json_object_create_vars(), ast_rtp_convert_stats_json(), ast_sip_subscription_set_persistence_data(), ast_sorcery_objectset_json_create(), AST_TEST_DEFINE(), channel_blob_to_json(), custom_fields_to_params(), message_json_construct1(), msg_to_json(), multi_user_event_to_json(), pack_payload(), peerstatus_to_json(), publish_acl_change(), stun_monitor_request(), and units_to_json().
struct ast_json * ast_json_object_create_vars | ( | const struct ast_variable * | variables, |
const char * | excludes | ||
) |
Create a new JSON object using the given variables.
variables | A list of Asterisk variables |
excludes | Comma separated string of variable names to exclude (optional) |
NULL | on error. |
Definition at line 877 of file json.c.
References ast_in_delimited_string(), ast_json_object_create(), ast_json_object_set(), ast_json_string_create(), ast_variable::name, ast_variable::next, NULL, and ast_variable::value.
Referenced by AST_TEST_DEFINE().
int ast_json_object_del | ( | struct ast_json * | object, |
const char * | key | ||
) |
Delete a field from a JSON object.
object | JSON object to modify. |
key | Key of field to delete. |
0 | on success, or -1 if key does not exist. |
Definition at line 418 of file json.c.
Referenced by ast_ari_get_docs(), AST_TEST_DEFINE(), bridge_to_json(), and channel_to_json().
Get a field from a JSON object.
The returned element is a borrowed reference; use ast_json_ref() to safely keep a pointer to it.
object | JSON object. |
key | Key of field to look up. |
NULL | on error. |
Definition at line 407 of file json.c.
References NULL.
Referenced by agent_login_to_ami(), agent_logoff_to_ami(), allocate_subscription(), app_event_filter_set(), app_send(), app_to_json(), append_event_str_single(), append_json_single(), assign_uuid(), ast_ari_applications_subscribe_parse_body(), ast_ari_applications_unsubscribe_parse_body(), ast_ari_asterisk_add_log_parse_body(), ast_ari_asterisk_get_global_var_parse_body(), ast_ari_asterisk_get_info_parse_body(), ast_ari_asterisk_set_global_var_parse_body(), ast_ari_asterisk_update_object(), ast_ari_bridges_add_channel_parse_body(), ast_ari_bridges_create_parse_body(), ast_ari_bridges_create_with_id_parse_body(), ast_ari_bridges_play_parse_body(), ast_ari_bridges_play_with_id_parse_body(), ast_ari_bridges_record_parse_body(), ast_ari_bridges_remove_channel_parse_body(), ast_ari_bridges_start_moh_parse_body(), ast_ari_callback(), ast_ari_channels_continue_in_dialplan_parse_body(), ast_ari_channels_create(), ast_ari_channels_create_parse_body(), ast_ari_channels_dial_parse_body(), ast_ari_channels_external_media(), ast_ari_channels_external_media_parse_body(), ast_ari_channels_get_channel_var_parse_body(), ast_ari_channels_hangup_parse_body(), ast_ari_channels_move_parse_body(), ast_ari_channels_mute_parse_body(), ast_ari_channels_originate(), ast_ari_channels_originate_parse_body(), ast_ari_channels_originate_with_id(), ast_ari_channels_originate_with_id_parse_body(), ast_ari_channels_play_parse_body(), ast_ari_channels_play_with_id_parse_body(), ast_ari_channels_record_parse_body(), ast_ari_channels_redirect_parse_body(), ast_ari_channels_send_dtmf_parse_body(), ast_ari_channels_set_channel_var_parse_body(), ast_ari_channels_snoop_channel_parse_body(), ast_ari_channels_snoop_channel_with_id_parse_body(), ast_ari_channels_start_moh_parse_body(), ast_ari_channels_unmute_parse_body(), ast_ari_device_states_update_parse_body(), ast_ari_endpoints_refer_parse_body(), ast_ari_endpoints_refer_to_endpoint_parse_body(), ast_ari_endpoints_send_message(), ast_ari_endpoints_send_message_parse_body(), ast_ari_endpoints_send_message_to_endpoint(), ast_ari_endpoints_send_message_to_endpoint_parse_body(), ast_ari_events_user_event(), ast_ari_events_user_event_parse_body(), ast_ari_get_docs(), ast_ari_mailboxes_update_parse_body(), ast_ari_playbacks_control_parse_body(), ast_ari_recordings_copy_stored_parse_body(), ast_ari_sounds_list_parse_body(), ast_ari_validate_event(), ast_ari_validate_message(), ast_endpoint_snapshot_to_json(), ast_stir_shaken_vs_verify(), AST_TEST_DEFINE(), asterisk_publication_devicestate(), asterisk_publication_devicestate_state_change(), asterisk_publication_mailboxstate(), asterisk_publication_mwi_state_change(), cc_available_to_ami(), cc_callerrecalling_to_ami(), cc_callerstartmonitoring_to_ami(), cc_callerstopmonitoring_to_ami(), cc_failure_to_ami(), cc_monitorfailed_to_ami(), cc_offertimerstart_to_ami(), cc_recallcomplete_to_ami(), cc_requestacknowledged_to_ami(), cc_requested_to_ami(), cel_generic_cb(), channel_dial_cb(), channel_dtmf_begin_cb(), channel_dtmf_end_cb(), channel_enter_cb(), channel_fax_cb(), channel_hangup_handler_cb(), channel_hangup_request_cb(), channel_hold_cb(), channel_mixmonitor_mute_cb(), channel_moh_start_cb(), conf_send_event_to_participants(), confbridge_publish_manager_event(), confbridge_talking_cb(), contactstatus_to_ami(), contactstatus_to_json(), create_sound_blob(), dahdichannel_to_ami(), dial_to_json(), dtmf_end_to_json(), fetch_access_token(), fetch_google_access_token(), get_blob_variable(), get_bool_header(), handle_dial_message(), handle_local_optimization_begin(), handle_local_optimization_end(), handle_masquerade(), handle_request_set(), handle_response_get(), handle_response_setup(), handler(), hold_to_json(), json_decode_read(), local_message_to_ami(), manager_generic_msg_cb(), meetme_stasis_cb(), multi_user_event_to_ami(), multi_user_event_to_json(), mwi_app_event_cb(), mwi_startup_event_cb(), parse_node(), parse_refer_json(), peerstatus_to_ami(), playback_to_json(), queue_agent_cb(), recording_to_json(), rtcp_message_handler(), rtcp_report_to_ami(), security_event_stasis_cb(), security_event_to_ami_blob(), send_start_msg_snapshots(), speech_test_server_get(), speech_test_server_set(), speech_test_server_setup(), startup_event_cb(), stasis_app_exec(), stasis_app_message_handler(), stasis_end_to_json(), stasis_start_to_json(), subscription_persistence_event_cb(), system_registry_to_ami(), talking_stop_to_ami(), and varset_to_ami().
struct ast_json_iter * ast_json_object_iter | ( | struct ast_json * | object | ) |
Get an iterator pointing to the first field in a JSON object.
The order of the fields in an object are not specified. However, iterating forward from this iterator will cover all fields in object. Adding or removing fields from object may invalidate its iterators.
object | JSON object. |
NULL | object is empty. on error. |
Definition at line 439 of file json.c.
Referenced by ast_ari_validate_application(), ast_ari_validate_application_move_failed(), ast_ari_validate_application_replaced(), ast_ari_validate_asterisk_info(), ast_ari_validate_asterisk_ping(), ast_ari_validate_bridge(), ast_ari_validate_bridge_attended_transfer(), ast_ari_validate_bridge_blind_transfer(), ast_ari_validate_bridge_created(), ast_ari_validate_bridge_destroyed(), ast_ari_validate_bridge_merged(), ast_ari_validate_bridge_video_source_changed(), ast_ari_validate_build_info(), ast_ari_validate_caller_id(), ast_ari_validate_channel(), ast_ari_validate_channel_caller_id(), ast_ari_validate_channel_connected_line(), ast_ari_validate_channel_created(), ast_ari_validate_channel_destroyed(), ast_ari_validate_channel_dialplan(), ast_ari_validate_channel_dtmf_received(), ast_ari_validate_channel_entered_bridge(), ast_ari_validate_channel_hangup_request(), ast_ari_validate_channel_hold(), ast_ari_validate_channel_left_bridge(), ast_ari_validate_channel_state_change(), ast_ari_validate_channel_talking_finished(), ast_ari_validate_channel_talking_started(), ast_ari_validate_channel_tone_detected(), ast_ari_validate_channel_unhold(), ast_ari_validate_channel_userevent(), ast_ari_validate_channel_varset(), ast_ari_validate_config_info(), ast_ari_validate_config_tuple(), ast_ari_validate_contact_info(), ast_ari_validate_contact_status_change(), ast_ari_validate_device_state(), ast_ari_validate_device_state_changed(), ast_ari_validate_dial(), ast_ari_validate_dialed(), ast_ari_validate_dialplan_cep(), ast_ari_validate_endpoint(), ast_ari_validate_endpoint_state_change(), ast_ari_validate_event(), ast_ari_validate_format_lang_pair(), ast_ari_validate_live_recording(), ast_ari_validate_log_channel(), ast_ari_validate_mailbox(), ast_ari_validate_message(), ast_ari_validate_missing_params(), ast_ari_validate_module(), ast_ari_validate_peer(), ast_ari_validate_peer_status_change(), ast_ari_validate_playback(), ast_ari_validate_playback_continuing(), ast_ari_validate_playback_finished(), ast_ari_validate_playback_started(), ast_ari_validate_recording_failed(), ast_ari_validate_recording_finished(), ast_ari_validate_recording_started(), ast_ari_validate_rtpstat(), ast_ari_validate_set_id(), ast_ari_validate_sound(), ast_ari_validate_stasis_end(), ast_ari_validate_stasis_start(), ast_ari_validate_status_info(), ast_ari_validate_stored_recording(), ast_ari_validate_system_info(), ast_ari_validate_text_message(), ast_ari_validate_text_message_received(), ast_ari_validate_variable(), ast_json_to_ast_variables(), AST_TEST_DEFINE(), handle_request_set(), handle_response_get(), and manager_json_to_ast_str().
struct ast_json_iter * ast_json_object_iter_at | ( | struct ast_json * | object, |
const char * | key | ||
) |
Get an iterator pointing to a specified key in object.
Iterating forward from this iterator may not to cover all elements in object.
object | JSON object to iterate. |
key | Key of field to lookup. |
NULL | if key does not exist. on error. |
Definition at line 443 of file json.c.
Referenced by AST_TEST_DEFINE(), message_json_is_request(), message_json_is_response(), and message_json_name().
const char * ast_json_object_iter_key | ( | struct ast_json_iter * | iter | ) |
Get the key from an iterator.
iter | JSON object iterator. |
Definition at line 451 of file json.c.
Referenced by ast_ari_validate_application(), ast_ari_validate_application_move_failed(), ast_ari_validate_application_replaced(), ast_ari_validate_asterisk_info(), ast_ari_validate_asterisk_ping(), ast_ari_validate_bridge(), ast_ari_validate_bridge_attended_transfer(), ast_ari_validate_bridge_blind_transfer(), ast_ari_validate_bridge_created(), ast_ari_validate_bridge_destroyed(), ast_ari_validate_bridge_merged(), ast_ari_validate_bridge_video_source_changed(), ast_ari_validate_build_info(), ast_ari_validate_caller_id(), ast_ari_validate_channel(), ast_ari_validate_channel_caller_id(), ast_ari_validate_channel_connected_line(), ast_ari_validate_channel_created(), ast_ari_validate_channel_destroyed(), ast_ari_validate_channel_dialplan(), ast_ari_validate_channel_dtmf_received(), ast_ari_validate_channel_entered_bridge(), ast_ari_validate_channel_hangup_request(), ast_ari_validate_channel_hold(), ast_ari_validate_channel_left_bridge(), ast_ari_validate_channel_state_change(), ast_ari_validate_channel_talking_finished(), ast_ari_validate_channel_talking_started(), ast_ari_validate_channel_tone_detected(), ast_ari_validate_channel_unhold(), ast_ari_validate_channel_userevent(), ast_ari_validate_channel_varset(), ast_ari_validate_config_info(), ast_ari_validate_config_tuple(), ast_ari_validate_contact_info(), ast_ari_validate_contact_status_change(), ast_ari_validate_device_state(), ast_ari_validate_device_state_changed(), ast_ari_validate_dial(), ast_ari_validate_dialed(), ast_ari_validate_dialplan_cep(), ast_ari_validate_endpoint(), ast_ari_validate_endpoint_state_change(), ast_ari_validate_event(), ast_ari_validate_format_lang_pair(), ast_ari_validate_live_recording(), ast_ari_validate_log_channel(), ast_ari_validate_mailbox(), ast_ari_validate_message(), ast_ari_validate_missing_params(), ast_ari_validate_module(), ast_ari_validate_peer(), ast_ari_validate_peer_status_change(), ast_ari_validate_playback(), ast_ari_validate_playback_continuing(), ast_ari_validate_playback_finished(), ast_ari_validate_playback_started(), ast_ari_validate_recording_failed(), ast_ari_validate_recording_finished(), ast_ari_validate_recording_started(), ast_ari_validate_rtpstat(), ast_ari_validate_set_id(), ast_ari_validate_sound(), ast_ari_validate_stasis_end(), ast_ari_validate_stasis_start(), ast_ari_validate_status_info(), ast_ari_validate_stored_recording(), ast_ari_validate_system_info(), ast_ari_validate_text_message(), ast_ari_validate_text_message_received(), ast_ari_validate_variable(), ast_json_to_ast_variables(), AST_TEST_DEFINE(), handle_request_set(), handle_response_get(), handle_setting(), and manager_json_to_ast_str().
struct ast_json_iter * ast_json_object_iter_next | ( | struct ast_json * | object, |
struct ast_json_iter * | iter | ||
) |
Get the next iterator.
object | JSON object iter was obtained from. |
iter | JSON object iterator. |
NULL | if iter was the last field. |
Definition at line 447 of file json.c.
Referenced by ast_ari_validate_application(), ast_ari_validate_application_move_failed(), ast_ari_validate_application_replaced(), ast_ari_validate_asterisk_info(), ast_ari_validate_asterisk_ping(), ast_ari_validate_bridge(), ast_ari_validate_bridge_attended_transfer(), ast_ari_validate_bridge_blind_transfer(), ast_ari_validate_bridge_created(), ast_ari_validate_bridge_destroyed(), ast_ari_validate_bridge_merged(), ast_ari_validate_bridge_video_source_changed(), ast_ari_validate_build_info(), ast_ari_validate_caller_id(), ast_ari_validate_channel(), ast_ari_validate_channel_caller_id(), ast_ari_validate_channel_connected_line(), ast_ari_validate_channel_created(), ast_ari_validate_channel_destroyed(), ast_ari_validate_channel_dialplan(), ast_ari_validate_channel_dtmf_received(), ast_ari_validate_channel_entered_bridge(), ast_ari_validate_channel_hangup_request(), ast_ari_validate_channel_hold(), ast_ari_validate_channel_left_bridge(), ast_ari_validate_channel_state_change(), ast_ari_validate_channel_talking_finished(), ast_ari_validate_channel_talking_started(), ast_ari_validate_channel_tone_detected(), ast_ari_validate_channel_unhold(), ast_ari_validate_channel_userevent(), ast_ari_validate_channel_varset(), ast_ari_validate_config_info(), ast_ari_validate_config_tuple(), ast_ari_validate_contact_info(), ast_ari_validate_contact_status_change(), ast_ari_validate_device_state(), ast_ari_validate_device_state_changed(), ast_ari_validate_dial(), ast_ari_validate_dialed(), ast_ari_validate_dialplan_cep(), ast_ari_validate_endpoint(), ast_ari_validate_endpoint_state_change(), ast_ari_validate_event(), ast_ari_validate_format_lang_pair(), ast_ari_validate_live_recording(), ast_ari_validate_log_channel(), ast_ari_validate_mailbox(), ast_ari_validate_message(), ast_ari_validate_missing_params(), ast_ari_validate_module(), ast_ari_validate_peer(), ast_ari_validate_peer_status_change(), ast_ari_validate_playback(), ast_ari_validate_playback_continuing(), ast_ari_validate_playback_finished(), ast_ari_validate_playback_started(), ast_ari_validate_recording_failed(), ast_ari_validate_recording_finished(), ast_ari_validate_recording_started(), ast_ari_validate_rtpstat(), ast_ari_validate_set_id(), ast_ari_validate_sound(), ast_ari_validate_stasis_end(), ast_ari_validate_stasis_start(), ast_ari_validate_status_info(), ast_ari_validate_stored_recording(), ast_ari_validate_system_info(), ast_ari_validate_text_message(), ast_ari_validate_text_message_received(), ast_ari_validate_variable(), ast_json_to_ast_variables(), AST_TEST_DEFINE(), and manager_json_to_ast_str().
int ast_json_object_iter_set | ( | struct ast_json * | object, |
struct ast_json_iter * | iter, | ||
struct ast_json * | value | ||
) |
Set the value of the field pointed to by an iterator.
value
reference even if it returns error; use ast_json_ref() to safely keep a pointer to it.object | JSON object iter was obtained from. |
iter | JSON object iterator. |
value | JSON value to store in iter's field. |
0 | on success. |
-1 | on error. |
Definition at line 459 of file json.c.
References value.
Referenced by AST_TEST_DEFINE().
struct ast_json * ast_json_object_iter_value | ( | struct ast_json_iter * | iter | ) |
Get the value from an iterator.
The returned element is a borrowed reference; use ast_json_ref() to safely keep a pointer to it.
iter | JSON object iterator. |
Definition at line 455 of file json.c.
Referenced by ast_ari_validate_application(), ast_ari_validate_application_move_failed(), ast_ari_validate_application_replaced(), ast_ari_validate_asterisk_info(), ast_ari_validate_asterisk_ping(), ast_ari_validate_bridge(), ast_ari_validate_bridge_attended_transfer(), ast_ari_validate_bridge_blind_transfer(), ast_ari_validate_bridge_created(), ast_ari_validate_bridge_destroyed(), ast_ari_validate_bridge_merged(), ast_ari_validate_bridge_video_source_changed(), ast_ari_validate_build_info(), ast_ari_validate_caller_id(), ast_ari_validate_channel(), ast_ari_validate_channel_caller_id(), ast_ari_validate_channel_connected_line(), ast_ari_validate_channel_created(), ast_ari_validate_channel_destroyed(), ast_ari_validate_channel_dialplan(), ast_ari_validate_channel_dtmf_received(), ast_ari_validate_channel_entered_bridge(), ast_ari_validate_channel_hangup_request(), ast_ari_validate_channel_hold(), ast_ari_validate_channel_left_bridge(), ast_ari_validate_channel_state_change(), ast_ari_validate_channel_talking_finished(), ast_ari_validate_channel_talking_started(), ast_ari_validate_channel_tone_detected(), ast_ari_validate_channel_unhold(), ast_ari_validate_channel_userevent(), ast_ari_validate_channel_varset(), ast_ari_validate_config_info(), ast_ari_validate_config_tuple(), ast_ari_validate_contact_info(), ast_ari_validate_contact_status_change(), ast_ari_validate_device_state(), ast_ari_validate_device_state_changed(), ast_ari_validate_dial(), ast_ari_validate_dialplan_cep(), ast_ari_validate_endpoint(), ast_ari_validate_endpoint_state_change(), ast_ari_validate_event(), ast_ari_validate_format_lang_pair(), ast_ari_validate_live_recording(), ast_ari_validate_log_channel(), ast_ari_validate_mailbox(), ast_ari_validate_message(), ast_ari_validate_missing_params(), ast_ari_validate_module(), ast_ari_validate_peer(), ast_ari_validate_peer_status_change(), ast_ari_validate_playback(), ast_ari_validate_playback_continuing(), ast_ari_validate_playback_finished(), ast_ari_validate_playback_started(), ast_ari_validate_recording_failed(), ast_ari_validate_recording_finished(), ast_ari_validate_recording_started(), ast_ari_validate_rtpstat(), ast_ari_validate_set_id(), ast_ari_validate_sound(), ast_ari_validate_stasis_end(), ast_ari_validate_stasis_start(), ast_ari_validate_status_info(), ast_ari_validate_stored_recording(), ast_ari_validate_system_info(), ast_ari_validate_text_message(), ast_ari_validate_text_message_received(), ast_ari_validate_variable(), ast_json_to_ast_variables(), AST_TEST_DEFINE(), handle_results(), handle_setting(), manager_json_to_ast_str(), and message_json_name().
Set a field in a JSON object.
object | JSON object to modify. |
key | Key of field to set. |
value | JSON value to set for field. |
0 | on success. |
-1 | on error. |
Definition at line 414 of file json.c.
References value.
Referenced by add_ip_json_object(), add_json_object(), alloc_security_event_json_object(), app_send(), ast_ari_asterisk_get_info(), ast_ari_get_docs(), ast_bridge_snapshot_to_json(), ast_bucket_file_json(), ast_bucket_json(), ast_channel_snapshot_to_json(), ast_endpoint_snapshot_to_json(), ast_json_channel_vars(), ast_json_object_create_vars(), ast_rtp_convert_stats_json(), ast_sip_subscription_set_persistence_data(), ast_sorcery_objectset_json_create(), AST_TEST_DEFINE(), attended_transfer_to_json(), blind_transfer_to_json(), channel_blob_to_json(), custom_fields_to_params(), devices_to_json(), dial_to_json(), external_media_audiosocket_tcp(), external_media_rtp_udp(), handler(), identify_module(), launch_asyncagi(), meetme_stasis_generate_msg(), message_json_error_msg_set(), message_json_id_set(), msg_to_json(), multi_user_event_to_json(), publish_acl_change(), recording_publish(), speech_test_server_get(), speech_test_server_set(), speech_test_server_setup(), stasis_app_event_filter_to_json(), stasis_app_message_handler(), stasis_app_recording_to_json(), stasis_app_user_event(), stasis_start_to_json(), sub_bridge_update_handler(), units_to_json(), and userevent_exec().
size_t ast_json_object_size | ( | struct ast_json * | object | ) |
Get size of JSON object.
object | JSON object. |
Zero | of object is not a JSON object. |
Definition at line 403 of file json.c.
Referenced by app_event_filter_set(), and AST_TEST_DEFINE().
Update object with all of the fields of other.
All of the fields of other are copied into object, overwriting existing keys. The other object is not changed, so ast_json_unref() it when you are done with it.
object | JSON object to modify. |
other | JSON object to copy into object. |
0 | on success. |
-1 | on error. |
Definition at line 426 of file json.c.
Referenced by AST_TEST_DEFINE(), cc_publish(), channel_to_json(), meetme_stasis_generate_msg(), message_json_construct2(), peerstatus_to_json(), send_conf_stasis(), and send_conf_stasis_snapshots().
Update existing fields in object with the fields of other.
Like ast_json_object_update(), but only existing fields are updated. No new fields will get added. The other object is not changed, so ast_json_unref() it when you are done with it.
object | JSON object to modify. |
other | JSON object to copy into object. |
0 | on success. |
-1 | on error. |
Definition at line 430 of file json.c.
Referenced by AST_TEST_DEFINE().
Add new fields to object with the fields of other.
Like ast_json_object_update(), but only missing fields are added. No existing fields will be modified. The other object is not changed, so ast_json_unref() it when you are done with it.
object | JSON object to modify. |
other | JSON object to copy into object. |
0 | on success. |
-1 | on error. |
Definition at line 434 of file json.c.
Referenced by AST_TEST_DEFINE().
struct ast_json * ast_json_pack | ( | char const * | format, |
... | |||
) |
Helper for creating complex JSON values.
See original Jansson docs at http://www.digip.org/jansson/doc/2.11/apiref.html#apiref-pack for more details.
Definition at line 612 of file json.c.
References args, and ast_json_vpack().
Referenced by __expire_registry(), __iax2_poke_noanswer(), add_format_information_cb(), agi_handle_command(), analog_publish_channel_alarm_clear(), analog_publish_dnd_state(), app_send_end_msg(), app_to_json(), app_update(), association_to_json(), ast_ari_asterisk_get_global_var(), ast_ari_asterisk_get_info(), ast_ari_asterisk_ping(), ast_ari_channels_get_channel_var(), ast_ari_response_error(), ast_bridge_channel_write_hold(), ast_bridge_merge_message_to_json(), ast_bridge_publish_enter(), ast_bridge_snapshot_to_json(), ast_cel_publish_event(), ast_cel_publish_user_event(), ast_channel_move(), ast_channel_publish_dial_internal(), ast_channel_publish_varset(), ast_channel_snapshot_to_json(), ast_endpoint_snapshot_to_json(), ast_json_dialplan_cep_app(), ast_json_name_number(), ast_json_party_id(), ast_manager_publish_event(), ast_queue_hangup_with_cause(), ast_queue_hold(), ast_rtcp_calculate_sr_rr_statistics(), ast_rtcp_interpret(), ast_sip_persistent_endpoint_publish_contact_state(), ast_sip_persistent_endpoint_update_state(), ast_softhangup(), ast_system_publish_registry(), AST_TEST_DEFINE(), asterisk_publication_send_refresh(), asterisk_publisher_devstate_cb(), asterisk_publisher_mwistate_cb(), attended_transfer_to_json(), beanstalk_put(), blind_transfer_to_json(), cc_publish(), cc_publish_available(), cc_publish_callerrecalling(), cc_publish_callerstartmonitoring(), cc_publish_callerstopmonitoring(), cc_publish_failure(), cc_publish_monitorfailed(), cc_publish_offertimerstart(), cc_publish_recallcomplete(), cc_publish_requestacknowledged(), cc_publish_requested(), cel_attended_transfer_cb(), cel_blind_transfer_cb(), cel_bridge_enter_cb(), cel_bridge_leave_cb(), cel_bs_put(), cel_channel_state_change(), cel_dial_cb(), cel_local_optimization_cb_helper(), cel_parking_cb(), cel_pickup_cb(), celgenuserevent_exec(), channel_callerid(), channel_connected_line(), channel_destroyed_event(), channel_dialplan(), charge_to_json(), conf_handle_talker_cb(), confbridge_handle_atxfer(), contactstatus_to_json(), create_sound_blob(), currency_to_json(), d_to_json(), dial_to_json(), dtmf_end_to_json(), e_to_json(), format_log_json(), handler(), hold_to_json(), join_queue(), json_party_name(), json_party_number(), json_party_subaddress(), launch_asyncagi(), leave_queue(), load_module(), local_optimization_finished_cb(), local_optimization_started_cb(), mailbox_to_json(), manager_mute_mixmonitor(), meetme_stasis_generate_msg(), message_json_construct2(), message_received_handler(), moh_post_start(), msg_to_json(), notify_new_message(), pack_bridge_and_channels(), peerstatus_to_json(), playback_to_json(), process_log_list(), process_module_list(), publish_async_exec_end(), publish_channel_alarm(), publish_channel_alarm_clear(), publish_cluster_discovery_to_stasis_full(), publish_dahdichannel(), publish_dnd_state(), publish_format_update(), publish_fully_booted(), publish_hangup_handler_message(), publish_load_message_type(), publish_local_bridge_message(), publish_span_alarm(), publish_span_alarm_clear(), queue_member_blob_create(), really_quit(), record_abandoned(), recording_to_json(), report_fax_status(), report_receive_fax_status(), report_send_fax_status(), reset_user_pw(), return_sorcery_object(), ring_entry(), rna(), rtcp_report_to_json(), s_to_json(), send_agent_complete(), send_agent_login(), send_agent_logoff(), send_conf_stasis(), send_conf_stasis_snapshots(), send_device_state(), send_dtmf_begin_event(), send_dtmf_end_event(), send_join_event(), send_leave_event(), send_mute_event(), send_start_msg_snapshots(), send_unmute_event(), simple_bridge_channel_event(), simple_bridge_event(), simple_channel_event(), simple_endpoint_event(), socket_process_helper(), speech_aeap_engine_create(), speech_aeap_get(), speech_aeap_set(), speech_test_server_get(), speech_test_server_handle_request(), stasis_app_device_state_to_json(), stasis_app_exec(), stasis_app_playback_to_json(), stasis_app_recording_to_json(), stasis_app_stored_recording_to_json(), stasis_app_user_event(), stasis_end_to_json(), stasis_start_to_json(), status_to_json(), talk_detect_audiohook_cb(), test_name_number(), try_calling(), unhold_to_json(), update_registry(), and userevent_exec().
struct ast_json * ast_json_party_id | ( | struct ast_party_id * | party | ) |
Construct an ast_party_id as JSON.
party | The party ID to represent as JSON. |
name
, number
and subaddress
objects for those that are valid in the party ID Definition at line 805 of file json.c.
References ast_describe_caller_presentation(), ast_json_pack(), ast_party_id_presentation(), json_party_name(), json_party_number(), json_party_subaddress(), ast_party_id::name, ast_party_id::number, and ast_party_id::subaddress.
struct ast_json_payload * ast_json_payload_create | ( | struct ast_json * | json | ) |
Create an ao2 object to pass json blobs as data payloads for stasis.
json | the ast_json blob we are loading |
NULL | if we fail to alloc it |
Definition at line 756 of file json.c.
References ao2_alloc, ast_json_ref(), ast_json_payload::json, json_payload_destructor(), and NULL.
Referenced by ast_manager_publish_event(), ast_system_publish_registry(), cc_publish(), handle_security_event(), publish_acl_change(), publish_cluster_discovery_to_stasis_full(), publish_format_update(), publish_load_message_type(), queue_publish_member_blob(), and stun_monitor_request().
struct ast_json * ast_json_real_create | ( | double | value | ) |
Create a JSON real number.
value | Value of the new JSON real number. |
NULL | on error. |
Definition at line 342 of file json.c.
References value.
Referenced by ast_ari_asterisk_get_info(), and ast_rtp_convert_stats_json().
double ast_json_real_get | ( | const struct ast_json * | real | ) |
Get the value from a JSON real number.
real | JSON real number. |
0 | if real is not a JSON real number. |
Definition at line 347 of file json.c.
Referenced by parse_node(), and rtcp_report_to_ami().
int ast_json_real_set | ( | struct ast_json * | real, |
double | value | ||
) |
Increase refcount on value.
value | JSON value to reference. |
Definition at line 67 of file json.c.
Referenced by alloc_security_event_json_object(), allocate_subscription(), aoc_publish_blob(), app_event_filter_set(), ari_bridges_play_found(), ari_bridges_play_new(), ast_ari_applications_list(), ast_ari_applications_subscribe(), ast_ari_applications_unsubscribe(), ast_ari_asterisk_get_global_var(), ast_ari_asterisk_get_info(), ast_ari_bridges_list(), ast_ari_bridges_record(), ast_ari_channels_get_channel_var(), ast_ari_channels_list(), ast_ari_endpoints_list(), ast_ari_endpoints_list_by_tech(), ast_ari_recordings_list_stored(), ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_websocket_session_read(), ast_bridge_blob_create(), ast_bridge_blob_create_from_snapshots(), ast_bucket_file_json(), ast_bucket_json(), ast_cel_publish_event(), ast_endpoint_blob_create(), ast_json_payload_create(), ast_manager_publish_event(), ast_multi_channel_blob_create(), ast_multi_object_blob_create(), ast_mwi_blob_create(), ast_rtp_publish_rtcp_message(), ast_sip_subscription_set_persistence_data(), AST_TEST_DEFINE(), attended_transfer_to_json(), create_channel_blob_message(), create_sound_blob(), generate_filenames_json(), json_array_from_list(), message_json_construct1(), message_received_handler(), multi_user_event_to_json(), publish_load_message_type(), report_receive_fax_status(), return_sorcery_object(), speech_test_server_set(), speech_test_server_setup(), stasis_app_event_filter_to_json(), stasis_app_message_handler(), stasis_app_playback_to_json(), stasis_app_recording_to_json(), and stasis_app_user_event().
void ast_json_reset_alloc_funcs | ( | void | ) |
Change alloc funcs back to the resource module defaults.
If you use ast_json_set_alloc_funcs() to temporarily change the allocator functions (i.e., from in a unit test), this function sets them back to ast_malloc() and ast_free().
Definition at line 62 of file json.c.
References ast_json_free(), and ast_json_malloc().
Referenced by ast_json_init(), and json_test_cleanup().
void ast_json_set_alloc_funcs | ( | void *(*)(size_t) | malloc_fn, |
void(*)(void *) | free_fn | ||
) |
Set custom allocators instead of the standard ast_malloc() and ast_free().
This is used by the unit tests to do JSON specific memory leak detection. Since it affects all users of the JSON library, shouldn't normally be used.
malloc_fn | Custom allocation function. |
free_fn | Matching free function. |
Definition at line 57 of file json.c.
Referenced by json_test_init().
struct ast_json * ast_json_string_create | ( | const char * | value | ) |
Construct a JSON string from value.
The given value must be a valid ASCII or UTF-8 encoded string.
value | Value of new JSON string. |
NULL | on error. |
Definition at line 278 of file json.c.
References value.
Referenced by add_json_object(), alloc_security_event_json_object(), app_send(), app_to_json(), ast_bridge_snapshot_to_json(), ast_bucket_file_json(), ast_bucket_json(), ast_channel_snapshot_to_json(), ast_endpoint_snapshot_to_json(), ast_json_channel_vars(), ast_json_ipaddr(), ast_json_object_create_vars(), ast_json_timeval(), ast_rtp_convert_stats_json(), ast_sorcery_objectset_json_create(), AST_TEST_DEFINE(), attended_transfer_to_json(), channel_blob_to_json(), container_to_json_array(), custom_fields_to_params(), device_to_json_cb(), fake_json(), generate_filenames_json(), handler(), identify_module(), json_array_from_list(), launch_asyncagi(), message_json_error_msg_set(), message_json_id_set(), msg_to_json(), multi_user_event_to_json(), pack_payload(), publish_acl_change(), recording_publish(), report_receive_fax_status(), send_start_msg_snapshots(), stasis_app_exec(), stasis_app_message_handler(), stasis_app_user_event(), sub_bridge_update_handler(), and userevent_exec().
const char * ast_json_string_get | ( | const struct ast_json * | string | ) |
Get the value of a JSON string.
string | JSON string. |
NULL | on error. |
Definition at line 283 of file json.c.
Referenced by agent_login_to_ami(), agent_logoff_to_ami(), app_send(), append_event_str_single(), append_json_single(), assign_uuid(), ast_ari_applications_subscribe_parse_body(), ast_ari_applications_unsubscribe_parse_body(), ast_ari_asterisk_add_log_parse_body(), ast_ari_asterisk_get_global_var_parse_body(), ast_ari_asterisk_get_info_parse_body(), ast_ari_asterisk_set_global_var_parse_body(), ast_ari_asterisk_update_object(), ast_ari_bridges_add_channel_parse_body(), ast_ari_bridges_create_parse_body(), ast_ari_bridges_create_with_id_parse_body(), ast_ari_bridges_play_parse_body(), ast_ari_bridges_play_with_id_parse_body(), ast_ari_bridges_record_parse_body(), ast_ari_bridges_remove_channel_parse_body(), ast_ari_bridges_start_moh_parse_body(), ast_ari_callback(), ast_ari_channels_continue_in_dialplan_parse_body(), ast_ari_channels_create_parse_body(), ast_ari_channels_dial_parse_body(), ast_ari_channels_external_media_parse_body(), ast_ari_channels_get_channel_var_parse_body(), ast_ari_channels_hangup_parse_body(), ast_ari_channels_move_parse_body(), ast_ari_channels_mute_parse_body(), ast_ari_channels_originate_parse_body(), ast_ari_channels_originate_with_id_parse_body(), ast_ari_channels_play_parse_body(), ast_ari_channels_play_with_id_parse_body(), ast_ari_channels_record_parse_body(), ast_ari_channels_redirect_parse_body(), ast_ari_channels_send_dtmf_parse_body(), ast_ari_channels_set_channel_var_parse_body(), ast_ari_channels_snoop_channel_parse_body(), ast_ari_channels_snoop_channel_with_id_parse_body(), ast_ari_channels_start_moh_parse_body(), ast_ari_channels_unmute_parse_body(), ast_ari_device_states_update_parse_body(), ast_ari_endpoints_refer_parse_body(), ast_ari_endpoints_refer_to_endpoint_parse_body(), ast_ari_endpoints_send_message_parse_body(), ast_ari_endpoints_send_message_to_endpoint_parse_body(), ast_ari_events_user_event_parse_body(), ast_ari_playbacks_control_parse_body(), ast_ari_recordings_copy_stored_parse_body(), ast_ari_sounds_list_parse_body(), ast_ari_validate_date(), ast_ari_validate_event(), ast_ari_validate_message(), ast_json_to_ast_variables(), AST_TEST_DEFINE(), asterisk_publication_devicestate(), asterisk_publication_devicestate_state_change(), asterisk_publication_mailboxstate(), asterisk_publication_mwi_state_change(), cc_available_to_ami(), cc_callerrecalling_to_ami(), cc_callerstartmonitoring_to_ami(), cc_callerstopmonitoring_to_ami(), cc_failure_to_ami(), cc_monitorfailed_to_ami(), cc_offertimerstart_to_ami(), cc_recallcomplete_to_ami(), cc_requestacknowledged_to_ami(), cc_requested_to_ami(), cel_generic_cb(), channel_dial_cb(), channel_dtmf_begin_cb(), channel_dtmf_end_cb(), channel_enter_cb(), channel_fax_cb(), channel_hangup_handler_cb(), channel_hold_cb(), channel_mixmonitor_mute_cb(), channel_moh_start_cb(), confbridge_publish_manager_event(), confbridge_talking_cb(), contactstatus_to_ami(), contactstatus_to_json(), dahdichannel_to_ami(), dial_to_json(), dtmf_end_to_json(), fetch_access_token(), fetch_google_access_token(), get_blob_variable(), handle_dial_message(), handle_masquerade(), handle_setting(), hold_to_json(), local_message_to_ami(), manager_generic_msg_cb(), manager_json_value_str_append(), meetme_stasis_cb(), message_json_name(), multi_user_event_to_ami(), mwi_app_event_cb(), mwi_startup_event_cb(), parse_node(), parse_refer_json(), peerstatus_to_ami(), playback_to_json(), queue_agent_cb(), recording_to_json(), rtcp_message_handler(), rtcp_report_to_ami(), speech_test_server_get(), startup_event_cb(), stasis_app_message_handler(), subscription_persistence_event_cb(), system_registry_to_ami(), and varset_to_ami().
int ast_json_string_set | ( | struct ast_json * | string, |
const char * | value | ||
) |
Change the value of a JSON string.
The given value must be a valid ASCII or UTF-8 encoded string.
string | JSON string to modify. |
value | New value to store in string. |
0 | on success. |
-1 | on error. |
Definition at line 288 of file json.c.
References value.
Referenced by AST_TEST_DEFINE(), and conf_send_event_to_participants().
struct ast_json * ast_json_stringf | ( | const char * | format, |
... | |||
) |
Create a JSON string, printf style.
The formatted value must be a valid ASCII or UTF-8 encoded string.
format | printf style format string. |
NULL | on error. |
Definition at line 293 of file json.c.
References args, and ast_json_vstringf().
Referenced by add_json_object(), alloc_security_event_json_object(), ast_ari_get_docs(), AST_TEST_DEFINE(), and units_to_json().
struct ast_json * ast_json_timeval | ( | const struct timeval | tv, |
const char * | zone | ||
) |
Construct a timeval as JSON.
JSON does not define a standard date format (boo), but the de facto standard is to use ISO 8601 formatted string. We build a millisecond resolution string from the timeval
tv | timeval to encode. |
zone | Text string of a standard system zoneinfo file. If NULL, the system localtime will be used. |
NULL | on error. |
Definition at line 670 of file json.c.
References AST_ISO8601_FORMAT, AST_ISO8601_LEN, ast_json_string_create(), ast_localtime(), ast_strftime(), and buf.
Referenced by add_json_object(), alloc_security_event_json_object(), app_send_end_msg(), app_update(), ast_ari_asterisk_get_info(), ast_ari_asterisk_ping(), ast_bridge_merge_message_to_json(), ast_bridge_snapshot_to_json(), ast_channel_snapshot_to_json(), AST_TEST_DEFINE(), attended_transfer_to_json(), blind_transfer_to_json(), channel_blob_to_json(), channel_callerid(), channel_connected_line(), channel_destroyed_event(), channel_dialplan(), contactstatus_to_json(), dial_to_json(), dtmf_end_to_json(), hold_to_json(), message_received_handler(), multi_user_event_to_json(), pack_bridge_and_channels(), peerstatus_to_json(), playback_to_json(), recording_to_json(), send_device_state(), send_start_msg_snapshots(), simple_bridge_channel_event(), simple_bridge_event(), simple_channel_event(), simple_endpoint_event(), stasis_app_exec(), and unhold_to_json().
enum ast_json_to_ast_vars_code ast_json_to_ast_variables | ( | struct ast_json * | json_variables, |
struct ast_variable ** | variables | ||
) |
Convert a ast_json
list of key/value pair tuples into a ast_variable
list.
json_variables | The JSON blob containing the variable |
variables | An out reference to the variables to populate. |
Definition at line 818 of file json.c.
References ast_assert, ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), AST_JSON_STRING, ast_json_string_get(), AST_JSON_TO_AST_VARS_CODE_INVALID_TYPE, AST_JSON_TO_AST_VARS_CODE_OOM, AST_JSON_TO_AST_VARS_CODE_SUCCESS, ast_json_typeof(), ast_strlen_zero(), ast_variable_list_append_hint(), ast_variable_new, ast_variables_destroy(), NULL, and value.
Referenced by json_to_ast_variables(), sorcery_astdb_retrieve_fields_common(), sorcery_astdb_retrieve_id(), sorcery_astdb_retrieve_prefix(), and sorcery_astdb_retrieve_regex().
struct ast_json * ast_json_true | ( | void | ) |
Get the JSON true value.
The returned value is a singleton, and does not need to be ast_json_unref()'ed.
Definition at line 233 of file json.c.
Referenced by AST_TEST_DEFINE().
const char * ast_json_typename | ( | enum ast_json_type | type | ) |
Get the string name for the given type.
type | Type to convert to string. |
? | for invalid types. |
Definition at line 95 of file json.c.
References ast_assert, AST_JSON_ARRAY, AST_JSON_FALSE, AST_JSON_INTEGER, AST_JSON_NULL, AST_JSON_OBJECT, AST_JSON_REAL, AST_JSON_STRING, AST_JSON_TRUE, and type.
Referenced by ast_ari_validate_boolean(), and check_type().
enum ast_json_type ast_json_typeof | ( | const struct ast_json * | value | ) |
Get the type of value.
value | Value to query. |
Definition at line 78 of file json.c.
References ast_assert, AST_JSON_ARRAY, AST_JSON_FALSE, AST_JSON_INTEGER, AST_JSON_NULL, AST_JSON_OBJECT, AST_JSON_REAL, AST_JSON_STRING, and AST_JSON_TRUE.
Referenced by app_event_filter_set(), ast_ari_applications_subscribe_parse_body(), ast_ari_applications_unsubscribe_parse_body(), ast_ari_asterisk_get_info_parse_body(), ast_ari_bridges_add_channel_parse_body(), ast_ari_bridges_play_parse_body(), ast_ari_bridges_play_with_id_parse_body(), ast_ari_bridges_remove_channel_parse_body(), ast_ari_channels_play_parse_body(), ast_ari_channels_play_with_id_parse_body(), ast_ari_events_user_event_parse_body(), ast_ari_validate_boolean(), ast_json_to_ast_variables(), AST_TEST_DEFINE(), check_type(), manager_json_to_ast_str(), manager_json_value_str_append(), pack_bridge_and_channels(), parse_node(), and parse_refer_json().
void ast_json_unref | ( | struct ast_json * | value | ) |
Decrease refcount on value. If refcount reaches zero, value is freed.
NULL
to this function. Definition at line 73 of file json.c.
Referenced by __expire_registry(), __iax2_poke_noanswer(), agi_handle_command(), alloc_security_event_json_object(), analog_publish_channel_alarm_clear(), analog_publish_dnd_state(), aoc_event_blob_dtor(), app_data_dtor(), app_dtor(), app_event_filter_set(), app_send_end_msg(), app_to_json(), app_update(), ari_bridges_play_found(), ari_bridges_play_new(), ast_aoc_manager_event(), ast_ari_applications_list(), ast_ari_applications_subscribe(), ast_ari_applications_unsubscribe(), ast_ari_asterisk_get_global_var(), ast_ari_asterisk_get_info(), ast_ari_asterisk_get_module(), ast_ari_asterisk_list_log_channels(), ast_ari_bridges_list(), ast_ari_bridges_record(), ast_ari_callback(), ast_ari_channels_get_channel_var(), ast_ari_channels_list(), ast_ari_endpoints_list(), ast_ari_endpoints_list_by_tech(), ast_ari_recordings_list_stored(), ast_ari_response_error(), ast_ari_sounds_list(), ast_ari_websocket_events_event_websocket_established(), ast_ari_websocket_session_read(), ast_bridge_channel_write_hold(), ast_bridge_merge_message_to_json(), ast_bridge_publish_enter(), ast_bucket_file_json(), ast_bucket_json(), ast_cel_publish_event(), ast_cel_publish_user_event(), ast_channel_move(), ast_channel_publish_dial_internal(), ast_channel_publish_varset(), ast_endpoint_snapshot_to_json(), ast_manager_publish_event(), ast_queue_hangup_with_cause(), ast_queue_hold(), ast_rtcp_calculate_sr_rr_statistics(), ast_rtcp_interpret(), ast_rtp_convert_stats_json(), ast_sip_persistent_endpoint_publish_contact_state(), ast_sip_persistent_endpoint_update_state(), ast_sip_subscription_set_persistence_data(), ast_softhangup(), ast_sorcery_objectset_json_create(), ast_stir_shaken_vs_verify(), ast_system_publish_registry(), AST_TEST_DEFINE(), asterisk_publication_devicestate_state_change(), asterisk_publication_mwi_state_change(), asterisk_publication_send_refresh(), asterisk_publisher_devstate_cb(), asterisk_publisher_mwistate_cb(), attended_transfer_to_json(), beanstalk_put(), blind_transfer_to_json(), bridge_blob_dtor(), cc_publish(), cc_publish_available(), cc_publish_callerrecalling(), cc_publish_callerstartmonitoring(), cc_publish_callerstopmonitoring(), cc_publish_failure(), cc_publish_monitorfailed(), cc_publish_offertimerstart(), cc_publish_recallcomplete(), cc_publish_requestacknowledged(), cc_publish_requested(), cel_attended_transfer_cb(), cel_blind_transfer_cb(), cel_bridge_enter_cb(), cel_bridge_leave_cb(), cel_bs_put(), cel_channel_state_change(), cel_dial_cb(), cel_local_optimization_cb_helper(), cel_parking_cb(), cel_pickup_cb(), celgenuserevent_exec(), channel_blob_dtor(), channel_blob_to_json(), channel_to_json(), conf_handle_talker_cb(), conf_run(), conf_send_event_to_participants(), confbridge_handle_atxfer(), contactstatus_to_json(), container_to_json_array(), create_sound_blob(), destroy_subscription(), dial_to_json(), endpoint_blob_dtor(), event_session_shutdown(), event_session_update_websocket(), fetch_access_token(), fetch_google_access_token(), format_log_json(), generate_filenames_json(), handle_msg_cb(), handle_security_event(), join_queue(), json_array_from_list(), json_decode_read(), json_payload_destructor(), launch_asyncagi(), leave_queue(), local_optimization_finished_cb(), local_optimization_started_cb(), manager_mute_mixmonitor(), meetme_stasis_generate_msg(), message_json_construct2(), message_json_destruct(), message_received_handler(), moh_post_start(), msg_to_json(), multi_channel_blob_dtor(), multi_object_blob_dtor(), mwi_blob_dtor(), notify_new_message(), pack_payload(), peerstatus_to_json(), playback_publish(), publish_acl_change(), publish_async_exec_end(), publish_channel_alarm(), publish_channel_alarm_clear(), publish_chanspy_message(), publish_cluster_discovery_to_stasis_full(), publish_dahdichannel(), publish_dnd_state(), publish_format_update(), publish_fully_booted(), publish_hangup_handler_message(), publish_load_message_type(), publish_local_bridge_message(), publish_span_alarm(), publish_span_alarm_clear(), queue_publish_member_blob(), really_quit(), record_abandoned(), recording_publish(), report_fax_status(), report_receive_fax_status(), report_send_fax_status(), reset_user_pw(), response_free(), return_sorcery_object(), ring_entry(), rna(), rtcp_message_handler(), rtcp_message_payload_dtor(), rtcp_report_to_json(), send_agent_complete(), send_agent_login(), send_agent_logoff(), send_conf_stasis(), send_conf_stasis_snapshots(), send_device_state(), send_dtmf_begin_event(), send_dtmf_end_event(), send_join_event(), send_leave_event(), send_mute_event(), send_talking_event(), send_unmute_event(), simple_bridge_channel_event(), socket_process_helper(), sorcery_astdb_create(), sorcery_astdb_retrieve_fields_common(), sorcery_astdb_retrieve_id(), sorcery_astdb_retrieve_prefix(), sorcery_astdb_retrieve_regex(), speech_test_server_handle_request(), start_message_blob_dtor(), stasis_app_exec(), stasis_app_mailboxes_to_json(), stasis_app_playback_to_json(), stasis_app_recording_to_json(), stasis_app_user_event(), stasis_start_to_json(), stun_monitor_request(), sub_bridge_update_handler(), sub_channel_update_handler(), sub_endpoint_update_handler(), subscription_persistence_destroy(), talk_detect_audiohook_cb(), test_name_number(), try_calling(), unload_module(), update_registry(), and userevent_exec().
int ast_json_utf8_check | ( | const char * | str | ) |
Check the nul terminated string for UTF-8 format.
str | String to check. |
0 | if not UTF-8 encoded or str is NULL. |
1 | if UTF-8 encoded. |
Definition at line 228 of file json.c.
References ast_json_utf8_check_len(), and str.
int ast_json_utf8_check_len | ( | const char * | str, |
size_t | len | ||
) |
Check the string of the given length for UTF-8 format.
str | String to check. |
len | Length of string to check. |
0 | if not UTF-8 encoded or str is NULL. |
1 | if UTF-8 encoded. |
Definition at line 186 of file json.c.
References ast_debug, json_utf8_check_first(), json_utf8_check_full(), len(), and str.
Referenced by ast_json_utf8_check().
struct ast_json * ast_json_vpack | ( | char const * | format, |
va_list | ap | ||
) |
Helper for creating complex JSON values simply.
See original Jansson docs at http://www.digip.org/jansson/doc/2.11/apiref.html#apiref-pack for more details.
Definition at line 621 of file json.c.
References ast_log, ast_log_backtrace(), ast_strlen_zero(), error(), LOG_ERROR, and NULL.
Referenced by ast_json_pack().
struct ast_json * ast_json_vstringf | ( | const char * | format, |
va_list | args | ||
) |
Create a JSON string, vprintf style.
The formatted value must be a valid ASCII or UTF-8 encoded string.
format | printf style format string. |
args |
NULL | on error. |
Definition at line 303 of file json.c.
References args, ast_free, ast_vasprintf, NULL, and str.
Referenced by ast_ari_response_error(), and ast_json_stringf().
|
static |
Copy Jansson error struct to ours.
Definition at line 544 of file json.c.
References ast_copy_string(), and error().
Referenced by ast_json_load_buf(), ast_json_load_file(), ast_json_load_new_file(), and ast_json_load_string().
|
static |
Default flags for JSON encoding.
Definition at line 467 of file json.c.
References AST_JSON_PRETTY, and AST_JSON_SORTED.
Referenced by ast_json_dump_file_format(), ast_json_dump_new_file_format(), ast_json_dump_str_format(), and ast_json_dump_string_format().
|
static |
Definition at line 782 of file json.c.
References ast_describe_caller_presentation(), ast_json_pack(), AST_JSON_UTF8_VALIDATE, ast_party_name_charset_describe(), name, and NULL.
Referenced by ast_json_party_id().
|
static |
Definition at line 770 of file json.c.
References ast_describe_caller_presentation(), ast_json_pack(), AST_JSON_UTF8_VALIDATE, and NULL.
Referenced by ast_json_party_id().
|
static |
Definition at line 794 of file json.c.
References ast_json_pack(), AST_JSON_UTF8_VALIDATE, NULL, ast_party_subaddress::odd_even_indicator, ast_party_subaddress::str, ast_party_subaddress::type, and ast_party_subaddress::valid.
Referenced by ast_json_party_id().
|
static |
Definition at line 750 of file json.c.
References ast_json_unref(), and ast_json_payload::json.
Referenced by ast_json_payload_create().
|
static |
Definition at line 112 of file json.c.
Referenced by ast_json_utf8_check_len().
|
static |
Definition at line 144 of file json.c.
References len(), str, and value.
Referenced by ast_json_utf8_check_len().
|
static |
Definition at line 556 of file json.c.
References error(), NULL, and text.
Referenced by ast_json_load_file(), and ast_json_load_string().
|
static |
Definition at line 489 of file json.c.
References ast_str_append_substr(), ast_str_make_space, ast_str_size(), and ast_str_strlen().
Referenced by ast_json_dump_str_format().