Asterisk - The Open Source Telephony Project GIT-master-f36a736
Functions
ari_model_validators.c File Reference

Generated file - Build validators for ARI model objects. More...

#include "asterisk.h"
#include "asterisk/logger.h"
#include "asterisk/module.h"
#include "ari_model_validators.h"
Include dependency graph for ari_model_validators.c:

Go to the source code of this file.

Functions

int ast_ari_validate_application (struct ast_json *json)
 Validator for Application. More...
 
ari_validator ast_ari_validate_application_fn (void)
 Function pointer to ast_ari_validate_application(). More...
 
int ast_ari_validate_application_move_failed (struct ast_json *json)
 Validator for ApplicationMoveFailed. More...
 
ari_validator ast_ari_validate_application_move_failed_fn (void)
 Function pointer to ast_ari_validate_application_move_failed(). More...
 
int ast_ari_validate_application_replaced (struct ast_json *json)
 Validator for ApplicationReplaced. More...
 
ari_validator ast_ari_validate_application_replaced_fn (void)
 Function pointer to ast_ari_validate_application_replaced(). More...
 
int ast_ari_validate_asterisk_info (struct ast_json *json)
 Validator for AsteriskInfo. More...
 
ari_validator ast_ari_validate_asterisk_info_fn (void)
 Function pointer to ast_ari_validate_asterisk_info(). More...
 
int ast_ari_validate_asterisk_ping (struct ast_json *json)
 Validator for AsteriskPing. More...
 
ari_validator ast_ari_validate_asterisk_ping_fn (void)
 Function pointer to ast_ari_validate_asterisk_ping(). More...
 
int ast_ari_validate_bridge (struct ast_json *json)
 Validator for Bridge. More...
 
int ast_ari_validate_bridge_attended_transfer (struct ast_json *json)
 Validator for BridgeAttendedTransfer. More...
 
ari_validator ast_ari_validate_bridge_attended_transfer_fn (void)
 Function pointer to ast_ari_validate_bridge_attended_transfer(). More...
 
int ast_ari_validate_bridge_blind_transfer (struct ast_json *json)
 Validator for BridgeBlindTransfer. More...
 
ari_validator ast_ari_validate_bridge_blind_transfer_fn (void)
 Function pointer to ast_ari_validate_bridge_blind_transfer(). More...
 
int ast_ari_validate_bridge_created (struct ast_json *json)
 Validator for BridgeCreated. More...
 
ari_validator ast_ari_validate_bridge_created_fn (void)
 Function pointer to ast_ari_validate_bridge_created(). More...
 
int ast_ari_validate_bridge_destroyed (struct ast_json *json)
 Validator for BridgeDestroyed. More...
 
ari_validator ast_ari_validate_bridge_destroyed_fn (void)
 Function pointer to ast_ari_validate_bridge_destroyed(). More...
 
ari_validator ast_ari_validate_bridge_fn (void)
 Function pointer to ast_ari_validate_bridge(). More...
 
int ast_ari_validate_bridge_merged (struct ast_json *json)
 Validator for BridgeMerged. More...
 
ari_validator ast_ari_validate_bridge_merged_fn (void)
 Function pointer to ast_ari_validate_bridge_merged(). More...
 
int ast_ari_validate_bridge_video_source_changed (struct ast_json *json)
 Validator for BridgeVideoSourceChanged. More...
 
ari_validator ast_ari_validate_bridge_video_source_changed_fn (void)
 Function pointer to ast_ari_validate_bridge_video_source_changed(). More...
 
int ast_ari_validate_build_info (struct ast_json *json)
 Validator for BuildInfo. More...
 
ari_validator ast_ari_validate_build_info_fn (void)
 Function pointer to ast_ari_validate_build_info(). More...
 
int ast_ari_validate_caller_id (struct ast_json *json)
 Validator for CallerID. More...
 
ari_validator ast_ari_validate_caller_id_fn (void)
 Function pointer to ast_ari_validate_caller_id(). More...
 
int ast_ari_validate_channel (struct ast_json *json)
 Validator for Channel. More...
 
int ast_ari_validate_channel_caller_id (struct ast_json *json)
 Validator for ChannelCallerId. More...
 
ari_validator ast_ari_validate_channel_caller_id_fn (void)
 Function pointer to ast_ari_validate_channel_caller_id(). More...
 
int ast_ari_validate_channel_connected_line (struct ast_json *json)
 Validator for ChannelConnectedLine. More...
 
ari_validator ast_ari_validate_channel_connected_line_fn (void)
 Function pointer to ast_ari_validate_channel_connected_line(). More...
 
int ast_ari_validate_channel_created (struct ast_json *json)
 Validator for ChannelCreated. More...
 
ari_validator ast_ari_validate_channel_created_fn (void)
 Function pointer to ast_ari_validate_channel_created(). More...
 
int ast_ari_validate_channel_destroyed (struct ast_json *json)
 Validator for ChannelDestroyed. More...
 
ari_validator ast_ari_validate_channel_destroyed_fn (void)
 Function pointer to ast_ari_validate_channel_destroyed(). More...
 
int ast_ari_validate_channel_dialplan (struct ast_json *json)
 Validator for ChannelDialplan. More...
 
ari_validator ast_ari_validate_channel_dialplan_fn (void)
 Function pointer to ast_ari_validate_channel_dialplan(). More...
 
int ast_ari_validate_channel_dtmf_received (struct ast_json *json)
 Validator for ChannelDtmfReceived. More...
 
ari_validator ast_ari_validate_channel_dtmf_received_fn (void)
 Function pointer to ast_ari_validate_channel_dtmf_received(). More...
 
int ast_ari_validate_channel_entered_bridge (struct ast_json *json)
 Validator for ChannelEnteredBridge. More...
 
ari_validator ast_ari_validate_channel_entered_bridge_fn (void)
 Function pointer to ast_ari_validate_channel_entered_bridge(). More...
 
ari_validator ast_ari_validate_channel_fn (void)
 Function pointer to ast_ari_validate_channel(). More...
 
int ast_ari_validate_channel_hangup_request (struct ast_json *json)
 Validator for ChannelHangupRequest. More...
 
ari_validator ast_ari_validate_channel_hangup_request_fn (void)
 Function pointer to ast_ari_validate_channel_hangup_request(). More...
 
int ast_ari_validate_channel_hold (struct ast_json *json)
 Validator for ChannelHold. More...
 
ari_validator ast_ari_validate_channel_hold_fn (void)
 Function pointer to ast_ari_validate_channel_hold(). More...
 
int ast_ari_validate_channel_left_bridge (struct ast_json *json)
 Validator for ChannelLeftBridge. More...
 
ari_validator ast_ari_validate_channel_left_bridge_fn (void)
 Function pointer to ast_ari_validate_channel_left_bridge(). More...
 
int ast_ari_validate_channel_state_change (struct ast_json *json)
 Validator for ChannelStateChange. More...
 
ari_validator ast_ari_validate_channel_state_change_fn (void)
 Function pointer to ast_ari_validate_channel_state_change(). More...
 
int ast_ari_validate_channel_talking_finished (struct ast_json *json)
 Validator for ChannelTalkingFinished. More...
 
ari_validator ast_ari_validate_channel_talking_finished_fn (void)
 Function pointer to ast_ari_validate_channel_talking_finished(). More...
 
int ast_ari_validate_channel_talking_started (struct ast_json *json)
 Validator for ChannelTalkingStarted. More...
 
ari_validator ast_ari_validate_channel_talking_started_fn (void)
 Function pointer to ast_ari_validate_channel_talking_started(). More...
 
int ast_ari_validate_channel_tone_detected (struct ast_json *json)
 Validator for ChannelToneDetected. More...
 
ari_validator ast_ari_validate_channel_tone_detected_fn (void)
 Function pointer to ast_ari_validate_channel_tone_detected(). More...
 
int ast_ari_validate_channel_unhold (struct ast_json *json)
 Validator for ChannelUnhold. More...
 
ari_validator ast_ari_validate_channel_unhold_fn (void)
 Function pointer to ast_ari_validate_channel_unhold(). More...
 
int ast_ari_validate_channel_userevent (struct ast_json *json)
 Validator for ChannelUserevent. More...
 
ari_validator ast_ari_validate_channel_userevent_fn (void)
 Function pointer to ast_ari_validate_channel_userevent(). More...
 
int ast_ari_validate_channel_varset (struct ast_json *json)
 Validator for ChannelVarset. More...
 
ari_validator ast_ari_validate_channel_varset_fn (void)
 Function pointer to ast_ari_validate_channel_varset(). More...
 
int ast_ari_validate_config_info (struct ast_json *json)
 Validator for ConfigInfo. More...
 
ari_validator ast_ari_validate_config_info_fn (void)
 Function pointer to ast_ari_validate_config_info(). More...
 
int ast_ari_validate_config_tuple (struct ast_json *json)
 Validator for ConfigTuple. More...
 
ari_validator ast_ari_validate_config_tuple_fn (void)
 Function pointer to ast_ari_validate_config_tuple(). More...
 
int ast_ari_validate_contact_info (struct ast_json *json)
 Validator for ContactInfo. More...
 
ari_validator ast_ari_validate_contact_info_fn (void)
 Function pointer to ast_ari_validate_contact_info(). More...
 
int ast_ari_validate_contact_status_change (struct ast_json *json)
 Validator for ContactStatusChange. More...
 
ari_validator ast_ari_validate_contact_status_change_fn (void)
 Function pointer to ast_ari_validate_contact_status_change(). More...
 
int ast_ari_validate_device_state (struct ast_json *json)
 Validator for DeviceState. More...
 
int ast_ari_validate_device_state_changed (struct ast_json *json)
 Validator for DeviceStateChanged. More...
 
ari_validator ast_ari_validate_device_state_changed_fn (void)
 Function pointer to ast_ari_validate_device_state_changed(). More...
 
ari_validator ast_ari_validate_device_state_fn (void)
 Function pointer to ast_ari_validate_device_state(). More...
 
int ast_ari_validate_dial (struct ast_json *json)
 Validator for Dial. More...
 
ari_validator ast_ari_validate_dial_fn (void)
 Function pointer to ast_ari_validate_dial(). More...
 
int ast_ari_validate_dialed (struct ast_json *json)
 Validator for Dialed. More...
 
ari_validator ast_ari_validate_dialed_fn (void)
 Function pointer to ast_ari_validate_dialed(). More...
 
int ast_ari_validate_dialplan_cep (struct ast_json *json)
 Validator for DialplanCEP. More...
 
ari_validator ast_ari_validate_dialplan_cep_fn (void)
 Function pointer to ast_ari_validate_dialplan_cep(). More...
 
int ast_ari_validate_endpoint (struct ast_json *json)
 Validator for Endpoint. More...
 
ari_validator ast_ari_validate_endpoint_fn (void)
 Function pointer to ast_ari_validate_endpoint(). More...
 
int ast_ari_validate_endpoint_state_change (struct ast_json *json)
 Validator for EndpointStateChange. More...
 
ari_validator ast_ari_validate_endpoint_state_change_fn (void)
 Function pointer to ast_ari_validate_endpoint_state_change(). More...
 
int ast_ari_validate_event (struct ast_json *json)
 Validator for Event. More...
 
ari_validator ast_ari_validate_event_fn (void)
 Function pointer to ast_ari_validate_event(). More...
 
int ast_ari_validate_format_lang_pair (struct ast_json *json)
 Validator for FormatLangPair. More...
 
ari_validator ast_ari_validate_format_lang_pair_fn (void)
 Function pointer to ast_ari_validate_format_lang_pair(). More...
 
int ast_ari_validate_live_recording (struct ast_json *json)
 Validator for LiveRecording. More...
 
ari_validator ast_ari_validate_live_recording_fn (void)
 Function pointer to ast_ari_validate_live_recording(). More...
 
int ast_ari_validate_log_channel (struct ast_json *json)
 Validator for LogChannel. More...
 
ari_validator ast_ari_validate_log_channel_fn (void)
 Function pointer to ast_ari_validate_log_channel(). More...
 
int ast_ari_validate_mailbox (struct ast_json *json)
 Validator for Mailbox. More...
 
ari_validator ast_ari_validate_mailbox_fn (void)
 Function pointer to ast_ari_validate_mailbox(). More...
 
int ast_ari_validate_message (struct ast_json *json)
 Validator for Message. More...
 
ari_validator ast_ari_validate_message_fn (void)
 Function pointer to ast_ari_validate_message(). More...
 
int ast_ari_validate_missing_params (struct ast_json *json)
 Validator for MissingParams. More...
 
ari_validator ast_ari_validate_missing_params_fn (void)
 Function pointer to ast_ari_validate_missing_params(). More...
 
int ast_ari_validate_module (struct ast_json *json)
 Validator for Module. More...
 
ari_validator ast_ari_validate_module_fn (void)
 Function pointer to ast_ari_validate_module(). More...
 
int ast_ari_validate_peer (struct ast_json *json)
 Validator for Peer. More...
 
ari_validator ast_ari_validate_peer_fn (void)
 Function pointer to ast_ari_validate_peer(). More...
 
int ast_ari_validate_peer_status_change (struct ast_json *json)
 Validator for PeerStatusChange. More...
 
ari_validator ast_ari_validate_peer_status_change_fn (void)
 Function pointer to ast_ari_validate_peer_status_change(). More...
 
int ast_ari_validate_playback (struct ast_json *json)
 Validator for Playback. More...
 
int ast_ari_validate_playback_continuing (struct ast_json *json)
 Validator for PlaybackContinuing. More...
 
ari_validator ast_ari_validate_playback_continuing_fn (void)
 Function pointer to ast_ari_validate_playback_continuing(). More...
 
int ast_ari_validate_playback_finished (struct ast_json *json)
 Validator for PlaybackFinished. More...
 
ari_validator ast_ari_validate_playback_finished_fn (void)
 Function pointer to ast_ari_validate_playback_finished(). More...
 
ari_validator ast_ari_validate_playback_fn (void)
 Function pointer to ast_ari_validate_playback(). More...
 
int ast_ari_validate_playback_started (struct ast_json *json)
 Validator for PlaybackStarted. More...
 
ari_validator ast_ari_validate_playback_started_fn (void)
 Function pointer to ast_ari_validate_playback_started(). More...
 
int ast_ari_validate_recording_failed (struct ast_json *json)
 Validator for RecordingFailed. More...
 
ari_validator ast_ari_validate_recording_failed_fn (void)
 Function pointer to ast_ari_validate_recording_failed(). More...
 
int ast_ari_validate_recording_finished (struct ast_json *json)
 Validator for RecordingFinished. More...
 
ari_validator ast_ari_validate_recording_finished_fn (void)
 Function pointer to ast_ari_validate_recording_finished(). More...
 
int ast_ari_validate_recording_started (struct ast_json *json)
 Validator for RecordingStarted. More...
 
ari_validator ast_ari_validate_recording_started_fn (void)
 Function pointer to ast_ari_validate_recording_started(). More...
 
int ast_ari_validate_rtpstat (struct ast_json *json)
 Validator for RTPstat. More...
 
ari_validator ast_ari_validate_rtpstat_fn (void)
 Function pointer to ast_ari_validate_rtpstat(). More...
 
int ast_ari_validate_set_id (struct ast_json *json)
 Validator for SetId. More...
 
ari_validator ast_ari_validate_set_id_fn (void)
 Function pointer to ast_ari_validate_set_id(). More...
 
int ast_ari_validate_sound (struct ast_json *json)
 Validator for Sound. More...
 
ari_validator ast_ari_validate_sound_fn (void)
 Function pointer to ast_ari_validate_sound(). More...
 
int ast_ari_validate_stasis_end (struct ast_json *json)
 Validator for StasisEnd. More...
 
ari_validator ast_ari_validate_stasis_end_fn (void)
 Function pointer to ast_ari_validate_stasis_end(). More...
 
int ast_ari_validate_stasis_start (struct ast_json *json)
 Validator for StasisStart. More...
 
ari_validator ast_ari_validate_stasis_start_fn (void)
 Function pointer to ast_ari_validate_stasis_start(). More...
 
int ast_ari_validate_status_info (struct ast_json *json)
 Validator for StatusInfo. More...
 
ari_validator ast_ari_validate_status_info_fn (void)
 Function pointer to ast_ari_validate_status_info(). More...
 
int ast_ari_validate_stored_recording (struct ast_json *json)
 Validator for StoredRecording. More...
 
ari_validator ast_ari_validate_stored_recording_fn (void)
 Function pointer to ast_ari_validate_stored_recording(). More...
 
int ast_ari_validate_system_info (struct ast_json *json)
 Validator for SystemInfo. More...
 
ari_validator ast_ari_validate_system_info_fn (void)
 Function pointer to ast_ari_validate_system_info(). More...
 
int ast_ari_validate_text_message (struct ast_json *json)
 Validator for TextMessage. More...
 
ari_validator ast_ari_validate_text_message_fn (void)
 Function pointer to ast_ari_validate_text_message(). More...
 
int ast_ari_validate_text_message_received (struct ast_json *json)
 Validator for TextMessageReceived. More...
 
ari_validator ast_ari_validate_text_message_received_fn (void)
 Function pointer to ast_ari_validate_text_message_received(). More...
 
int ast_ari_validate_variable (struct ast_json *json)
 Validator for Variable. More...
 
ari_validator ast_ari_validate_variable_fn (void)
 Function pointer to ast_ari_validate_variable(). More...
 

Detailed Description

Generated file - Build validators for ARI model objects.

Definition in file ari_model_validators.c.

Function Documentation

◆ ast_ari_validate_application()

int ast_ari_validate_application ( struct ast_json json)

Validator for Application.

Details of a Stasis application

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 7430 of file ari_model_validators.c.

7431{
7432 int res = 1;
7433 struct ast_json_iter *iter;
7434 int has_bridge_ids = 0;
7435 int has_channel_ids = 0;
7436 int has_device_names = 0;
7437 int has_endpoint_ids = 0;
7438 int has_events_allowed = 0;
7439 int has_events_disallowed = 0;
7440 int has_name = 0;
7441
7442 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
7443 if (strcmp("bridge_ids", ast_json_object_iter_key(iter)) == 0) {
7444 int prop_is_valid;
7445 has_bridge_ids = 1;
7446 prop_is_valid = ast_ari_validate_list(
7449 if (!prop_is_valid) {
7450 ast_log(LOG_ERROR, "ARI Application field bridge_ids failed validation\n");
7451 res = 0;
7452 }
7453 } else
7454 if (strcmp("channel_ids", ast_json_object_iter_key(iter)) == 0) {
7455 int prop_is_valid;
7456 has_channel_ids = 1;
7457 prop_is_valid = ast_ari_validate_list(
7460 if (!prop_is_valid) {
7461 ast_log(LOG_ERROR, "ARI Application field channel_ids failed validation\n");
7462 res = 0;
7463 }
7464 } else
7465 if (strcmp("device_names", ast_json_object_iter_key(iter)) == 0) {
7466 int prop_is_valid;
7467 has_device_names = 1;
7468 prop_is_valid = ast_ari_validate_list(
7471 if (!prop_is_valid) {
7472 ast_log(LOG_ERROR, "ARI Application field device_names failed validation\n");
7473 res = 0;
7474 }
7475 } else
7476 if (strcmp("endpoint_ids", ast_json_object_iter_key(iter)) == 0) {
7477 int prop_is_valid;
7478 has_endpoint_ids = 1;
7479 prop_is_valid = ast_ari_validate_list(
7482 if (!prop_is_valid) {
7483 ast_log(LOG_ERROR, "ARI Application field endpoint_ids failed validation\n");
7484 res = 0;
7485 }
7486 } else
7487 if (strcmp("events_allowed", ast_json_object_iter_key(iter)) == 0) {
7488 int prop_is_valid;
7489 has_events_allowed = 1;
7490 prop_is_valid = ast_ari_validate_list(
7493 if (!prop_is_valid) {
7494 ast_log(LOG_ERROR, "ARI Application field events_allowed failed validation\n");
7495 res = 0;
7496 }
7497 } else
7498 if (strcmp("events_disallowed", ast_json_object_iter_key(iter)) == 0) {
7499 int prop_is_valid;
7500 has_events_disallowed = 1;
7501 prop_is_valid = ast_ari_validate_list(
7504 if (!prop_is_valid) {
7505 ast_log(LOG_ERROR, "ARI Application field events_disallowed failed validation\n");
7506 res = 0;
7507 }
7508 } else
7509 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
7510 int prop_is_valid;
7511 has_name = 1;
7512 prop_is_valid = ast_ari_validate_string(
7514 if (!prop_is_valid) {
7515 ast_log(LOG_ERROR, "ARI Application field name failed validation\n");
7516 res = 0;
7517 }
7518 } else
7519 {
7521 "ARI Application has undocumented field %s\n",
7523 res = 0;
7524 }
7525 }
7526
7527 if (!has_bridge_ids) {
7528 ast_log(LOG_ERROR, "ARI Application missing required field bridge_ids\n");
7529 res = 0;
7530 }
7531
7532 if (!has_channel_ids) {
7533 ast_log(LOG_ERROR, "ARI Application missing required field channel_ids\n");
7534 res = 0;
7535 }
7536
7537 if (!has_device_names) {
7538 ast_log(LOG_ERROR, "ARI Application missing required field device_names\n");
7539 res = 0;
7540 }
7541
7542 if (!has_endpoint_ids) {
7543 ast_log(LOG_ERROR, "ARI Application missing required field endpoint_ids\n");
7544 res = 0;
7545 }
7546
7547 if (!has_events_allowed) {
7548 ast_log(LOG_ERROR, "ARI Application missing required field events_allowed\n");
7549 res = 0;
7550 }
7551
7552 if (!has_events_disallowed) {
7553 ast_log(LOG_ERROR, "ARI Application missing required field events_disallowed\n");
7554 res = 0;
7555 }
7556
7557 if (!has_name) {
7558 ast_log(LOG_ERROR, "ARI Application missing required field name\n");
7559 res = 0;
7560 }
7561
7562 return res;
7563}
int ast_ari_validate_object(struct ast_json *json)
Validator for native Swagger object.
Definition: res_ari_model.c:96
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
int ast_ari_validate_list(struct ast_json *json, int(*fn)(struct ast_json *))
Validator for a Swagger List[]/JSON array.
#define ast_log
Definition: astobj2.c:42
#define LOG_ERROR
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
struct ast_json_iter * ast_json_object_iter_next(struct ast_json *object, struct ast_json_iter *iter)
Get the next iterator.
Definition: json.c:447
struct ast_json_iter * ast_json_object_iter(struct ast_json *object)
Get an iterator pointing to the first field in a JSON object.
Definition: json.c:439
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
Iterator for JSON object key/values.

References ast_ari_validate_list(), ast_ari_validate_object(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_applications_filter_cb(), ast_ari_applications_get_cb(), ast_ari_applications_subscribe_cb(), ast_ari_applications_unsubscribe_cb(), and ast_ari_validate_application_fn().

◆ ast_ari_validate_application_fn()

ari_validator ast_ari_validate_application_fn ( void  )

Function pointer to ast_ari_validate_application().

Definition at line 7565 of file ari_model_validators.c.

7566{
7568}
int ast_ari_validate_application(struct ast_json *json)
Validator for Application.

References ast_ari_validate_application().

Referenced by ast_ari_applications_list_cb().

◆ ast_ari_validate_application_move_failed()

int ast_ari_validate_application_move_failed ( struct ast_json json)

Validator for ApplicationMoveFailed.

Notification that trying to move a channel to another Stasis application failed.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 2431 of file ari_model_validators.c.

2432{
2433 int res = 1;
2434 struct ast_json_iter *iter;
2435 int has_type = 0;
2436 int has_application = 0;
2437 int has_timestamp = 0;
2438 int has_args = 0;
2439 int has_channel = 0;
2440 int has_destination = 0;
2441
2442 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2443 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2444 int prop_is_valid;
2445 prop_is_valid = ast_ari_validate_string(
2447 if (!prop_is_valid) {
2448 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field asterisk_id failed validation\n");
2449 res = 0;
2450 }
2451 } else
2452 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2453 int prop_is_valid;
2454 has_type = 1;
2455 prop_is_valid = ast_ari_validate_string(
2457 if (!prop_is_valid) {
2458 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field type failed validation\n");
2459 res = 0;
2460 }
2461 } else
2462 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2463 int prop_is_valid;
2464 has_application = 1;
2465 prop_is_valid = ast_ari_validate_string(
2467 if (!prop_is_valid) {
2468 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field application failed validation\n");
2469 res = 0;
2470 }
2471 } else
2472 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2473 int prop_is_valid;
2474 has_timestamp = 1;
2475 prop_is_valid = ast_ari_validate_date(
2477 if (!prop_is_valid) {
2478 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field timestamp failed validation\n");
2479 res = 0;
2480 }
2481 } else
2482 if (strcmp("args", ast_json_object_iter_key(iter)) == 0) {
2483 int prop_is_valid;
2484 has_args = 1;
2485 prop_is_valid = ast_ari_validate_list(
2488 if (!prop_is_valid) {
2489 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field args failed validation\n");
2490 res = 0;
2491 }
2492 } else
2493 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2494 int prop_is_valid;
2495 has_channel = 1;
2496 prop_is_valid = ast_ari_validate_channel(
2498 if (!prop_is_valid) {
2499 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field channel failed validation\n");
2500 res = 0;
2501 }
2502 } else
2503 if (strcmp("destination", ast_json_object_iter_key(iter)) == 0) {
2504 int prop_is_valid;
2505 has_destination = 1;
2506 prop_is_valid = ast_ari_validate_string(
2508 if (!prop_is_valid) {
2509 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field destination failed validation\n");
2510 res = 0;
2511 }
2512 } else
2513 {
2515 "ARI ApplicationMoveFailed has undocumented field %s\n",
2517 res = 0;
2518 }
2519 }
2520
2521 if (!has_type) {
2522 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed missing required field type\n");
2523 res = 0;
2524 }
2525
2526 if (!has_application) {
2527 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed missing required field application\n");
2528 res = 0;
2529 }
2530
2531 if (!has_timestamp) {
2532 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed missing required field timestamp\n");
2533 res = 0;
2534 }
2535
2536 if (!has_args) {
2537 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed missing required field args\n");
2538 res = 0;
2539 }
2540
2541 if (!has_channel) {
2542 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed missing required field channel\n");
2543 res = 0;
2544 }
2545
2546 if (!has_destination) {
2547 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed missing required field destination\n");
2548 res = 0;
2549 }
2550
2551 return res;
2552}
int ast_ari_validate_channel(struct ast_json *json)
Validator for Channel.
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.

References ast_ari_validate_channel(), ast_ari_validate_date(), ast_ari_validate_list(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_application_move_failed_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_application_move_failed_fn()

ari_validator ast_ari_validate_application_move_failed_fn ( void  )

Function pointer to ast_ari_validate_application_move_failed().

Definition at line 2554 of file ari_model_validators.c.

2555{
2557}
int ast_ari_validate_application_move_failed(struct ast_json *json)
Validator for ApplicationMoveFailed.

References ast_ari_validate_application_move_failed().

◆ ast_ari_validate_application_replaced()

int ast_ari_validate_application_replaced ( struct ast_json json)

Validator for ApplicationReplaced.

Notification that another WebSocket has taken over for an application.

An application may only be subscribed to by a single WebSocket at a time. If multiple WebSockets attempt to subscribe to the same application, the newer WebSocket wins, and the older one receives this event.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 2559 of file ari_model_validators.c.

2560{
2561 int res = 1;
2562 struct ast_json_iter *iter;
2563 int has_type = 0;
2564 int has_application = 0;
2565 int has_timestamp = 0;
2566
2567 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2568 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2569 int prop_is_valid;
2570 prop_is_valid = ast_ari_validate_string(
2572 if (!prop_is_valid) {
2573 ast_log(LOG_ERROR, "ARI ApplicationReplaced field asterisk_id failed validation\n");
2574 res = 0;
2575 }
2576 } else
2577 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2578 int prop_is_valid;
2579 has_type = 1;
2580 prop_is_valid = ast_ari_validate_string(
2582 if (!prop_is_valid) {
2583 ast_log(LOG_ERROR, "ARI ApplicationReplaced field type failed validation\n");
2584 res = 0;
2585 }
2586 } else
2587 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2588 int prop_is_valid;
2589 has_application = 1;
2590 prop_is_valid = ast_ari_validate_string(
2592 if (!prop_is_valid) {
2593 ast_log(LOG_ERROR, "ARI ApplicationReplaced field application failed validation\n");
2594 res = 0;
2595 }
2596 } else
2597 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2598 int prop_is_valid;
2599 has_timestamp = 1;
2600 prop_is_valid = ast_ari_validate_date(
2602 if (!prop_is_valid) {
2603 ast_log(LOG_ERROR, "ARI ApplicationReplaced field timestamp failed validation\n");
2604 res = 0;
2605 }
2606 } else
2607 {
2609 "ARI ApplicationReplaced has undocumented field %s\n",
2611 res = 0;
2612 }
2613 }
2614
2615 if (!has_type) {
2616 ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field type\n");
2617 res = 0;
2618 }
2619
2620 if (!has_application) {
2621 ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field application\n");
2622 res = 0;
2623 }
2624
2625 if (!has_timestamp) {
2626 ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field timestamp\n");
2627 res = 0;
2628 }
2629
2630 return res;
2631}

References ast_ari_validate_date(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_application_replaced_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_application_replaced_fn()

ari_validator ast_ari_validate_application_replaced_fn ( void  )

Function pointer to ast_ari_validate_application_replaced().

Definition at line 2633 of file ari_model_validators.c.

2634{
2636}
int ast_ari_validate_application_replaced(struct ast_json *json)
Validator for ApplicationReplaced.

References ast_ari_validate_application_replaced().

◆ ast_ari_validate_asterisk_info()

int ast_ari_validate_asterisk_info ( struct ast_json json)

Validator for AsteriskInfo.

Asterisk system information

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 36 of file ari_model_validators.c.

37{
38 int res = 1;
39 struct ast_json_iter *iter;
40
41 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
42 if (strcmp("build", ast_json_object_iter_key(iter)) == 0) {
43 int prop_is_valid;
44 prop_is_valid = ast_ari_validate_build_info(
46 if (!prop_is_valid) {
47 ast_log(LOG_ERROR, "ARI AsteriskInfo field build failed validation\n");
48 res = 0;
49 }
50 } else
51 if (strcmp("config", ast_json_object_iter_key(iter)) == 0) {
52 int prop_is_valid;
53 prop_is_valid = ast_ari_validate_config_info(
55 if (!prop_is_valid) {
56 ast_log(LOG_ERROR, "ARI AsteriskInfo field config failed validation\n");
57 res = 0;
58 }
59 } else
60 if (strcmp("status", ast_json_object_iter_key(iter)) == 0) {
61 int prop_is_valid;
62 prop_is_valid = ast_ari_validate_status_info(
64 if (!prop_is_valid) {
65 ast_log(LOG_ERROR, "ARI AsteriskInfo field status failed validation\n");
66 res = 0;
67 }
68 } else
69 if (strcmp("system", ast_json_object_iter_key(iter)) == 0) {
70 int prop_is_valid;
71 prop_is_valid = ast_ari_validate_system_info(
73 if (!prop_is_valid) {
74 ast_log(LOG_ERROR, "ARI AsteriskInfo field system failed validation\n");
75 res = 0;
76 }
77 } else
78 {
80 "ARI AsteriskInfo has undocumented field %s\n",
82 res = 0;
83 }
84 }
85
86 return res;
87}
int ast_ari_validate_status_info(struct ast_json *json)
Validator for StatusInfo.
int ast_ari_validate_system_info(struct ast_json *json)
Validator for SystemInfo.
int ast_ari_validate_build_info(struct ast_json *json)
Validator for BuildInfo.
int ast_ari_validate_config_info(struct ast_json *json)
Validator for ConfigInfo.

References ast_ari_validate_build_info(), ast_ari_validate_config_info(), ast_ari_validate_status_info(), ast_ari_validate_system_info(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_asterisk_get_info_cb(), and ast_ari_validate_asterisk_info_fn().

◆ ast_ari_validate_asterisk_info_fn()

ari_validator ast_ari_validate_asterisk_info_fn ( void  )

Function pointer to ast_ari_validate_asterisk_info().

Definition at line 89 of file ari_model_validators.c.

90{
92}
int ast_ari_validate_asterisk_info(struct ast_json *json)
Validator for AsteriskInfo.

References ast_ari_validate_asterisk_info().

◆ ast_ari_validate_asterisk_ping()

int ast_ari_validate_asterisk_ping ( struct ast_json json)

Validator for AsteriskPing.

Asterisk ping information

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 94 of file ari_model_validators.c.

95{
96 int res = 1;
97 struct ast_json_iter *iter;
98 int has_asterisk_id = 0;
99 int has_ping = 0;
100 int has_timestamp = 0;
101
102 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
103 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
104 int prop_is_valid;
105 has_asterisk_id = 1;
106 prop_is_valid = ast_ari_validate_string(
108 if (!prop_is_valid) {
109 ast_log(LOG_ERROR, "ARI AsteriskPing field asterisk_id failed validation\n");
110 res = 0;
111 }
112 } else
113 if (strcmp("ping", ast_json_object_iter_key(iter)) == 0) {
114 int prop_is_valid;
115 has_ping = 1;
116 prop_is_valid = ast_ari_validate_string(
118 if (!prop_is_valid) {
119 ast_log(LOG_ERROR, "ARI AsteriskPing field ping failed validation\n");
120 res = 0;
121 }
122 } else
123 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
124 int prop_is_valid;
125 has_timestamp = 1;
126 prop_is_valid = ast_ari_validate_string(
128 if (!prop_is_valid) {
129 ast_log(LOG_ERROR, "ARI AsteriskPing field timestamp failed validation\n");
130 res = 0;
131 }
132 } else
133 {
135 "ARI AsteriskPing has undocumented field %s\n",
137 res = 0;
138 }
139 }
140
141 if (!has_asterisk_id) {
142 ast_log(LOG_ERROR, "ARI AsteriskPing missing required field asterisk_id\n");
143 res = 0;
144 }
145
146 if (!has_ping) {
147 ast_log(LOG_ERROR, "ARI AsteriskPing missing required field ping\n");
148 res = 0;
149 }
150
151 if (!has_timestamp) {
152 ast_log(LOG_ERROR, "ARI AsteriskPing missing required field timestamp\n");
153 res = 0;
154 }
155
156 return res;
157}

References ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_asterisk_ping_cb(), and ast_ari_validate_asterisk_ping_fn().

◆ ast_ari_validate_asterisk_ping_fn()

ari_validator ast_ari_validate_asterisk_ping_fn ( void  )

Function pointer to ast_ari_validate_asterisk_ping().

Definition at line 159 of file ari_model_validators.c.

160{
162}
int ast_ari_validate_asterisk_ping(struct ast_json *json)
Validator for AsteriskPing.

References ast_ari_validate_asterisk_ping().

◆ ast_ari_validate_bridge()

int ast_ari_validate_bridge ( struct ast_json json)

Validator for Bridge.

The merging of media from one or more channels.

Everyone on the bridge receives the same audio.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 1740 of file ari_model_validators.c.

1741{
1742 int res = 1;
1743 struct ast_json_iter *iter;
1744 int has_bridge_class = 0;
1745 int has_bridge_type = 0;
1746 int has_channels = 0;
1747 int has_creationtime = 0;
1748 int has_creator = 0;
1749 int has_id = 0;
1750 int has_name = 0;
1751 int has_technology = 0;
1752
1753 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1754 if (strcmp("bridge_class", ast_json_object_iter_key(iter)) == 0) {
1755 int prop_is_valid;
1756 has_bridge_class = 1;
1757 prop_is_valid = ast_ari_validate_string(
1759 if (!prop_is_valid) {
1760 ast_log(LOG_ERROR, "ARI Bridge field bridge_class failed validation\n");
1761 res = 0;
1762 }
1763 } else
1764 if (strcmp("bridge_type", ast_json_object_iter_key(iter)) == 0) {
1765 int prop_is_valid;
1766 has_bridge_type = 1;
1767 prop_is_valid = ast_ari_validate_string(
1769 if (!prop_is_valid) {
1770 ast_log(LOG_ERROR, "ARI Bridge field bridge_type failed validation\n");
1771 res = 0;
1772 }
1773 } else
1774 if (strcmp("channels", ast_json_object_iter_key(iter)) == 0) {
1775 int prop_is_valid;
1776 has_channels = 1;
1777 prop_is_valid = ast_ari_validate_list(
1780 if (!prop_is_valid) {
1781 ast_log(LOG_ERROR, "ARI Bridge field channels failed validation\n");
1782 res = 0;
1783 }
1784 } else
1785 if (strcmp("creationtime", ast_json_object_iter_key(iter)) == 0) {
1786 int prop_is_valid;
1787 has_creationtime = 1;
1788 prop_is_valid = ast_ari_validate_date(
1790 if (!prop_is_valid) {
1791 ast_log(LOG_ERROR, "ARI Bridge field creationtime failed validation\n");
1792 res = 0;
1793 }
1794 } else
1795 if (strcmp("creator", ast_json_object_iter_key(iter)) == 0) {
1796 int prop_is_valid;
1797 has_creator = 1;
1798 prop_is_valid = ast_ari_validate_string(
1800 if (!prop_is_valid) {
1801 ast_log(LOG_ERROR, "ARI Bridge field creator failed validation\n");
1802 res = 0;
1803 }
1804 } else
1805 if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
1806 int prop_is_valid;
1807 has_id = 1;
1808 prop_is_valid = ast_ari_validate_string(
1810 if (!prop_is_valid) {
1811 ast_log(LOG_ERROR, "ARI Bridge field id failed validation\n");
1812 res = 0;
1813 }
1814 } else
1815 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1816 int prop_is_valid;
1817 has_name = 1;
1818 prop_is_valid = ast_ari_validate_string(
1820 if (!prop_is_valid) {
1821 ast_log(LOG_ERROR, "ARI Bridge field name failed validation\n");
1822 res = 0;
1823 }
1824 } else
1825 if (strcmp("technology", ast_json_object_iter_key(iter)) == 0) {
1826 int prop_is_valid;
1827 has_technology = 1;
1828 prop_is_valid = ast_ari_validate_string(
1830 if (!prop_is_valid) {
1831 ast_log(LOG_ERROR, "ARI Bridge field technology failed validation\n");
1832 res = 0;
1833 }
1834 } else
1835 if (strcmp("video_mode", ast_json_object_iter_key(iter)) == 0) {
1836 int prop_is_valid;
1837 prop_is_valid = ast_ari_validate_string(
1839 if (!prop_is_valid) {
1840 ast_log(LOG_ERROR, "ARI Bridge field video_mode failed validation\n");
1841 res = 0;
1842 }
1843 } else
1844 if (strcmp("video_source_id", ast_json_object_iter_key(iter)) == 0) {
1845 int prop_is_valid;
1846 prop_is_valid = ast_ari_validate_string(
1848 if (!prop_is_valid) {
1849 ast_log(LOG_ERROR, "ARI Bridge field video_source_id failed validation\n");
1850 res = 0;
1851 }
1852 } else
1853 {
1855 "ARI Bridge has undocumented field %s\n",
1857 res = 0;
1858 }
1859 }
1860
1861 if (!has_bridge_class) {
1862 ast_log(LOG_ERROR, "ARI Bridge missing required field bridge_class\n");
1863 res = 0;
1864 }
1865
1866 if (!has_bridge_type) {
1867 ast_log(LOG_ERROR, "ARI Bridge missing required field bridge_type\n");
1868 res = 0;
1869 }
1870
1871 if (!has_channels) {
1872 ast_log(LOG_ERROR, "ARI Bridge missing required field channels\n");
1873 res = 0;
1874 }
1875
1876 if (!has_creationtime) {
1877 ast_log(LOG_ERROR, "ARI Bridge missing required field creationtime\n");
1878 res = 0;
1879 }
1880
1881 if (!has_creator) {
1882 ast_log(LOG_ERROR, "ARI Bridge missing required field creator\n");
1883 res = 0;
1884 }
1885
1886 if (!has_id) {
1887 ast_log(LOG_ERROR, "ARI Bridge missing required field id\n");
1888 res = 0;
1889 }
1890
1891 if (!has_name) {
1892 ast_log(LOG_ERROR, "ARI Bridge missing required field name\n");
1893 res = 0;
1894 }
1895
1896 if (!has_technology) {
1897 ast_log(LOG_ERROR, "ARI Bridge missing required field technology\n");
1898 res = 0;
1899 }
1900
1901 return res;
1902}

References ast_ari_validate_date(), ast_ari_validate_list(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_bridges_create_cb(), ast_ari_bridges_create_with_id_cb(), ast_ari_bridges_get_cb(), 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_fn(), ast_ari_validate_bridge_merged(), ast_ari_validate_bridge_video_source_changed(), ast_ari_validate_channel_entered_bridge(), ast_ari_validate_channel_left_bridge(), and ast_ari_validate_channel_userevent().

◆ ast_ari_validate_bridge_attended_transfer()

int ast_ari_validate_bridge_attended_transfer ( struct ast_json json)

Validator for BridgeAttendedTransfer.

Notification that an attended transfer has occurred.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 2638 of file ari_model_validators.c.

2639{
2640 int res = 1;
2641 struct ast_json_iter *iter;
2642 int has_type = 0;
2643 int has_application = 0;
2644 int has_timestamp = 0;
2645 int has_destination_type = 0;
2646 int has_is_external = 0;
2647 int has_result = 0;
2648 int has_transferer_first_leg = 0;
2649 int has_transferer_second_leg = 0;
2650
2651 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2652 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2653 int prop_is_valid;
2654 prop_is_valid = ast_ari_validate_string(
2656 if (!prop_is_valid) {
2657 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field asterisk_id failed validation\n");
2658 res = 0;
2659 }
2660 } else
2661 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2662 int prop_is_valid;
2663 has_type = 1;
2664 prop_is_valid = ast_ari_validate_string(
2666 if (!prop_is_valid) {
2667 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field type failed validation\n");
2668 res = 0;
2669 }
2670 } else
2671 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2672 int prop_is_valid;
2673 has_application = 1;
2674 prop_is_valid = ast_ari_validate_string(
2676 if (!prop_is_valid) {
2677 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field application failed validation\n");
2678 res = 0;
2679 }
2680 } else
2681 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2682 int prop_is_valid;
2683 has_timestamp = 1;
2684 prop_is_valid = ast_ari_validate_date(
2686 if (!prop_is_valid) {
2687 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field timestamp failed validation\n");
2688 res = 0;
2689 }
2690 } else
2691 if (strcmp("destination_application", ast_json_object_iter_key(iter)) == 0) {
2692 int prop_is_valid;
2693 prop_is_valid = ast_ari_validate_string(
2695 if (!prop_is_valid) {
2696 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_application failed validation\n");
2697 res = 0;
2698 }
2699 } else
2700 if (strcmp("destination_bridge", ast_json_object_iter_key(iter)) == 0) {
2701 int prop_is_valid;
2702 prop_is_valid = ast_ari_validate_string(
2704 if (!prop_is_valid) {
2705 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_bridge failed validation\n");
2706 res = 0;
2707 }
2708 } else
2709 if (strcmp("destination_link_first_leg", ast_json_object_iter_key(iter)) == 0) {
2710 int prop_is_valid;
2711 prop_is_valid = ast_ari_validate_channel(
2713 if (!prop_is_valid) {
2714 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_link_first_leg failed validation\n");
2715 res = 0;
2716 }
2717 } else
2718 if (strcmp("destination_link_second_leg", ast_json_object_iter_key(iter)) == 0) {
2719 int prop_is_valid;
2720 prop_is_valid = ast_ari_validate_channel(
2722 if (!prop_is_valid) {
2723 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_link_second_leg failed validation\n");
2724 res = 0;
2725 }
2726 } else
2727 if (strcmp("destination_threeway_bridge", ast_json_object_iter_key(iter)) == 0) {
2728 int prop_is_valid;
2729 prop_is_valid = ast_ari_validate_bridge(
2731 if (!prop_is_valid) {
2732 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_threeway_bridge failed validation\n");
2733 res = 0;
2734 }
2735 } else
2736 if (strcmp("destination_threeway_channel", ast_json_object_iter_key(iter)) == 0) {
2737 int prop_is_valid;
2738 prop_is_valid = ast_ari_validate_channel(
2740 if (!prop_is_valid) {
2741 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_threeway_channel failed validation\n");
2742 res = 0;
2743 }
2744 } else
2745 if (strcmp("destination_type", ast_json_object_iter_key(iter)) == 0) {
2746 int prop_is_valid;
2747 has_destination_type = 1;
2748 prop_is_valid = ast_ari_validate_string(
2750 if (!prop_is_valid) {
2751 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_type failed validation\n");
2752 res = 0;
2753 }
2754 } else
2755 if (strcmp("is_external", ast_json_object_iter_key(iter)) == 0) {
2756 int prop_is_valid;
2757 has_is_external = 1;
2758 prop_is_valid = ast_ari_validate_boolean(
2760 if (!prop_is_valid) {
2761 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field is_external failed validation\n");
2762 res = 0;
2763 }
2764 } else
2765 if (strcmp("replace_channel", ast_json_object_iter_key(iter)) == 0) {
2766 int prop_is_valid;
2767 prop_is_valid = ast_ari_validate_channel(
2769 if (!prop_is_valid) {
2770 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field replace_channel failed validation\n");
2771 res = 0;
2772 }
2773 } else
2774 if (strcmp("result", ast_json_object_iter_key(iter)) == 0) {
2775 int prop_is_valid;
2776 has_result = 1;
2777 prop_is_valid = ast_ari_validate_string(
2779 if (!prop_is_valid) {
2780 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field result failed validation\n");
2781 res = 0;
2782 }
2783 } else
2784 if (strcmp("transfer_target", ast_json_object_iter_key(iter)) == 0) {
2785 int prop_is_valid;
2786 prop_is_valid = ast_ari_validate_channel(
2788 if (!prop_is_valid) {
2789 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transfer_target failed validation\n");
2790 res = 0;
2791 }
2792 } else
2793 if (strcmp("transferee", ast_json_object_iter_key(iter)) == 0) {
2794 int prop_is_valid;
2795 prop_is_valid = ast_ari_validate_channel(
2797 if (!prop_is_valid) {
2798 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferee failed validation\n");
2799 res = 0;
2800 }
2801 } else
2802 if (strcmp("transferer_first_leg", ast_json_object_iter_key(iter)) == 0) {
2803 int prop_is_valid;
2804 has_transferer_first_leg = 1;
2805 prop_is_valid = ast_ari_validate_channel(
2807 if (!prop_is_valid) {
2808 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_first_leg failed validation\n");
2809 res = 0;
2810 }
2811 } else
2812 if (strcmp("transferer_first_leg_bridge", ast_json_object_iter_key(iter)) == 0) {
2813 int prop_is_valid;
2814 prop_is_valid = ast_ari_validate_bridge(
2816 if (!prop_is_valid) {
2817 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_first_leg_bridge failed validation\n");
2818 res = 0;
2819 }
2820 } else
2821 if (strcmp("transferer_second_leg", ast_json_object_iter_key(iter)) == 0) {
2822 int prop_is_valid;
2823 has_transferer_second_leg = 1;
2824 prop_is_valid = ast_ari_validate_channel(
2826 if (!prop_is_valid) {
2827 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_second_leg failed validation\n");
2828 res = 0;
2829 }
2830 } else
2831 if (strcmp("transferer_second_leg_bridge", ast_json_object_iter_key(iter)) == 0) {
2832 int prop_is_valid;
2833 prop_is_valid = ast_ari_validate_bridge(
2835 if (!prop_is_valid) {
2836 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_second_leg_bridge failed validation\n");
2837 res = 0;
2838 }
2839 } else
2840 {
2842 "ARI BridgeAttendedTransfer has undocumented field %s\n",
2844 res = 0;
2845 }
2846 }
2847
2848 if (!has_type) {
2849 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field type\n");
2850 res = 0;
2851 }
2852
2853 if (!has_application) {
2854 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field application\n");
2855 res = 0;
2856 }
2857
2858 if (!has_timestamp) {
2859 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field timestamp\n");
2860 res = 0;
2861 }
2862
2863 if (!has_destination_type) {
2864 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field destination_type\n");
2865 res = 0;
2866 }
2867
2868 if (!has_is_external) {
2869 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field is_external\n");
2870 res = 0;
2871 }
2872
2873 if (!has_result) {
2874 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field result\n");
2875 res = 0;
2876 }
2877
2878 if (!has_transferer_first_leg) {
2879 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field transferer_first_leg\n");
2880 res = 0;
2881 }
2882
2883 if (!has_transferer_second_leg) {
2884 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field transferer_second_leg\n");
2885 res = 0;
2886 }
2887
2888 return res;
2889}
int ast_ari_validate_bridge(struct ast_json *json)
Validator for Bridge.
int ast_ari_validate_boolean(struct ast_json *json)
Validator for native Swagger boolean.

References ast_ari_validate_boolean(), ast_ari_validate_bridge(), ast_ari_validate_channel(), ast_ari_validate_date(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_bridge_attended_transfer_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_bridge_attended_transfer_fn()

ari_validator ast_ari_validate_bridge_attended_transfer_fn ( void  )

Function pointer to ast_ari_validate_bridge_attended_transfer().

Definition at line 2891 of file ari_model_validators.c.

2892{
2894}
int ast_ari_validate_bridge_attended_transfer(struct ast_json *json)
Validator for BridgeAttendedTransfer.

References ast_ari_validate_bridge_attended_transfer().

◆ ast_ari_validate_bridge_blind_transfer()

int ast_ari_validate_bridge_blind_transfer ( struct ast_json json)

Validator for BridgeBlindTransfer.

Notification that a blind transfer has occurred.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 2896 of file ari_model_validators.c.

2897{
2898 int res = 1;
2899 struct ast_json_iter *iter;
2900 int has_type = 0;
2901 int has_application = 0;
2902 int has_timestamp = 0;
2903 int has_channel = 0;
2904 int has_context = 0;
2905 int has_exten = 0;
2906 int has_is_external = 0;
2907 int has_result = 0;
2908
2909 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2910 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2911 int prop_is_valid;
2912 prop_is_valid = ast_ari_validate_string(
2914 if (!prop_is_valid) {
2915 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field asterisk_id failed validation\n");
2916 res = 0;
2917 }
2918 } else
2919 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2920 int prop_is_valid;
2921 has_type = 1;
2922 prop_is_valid = ast_ari_validate_string(
2924 if (!prop_is_valid) {
2925 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field type failed validation\n");
2926 res = 0;
2927 }
2928 } else
2929 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2930 int prop_is_valid;
2931 has_application = 1;
2932 prop_is_valid = ast_ari_validate_string(
2934 if (!prop_is_valid) {
2935 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field application failed validation\n");
2936 res = 0;
2937 }
2938 } else
2939 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2940 int prop_is_valid;
2941 has_timestamp = 1;
2942 prop_is_valid = ast_ari_validate_date(
2944 if (!prop_is_valid) {
2945 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field timestamp failed validation\n");
2946 res = 0;
2947 }
2948 } else
2949 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2950 int prop_is_valid;
2951 prop_is_valid = ast_ari_validate_bridge(
2953 if (!prop_is_valid) {
2954 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field bridge failed validation\n");
2955 res = 0;
2956 }
2957 } else
2958 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2959 int prop_is_valid;
2960 has_channel = 1;
2961 prop_is_valid = ast_ari_validate_channel(
2963 if (!prop_is_valid) {
2964 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field channel failed validation\n");
2965 res = 0;
2966 }
2967 } else
2968 if (strcmp("context", ast_json_object_iter_key(iter)) == 0) {
2969 int prop_is_valid;
2970 has_context = 1;
2971 prop_is_valid = ast_ari_validate_string(
2973 if (!prop_is_valid) {
2974 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field context failed validation\n");
2975 res = 0;
2976 }
2977 } else
2978 if (strcmp("exten", ast_json_object_iter_key(iter)) == 0) {
2979 int prop_is_valid;
2980 has_exten = 1;
2981 prop_is_valid = ast_ari_validate_string(
2983 if (!prop_is_valid) {
2984 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field exten failed validation\n");
2985 res = 0;
2986 }
2987 } else
2988 if (strcmp("is_external", ast_json_object_iter_key(iter)) == 0) {
2989 int prop_is_valid;
2990 has_is_external = 1;
2991 prop_is_valid = ast_ari_validate_boolean(
2993 if (!prop_is_valid) {
2994 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field is_external failed validation\n");
2995 res = 0;
2996 }
2997 } else
2998 if (strcmp("replace_channel", ast_json_object_iter_key(iter)) == 0) {
2999 int prop_is_valid;
3000 prop_is_valid = ast_ari_validate_channel(
3002 if (!prop_is_valid) {
3003 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field replace_channel failed validation\n");
3004 res = 0;
3005 }
3006 } else
3007 if (strcmp("result", ast_json_object_iter_key(iter)) == 0) {
3008 int prop_is_valid;
3009 has_result = 1;
3010 prop_is_valid = ast_ari_validate_string(
3012 if (!prop_is_valid) {
3013 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field result failed validation\n");
3014 res = 0;
3015 }
3016 } else
3017 if (strcmp("transferee", ast_json_object_iter_key(iter)) == 0) {
3018 int prop_is_valid;
3019 prop_is_valid = ast_ari_validate_channel(
3021 if (!prop_is_valid) {
3022 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field transferee failed validation\n");
3023 res = 0;
3024 }
3025 } else
3026 {
3028 "ARI BridgeBlindTransfer has undocumented field %s\n",
3030 res = 0;
3031 }
3032 }
3033
3034 if (!has_type) {
3035 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field type\n");
3036 res = 0;
3037 }
3038
3039 if (!has_application) {
3040 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field application\n");
3041 res = 0;
3042 }
3043
3044 if (!has_timestamp) {
3045 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field timestamp\n");
3046 res = 0;
3047 }
3048
3049 if (!has_channel) {
3050 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field channel\n");
3051 res = 0;
3052 }
3053
3054 if (!has_context) {
3055 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field context\n");
3056 res = 0;
3057 }
3058
3059 if (!has_exten) {
3060 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field exten\n");
3061 res = 0;
3062 }
3063
3064 if (!has_is_external) {
3065 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field is_external\n");
3066 res = 0;
3067 }
3068
3069 if (!has_result) {
3070 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field result\n");
3071 res = 0;
3072 }
3073
3074 return res;
3075}

References ast_ari_validate_boolean(), ast_ari_validate_bridge(), ast_ari_validate_channel(), ast_ari_validate_date(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_bridge_blind_transfer_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_bridge_blind_transfer_fn()

ari_validator ast_ari_validate_bridge_blind_transfer_fn ( void  )

Function pointer to ast_ari_validate_bridge_blind_transfer().

Definition at line 3077 of file ari_model_validators.c.

3078{
3080}
int ast_ari_validate_bridge_blind_transfer(struct ast_json *json)
Validator for BridgeBlindTransfer.

References ast_ari_validate_bridge_blind_transfer().

◆ ast_ari_validate_bridge_created()

int ast_ari_validate_bridge_created ( struct ast_json json)

Validator for BridgeCreated.

Notification that a bridge has been created.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 3082 of file ari_model_validators.c.

3083{
3084 int res = 1;
3085 struct ast_json_iter *iter;
3086 int has_type = 0;
3087 int has_application = 0;
3088 int has_timestamp = 0;
3089 int has_bridge = 0;
3090
3091 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3092 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3093 int prop_is_valid;
3094 prop_is_valid = ast_ari_validate_string(
3096 if (!prop_is_valid) {
3097 ast_log(LOG_ERROR, "ARI BridgeCreated field asterisk_id failed validation\n");
3098 res = 0;
3099 }
3100 } else
3101 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3102 int prop_is_valid;
3103 has_type = 1;
3104 prop_is_valid = ast_ari_validate_string(
3106 if (!prop_is_valid) {
3107 ast_log(LOG_ERROR, "ARI BridgeCreated field type failed validation\n");
3108 res = 0;
3109 }
3110 } else
3111 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3112 int prop_is_valid;
3113 has_application = 1;
3114 prop_is_valid = ast_ari_validate_string(
3116 if (!prop_is_valid) {
3117 ast_log(LOG_ERROR, "ARI BridgeCreated field application failed validation\n");
3118 res = 0;
3119 }
3120 } else
3121 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3122 int prop_is_valid;
3123 has_timestamp = 1;
3124 prop_is_valid = ast_ari_validate_date(
3126 if (!prop_is_valid) {
3127 ast_log(LOG_ERROR, "ARI BridgeCreated field timestamp failed validation\n");
3128 res = 0;
3129 }
3130 } else
3131 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
3132 int prop_is_valid;
3133 has_bridge = 1;
3134 prop_is_valid = ast_ari_validate_bridge(
3136 if (!prop_is_valid) {
3137 ast_log(LOG_ERROR, "ARI BridgeCreated field bridge failed validation\n");
3138 res = 0;
3139 }
3140 } else
3141 {
3143 "ARI BridgeCreated has undocumented field %s\n",
3145 res = 0;
3146 }
3147 }
3148
3149 if (!has_type) {
3150 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field type\n");
3151 res = 0;
3152 }
3153
3154 if (!has_application) {
3155 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field application\n");
3156 res = 0;
3157 }
3158
3159 if (!has_timestamp) {
3160 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field timestamp\n");
3161 res = 0;
3162 }
3163
3164 if (!has_bridge) {
3165 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field bridge\n");
3166 res = 0;
3167 }
3168
3169 return res;
3170}

References ast_ari_validate_bridge(), ast_ari_validate_date(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_bridge_created_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_bridge_created_fn()

ari_validator ast_ari_validate_bridge_created_fn ( void  )

Function pointer to ast_ari_validate_bridge_created().

Definition at line 3172 of file ari_model_validators.c.

3173{
3175}
int ast_ari_validate_bridge_created(struct ast_json *json)
Validator for BridgeCreated.

References ast_ari_validate_bridge_created().

◆ ast_ari_validate_bridge_destroyed()

int ast_ari_validate_bridge_destroyed ( struct ast_json json)

Validator for BridgeDestroyed.

Notification that a bridge has been destroyed.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 3177 of file ari_model_validators.c.

3178{
3179 int res = 1;
3180 struct ast_json_iter *iter;
3181 int has_type = 0;
3182 int has_application = 0;
3183 int has_timestamp = 0;
3184 int has_bridge = 0;
3185
3186 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3187 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3188 int prop_is_valid;
3189 prop_is_valid = ast_ari_validate_string(
3191 if (!prop_is_valid) {
3192 ast_log(LOG_ERROR, "ARI BridgeDestroyed field asterisk_id failed validation\n");
3193 res = 0;
3194 }
3195 } else
3196 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3197 int prop_is_valid;
3198 has_type = 1;
3199 prop_is_valid = ast_ari_validate_string(
3201 if (!prop_is_valid) {
3202 ast_log(LOG_ERROR, "ARI BridgeDestroyed field type failed validation\n");
3203 res = 0;
3204 }
3205 } else
3206 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3207 int prop_is_valid;
3208 has_application = 1;
3209 prop_is_valid = ast_ari_validate_string(
3211 if (!prop_is_valid) {
3212 ast_log(LOG_ERROR, "ARI BridgeDestroyed field application failed validation\n");
3213 res = 0;
3214 }
3215 } else
3216 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3217 int prop_is_valid;
3218 has_timestamp = 1;
3219 prop_is_valid = ast_ari_validate_date(
3221 if (!prop_is_valid) {
3222 ast_log(LOG_ERROR, "ARI BridgeDestroyed field timestamp failed validation\n");
3223 res = 0;
3224 }
3225 } else
3226 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
3227 int prop_is_valid;
3228 has_bridge = 1;
3229 prop_is_valid = ast_ari_validate_bridge(
3231 if (!prop_is_valid) {
3232 ast_log(LOG_ERROR, "ARI BridgeDestroyed field bridge failed validation\n");
3233 res = 0;
3234 }
3235 } else
3236 {
3238 "ARI BridgeDestroyed has undocumented field %s\n",
3240 res = 0;
3241 }
3242 }
3243
3244 if (!has_type) {
3245 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field type\n");
3246 res = 0;
3247 }
3248
3249 if (!has_application) {
3250 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field application\n");
3251 res = 0;
3252 }
3253
3254 if (!has_timestamp) {
3255 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field timestamp\n");
3256 res = 0;
3257 }
3258
3259 if (!has_bridge) {
3260 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field bridge\n");
3261 res = 0;
3262 }
3263
3264 return res;
3265}

References ast_ari_validate_bridge(), ast_ari_validate_date(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_bridge_destroyed_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_bridge_destroyed_fn()

ari_validator ast_ari_validate_bridge_destroyed_fn ( void  )

Function pointer to ast_ari_validate_bridge_destroyed().

Definition at line 3267 of file ari_model_validators.c.

3268{
3270}
int ast_ari_validate_bridge_destroyed(struct ast_json *json)
Validator for BridgeDestroyed.

References ast_ari_validate_bridge_destroyed().

◆ ast_ari_validate_bridge_fn()

ari_validator ast_ari_validate_bridge_fn ( void  )

Function pointer to ast_ari_validate_bridge().

Definition at line 1904 of file ari_model_validators.c.

1905{
1907}

References ast_ari_validate_bridge().

Referenced by ast_ari_bridges_list_cb().

◆ ast_ari_validate_bridge_merged()

int ast_ari_validate_bridge_merged ( struct ast_json json)

Validator for BridgeMerged.

Notification that one bridge has merged into another.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 3272 of file ari_model_validators.c.

3273{
3274 int res = 1;
3275 struct ast_json_iter *iter;
3276 int has_type = 0;
3277 int has_application = 0;
3278 int has_timestamp = 0;
3279 int has_bridge = 0;
3280 int has_bridge_from = 0;
3281
3282 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3283 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3284 int prop_is_valid;
3285 prop_is_valid = ast_ari_validate_string(
3287 if (!prop_is_valid) {
3288 ast_log(LOG_ERROR, "ARI BridgeMerged field asterisk_id failed validation\n");
3289 res = 0;
3290 }
3291 } else
3292 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3293 int prop_is_valid;
3294 has_type = 1;
3295 prop_is_valid = ast_ari_validate_string(
3297 if (!prop_is_valid) {
3298 ast_log(LOG_ERROR, "ARI BridgeMerged field type failed validation\n");
3299 res = 0;
3300 }
3301 } else
3302 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3303 int prop_is_valid;
3304 has_application = 1;
3305 prop_is_valid = ast_ari_validate_string(
3307 if (!prop_is_valid) {
3308 ast_log(LOG_ERROR, "ARI BridgeMerged field application failed validation\n");
3309 res = 0;
3310 }
3311 } else
3312 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3313 int prop_is_valid;
3314 has_timestamp = 1;
3315 prop_is_valid = ast_ari_validate_date(
3317 if (!prop_is_valid) {
3318 ast_log(LOG_ERROR, "ARI BridgeMerged field timestamp failed validation\n");
3319 res = 0;
3320 }
3321 } else
3322 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
3323 int prop_is_valid;
3324 has_bridge = 1;
3325 prop_is_valid = ast_ari_validate_bridge(
3327 if (!prop_is_valid) {
3328 ast_log(LOG_ERROR, "ARI BridgeMerged field bridge failed validation\n");
3329 res = 0;
3330 }
3331 } else
3332 if (strcmp("bridge_from", ast_json_object_iter_key(iter)) == 0) {
3333 int prop_is_valid;
3334 has_bridge_from = 1;
3335 prop_is_valid = ast_ari_validate_bridge(
3337 if (!prop_is_valid) {
3338 ast_log(LOG_ERROR, "ARI BridgeMerged field bridge_from failed validation\n");
3339 res = 0;
3340 }
3341 } else
3342 {
3344 "ARI BridgeMerged has undocumented field %s\n",
3346 res = 0;
3347 }
3348 }
3349
3350 if (!has_type) {
3351 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field type\n");
3352 res = 0;
3353 }
3354
3355 if (!has_application) {
3356 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field application\n");
3357 res = 0;
3358 }
3359
3360 if (!has_timestamp) {
3361 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field timestamp\n");
3362 res = 0;
3363 }
3364
3365 if (!has_bridge) {
3366 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge\n");
3367 res = 0;
3368 }
3369
3370 if (!has_bridge_from) {
3371 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge_from\n");
3372 res = 0;
3373 }
3374
3375 return res;
3376}

References ast_ari_validate_bridge(), ast_ari_validate_date(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_bridge_merged_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_bridge_merged_fn()

ari_validator ast_ari_validate_bridge_merged_fn ( void  )

Function pointer to ast_ari_validate_bridge_merged().

Definition at line 3378 of file ari_model_validators.c.

3379{
3381}
int ast_ari_validate_bridge_merged(struct ast_json *json)
Validator for BridgeMerged.

References ast_ari_validate_bridge_merged().

◆ ast_ari_validate_bridge_video_source_changed()

int ast_ari_validate_bridge_video_source_changed ( struct ast_json json)

Validator for BridgeVideoSourceChanged.

Notification that the source of video in a bridge has changed.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 3383 of file ari_model_validators.c.

3384{
3385 int res = 1;
3386 struct ast_json_iter *iter;
3387 int has_type = 0;
3388 int has_application = 0;
3389 int has_timestamp = 0;
3390 int has_bridge = 0;
3391
3392 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3393 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3394 int prop_is_valid;
3395 prop_is_valid = ast_ari_validate_string(
3397 if (!prop_is_valid) {
3398 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field asterisk_id failed validation\n");
3399 res = 0;
3400 }
3401 } else
3402 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3403 int prop_is_valid;
3404 has_type = 1;
3405 prop_is_valid = ast_ari_validate_string(
3407 if (!prop_is_valid) {
3408 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field type failed validation\n");
3409 res = 0;
3410 }
3411 } else
3412 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3413 int prop_is_valid;
3414 has_application = 1;
3415 prop_is_valid = ast_ari_validate_string(
3417 if (!prop_is_valid) {
3418 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field application failed validation\n");
3419 res = 0;
3420 }
3421 } else
3422 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3423 int prop_is_valid;
3424 has_timestamp = 1;
3425 prop_is_valid = ast_ari_validate_date(
3427 if (!prop_is_valid) {
3428 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field timestamp failed validation\n");
3429 res = 0;
3430 }
3431 } else
3432 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
3433 int prop_is_valid;
3434 has_bridge = 1;
3435 prop_is_valid = ast_ari_validate_bridge(
3437 if (!prop_is_valid) {
3438 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field bridge failed validation\n");
3439 res = 0;
3440 }
3441 } else
3442 if (strcmp("old_video_source_id", ast_json_object_iter_key(iter)) == 0) {
3443 int prop_is_valid;
3444 prop_is_valid = ast_ari_validate_string(
3446 if (!prop_is_valid) {
3447 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field old_video_source_id failed validation\n");
3448 res = 0;
3449 }
3450 } else
3451 {
3453 "ARI BridgeVideoSourceChanged has undocumented field %s\n",
3455 res = 0;
3456 }
3457 }
3458
3459 if (!has_type) {
3460 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged missing required field type\n");
3461 res = 0;
3462 }
3463
3464 if (!has_application) {
3465 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged missing required field application\n");
3466 res = 0;
3467 }
3468
3469 if (!has_timestamp) {
3470 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged missing required field timestamp\n");
3471 res = 0;
3472 }
3473
3474 if (!has_bridge) {
3475 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged missing required field bridge\n");
3476 res = 0;
3477 }
3478
3479 return res;
3480}

References ast_ari_validate_bridge(), ast_ari_validate_date(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_bridge_video_source_changed_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_bridge_video_source_changed_fn()

ari_validator ast_ari_validate_bridge_video_source_changed_fn ( void  )

Function pointer to ast_ari_validate_bridge_video_source_changed().

Definition at line 3482 of file ari_model_validators.c.

3483{
3485}
int ast_ari_validate_bridge_video_source_changed(struct ast_json *json)
Validator for BridgeVideoSourceChanged.

References ast_ari_validate_bridge_video_source_changed().

◆ ast_ari_validate_build_info()

int ast_ari_validate_build_info ( struct ast_json json)

Validator for BuildInfo.

Info about how Asterisk was built

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 164 of file ari_model_validators.c.

165{
166 int res = 1;
167 struct ast_json_iter *iter;
168 int has_date = 0;
169 int has_kernel = 0;
170 int has_machine = 0;
171 int has_options = 0;
172 int has_os = 0;
173 int has_user = 0;
174
175 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
176 if (strcmp("date", ast_json_object_iter_key(iter)) == 0) {
177 int prop_is_valid;
178 has_date = 1;
179 prop_is_valid = ast_ari_validate_string(
181 if (!prop_is_valid) {
182 ast_log(LOG_ERROR, "ARI BuildInfo field date failed validation\n");
183 res = 0;
184 }
185 } else
186 if (strcmp("kernel", ast_json_object_iter_key(iter)) == 0) {
187 int prop_is_valid;
188 has_kernel = 1;
189 prop_is_valid = ast_ari_validate_string(
191 if (!prop_is_valid) {
192 ast_log(LOG_ERROR, "ARI BuildInfo field kernel failed validation\n");
193 res = 0;
194 }
195 } else
196 if (strcmp("machine", ast_json_object_iter_key(iter)) == 0) {
197 int prop_is_valid;
198 has_machine = 1;
199 prop_is_valid = ast_ari_validate_string(
201 if (!prop_is_valid) {
202 ast_log(LOG_ERROR, "ARI BuildInfo field machine failed validation\n");
203 res = 0;
204 }
205 } else
206 if (strcmp("options", ast_json_object_iter_key(iter)) == 0) {
207 int prop_is_valid;
208 has_options = 1;
209 prop_is_valid = ast_ari_validate_string(
211 if (!prop_is_valid) {
212 ast_log(LOG_ERROR, "ARI BuildInfo field options failed validation\n");
213 res = 0;
214 }
215 } else
216 if (strcmp("os", ast_json_object_iter_key(iter)) == 0) {
217 int prop_is_valid;
218 has_os = 1;
219 prop_is_valid = ast_ari_validate_string(
221 if (!prop_is_valid) {
222 ast_log(LOG_ERROR, "ARI BuildInfo field os failed validation\n");
223 res = 0;
224 }
225 } else
226 if (strcmp("user", ast_json_object_iter_key(iter)) == 0) {
227 int prop_is_valid;
228 has_user = 1;
229 prop_is_valid = ast_ari_validate_string(
231 if (!prop_is_valid) {
232 ast_log(LOG_ERROR, "ARI BuildInfo field user failed validation\n");
233 res = 0;
234 }
235 } else
236 {
238 "ARI BuildInfo has undocumented field %s\n",
240 res = 0;
241 }
242 }
243
244 if (!has_date) {
245 ast_log(LOG_ERROR, "ARI BuildInfo missing required field date\n");
246 res = 0;
247 }
248
249 if (!has_kernel) {
250 ast_log(LOG_ERROR, "ARI BuildInfo missing required field kernel\n");
251 res = 0;
252 }
253
254 if (!has_machine) {
255 ast_log(LOG_ERROR, "ARI BuildInfo missing required field machine\n");
256 res = 0;
257 }
258
259 if (!has_options) {
260 ast_log(LOG_ERROR, "ARI BuildInfo missing required field options\n");
261 res = 0;
262 }
263
264 if (!has_os) {
265 ast_log(LOG_ERROR, "ARI BuildInfo missing required field os\n");
266 res = 0;
267 }
268
269 if (!has_user) {
270 ast_log(LOG_ERROR, "ARI BuildInfo missing required field user\n");
271 res = 0;
272 }
273
274 return res;
275}

References ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_asterisk_info(), and ast_ari_validate_build_info_fn().

◆ ast_ari_validate_build_info_fn()

ari_validator ast_ari_validate_build_info_fn ( void  )

Function pointer to ast_ari_validate_build_info().

Definition at line 277 of file ari_model_validators.c.

278{
280}

References ast_ari_validate_build_info().

◆ ast_ari_validate_caller_id()

int ast_ari_validate_caller_id ( struct ast_json json)

Validator for CallerID.

Caller identification

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 980 of file ari_model_validators.c.

981{
982 int res = 1;
983 struct ast_json_iter *iter;
984 int has_name = 0;
985 int has_number = 0;
986
987 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
988 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
989 int prop_is_valid;
990 has_name = 1;
991 prop_is_valid = ast_ari_validate_string(
993 if (!prop_is_valid) {
994 ast_log(LOG_ERROR, "ARI CallerID field name failed validation\n");
995 res = 0;
996 }
997 } else
998 if (strcmp("number", ast_json_object_iter_key(iter)) == 0) {
999 int prop_is_valid;
1000 has_number = 1;
1001 prop_is_valid = ast_ari_validate_string(
1003 if (!prop_is_valid) {
1004 ast_log(LOG_ERROR, "ARI CallerID field number failed validation\n");
1005 res = 0;
1006 }
1007 } else
1008 {
1010 "ARI CallerID has undocumented field %s\n",
1012 res = 0;
1013 }
1014 }
1015
1016 if (!has_name) {
1017 ast_log(LOG_ERROR, "ARI CallerID missing required field name\n");
1018 res = 0;
1019 }
1020
1021 if (!has_number) {
1022 ast_log(LOG_ERROR, "ARI CallerID missing required field number\n");
1023 res = 0;
1024 }
1025
1026 return res;
1027}

References ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_caller_id_fn(), and ast_ari_validate_channel().

◆ ast_ari_validate_caller_id_fn()

ari_validator ast_ari_validate_caller_id_fn ( void  )

Function pointer to ast_ari_validate_caller_id().

Definition at line 1029 of file ari_model_validators.c.

1030{
1032}
int ast_ari_validate_caller_id(struct ast_json *json)
Validator for CallerID.

References ast_ari_validate_caller_id().

◆ ast_ari_validate_channel()

int ast_ari_validate_channel ( struct ast_json json)

Validator for Channel.

A specific communication connection between Asterisk and an Endpoint.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 1034 of file ari_model_validators.c.

1035{
1036 int res = 1;
1037 struct ast_json_iter *iter;
1038 int has_accountcode = 0;
1039 int has_caller = 0;
1040 int has_connected = 0;
1041 int has_creationtime = 0;
1042 int has_dialplan = 0;
1043 int has_id = 0;
1044 int has_language = 0;
1045 int has_name = 0;
1046 int has_protocol_id = 0;
1047 int has_state = 0;
1048
1049 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1050 if (strcmp("accountcode", ast_json_object_iter_key(iter)) == 0) {
1051 int prop_is_valid;
1052 has_accountcode = 1;
1053 prop_is_valid = ast_ari_validate_string(
1055 if (!prop_is_valid) {
1056 ast_log(LOG_ERROR, "ARI Channel field accountcode failed validation\n");
1057 res = 0;
1058 }
1059 } else
1060 if (strcmp("caller", ast_json_object_iter_key(iter)) == 0) {
1061 int prop_is_valid;
1062 has_caller = 1;
1063 prop_is_valid = ast_ari_validate_caller_id(
1065 if (!prop_is_valid) {
1066 ast_log(LOG_ERROR, "ARI Channel field caller failed validation\n");
1067 res = 0;
1068 }
1069 } else
1070 if (strcmp("caller_rdnis", ast_json_object_iter_key(iter)) == 0) {
1071 int prop_is_valid;
1072 prop_is_valid = ast_ari_validate_string(
1074 if (!prop_is_valid) {
1075 ast_log(LOG_ERROR, "ARI Channel field caller_rdnis failed validation\n");
1076 res = 0;
1077 }
1078 } else
1079 if (strcmp("channelvars", ast_json_object_iter_key(iter)) == 0) {
1080 int prop_is_valid;
1081 prop_is_valid = ast_ari_validate_object(
1083 if (!prop_is_valid) {
1084 ast_log(LOG_ERROR, "ARI Channel field channelvars failed validation\n");
1085 res = 0;
1086 }
1087 } else
1088 if (strcmp("connected", ast_json_object_iter_key(iter)) == 0) {
1089 int prop_is_valid;
1090 has_connected = 1;
1091 prop_is_valid = ast_ari_validate_caller_id(
1093 if (!prop_is_valid) {
1094 ast_log(LOG_ERROR, "ARI Channel field connected failed validation\n");
1095 res = 0;
1096 }
1097 } else
1098 if (strcmp("creationtime", ast_json_object_iter_key(iter)) == 0) {
1099 int prop_is_valid;
1100 has_creationtime = 1;
1101 prop_is_valid = ast_ari_validate_date(
1103 if (!prop_is_valid) {
1104 ast_log(LOG_ERROR, "ARI Channel field creationtime failed validation\n");
1105 res = 0;
1106 }
1107 } else
1108 if (strcmp("dialplan", ast_json_object_iter_key(iter)) == 0) {
1109 int prop_is_valid;
1110 has_dialplan = 1;
1111 prop_is_valid = ast_ari_validate_dialplan_cep(
1113 if (!prop_is_valid) {
1114 ast_log(LOG_ERROR, "ARI Channel field dialplan failed validation\n");
1115 res = 0;
1116 }
1117 } else
1118 if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
1119 int prop_is_valid;
1120 has_id = 1;
1121 prop_is_valid = ast_ari_validate_string(
1123 if (!prop_is_valid) {
1124 ast_log(LOG_ERROR, "ARI Channel field id failed validation\n");
1125 res = 0;
1126 }
1127 } else
1128 if (strcmp("language", ast_json_object_iter_key(iter)) == 0) {
1129 int prop_is_valid;
1130 has_language = 1;
1131 prop_is_valid = ast_ari_validate_string(
1133 if (!prop_is_valid) {
1134 ast_log(LOG_ERROR, "ARI Channel field language failed validation\n");
1135 res = 0;
1136 }
1137 } else
1138 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1139 int prop_is_valid;
1140 has_name = 1;
1141 prop_is_valid = ast_ari_validate_string(
1143 if (!prop_is_valid) {
1144 ast_log(LOG_ERROR, "ARI Channel field name failed validation\n");
1145 res = 0;
1146 }
1147 } else
1148 if (strcmp("protocol_id", ast_json_object_iter_key(iter)) == 0) {
1149 int prop_is_valid;
1150 has_protocol_id = 1;
1151 prop_is_valid = ast_ari_validate_string(
1153 if (!prop_is_valid) {
1154 ast_log(LOG_ERROR, "ARI Channel field protocol_id failed validation\n");
1155 res = 0;
1156 }
1157 } else
1158 if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
1159 int prop_is_valid;
1160 has_state = 1;
1161 prop_is_valid = ast_ari_validate_string(
1163 if (!prop_is_valid) {
1164 ast_log(LOG_ERROR, "ARI Channel field state failed validation\n");
1165 res = 0;
1166 }
1167 } else
1168 if (strcmp("tenantid", ast_json_object_iter_key(iter)) == 0) {
1169 int prop_is_valid;
1170 prop_is_valid = ast_ari_validate_string(
1172 if (!prop_is_valid) {
1173 ast_log(LOG_ERROR, "ARI Channel field tenantid failed validation\n");
1174 res = 0;
1175 }
1176 } else
1177 {
1179 "ARI Channel has undocumented field %s\n",
1181 res = 0;
1182 }
1183 }
1184
1185 if (!has_accountcode) {
1186 ast_log(LOG_ERROR, "ARI Channel missing required field accountcode\n");
1187 res = 0;
1188 }
1189
1190 if (!has_caller) {
1191 ast_log(LOG_ERROR, "ARI Channel missing required field caller\n");
1192 res = 0;
1193 }
1194
1195 if (!has_connected) {
1196 ast_log(LOG_ERROR, "ARI Channel missing required field connected\n");
1197 res = 0;
1198 }
1199
1200 if (!has_creationtime) {
1201 ast_log(LOG_ERROR, "ARI Channel missing required field creationtime\n");
1202 res = 0;
1203 }
1204
1205 if (!has_dialplan) {
1206 ast_log(LOG_ERROR, "ARI Channel missing required field dialplan\n");
1207 res = 0;
1208 }
1209
1210 if (!has_id) {
1211 ast_log(LOG_ERROR, "ARI Channel missing required field id\n");
1212 res = 0;
1213 }
1214
1215 if (!has_language) {
1216 ast_log(LOG_ERROR, "ARI Channel missing required field language\n");
1217 res = 0;
1218 }
1219
1220 if (!has_name) {
1221 ast_log(LOG_ERROR, "ARI Channel missing required field name\n");
1222 res = 0;
1223 }
1224
1225 if (!has_protocol_id) {
1226 ast_log(LOG_ERROR, "ARI Channel missing required field protocol_id\n");
1227 res = 0;
1228 }
1229
1230 if (!has_state) {
1231 ast_log(LOG_ERROR, "ARI Channel missing required field state\n");
1232 res = 0;
1233 }
1234
1235 return res;
1236}
int ast_ari_validate_dialplan_cep(struct ast_json *json)
Validator for DialplanCEP.

References ast_ari_validate_caller_id(), ast_ari_validate_date(), ast_ari_validate_dialplan_cep(), ast_ari_validate_object(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_channels_create_cb(), ast_ari_channels_external_media_cb(), ast_ari_channels_get_cb(), ast_ari_channels_originate_cb(), ast_ari_channels_originate_with_id_cb(), ast_ari_channels_snoop_channel_cb(), ast_ari_channels_snoop_channel_with_id_cb(), ast_ari_validate_application_move_failed(), ast_ari_validate_bridge_attended_transfer(), ast_ari_validate_bridge_blind_transfer(), 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_fn(), 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_dial(), ast_ari_validate_stasis_end(), and ast_ari_validate_stasis_start().

◆ ast_ari_validate_channel_caller_id()

int ast_ari_validate_channel_caller_id ( struct ast_json json)

Validator for ChannelCallerId.

Channel changed Caller ID.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 3487 of file ari_model_validators.c.

3488{
3489 int res = 1;
3490 struct ast_json_iter *iter;
3491 int has_type = 0;
3492 int has_application = 0;
3493 int has_timestamp = 0;
3494 int has_caller_presentation = 0;
3495 int has_caller_presentation_txt = 0;
3496 int has_channel = 0;
3497
3498 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3499 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3500 int prop_is_valid;
3501 prop_is_valid = ast_ari_validate_string(
3503 if (!prop_is_valid) {
3504 ast_log(LOG_ERROR, "ARI ChannelCallerId field asterisk_id failed validation\n");
3505 res = 0;
3506 }
3507 } else
3508 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3509 int prop_is_valid;
3510 has_type = 1;
3511 prop_is_valid = ast_ari_validate_string(
3513 if (!prop_is_valid) {
3514 ast_log(LOG_ERROR, "ARI ChannelCallerId field type failed validation\n");
3515 res = 0;
3516 }
3517 } else
3518 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3519 int prop_is_valid;
3520 has_application = 1;
3521 prop_is_valid = ast_ari_validate_string(
3523 if (!prop_is_valid) {
3524 ast_log(LOG_ERROR, "ARI ChannelCallerId field application failed validation\n");
3525 res = 0;
3526 }
3527 } else
3528 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3529 int prop_is_valid;
3530 has_timestamp = 1;
3531 prop_is_valid = ast_ari_validate_date(
3533 if (!prop_is_valid) {
3534 ast_log(LOG_ERROR, "ARI ChannelCallerId field timestamp failed validation\n");
3535 res = 0;
3536 }
3537 } else
3538 if (strcmp("caller_presentation", ast_json_object_iter_key(iter)) == 0) {
3539 int prop_is_valid;
3540 has_caller_presentation = 1;
3541 prop_is_valid = ast_ari_validate_int(
3543 if (!prop_is_valid) {
3544 ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation failed validation\n");
3545 res = 0;
3546 }
3547 } else
3548 if (strcmp("caller_presentation_txt", ast_json_object_iter_key(iter)) == 0) {
3549 int prop_is_valid;
3550 has_caller_presentation_txt = 1;
3551 prop_is_valid = ast_ari_validate_string(
3553 if (!prop_is_valid) {
3554 ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation_txt failed validation\n");
3555 res = 0;
3556 }
3557 } else
3558 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
3559 int prop_is_valid;
3560 has_channel = 1;
3561 prop_is_valid = ast_ari_validate_channel(
3563 if (!prop_is_valid) {
3564 ast_log(LOG_ERROR, "ARI ChannelCallerId field channel failed validation\n");
3565 res = 0;
3566 }
3567 } else
3568 {
3570 "ARI ChannelCallerId has undocumented field %s\n",
3572 res = 0;
3573 }
3574 }
3575
3576 if (!has_type) {
3577 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field type\n");
3578 res = 0;
3579 }
3580
3581 if (!has_application) {
3582 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field application\n");
3583 res = 0;
3584 }
3585
3586 if (!has_timestamp) {
3587 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field timestamp\n");
3588 res = 0;
3589 }
3590
3591 if (!has_caller_presentation) {
3592 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation\n");
3593 res = 0;
3594 }
3595
3596 if (!has_caller_presentation_txt) {
3597 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation_txt\n");
3598 res = 0;
3599 }
3600
3601 if (!has_channel) {
3602 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field channel\n");
3603 res = 0;
3604 }
3605
3606 return res;
3607}
int ast_ari_validate_int(struct ast_json *json)
Validator for native Swagger int.

References ast_ari_validate_channel(), ast_ari_validate_date(), ast_ari_validate_int(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_channel_caller_id_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_channel_caller_id_fn()

ari_validator ast_ari_validate_channel_caller_id_fn ( void  )

Function pointer to ast_ari_validate_channel_caller_id().

Definition at line 3609 of file ari_model_validators.c.

3610{
3612}
int ast_ari_validate_channel_caller_id(struct ast_json *json)
Validator for ChannelCallerId.

References ast_ari_validate_channel_caller_id().

◆ ast_ari_validate_channel_connected_line()

int ast_ari_validate_channel_connected_line ( struct ast_json json)

Validator for ChannelConnectedLine.

Channel changed Connected Line.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 3614 of file ari_model_validators.c.

3615{
3616 int res = 1;
3617 struct ast_json_iter *iter;
3618 int has_type = 0;
3619 int has_application = 0;
3620 int has_timestamp = 0;
3621 int has_channel = 0;
3622
3623 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3624 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3625 int prop_is_valid;
3626 prop_is_valid = ast_ari_validate_string(
3628 if (!prop_is_valid) {
3629 ast_log(LOG_ERROR, "ARI ChannelConnectedLine field asterisk_id failed validation\n");
3630 res = 0;
3631 }
3632 } else
3633 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3634 int prop_is_valid;
3635 has_type = 1;
3636 prop_is_valid = ast_ari_validate_string(
3638 if (!prop_is_valid) {
3639 ast_log(LOG_ERROR, "ARI ChannelConnectedLine field type failed validation\n");
3640 res = 0;
3641 }
3642 } else
3643 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3644 int prop_is_valid;
3645 has_application = 1;
3646 prop_is_valid = ast_ari_validate_string(
3648 if (!prop_is_valid) {
3649 ast_log(LOG_ERROR, "ARI ChannelConnectedLine field application failed validation\n");
3650 res = 0;
3651 }
3652 } else
3653 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3654 int prop_is_valid;
3655 has_timestamp = 1;
3656 prop_is_valid = ast_ari_validate_date(
3658 if (!prop_is_valid) {
3659 ast_log(LOG_ERROR, "ARI ChannelConnectedLine field timestamp failed validation\n");
3660 res = 0;
3661 }
3662 } else
3663 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
3664 int prop_is_valid;
3665 has_channel = 1;
3666 prop_is_valid = ast_ari_validate_channel(
3668 if (!prop_is_valid) {
3669 ast_log(LOG_ERROR, "ARI ChannelConnectedLine field channel failed validation\n");
3670 res = 0;
3671 }
3672 } else
3673 {
3675 "ARI ChannelConnectedLine has undocumented field %s\n",
3677 res = 0;
3678 }
3679 }
3680
3681 if (!has_type) {
3682 ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field type\n");
3683 res = 0;
3684 }
3685
3686 if (!has_application) {
3687 ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field application\n");
3688 res = 0;
3689 }
3690
3691 if (!has_timestamp) {
3692 ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field timestamp\n");
3693 res = 0;
3694 }
3695
3696 if (!has_channel) {
3697 ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field channel\n");
3698 res = 0;
3699 }
3700
3701 return res;
3702}

References ast_ari_validate_channel(), ast_ari_validate_date(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_channel_connected_line_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_channel_connected_line_fn()

ari_validator ast_ari_validate_channel_connected_line_fn ( void  )

Function pointer to ast_ari_validate_channel_connected_line().

Definition at line 3704 of file ari_model_validators.c.

3705{
3707}
int ast_ari_validate_channel_connected_line(struct ast_json *json)
Validator for ChannelConnectedLine.

References ast_ari_validate_channel_connected_line().

◆ ast_ari_validate_channel_created()

int ast_ari_validate_channel_created ( struct ast_json json)

Validator for ChannelCreated.

Notification that a channel has been created.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 3709 of file ari_model_validators.c.

3710{
3711 int res = 1;
3712 struct ast_json_iter *iter;
3713 int has_type = 0;
3714 int has_application = 0;
3715 int has_timestamp = 0;
3716 int has_channel = 0;
3717
3718 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3719 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3720 int prop_is_valid;
3721 prop_is_valid = ast_ari_validate_string(
3723 if (!prop_is_valid) {
3724 ast_log(LOG_ERROR, "ARI ChannelCreated field asterisk_id failed validation\n");
3725 res = 0;
3726 }
3727 } else
3728 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3729 int prop_is_valid;
3730 has_type = 1;
3731 prop_is_valid = ast_ari_validate_string(
3733 if (!prop_is_valid) {
3734 ast_log(LOG_ERROR, "ARI ChannelCreated field type failed validation\n");
3735 res = 0;
3736 }
3737 } else
3738 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3739 int prop_is_valid;
3740 has_application = 1;
3741 prop_is_valid = ast_ari_validate_string(
3743 if (!prop_is_valid) {
3744 ast_log(LOG_ERROR, "ARI ChannelCreated field application failed validation\n");
3745 res = 0;
3746 }
3747 } else
3748 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3749 int prop_is_valid;
3750 has_timestamp = 1;
3751 prop_is_valid = ast_ari_validate_date(
3753 if (!prop_is_valid) {
3754 ast_log(LOG_ERROR, "ARI ChannelCreated field timestamp failed validation\n");
3755 res = 0;
3756 }
3757 } else
3758 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
3759 int prop_is_valid;
3760 has_channel = 1;
3761 prop_is_valid = ast_ari_validate_channel(
3763 if (!prop_is_valid) {
3764 ast_log(LOG_ERROR, "ARI ChannelCreated field channel failed validation\n");
3765 res = 0;
3766 }
3767 } else
3768 {
3770 "ARI ChannelCreated has undocumented field %s\n",
3772 res = 0;
3773 }
3774 }
3775
3776 if (!has_type) {
3777 ast_log(LOG_ERROR, "ARI ChannelCreated missing required field type\n");
3778 res = 0;
3779 }
3780
3781 if (!has_application) {
3782 ast_log(LOG_ERROR, "ARI ChannelCreated missing required field application\n");
3783 res = 0;
3784 }
3785
3786 if (!has_timestamp) {
3787 ast_log(LOG_ERROR, "ARI ChannelCreated missing required field timestamp\n");
3788 res = 0;
3789 }
3790
3791 if (!has_channel) {
3792 ast_log(LOG_ERROR, "ARI ChannelCreated missing required field channel\n");
3793 res = 0;
3794 }
3795
3796 return res;
3797}

References ast_ari_validate_channel(), ast_ari_validate_date(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_channel_created_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_channel_created_fn()

ari_validator ast_ari_validate_channel_created_fn ( void  )

Function pointer to ast_ari_validate_channel_created().

Definition at line 3799 of file ari_model_validators.c.

3800{
3802}
int ast_ari_validate_channel_created(struct ast_json *json)
Validator for ChannelCreated.

References ast_ari_validate_channel_created().

◆ ast_ari_validate_channel_destroyed()

int ast_ari_validate_channel_destroyed ( struct ast_json json)

Validator for ChannelDestroyed.

Notification that a channel has been destroyed.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 3804 of file ari_model_validators.c.

3805{
3806 int res = 1;
3807 struct ast_json_iter *iter;
3808 int has_type = 0;
3809 int has_application = 0;
3810 int has_timestamp = 0;
3811 int has_cause = 0;
3812 int has_cause_txt = 0;
3813 int has_channel = 0;
3814
3815 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3816 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3817 int prop_is_valid;
3818 prop_is_valid = ast_ari_validate_string(
3820 if (!prop_is_valid) {
3821 ast_log(LOG_ERROR, "ARI ChannelDestroyed field asterisk_id failed validation\n");
3822 res = 0;
3823 }
3824 } else
3825 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3826 int prop_is_valid;
3827 has_type = 1;
3828 prop_is_valid = ast_ari_validate_string(
3830 if (!prop_is_valid) {
3831 ast_log(LOG_ERROR, "ARI ChannelDestroyed field type failed validation\n");
3832 res = 0;
3833 }
3834 } else
3835 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3836 int prop_is_valid;
3837 has_application = 1;
3838 prop_is_valid = ast_ari_validate_string(
3840 if (!prop_is_valid) {
3841 ast_log(LOG_ERROR, "ARI ChannelDestroyed field application failed validation\n");
3842 res = 0;
3843 }
3844 } else
3845 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3846 int prop_is_valid;
3847 has_timestamp = 1;
3848 prop_is_valid = ast_ari_validate_date(
3850 if (!prop_is_valid) {
3851 ast_log(LOG_ERROR, "ARI ChannelDestroyed field timestamp failed validation\n");
3852 res = 0;
3853 }
3854 } else
3855 if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
3856 int prop_is_valid;
3857 has_cause = 1;
3858 prop_is_valid = ast_ari_validate_int(
3860 if (!prop_is_valid) {
3861 ast_log(LOG_ERROR, "ARI ChannelDestroyed field cause failed validation\n");
3862 res = 0;
3863 }
3864 } else
3865 if (strcmp("cause_txt", ast_json_object_iter_key(iter)) == 0) {
3866 int prop_is_valid;
3867 has_cause_txt = 1;
3868 prop_is_valid = ast_ari_validate_string(
3870 if (!prop_is_valid) {
3871 ast_log(LOG_ERROR, "ARI ChannelDestroyed field cause_txt failed validation\n");
3872 res = 0;
3873 }
3874 } else
3875 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
3876 int prop_is_valid;
3877 has_channel = 1;
3878 prop_is_valid = ast_ari_validate_channel(
3880 if (!prop_is_valid) {
3881 ast_log(LOG_ERROR, "ARI ChannelDestroyed field channel failed validation\n");
3882 res = 0;
3883 }
3884 } else
3885 {
3887 "ARI ChannelDestroyed has undocumented field %s\n",
3889 res = 0;
3890 }
3891 }
3892
3893 if (!has_type) {
3894 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field type\n");
3895 res = 0;
3896 }
3897
3898 if (!has_application) {
3899 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field application\n");
3900 res = 0;
3901 }
3902
3903 if (!has_timestamp) {
3904 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field timestamp\n");
3905 res = 0;
3906 }
3907
3908 if (!has_cause) {
3909 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field cause\n");
3910 res = 0;
3911 }
3912
3913 if (!has_cause_txt) {
3914 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field cause_txt\n");
3915 res = 0;
3916 }
3917
3918 if (!has_channel) {
3919 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field channel\n");
3920 res = 0;
3921 }
3922
3923 return res;
3924}

References ast_ari_validate_channel(), ast_ari_validate_date(), ast_ari_validate_int(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_channel_destroyed_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_channel_destroyed_fn()

ari_validator ast_ari_validate_channel_destroyed_fn ( void  )

Function pointer to ast_ari_validate_channel_destroyed().

Definition at line 3926 of file ari_model_validators.c.

3927{
3929}
int ast_ari_validate_channel_destroyed(struct ast_json *json)
Validator for ChannelDestroyed.

References ast_ari_validate_channel_destroyed().

◆ ast_ari_validate_channel_dialplan()

int ast_ari_validate_channel_dialplan ( struct ast_json json)

Validator for ChannelDialplan.

Channel changed location in the dialplan.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 3931 of file ari_model_validators.c.

3932{
3933 int res = 1;
3934 struct ast_json_iter *iter;
3935 int has_type = 0;
3936 int has_application = 0;
3937 int has_timestamp = 0;
3938 int has_channel = 0;
3939 int has_dialplan_app = 0;
3940 int has_dialplan_app_data = 0;
3941
3942 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3943 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3944 int prop_is_valid;
3945 prop_is_valid = ast_ari_validate_string(
3947 if (!prop_is_valid) {
3948 ast_log(LOG_ERROR, "ARI ChannelDialplan field asterisk_id failed validation\n");
3949 res = 0;
3950 }
3951 } else
3952 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3953 int prop_is_valid;
3954 has_type = 1;
3955 prop_is_valid = ast_ari_validate_string(
3957 if (!prop_is_valid) {
3958 ast_log(LOG_ERROR, "ARI ChannelDialplan field type failed validation\n");
3959 res = 0;
3960 }
3961 } else
3962 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3963 int prop_is_valid;
3964 has_application = 1;
3965 prop_is_valid = ast_ari_validate_string(
3967 if (!prop_is_valid) {
3968 ast_log(LOG_ERROR, "ARI ChannelDialplan field application failed validation\n");
3969 res = 0;
3970 }
3971 } else
3972 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3973 int prop_is_valid;
3974 has_timestamp = 1;
3975 prop_is_valid = ast_ari_validate_date(
3977 if (!prop_is_valid) {
3978 ast_log(LOG_ERROR, "ARI ChannelDialplan field timestamp failed validation\n");
3979 res = 0;
3980 }
3981 } else
3982 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
3983 int prop_is_valid;
3984 has_channel = 1;
3985 prop_is_valid = ast_ari_validate_channel(
3987 if (!prop_is_valid) {
3988 ast_log(LOG_ERROR, "ARI ChannelDialplan field channel failed validation\n");
3989 res = 0;
3990 }
3991 } else
3992 if (strcmp("dialplan_app", ast_json_object_iter_key(iter)) == 0) {
3993 int prop_is_valid;
3994 has_dialplan_app = 1;
3995 prop_is_valid = ast_ari_validate_string(
3997 if (!prop_is_valid) {
3998 ast_log(LOG_ERROR, "ARI ChannelDialplan field dialplan_app failed validation\n");
3999 res = 0;
4000 }
4001 } else
4002 if (strcmp("dialplan_app_data", ast_json_object_iter_key(iter)) == 0) {
4003 int prop_is_valid;
4004 has_dialplan_app_data = 1;
4005 prop_is_valid = ast_ari_validate_string(
4007 if (!prop_is_valid) {
4008 ast_log(LOG_ERROR, "ARI ChannelDialplan field dialplan_app_data failed validation\n");
4009 res = 0;
4010 }
4011 } else
4012 {
4014 "ARI ChannelDialplan has undocumented field %s\n",
4016 res = 0;
4017 }
4018 }
4019
4020 if (!has_type) {
4021 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field type\n");
4022 res = 0;
4023 }
4024
4025 if (!has_application) {
4026 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field application\n");
4027 res = 0;
4028 }
4029
4030 if (!has_timestamp) {
4031 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field timestamp\n");
4032 res = 0;
4033 }
4034
4035 if (!has_channel) {
4036 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field channel\n");
4037 res = 0;
4038 }
4039
4040 if (!has_dialplan_app) {
4041 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field dialplan_app\n");
4042 res = 0;
4043 }
4044
4045 if (!has_dialplan_app_data) {
4046 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field dialplan_app_data\n");
4047 res = 0;
4048 }
4049
4050 return res;
4051}

References ast_ari_validate_channel(), ast_ari_validate_date(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_channel_dialplan_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_channel_dialplan_fn()

ari_validator ast_ari_validate_channel_dialplan_fn ( void  )

Function pointer to ast_ari_validate_channel_dialplan().

Definition at line 4053 of file ari_model_validators.c.

4054{
4056}
int ast_ari_validate_channel_dialplan(struct ast_json *json)
Validator for ChannelDialplan.

References ast_ari_validate_channel_dialplan().

◆ ast_ari_validate_channel_dtmf_received()

int ast_ari_validate_channel_dtmf_received ( struct ast_json json)

Validator for ChannelDtmfReceived.

DTMF received on a channel.

This event is sent when the DTMF ends. There is no notification about the start of DTMF

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 4058 of file ari_model_validators.c.

4059{
4060 int res = 1;
4061 struct ast_json_iter *iter;
4062 int has_type = 0;
4063 int has_application = 0;
4064 int has_timestamp = 0;
4065 int has_channel = 0;
4066 int has_digit = 0;
4067 int has_duration_ms = 0;
4068
4069 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4070 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4071 int prop_is_valid;
4072 prop_is_valid = ast_ari_validate_string(
4074 if (!prop_is_valid) {
4075 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field asterisk_id failed validation\n");
4076 res = 0;
4077 }
4078 } else
4079 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4080 int prop_is_valid;
4081 has_type = 1;
4082 prop_is_valid = ast_ari_validate_string(
4084 if (!prop_is_valid) {
4085 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field type failed validation\n");
4086 res = 0;
4087 }
4088 } else
4089 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4090 int prop_is_valid;
4091 has_application = 1;
4092 prop_is_valid = ast_ari_validate_string(
4094 if (!prop_is_valid) {
4095 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field application failed validation\n");
4096 res = 0;
4097 }
4098 } else
4099 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4100 int prop_is_valid;
4101 has_timestamp = 1;
4102 prop_is_valid = ast_ari_validate_date(
4104 if (!prop_is_valid) {
4105 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field timestamp failed validation\n");
4106 res = 0;
4107 }
4108 } else
4109 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4110 int prop_is_valid;
4111 has_channel = 1;
4112 prop_is_valid = ast_ari_validate_channel(
4114 if (!prop_is_valid) {
4115 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field channel failed validation\n");
4116 res = 0;
4117 }
4118 } else
4119 if (strcmp("digit", ast_json_object_iter_key(iter)) == 0) {
4120 int prop_is_valid;
4121 has_digit = 1;
4122 prop_is_valid = ast_ari_validate_string(
4124 if (!prop_is_valid) {
4125 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field digit failed validation\n");
4126 res = 0;
4127 }
4128 } else
4129 if (strcmp("duration_ms", ast_json_object_iter_key(iter)) == 0) {
4130 int prop_is_valid;
4131 has_duration_ms = 1;
4132 prop_is_valid = ast_ari_validate_int(
4134 if (!prop_is_valid) {
4135 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field duration_ms failed validation\n");
4136 res = 0;
4137 }
4138 } else
4139 {
4141 "ARI ChannelDtmfReceived has undocumented field %s\n",
4143 res = 0;
4144 }
4145 }
4146
4147 if (!has_type) {
4148 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field type\n");
4149 res = 0;
4150 }
4151
4152 if (!has_application) {
4153 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field application\n");
4154 res = 0;
4155 }
4156
4157 if (!has_timestamp) {
4158 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field timestamp\n");
4159 res = 0;
4160 }
4161
4162 if (!has_channel) {
4163 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field channel\n");
4164 res = 0;
4165 }
4166
4167 if (!has_digit) {
4168 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field digit\n");
4169 res = 0;
4170 }
4171
4172 if (!has_duration_ms) {
4173 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field duration_ms\n");
4174 res = 0;
4175 }
4176
4177 return res;
4178}

References ast_ari_validate_channel(), ast_ari_validate_date(), ast_ari_validate_int(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_channel_dtmf_received_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_channel_dtmf_received_fn()

ari_validator ast_ari_validate_channel_dtmf_received_fn ( void  )

Function pointer to ast_ari_validate_channel_dtmf_received().

Definition at line 4180 of file ari_model_validators.c.

4181{
4183}
int ast_ari_validate_channel_dtmf_received(struct ast_json *json)
Validator for ChannelDtmfReceived.

References ast_ari_validate_channel_dtmf_received().

◆ ast_ari_validate_channel_entered_bridge()

int ast_ari_validate_channel_entered_bridge ( struct ast_json json)

Validator for ChannelEnteredBridge.

Notification that a channel has entered a bridge.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 4185 of file ari_model_validators.c.

4186{
4187 int res = 1;
4188 struct ast_json_iter *iter;
4189 int has_type = 0;
4190 int has_application = 0;
4191 int has_timestamp = 0;
4192 int has_bridge = 0;
4193
4194 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4195 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4196 int prop_is_valid;
4197 prop_is_valid = ast_ari_validate_string(
4199 if (!prop_is_valid) {
4200 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field asterisk_id failed validation\n");
4201 res = 0;
4202 }
4203 } else
4204 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4205 int prop_is_valid;
4206 has_type = 1;
4207 prop_is_valid = ast_ari_validate_string(
4209 if (!prop_is_valid) {
4210 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field type failed validation\n");
4211 res = 0;
4212 }
4213 } else
4214 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4215 int prop_is_valid;
4216 has_application = 1;
4217 prop_is_valid = ast_ari_validate_string(
4219 if (!prop_is_valid) {
4220 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field application failed validation\n");
4221 res = 0;
4222 }
4223 } else
4224 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4225 int prop_is_valid;
4226 has_timestamp = 1;
4227 prop_is_valid = ast_ari_validate_date(
4229 if (!prop_is_valid) {
4230 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field timestamp failed validation\n");
4231 res = 0;
4232 }
4233 } else
4234 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
4235 int prop_is_valid;
4236 has_bridge = 1;
4237 prop_is_valid = ast_ari_validate_bridge(
4239 if (!prop_is_valid) {
4240 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field bridge failed validation\n");
4241 res = 0;
4242 }
4243 } else
4244 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4245 int prop_is_valid;
4246 prop_is_valid = ast_ari_validate_channel(
4248 if (!prop_is_valid) {
4249 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field channel failed validation\n");
4250 res = 0;
4251 }
4252 } else
4253 {
4255 "ARI ChannelEnteredBridge has undocumented field %s\n",
4257 res = 0;
4258 }
4259 }
4260
4261 if (!has_type) {
4262 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field type\n");
4263 res = 0;
4264 }
4265
4266 if (!has_application) {
4267 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field application\n");
4268 res = 0;
4269 }
4270
4271 if (!has_timestamp) {
4272 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field timestamp\n");
4273 res = 0;
4274 }
4275
4276 if (!has_bridge) {
4277 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field bridge\n");
4278 res = 0;
4279 }
4280
4281 return res;
4282}

References ast_ari_validate_bridge(), ast_ari_validate_channel(), ast_ari_validate_date(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_channel_entered_bridge_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_channel_entered_bridge_fn()

ari_validator ast_ari_validate_channel_entered_bridge_fn ( void  )

Function pointer to ast_ari_validate_channel_entered_bridge().

Definition at line 4284 of file ari_model_validators.c.

4285{
4287}
int ast_ari_validate_channel_entered_bridge(struct ast_json *json)
Validator for ChannelEnteredBridge.

References ast_ari_validate_channel_entered_bridge().

◆ ast_ari_validate_channel_fn()

ari_validator ast_ari_validate_channel_fn ( void  )

Function pointer to ast_ari_validate_channel().

Definition at line 1238 of file ari_model_validators.c.

1239{
1241}

References ast_ari_validate_channel().

Referenced by ast_ari_channels_list_cb().

◆ ast_ari_validate_channel_hangup_request()

int ast_ari_validate_channel_hangup_request ( struct ast_json json)

Validator for ChannelHangupRequest.

A hangup was requested on the channel.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 4289 of file ari_model_validators.c.

4290{
4291 int res = 1;
4292 struct ast_json_iter *iter;
4293 int has_type = 0;
4294 int has_application = 0;
4295 int has_timestamp = 0;
4296 int has_channel = 0;
4297
4298 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4299 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4300 int prop_is_valid;
4301 prop_is_valid = ast_ari_validate_string(
4303 if (!prop_is_valid) {
4304 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field asterisk_id failed validation\n");
4305 res = 0;
4306 }
4307 } else
4308 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4309 int prop_is_valid;
4310 has_type = 1;
4311 prop_is_valid = ast_ari_validate_string(
4313 if (!prop_is_valid) {
4314 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field type failed validation\n");
4315 res = 0;
4316 }
4317 } else
4318 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4319 int prop_is_valid;
4320 has_application = 1;
4321 prop_is_valid = ast_ari_validate_string(
4323 if (!prop_is_valid) {
4324 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field application failed validation\n");
4325 res = 0;
4326 }
4327 } else
4328 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4329 int prop_is_valid;
4330 has_timestamp = 1;
4331 prop_is_valid = ast_ari_validate_date(
4333 if (!prop_is_valid) {
4334 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field timestamp failed validation\n");
4335 res = 0;
4336 }
4337 } else
4338 if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
4339 int prop_is_valid;
4340 prop_is_valid = ast_ari_validate_int(
4342 if (!prop_is_valid) {
4343 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field cause failed validation\n");
4344 res = 0;
4345 }
4346 } else
4347 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4348 int prop_is_valid;
4349 has_channel = 1;
4350 prop_is_valid = ast_ari_validate_channel(
4352 if (!prop_is_valid) {
4353 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field channel failed validation\n");
4354 res = 0;
4355 }
4356 } else
4357 if (strcmp("soft", ast_json_object_iter_key(iter)) == 0) {
4358 int prop_is_valid;
4359 prop_is_valid = ast_ari_validate_boolean(
4361 if (!prop_is_valid) {
4362 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field soft failed validation\n");
4363 res = 0;
4364 }
4365 } else
4366 {
4368 "ARI ChannelHangupRequest has undocumented field %s\n",
4370 res = 0;
4371 }
4372 }
4373
4374 if (!has_type) {
4375 ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field type\n");
4376 res = 0;
4377 }
4378
4379 if (!has_application) {
4380 ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field application\n");
4381 res = 0;
4382 }
4383
4384 if (!has_timestamp) {
4385 ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field timestamp\n");
4386 res = 0;
4387 }
4388
4389 if (!has_channel) {
4390 ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field channel\n");
4391 res = 0;
4392 }
4393
4394 return res;
4395}

References ast_ari_validate_boolean(), ast_ari_validate_channel(), ast_ari_validate_date(), ast_ari_validate_int(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_channel_hangup_request_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_channel_hangup_request_fn()

ari_validator ast_ari_validate_channel_hangup_request_fn ( void  )

Function pointer to ast_ari_validate_channel_hangup_request().

Definition at line 4397 of file ari_model_validators.c.

4398{
4400}
int ast_ari_validate_channel_hangup_request(struct ast_json *json)
Validator for ChannelHangupRequest.

References ast_ari_validate_channel_hangup_request().

◆ ast_ari_validate_channel_hold()

int ast_ari_validate_channel_hold ( struct ast_json json)

Validator for ChannelHold.

A channel initiated a media hold.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 4402 of file ari_model_validators.c.

4403{
4404 int res = 1;
4405 struct ast_json_iter *iter;
4406 int has_type = 0;
4407 int has_application = 0;
4408 int has_timestamp = 0;
4409 int has_channel = 0;
4410
4411 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4412 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4413 int prop_is_valid;
4414 prop_is_valid = ast_ari_validate_string(
4416 if (!prop_is_valid) {
4417 ast_log(LOG_ERROR, "ARI ChannelHold field asterisk_id failed validation\n");
4418 res = 0;
4419 }
4420 } else
4421 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4422 int prop_is_valid;
4423 has_type = 1;
4424 prop_is_valid = ast_ari_validate_string(
4426 if (!prop_is_valid) {
4427 ast_log(LOG_ERROR, "ARI ChannelHold field type failed validation\n");
4428 res = 0;
4429 }
4430 } else
4431 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4432 int prop_is_valid;
4433 has_application = 1;
4434 prop_is_valid = ast_ari_validate_string(
4436 if (!prop_is_valid) {
4437 ast_log(LOG_ERROR, "ARI ChannelHold field application failed validation\n");
4438 res = 0;
4439 }
4440 } else
4441 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4442 int prop_is_valid;
4443 has_timestamp = 1;
4444 prop_is_valid = ast_ari_validate_date(
4446 if (!prop_is_valid) {
4447 ast_log(LOG_ERROR, "ARI ChannelHold field timestamp failed validation\n");
4448 res = 0;
4449 }
4450 } else
4451 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4452 int prop_is_valid;
4453 has_channel = 1;
4454 prop_is_valid = ast_ari_validate_channel(
4456 if (!prop_is_valid) {
4457 ast_log(LOG_ERROR, "ARI ChannelHold field channel failed validation\n");
4458 res = 0;
4459 }
4460 } else
4461 if (strcmp("musicclass", ast_json_object_iter_key(iter)) == 0) {
4462 int prop_is_valid;
4463 prop_is_valid = ast_ari_validate_string(
4465 if (!prop_is_valid) {
4466 ast_log(LOG_ERROR, "ARI ChannelHold field musicclass failed validation\n");
4467 res = 0;
4468 }
4469 } else
4470 {
4472 "ARI ChannelHold has undocumented field %s\n",
4474 res = 0;
4475 }
4476 }
4477
4478 if (!has_type) {
4479 ast_log(LOG_ERROR, "ARI ChannelHold missing required field type\n");
4480 res = 0;
4481 }
4482
4483 if (!has_application) {
4484 ast_log(LOG_ERROR, "ARI ChannelHold missing required field application\n");
4485 res = 0;
4486 }
4487
4488 if (!has_timestamp) {
4489 ast_log(LOG_ERROR, "ARI ChannelHold missing required field timestamp\n");
4490 res = 0;
4491 }
4492
4493 if (!has_channel) {
4494 ast_log(LOG_ERROR, "ARI ChannelHold missing required field channel\n");
4495 res = 0;
4496 }
4497
4498 return res;
4499}

References ast_ari_validate_channel(), ast_ari_validate_date(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_channel_hold_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_channel_hold_fn()

ari_validator ast_ari_validate_channel_hold_fn ( void  )

Function pointer to ast_ari_validate_channel_hold().

Definition at line 4501 of file ari_model_validators.c.

4502{
4504}
int ast_ari_validate_channel_hold(struct ast_json *json)
Validator for ChannelHold.

References ast_ari_validate_channel_hold().

◆ ast_ari_validate_channel_left_bridge()

int ast_ari_validate_channel_left_bridge ( struct ast_json json)

Validator for ChannelLeftBridge.

Notification that a channel has left a bridge.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 4506 of file ari_model_validators.c.

4507{
4508 int res = 1;
4509 struct ast_json_iter *iter;
4510 int has_type = 0;
4511 int has_application = 0;
4512 int has_timestamp = 0;
4513 int has_bridge = 0;
4514 int has_channel = 0;
4515
4516 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4517 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4518 int prop_is_valid;
4519 prop_is_valid = ast_ari_validate_string(
4521 if (!prop_is_valid) {
4522 ast_log(LOG_ERROR, "ARI ChannelLeftBridge field asterisk_id failed validation\n");
4523 res = 0;
4524 }
4525 } else
4526 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4527 int prop_is_valid;
4528 has_type = 1;
4529 prop_is_valid = ast_ari_validate_string(
4531 if (!prop_is_valid) {
4532 ast_log(LOG_ERROR, "ARI ChannelLeftBridge field type failed validation\n");
4533 res = 0;
4534 }
4535 } else
4536 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4537 int prop_is_valid;
4538 has_application = 1;
4539 prop_is_valid = ast_ari_validate_string(
4541 if (!prop_is_valid) {
4542 ast_log(LOG_ERROR, "ARI ChannelLeftBridge field application failed validation\n");
4543 res = 0;
4544 }
4545 } else
4546 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4547 int prop_is_valid;
4548 has_timestamp = 1;
4549 prop_is_valid = ast_ari_validate_date(
4551 if (!prop_is_valid) {
4552 ast_log(LOG_ERROR, "ARI ChannelLeftBridge field timestamp failed validation\n");
4553 res = 0;
4554 }
4555 } else
4556 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
4557 int prop_is_valid;
4558 has_bridge = 1;
4559 prop_is_valid = ast_ari_validate_bridge(
4561 if (!prop_is_valid) {
4562 ast_log(LOG_ERROR, "ARI ChannelLeftBridge field bridge failed validation\n");
4563 res = 0;
4564 }
4565 } else
4566 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4567 int prop_is_valid;
4568 has_channel = 1;
4569 prop_is_valid = ast_ari_validate_channel(
4571 if (!prop_is_valid) {
4572 ast_log(LOG_ERROR, "ARI ChannelLeftBridge field channel failed validation\n");
4573 res = 0;
4574 }
4575 } else
4576 {
4578 "ARI ChannelLeftBridge has undocumented field %s\n",
4580 res = 0;
4581 }
4582 }
4583
4584 if (!has_type) {
4585 ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field type\n");
4586 res = 0;
4587 }
4588
4589 if (!has_application) {
4590 ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field application\n");
4591 res = 0;
4592 }
4593
4594 if (!has_timestamp) {
4595 ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field timestamp\n");
4596 res = 0;
4597 }
4598
4599 if (!has_bridge) {
4600 ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field bridge\n");
4601 res = 0;
4602 }
4603
4604 if (!has_channel) {
4605 ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field channel\n");
4606 res = 0;
4607 }
4608
4609 return res;
4610}

References ast_ari_validate_bridge(), ast_ari_validate_channel(), ast_ari_validate_date(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_channel_left_bridge_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_channel_left_bridge_fn()

ari_validator ast_ari_validate_channel_left_bridge_fn ( void  )

Function pointer to ast_ari_validate_channel_left_bridge().

Definition at line 4612 of file ari_model_validators.c.

4613{
4615}
int ast_ari_validate_channel_left_bridge(struct ast_json *json)
Validator for ChannelLeftBridge.

References ast_ari_validate_channel_left_bridge().

◆ ast_ari_validate_channel_state_change()

int ast_ari_validate_channel_state_change ( struct ast_json json)

Validator for ChannelStateChange.

Notification of a channel's state change.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 4617 of file ari_model_validators.c.

4618{
4619 int res = 1;
4620 struct ast_json_iter *iter;
4621 int has_type = 0;
4622 int has_application = 0;
4623 int has_timestamp = 0;
4624 int has_channel = 0;
4625
4626 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4627 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4628 int prop_is_valid;
4629 prop_is_valid = ast_ari_validate_string(
4631 if (!prop_is_valid) {
4632 ast_log(LOG_ERROR, "ARI ChannelStateChange field asterisk_id failed validation\n");
4633 res = 0;
4634 }
4635 } else
4636 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4637 int prop_is_valid;
4638 has_type = 1;
4639 prop_is_valid = ast_ari_validate_string(
4641 if (!prop_is_valid) {
4642 ast_log(LOG_ERROR, "ARI ChannelStateChange field type failed validation\n");
4643 res = 0;
4644 }
4645 } else
4646 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4647 int prop_is_valid;
4648 has_application = 1;
4649 prop_is_valid = ast_ari_validate_string(
4651 if (!prop_is_valid) {
4652 ast_log(LOG_ERROR, "ARI ChannelStateChange field application failed validation\n");
4653 res = 0;
4654 }
4655 } else
4656 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4657 int prop_is_valid;
4658 has_timestamp = 1;
4659 prop_is_valid = ast_ari_validate_date(
4661 if (!prop_is_valid) {
4662 ast_log(LOG_ERROR, "ARI ChannelStateChange field timestamp failed validation\n");
4663 res = 0;
4664 }
4665 } else
4666 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4667 int prop_is_valid;
4668 has_channel = 1;
4669 prop_is_valid = ast_ari_validate_channel(
4671 if (!prop_is_valid) {
4672 ast_log(LOG_ERROR, "ARI ChannelStateChange field channel failed validation\n");
4673 res = 0;
4674 }
4675 } else
4676 {
4678 "ARI ChannelStateChange has undocumented field %s\n",
4680 res = 0;
4681 }
4682 }
4683
4684 if (!has_type) {
4685 ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field type\n");
4686 res = 0;
4687 }
4688
4689 if (!has_application) {
4690 ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field application\n");
4691 res = 0;
4692 }
4693
4694 if (!has_timestamp) {
4695 ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field timestamp\n");
4696 res = 0;
4697 }
4698
4699 if (!has_channel) {
4700 ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field channel\n");
4701 res = 0;
4702 }
4703
4704 return res;
4705}

References ast_ari_validate_channel(), ast_ari_validate_date(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_channel_state_change_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_channel_state_change_fn()

ari_validator ast_ari_validate_channel_state_change_fn ( void  )

Function pointer to ast_ari_validate_channel_state_change().

Definition at line 4707 of file ari_model_validators.c.

4708{
4710}
int ast_ari_validate_channel_state_change(struct ast_json *json)
Validator for ChannelStateChange.

References ast_ari_validate_channel_state_change().

◆ ast_ari_validate_channel_talking_finished()

int ast_ari_validate_channel_talking_finished ( struct ast_json json)

Validator for ChannelTalkingFinished.

Talking is no longer detected on the channel.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 4712 of file ari_model_validators.c.

4713{
4714 int res = 1;
4715 struct ast_json_iter *iter;
4716 int has_type = 0;
4717 int has_application = 0;
4718 int has_timestamp = 0;
4719 int has_channel = 0;
4720 int has_duration = 0;
4721
4722 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4723 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4724 int prop_is_valid;
4725 prop_is_valid = ast_ari_validate_string(
4727 if (!prop_is_valid) {
4728 ast_log(LOG_ERROR, "ARI ChannelTalkingFinished field asterisk_id failed validation\n");
4729 res = 0;
4730 }
4731 } else
4732 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4733 int prop_is_valid;
4734 has_type = 1;
4735 prop_is_valid = ast_ari_validate_string(
4737 if (!prop_is_valid) {
4738 ast_log(LOG_ERROR, "ARI ChannelTalkingFinished field type failed validation\n");
4739 res = 0;
4740 }
4741 } else
4742 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4743 int prop_is_valid;
4744 has_application = 1;
4745 prop_is_valid = ast_ari_validate_string(
4747 if (!prop_is_valid) {
4748 ast_log(LOG_ERROR, "ARI ChannelTalkingFinished field application failed validation\n");
4749 res = 0;
4750 }
4751 } else
4752 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4753 int prop_is_valid;
4754 has_timestamp = 1;
4755 prop_is_valid = ast_ari_validate_date(
4757 if (!prop_is_valid) {
4758 ast_log(LOG_ERROR, "ARI ChannelTalkingFinished field timestamp failed validation\n");
4759 res = 0;
4760 }
4761 } else
4762 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4763 int prop_is_valid;
4764 has_channel = 1;
4765 prop_is_valid = ast_ari_validate_channel(
4767 if (!prop_is_valid) {
4768 ast_log(LOG_ERROR, "ARI ChannelTalkingFinished field channel failed validation\n");
4769 res = 0;
4770 }
4771 } else
4772 if (strcmp("duration", ast_json_object_iter_key(iter)) == 0) {
4773 int prop_is_valid;
4774 has_duration = 1;
4775 prop_is_valid = ast_ari_validate_int(
4777 if (!prop_is_valid) {
4778 ast_log(LOG_ERROR, "ARI ChannelTalkingFinished field duration failed validation\n");
4779 res = 0;
4780 }
4781 } else
4782 {
4784 "ARI ChannelTalkingFinished has undocumented field %s\n",
4786 res = 0;
4787 }
4788 }
4789
4790 if (!has_type) {
4791 ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field type\n");
4792 res = 0;
4793 }
4794
4795 if (!has_application) {
4796 ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field application\n");
4797 res = 0;
4798 }
4799
4800 if (!has_timestamp) {
4801 ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field timestamp\n");
4802 res = 0;
4803 }
4804
4805 if (!has_channel) {
4806 ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field channel\n");
4807 res = 0;
4808 }
4809
4810 if (!has_duration) {
4811 ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field duration\n");
4812 res = 0;
4813 }
4814
4815 return res;
4816}

References ast_ari_validate_channel(), ast_ari_validate_date(), ast_ari_validate_int(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_channel_talking_finished_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_channel_talking_finished_fn()

ari_validator ast_ari_validate_channel_talking_finished_fn ( void  )

Function pointer to ast_ari_validate_channel_talking_finished().

Definition at line 4818 of file ari_model_validators.c.

4819{
4821}
int ast_ari_validate_channel_talking_finished(struct ast_json *json)
Validator for ChannelTalkingFinished.

References ast_ari_validate_channel_talking_finished().

◆ ast_ari_validate_channel_talking_started()

int ast_ari_validate_channel_talking_started ( struct ast_json json)

Validator for ChannelTalkingStarted.

Talking was detected on the channel.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 4823 of file ari_model_validators.c.

4824{
4825 int res = 1;
4826 struct ast_json_iter *iter;
4827 int has_type = 0;
4828 int has_application = 0;
4829 int has_timestamp = 0;
4830 int has_channel = 0;
4831
4832 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4833 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4834 int prop_is_valid;
4835 prop_is_valid = ast_ari_validate_string(
4837 if (!prop_is_valid) {
4838 ast_log(LOG_ERROR, "ARI ChannelTalkingStarted field asterisk_id failed validation\n");
4839 res = 0;
4840 }
4841 } else
4842 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4843 int prop_is_valid;
4844 has_type = 1;
4845 prop_is_valid = ast_ari_validate_string(
4847 if (!prop_is_valid) {
4848 ast_log(LOG_ERROR, "ARI ChannelTalkingStarted field type failed validation\n");
4849 res = 0;
4850 }
4851 } else
4852 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4853 int prop_is_valid;
4854 has_application = 1;
4855 prop_is_valid = ast_ari_validate_string(
4857 if (!prop_is_valid) {
4858 ast_log(LOG_ERROR, "ARI ChannelTalkingStarted field application failed validation\n");
4859 res = 0;
4860 }
4861 } else
4862 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4863 int prop_is_valid;
4864 has_timestamp = 1;
4865 prop_is_valid = ast_ari_validate_date(
4867 if (!prop_is_valid) {
4868 ast_log(LOG_ERROR, "ARI ChannelTalkingStarted field timestamp failed validation\n");
4869 res = 0;
4870 }
4871 } else
4872 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4873 int prop_is_valid;
4874 has_channel = 1;
4875 prop_is_valid = ast_ari_validate_channel(
4877 if (!prop_is_valid) {
4878 ast_log(LOG_ERROR, "ARI ChannelTalkingStarted field channel failed validation\n");
4879 res = 0;
4880 }
4881 } else
4882 {
4884 "ARI ChannelTalkingStarted has undocumented field %s\n",
4886 res = 0;
4887 }
4888 }
4889
4890 if (!has_type) {
4891 ast_log(LOG_ERROR, "ARI ChannelTalkingStarted missing required field type\n");
4892 res = 0;
4893 }
4894
4895 if (!has_application) {
4896 ast_log(LOG_ERROR, "ARI ChannelTalkingStarted missing required field application\n");
4897 res = 0;
4898 }
4899
4900 if (!has_timestamp) {
4901 ast_log(LOG_ERROR, "ARI ChannelTalkingStarted missing required field timestamp\n");
4902 res = 0;
4903 }
4904
4905 if (!has_channel) {
4906 ast_log(LOG_ERROR, "ARI ChannelTalkingStarted missing required field channel\n");
4907 res = 0;
4908 }
4909
4910 return res;
4911}

References ast_ari_validate_channel(), ast_ari_validate_date(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_channel_talking_started_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_channel_talking_started_fn()

ari_validator ast_ari_validate_channel_talking_started_fn ( void  )

Function pointer to ast_ari_validate_channel_talking_started().

Definition at line 4913 of file ari_model_validators.c.

4914{
4916}
int ast_ari_validate_channel_talking_started(struct ast_json *json)
Validator for ChannelTalkingStarted.

References ast_ari_validate_channel_talking_started().

◆ ast_ari_validate_channel_tone_detected()

int ast_ari_validate_channel_tone_detected ( struct ast_json json)

Validator for ChannelToneDetected.

Tone was detected on the channel.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 4918 of file ari_model_validators.c.

4919{
4920 int res = 1;
4921 struct ast_json_iter *iter;
4922 int has_type = 0;
4923 int has_application = 0;
4924 int has_timestamp = 0;
4925 int has_channel = 0;
4926
4927 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4928 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4929 int prop_is_valid;
4930 prop_is_valid = ast_ari_validate_string(
4932 if (!prop_is_valid) {
4933 ast_log(LOG_ERROR, "ARI ChannelToneDetected field asterisk_id failed validation\n");
4934 res = 0;
4935 }
4936 } else
4937 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4938 int prop_is_valid;
4939 has_type = 1;
4940 prop_is_valid = ast_ari_validate_string(
4942 if (!prop_is_valid) {
4943 ast_log(LOG_ERROR, "ARI ChannelToneDetected field type failed validation\n");
4944 res = 0;
4945 }
4946 } else
4947 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4948 int prop_is_valid;
4949 has_application = 1;
4950 prop_is_valid = ast_ari_validate_string(
4952 if (!prop_is_valid) {
4953 ast_log(LOG_ERROR, "ARI ChannelToneDetected field application failed validation\n");
4954 res = 0;
4955 }
4956 } else
4957 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4958 int prop_is_valid;
4959 has_timestamp = 1;
4960 prop_is_valid = ast_ari_validate_date(
4962 if (!prop_is_valid) {
4963 ast_log(LOG_ERROR, "ARI ChannelToneDetected field timestamp failed validation\n");
4964 res = 0;
4965 }
4966 } else
4967 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4968 int prop_is_valid;
4969 has_channel = 1;
4970 prop_is_valid = ast_ari_validate_channel(
4972 if (!prop_is_valid) {
4973 ast_log(LOG_ERROR, "ARI ChannelToneDetected field channel failed validation\n");
4974 res = 0;
4975 }
4976 } else
4977 {
4979 "ARI ChannelToneDetected has undocumented field %s\n",
4981 res = 0;
4982 }
4983 }
4984
4985 if (!has_type) {
4986 ast_log(LOG_ERROR, "ARI ChannelToneDetected missing required field type\n");
4987 res = 0;
4988 }
4989
4990 if (!has_application) {
4991 ast_log(LOG_ERROR, "ARI ChannelToneDetected missing required field application\n");
4992 res = 0;
4993 }
4994
4995 if (!has_timestamp) {
4996 ast_log(LOG_ERROR, "ARI ChannelToneDetected missing required field timestamp\n");
4997 res = 0;
4998 }
4999
5000 if (!has_channel) {
5001 ast_log(LOG_ERROR, "ARI ChannelToneDetected missing required field channel\n");
5002 res = 0;
5003 }
5004
5005 return res;
5006}

References ast_ari_validate_channel(), ast_ari_validate_date(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_channel_tone_detected_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_channel_tone_detected_fn()

ari_validator ast_ari_validate_channel_tone_detected_fn ( void  )

Function pointer to ast_ari_validate_channel_tone_detected().

Definition at line 5008 of file ari_model_validators.c.

5009{
5011}
int ast_ari_validate_channel_tone_detected(struct ast_json *json)
Validator for ChannelToneDetected.

References ast_ari_validate_channel_tone_detected().

◆ ast_ari_validate_channel_unhold()

int ast_ari_validate_channel_unhold ( struct ast_json json)

Validator for ChannelUnhold.

A channel initiated a media unhold.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 5013 of file ari_model_validators.c.

5014{
5015 int res = 1;
5016 struct ast_json_iter *iter;
5017 int has_type = 0;
5018 int has_application = 0;
5019 int has_timestamp = 0;
5020 int has_channel = 0;
5021
5022 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
5023 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
5024 int prop_is_valid;
5025 prop_is_valid = ast_ari_validate_string(
5027 if (!prop_is_valid) {
5028 ast_log(LOG_ERROR, "ARI ChannelUnhold field asterisk_id failed validation\n");
5029 res = 0;
5030 }
5031 } else
5032 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
5033 int prop_is_valid;
5034 has_type = 1;
5035 prop_is_valid = ast_ari_validate_string(
5037 if (!prop_is_valid) {
5038 ast_log(LOG_ERROR, "ARI ChannelUnhold field type failed validation\n");
5039 res = 0;
5040 }
5041 } else
5042 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
5043 int prop_is_valid;
5044 has_application = 1;
5045 prop_is_valid = ast_ari_validate_string(
5047 if (!prop_is_valid) {
5048 ast_log(LOG_ERROR, "ARI ChannelUnhold field application failed validation\n");
5049 res = 0;
5050 }
5051 } else
5052 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
5053 int prop_is_valid;
5054 has_timestamp = 1;
5055 prop_is_valid = ast_ari_validate_date(
5057 if (!prop_is_valid) {
5058 ast_log(LOG_ERROR, "ARI ChannelUnhold field timestamp failed validation\n");
5059 res = 0;
5060 }
5061 } else
5062 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
5063 int prop_is_valid;
5064 has_channel = 1;
5065 prop_is_valid = ast_ari_validate_channel(
5067 if (!prop_is_valid) {
5068 ast_log(LOG_ERROR, "ARI ChannelUnhold field channel failed validation\n");
5069 res = 0;
5070 }
5071 } else
5072 {
5074 "ARI ChannelUnhold has undocumented field %s\n",
5076 res = 0;
5077 }
5078 }
5079
5080 if (!has_type) {
5081 ast_log(LOG_ERROR, "ARI ChannelUnhold missing required field type\n");
5082 res = 0;
5083 }
5084
5085 if (!has_application) {
5086 ast_log(LOG_ERROR, "ARI ChannelUnhold missing required field application\n");
5087 res = 0;
5088 }
5089
5090 if (!has_timestamp) {
5091 ast_log(LOG_ERROR, "ARI ChannelUnhold missing required field timestamp\n");
5092 res = 0;
5093 }
5094
5095 if (!has_channel) {
5096 ast_log(LOG_ERROR, "ARI ChannelUnhold missing required field channel\n");
5097 res = 0;
5098 }
5099
5100 return res;
5101}

References ast_ari_validate_channel(), ast_ari_validate_date(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_channel_unhold_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_channel_unhold_fn()

ari_validator ast_ari_validate_channel_unhold_fn ( void  )

Function pointer to ast_ari_validate_channel_unhold().

Definition at line 5103 of file ari_model_validators.c.

5104{
5106}
int ast_ari_validate_channel_unhold(struct ast_json *json)
Validator for ChannelUnhold.

References ast_ari_validate_channel_unhold().

◆ ast_ari_validate_channel_userevent()

int ast_ari_validate_channel_userevent ( struct ast_json json)

Validator for ChannelUserevent.

User-generated event with additional user-defined fields in the object.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 5108 of file ari_model_validators.c.

5109{
5110 int res = 1;
5111 struct ast_json_iter *iter;
5112 int has_type = 0;
5113 int has_application = 0;
5114 int has_timestamp = 0;
5115 int has_eventname = 0;
5116 int has_userevent = 0;
5117
5118 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
5119 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
5120 int prop_is_valid;
5121 prop_is_valid = ast_ari_validate_string(
5123 if (!prop_is_valid) {
5124 ast_log(LOG_ERROR, "ARI ChannelUserevent field asterisk_id failed validation\n");
5125 res = 0;
5126 }
5127 } else
5128 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
5129 int prop_is_valid;
5130 has_type = 1;
5131 prop_is_valid = ast_ari_validate_string(
5133 if (!prop_is_valid) {
5134 ast_log(LOG_ERROR, "ARI ChannelUserevent field type failed validation\n");
5135 res = 0;
5136 }
5137 } else
5138 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
5139 int prop_is_valid;
5140 has_application = 1;
5141 prop_is_valid = ast_ari_validate_string(
5143 if (!prop_is_valid) {
5144 ast_log(LOG_ERROR, "ARI ChannelUserevent field application failed validation\n");
5145 res = 0;
5146 }
5147 } else
5148 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
5149 int prop_is_valid;
5150 has_timestamp = 1;
5151 prop_is_valid = ast_ari_validate_date(
5153 if (!prop_is_valid) {
5154 ast_log(LOG_ERROR, "ARI ChannelUserevent field timestamp failed validation\n");
5155 res = 0;
5156 }
5157 } else
5158 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
5159 int prop_is_valid;
5160 prop_is_valid = ast_ari_validate_bridge(
5162 if (!prop_is_valid) {
5163 ast_log(LOG_ERROR, "ARI ChannelUserevent field bridge failed validation\n");
5164 res = 0;
5165 }
5166 } else
5167 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
5168 int prop_is_valid;
5169 prop_is_valid = ast_ari_validate_channel(
5171 if (!prop_is_valid) {
5172 ast_log(LOG_ERROR, "ARI ChannelUserevent field channel failed validation\n");
5173 res = 0;
5174 }
5175 } else
5176 if (strcmp("endpoint", ast_json_object_iter_key(iter)) == 0) {
5177 int prop_is_valid;
5178 prop_is_valid = ast_ari_validate_endpoint(
5180 if (!prop_is_valid) {
5181 ast_log(LOG_ERROR, "ARI ChannelUserevent field endpoint failed validation\n");
5182 res = 0;
5183 }
5184 } else
5185 if (strcmp("eventname", ast_json_object_iter_key(iter)) == 0) {
5186 int prop_is_valid;
5187 has_eventname = 1;
5188 prop_is_valid = ast_ari_validate_string(
5190 if (!prop_is_valid) {
5191 ast_log(LOG_ERROR, "ARI ChannelUserevent field eventname failed validation\n");
5192 res = 0;
5193 }
5194 } else
5195 if (strcmp("userevent", ast_json_object_iter_key(iter)) == 0) {
5196 int prop_is_valid;
5197 has_userevent = 1;
5198 prop_is_valid = ast_ari_validate_object(
5200 if (!prop_is_valid) {
5201 ast_log(LOG_ERROR, "ARI ChannelUserevent field userevent failed validation\n");
5202 res = 0;
5203 }
5204 } else
5205 {
5207 "ARI ChannelUserevent has undocumented field %s\n",
5209 res = 0;
5210 }
5211 }
5212
5213 if (!has_type) {
5214 ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field type\n");
5215 res = 0;
5216 }
5217
5218 if (!has_application) {
5219 ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field application\n");
5220 res = 0;
5221 }
5222
5223 if (!has_timestamp) {
5224 ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field timestamp\n");
5225 res = 0;
5226 }
5227
5228 if (!has_eventname) {
5229 ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field eventname\n");
5230 res = 0;
5231 }
5232
5233 if (!has_userevent) {
5234 ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field userevent\n");
5235 res = 0;
5236 }
5237
5238 return res;
5239}
int ast_ari_validate_endpoint(struct ast_json *json)
Validator for Endpoint.

References ast_ari_validate_bridge(), ast_ari_validate_channel(), ast_ari_validate_date(), ast_ari_validate_endpoint(), ast_ari_validate_object(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_channel_userevent_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_channel_userevent_fn()

ari_validator ast_ari_validate_channel_userevent_fn ( void  )

Function pointer to ast_ari_validate_channel_userevent().

Definition at line 5241 of file ari_model_validators.c.

5242{
5244}
int ast_ari_validate_channel_userevent(struct ast_json *json)
Validator for ChannelUserevent.

References ast_ari_validate_channel_userevent().

◆ ast_ari_validate_channel_varset()

int ast_ari_validate_channel_varset ( struct ast_json json)

Validator for ChannelVarset.

Channel variable changed.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 5246 of file ari_model_validators.c.

5247{
5248 int res = 1;
5249 struct ast_json_iter *iter;
5250 int has_type = 0;
5251 int has_application = 0;
5252 int has_timestamp = 0;
5253 int has_value = 0;
5254 int has_variable = 0;
5255
5256 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
5257 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
5258 int prop_is_valid;
5259 prop_is_valid = ast_ari_validate_string(
5261 if (!prop_is_valid) {
5262 ast_log(LOG_ERROR, "ARI ChannelVarset field asterisk_id failed validation\n");
5263 res = 0;
5264 }
5265 } else
5266 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
5267 int prop_is_valid;
5268 has_type = 1;
5269 prop_is_valid = ast_ari_validate_string(
5271 if (!prop_is_valid) {
5272 ast_log(LOG_ERROR, "ARI ChannelVarset field type failed validation\n");
5273 res = 0;
5274 }
5275 } else
5276 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
5277 int prop_is_valid;
5278 has_application = 1;
5279 prop_is_valid = ast_ari_validate_string(
5281 if (!prop_is_valid) {
5282 ast_log(LOG_ERROR, "ARI ChannelVarset field application failed validation\n");
5283 res = 0;
5284 }
5285 } else
5286 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
5287 int prop_is_valid;
5288 has_timestamp = 1;
5289 prop_is_valid = ast_ari_validate_date(
5291 if (!prop_is_valid) {
5292 ast_log(LOG_ERROR, "ARI ChannelVarset field timestamp failed validation\n");
5293 res = 0;
5294 }
5295 } else
5296 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
5297 int prop_is_valid;
5298 prop_is_valid = ast_ari_validate_channel(
5300 if (!prop_is_valid) {
5301 ast_log(LOG_ERROR, "ARI ChannelVarset field channel failed validation\n");
5302 res = 0;
5303 }
5304 } else
5305 if (strcmp("value", ast_json_object_iter_key(iter)) == 0) {
5306 int prop_is_valid;
5307 has_value = 1;
5308 prop_is_valid = ast_ari_validate_string(
5310 if (!prop_is_valid) {
5311 ast_log(LOG_ERROR, "ARI ChannelVarset field value failed validation\n");
5312 res = 0;
5313 }
5314 } else
5315 if (strcmp("variable", ast_json_object_iter_key(iter)) == 0) {
5316 int prop_is_valid;
5317 has_variable = 1;
5318 prop_is_valid = ast_ari_validate_string(
5320 if (!prop_is_valid) {
5321 ast_log(LOG_ERROR, "ARI ChannelVarset field variable failed validation\n");
5322 res = 0;
5323 }
5324 } else
5325 {
5327 "ARI ChannelVarset has undocumented field %s\n",
5329 res = 0;
5330 }
5331 }
5332
5333 if (!has_type) {
5334 ast_log(LOG_ERROR, "ARI ChannelVarset missing required field type\n");
5335 res = 0;
5336 }
5337
5338 if (!has_application) {
5339 ast_log(LOG_ERROR, "ARI ChannelVarset missing required field application\n");
5340 res = 0;
5341 }
5342
5343 if (!has_timestamp) {
5344 ast_log(LOG_ERROR, "ARI ChannelVarset missing required field timestamp\n");
5345 res = 0;
5346 }
5347
5348 if (!has_value) {
5349 ast_log(LOG_ERROR, "ARI ChannelVarset missing required field value\n");
5350 res = 0;
5351 }
5352
5353 if (!has_variable) {
5354 ast_log(LOG_ERROR, "ARI ChannelVarset missing required field variable\n");
5355 res = 0;
5356 }
5357
5358 return res;
5359}

References ast_ari_validate_channel(), ast_ari_validate_date(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_channel_varset_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_channel_varset_fn()

ari_validator ast_ari_validate_channel_varset_fn ( void  )

Function pointer to ast_ari_validate_channel_varset().

Definition at line 5361 of file ari_model_validators.c.

5362{
5364}
int ast_ari_validate_channel_varset(struct ast_json *json)
Validator for ChannelVarset.

References ast_ari_validate_channel_varset().

◆ ast_ari_validate_config_info()

int ast_ari_validate_config_info ( struct ast_json json)

Validator for ConfigInfo.

Info about Asterisk configuration

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 282 of file ari_model_validators.c.

283{
284 int res = 1;
285 struct ast_json_iter *iter;
286 int has_default_language = 0;
287 int has_name = 0;
288 int has_setid = 0;
289
290 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
291 if (strcmp("default_language", ast_json_object_iter_key(iter)) == 0) {
292 int prop_is_valid;
293 has_default_language = 1;
294 prop_is_valid = ast_ari_validate_string(
296 if (!prop_is_valid) {
297 ast_log(LOG_ERROR, "ARI ConfigInfo field default_language failed validation\n");
298 res = 0;
299 }
300 } else
301 if (strcmp("max_channels", ast_json_object_iter_key(iter)) == 0) {
302 int prop_is_valid;
303 prop_is_valid = ast_ari_validate_int(
305 if (!prop_is_valid) {
306 ast_log(LOG_ERROR, "ARI ConfigInfo field max_channels failed validation\n");
307 res = 0;
308 }
309 } else
310 if (strcmp("max_load", ast_json_object_iter_key(iter)) == 0) {
311 int prop_is_valid;
312 prop_is_valid = ast_ari_validate_double(
314 if (!prop_is_valid) {
315 ast_log(LOG_ERROR, "ARI ConfigInfo field max_load failed validation\n");
316 res = 0;
317 }
318 } else
319 if (strcmp("max_open_files", ast_json_object_iter_key(iter)) == 0) {
320 int prop_is_valid;
321 prop_is_valid = ast_ari_validate_int(
323 if (!prop_is_valid) {
324 ast_log(LOG_ERROR, "ARI ConfigInfo field max_open_files failed validation\n");
325 res = 0;
326 }
327 } else
328 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
329 int prop_is_valid;
330 has_name = 1;
331 prop_is_valid = ast_ari_validate_string(
333 if (!prop_is_valid) {
334 ast_log(LOG_ERROR, "ARI ConfigInfo field name failed validation\n");
335 res = 0;
336 }
337 } else
338 if (strcmp("setid", ast_json_object_iter_key(iter)) == 0) {
339 int prop_is_valid;
340 has_setid = 1;
341 prop_is_valid = ast_ari_validate_set_id(
343 if (!prop_is_valid) {
344 ast_log(LOG_ERROR, "ARI ConfigInfo field setid failed validation\n");
345 res = 0;
346 }
347 } else
348 {
350 "ARI ConfigInfo has undocumented field %s\n",
352 res = 0;
353 }
354 }
355
356 if (!has_default_language) {
357 ast_log(LOG_ERROR, "ARI ConfigInfo missing required field default_language\n");
358 res = 0;
359 }
360
361 if (!has_name) {
362 ast_log(LOG_ERROR, "ARI ConfigInfo missing required field name\n");
363 res = 0;
364 }
365
366 if (!has_setid) {
367 ast_log(LOG_ERROR, "ARI ConfigInfo missing required field setid\n");
368 res = 0;
369 }
370
371 return res;
372}
int ast_ari_validate_set_id(struct ast_json *json)
Validator for SetId.
int ast_ari_validate_double(struct ast_json *json)
Validator for native Swagger double.

References ast_ari_validate_double(), ast_ari_validate_int(), ast_ari_validate_set_id(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_asterisk_info(), and ast_ari_validate_config_info_fn().

◆ ast_ari_validate_config_info_fn()

ari_validator ast_ari_validate_config_info_fn ( void  )

Function pointer to ast_ari_validate_config_info().

Definition at line 374 of file ari_model_validators.c.

375{
377}

References ast_ari_validate_config_info().

◆ ast_ari_validate_config_tuple()

int ast_ari_validate_config_tuple ( struct ast_json json)

Validator for ConfigTuple.

A key/value pair that makes up part of a configuration object.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 379 of file ari_model_validators.c.

380{
381 int res = 1;
382 struct ast_json_iter *iter;
383 int has_attribute = 0;
384 int has_value = 0;
385
386 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
387 if (strcmp("attribute", ast_json_object_iter_key(iter)) == 0) {
388 int prop_is_valid;
389 has_attribute = 1;
390 prop_is_valid = ast_ari_validate_string(
392 if (!prop_is_valid) {
393 ast_log(LOG_ERROR, "ARI ConfigTuple field attribute failed validation\n");
394 res = 0;
395 }
396 } else
397 if (strcmp("value", ast_json_object_iter_key(iter)) == 0) {
398 int prop_is_valid;
399 has_value = 1;
400 prop_is_valid = ast_ari_validate_string(
402 if (!prop_is_valid) {
403 ast_log(LOG_ERROR, "ARI ConfigTuple field value failed validation\n");
404 res = 0;
405 }
406 } else
407 {
409 "ARI ConfigTuple has undocumented field %s\n",
411 res = 0;
412 }
413 }
414
415 if (!has_attribute) {
416 ast_log(LOG_ERROR, "ARI ConfigTuple missing required field attribute\n");
417 res = 0;
418 }
419
420 if (!has_value) {
421 ast_log(LOG_ERROR, "ARI ConfigTuple missing required field value\n");
422 res = 0;
423 }
424
425 return res;
426}

References ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_config_tuple_fn().

◆ ast_ari_validate_config_tuple_fn()

ari_validator ast_ari_validate_config_tuple_fn ( void  )

Function pointer to ast_ari_validate_config_tuple().

Definition at line 428 of file ari_model_validators.c.

429{
431}
int ast_ari_validate_config_tuple(struct ast_json *json)
Validator for ConfigTuple.

References ast_ari_validate_config_tuple().

Referenced by ast_ari_asterisk_get_object_cb(), and ast_ari_asterisk_update_object_cb().

◆ ast_ari_validate_contact_info()

int ast_ari_validate_contact_info ( struct ast_json json)

Validator for ContactInfo.

Detailed information about a contact on an endpoint.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 5366 of file ari_model_validators.c.

5367{
5368 int res = 1;
5369 struct ast_json_iter *iter;
5370 int has_aor = 0;
5371 int has_contact_status = 0;
5372 int has_uri = 0;
5373
5374 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
5375 if (strcmp("aor", ast_json_object_iter_key(iter)) == 0) {
5376 int prop_is_valid;
5377 has_aor = 1;
5378 prop_is_valid = ast_ari_validate_string(
5380 if (!prop_is_valid) {
5381 ast_log(LOG_ERROR, "ARI ContactInfo field aor failed validation\n");
5382 res = 0;
5383 }
5384 } else
5385 if (strcmp("contact_status", ast_json_object_iter_key(iter)) == 0) {
5386 int prop_is_valid;
5387 has_contact_status = 1;
5388 prop_is_valid = ast_ari_validate_string(
5390 if (!prop_is_valid) {
5391 ast_log(LOG_ERROR, "ARI ContactInfo field contact_status failed validation\n");
5392 res = 0;
5393 }
5394 } else
5395 if (strcmp("roundtrip_usec", ast_json_object_iter_key(iter)) == 0) {
5396 int prop_is_valid;
5397 prop_is_valid = ast_ari_validate_string(
5399 if (!prop_is_valid) {
5400 ast_log(LOG_ERROR, "ARI ContactInfo field roundtrip_usec failed validation\n");
5401 res = 0;
5402 }
5403 } else
5404 if (strcmp("uri", ast_json_object_iter_key(iter)) == 0) {
5405 int prop_is_valid;
5406 has_uri = 1;
5407 prop_is_valid = ast_ari_validate_string(
5409 if (!prop_is_valid) {
5410 ast_log(LOG_ERROR, "ARI ContactInfo field uri failed validation\n");
5411 res = 0;
5412 }
5413 } else
5414 {
5416 "ARI ContactInfo has undocumented field %s\n",
5418 res = 0;
5419 }
5420 }
5421
5422 if (!has_aor) {
5423 ast_log(LOG_ERROR, "ARI ContactInfo missing required field aor\n");
5424 res = 0;
5425 }
5426
5427 if (!has_contact_status) {
5428 ast_log(LOG_ERROR, "ARI ContactInfo missing required field contact_status\n");
5429 res = 0;
5430 }
5431
5432 if (!has_uri) {
5433 ast_log(LOG_ERROR, "ARI ContactInfo missing required field uri\n");
5434 res = 0;
5435 }
5436
5437 return res;
5438}

References ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_contact_info_fn(), and ast_ari_validate_contact_status_change().

◆ ast_ari_validate_contact_info_fn()

ari_validator ast_ari_validate_contact_info_fn ( void  )

Function pointer to ast_ari_validate_contact_info().

Definition at line 5440 of file ari_model_validators.c.

5441{
5443}
int ast_ari_validate_contact_info(struct ast_json *json)
Validator for ContactInfo.

References ast_ari_validate_contact_info().

◆ ast_ari_validate_contact_status_change()

int ast_ari_validate_contact_status_change ( struct ast_json json)

Validator for ContactStatusChange.

The state of a contact on an endpoint has changed.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 5445 of file ari_model_validators.c.

5446{
5447 int res = 1;
5448 struct ast_json_iter *iter;
5449 int has_type = 0;
5450 int has_application = 0;
5451 int has_timestamp = 0;
5452 int has_contact_info = 0;
5453 int has_endpoint = 0;
5454
5455 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
5456 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
5457 int prop_is_valid;
5458 prop_is_valid = ast_ari_validate_string(
5460 if (!prop_is_valid) {
5461 ast_log(LOG_ERROR, "ARI ContactStatusChange field asterisk_id failed validation\n");
5462 res = 0;
5463 }
5464 } else
5465 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
5466 int prop_is_valid;
5467 has_type = 1;
5468 prop_is_valid = ast_ari_validate_string(
5470 if (!prop_is_valid) {
5471 ast_log(LOG_ERROR, "ARI ContactStatusChange field type failed validation\n");
5472 res = 0;
5473 }
5474 } else
5475 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
5476 int prop_is_valid;
5477 has_application = 1;
5478 prop_is_valid = ast_ari_validate_string(
5480 if (!prop_is_valid) {
5481 ast_log(LOG_ERROR, "ARI ContactStatusChange field application failed validation\n");
5482 res = 0;
5483 }
5484 } else
5485 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
5486 int prop_is_valid;
5487 has_timestamp = 1;
5488 prop_is_valid = ast_ari_validate_date(
5490 if (!prop_is_valid) {
5491 ast_log(LOG_ERROR, "ARI ContactStatusChange field timestamp failed validation\n");
5492 res = 0;
5493 }
5494 } else
5495 if (strcmp("contact_info", ast_json_object_iter_key(iter)) == 0) {
5496 int prop_is_valid;
5497 has_contact_info = 1;
5498 prop_is_valid = ast_ari_validate_contact_info(
5500 if (!prop_is_valid) {
5501 ast_log(LOG_ERROR, "ARI ContactStatusChange field contact_info failed validation\n");
5502 res = 0;
5503 }
5504 } else
5505 if (strcmp("endpoint", ast_json_object_iter_key(iter)) == 0) {
5506 int prop_is_valid;
5507 has_endpoint = 1;
5508 prop_is_valid = ast_ari_validate_endpoint(
5510 if (!prop_is_valid) {
5511 ast_log(LOG_ERROR, "ARI ContactStatusChange field endpoint failed validation\n");
5512 res = 0;
5513 }
5514 } else
5515 {
5517 "ARI ContactStatusChange has undocumented field %s\n",
5519 res = 0;
5520 }
5521 }
5522
5523 if (!has_type) {
5524 ast_log(LOG_ERROR, "ARI ContactStatusChange missing required field type\n");
5525 res = 0;
5526 }
5527
5528 if (!has_application) {
5529 ast_log(LOG_ERROR, "ARI ContactStatusChange missing required field application\n");
5530 res = 0;
5531 }
5532
5533 if (!has_timestamp) {
5534 ast_log(LOG_ERROR, "ARI ContactStatusChange missing required field timestamp\n");
5535 res = 0;
5536 }
5537
5538 if (!has_contact_info) {
5539 ast_log(LOG_ERROR, "ARI ContactStatusChange missing required field contact_info\n");
5540 res = 0;
5541 }
5542
5543 if (!has_endpoint) {
5544 ast_log(LOG_ERROR, "ARI ContactStatusChange missing required field endpoint\n");
5545 res = 0;
5546 }
5547
5548 return res;
5549}

References ast_ari_validate_contact_info(), ast_ari_validate_date(), ast_ari_validate_endpoint(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_contact_status_change_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_contact_status_change_fn()

ari_validator ast_ari_validate_contact_status_change_fn ( void  )

Function pointer to ast_ari_validate_contact_status_change().

Definition at line 5551 of file ari_model_validators.c.

5552{
5554}
int ast_ari_validate_contact_status_change(struct ast_json *json)
Validator for ContactStatusChange.

References ast_ari_validate_contact_status_change().

◆ ast_ari_validate_device_state()

int ast_ari_validate_device_state ( struct ast_json json)

Validator for DeviceState.

Represents the state of a device.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 2307 of file ari_model_validators.c.

2308{
2309 int res = 1;
2310 struct ast_json_iter *iter;
2311 int has_name = 0;
2312 int has_state = 0;
2313
2314 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2315 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
2316 int prop_is_valid;
2317 has_name = 1;
2318 prop_is_valid = ast_ari_validate_string(
2320 if (!prop_is_valid) {
2321 ast_log(LOG_ERROR, "ARI DeviceState field name failed validation\n");
2322 res = 0;
2323 }
2324 } else
2325 if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
2326 int prop_is_valid;
2327 has_state = 1;
2328 prop_is_valid = ast_ari_validate_string(
2330 if (!prop_is_valid) {
2331 ast_log(LOG_ERROR, "ARI DeviceState field state failed validation\n");
2332 res = 0;
2333 }
2334 } else
2335 {
2337 "ARI DeviceState has undocumented field %s\n",
2339 res = 0;
2340 }
2341 }
2342
2343 if (!has_name) {
2344 ast_log(LOG_ERROR, "ARI DeviceState missing required field name\n");
2345 res = 0;
2346 }
2347
2348 if (!has_state) {
2349 ast_log(LOG_ERROR, "ARI DeviceState missing required field state\n");
2350 res = 0;
2351 }
2352
2353 return res;
2354}

References ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_device_states_get_cb(), ast_ari_validate_device_state_changed(), and ast_ari_validate_device_state_fn().

◆ ast_ari_validate_device_state_changed()

int ast_ari_validate_device_state_changed ( struct ast_json json)

Validator for DeviceStateChanged.

Notification that a device state has changed.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 5556 of file ari_model_validators.c.

5557{
5558 int res = 1;
5559 struct ast_json_iter *iter;
5560 int has_type = 0;
5561 int has_application = 0;
5562 int has_timestamp = 0;
5563 int has_device_state = 0;
5564
5565 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
5566 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
5567 int prop_is_valid;
5568 prop_is_valid = ast_ari_validate_string(
5570 if (!prop_is_valid) {
5571 ast_log(LOG_ERROR, "ARI DeviceStateChanged field asterisk_id failed validation\n");
5572 res = 0;
5573 }
5574 } else
5575 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
5576 int prop_is_valid;
5577 has_type = 1;
5578 prop_is_valid = ast_ari_validate_string(
5580 if (!prop_is_valid) {
5581 ast_log(LOG_ERROR, "ARI DeviceStateChanged field type failed validation\n");
5582 res = 0;
5583 }
5584 } else
5585 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
5586 int prop_is_valid;
5587 has_application = 1;
5588 prop_is_valid = ast_ari_validate_string(
5590 if (!prop_is_valid) {
5591 ast_log(LOG_ERROR, "ARI DeviceStateChanged field application failed validation\n");
5592 res = 0;
5593 }
5594 } else
5595 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
5596 int prop_is_valid;
5597 has_timestamp = 1;
5598 prop_is_valid = ast_ari_validate_date(
5600 if (!prop_is_valid) {
5601 ast_log(LOG_ERROR, "ARI DeviceStateChanged field timestamp failed validation\n");
5602 res = 0;
5603 }
5604 } else
5605 if (strcmp("device_state", ast_json_object_iter_key(iter)) == 0) {
5606 int prop_is_valid;
5607 has_device_state = 1;
5608 prop_is_valid = ast_ari_validate_device_state(
5610 if (!prop_is_valid) {
5611 ast_log(LOG_ERROR, "ARI DeviceStateChanged field device_state failed validation\n");
5612 res = 0;
5613 }
5614 } else
5615 {
5617 "ARI DeviceStateChanged has undocumented field %s\n",
5619 res = 0;
5620 }
5621 }
5622
5623 if (!has_type) {
5624 ast_log(LOG_ERROR, "ARI DeviceStateChanged missing required field type\n");
5625 res = 0;
5626 }
5627
5628 if (!has_application) {
5629 ast_log(LOG_ERROR, "ARI DeviceStateChanged missing required field application\n");
5630 res = 0;
5631 }
5632
5633 if (!has_timestamp) {
5634 ast_log(LOG_ERROR, "ARI DeviceStateChanged missing required field timestamp\n");
5635 res = 0;
5636 }
5637
5638 if (!has_device_state) {
5639 ast_log(LOG_ERROR, "ARI DeviceStateChanged missing required field device_state\n");
5640 res = 0;
5641 }
5642
5643 return res;
5644}
int ast_ari_validate_device_state(struct ast_json *json)
Validator for DeviceState.

References ast_ari_validate_date(), ast_ari_validate_device_state(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_device_state_changed_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_device_state_changed_fn()

ari_validator ast_ari_validate_device_state_changed_fn ( void  )

Function pointer to ast_ari_validate_device_state_changed().

Definition at line 5646 of file ari_model_validators.c.

5647{
5649}
int ast_ari_validate_device_state_changed(struct ast_json *json)
Validator for DeviceStateChanged.

References ast_ari_validate_device_state_changed().

◆ ast_ari_validate_device_state_fn()

ari_validator ast_ari_validate_device_state_fn ( void  )

Function pointer to ast_ari_validate_device_state().

Definition at line 2356 of file ari_model_validators.c.

2357{
2359}

References ast_ari_validate_device_state().

Referenced by ast_ari_device_states_list_cb().

◆ ast_ari_validate_dial()

int ast_ari_validate_dial ( struct ast_json json)

Validator for Dial.

Dialing state has changed.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 5651 of file ari_model_validators.c.

5652{
5653 int res = 1;
5654 struct ast_json_iter *iter;
5655 int has_type = 0;
5656 int has_application = 0;
5657 int has_timestamp = 0;
5658 int has_dialstatus = 0;
5659 int has_peer = 0;
5660
5661 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
5662 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
5663 int prop_is_valid;
5664 prop_is_valid = ast_ari_validate_string(
5666 if (!prop_is_valid) {
5667 ast_log(LOG_ERROR, "ARI Dial field asterisk_id failed validation\n");
5668 res = 0;
5669 }
5670 } else
5671 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
5672 int prop_is_valid;
5673 has_type = 1;
5674 prop_is_valid = ast_ari_validate_string(
5676 if (!prop_is_valid) {
5677 ast_log(LOG_ERROR, "ARI Dial field type failed validation\n");
5678 res = 0;
5679 }
5680 } else
5681 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
5682 int prop_is_valid;
5683 has_application = 1;
5684 prop_is_valid = ast_ari_validate_string(
5686 if (!prop_is_valid) {
5687 ast_log(LOG_ERROR, "ARI Dial field application failed validation\n");
5688 res = 0;
5689 }
5690 } else
5691 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
5692 int prop_is_valid;
5693 has_timestamp = 1;
5694 prop_is_valid = ast_ari_validate_date(
5696 if (!prop_is_valid) {
5697 ast_log(LOG_ERROR, "ARI Dial field timestamp failed validation\n");
5698 res = 0;
5699 }
5700 } else
5701 if (strcmp("caller", ast_json_object_iter_key(iter)) == 0) {
5702 int prop_is_valid;
5703 prop_is_valid = ast_ari_validate_channel(
5705 if (!prop_is_valid) {
5706 ast_log(LOG_ERROR, "ARI Dial field caller failed validation\n");
5707 res = 0;
5708 }
5709 } else
5710 if (strcmp("dialstatus", ast_json_object_iter_key(iter)) == 0) {
5711 int prop_is_valid;
5712 has_dialstatus = 1;
5713 prop_is_valid = ast_ari_validate_string(
5715 if (!prop_is_valid) {
5716 ast_log(LOG_ERROR, "ARI Dial field dialstatus failed validation\n");
5717 res = 0;
5718 }
5719 } else
5720 if (strcmp("dialstring", ast_json_object_iter_key(iter)) == 0) {
5721 int prop_is_valid;
5722 prop_is_valid = ast_ari_validate_string(
5724 if (!prop_is_valid) {
5725 ast_log(LOG_ERROR, "ARI Dial field dialstring failed validation\n");
5726 res = 0;
5727 }
5728 } else
5729 if (strcmp("forward", ast_json_object_iter_key(iter)) == 0) {
5730 int prop_is_valid;
5731 prop_is_valid = ast_ari_validate_string(
5733 if (!prop_is_valid) {
5734 ast_log(LOG_ERROR, "ARI Dial field forward failed validation\n");
5735 res = 0;
5736 }
5737 } else
5738 if (strcmp("forwarded", ast_json_object_iter_key(iter)) == 0) {
5739 int prop_is_valid;
5740 prop_is_valid = ast_ari_validate_channel(
5742 if (!prop_is_valid) {
5743 ast_log(LOG_ERROR, "ARI Dial field forwarded failed validation\n");
5744 res = 0;
5745 }
5746 } else
5747 if (strcmp("peer", ast_json_object_iter_key(iter)) == 0) {
5748 int prop_is_valid;
5749 has_peer = 1;
5750 prop_is_valid = ast_ari_validate_channel(
5752 if (!prop_is_valid) {
5753 ast_log(LOG_ERROR, "ARI Dial field peer failed validation\n");
5754 res = 0;
5755 }
5756 } else
5757 {
5759 "ARI Dial has undocumented field %s\n",
5761 res = 0;
5762 }
5763 }
5764
5765 if (!has_type) {
5766 ast_log(LOG_ERROR, "ARI Dial missing required field type\n");
5767 res = 0;
5768 }
5769
5770 if (!has_application) {
5771 ast_log(LOG_ERROR, "ARI Dial missing required field application\n");
5772 res = 0;
5773 }
5774
5775 if (!has_timestamp) {
5776 ast_log(LOG_ERROR, "ARI Dial missing required field timestamp\n");
5777 res = 0;
5778 }
5779
5780 if (!has_dialstatus) {
5781 ast_log(LOG_ERROR, "ARI Dial missing required field dialstatus\n");
5782 res = 0;
5783 }
5784
5785 if (!has_peer) {
5786 ast_log(LOG_ERROR, "ARI Dial missing required field peer\n");
5787 res = 0;
5788 }
5789
5790 return res;
5791}

References ast_ari_validate_channel(), ast_ari_validate_date(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_dial_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_dial_fn()

ari_validator ast_ari_validate_dial_fn ( void  )

Function pointer to ast_ari_validate_dial().

Definition at line 5793 of file ari_model_validators.c.

5794{
5795 return ast_ari_validate_dial;
5796}
int ast_ari_validate_dial(struct ast_json *json)
Validator for Dial.

References ast_ari_validate_dial().

◆ ast_ari_validate_dialed()

int ast_ari_validate_dialed ( struct ast_json json)

Validator for Dialed.

Dialed channel information.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 1243 of file ari_model_validators.c.

1244{
1245 int res = 1;
1246 struct ast_json_iter *iter;
1247
1248 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1249 {
1251 "ARI Dialed has undocumented field %s\n",
1253 res = 0;
1254 }
1255 }
1256
1257 return res;
1258}

References ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_dialed_fn().

◆ ast_ari_validate_dialed_fn()

ari_validator ast_ari_validate_dialed_fn ( void  )

Function pointer to ast_ari_validate_dialed().

Definition at line 1260 of file ari_model_validators.c.

1261{
1263}
int ast_ari_validate_dialed(struct ast_json *json)
Validator for Dialed.

References ast_ari_validate_dialed().

◆ ast_ari_validate_dialplan_cep()

int ast_ari_validate_dialplan_cep ( struct ast_json json)

Validator for DialplanCEP.

Dialplan location (context/extension/priority)

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 1265 of file ari_model_validators.c.

1266{
1267 int res = 1;
1268 struct ast_json_iter *iter;
1269 int has_app_data = 0;
1270 int has_app_name = 0;
1271 int has_context = 0;
1272 int has_exten = 0;
1273 int has_priority = 0;
1274
1275 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1276 if (strcmp("app_data", ast_json_object_iter_key(iter)) == 0) {
1277 int prop_is_valid;
1278 has_app_data = 1;
1279 prop_is_valid = ast_ari_validate_string(
1281 if (!prop_is_valid) {
1282 ast_log(LOG_ERROR, "ARI DialplanCEP field app_data failed validation\n");
1283 res = 0;
1284 }
1285 } else
1286 if (strcmp("app_name", ast_json_object_iter_key(iter)) == 0) {
1287 int prop_is_valid;
1288 has_app_name = 1;
1289 prop_is_valid = ast_ari_validate_string(
1291 if (!prop_is_valid) {
1292 ast_log(LOG_ERROR, "ARI DialplanCEP field app_name failed validation\n");
1293 res = 0;
1294 }
1295 } else
1296 if (strcmp("context", ast_json_object_iter_key(iter)) == 0) {
1297 int prop_is_valid;
1298 has_context = 1;
1299 prop_is_valid = ast_ari_validate_string(
1301 if (!prop_is_valid) {
1302 ast_log(LOG_ERROR, "ARI DialplanCEP field context failed validation\n");
1303 res = 0;
1304 }
1305 } else
1306 if (strcmp("exten", ast_json_object_iter_key(iter)) == 0) {
1307 int prop_is_valid;
1308 has_exten = 1;
1309 prop_is_valid = ast_ari_validate_string(
1311 if (!prop_is_valid) {
1312 ast_log(LOG_ERROR, "ARI DialplanCEP field exten failed validation\n");
1313 res = 0;
1314 }
1315 } else
1316 if (strcmp("priority", ast_json_object_iter_key(iter)) == 0) {
1317 int prop_is_valid;
1318 has_priority = 1;
1319 prop_is_valid = ast_ari_validate_long(
1321 if (!prop_is_valid) {
1322 ast_log(LOG_ERROR, "ARI DialplanCEP field priority failed validation\n");
1323 res = 0;
1324 }
1325 } else
1326 {
1328 "ARI DialplanCEP has undocumented field %s\n",
1330 res = 0;
1331 }
1332 }
1333
1334 if (!has_app_data) {
1335 ast_log(LOG_ERROR, "ARI DialplanCEP missing required field app_data\n");
1336 res = 0;
1337 }
1338
1339 if (!has_app_name) {
1340 ast_log(LOG_ERROR, "ARI DialplanCEP missing required field app_name\n");
1341 res = 0;
1342 }
1343
1344 if (!has_context) {
1345 ast_log(LOG_ERROR, "ARI DialplanCEP missing required field context\n");
1346 res = 0;
1347 }
1348
1349 if (!has_exten) {
1350 ast_log(LOG_ERROR, "ARI DialplanCEP missing required field exten\n");
1351 res = 0;
1352 }
1353
1354 if (!has_priority) {
1355 ast_log(LOG_ERROR, "ARI DialplanCEP missing required field priority\n");
1356 res = 0;
1357 }
1358
1359 return res;
1360}
int ast_ari_validate_long(struct ast_json *json)
Validator for native Swagger long.
static int has_priority(void)
Check whether we were set to high(er) priority.
Definition: asterisk.c:1779

References ast_ari_validate_long(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, has_priority(), and LOG_ERROR.

Referenced by ast_ari_validate_channel(), and ast_ari_validate_dialplan_cep_fn().

◆ ast_ari_validate_dialplan_cep_fn()

ari_validator ast_ari_validate_dialplan_cep_fn ( void  )

Function pointer to ast_ari_validate_dialplan_cep().

Definition at line 1362 of file ari_model_validators.c.

1363{
1365}

References ast_ari_validate_dialplan_cep().

◆ ast_ari_validate_endpoint()

int ast_ari_validate_endpoint ( struct ast_json json)

Validator for Endpoint.

An external device that may offer/accept calls to/from Asterisk.

Unlike most resources, which have a single unique identifier, an endpoint is uniquely identified by the technology/resource pair.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 821 of file ari_model_validators.c.

822{
823 int res = 1;
824 struct ast_json_iter *iter;
825 int has_channel_ids = 0;
826 int has_resource = 0;
827 int has_technology = 0;
828
829 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
830 if (strcmp("channel_ids", ast_json_object_iter_key(iter)) == 0) {
831 int prop_is_valid;
832 has_channel_ids = 1;
833 prop_is_valid = ast_ari_validate_list(
836 if (!prop_is_valid) {
837 ast_log(LOG_ERROR, "ARI Endpoint field channel_ids failed validation\n");
838 res = 0;
839 }
840 } else
841 if (strcmp("resource", ast_json_object_iter_key(iter)) == 0) {
842 int prop_is_valid;
843 has_resource = 1;
844 prop_is_valid = ast_ari_validate_string(
846 if (!prop_is_valid) {
847 ast_log(LOG_ERROR, "ARI Endpoint field resource failed validation\n");
848 res = 0;
849 }
850 } else
851 if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
852 int prop_is_valid;
853 prop_is_valid = ast_ari_validate_string(
855 if (!prop_is_valid) {
856 ast_log(LOG_ERROR, "ARI Endpoint field state failed validation\n");
857 res = 0;
858 }
859 } else
860 if (strcmp("technology", ast_json_object_iter_key(iter)) == 0) {
861 int prop_is_valid;
862 has_technology = 1;
863 prop_is_valid = ast_ari_validate_string(
865 if (!prop_is_valid) {
866 ast_log(LOG_ERROR, "ARI Endpoint field technology failed validation\n");
867 res = 0;
868 }
869 } else
870 {
872 "ARI Endpoint has undocumented field %s\n",
874 res = 0;
875 }
876 }
877
878 if (!has_channel_ids) {
879 ast_log(LOG_ERROR, "ARI Endpoint missing required field channel_ids\n");
880 res = 0;
881 }
882
883 if (!has_resource) {
884 ast_log(LOG_ERROR, "ARI Endpoint missing required field resource\n");
885 res = 0;
886 }
887
888 if (!has_technology) {
889 ast_log(LOG_ERROR, "ARI Endpoint missing required field technology\n");
890 res = 0;
891 }
892
893 return res;
894}

References ast_ari_validate_list(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_endpoints_get_cb(), ast_ari_validate_channel_userevent(), ast_ari_validate_contact_status_change(), ast_ari_validate_endpoint_fn(), ast_ari_validate_endpoint_state_change(), ast_ari_validate_peer_status_change(), and ast_ari_validate_text_message_received().

◆ ast_ari_validate_endpoint_fn()

ari_validator ast_ari_validate_endpoint_fn ( void  )

Function pointer to ast_ari_validate_endpoint().

Definition at line 896 of file ari_model_validators.c.

897{
899}

References ast_ari_validate_endpoint().

Referenced by ast_ari_endpoints_list_by_tech_cb(), and ast_ari_endpoints_list_cb().

◆ ast_ari_validate_endpoint_state_change()

int ast_ari_validate_endpoint_state_change ( struct ast_json json)

Validator for EndpointStateChange.

Endpoint state changed.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 5798 of file ari_model_validators.c.

5799{
5800 int res = 1;
5801 struct ast_json_iter *iter;
5802 int has_type = 0;
5803 int has_application = 0;
5804 int has_timestamp = 0;
5805 int has_endpoint = 0;
5806
5807 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
5808 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
5809 int prop_is_valid;
5810 prop_is_valid = ast_ari_validate_string(
5812 if (!prop_is_valid) {
5813 ast_log(LOG_ERROR, "ARI EndpointStateChange field asterisk_id failed validation\n");
5814 res = 0;
5815 }
5816 } else
5817 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
5818 int prop_is_valid;
5819 has_type = 1;
5820 prop_is_valid = ast_ari_validate_string(
5822 if (!prop_is_valid) {
5823 ast_log(LOG_ERROR, "ARI EndpointStateChange field type failed validation\n");
5824 res = 0;
5825 }
5826 } else
5827 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
5828 int prop_is_valid;
5829 has_application = 1;
5830 prop_is_valid = ast_ari_validate_string(
5832 if (!prop_is_valid) {
5833 ast_log(LOG_ERROR, "ARI EndpointStateChange field application failed validation\n");
5834 res = 0;
5835 }
5836 } else
5837 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
5838 int prop_is_valid;
5839 has_timestamp = 1;
5840 prop_is_valid = ast_ari_validate_date(
5842 if (!prop_is_valid) {
5843 ast_log(LOG_ERROR, "ARI EndpointStateChange field timestamp failed validation\n");
5844 res = 0;
5845 }
5846 } else
5847 if (strcmp("endpoint", ast_json_object_iter_key(iter)) == 0) {
5848 int prop_is_valid;
5849 has_endpoint = 1;
5850 prop_is_valid = ast_ari_validate_endpoint(
5852 if (!prop_is_valid) {
5853 ast_log(LOG_ERROR, "ARI EndpointStateChange field endpoint failed validation\n");
5854 res = 0;
5855 }
5856 } else
5857 {
5859 "ARI EndpointStateChange has undocumented field %s\n",
5861 res = 0;
5862 }
5863 }
5864
5865 if (!has_type) {
5866 ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field type\n");
5867 res = 0;
5868 }
5869
5870 if (!has_application) {
5871 ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field application\n");
5872 res = 0;
5873 }
5874
5875 if (!has_timestamp) {
5876 ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field timestamp\n");
5877 res = 0;
5878 }
5879
5880 if (!has_endpoint) {
5881 ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field endpoint\n");
5882 res = 0;
5883 }
5884
5885 return res;
5886}

References ast_ari_validate_date(), ast_ari_validate_endpoint(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_endpoint_state_change_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

◆ ast_ari_validate_endpoint_state_change_fn()

ari_validator ast_ari_validate_endpoint_state_change_fn ( void  )

Function pointer to ast_ari_validate_endpoint_state_change().

Definition at line 5888 of file ari_model_validators.c.

5889{
5891}
int ast_ari_validate_endpoint_state_change(struct ast_json *json)
Validator for EndpointStateChange.

References ast_ari_validate_endpoint_state_change().

◆ ast_ari_validate_event()

int ast_ari_validate_event ( struct ast_json json)

Validator for Event.

Base type for asynchronous events from Asterisk.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 5893 of file ari_model_validators.c.

5894{
5895 int res = 1;
5896 struct ast_json_iter *iter;
5897 int has_type = 0;
5898 int has_application = 0;
5899 int has_timestamp = 0;
5900 const char *discriminator;
5901
5902 discriminator = ast_json_string_get(ast_json_object_get(json, "type"));
5903 if (!discriminator) {
5904 ast_log(LOG_ERROR, "ARI Event missing required field type\n");
5905 return 0;
5906 }
5907
5908 if (strcmp("Event", discriminator) == 0) {
5909 /* Self type; fall through */
5910 } else
5911 if (strcmp("ApplicationMoveFailed", discriminator) == 0) {
5913 } else
5914 if (strcmp("ApplicationReplaced", discriminator) == 0) {
5916 } else
5917 if (strcmp("BridgeAttendedTransfer", discriminator) == 0) {
5919 } else
5920 if (strcmp("BridgeBlindTransfer", discriminator) == 0) {
5922 } else
5923 if (strcmp("BridgeCreated", discriminator) == 0) {
5925 } else
5926 if (strcmp("BridgeDestroyed", discriminator) == 0) {
5928 } else
5929 if (strcmp("BridgeMerged", discriminator) == 0) {
5930 return ast_ari_validate_bridge_merged(json);
5931 } else
5932 if (strcmp("BridgeVideoSourceChanged", discriminator) == 0) {
5934 } else
5935 if (strcmp("ChannelCallerId", discriminator) == 0) {
5937 } else
5938 if (strcmp("ChannelConnectedLine", discriminator) == 0) {
5940 } else
5941 if (strcmp("ChannelCreated", discriminator) == 0) {
5943 } else
5944 if (strcmp("ChannelDestroyed", discriminator) == 0) {
5946 } else
5947 if (strcmp("ChannelDialplan", discriminator) == 0) {
5949 } else
5950 if (strcmp("ChannelDtmfReceived", discriminator) == 0) {
5952 } else
5953 if (strcmp("ChannelEnteredBridge", discriminator) == 0) {
5955 } else
5956 if (strcmp("ChannelHangupRequest", discriminator) == 0) {
5958 } else
5959 if (strcmp("ChannelHold", discriminator) == 0) {
5960 return ast_ari_validate_channel_hold(json);
5961 } else
5962 if (strcmp("ChannelLeftBridge", discriminator) == 0) {
5964 } else
5965 if (strcmp("ChannelStateChange", discriminator) == 0) {
5967 } else
5968 if (strcmp("ChannelTalkingFinished", discriminator) == 0) {
5970 } else
5971 if (strcmp("ChannelTalkingStarted", discriminator) == 0) {
5973 } else
5974 if (strcmp("ChannelToneDetected", discriminator) == 0) {
5976 } else
5977 if (strcmp("ChannelUnhold", discriminator) == 0) {
5979 } else
5980 if (strcmp("ChannelUserevent", discriminator) == 0) {
5982 } else
5983 if (strcmp("ChannelVarset", discriminator) == 0) {
5985 } else
5986 if (strcmp("ContactStatusChange", discriminator) == 0) {
5988 } else
5989 if (strcmp("DeviceStateChanged", discriminator) == 0) {
5991 } else
5992 if (strcmp("Dial", discriminator) == 0) {
5993 return ast_ari_validate_dial(json);
5994 } else
5995 if (strcmp("EndpointStateChange", discriminator) == 0) {
5997 } else
5998 if (strcmp("PeerStatusChange", discriminator) == 0) {
6000 } else
6001 if (strcmp("PlaybackContinuing", discriminator) == 0) {
6003 } else
6004 if (strcmp("PlaybackFinished", discriminator) == 0) {
6006 } else
6007 if (strcmp("PlaybackStarted", discriminator) == 0) {
6009 } else
6010 if (strcmp("RecordingFailed", discriminator) == 0) {
6012 } else
6013 if (strcmp("RecordingFinished", discriminator) == 0) {
6015 } else
6016 if (strcmp("RecordingStarted", discriminator) == 0) {
6018 } else
6019 if (strcmp("StasisEnd", discriminator) == 0) {
6020 return ast_ari_validate_stasis_end(json);
6021 } else
6022 if (strcmp("StasisStart", discriminator) == 0) {
6023 return ast_ari_validate_stasis_start(json);
6024 } else
6025 if (strcmp("TextMessageReceived", discriminator) == 0) {
6027 } else
6028 {
6029 ast_log(LOG_ERROR, "ARI Event has undocumented subtype %s\n",
6030 discriminator);
6031 res = 0;
6032 }
6033
6034 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6035 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6036 int prop_is_valid;
6037 prop_is_valid = ast_ari_validate_string(
6039 if (!prop_is_valid) {
6040 ast_log(LOG_ERROR, "ARI Event field asterisk_id failed validation\n");
6041 res = 0;
6042 }
6043 } else
6044 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6045 int prop_is_valid;
6046 has_type = 1;
6047 prop_is_valid = ast_ari_validate_string(
6049 if (!prop_is_valid) {
6050 ast_log(LOG_ERROR, "ARI Event field type failed validation\n");
6051 res = 0;
6052 }
6053 } else
6054 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
6055 int prop_is_valid;
6056 has_application = 1;
6057 prop_is_valid = ast_ari_validate_string(
6059 if (!prop_is_valid) {
6060 ast_log(LOG_ERROR, "ARI Event field application failed validation\n");
6061 res = 0;
6062 }
6063 } else
6064 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
6065 int prop_is_valid;
6066 has_timestamp = 1;
6067 prop_is_valid = ast_ari_validate_date(
6069 if (!prop_is_valid) {
6070 ast_log(LOG_ERROR, "ARI Event field timestamp failed validation\n");
6071 res = 0;
6072 }
6073 } else
6074 {
6076 "ARI Event has undocumented field %s\n",
6078 res = 0;
6079 }
6080 }
6081
6082 if (!has_type) {
6083 ast_log(LOG_ERROR, "ARI Event missing required field type\n");
6084 res = 0;
6085 }
6086
6087 if (!has_application) {
6088 ast_log(LOG_ERROR, "ARI Event missing required field application\n");
6089 res = 0;
6090 }
6091
6092 if (!has_timestamp) {
6093 ast_log(LOG_ERROR, "ARI Event missing required field timestamp\n");
6094 res = 0;
6095 }
6096
6097 return res;
6098}
int ast_ari_validate_text_message_received(struct ast_json *json)
Validator for TextMessageReceived.
int ast_ari_validate_playback_finished(struct ast_json *json)
Validator for PlaybackFinished.
int ast_ari_validate_stasis_start(struct ast_json *json)
Validator for StasisStart.
int ast_ari_validate_stasis_end(struct ast_json *json)
Validator for StasisEnd.
int ast_ari_validate_playback_started(struct ast_json *json)
Validator for PlaybackStarted.
int ast_ari_validate_peer_status_change(struct ast_json *json)
Validator for PeerStatusChange.
int ast_ari_validate_playback_continuing(struct ast_json *json)
Validator for PlaybackContinuing.
int ast_ari_validate_recording_finished(struct ast_json *json)
Validator for RecordingFinished.
int ast_ari_validate_recording_started(struct ast_json *json)
Validator for RecordingStarted.
int ast_ari_validate_recording_failed(struct ast_json *json)
Validator for RecordingFailed.
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
Definition: json.c:283
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
Definition: json.c:407

References ast_ari_validate_application_move_failed(), ast_ari_validate_application_replaced(), 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_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_contact_status_change(), ast_ari_validate_date(), ast_ari_validate_device_state_changed(), ast_ari_validate_dial(), ast_ari_validate_endpoint_state_change(), ast_ari_validate_peer_status_change(), 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_stasis_end(), ast_ari_validate_stasis_start(), ast_ari_validate_string(), ast_ari_validate_text_message_received(), ast_json_object_get(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_json_string_get(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_event_fn(), and ast_ari_validate_message().

◆ ast_ari_validate_event_fn()

ari_validator ast_ari_validate_event_fn ( void  )

Function pointer to ast_ari_validate_event().

Definition at line 6100 of file ari_model_validators.c.

6101{
6103}
int ast_ari_validate_event(struct ast_json *json)
Validator for Event.

References ast_ari_validate_event().

◆ ast_ari_validate_format_lang_pair()

int ast_ari_validate_format_lang_pair ( struct ast_json json)

Validator for FormatLangPair.

Identifies the format and language of a sound file

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 2085 of file ari_model_validators.c.

2086{
2087 int res = 1;
2088 struct ast_json_iter *iter;
2089 int has_format = 0;
2090 int has_language = 0;
2091
2092 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2093 if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
2094 int prop_is_valid;
2095 has_format = 1;
2096 prop_is_valid = ast_ari_validate_string(
2098 if (!prop_is_valid) {
2099 ast_log(LOG_ERROR, "ARI FormatLangPair field format failed validation\n");
2100 res = 0;
2101 }
2102 } else
2103 if (strcmp("language", ast_json_object_iter_key(iter)) == 0) {
2104 int prop_is_valid;
2105 has_language = 1;
2106 prop_is_valid = ast_ari_validate_string(
2108 if (!prop_is_valid) {
2109 ast_log(LOG_ERROR, "ARI FormatLangPair field language failed validation\n");
2110 res = 0;
2111 }
2112 } else
2113 {
2115 "ARI FormatLangPair has undocumented field %s\n",
2117 res = 0;
2118 }
2119 }
2120
2121 if (!has_format) {
2122 ast_log(LOG_ERROR, "ARI FormatLangPair missing required field format\n");
2123 res = 0;
2124 }
2125
2126 if (!has_language) {
2127 ast_log(LOG_ERROR, "ARI FormatLangPair missing required field language\n");
2128 res = 0;
2129 }
2130
2131 return res;
2132}

References ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_format_lang_pair_fn(), and ast_ari_validate_sound().

◆ ast_ari_validate_format_lang_pair_fn()

ari_validator ast_ari_validate_format_lang_pair_fn ( void  )

Function pointer to ast_ari_validate_format_lang_pair().

Definition at line 2134 of file ari_model_validators.c.

2135{
2137}
int ast_ari_validate_format_lang_pair(struct ast_json *json)
Validator for FormatLangPair.

References ast_ari_validate_format_lang_pair().

◆ ast_ari_validate_live_recording()

int ast_ari_validate_live_recording ( struct ast_json json)

Validator for LiveRecording.

A recording that is in progress

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 1909 of file ari_model_validators.c.

1910{
1911 int res = 1;
1912 struct ast_json_iter *iter;
1913 int has_format = 0;
1914 int has_name = 0;
1915 int has_state = 0;
1916 int has_target_uri = 0;
1917
1918 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1919 if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
1920 int prop_is_valid;
1921 prop_is_valid = ast_ari_validate_string(
1923 if (!prop_is_valid) {
1924 ast_log(LOG_ERROR, "ARI LiveRecording field cause failed validation\n");
1925 res = 0;
1926 }
1927 } else
1928 if (strcmp("duration", ast_json_object_iter_key(iter)) == 0) {
1929 int prop_is_valid;
1930 prop_is_valid = ast_ari_validate_int(
1932 if (!prop_is_valid) {
1933 ast_log(LOG_ERROR, "ARI LiveRecording field duration failed validation\n");
1934 res = 0;
1935 }
1936 } else
1937 if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
1938 int prop_is_valid;
1939 has_format = 1;
1940 prop_is_valid = ast_ari_validate_string(
1942 if (!prop_is_valid) {
1943 ast_log(LOG_ERROR, "ARI LiveRecording field format failed validation\n");
1944 res = 0;
1945 }
1946 } else
1947 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1948 int prop_is_valid;
1949 has_name = 1;
1950 prop_is_valid = ast_ari_validate_string(
1952 if (!prop_is_valid) {
1953 ast_log(LOG_ERROR, "ARI LiveRecording field name failed validation\n");
1954 res = 0;
1955 }
1956 } else
1957 if (strcmp("silence_duration", ast_json_object_iter_key(iter)) == 0) {
1958 int prop_is_valid;
1959 prop_is_valid = ast_ari_validate_int(
1961 if (!prop_is_valid) {
1962 ast_log(LOG_ERROR, "ARI LiveRecording field silence_duration failed validation\n");
1963 res = 0;
1964 }
1965 } else
1966 if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
1967 int prop_is_valid;
1968 has_state = 1;
1969 prop_is_valid = ast_ari_validate_string(
1971 if (!prop_is_valid) {
1972 ast_log(LOG_ERROR, "ARI LiveRecording field state failed validation\n");
1973 res = 0;
1974 }
1975 } else
1976 if (strcmp("talking_duration", ast_json_object_iter_key(iter)) == 0) {
1977 int prop_is_valid;
1978 prop_is_valid = ast_ari_validate_int(
1980 if (!prop_is_valid) {
1981 ast_log(LOG_ERROR, "ARI LiveRecording field talking_duration failed validation\n");
1982 res = 0;
1983 }
1984 } else
1985 if (strcmp("target_uri", ast_json_object_iter_key(iter)) == 0) {
1986 int prop_is_valid;
1987 has_target_uri = 1;
1988 prop_is_valid = ast_ari_validate_string(
1990 if (!prop_is_valid) {
1991 ast_log(LOG_ERROR, "ARI LiveRecording field target_uri failed validation\n");
1992 res = 0;
1993 }
1994 } else
1995 {
1997 "ARI LiveRecording has undocumented field %s\n",
1999 res = 0;
2000 }
2001 }
2002
2003 if (!has_format) {
2004 ast_log(LOG_ERROR, "ARI LiveRecording missing required field format\n");
2005 res = 0;
2006 }
2007
2008 if (!has_name) {
2009 ast_log(LOG_ERROR, "ARI LiveRecording missing required field name\n");
2010 res = 0;
2011 }
2012
2013 if (!has_state) {
2014 ast_log(LOG_ERROR, "ARI LiveRecording missing required field state\n");
2015 res = 0;
2016 }
2017
2018 if (!has_target_uri) {
2019 ast_log(LOG_ERROR, "ARI LiveRecording missing required field target_uri\n");
2020 res = 0;
2021 }
2022
2023 return res;
2024}

References ast_ari_validate_int(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_bridges_record_cb(), ast_ari_channels_record_cb(), ast_ari_recordings_get_live_cb(), ast_ari_validate_live_recording_fn(), ast_ari_validate_recording_failed(), ast_ari_validate_recording_finished(), and ast_ari_validate_recording_started().

◆ ast_ari_validate_live_recording_fn()

ari_validator ast_ari_validate_live_recording_fn ( void  )

Function pointer to ast_ari_validate_live_recording().

Definition at line 2026 of file ari_model_validators.c.

2027{
2029}
int ast_ari_validate_live_recording(struct ast_json *json)
Validator for LiveRecording.

References ast_ari_validate_live_recording().

◆ ast_ari_validate_log_channel()

int ast_ari_validate_log_channel ( struct ast_json json)

Validator for LogChannel.

Details of an Asterisk log channel

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 433 of file ari_model_validators.c.

434{
435 int res = 1;
436 struct ast_json_iter *iter;
437 int has_channel = 0;
438 int has_configuration = 0;
439 int has_status = 0;
440 int has_type = 0;
441
442 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
443 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
444 int prop_is_valid;
445 has_channel = 1;
446 prop_is_valid = ast_ari_validate_string(
448 if (!prop_is_valid) {
449 ast_log(LOG_ERROR, "ARI LogChannel field channel failed validation\n");
450 res = 0;
451 }
452 } else
453 if (strcmp("configuration", ast_json_object_iter_key(iter)) == 0) {
454 int prop_is_valid;
455 has_configuration = 1;
456 prop_is_valid = ast_ari_validate_string(
458 if (!prop_is_valid) {
459 ast_log(LOG_ERROR, "ARI LogChannel field configuration failed validation\n");
460 res = 0;
461 }
462 } else
463 if (strcmp("status", ast_json_object_iter_key(iter)) == 0) {
464 int prop_is_valid;
465 has_status = 1;
466 prop_is_valid = ast_ari_validate_string(
468 if (!prop_is_valid) {
469 ast_log(LOG_ERROR, "ARI LogChannel field status failed validation\n");
470 res = 0;
471 }
472 } else
473 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
474 int prop_is_valid;
475 has_type = 1;
476 prop_is_valid = ast_ari_validate_string(
478 if (!prop_is_valid) {
479 ast_log(LOG_ERROR, "ARI LogChannel field type failed validation\n");
480 res = 0;
481 }
482 } else
483 {
485 "ARI LogChannel has undocumented field %s\n",
487 res = 0;
488 }
489 }
490
491 if (!has_channel) {
492 ast_log(LOG_ERROR, "ARI LogChannel missing required field channel\n");
493 res = 0;
494 }
495
496 if (!has_configuration) {
497 ast_log(LOG_ERROR, "ARI LogChannel missing required field configuration\n");
498 res = 0;
499 }
500
501 if (!has_status) {
502 ast_log(LOG_ERROR, "ARI LogChannel missing required field status\n");
503 res = 0;
504 }
505
506 if (!has_type) {
507 ast_log(LOG_ERROR, "ARI LogChannel missing required field type\n");
508 res = 0;
509 }
510
511 return res;
512}

References ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_log_channel_fn().

◆ ast_ari_validate_log_channel_fn()

ari_validator ast_ari_validate_log_channel_fn ( void  )

Function pointer to ast_ari_validate_log_channel().

Definition at line 514 of file ari_model_validators.c.

515{
517}
int ast_ari_validate_log_channel(struct ast_json *json)
Validator for LogChannel.

References ast_ari_validate_log_channel().

Referenced by ast_ari_asterisk_list_log_channels_cb().

◆ ast_ari_validate_mailbox()

int ast_ari_validate_mailbox ( struct ast_json json)

Validator for Mailbox.

Represents the state of a mailbox.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 2361 of file ari_model_validators.c.

2362{
2363 int res = 1;
2364 struct ast_json_iter *iter;
2365 int has_name = 0;
2366 int has_new_messages = 0;
2367 int has_old_messages = 0;
2368
2369 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2370 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
2371 int prop_is_valid;
2372 has_name = 1;
2373 prop_is_valid = ast_ari_validate_string(
2375 if (!prop_is_valid) {
2376 ast_log(LOG_ERROR, "ARI Mailbox field name failed validation\n");
2377 res = 0;
2378 }
2379 } else
2380 if (strcmp("new_messages", ast_json_object_iter_key(iter)) == 0) {
2381 int prop_is_valid;
2382 has_new_messages = 1;
2383 prop_is_valid = ast_ari_validate_int(
2385 if (!prop_is_valid) {
2386 ast_log(LOG_ERROR, "ARI Mailbox field new_messages failed validation\n");
2387 res = 0;
2388 }
2389 } else
2390 if (strcmp("old_messages", ast_json_object_iter_key(iter)) == 0) {
2391 int prop_is_valid;
2392 has_old_messages = 1;
2393 prop_is_valid = ast_ari_validate_int(
2395 if (!prop_is_valid) {
2396 ast_log(LOG_ERROR, "ARI Mailbox field old_messages failed validation\n");
2397 res = 0;
2398 }
2399 } else
2400 {
2402 "ARI Mailbox has undocumented field %s\n",
2404 res = 0;
2405 }
2406 }
2407
2408 if (!has_name) {
2409 ast_log(LOG_ERROR, "ARI Mailbox missing required field name\n");
2410 res = 0;
2411 }
2412
2413 if (!has_new_messages) {
2414 ast_log(LOG_ERROR, "ARI Mailbox missing required field new_messages\n");
2415 res = 0;
2416 }
2417
2418 if (!has_old_messages) {
2419 ast_log(LOG_ERROR, "ARI Mailbox missing required field old_messages\n");
2420 res = 0;
2421 }
2422
2423 return res;
2424}

References ast_ari_validate_int(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_mailboxes_get_cb(), and ast_ari_validate_mailbox_fn().

◆ ast_ari_validate_mailbox_fn()

ari_validator ast_ari_validate_mailbox_fn ( void  )

Function pointer to ast_ari_validate_mailbox().

Definition at line 2426 of file ari_model_validators.c.

2427{
2429}
int ast_ari_validate_mailbox(struct ast_json *json)
Validator for Mailbox.

References ast_ari_validate_mailbox().

Referenced by ast_ari_mailboxes_list_cb().

◆ ast_ari_validate_message()

int ast_ari_validate_message ( struct ast_json json)

Validator for Message.

Base type for errors and events

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 6105 of file ari_model_validators.c.

6106{
6107 int res = 1;
6108 struct ast_json_iter *iter;
6109 int has_type = 0;
6110 const char *discriminator;
6111
6112 discriminator = ast_json_string_get(ast_json_object_get(json, "type"));
6113 if (!discriminator) {
6114 ast_log(LOG_ERROR, "ARI Message missing required field type\n");
6115 return 0;
6116 }
6117
6118 if (strcmp("Message", discriminator) == 0) {
6119 /* Self type; fall through */
6120 } else
6121 if (strcmp("ApplicationMoveFailed", discriminator) == 0) {
6123 } else
6124 if (strcmp("ApplicationReplaced", discriminator) == 0) {
6126 } else
6127 if (strcmp("BridgeAttendedTransfer", discriminator) == 0) {
6129 } else
6130 if (strcmp("BridgeBlindTransfer", discriminator) == 0) {
6132 } else
6133 if (strcmp("BridgeCreated", discriminator) == 0) {
6135 } else
6136 if (strcmp("BridgeDestroyed", discriminator) == 0) {
6138 } else
6139 if (strcmp("BridgeMerged", discriminator) == 0) {
6140 return ast_ari_validate_bridge_merged(json);
6141 } else
6142 if (strcmp("BridgeVideoSourceChanged", discriminator) == 0) {
6144 } else
6145 if (strcmp("ChannelCallerId", discriminator) == 0) {
6147 } else
6148 if (strcmp("ChannelConnectedLine", discriminator) == 0) {
6150 } else
6151 if (strcmp("ChannelCreated", discriminator) == 0) {
6153 } else
6154 if (strcmp("ChannelDestroyed", discriminator) == 0) {
6156 } else
6157 if (strcmp("ChannelDialplan", discriminator) == 0) {
6159 } else
6160 if (strcmp("ChannelDtmfReceived", discriminator) == 0) {
6162 } else
6163 if (strcmp("ChannelEnteredBridge", discriminator) == 0) {
6165 } else
6166 if (strcmp("ChannelHangupRequest", discriminator) == 0) {
6168 } else
6169 if (strcmp("ChannelHold", discriminator) == 0) {
6170 return ast_ari_validate_channel_hold(json);
6171 } else
6172 if (strcmp("ChannelLeftBridge", discriminator) == 0) {
6174 } else
6175 if (strcmp("ChannelStateChange", discriminator) == 0) {
6177 } else
6178 if (strcmp("ChannelTalkingFinished", discriminator) == 0) {
6180 } else
6181 if (strcmp("ChannelTalkingStarted", discriminator) == 0) {
6183 } else
6184 if (strcmp("ChannelToneDetected", discriminator) == 0) {
6186 } else
6187 if (strcmp("ChannelUnhold", discriminator) == 0) {
6189 } else
6190 if (strcmp("ChannelUserevent", discriminator) == 0) {
6192 } else
6193 if (strcmp("ChannelVarset", discriminator) == 0) {
6195 } else
6196 if (strcmp("ContactStatusChange", discriminator) == 0) {
6198 } else
6199 if (strcmp("DeviceStateChanged", discriminator) == 0) {
6201 } else
6202 if (strcmp("Dial", discriminator) == 0) {
6203 return ast_ari_validate_dial(json);
6204 } else
6205 if (strcmp("EndpointStateChange", discriminator) == 0) {
6207 } else
6208 if (strcmp("Event", discriminator) == 0) {
6209 return ast_ari_validate_event(json);
6210 } else
6211 if (strcmp("MissingParams", discriminator) == 0) {
6213 } else
6214 if (strcmp("PeerStatusChange", discriminator) == 0) {
6216 } else
6217 if (strcmp("PlaybackContinuing", discriminator) == 0) {
6219 } else
6220 if (strcmp("PlaybackFinished", discriminator) == 0) {
6222 } else
6223 if (strcmp("PlaybackStarted", discriminator) == 0) {
6225 } else
6226 if (strcmp("RecordingFailed", discriminator) == 0) {
6228 } else
6229 if (strcmp("RecordingFinished", discriminator) == 0) {
6231 } else
6232 if (strcmp("RecordingStarted", discriminator) == 0) {
6234 } else
6235 if (strcmp("StasisEnd", discriminator) == 0) {
6236 return ast_ari_validate_stasis_end(json);
6237 } else
6238 if (strcmp("StasisStart", discriminator) == 0) {
6239 return ast_ari_validate_stasis_start(json);
6240 } else
6241 if (strcmp("TextMessageReceived", discriminator) == 0) {
6243 } else
6244 {
6245 ast_log(LOG_ERROR, "ARI Message has undocumented subtype %s\n",
6246 discriminator);
6247 res = 0;
6248 }
6249
6250 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6251 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6252 int prop_is_valid;
6253 prop_is_valid = ast_ari_validate_string(
6255 if (!prop_is_valid) {
6256 ast_log(LOG_ERROR, "ARI Message field asterisk_id failed validation\n");
6257 res = 0;
6258 }
6259 } else
6260 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6261 int prop_is_valid;
6262 has_type = 1;
6263 prop_is_valid = ast_ari_validate_string(
6265 if (!prop_is_valid) {
6266 ast_log(LOG_ERROR, "ARI Message field type failed validation\n");
6267 res = 0;
6268 }
6269 } else
6270 {
6272 "ARI Message has undocumented field %s\n",
6274 res = 0;
6275 }
6276 }
6277
6278 if (!has_type) {
6279 ast_log(LOG_ERROR, "ARI Message missing required field type\n");
6280 res = 0;
6281 }
6282
6283 return res;
6284}
int ast_ari_validate_missing_params(struct ast_json *json)
Validator for MissingParams.

References ast_ari_validate_application_move_failed(), ast_ari_validate_application_replaced(), 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_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_contact_status_change(), ast_ari_validate_device_state_changed(), ast_ari_validate_dial(), ast_ari_validate_endpoint_state_change(), ast_ari_validate_event(), ast_ari_validate_missing_params(), ast_ari_validate_peer_status_change(), 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_stasis_end(), ast_ari_validate_stasis_start(), ast_ari_validate_string(), ast_ari_validate_text_message_received(), ast_json_object_get(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_json_string_get(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_message_fn().

◆ ast_ari_validate_message_fn()

ari_validator ast_ari_validate_message_fn ( void  )

Function pointer to ast_ari_validate_message().

Definition at line 6286 of file ari_model_validators.c.

6287{
6289}
int ast_ari_validate_message(struct ast_json *json)
Validator for Message.

References ast_ari_validate_message().

Referenced by ast_ari_events_event_websocket_ws_established_cb().

◆ ast_ari_validate_missing_params()

int ast_ari_validate_missing_params ( struct ast_json json)

Validator for MissingParams.

Error event sent when required params are missing.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 6291 of file ari_model_validators.c.

6292{
6293 int res = 1;
6294 struct ast_json_iter *iter;
6295 int has_type = 0;
6296 int has_params = 0;
6297
6298 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6299 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6300 int prop_is_valid;
6301 prop_is_valid = ast_ari_validate_string(
6303 if (!prop_is_valid) {
6304 ast_log(LOG_ERROR, "ARI MissingParams field asterisk_id failed validation\n");
6305 res = 0;
6306 }
6307 } else
6308 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6309 int prop_is_valid;
6310 has_type = 1;
6311 prop_is_valid = ast_ari_validate_string(
6313 if (!prop_is_valid) {
6314 ast_log(LOG_ERROR, "ARI MissingParams field type failed validation\n");
6315 res = 0;
6316 }
6317 } else
6318 if (strcmp("params", ast_json_object_iter_key(iter)) == 0) {
6319 int prop_is_valid;
6320 has_params = 1;
6321 prop_is_valid = ast_ari_validate_list(
6324 if (!prop_is_valid) {
6325 ast_log(LOG_ERROR, "ARI MissingParams field params failed validation\n");
6326 res = 0;
6327 }
6328 } else
6329 {
6331 "ARI MissingParams has undocumented field %s\n",
6333 res = 0;
6334 }
6335 }
6336
6337 if (!has_type) {
6338 ast_log(LOG_ERROR, "ARI MissingParams missing required field type\n");
6339 res = 0;
6340 }
6341
6342 if (!has_params) {
6343 ast_log(LOG_ERROR, "ARI MissingParams missing required field params\n");
6344 res = 0;
6345 }
6346
6347 return res;
6348}

References ast_ari_validate_list(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_message(), and ast_ari_validate_missing_params_fn().

◆ ast_ari_validate_missing_params_fn()

ari_validator ast_ari_validate_missing_params_fn ( void  )

Function pointer to ast_ari_validate_missing_params().

Definition at line 6350 of file ari_model_validators.c.

6351{
6353}

References ast_ari_validate_missing_params().

◆ ast_ari_validate_module()

int ast_ari_validate_module ( struct ast_json json)

Validator for Module.

Details of an Asterisk module

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 519 of file ari_model_validators.c.

520{
521 int res = 1;
522 struct ast_json_iter *iter;
523 int has_description = 0;
524 int has_name = 0;
525 int has_status = 0;
526 int has_support_level = 0;
527 int has_use_count = 0;
528
529 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
530 if (strcmp("description", ast_json_object_iter_key(iter)) == 0) {
531 int prop_is_valid;
532 has_description = 1;
533 prop_is_valid = ast_ari_validate_string(
535 if (!prop_is_valid) {
536 ast_log(LOG_ERROR, "ARI Module field description failed validation\n");
537 res = 0;
538 }
539 } else
540 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
541 int prop_is_valid;
542 has_name = 1;
543 prop_is_valid = ast_ari_validate_string(
545 if (!prop_is_valid) {
546 ast_log(LOG_ERROR, "ARI Module field name failed validation\n");
547 res = 0;
548 }
549 } else
550 if (strcmp("status", ast_json_object_iter_key(iter)) == 0) {
551 int prop_is_valid;
552 has_status = 1;
553 prop_is_valid = ast_ari_validate_string(
555 if (!prop_is_valid) {
556 ast_log(LOG_ERROR, "ARI Module field status failed validation\n");
557 res = 0;
558 }
559 } else
560 if (strcmp("support_level", ast_json_object_iter_key(iter)) == 0) {
561 int prop_is_valid;
562 has_support_level = 1;
563 prop_is_valid = ast_ari_validate_string(
565 if (!prop_is_valid) {
566 ast_log(LOG_ERROR, "ARI Module field support_level failed validation\n");
567 res = 0;
568 }
569 } else
570 if (strcmp("use_count", ast_json_object_iter_key(iter)) == 0) {
571 int prop_is_valid;
572 has_use_count = 1;
573 prop_is_valid = ast_ari_validate_int(
575 if (!prop_is_valid) {
576 ast_log(LOG_ERROR, "ARI Module field use_count failed validation\n");
577 res = 0;
578 }
579 } else
580 {
582 "ARI Module has undocumented field %s\n",
584 res = 0;
585 }
586 }
587
588 if (!has_description) {
589 ast_log(LOG_ERROR, "ARI Module missing required field description\n");
590 res = 0;
591 }
592
593 if (!has_name) {
594 ast_log(LOG_ERROR, "ARI Module missing required field name\n");
595 res = 0;
596 }
597
598 if (!has_status) {
599 ast_log(LOG_ERROR, "ARI Module missing required field status\n");
600 res = 0;
601 }
602
603 if (!has_support_level) {
604 ast_log(LOG_ERROR, "ARI Module missing required field support_level\n");
605 res = 0;
606 }
607
608 if (!has_use_count) {
609 ast_log(LOG_ERROR, "ARI Module missing required field use_count\n");
610 res = 0;
611 }
612
613 return res;
614}

References ast_ari_validate_int(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_asterisk_get_module_cb(), and ast_ari_validate_module_fn().

◆ ast_ari_validate_module_fn()

ari_validator ast_ari_validate_module_fn ( void  )

Function pointer to ast_ari_validate_module().

Definition at line 616 of file ari_model_validators.c.

617{
619}
int ast_ari_validate_module(struct ast_json *json)
Validator for Module.

References ast_ari_validate_module().

Referenced by ast_ari_asterisk_list_modules_cb().

◆ ast_ari_validate_peer()

int ast_ari_validate_peer ( struct ast_json json)

Validator for Peer.

Detailed information about a remote peer that communicates with Asterisk.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 6355 of file ari_model_validators.c.

6356{
6357 int res = 1;
6358 struct ast_json_iter *iter;
6359 int has_peer_status = 0;
6360
6361 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6362 if (strcmp("address", ast_json_object_iter_key(iter)) == 0) {
6363 int prop_is_valid;
6364 prop_is_valid = ast_ari_validate_string(
6366 if (!prop_is_valid) {
6367 ast_log(LOG_ERROR, "ARI Peer field address failed validation\n");
6368 res = 0;
6369 }
6370 } else
6371 if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
6372 int prop_is_valid;
6373 prop_is_valid = ast_ari_validate_string(
6375 if (!prop_is_valid) {
6376 ast_log(LOG_ERROR, "ARI Peer field cause failed validation\n");
6377 res = 0;
6378 }
6379 } else
6380 if (strcmp("peer_status", ast_json_object_iter_key(iter)) == 0) {
6381 int prop_is_valid;
6382 has_peer_status = 1;
6383 prop_is_valid = ast_ari_validate_string(
6385 if (!prop_is_valid) {
6386 ast_log(LOG_ERROR, "ARI Peer field peer_status failed validation\n");
6387 res = 0;
6388 }
6389 } else
6390 if (strcmp("port", ast_json_object_iter_key(iter)) == 0) {
6391 int prop_is_valid;
6392 prop_is_valid = ast_ari_validate_string(
6394 if (!prop_is_valid) {
6395 ast_log(LOG_ERROR, "ARI Peer field port failed validation\n");
6396 res = 0;
6397 }
6398 } else
6399 if (strcmp("time", ast_json_object_iter_key(iter)) == 0) {
6400 int prop_is_valid;
6401 prop_is_valid = ast_ari_validate_string(
6403 if (!prop_is_valid) {
6404 ast_log(LOG_ERROR, "ARI Peer field time failed validation\n");
6405 res = 0;
6406 }
6407 } else
6408 {
6410 "ARI Peer has undocumented field %s\n",
6412 res = 0;
6413 }
6414 }
6415
6416 if (!has_peer_status) {
6417 ast_log(LOG_ERROR, "ARI Peer missing required field peer_status\n");
6418 res = 0;
6419 }
6420
6421 return res;
6422}

References ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_peer_fn(), and ast_ari_validate_peer_status_change().

◆ ast_ari_validate_peer_fn()

ari_validator ast_ari_validate_peer_fn ( void  )

Function pointer to ast_ari_validate_peer().

Definition at line 6424 of file ari_model_validators.c.

6425{
6426 return ast_ari_validate_peer;
6427}
int ast_ari_validate_peer(struct ast_json *json)
Validator for Peer.

References ast_ari_validate_peer().

◆ ast_ari_validate_peer_status_change()

int ast_ari_validate_peer_status_change ( struct ast_json json)

Validator for PeerStatusChange.

The state of a peer associated with an endpoint has changed.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 6429 of file ari_model_validators.c.

6430{
6431 int res = 1;
6432 struct ast_json_iter *iter;
6433 int has_type = 0;
6434 int has_application = 0;
6435 int has_timestamp = 0;
6436 int has_endpoint = 0;
6437 int has_peer = 0;
6438
6439 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6440 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6441 int prop_is_valid;
6442 prop_is_valid = ast_ari_validate_string(
6444 if (!prop_is_valid) {
6445 ast_log(LOG_ERROR, "ARI PeerStatusChange field asterisk_id failed validation\n");
6446 res = 0;
6447 }
6448 } else
6449 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6450 int prop_is_valid;
6451 has_type = 1;
6452 prop_is_valid = ast_ari_validate_string(
6454 if (!prop_is_valid) {
6455 ast_log(LOG_ERROR, "ARI PeerStatusChange field type failed validation\n");
6456 res = 0;
6457 }
6458 } else
6459 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
6460 int prop_is_valid;
6461 has_application = 1;
6462 prop_is_valid = ast_ari_validate_string(
6464 if (!prop_is_valid) {
6465 ast_log(LOG_ERROR, "ARI PeerStatusChange field application failed validation\n");
6466 res = 0;
6467 }
6468 } else
6469 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
6470 int prop_is_valid;
6471 has_timestamp = 1;
6472 prop_is_valid = ast_ari_validate_date(
6474 if (!prop_is_valid) {
6475 ast_log(LOG_ERROR, "ARI PeerStatusChange field timestamp failed validation\n");
6476 res = 0;
6477 }
6478 } else
6479 if (strcmp("endpoint", ast_json_object_iter_key(iter)) == 0) {
6480 int prop_is_valid;
6481 has_endpoint = 1;
6482 prop_is_valid = ast_ari_validate_endpoint(
6484 if (!prop_is_valid) {
6485 ast_log(LOG_ERROR, "ARI PeerStatusChange field endpoint failed validation\n");
6486 res = 0;
6487 }
6488 } else
6489 if (strcmp("peer", ast_json_object_iter_key(iter)) == 0) {
6490 int prop_is_valid;
6491 has_peer = 1;
6492 prop_is_valid = ast_ari_validate_peer(
6494 if (!prop_is_valid) {
6495 ast_log(LOG_ERROR, "ARI PeerStatusChange field peer failed validation\n");
6496 res = 0;
6497 }
6498 } else
6499 {
6501 "ARI PeerStatusChange has undocumented field %s\n",
6503 res = 0;
6504 }
6505 }
6506
6507 if (!has_type) {
6508 ast_log(LOG_ERROR, "ARI PeerStatusChange missing required field type\n");
6509 res = 0;
6510 }
6511
6512 if (!has_application) {
6513 ast_log(LOG_ERROR, "ARI PeerStatusChange missing required field application\n");
6514 res = 0;
6515 }
6516
6517 if (!has_timestamp) {
6518 ast_log(LOG_ERROR, "ARI PeerStatusChange missing required field timestamp\n");
6519 res = 0;
6520 }
6521
6522 if (!has_endpoint) {
6523 ast_log(LOG_ERROR, "ARI PeerStatusChange missing required field endpoint\n");
6524 res = 0;
6525 }
6526
6527 if (!has_peer) {
6528 ast_log(LOG_ERROR, "ARI PeerStatusChange missing required field peer\n");
6529 res = 0;
6530 }
6531
6532 return res;
6533}

References ast_ari_validate_date(), ast_ari_validate_endpoint(), ast_ari_validate_peer(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_event(), ast_ari_validate_message(), and ast_ari_validate_peer_status_change_fn().

◆ ast_ari_validate_peer_status_change_fn()

ari_validator ast_ari_validate_peer_status_change_fn ( void  )

Function pointer to ast_ari_validate_peer_status_change().

Definition at line 6535 of file ari_model_validators.c.

6536{
6538}

References ast_ari_validate_peer_status_change().

◆ ast_ari_validate_playback()

int ast_ari_validate_playback ( struct ast_json json)

Validator for Playback.

Object representing the playback of media to a channel

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 2203 of file ari_model_validators.c.

2204{
2205 int res = 1;
2206 struct ast_json_iter *iter;
2207 int has_id = 0;
2208 int has_media_uri = 0;
2209 int has_state = 0;
2210 int has_target_uri = 0;
2211
2212 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2213 if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
2214 int prop_is_valid;
2215 has_id = 1;
2216 prop_is_valid = ast_ari_validate_string(
2218 if (!prop_is_valid) {
2219 ast_log(LOG_ERROR, "ARI Playback field id failed validation\n");
2220 res = 0;
2221 }
2222 } else
2223 if (strcmp("language", ast_json_object_iter_key(iter)) == 0) {
2224 int prop_is_valid;
2225 prop_is_valid = ast_ari_validate_string(
2227 if (!prop_is_valid) {
2228 ast_log(LOG_ERROR, "ARI Playback field language failed validation\n");
2229 res = 0;
2230 }
2231 } else
2232 if (strcmp("media_uri", ast_json_object_iter_key(iter)) == 0) {
2233 int prop_is_valid;
2234 has_media_uri = 1;
2235 prop_is_valid = ast_ari_validate_string(
2237 if (!prop_is_valid) {
2238 ast_log(LOG_ERROR, "ARI Playback field media_uri failed validation\n");
2239 res = 0;
2240 }
2241 } else
2242 if (strcmp("next_media_uri", ast_json_object_iter_key(iter)) == 0) {
2243 int prop_is_valid;
2244 prop_is_valid = ast_ari_validate_string(
2246 if (!prop_is_valid) {
2247 ast_log(LOG_ERROR, "ARI Playback field next_media_uri failed validation\n");
2248 res = 0;
2249 }
2250 } else
2251 if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
2252 int prop_is_valid;
2253 has_state = 1;
2254 prop_is_valid = ast_ari_validate_string(
2256 if (!prop_is_valid) {
2257 ast_log(LOG_ERROR, "ARI Playback field state failed validation\n");
2258 res = 0;
2259 }
2260 } else
2261 if (strcmp("target_uri", ast_json_object_iter_key(iter)) == 0) {
2262 int prop_is_valid;
2263 has_target_uri = 1;
2264 prop_is_valid = ast_ari_validate_string(
2266 if (!prop_is_valid) {
2267 ast_log(LOG_ERROR, "ARI Playback field target_uri failed validation\n");
2268 res = 0;
2269 }
2270 } else
2271 {
2273 "ARI Playback has undocumented field %s\n",
2275 res = 0;
2276 }
2277 }
2278
2279 if (!has_id) {
2280 ast_log(LOG_ERROR, "ARI Playback missing required field id\n");
2281 res = 0;
2282 }
2283
2284 if (!has_media_uri) {
2285 ast_log(LOG_ERROR, "ARI Playback missing required field media_uri\n");
2286 res = 0;
2287 }
2288
2289 if (!has_state) {
2290 ast_log(LOG_ERROR, "ARI Playback missing required field state\n");
2291 res = 0;
2292 }
2293
2294 if (!has_target_uri) {
2295 ast_log(LOG_ERROR, "ARI Playback missing required field target_uri\n");
2296 res = 0;
2297 }
2298
2299 return res;
2300}

References ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_bridges_play_cb(), ast_ari_bridges_play_with_id_cb(), ast_ari_channels_play_cb(), ast_ari_channels_play_with_id_cb(), ast_ari_playbacks_get_cb(), ast_ari_validate_playback_continuing(), ast_ari_validate_playback_finished(), ast_ari_validate_playback_fn(), and ast_ari_validate_playback_started().

◆ ast_ari_validate_playback_continuing()

int ast_ari_validate_playback_continuing ( struct ast_json json)

Validator for PlaybackContinuing.

Event showing the continuation of a media playback operation from one media URI to the next in the list.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 6540 of file ari_model_validators.c.

6541{
6542 int res = 1;
6543 struct ast_json_iter *iter;
6544 int has_type = 0;
6545 int has_application = 0;
6546 int has_timestamp = 0;
6547 int has_playback = 0;
6548
6549 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6550 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6551 int prop_is_valid;
6552 prop_is_valid = ast_ari_validate_string(
6554 if (!prop_is_valid) {
6555 ast_log(LOG_ERROR, "ARI PlaybackContinuing field asterisk_id failed validation\n");
6556 res = 0;
6557 }
6558 } else
6559 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6560 int prop_is_valid;
6561 has_type = 1;
6562 prop_is_valid = ast_ari_validate_string(
6564 if (!prop_is_valid) {
6565 ast_log(LOG_ERROR, "ARI PlaybackContinuing field type failed validation\n");
6566 res = 0;
6567 }
6568 } else
6569 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
6570 int prop_is_valid;
6571 has_application = 1;
6572 prop_is_valid = ast_ari_validate_string(
6574 if (!prop_is_valid) {
6575 ast_log(LOG_ERROR, "ARI PlaybackContinuing field application failed validation\n");
6576 res = 0;
6577 }
6578 } else
6579 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
6580 int prop_is_valid;
6581 has_timestamp = 1;
6582 prop_is_valid = ast_ari_validate_date(
6584 if (!prop_is_valid) {
6585 ast_log(LOG_ERROR, "ARI PlaybackContinuing field timestamp failed validation\n");
6586 res = 0;
6587 }
6588 } else
6589 if (strcmp("playback", ast_json_object_iter_key(iter)) == 0) {
6590 int prop_is_valid;
6591 has_playback = 1;
6592 prop_is_valid = ast_ari_validate_playback(
6594 if (!prop_is_valid) {
6595 ast_log(LOG_ERROR, "ARI PlaybackContinuing field playback failed validation\n");
6596 res = 0;
6597 }
6598 } else
6599 {
6601 "ARI PlaybackContinuing has undocumented field %s\n",
6603 res = 0;
6604 }
6605 }
6606
6607 if (!has_type) {
6608 ast_log(LOG_ERROR, "ARI PlaybackContinuing missing required field type\n");
6609 res = 0;
6610 }
6611
6612 if (!has_application) {
6613 ast_log(LOG_ERROR, "ARI PlaybackContinuing missing required field application\n");
6614 res = 0;
6615 }
6616
6617 if (!has_timestamp) {
6618 ast_log(LOG_ERROR, "ARI PlaybackContinuing missing required field timestamp\n");
6619 res = 0;
6620 }
6621
6622 if (!has_playback) {
6623 ast_log(LOG_ERROR, "ARI PlaybackContinuing missing required field playback\n");
6624 res = 0;
6625 }
6626
6627 return res;
6628}
int ast_ari_validate_playback(struct ast_json *json)
Validator for Playback.

References ast_ari_validate_date(), ast_ari_validate_playback(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_event(), ast_ari_validate_message(), and ast_ari_validate_playback_continuing_fn().

◆ ast_ari_validate_playback_continuing_fn()

ari_validator ast_ari_validate_playback_continuing_fn ( void  )

Function pointer to ast_ari_validate_playback_continuing().

Definition at line 6630 of file ari_model_validators.c.

6631{
6633}

References ast_ari_validate_playback_continuing().

◆ ast_ari_validate_playback_finished()

int ast_ari_validate_playback_finished ( struct ast_json json)

Validator for PlaybackFinished.

Event showing the completion of a media playback operation.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 6635 of file ari_model_validators.c.

6636{
6637 int res = 1;
6638 struct ast_json_iter *iter;
6639 int has_type = 0;
6640 int has_application = 0;
6641 int has_timestamp = 0;
6642 int has_playback = 0;
6643
6644 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6645 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6646 int prop_is_valid;
6647 prop_is_valid = ast_ari_validate_string(
6649 if (!prop_is_valid) {
6650 ast_log(LOG_ERROR, "ARI PlaybackFinished field asterisk_id failed validation\n");
6651 res = 0;
6652 }
6653 } else
6654 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6655 int prop_is_valid;
6656 has_type = 1;
6657 prop_is_valid = ast_ari_validate_string(
6659 if (!prop_is_valid) {
6660 ast_log(LOG_ERROR, "ARI PlaybackFinished field type failed validation\n");
6661 res = 0;
6662 }
6663 } else
6664 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
6665 int prop_is_valid;
6666 has_application = 1;
6667 prop_is_valid = ast_ari_validate_string(
6669 if (!prop_is_valid) {
6670 ast_log(LOG_ERROR, "ARI PlaybackFinished field application failed validation\n");
6671 res = 0;
6672 }
6673 } else
6674 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
6675 int prop_is_valid;
6676 has_timestamp = 1;
6677 prop_is_valid = ast_ari_validate_date(
6679 if (!prop_is_valid) {
6680 ast_log(LOG_ERROR, "ARI PlaybackFinished field timestamp failed validation\n");
6681 res = 0;
6682 }
6683 } else
6684 if (strcmp("playback", ast_json_object_iter_key(iter)) == 0) {
6685 int prop_is_valid;
6686 has_playback = 1;
6687 prop_is_valid = ast_ari_validate_playback(
6689 if (!prop_is_valid) {
6690 ast_log(LOG_ERROR, "ARI PlaybackFinished field playback failed validation\n");
6691 res = 0;
6692 }
6693 } else
6694 {
6696 "ARI PlaybackFinished has undocumented field %s\n",
6698 res = 0;
6699 }
6700 }
6701
6702 if (!has_type) {
6703 ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field type\n");
6704 res = 0;
6705 }
6706
6707 if (!has_application) {
6708 ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field application\n");
6709 res = 0;
6710 }
6711
6712 if (!has_timestamp) {
6713 ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field timestamp\n");
6714 res = 0;
6715 }
6716
6717 if (!has_playback) {
6718 ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field playback\n");
6719 res = 0;
6720 }
6721
6722 return res;
6723}

References ast_ari_validate_date(), ast_ari_validate_playback(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_event(), ast_ari_validate_message(), and ast_ari_validate_playback_finished_fn().

◆ ast_ari_validate_playback_finished_fn()

ari_validator ast_ari_validate_playback_finished_fn ( void  )

Function pointer to ast_ari_validate_playback_finished().

Definition at line 6725 of file ari_model_validators.c.

6726{
6728}

References ast_ari_validate_playback_finished().

◆ ast_ari_validate_playback_fn()

ari_validator ast_ari_validate_playback_fn ( void  )

Function pointer to ast_ari_validate_playback().

Definition at line 2302 of file ari_model_validators.c.

2303{
2305}

References ast_ari_validate_playback().

◆ ast_ari_validate_playback_started()

int ast_ari_validate_playback_started ( struct ast_json json)

Validator for PlaybackStarted.

Event showing the start of a media playback operation.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 6730 of file ari_model_validators.c.

6731{
6732 int res = 1;
6733 struct ast_json_iter *iter;
6734 int has_type = 0;
6735 int has_application = 0;
6736 int has_timestamp = 0;
6737 int has_playback = 0;
6738
6739 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6740 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6741 int prop_is_valid;
6742 prop_is_valid = ast_ari_validate_string(
6744 if (!prop_is_valid) {
6745 ast_log(LOG_ERROR, "ARI PlaybackStarted field asterisk_id failed validation\n");
6746 res = 0;
6747 }
6748 } else
6749 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6750 int prop_is_valid;
6751 has_type = 1;
6752 prop_is_valid = ast_ari_validate_string(
6754 if (!prop_is_valid) {
6755 ast_log(LOG_ERROR, "ARI PlaybackStarted field type failed validation\n");
6756 res = 0;
6757 }
6758 } else
6759 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
6760 int prop_is_valid;
6761 has_application = 1;
6762 prop_is_valid = ast_ari_validate_string(
6764 if (!prop_is_valid) {
6765 ast_log(LOG_ERROR, "ARI PlaybackStarted field application failed validation\n");
6766 res = 0;
6767 }
6768 } else
6769 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
6770 int prop_is_valid;
6771 has_timestamp = 1;
6772 prop_is_valid = ast_ari_validate_date(
6774 if (!prop_is_valid) {
6775 ast_log(LOG_ERROR, "ARI PlaybackStarted field timestamp failed validation\n");
6776 res = 0;
6777 }
6778 } else
6779 if (strcmp("playback", ast_json_object_iter_key(iter)) == 0) {
6780 int prop_is_valid;
6781 has_playback = 1;
6782 prop_is_valid = ast_ari_validate_playback(
6784 if (!prop_is_valid) {
6785 ast_log(LOG_ERROR, "ARI PlaybackStarted field playback failed validation\n");
6786 res = 0;
6787 }
6788 } else
6789 {
6791 "ARI PlaybackStarted has undocumented field %s\n",
6793 res = 0;
6794 }
6795 }
6796
6797 if (!has_type) {
6798 ast_log(LOG_ERROR, "ARI PlaybackStarted missing required field type\n");
6799 res = 0;
6800 }
6801
6802 if (!has_application) {
6803 ast_log(LOG_ERROR, "ARI PlaybackStarted missing required field application\n");
6804 res = 0;
6805 }
6806
6807 if (!has_timestamp) {
6808 ast_log(LOG_ERROR, "ARI PlaybackStarted missing required field timestamp\n");
6809 res = 0;
6810 }
6811
6812 if (!has_playback) {
6813 ast_log(LOG_ERROR, "ARI PlaybackStarted missing required field playback\n");
6814 res = 0;
6815 }
6816
6817 return res;
6818}

References ast_ari_validate_date(), ast_ari_validate_playback(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_event(), ast_ari_validate_message(), and ast_ari_validate_playback_started_fn().

◆ ast_ari_validate_playback_started_fn()

ari_validator ast_ari_validate_playback_started_fn ( void  )

Function pointer to ast_ari_validate_playback_started().

Definition at line 6820 of file ari_model_validators.c.

6821{
6823}

References ast_ari_validate_playback_started().

◆ ast_ari_validate_recording_failed()

int ast_ari_validate_recording_failed ( struct ast_json json)

Validator for RecordingFailed.

Event showing failure of a recording operation.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 6825 of file ari_model_validators.c.

6826{
6827 int res = 1;
6828 struct ast_json_iter *iter;
6829 int has_type = 0;
6830 int has_application = 0;
6831 int has_timestamp = 0;
6832 int has_recording = 0;
6833
6834 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6835 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6836 int prop_is_valid;
6837 prop_is_valid = ast_ari_validate_string(
6839 if (!prop_is_valid) {
6840 ast_log(LOG_ERROR, "ARI RecordingFailed field asterisk_id failed validation\n");
6841 res = 0;
6842 }
6843 } else
6844 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6845 int prop_is_valid;
6846 has_type = 1;
6847 prop_is_valid = ast_ari_validate_string(
6849 if (!prop_is_valid) {
6850 ast_log(LOG_ERROR, "ARI RecordingFailed field type failed validation\n");
6851 res = 0;
6852 }
6853 } else
6854 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
6855 int prop_is_valid;
6856 has_application = 1;
6857 prop_is_valid = ast_ari_validate_string(
6859 if (!prop_is_valid) {
6860 ast_log(LOG_ERROR, "ARI RecordingFailed field application failed validation\n");
6861 res = 0;
6862 }
6863 } else
6864 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
6865 int prop_is_valid;
6866 has_timestamp = 1;
6867 prop_is_valid = ast_ari_validate_date(
6869 if (!prop_is_valid) {
6870 ast_log(LOG_ERROR, "ARI RecordingFailed field timestamp failed validation\n");
6871 res = 0;
6872 }
6873 } else
6874 if (strcmp("recording", ast_json_object_iter_key(iter)) == 0) {
6875 int prop_is_valid;
6876 has_recording = 1;
6877 prop_is_valid = ast_ari_validate_live_recording(
6879 if (!prop_is_valid) {
6880 ast_log(LOG_ERROR, "ARI RecordingFailed field recording failed validation\n");
6881 res = 0;
6882 }
6883 } else
6884 {
6886 "ARI RecordingFailed has undocumented field %s\n",
6888 res = 0;
6889 }
6890 }
6891
6892 if (!has_type) {
6893 ast_log(LOG_ERROR, "ARI RecordingFailed missing required field type\n");
6894 res = 0;
6895 }
6896
6897 if (!has_application) {
6898 ast_log(LOG_ERROR, "ARI RecordingFailed missing required field application\n");
6899 res = 0;
6900 }
6901
6902 if (!has_timestamp) {
6903 ast_log(LOG_ERROR, "ARI RecordingFailed missing required field timestamp\n");
6904 res = 0;
6905 }
6906
6907 if (!has_recording) {
6908 ast_log(LOG_ERROR, "ARI RecordingFailed missing required field recording\n");
6909 res = 0;
6910 }
6911
6912 return res;
6913}

References ast_ari_validate_date(), ast_ari_validate_live_recording(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_event(), ast_ari_validate_message(), and ast_ari_validate_recording_failed_fn().

◆ ast_ari_validate_recording_failed_fn()

ari_validator ast_ari_validate_recording_failed_fn ( void  )

Function pointer to ast_ari_validate_recording_failed().

Definition at line 6915 of file ari_model_validators.c.

6916{
6918}

References ast_ari_validate_recording_failed().

◆ ast_ari_validate_recording_finished()

int ast_ari_validate_recording_finished ( struct ast_json json)

Validator for RecordingFinished.

Event showing the completion of a recording operation.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 6920 of file ari_model_validators.c.

6921{
6922 int res = 1;
6923 struct ast_json_iter *iter;
6924 int has_type = 0;
6925 int has_application = 0;
6926 int has_timestamp = 0;
6927 int has_recording = 0;
6928
6929 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6930 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6931 int prop_is_valid;
6932 prop_is_valid = ast_ari_validate_string(
6934 if (!prop_is_valid) {
6935 ast_log(LOG_ERROR, "ARI RecordingFinished field asterisk_id failed validation\n");
6936 res = 0;
6937 }
6938 } else
6939 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6940 int prop_is_valid;
6941 has_type = 1;
6942 prop_is_valid = ast_ari_validate_string(
6944 if (!prop_is_valid) {
6945 ast_log(LOG_ERROR, "ARI RecordingFinished field type failed validation\n");
6946 res = 0;
6947 }
6948 } else
6949 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
6950 int prop_is_valid;
6951 has_application = 1;
6952 prop_is_valid = ast_ari_validate_string(
6954 if (!prop_is_valid) {
6955 ast_log(LOG_ERROR, "ARI RecordingFinished field application failed validation\n");
6956 res = 0;
6957 }
6958 } else
6959 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
6960 int prop_is_valid;
6961 has_timestamp = 1;
6962 prop_is_valid = ast_ari_validate_date(
6964 if (!prop_is_valid) {
6965 ast_log(LOG_ERROR, "ARI RecordingFinished field timestamp failed validation\n");
6966 res = 0;
6967 }
6968 } else
6969 if (strcmp("recording", ast_json_object_iter_key(iter)) == 0) {
6970 int prop_is_valid;
6971 has_recording = 1;
6972 prop_is_valid = ast_ari_validate_live_recording(
6974 if (!prop_is_valid) {
6975 ast_log(LOG_ERROR, "ARI RecordingFinished field recording failed validation\n");
6976 res = 0;
6977 }
6978 } else
6979 {
6981 "ARI RecordingFinished has undocumented field %s\n",
6983 res = 0;
6984 }
6985 }
6986
6987 if (!has_type) {
6988 ast_log(LOG_ERROR, "ARI RecordingFinished missing required field type\n");
6989 res = 0;
6990 }
6991
6992 if (!has_application) {
6993 ast_log(LOG_ERROR, "ARI RecordingFinished missing required field application\n");
6994 res = 0;
6995 }
6996
6997 if (!has_timestamp) {
6998 ast_log(LOG_ERROR, "ARI RecordingFinished missing required field timestamp\n");
6999 res = 0;
7000 }
7001
7002 if (!has_recording) {
7003 ast_log(LOG_ERROR, "ARI RecordingFinished missing required field recording\n");
7004 res = 0;
7005 }
7006
7007 return res;
7008}

References ast_ari_validate_date(), ast_ari_validate_live_recording(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_event(), ast_ari_validate_message(), and ast_ari_validate_recording_finished_fn().

◆ ast_ari_validate_recording_finished_fn()

ari_validator ast_ari_validate_recording_finished_fn ( void  )

Function pointer to ast_ari_validate_recording_finished().

Definition at line 7010 of file ari_model_validators.c.

7011{
7013}

References ast_ari_validate_recording_finished().

◆ ast_ari_validate_recording_started()

int ast_ari_validate_recording_started ( struct ast_json json)

Validator for RecordingStarted.

Event showing the start of a recording operation.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 7015 of file ari_model_validators.c.

7016{
7017 int res = 1;
7018 struct ast_json_iter *iter;
7019 int has_type = 0;
7020 int has_application = 0;
7021 int has_timestamp = 0;
7022 int has_recording = 0;
7023
7024 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
7025 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
7026 int prop_is_valid;
7027 prop_is_valid = ast_ari_validate_string(
7029 if (!prop_is_valid) {
7030 ast_log(LOG_ERROR, "ARI RecordingStarted field asterisk_id failed validation\n");
7031 res = 0;
7032 }
7033 } else
7034 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
7035 int prop_is_valid;
7036 has_type = 1;
7037 prop_is_valid = ast_ari_validate_string(
7039 if (!prop_is_valid) {
7040 ast_log(LOG_ERROR, "ARI RecordingStarted field type failed validation\n");
7041 res = 0;
7042 }
7043 } else
7044 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
7045 int prop_is_valid;
7046 has_application = 1;
7047 prop_is_valid = ast_ari_validate_string(
7049 if (!prop_is_valid) {
7050 ast_log(LOG_ERROR, "ARI RecordingStarted field application failed validation\n");
7051 res = 0;
7052 }
7053 } else
7054 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
7055 int prop_is_valid;
7056 has_timestamp = 1;
7057 prop_is_valid = ast_ari_validate_date(
7059 if (!prop_is_valid) {
7060 ast_log(LOG_ERROR, "ARI RecordingStarted field timestamp failed validation\n");
7061 res = 0;
7062 }
7063 } else
7064 if (strcmp("recording", ast_json_object_iter_key(iter)) == 0) {
7065 int prop_is_valid;
7066 has_recording = 1;
7067 prop_is_valid = ast_ari_validate_live_recording(
7069 if (!prop_is_valid) {
7070 ast_log(LOG_ERROR, "ARI RecordingStarted field recording failed validation\n");
7071 res = 0;
7072 }
7073 } else
7074 {
7076 "ARI RecordingStarted has undocumented field %s\n",
7078 res = 0;
7079 }
7080 }
7081
7082 if (!has_type) {
7083 ast_log(LOG_ERROR, "ARI RecordingStarted missing required field type\n");
7084 res = 0;
7085 }
7086
7087 if (!has_application) {
7088 ast_log(LOG_ERROR, "ARI RecordingStarted missing required field application\n");
7089 res = 0;
7090 }
7091
7092 if (!has_timestamp) {
7093 ast_log(LOG_ERROR, "ARI RecordingStarted missing required field timestamp\n");
7094 res = 0;
7095 }
7096
7097 if (!has_recording) {
7098 ast_log(LOG_ERROR, "ARI RecordingStarted missing required field recording\n");
7099 res = 0;
7100 }
7101
7102 return res;
7103}

References ast_ari_validate_date(), ast_ari_validate_live_recording(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_event(), ast_ari_validate_message(), and ast_ari_validate_recording_started_fn().

◆ ast_ari_validate_recording_started_fn()

ari_validator ast_ari_validate_recording_started_fn ( void  )

Function pointer to ast_ari_validate_recording_started().

Definition at line 7105 of file ari_model_validators.c.

7106{
7108}

References ast_ari_validate_recording_started().

◆ ast_ari_validate_rtpstat()

int ast_ari_validate_rtpstat ( struct ast_json json)

Validator for RTPstat.

A statistics of a RTP.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 1367 of file ari_model_validators.c.

1368{
1369 int res = 1;
1370 struct ast_json_iter *iter;
1371 int has_channel_uniqueid = 0;
1372 int has_local_ssrc = 0;
1373 int has_remote_ssrc = 0;
1374 int has_rxcount = 0;
1375 int has_rxoctetcount = 0;
1376 int has_rxploss = 0;
1377 int has_txcount = 0;
1378 int has_txoctetcount = 0;
1379 int has_txploss = 0;
1380
1381 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1382 if (strcmp("channel_uniqueid", ast_json_object_iter_key(iter)) == 0) {
1383 int prop_is_valid;
1384 has_channel_uniqueid = 1;
1385 prop_is_valid = ast_ari_validate_string(
1387 if (!prop_is_valid) {
1388 ast_log(LOG_ERROR, "ARI RTPstat field channel_uniqueid failed validation\n");
1389 res = 0;
1390 }
1391 } else
1392 if (strcmp("local_maxjitter", ast_json_object_iter_key(iter)) == 0) {
1393 int prop_is_valid;
1394 prop_is_valid = ast_ari_validate_double(
1396 if (!prop_is_valid) {
1397 ast_log(LOG_ERROR, "ARI RTPstat field local_maxjitter failed validation\n");
1398 res = 0;
1399 }
1400 } else
1401 if (strcmp("local_maxrxploss", ast_json_object_iter_key(iter)) == 0) {
1402 int prop_is_valid;
1403 prop_is_valid = ast_ari_validate_double(
1405 if (!prop_is_valid) {
1406 ast_log(LOG_ERROR, "ARI RTPstat field local_maxrxploss failed validation\n");
1407 res = 0;
1408 }
1409 } else
1410 if (strcmp("local_minjitter", ast_json_object_iter_key(iter)) == 0) {
1411 int prop_is_valid;
1412 prop_is_valid = ast_ari_validate_double(
1414 if (!prop_is_valid) {
1415 ast_log(LOG_ERROR, "ARI RTPstat field local_minjitter failed validation\n");
1416 res = 0;
1417 }
1418 } else
1419 if (strcmp("local_minrxploss", ast_json_object_iter_key(iter)) == 0) {
1420 int prop_is_valid;
1421 prop_is_valid = ast_ari_validate_double(
1423 if (!prop_is_valid) {
1424 ast_log(LOG_ERROR, "ARI RTPstat field local_minrxploss failed validation\n");
1425 res = 0;
1426 }
1427 } else
1428 if (strcmp("local_normdevjitter", ast_json_object_iter_key(iter)) == 0) {
1429 int prop_is_valid;
1430 prop_is_valid = ast_ari_validate_double(
1432 if (!prop_is_valid) {
1433 ast_log(LOG_ERROR, "ARI RTPstat field local_normdevjitter failed validation\n");
1434 res = 0;
1435 }
1436 } else
1437 if (strcmp("local_normdevrxploss", ast_json_object_iter_key(iter)) == 0) {
1438 int prop_is_valid;
1439 prop_is_valid = ast_ari_validate_double(
1441 if (!prop_is_valid) {
1442 ast_log(LOG_ERROR, "ARI RTPstat field local_normdevrxploss failed validation\n");
1443 res = 0;
1444 }
1445 } else
1446 if (strcmp("local_ssrc", ast_json_object_iter_key(iter)) == 0) {
1447 int prop_is_valid;
1448 has_local_ssrc = 1;
1449 prop_is_valid = ast_ari_validate_int(
1451 if (!prop_is_valid) {
1452 ast_log(LOG_ERROR, "ARI RTPstat field local_ssrc failed validation\n");
1453 res = 0;
1454 }
1455 } else
1456 if (strcmp("local_stdevjitter", ast_json_object_iter_key(iter)) == 0) {
1457 int prop_is_valid;
1458 prop_is_valid = ast_ari_validate_double(
1460 if (!prop_is_valid) {
1461 ast_log(LOG_ERROR, "ARI RTPstat field local_stdevjitter failed validation\n");
1462 res = 0;
1463 }
1464 } else
1465 if (strcmp("local_stdevrxploss", ast_json_object_iter_key(iter)) == 0) {
1466 int prop_is_valid;
1467 prop_is_valid = ast_ari_validate_double(
1469 if (!prop_is_valid) {
1470 ast_log(LOG_ERROR, "ARI RTPstat field local_stdevrxploss failed validation\n");
1471 res = 0;
1472 }
1473 } else
1474 if (strcmp("maxrtt", ast_json_object_iter_key(iter)) == 0) {
1475 int prop_is_valid;
1476 prop_is_valid = ast_ari_validate_double(
1478 if (!prop_is_valid) {
1479 ast_log(LOG_ERROR, "ARI RTPstat field maxrtt failed validation\n");
1480 res = 0;
1481 }
1482 } else
1483 if (strcmp("minrtt", ast_json_object_iter_key(iter)) == 0) {
1484 int prop_is_valid;
1485 prop_is_valid = ast_ari_validate_double(
1487 if (!prop_is_valid) {
1488 ast_log(LOG_ERROR, "ARI RTPstat field minrtt failed validation\n");
1489 res = 0;
1490 }
1491 } else
1492 if (strcmp("normdevrtt", ast_json_object_iter_key(iter)) == 0) {
1493 int prop_is_valid;
1494 prop_is_valid = ast_ari_validate_double(
1496 if (!prop_is_valid) {
1497 ast_log(LOG_ERROR, "ARI RTPstat field normdevrtt failed validation\n");
1498 res = 0;
1499 }
1500 } else
1501 if (strcmp("remote_maxjitter", ast_json_object_iter_key(iter)) == 0) {
1502 int prop_is_valid;
1503 prop_is_valid = ast_ari_validate_double(
1505 if (!prop_is_valid) {
1506 ast_log(LOG_ERROR, "ARI RTPstat field remote_maxjitter failed validation\n");
1507 res = 0;
1508 }
1509 } else
1510 if (strcmp("remote_maxrxploss", ast_json_object_iter_key(iter)) == 0) {
1511 int prop_is_valid;
1512 prop_is_valid = ast_ari_validate_double(
1514 if (!prop_is_valid) {
1515 ast_log(LOG_ERROR, "ARI RTPstat field remote_maxrxploss failed validation\n");
1516 res = 0;
1517 }
1518 } else
1519 if (strcmp("remote_minjitter", ast_json_object_iter_key(iter)) == 0) {
1520 int prop_is_valid;
1521 prop_is_valid = ast_ari_validate_double(
1523 if (!prop_is_valid) {
1524 ast_log(LOG_ERROR, "ARI RTPstat field remote_minjitter failed validation\n");
1525 res = 0;
1526 }
1527 } else
1528 if (strcmp("remote_minrxploss", ast_json_object_iter_key(iter)) == 0) {
1529 int prop_is_valid;
1530 prop_is_valid = ast_ari_validate_double(
1532 if (!prop_is_valid) {
1533 ast_log(LOG_ERROR, "ARI RTPstat field remote_minrxploss failed validation\n");
1534 res = 0;
1535 }
1536 } else
1537 if (strcmp("remote_normdevjitter", ast_json_object_iter_key(iter)) == 0) {
1538 int prop_is_valid;
1539 prop_is_valid = ast_ari_validate_double(
1541 if (!prop_is_valid) {
1542 ast_log(LOG_ERROR, "ARI RTPstat field remote_normdevjitter failed validation\n");
1543 res = 0;
1544 }
1545 } else
1546 if (strcmp("remote_normdevrxploss", ast_json_object_iter_key(iter)) == 0) {
1547 int prop_is_valid;
1548 prop_is_valid = ast_ari_validate_double(
1550 if (!prop_is_valid) {
1551 ast_log(LOG_ERROR, "ARI RTPstat field remote_normdevrxploss failed validation\n");
1552 res = 0;
1553 }
1554 } else
1555 if (strcmp("remote_ssrc", ast_json_object_iter_key(iter)) == 0) {
1556 int prop_is_valid;
1557 has_remote_ssrc = 1;
1558 prop_is_valid = ast_ari_validate_int(
1560 if (!prop_is_valid) {
1561 ast_log(LOG_ERROR, "ARI RTPstat field remote_ssrc failed validation\n");
1562 res = 0;
1563 }
1564 } else
1565 if (strcmp("remote_stdevjitter", ast_json_object_iter_key(iter)) == 0) {
1566 int prop_is_valid;
1567 prop_is_valid = ast_ari_validate_double(
1569 if (!prop_is_valid) {
1570 ast_log(LOG_ERROR, "ARI RTPstat field remote_stdevjitter failed validation\n");
1571 res = 0;
1572 }
1573 } else
1574 if (strcmp("remote_stdevrxploss", ast_json_object_iter_key(iter)) == 0) {
1575 int prop_is_valid;
1576 prop_is_valid = ast_ari_validate_double(
1578 if (!prop_is_valid) {
1579 ast_log(LOG_ERROR, "ARI RTPstat field remote_stdevrxploss failed validation\n");
1580 res = 0;
1581 }
1582 } else
1583 if (strcmp("rtt", ast_json_object_iter_key(iter)) == 0) {
1584 int prop_is_valid;
1585 prop_is_valid = ast_ari_validate_double(
1587 if (!prop_is_valid) {
1588 ast_log(LOG_ERROR, "ARI RTPstat field rtt failed validation\n");
1589 res = 0;
1590 }
1591 } else
1592 if (strcmp("rxcount", ast_json_object_iter_key(iter)) == 0) {
1593 int prop_is_valid;
1594 has_rxcount = 1;
1595 prop_is_valid = ast_ari_validate_int(
1597 if (!prop_is_valid) {
1598 ast_log(LOG_ERROR, "ARI RTPstat field rxcount failed validation\n");
1599 res = 0;
1600 }
1601 } else
1602 if (strcmp("rxjitter", ast_json_object_iter_key(iter)) == 0) {
1603 int prop_is_valid;
1604 prop_is_valid = ast_ari_validate_double(
1606 if (!prop_is_valid) {
1607 ast_log(LOG_ERROR, "ARI RTPstat field rxjitter failed validation\n");
1608 res = 0;
1609 }
1610 } else
1611 if (strcmp("rxoctetcount", ast_json_object_iter_key(iter)) == 0) {
1612 int prop_is_valid;
1613 has_rxoctetcount = 1;
1614 prop_is_valid = ast_ari_validate_int(
1616 if (!prop_is_valid) {
1617 ast_log(LOG_ERROR, "ARI RTPstat field rxoctetcount failed validation\n");
1618 res = 0;
1619 }
1620 } else
1621 if (strcmp("rxploss", ast_json_object_iter_key(iter)) == 0) {
1622 int prop_is_valid;
1623 has_rxploss = 1;
1624 prop_is_valid = ast_ari_validate_int(
1626 if (!prop_is_valid) {
1627 ast_log(LOG_ERROR, "ARI RTPstat field rxploss failed validation\n");
1628 res = 0;
1629 }
1630 } else
1631 if (strcmp("stdevrtt", ast_json_object_iter_key(iter)) == 0) {
1632 int prop_is_valid;
1633 prop_is_valid = ast_ari_validate_double(
1635 if (!prop_is_valid) {
1636 ast_log(LOG_ERROR, "ARI RTPstat field stdevrtt failed validation\n");
1637 res = 0;
1638 }
1639 } else
1640 if (strcmp("txcount", ast_json_object_iter_key(iter)) == 0) {
1641 int prop_is_valid;
1642 has_txcount = 1;
1643 prop_is_valid = ast_ari_validate_int(
1645 if (!prop_is_valid) {
1646 ast_log(LOG_ERROR, "ARI RTPstat field txcount failed validation\n");
1647 res = 0;
1648 }
1649 } else
1650 if (strcmp("txjitter", ast_json_object_iter_key(iter)) == 0) {
1651 int prop_is_valid;
1652 prop_is_valid = ast_ari_validate_double(
1654 if (!prop_is_valid) {
1655 ast_log(LOG_ERROR, "ARI RTPstat field txjitter failed validation\n");
1656 res = 0;
1657 }
1658 } else
1659 if (strcmp("txoctetcount", ast_json_object_iter_key(iter)) == 0) {
1660 int prop_is_valid;
1661 has_txoctetcount = 1;
1662 prop_is_valid = ast_ari_validate_int(
1664 if (!prop_is_valid) {
1665 ast_log(LOG_ERROR, "ARI RTPstat field txoctetcount failed validation\n");
1666 res = 0;
1667 }
1668 } else
1669 if (strcmp("txploss", ast_json_object_iter_key(iter)) == 0) {
1670 int prop_is_valid;
1671 has_txploss = 1;
1672 prop_is_valid = ast_ari_validate_int(
1674 if (!prop_is_valid) {
1675 ast_log(LOG_ERROR, "ARI RTPstat field txploss failed validation\n");
1676 res = 0;
1677 }
1678 } else
1679 {
1681 "ARI RTPstat has undocumented field %s\n",
1683 res = 0;
1684 }
1685 }
1686
1687 if (!has_channel_uniqueid) {
1688 ast_log(LOG_ERROR, "ARI RTPstat missing required field channel_uniqueid\n");
1689 res = 0;
1690 }
1691
1692 if (!has_local_ssrc) {
1693 ast_log(LOG_ERROR, "ARI RTPstat missing required field local_ssrc\n");
1694 res = 0;
1695 }
1696
1697 if (!has_remote_ssrc) {
1698 ast_log(LOG_ERROR, "ARI RTPstat missing required field remote_ssrc\n");
1699 res = 0;
1700 }
1701
1702 if (!has_rxcount) {
1703 ast_log(LOG_ERROR, "ARI RTPstat missing required field rxcount\n");
1704 res = 0;
1705 }
1706
1707 if (!has_rxoctetcount) {
1708 ast_log(LOG_ERROR, "ARI RTPstat missing required field rxoctetcount\n");
1709 res = 0;
1710 }
1711
1712 if (!has_rxploss) {
1713 ast_log(LOG_ERROR, "ARI RTPstat missing required field rxploss\n");
1714 res = 0;
1715 }
1716
1717 if (!has_txcount) {
1718 ast_log(LOG_ERROR, "ARI RTPstat missing required field txcount\n");
1719 res = 0;
1720 }
1721
1722 if (!has_txoctetcount) {
1723 ast_log(LOG_ERROR, "ARI RTPstat missing required field txoctetcount\n");
1724 res = 0;
1725 }
1726
1727 if (!has_txploss) {
1728 ast_log(LOG_ERROR, "ARI RTPstat missing required field txploss\n");
1729 res = 0;
1730 }
1731
1732 return res;
1733}

References ast_ari_validate_double(), ast_ari_validate_int(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_channels_rtpstatistics_cb(), and ast_ari_validate_rtpstat_fn().

◆ ast_ari_validate_rtpstat_fn()

ari_validator ast_ari_validate_rtpstat_fn ( void  )

Function pointer to ast_ari_validate_rtpstat().

Definition at line 1735 of file ari_model_validators.c.

1736{
1738}
int ast_ari_validate_rtpstat(struct ast_json *json)
Validator for RTPstat.

References ast_ari_validate_rtpstat().

◆ ast_ari_validate_set_id()

int ast_ari_validate_set_id ( struct ast_json json)

Validator for SetId.

Effective user/group id

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 621 of file ari_model_validators.c.

622{
623 int res = 1;
624 struct ast_json_iter *iter;
625 int has_group = 0;
626 int has_user = 0;
627
628 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
629 if (strcmp("group", ast_json_object_iter_key(iter)) == 0) {
630 int prop_is_valid;
631 has_group = 1;
632 prop_is_valid = ast_ari_validate_string(
634 if (!prop_is_valid) {
635 ast_log(LOG_ERROR, "ARI SetId field group failed validation\n");
636 res = 0;
637 }
638 } else
639 if (strcmp("user", ast_json_object_iter_key(iter)) == 0) {
640 int prop_is_valid;
641 has_user = 1;
642 prop_is_valid = ast_ari_validate_string(
644 if (!prop_is_valid) {
645 ast_log(LOG_ERROR, "ARI SetId field user failed validation\n");
646 res = 0;
647 }
648 } else
649 {
651 "ARI SetId has undocumented field %s\n",
653 res = 0;
654 }
655 }
656
657 if (!has_group) {
658 ast_log(LOG_ERROR, "ARI SetId missing required field group\n");
659 res = 0;
660 }
661
662 if (!has_user) {
663 ast_log(LOG_ERROR, "ARI SetId missing required field user\n");
664 res = 0;
665 }
666
667 return res;
668}

References ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_config_info(), and ast_ari_validate_set_id_fn().

◆ ast_ari_validate_set_id_fn()

ari_validator ast_ari_validate_set_id_fn ( void  )

Function pointer to ast_ari_validate_set_id().

Definition at line 670 of file ari_model_validators.c.

671{
673}

References ast_ari_validate_set_id().

◆ ast_ari_validate_sound()

int ast_ari_validate_sound ( struct ast_json json)

Validator for Sound.

A media file that may be played back.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 2139 of file ari_model_validators.c.

2140{
2141 int res = 1;
2142 struct ast_json_iter *iter;
2143 int has_formats = 0;
2144 int has_id = 0;
2145
2146 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2147 if (strcmp("formats", ast_json_object_iter_key(iter)) == 0) {
2148 int prop_is_valid;
2149 has_formats = 1;
2150 prop_is_valid = ast_ari_validate_list(
2153 if (!prop_is_valid) {
2154 ast_log(LOG_ERROR, "ARI Sound field formats failed validation\n");
2155 res = 0;
2156 }
2157 } else
2158 if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
2159 int prop_is_valid;
2160 has_id = 1;
2161 prop_is_valid = ast_ari_validate_string(
2163 if (!prop_is_valid) {
2164 ast_log(LOG_ERROR, "ARI Sound field id failed validation\n");
2165 res = 0;
2166 }
2167 } else
2168 if (strcmp("text", ast_json_object_iter_key(iter)) == 0) {
2169 int prop_is_valid;
2170 prop_is_valid = ast_ari_validate_string(
2172 if (!prop_is_valid) {
2173 ast_log(LOG_ERROR, "ARI Sound field text failed validation\n");
2174 res = 0;
2175 }
2176 } else
2177 {
2179 "ARI Sound has undocumented field %s\n",
2181 res = 0;
2182 }
2183 }
2184
2185 if (!has_formats) {
2186 ast_log(LOG_ERROR, "ARI Sound missing required field formats\n");
2187 res = 0;
2188 }
2189
2190 if (!has_id) {
2191 ast_log(LOG_ERROR, "ARI Sound missing required field id\n");
2192 res = 0;
2193 }
2194
2195 return res;
2196}

References ast_ari_validate_format_lang_pair(), ast_ari_validate_list(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_sounds_get_cb(), and ast_ari_validate_sound_fn().

◆ ast_ari_validate_sound_fn()

ari_validator ast_ari_validate_sound_fn ( void  )

Function pointer to ast_ari_validate_sound().

Definition at line 2198 of file ari_model_validators.c.

2199{
2201}
int ast_ari_validate_sound(struct ast_json *json)
Validator for Sound.

References ast_ari_validate_sound().

Referenced by ast_ari_sounds_list_cb().

◆ ast_ari_validate_stasis_end()

int ast_ari_validate_stasis_end ( struct ast_json json)

Validator for StasisEnd.

Notification that a channel has left a Stasis application.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 7110 of file ari_model_validators.c.

7111{
7112 int res = 1;
7113 struct ast_json_iter *iter;
7114 int has_type = 0;
7115 int has_application = 0;
7116 int has_timestamp = 0;
7117 int has_channel = 0;
7118
7119 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
7120 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
7121 int prop_is_valid;
7122 prop_is_valid = ast_ari_validate_string(
7124 if (!prop_is_valid) {
7125 ast_log(LOG_ERROR, "ARI StasisEnd field asterisk_id failed validation\n");
7126 res = 0;
7127 }
7128 } else
7129 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
7130 int prop_is_valid;
7131 has_type = 1;
7132 prop_is_valid = ast_ari_validate_string(
7134 if (!prop_is_valid) {
7135 ast_log(LOG_ERROR, "ARI StasisEnd field type failed validation\n");
7136 res = 0;
7137 }
7138 } else
7139 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
7140 int prop_is_valid;
7141 has_application = 1;
7142 prop_is_valid = ast_ari_validate_string(
7144 if (!prop_is_valid) {
7145 ast_log(LOG_ERROR, "ARI StasisEnd field application failed validation\n");
7146 res = 0;
7147 }
7148 } else
7149 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
7150 int prop_is_valid;
7151 has_timestamp = 1;
7152 prop_is_valid = ast_ari_validate_date(
7154 if (!prop_is_valid) {
7155 ast_log(LOG_ERROR, "ARI StasisEnd field timestamp failed validation\n");
7156 res = 0;
7157 }
7158 } else
7159 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
7160 int prop_is_valid;
7161 has_channel = 1;
7162 prop_is_valid = ast_ari_validate_channel(
7164 if (!prop_is_valid) {
7165 ast_log(LOG_ERROR, "ARI StasisEnd field channel failed validation\n");
7166 res = 0;
7167 }
7168 } else
7169 {
7171 "ARI StasisEnd has undocumented field %s\n",
7173 res = 0;
7174 }
7175 }
7176
7177 if (!has_type) {
7178 ast_log(LOG_ERROR, "ARI StasisEnd missing required field type\n");
7179 res = 0;
7180 }
7181
7182 if (!has_application) {
7183 ast_log(LOG_ERROR, "ARI StasisEnd missing required field application\n");
7184 res = 0;
7185 }
7186
7187 if (!has_timestamp) {
7188 ast_log(LOG_ERROR, "ARI StasisEnd missing required field timestamp\n");
7189 res = 0;
7190 }
7191
7192 if (!has_channel) {
7193 ast_log(LOG_ERROR, "ARI StasisEnd missing required field channel\n");
7194 res = 0;
7195 }
7196
7197 return res;
7198}

References ast_ari_validate_channel(), ast_ari_validate_date(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_event(), ast_ari_validate_message(), and ast_ari_validate_stasis_end_fn().

◆ ast_ari_validate_stasis_end_fn()

ari_validator ast_ari_validate_stasis_end_fn ( void  )

Function pointer to ast_ari_validate_stasis_end().

Definition at line 7200 of file ari_model_validators.c.

7201{
7203}

References ast_ari_validate_stasis_end().

◆ ast_ari_validate_stasis_start()

int ast_ari_validate_stasis_start ( struct ast_json json)

Validator for StasisStart.

Notification that a channel has entered a Stasis application.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 7205 of file ari_model_validators.c.

7206{
7207 int res = 1;
7208 struct ast_json_iter *iter;
7209 int has_type = 0;
7210 int has_application = 0;
7211 int has_timestamp = 0;
7212 int has_args = 0;
7213 int has_channel = 0;
7214
7215 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
7216 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
7217 int prop_is_valid;
7218 prop_is_valid = ast_ari_validate_string(
7220 if (!prop_is_valid) {
7221 ast_log(LOG_ERROR, "ARI StasisStart field asterisk_id failed validation\n");
7222 res = 0;
7223 }
7224 } else
7225 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
7226 int prop_is_valid;
7227 has_type = 1;
7228 prop_is_valid = ast_ari_validate_string(
7230 if (!prop_is_valid) {
7231 ast_log(LOG_ERROR, "ARI StasisStart field type failed validation\n");
7232 res = 0;
7233 }
7234 } else
7235 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
7236 int prop_is_valid;
7237 has_application = 1;
7238 prop_is_valid = ast_ari_validate_string(
7240 if (!prop_is_valid) {
7241 ast_log(LOG_ERROR, "ARI StasisStart field application failed validation\n");
7242 res = 0;
7243 }
7244 } else
7245 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
7246 int prop_is_valid;
7247 has_timestamp = 1;
7248 prop_is_valid = ast_ari_validate_date(
7250 if (!prop_is_valid) {
7251 ast_log(LOG_ERROR, "ARI StasisStart field timestamp failed validation\n");
7252 res = 0;
7253 }
7254 } else
7255 if (strcmp("args", ast_json_object_iter_key(iter)) == 0) {
7256 int prop_is_valid;
7257 has_args = 1;
7258 prop_is_valid = ast_ari_validate_list(
7261 if (!prop_is_valid) {
7262 ast_log(LOG_ERROR, "ARI StasisStart field args failed validation\n");
7263 res = 0;
7264 }
7265 } else
7266 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
7267 int prop_is_valid;
7268 has_channel = 1;
7269 prop_is_valid = ast_ari_validate_channel(
7271 if (!prop_is_valid) {
7272 ast_log(LOG_ERROR, "ARI StasisStart field channel failed validation\n");
7273 res = 0;
7274 }
7275 } else
7276 if (strcmp("replace_channel", ast_json_object_iter_key(iter)) == 0) {
7277 int prop_is_valid;
7278 prop_is_valid = ast_ari_validate_channel(
7280 if (!prop_is_valid) {
7281 ast_log(LOG_ERROR, "ARI StasisStart field replace_channel failed validation\n");
7282 res = 0;
7283 }
7284 } else
7285 {
7287 "ARI StasisStart has undocumented field %s\n",
7289 res = 0;
7290 }
7291 }
7292
7293 if (!has_type) {
7294 ast_log(LOG_ERROR, "ARI StasisStart missing required field type\n");
7295 res = 0;
7296 }
7297
7298 if (!has_application) {
7299 ast_log(LOG_ERROR, "ARI StasisStart missing required field application\n");
7300 res = 0;
7301 }
7302
7303 if (!has_timestamp) {
7304 ast_log(LOG_ERROR, "ARI StasisStart missing required field timestamp\n");
7305 res = 0;
7306 }
7307
7308 if (!has_args) {
7309 ast_log(LOG_ERROR, "ARI StasisStart missing required field args\n");
7310 res = 0;
7311 }
7312
7313 if (!has_channel) {
7314 ast_log(LOG_ERROR, "ARI StasisStart missing required field channel\n");
7315 res = 0;
7316 }
7317
7318 return res;
7319}

References ast_ari_validate_channel(), ast_ari_validate_date(), ast_ari_validate_list(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_event(), ast_ari_validate_message(), and ast_ari_validate_stasis_start_fn().

◆ ast_ari_validate_stasis_start_fn()

ari_validator ast_ari_validate_stasis_start_fn ( void  )

Function pointer to ast_ari_validate_stasis_start().

Definition at line 7321 of file ari_model_validators.c.

7322{
7324}

References ast_ari_validate_stasis_start().

◆ ast_ari_validate_status_info()

int ast_ari_validate_status_info ( struct ast_json json)

Validator for StatusInfo.

Info about Asterisk status

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 675 of file ari_model_validators.c.

676{
677 int res = 1;
678 struct ast_json_iter *iter;
679 int has_last_reload_time = 0;
680 int has_startup_time = 0;
681
682 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
683 if (strcmp("last_reload_time", ast_json_object_iter_key(iter)) == 0) {
684 int prop_is_valid;
685 has_last_reload_time = 1;
686 prop_is_valid = ast_ari_validate_date(
688 if (!prop_is_valid) {
689 ast_log(LOG_ERROR, "ARI StatusInfo field last_reload_time failed validation\n");
690 res = 0;
691 }
692 } else
693 if (strcmp("startup_time", ast_json_object_iter_key(iter)) == 0) {
694 int prop_is_valid;
695 has_startup_time = 1;
696 prop_is_valid = ast_ari_validate_date(
698 if (!prop_is_valid) {
699 ast_log(LOG_ERROR, "ARI StatusInfo field startup_time failed validation\n");
700 res = 0;
701 }
702 } else
703 {
705 "ARI StatusInfo has undocumented field %s\n",
707 res = 0;
708 }
709 }
710
711 if (!has_last_reload_time) {
712 ast_log(LOG_ERROR, "ARI StatusInfo missing required field last_reload_time\n");
713 res = 0;
714 }
715
716 if (!has_startup_time) {
717 ast_log(LOG_ERROR, "ARI StatusInfo missing required field startup_time\n");
718 res = 0;
719 }
720
721 return res;
722}

References ast_ari_validate_date(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_asterisk_info(), and ast_ari_validate_status_info_fn().

◆ ast_ari_validate_status_info_fn()

ari_validator ast_ari_validate_status_info_fn ( void  )

Function pointer to ast_ari_validate_status_info().

Definition at line 724 of file ari_model_validators.c.

725{
727}

References ast_ari_validate_status_info().

◆ ast_ari_validate_stored_recording()

int ast_ari_validate_stored_recording ( struct ast_json json)

Validator for StoredRecording.

A past recording that may be played back.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 2031 of file ari_model_validators.c.

2032{
2033 int res = 1;
2034 struct ast_json_iter *iter;
2035 int has_format = 0;
2036 int has_name = 0;
2037
2038 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2039 if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
2040 int prop_is_valid;
2041 has_format = 1;
2042 prop_is_valid = ast_ari_validate_string(
2044 if (!prop_is_valid) {
2045 ast_log(LOG_ERROR, "ARI StoredRecording field format failed validation\n");
2046 res = 0;
2047 }
2048 } else
2049 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
2050 int prop_is_valid;
2051 has_name = 1;
2052 prop_is_valid = ast_ari_validate_string(
2054 if (!prop_is_valid) {
2055 ast_log(LOG_ERROR, "ARI StoredRecording field name failed validation\n");
2056 res = 0;
2057 }
2058 } else
2059 {
2061 "ARI StoredRecording has undocumented field %s\n",
2063 res = 0;
2064 }
2065 }
2066
2067 if (!has_format) {
2068 ast_log(LOG_ERROR, "ARI StoredRecording missing required field format\n");
2069 res = 0;
2070 }
2071
2072 if (!has_name) {
2073 ast_log(LOG_ERROR, "ARI StoredRecording missing required field name\n");
2074 res = 0;
2075 }
2076
2077 return res;
2078}

References ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_recordings_copy_stored_cb(), ast_ari_recordings_get_stored_cb(), and ast_ari_validate_stored_recording_fn().

◆ ast_ari_validate_stored_recording_fn()

ari_validator ast_ari_validate_stored_recording_fn ( void  )

Function pointer to ast_ari_validate_stored_recording().

Definition at line 2080 of file ari_model_validators.c.

2081{
2083}
int ast_ari_validate_stored_recording(struct ast_json *json)
Validator for StoredRecording.

References ast_ari_validate_stored_recording().

Referenced by ast_ari_recordings_list_stored_cb().

◆ ast_ari_validate_system_info()

int ast_ari_validate_system_info ( struct ast_json json)

Validator for SystemInfo.

Info about Asterisk

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 729 of file ari_model_validators.c.

730{
731 int res = 1;
732 struct ast_json_iter *iter;
733 int has_entity_id = 0;
734 int has_version = 0;
735
736 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
737 if (strcmp("entity_id", ast_json_object_iter_key(iter)) == 0) {
738 int prop_is_valid;
739 has_entity_id = 1;
740 prop_is_valid = ast_ari_validate_string(
742 if (!prop_is_valid) {
743 ast_log(LOG_ERROR, "ARI SystemInfo field entity_id failed validation\n");
744 res = 0;
745 }
746 } else
747 if (strcmp("version", ast_json_object_iter_key(iter)) == 0) {
748 int prop_is_valid;
749 has_version = 1;
750 prop_is_valid = ast_ari_validate_string(
752 if (!prop_is_valid) {
753 ast_log(LOG_ERROR, "ARI SystemInfo field version failed validation\n");
754 res = 0;
755 }
756 } else
757 {
759 "ARI SystemInfo has undocumented field %s\n",
761 res = 0;
762 }
763 }
764
765 if (!has_entity_id) {
766 ast_log(LOG_ERROR, "ARI SystemInfo missing required field entity_id\n");
767 res = 0;
768 }
769
770 if (!has_version) {
771 ast_log(LOG_ERROR, "ARI SystemInfo missing required field version\n");
772 res = 0;
773 }
774
775 return res;
776}

References ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_asterisk_info(), and ast_ari_validate_system_info_fn().

◆ ast_ari_validate_system_info_fn()

ari_validator ast_ari_validate_system_info_fn ( void  )

Function pointer to ast_ari_validate_system_info().

Definition at line 778 of file ari_model_validators.c.

779{
781}

References ast_ari_validate_system_info().

◆ ast_ari_validate_text_message()

int ast_ari_validate_text_message ( struct ast_json json)

Validator for TextMessage.

A text message.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 901 of file ari_model_validators.c.

902{
903 int res = 1;
904 struct ast_json_iter *iter;
905 int has_body = 0;
906 int has_from = 0;
907 int has_to = 0;
908
909 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
910 if (strcmp("body", ast_json_object_iter_key(iter)) == 0) {
911 int prop_is_valid;
912 has_body = 1;
913 prop_is_valid = ast_ari_validate_string(
915 if (!prop_is_valid) {
916 ast_log(LOG_ERROR, "ARI TextMessage field body failed validation\n");
917 res = 0;
918 }
919 } else
920 if (strcmp("from", ast_json_object_iter_key(iter)) == 0) {
921 int prop_is_valid;
922 has_from = 1;
923 prop_is_valid = ast_ari_validate_string(
925 if (!prop_is_valid) {
926 ast_log(LOG_ERROR, "ARI TextMessage field from failed validation\n");
927 res = 0;
928 }
929 } else
930 if (strcmp("to", ast_json_object_iter_key(iter)) == 0) {
931 int prop_is_valid;
932 has_to = 1;
933 prop_is_valid = ast_ari_validate_string(
935 if (!prop_is_valid) {
936 ast_log(LOG_ERROR, "ARI TextMessage field to failed validation\n");
937 res = 0;
938 }
939 } else
940 if (strcmp("variables", ast_json_object_iter_key(iter)) == 0) {
941 int prop_is_valid;
942 prop_is_valid = ast_ari_validate_object(
944 if (!prop_is_valid) {
945 ast_log(LOG_ERROR, "ARI TextMessage field variables failed validation\n");
946 res = 0;
947 }
948 } else
949 {
951 "ARI TextMessage has undocumented field %s\n",
953 res = 0;
954 }
955 }
956
957 if (!has_body) {
958 ast_log(LOG_ERROR, "ARI TextMessage missing required field body\n");
959 res = 0;
960 }
961
962 if (!has_from) {
963 ast_log(LOG_ERROR, "ARI TextMessage missing required field from\n");
964 res = 0;
965 }
966
967 if (!has_to) {
968 ast_log(LOG_ERROR, "ARI TextMessage missing required field to\n");
969 res = 0;
970 }
971
972 return res;
973}

References ast_ari_validate_object(), ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_text_message_fn(), and ast_ari_validate_text_message_received().

◆ ast_ari_validate_text_message_fn()

ari_validator ast_ari_validate_text_message_fn ( void  )

Function pointer to ast_ari_validate_text_message().

Definition at line 975 of file ari_model_validators.c.

976{
978}
int ast_ari_validate_text_message(struct ast_json *json)
Validator for TextMessage.

References ast_ari_validate_text_message().

◆ ast_ari_validate_text_message_received()

int ast_ari_validate_text_message_received ( struct ast_json json)

Validator for TextMessageReceived.

A text message was received from an endpoint.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 7326 of file ari_model_validators.c.

7327{
7328 int res = 1;
7329 struct ast_json_iter *iter;
7330 int has_type = 0;
7331 int has_application = 0;
7332 int has_timestamp = 0;
7333 int has_message = 0;
7334
7335 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
7336 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
7337 int prop_is_valid;
7338 prop_is_valid = ast_ari_validate_string(
7340 if (!prop_is_valid) {
7341 ast_log(LOG_ERROR, "ARI TextMessageReceived field asterisk_id failed validation\n");
7342 res = 0;
7343 }
7344 } else
7345 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
7346 int prop_is_valid;
7347 has_type = 1;
7348 prop_is_valid = ast_ari_validate_string(
7350 if (!prop_is_valid) {
7351 ast_log(LOG_ERROR, "ARI TextMessageReceived field type failed validation\n");
7352 res = 0;
7353 }
7354 } else
7355 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
7356 int prop_is_valid;
7357 has_application = 1;
7358 prop_is_valid = ast_ari_validate_string(
7360 if (!prop_is_valid) {
7361 ast_log(LOG_ERROR, "ARI TextMessageReceived field application failed validation\n");
7362 res = 0;
7363 }
7364 } else
7365 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
7366 int prop_is_valid;
7367 has_timestamp = 1;
7368 prop_is_valid = ast_ari_validate_date(
7370 if (!prop_is_valid) {
7371 ast_log(LOG_ERROR, "ARI TextMessageReceived field timestamp failed validation\n");
7372 res = 0;
7373 }
7374 } else
7375 if (strcmp("endpoint", ast_json_object_iter_key(iter)) == 0) {
7376 int prop_is_valid;
7377 prop_is_valid = ast_ari_validate_endpoint(
7379 if (!prop_is_valid) {
7380 ast_log(LOG_ERROR, "ARI TextMessageReceived field endpoint failed validation\n");
7381 res = 0;
7382 }
7383 } else
7384 if (strcmp("message", ast_json_object_iter_key(iter)) == 0) {
7385 int prop_is_valid;
7386 has_message = 1;
7387 prop_is_valid = ast_ari_validate_text_message(
7389 if (!prop_is_valid) {
7390 ast_log(LOG_ERROR, "ARI TextMessageReceived field message failed validation\n");
7391 res = 0;
7392 }
7393 } else
7394 {
7396 "ARI TextMessageReceived has undocumented field %s\n",
7398 res = 0;
7399 }
7400 }
7401
7402 if (!has_type) {
7403 ast_log(LOG_ERROR, "ARI TextMessageReceived missing required field type\n");
7404 res = 0;
7405 }
7406
7407 if (!has_application) {
7408 ast_log(LOG_ERROR, "ARI TextMessageReceived missing required field application\n");
7409 res = 0;
7410 }
7411
7412 if (!has_timestamp) {
7413 ast_log(LOG_ERROR, "ARI TextMessageReceived missing required field timestamp\n");
7414 res = 0;
7415 }
7416
7417 if (!has_message) {
7418 ast_log(LOG_ERROR, "ARI TextMessageReceived missing required field message\n");
7419 res = 0;
7420 }
7421
7422 return res;
7423}

References ast_ari_validate_date(), ast_ari_validate_endpoint(), ast_ari_validate_string(), ast_ari_validate_text_message(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_event(), ast_ari_validate_message(), and ast_ari_validate_text_message_received_fn().

◆ ast_ari_validate_text_message_received_fn()

ari_validator ast_ari_validate_text_message_received_fn ( void  )

◆ ast_ari_validate_variable()

int ast_ari_validate_variable ( struct ast_json json)

Validator for Variable.

The value of a channel variable

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 783 of file ari_model_validators.c.

784{
785 int res = 1;
786 struct ast_json_iter *iter;
787 int has_value = 0;
788
789 for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
790 if (strcmp("value", ast_json_object_iter_key(iter)) == 0) {
791 int prop_is_valid;
792 has_value = 1;
793 prop_is_valid = ast_ari_validate_string(
795 if (!prop_is_valid) {
796 ast_log(LOG_ERROR, "ARI Variable field value failed validation\n");
797 res = 0;
798 }
799 } else
800 {
802 "ARI Variable has undocumented field %s\n",
804 res = 0;
805 }
806 }
807
808 if (!has_value) {
809 ast_log(LOG_ERROR, "ARI Variable missing required field value\n");
810 res = 0;
811 }
812
813 return res;
814}

References ast_ari_validate_string(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_log, and LOG_ERROR.

Referenced by ast_ari_asterisk_get_global_var_cb(), ast_ari_channels_get_channel_var_cb(), and ast_ari_validate_variable_fn().

◆ ast_ari_validate_variable_fn()

ari_validator ast_ari_validate_variable_fn ( void  )

Function pointer to ast_ari_validate_variable().

Definition at line 816 of file ari_model_validators.c.

817{
819}
int ast_ari_validate_variable(struct ast_json *json)
Validator for Variable.

References ast_ari_validate_variable().