Asterisk - The Open Source Telephony Project  18.5.0
Typedefs | Functions
ari_model_validators.h File Reference

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

#include "asterisk/json.h"
Include dependency graph for ari_model_validators.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef int(* ari_validator) (struct ast_json *json)
 Function type for validator functions. Allows for. More...
 

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_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...
 
int ast_ari_validate_void (struct ast_json *json)
 Validator for native Swagger void. More...
 
int ast_ari_validate_object (struct ast_json *json)
 Validator for native Swagger object. More...
 
int ast_ari_validate_byte (struct ast_json *json)
 Validator for native Swagger byte. More...
 
int ast_ari_validate_boolean (struct ast_json *json)
 Validator for native Swagger boolean. More...
 
int ast_ari_validate_int (struct ast_json *json)
 Validator for native Swagger int. More...
 
int ast_ari_validate_long (struct ast_json *json)
 Validator for native Swagger long. More...
 
int ast_ari_validate_float (struct ast_json *json)
 Validator for native Swagger float. More...
 
int ast_ari_validate_double (struct ast_json *json)
 Validator for native Swagger double. More...
 
int ast_ari_validate_string (struct ast_json *json)
 Validator for native Swagger string. More...
 
int ast_ari_validate_date (struct ast_json *json)
 Validator for native Swagger date. More...
 
int ast_ari_validate_list (struct ast_json *json, int(*fn)(struct ast_json *))
 Validator for a Swagger List[]/JSON array. More...
 

Detailed Description

Generated file - Build validators for ARI model objects.

In addition to the normal validation functions one would normally expect, each validator has a ast_ari_validate_{id}_fn() companion function that returns the validator's function pointer.

The reason for this seamingly useless indirection is the way function pointers used to interfere with module loading. Previously, Asterisk attempted to dlopen() each module using RTLD_LAZY in order to read some metadata from the module. Using functions to get the function pointer allowed us to be lazy.

Definition in file ari_model_validators.h.

Typedef Documentation

◆ ari_validator

typedef int(* ari_validator) (struct ast_json *json)

Function type for validator functions. Allows for.

Definition at line 152 of file ari_model_validators.h.

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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 7295 of file ari_model_validators.c.

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().

7296 {
7297  int res = 1;
7298  struct ast_json_iter *iter;
7299  int has_bridge_ids = 0;
7300  int has_channel_ids = 0;
7301  int has_device_names = 0;
7302  int has_endpoint_ids = 0;
7303  int has_events_allowed = 0;
7304  int has_events_disallowed = 0;
7305  int has_name = 0;
7306 
7307  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
7308  if (strcmp("bridge_ids", ast_json_object_iter_key(iter)) == 0) {
7309  int prop_is_valid;
7310  has_bridge_ids = 1;
7311  prop_is_valid = ast_ari_validate_list(
7314  if (!prop_is_valid) {
7315  ast_log(LOG_ERROR, "ARI Application field bridge_ids failed validation\n");
7316  res = 0;
7317  }
7318  } else
7319  if (strcmp("channel_ids", ast_json_object_iter_key(iter)) == 0) {
7320  int prop_is_valid;
7321  has_channel_ids = 1;
7322  prop_is_valid = ast_ari_validate_list(
7325  if (!prop_is_valid) {
7326  ast_log(LOG_ERROR, "ARI Application field channel_ids failed validation\n");
7327  res = 0;
7328  }
7329  } else
7330  if (strcmp("device_names", ast_json_object_iter_key(iter)) == 0) {
7331  int prop_is_valid;
7332  has_device_names = 1;
7333  prop_is_valid = ast_ari_validate_list(
7336  if (!prop_is_valid) {
7337  ast_log(LOG_ERROR, "ARI Application field device_names failed validation\n");
7338  res = 0;
7339  }
7340  } else
7341  if (strcmp("endpoint_ids", ast_json_object_iter_key(iter)) == 0) {
7342  int prop_is_valid;
7343  has_endpoint_ids = 1;
7344  prop_is_valid = ast_ari_validate_list(
7347  if (!prop_is_valid) {
7348  ast_log(LOG_ERROR, "ARI Application field endpoint_ids failed validation\n");
7349  res = 0;
7350  }
7351  } else
7352  if (strcmp("events_allowed", ast_json_object_iter_key(iter)) == 0) {
7353  int prop_is_valid;
7354  has_events_allowed = 1;
7355  prop_is_valid = ast_ari_validate_list(
7358  if (!prop_is_valid) {
7359  ast_log(LOG_ERROR, "ARI Application field events_allowed failed validation\n");
7360  res = 0;
7361  }
7362  } else
7363  if (strcmp("events_disallowed", ast_json_object_iter_key(iter)) == 0) {
7364  int prop_is_valid;
7365  has_events_disallowed = 1;
7366  prop_is_valid = ast_ari_validate_list(
7369  if (!prop_is_valid) {
7370  ast_log(LOG_ERROR, "ARI Application field events_disallowed failed validation\n");
7371  res = 0;
7372  }
7373  } else
7374  if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
7375  int prop_is_valid;
7376  has_name = 1;
7377  prop_is_valid = ast_ari_validate_string(
7379  if (!prop_is_valid) {
7380  ast_log(LOG_ERROR, "ARI Application field name failed validation\n");
7381  res = 0;
7382  }
7383  } else
7384  {
7386  "ARI Application has undocumented field %s\n",
7387  ast_json_object_iter_key(iter));
7388  res = 0;
7389  }
7390  }
7391 
7392  if (!has_bridge_ids) {
7393  ast_log(LOG_ERROR, "ARI Application missing required field bridge_ids\n");
7394  res = 0;
7395  }
7396 
7397  if (!has_channel_ids) {
7398  ast_log(LOG_ERROR, "ARI Application missing required field channel_ids\n");
7399  res = 0;
7400  }
7401 
7402  if (!has_device_names) {
7403  ast_log(LOG_ERROR, "ARI Application missing required field device_names\n");
7404  res = 0;
7405  }
7406 
7407  if (!has_endpoint_ids) {
7408  ast_log(LOG_ERROR, "ARI Application missing required field endpoint_ids\n");
7409  res = 0;
7410  }
7411 
7412  if (!has_events_allowed) {
7413  ast_log(LOG_ERROR, "ARI Application missing required field events_allowed\n");
7414  res = 0;
7415  }
7416 
7417  if (!has_events_disallowed) {
7418  ast_log(LOG_ERROR, "ARI Application missing required field events_disallowed\n");
7419  res = 0;
7420  }
7421 
7422  if (!has_name) {
7423  ast_log(LOG_ERROR, "ARI Application missing required field name\n");
7424  res = 0;
7425  }
7426 
7427  return res;
7428 }
Iterator for JSON object key/values.
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:429
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
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.
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:437

◆ ast_ari_validate_application_fn()

ari_validator ast_ari_validate_application_fn ( void  )

Function pointer to ast_ari_validate_application().

See ast_ari_model_validators.h for more details.

Definition at line 7430 of file ari_model_validators.c.

References ast_ari_validate_application().

Referenced by ast_ari_applications_list_cb().

7431 {
7433 }
int ast_ari_validate_application(struct ast_json *json)
Validator for Application.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 2397 of file ari_model_validators.c.

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().

2398 {
2399  int res = 1;
2400  struct ast_json_iter *iter;
2401  int has_type = 0;
2402  int has_application = 0;
2403  int has_timestamp = 0;
2404  int has_args = 0;
2405  int has_channel = 0;
2406  int has_destination = 0;
2407 
2408  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2409  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2410  int prop_is_valid;
2411  prop_is_valid = ast_ari_validate_string(
2413  if (!prop_is_valid) {
2414  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field asterisk_id failed validation\n");
2415  res = 0;
2416  }
2417  } else
2418  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2419  int prop_is_valid;
2420  has_type = 1;
2421  prop_is_valid = ast_ari_validate_string(
2423  if (!prop_is_valid) {
2424  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field type failed validation\n");
2425  res = 0;
2426  }
2427  } else
2428  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2429  int prop_is_valid;
2430  has_application = 1;
2431  prop_is_valid = ast_ari_validate_string(
2433  if (!prop_is_valid) {
2434  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field application failed validation\n");
2435  res = 0;
2436  }
2437  } else
2438  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2439  int prop_is_valid;
2440  has_timestamp = 1;
2441  prop_is_valid = ast_ari_validate_date(
2443  if (!prop_is_valid) {
2444  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field timestamp failed validation\n");
2445  res = 0;
2446  }
2447  } else
2448  if (strcmp("args", ast_json_object_iter_key(iter)) == 0) {
2449  int prop_is_valid;
2450  has_args = 1;
2451  prop_is_valid = ast_ari_validate_list(
2454  if (!prop_is_valid) {
2455  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field args failed validation\n");
2456  res = 0;
2457  }
2458  } else
2459  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2460  int prop_is_valid;
2461  has_channel = 1;
2462  prop_is_valid = ast_ari_validate_channel(
2464  if (!prop_is_valid) {
2465  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field channel failed validation\n");
2466  res = 0;
2467  }
2468  } else
2469  if (strcmp("destination", ast_json_object_iter_key(iter)) == 0) {
2470  int prop_is_valid;
2471  has_destination = 1;
2472  prop_is_valid = ast_ari_validate_string(
2474  if (!prop_is_valid) {
2475  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field destination failed validation\n");
2476  res = 0;
2477  }
2478  } else
2479  {
2481  "ARI ApplicationMoveFailed has undocumented field %s\n",
2482  ast_json_object_iter_key(iter));
2483  res = 0;
2484  }
2485  }
2486 
2487  if (!has_type) {
2488  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed missing required field type\n");
2489  res = 0;
2490  }
2491 
2492  if (!has_application) {
2493  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed missing required field application\n");
2494  res = 0;
2495  }
2496 
2497  if (!has_timestamp) {
2498  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed missing required field timestamp\n");
2499  res = 0;
2500  }
2501 
2502  if (!has_args) {
2503  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed missing required field args\n");
2504  res = 0;
2505  }
2506 
2507  if (!has_channel) {
2508  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed missing required field channel\n");
2509  res = 0;
2510  }
2511 
2512  if (!has_destination) {
2513  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed missing required field destination\n");
2514  res = 0;
2515  }
2516 
2517  return res;
2518 }
Iterator for JSON object key/values.
int ast_ari_validate_channel(struct ast_json *json)
Validator for Channel.
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:429
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
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.
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:437

◆ 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().

See ast_ari_model_validators.h for more details.

Definition at line 2520 of file ari_model_validators.c.

References ast_ari_validate_application_move_failed().

2521 {
2523 }
int ast_ari_validate_application_move_failed(struct ast_json *json)
Validator for ApplicationMoveFailed.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 2525 of file ari_model_validators.c.

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().

2526 {
2527  int res = 1;
2528  struct ast_json_iter *iter;
2529  int has_type = 0;
2530  int has_application = 0;
2531  int has_timestamp = 0;
2532 
2533  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2534  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2535  int prop_is_valid;
2536  prop_is_valid = ast_ari_validate_string(
2538  if (!prop_is_valid) {
2539  ast_log(LOG_ERROR, "ARI ApplicationReplaced field asterisk_id failed validation\n");
2540  res = 0;
2541  }
2542  } else
2543  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2544  int prop_is_valid;
2545  has_type = 1;
2546  prop_is_valid = ast_ari_validate_string(
2548  if (!prop_is_valid) {
2549  ast_log(LOG_ERROR, "ARI ApplicationReplaced field type failed validation\n");
2550  res = 0;
2551  }
2552  } else
2553  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2554  int prop_is_valid;
2555  has_application = 1;
2556  prop_is_valid = ast_ari_validate_string(
2558  if (!prop_is_valid) {
2559  ast_log(LOG_ERROR, "ARI ApplicationReplaced field application failed validation\n");
2560  res = 0;
2561  }
2562  } else
2563  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2564  int prop_is_valid;
2565  has_timestamp = 1;
2566  prop_is_valid = ast_ari_validate_date(
2568  if (!prop_is_valid) {
2569  ast_log(LOG_ERROR, "ARI ApplicationReplaced field timestamp failed validation\n");
2570  res = 0;
2571  }
2572  } else
2573  {
2575  "ARI ApplicationReplaced has undocumented field %s\n",
2576  ast_json_object_iter_key(iter));
2577  res = 0;
2578  }
2579  }
2580 
2581  if (!has_type) {
2582  ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field type\n");
2583  res = 0;
2584  }
2585 
2586  if (!has_application) {
2587  ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field application\n");
2588  res = 0;
2589  }
2590 
2591  if (!has_timestamp) {
2592  ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field timestamp\n");
2593  res = 0;
2594  }
2595 
2596  return res;
2597 }
Iterator for JSON object key/values.
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:429
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ ast_ari_validate_application_replaced_fn()

ari_validator ast_ari_validate_application_replaced_fn ( void  )

Function pointer to ast_ari_validate_application_replaced().

See ast_ari_model_validators.h for more details.

Definition at line 2599 of file ari_model_validators.c.

References ast_ari_validate_application_replaced().

2600 {
2602 }
int ast_ari_validate_application_replaced(struct ast_json *json)
Validator for ApplicationReplaced.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 36 of file ari_model_validators.c.

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().

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_config_info(struct ast_json *json)
Validator for ConfigInfo.
Iterator for JSON object key/values.
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:429
int ast_ari_validate_build_info(struct ast_json *json)
Validator for BuildInfo.
int ast_ari_validate_system_info(struct ast_json *json)
Validator for SystemInfo.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
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:437

◆ ast_ari_validate_asterisk_info_fn()

ari_validator ast_ari_validate_asterisk_info_fn ( void  )

Function pointer to ast_ari_validate_asterisk_info().

See ast_ari_model_validators.h for more details.

Definition at line 89 of file ari_model_validators.c.

References ast_ari_validate_asterisk_info().

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

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 94 of file ari_model_validators.c.

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().

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 }
Iterator for JSON object key/values.
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:429
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ ast_ari_validate_asterisk_ping_fn()

ari_validator ast_ari_validate_asterisk_ping_fn ( void  )

Function pointer to ast_ari_validate_asterisk_ping().

See ast_ari_model_validators.h for more details.

Definition at line 159 of file ari_model_validators.c.

References ast_ari_validate_asterisk_ping().

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

◆ ast_ari_validate_boolean()

int ast_ari_validate_boolean ( struct ast_json json)

Validator for native Swagger boolean.

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

Definition at line 107 of file res_ari_model.c.

References AST_JSON_FALSE, AST_JSON_TRUE, ast_json_typename(), ast_json_typeof(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_bridge_attended_transfer(), ast_ari_validate_bridge_blind_transfer(), ast_ari_validate_channel_hangup_request(), and AST_TEST_DEFINE().

108 {
109  enum ast_json_type actual = ast_json_typeof(json);
110  switch (actual) {
111  case AST_JSON_TRUE:
112  case AST_JSON_FALSE:
113  return 1;
114  default:
115  ast_log(LOG_ERROR, "Expected type boolean, was %s\n",
116  ast_json_typename(actual));
117  return 0;
118  }
119 }
ast_json_type
Valid types of a JSON element.
Definition: json.h:162
#define ast_log
Definition: astobj2.c:42
#define LOG_ERROR
Definition: logger.h:285
enum ast_json_type ast_json_typeof(const struct ast_json *value)
Get the type of value.
Definition: json.c:78
const char * ast_json_typename(enum ast_json_type type)
Get the string name for the given type.
Definition: json.c:95

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 1706 of file ari_model_validators.c.

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().

1707 {
1708  int res = 1;
1709  struct ast_json_iter *iter;
1710  int has_bridge_class = 0;
1711  int has_bridge_type = 0;
1712  int has_channels = 0;
1713  int has_creationtime = 0;
1714  int has_creator = 0;
1715  int has_id = 0;
1716  int has_name = 0;
1717  int has_technology = 0;
1718 
1719  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1720  if (strcmp("bridge_class", ast_json_object_iter_key(iter)) == 0) {
1721  int prop_is_valid;
1722  has_bridge_class = 1;
1723  prop_is_valid = ast_ari_validate_string(
1725  if (!prop_is_valid) {
1726  ast_log(LOG_ERROR, "ARI Bridge field bridge_class failed validation\n");
1727  res = 0;
1728  }
1729  } else
1730  if (strcmp("bridge_type", ast_json_object_iter_key(iter)) == 0) {
1731  int prop_is_valid;
1732  has_bridge_type = 1;
1733  prop_is_valid = ast_ari_validate_string(
1735  if (!prop_is_valid) {
1736  ast_log(LOG_ERROR, "ARI Bridge field bridge_type failed validation\n");
1737  res = 0;
1738  }
1739  } else
1740  if (strcmp("channels", ast_json_object_iter_key(iter)) == 0) {
1741  int prop_is_valid;
1742  has_channels = 1;
1743  prop_is_valid = ast_ari_validate_list(
1746  if (!prop_is_valid) {
1747  ast_log(LOG_ERROR, "ARI Bridge field channels failed validation\n");
1748  res = 0;
1749  }
1750  } else
1751  if (strcmp("creationtime", ast_json_object_iter_key(iter)) == 0) {
1752  int prop_is_valid;
1753  has_creationtime = 1;
1754  prop_is_valid = ast_ari_validate_date(
1756  if (!prop_is_valid) {
1757  ast_log(LOG_ERROR, "ARI Bridge field creationtime failed validation\n");
1758  res = 0;
1759  }
1760  } else
1761  if (strcmp("creator", ast_json_object_iter_key(iter)) == 0) {
1762  int prop_is_valid;
1763  has_creator = 1;
1764  prop_is_valid = ast_ari_validate_string(
1766  if (!prop_is_valid) {
1767  ast_log(LOG_ERROR, "ARI Bridge field creator failed validation\n");
1768  res = 0;
1769  }
1770  } else
1771  if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
1772  int prop_is_valid;
1773  has_id = 1;
1774  prop_is_valid = ast_ari_validate_string(
1776  if (!prop_is_valid) {
1777  ast_log(LOG_ERROR, "ARI Bridge field id failed validation\n");
1778  res = 0;
1779  }
1780  } else
1781  if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1782  int prop_is_valid;
1783  has_name = 1;
1784  prop_is_valid = ast_ari_validate_string(
1786  if (!prop_is_valid) {
1787  ast_log(LOG_ERROR, "ARI Bridge field name failed validation\n");
1788  res = 0;
1789  }
1790  } else
1791  if (strcmp("technology", ast_json_object_iter_key(iter)) == 0) {
1792  int prop_is_valid;
1793  has_technology = 1;
1794  prop_is_valid = ast_ari_validate_string(
1796  if (!prop_is_valid) {
1797  ast_log(LOG_ERROR, "ARI Bridge field technology failed validation\n");
1798  res = 0;
1799  }
1800  } else
1801  if (strcmp("video_mode", ast_json_object_iter_key(iter)) == 0) {
1802  int prop_is_valid;
1803  prop_is_valid = ast_ari_validate_string(
1805  if (!prop_is_valid) {
1806  ast_log(LOG_ERROR, "ARI Bridge field video_mode failed validation\n");
1807  res = 0;
1808  }
1809  } else
1810  if (strcmp("video_source_id", ast_json_object_iter_key(iter)) == 0) {
1811  int prop_is_valid;
1812  prop_is_valid = ast_ari_validate_string(
1814  if (!prop_is_valid) {
1815  ast_log(LOG_ERROR, "ARI Bridge field video_source_id failed validation\n");
1816  res = 0;
1817  }
1818  } else
1819  {
1821  "ARI Bridge has undocumented field %s\n",
1822  ast_json_object_iter_key(iter));
1823  res = 0;
1824  }
1825  }
1826 
1827  if (!has_bridge_class) {
1828  ast_log(LOG_ERROR, "ARI Bridge missing required field bridge_class\n");
1829  res = 0;
1830  }
1831 
1832  if (!has_bridge_type) {
1833  ast_log(LOG_ERROR, "ARI Bridge missing required field bridge_type\n");
1834  res = 0;
1835  }
1836 
1837  if (!has_channels) {
1838  ast_log(LOG_ERROR, "ARI Bridge missing required field channels\n");
1839  res = 0;
1840  }
1841 
1842  if (!has_creationtime) {
1843  ast_log(LOG_ERROR, "ARI Bridge missing required field creationtime\n");
1844  res = 0;
1845  }
1846 
1847  if (!has_creator) {
1848  ast_log(LOG_ERROR, "ARI Bridge missing required field creator\n");
1849  res = 0;
1850  }
1851 
1852  if (!has_id) {
1853  ast_log(LOG_ERROR, "ARI Bridge missing required field id\n");
1854  res = 0;
1855  }
1856 
1857  if (!has_name) {
1858  ast_log(LOG_ERROR, "ARI Bridge missing required field name\n");
1859  res = 0;
1860  }
1861 
1862  if (!has_technology) {
1863  ast_log(LOG_ERROR, "ARI Bridge missing required field technology\n");
1864  res = 0;
1865  }
1866 
1867  return res;
1868 }
Iterator for JSON object key/values.
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:429
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
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.
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:437

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 2604 of file ari_model_validators.c.

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().

2605 {
2606  int res = 1;
2607  struct ast_json_iter *iter;
2608  int has_type = 0;
2609  int has_application = 0;
2610  int has_timestamp = 0;
2611  int has_destination_type = 0;
2612  int has_is_external = 0;
2613  int has_result = 0;
2614  int has_transferer_first_leg = 0;
2615  int has_transferer_second_leg = 0;
2616 
2617  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2618  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2619  int prop_is_valid;
2620  prop_is_valid = ast_ari_validate_string(
2622  if (!prop_is_valid) {
2623  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field asterisk_id failed validation\n");
2624  res = 0;
2625  }
2626  } else
2627  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2628  int prop_is_valid;
2629  has_type = 1;
2630  prop_is_valid = ast_ari_validate_string(
2632  if (!prop_is_valid) {
2633  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field type failed validation\n");
2634  res = 0;
2635  }
2636  } else
2637  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2638  int prop_is_valid;
2639  has_application = 1;
2640  prop_is_valid = ast_ari_validate_string(
2642  if (!prop_is_valid) {
2643  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field application failed validation\n");
2644  res = 0;
2645  }
2646  } else
2647  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2648  int prop_is_valid;
2649  has_timestamp = 1;
2650  prop_is_valid = ast_ari_validate_date(
2652  if (!prop_is_valid) {
2653  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field timestamp failed validation\n");
2654  res = 0;
2655  }
2656  } else
2657  if (strcmp("destination_application", ast_json_object_iter_key(iter)) == 0) {
2658  int prop_is_valid;
2659  prop_is_valid = ast_ari_validate_string(
2661  if (!prop_is_valid) {
2662  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_application failed validation\n");
2663  res = 0;
2664  }
2665  } else
2666  if (strcmp("destination_bridge", ast_json_object_iter_key(iter)) == 0) {
2667  int prop_is_valid;
2668  prop_is_valid = ast_ari_validate_string(
2670  if (!prop_is_valid) {
2671  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_bridge failed validation\n");
2672  res = 0;
2673  }
2674  } else
2675  if (strcmp("destination_link_first_leg", ast_json_object_iter_key(iter)) == 0) {
2676  int prop_is_valid;
2677  prop_is_valid = ast_ari_validate_channel(
2679  if (!prop_is_valid) {
2680  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_link_first_leg failed validation\n");
2681  res = 0;
2682  }
2683  } else
2684  if (strcmp("destination_link_second_leg", ast_json_object_iter_key(iter)) == 0) {
2685  int prop_is_valid;
2686  prop_is_valid = ast_ari_validate_channel(
2688  if (!prop_is_valid) {
2689  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_link_second_leg failed validation\n");
2690  res = 0;
2691  }
2692  } else
2693  if (strcmp("destination_threeway_bridge", ast_json_object_iter_key(iter)) == 0) {
2694  int prop_is_valid;
2695  prop_is_valid = ast_ari_validate_bridge(
2697  if (!prop_is_valid) {
2698  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_threeway_bridge failed validation\n");
2699  res = 0;
2700  }
2701  } else
2702  if (strcmp("destination_threeway_channel", ast_json_object_iter_key(iter)) == 0) {
2703  int prop_is_valid;
2704  prop_is_valid = ast_ari_validate_channel(
2706  if (!prop_is_valid) {
2707  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_threeway_channel failed validation\n");
2708  res = 0;
2709  }
2710  } else
2711  if (strcmp("destination_type", ast_json_object_iter_key(iter)) == 0) {
2712  int prop_is_valid;
2713  has_destination_type = 1;
2714  prop_is_valid = ast_ari_validate_string(
2716  if (!prop_is_valid) {
2717  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_type failed validation\n");
2718  res = 0;
2719  }
2720  } else
2721  if (strcmp("is_external", ast_json_object_iter_key(iter)) == 0) {
2722  int prop_is_valid;
2723  has_is_external = 1;
2724  prop_is_valid = ast_ari_validate_boolean(
2726  if (!prop_is_valid) {
2727  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field is_external failed validation\n");
2728  res = 0;
2729  }
2730  } else
2731  if (strcmp("replace_channel", ast_json_object_iter_key(iter)) == 0) {
2732  int prop_is_valid;
2733  prop_is_valid = ast_ari_validate_channel(
2735  if (!prop_is_valid) {
2736  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field replace_channel failed validation\n");
2737  res = 0;
2738  }
2739  } else
2740  if (strcmp("result", ast_json_object_iter_key(iter)) == 0) {
2741  int prop_is_valid;
2742  has_result = 1;
2743  prop_is_valid = ast_ari_validate_string(
2745  if (!prop_is_valid) {
2746  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field result failed validation\n");
2747  res = 0;
2748  }
2749  } else
2750  if (strcmp("transfer_target", ast_json_object_iter_key(iter)) == 0) {
2751  int prop_is_valid;
2752  prop_is_valid = ast_ari_validate_channel(
2754  if (!prop_is_valid) {
2755  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transfer_target failed validation\n");
2756  res = 0;
2757  }
2758  } else
2759  if (strcmp("transferee", ast_json_object_iter_key(iter)) == 0) {
2760  int prop_is_valid;
2761  prop_is_valid = ast_ari_validate_channel(
2763  if (!prop_is_valid) {
2764  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferee failed validation\n");
2765  res = 0;
2766  }
2767  } else
2768  if (strcmp("transferer_first_leg", ast_json_object_iter_key(iter)) == 0) {
2769  int prop_is_valid;
2770  has_transferer_first_leg = 1;
2771  prop_is_valid = ast_ari_validate_channel(
2773  if (!prop_is_valid) {
2774  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_first_leg failed validation\n");
2775  res = 0;
2776  }
2777  } else
2778  if (strcmp("transferer_first_leg_bridge", ast_json_object_iter_key(iter)) == 0) {
2779  int prop_is_valid;
2780  prop_is_valid = ast_ari_validate_bridge(
2782  if (!prop_is_valid) {
2783  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_first_leg_bridge failed validation\n");
2784  res = 0;
2785  }
2786  } else
2787  if (strcmp("transferer_second_leg", ast_json_object_iter_key(iter)) == 0) {
2788  int prop_is_valid;
2789  has_transferer_second_leg = 1;
2790  prop_is_valid = ast_ari_validate_channel(
2792  if (!prop_is_valid) {
2793  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_second_leg failed validation\n");
2794  res = 0;
2795  }
2796  } else
2797  if (strcmp("transferer_second_leg_bridge", ast_json_object_iter_key(iter)) == 0) {
2798  int prop_is_valid;
2799  prop_is_valid = ast_ari_validate_bridge(
2801  if (!prop_is_valid) {
2802  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_second_leg_bridge failed validation\n");
2803  res = 0;
2804  }
2805  } else
2806  {
2808  "ARI BridgeAttendedTransfer has undocumented field %s\n",
2809  ast_json_object_iter_key(iter));
2810  res = 0;
2811  }
2812  }
2813 
2814  if (!has_type) {
2815  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field type\n");
2816  res = 0;
2817  }
2818 
2819  if (!has_application) {
2820  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field application\n");
2821  res = 0;
2822  }
2823 
2824  if (!has_timestamp) {
2825  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field timestamp\n");
2826  res = 0;
2827  }
2828 
2829  if (!has_destination_type) {
2830  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field destination_type\n");
2831  res = 0;
2832  }
2833 
2834  if (!has_is_external) {
2835  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field is_external\n");
2836  res = 0;
2837  }
2838 
2839  if (!has_result) {
2840  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field result\n");
2841  res = 0;
2842  }
2843 
2844  if (!has_transferer_first_leg) {
2845  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field transferer_first_leg\n");
2846  res = 0;
2847  }
2848 
2849  if (!has_transferer_second_leg) {
2850  ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field transferer_second_leg\n");
2851  res = 0;
2852  }
2853 
2854  return res;
2855 }
Iterator for JSON object key/values.
int ast_ari_validate_channel(struct ast_json *json)
Validator for Channel.
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:429
int ast_ari_validate_boolean(struct ast_json *json)
Validator for native Swagger boolean.
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_bridge(struct ast_json *json)
Validator for Bridge.
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ 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().

See ast_ari_model_validators.h for more details.

Definition at line 2857 of file ari_model_validators.c.

References ast_ari_validate_bridge_attended_transfer().

2858 {
2860 }
int ast_ari_validate_bridge_attended_transfer(struct ast_json *json)
Validator for BridgeAttendedTransfer.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 2862 of file ari_model_validators.c.

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().

2863 {
2864  int res = 1;
2865  struct ast_json_iter *iter;
2866  int has_type = 0;
2867  int has_application = 0;
2868  int has_timestamp = 0;
2869  int has_channel = 0;
2870  int has_context = 0;
2871  int has_exten = 0;
2872  int has_is_external = 0;
2873  int has_result = 0;
2874 
2875  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2876  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2877  int prop_is_valid;
2878  prop_is_valid = ast_ari_validate_string(
2880  if (!prop_is_valid) {
2881  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field asterisk_id failed validation\n");
2882  res = 0;
2883  }
2884  } else
2885  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2886  int prop_is_valid;
2887  has_type = 1;
2888  prop_is_valid = ast_ari_validate_string(
2890  if (!prop_is_valid) {
2891  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field type failed validation\n");
2892  res = 0;
2893  }
2894  } else
2895  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2896  int prop_is_valid;
2897  has_application = 1;
2898  prop_is_valid = ast_ari_validate_string(
2900  if (!prop_is_valid) {
2901  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field application failed validation\n");
2902  res = 0;
2903  }
2904  } else
2905  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2906  int prop_is_valid;
2907  has_timestamp = 1;
2908  prop_is_valid = ast_ari_validate_date(
2910  if (!prop_is_valid) {
2911  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field timestamp failed validation\n");
2912  res = 0;
2913  }
2914  } else
2915  if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2916  int prop_is_valid;
2917  prop_is_valid = ast_ari_validate_bridge(
2919  if (!prop_is_valid) {
2920  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field bridge failed validation\n");
2921  res = 0;
2922  }
2923  } else
2924  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2925  int prop_is_valid;
2926  has_channel = 1;
2927  prop_is_valid = ast_ari_validate_channel(
2929  if (!prop_is_valid) {
2930  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field channel failed validation\n");
2931  res = 0;
2932  }
2933  } else
2934  if (strcmp("context", ast_json_object_iter_key(iter)) == 0) {
2935  int prop_is_valid;
2936  has_context = 1;
2937  prop_is_valid = ast_ari_validate_string(
2939  if (!prop_is_valid) {
2940  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field context failed validation\n");
2941  res = 0;
2942  }
2943  } else
2944  if (strcmp("exten", ast_json_object_iter_key(iter)) == 0) {
2945  int prop_is_valid;
2946  has_exten = 1;
2947  prop_is_valid = ast_ari_validate_string(
2949  if (!prop_is_valid) {
2950  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field exten failed validation\n");
2951  res = 0;
2952  }
2953  } else
2954  if (strcmp("is_external", ast_json_object_iter_key(iter)) == 0) {
2955  int prop_is_valid;
2956  has_is_external = 1;
2957  prop_is_valid = ast_ari_validate_boolean(
2959  if (!prop_is_valid) {
2960  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field is_external failed validation\n");
2961  res = 0;
2962  }
2963  } else
2964  if (strcmp("replace_channel", ast_json_object_iter_key(iter)) == 0) {
2965  int prop_is_valid;
2966  prop_is_valid = ast_ari_validate_channel(
2968  if (!prop_is_valid) {
2969  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field replace_channel failed validation\n");
2970  res = 0;
2971  }
2972  } else
2973  if (strcmp("result", ast_json_object_iter_key(iter)) == 0) {
2974  int prop_is_valid;
2975  has_result = 1;
2976  prop_is_valid = ast_ari_validate_string(
2978  if (!prop_is_valid) {
2979  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field result failed validation\n");
2980  res = 0;
2981  }
2982  } else
2983  if (strcmp("transferee", ast_json_object_iter_key(iter)) == 0) {
2984  int prop_is_valid;
2985  prop_is_valid = ast_ari_validate_channel(
2987  if (!prop_is_valid) {
2988  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field transferee failed validation\n");
2989  res = 0;
2990  }
2991  } else
2992  {
2994  "ARI BridgeBlindTransfer has undocumented field %s\n",
2995  ast_json_object_iter_key(iter));
2996  res = 0;
2997  }
2998  }
2999 
3000  if (!has_type) {
3001  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field type\n");
3002  res = 0;
3003  }
3004 
3005  if (!has_application) {
3006  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field application\n");
3007  res = 0;
3008  }
3009 
3010  if (!has_timestamp) {
3011  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field timestamp\n");
3012  res = 0;
3013  }
3014 
3015  if (!has_channel) {
3016  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field channel\n");
3017  res = 0;
3018  }
3019 
3020  if (!has_context) {
3021  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field context\n");
3022  res = 0;
3023  }
3024 
3025  if (!has_exten) {
3026  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field exten\n");
3027  res = 0;
3028  }
3029 
3030  if (!has_is_external) {
3031  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field is_external\n");
3032  res = 0;
3033  }
3034 
3035  if (!has_result) {
3036  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field result\n");
3037  res = 0;
3038  }
3039 
3040  return res;
3041 }
Iterator for JSON object key/values.
int ast_ari_validate_channel(struct ast_json *json)
Validator for Channel.
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:429
int ast_ari_validate_boolean(struct ast_json *json)
Validator for native Swagger boolean.
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_bridge(struct ast_json *json)
Validator for Bridge.
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ 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().

See ast_ari_model_validators.h for more details.

Definition at line 3043 of file ari_model_validators.c.

References ast_ari_validate_bridge_blind_transfer().

3044 {
3046 }
int ast_ari_validate_bridge_blind_transfer(struct ast_json *json)
Validator for BridgeBlindTransfer.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 3048 of file ari_model_validators.c.

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().

3049 {
3050  int res = 1;
3051  struct ast_json_iter *iter;
3052  int has_type = 0;
3053  int has_application = 0;
3054  int has_timestamp = 0;
3055  int has_bridge = 0;
3056 
3057  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3058  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3059  int prop_is_valid;
3060  prop_is_valid = ast_ari_validate_string(
3062  if (!prop_is_valid) {
3063  ast_log(LOG_ERROR, "ARI BridgeCreated field asterisk_id failed validation\n");
3064  res = 0;
3065  }
3066  } else
3067  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3068  int prop_is_valid;
3069  has_type = 1;
3070  prop_is_valid = ast_ari_validate_string(
3072  if (!prop_is_valid) {
3073  ast_log(LOG_ERROR, "ARI BridgeCreated field type failed validation\n");
3074  res = 0;
3075  }
3076  } else
3077  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3078  int prop_is_valid;
3079  has_application = 1;
3080  prop_is_valid = ast_ari_validate_string(
3082  if (!prop_is_valid) {
3083  ast_log(LOG_ERROR, "ARI BridgeCreated field application failed validation\n");
3084  res = 0;
3085  }
3086  } else
3087  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3088  int prop_is_valid;
3089  has_timestamp = 1;
3090  prop_is_valid = ast_ari_validate_date(
3092  if (!prop_is_valid) {
3093  ast_log(LOG_ERROR, "ARI BridgeCreated field timestamp failed validation\n");
3094  res = 0;
3095  }
3096  } else
3097  if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
3098  int prop_is_valid;
3099  has_bridge = 1;
3100  prop_is_valid = ast_ari_validate_bridge(
3102  if (!prop_is_valid) {
3103  ast_log(LOG_ERROR, "ARI BridgeCreated field bridge failed validation\n");
3104  res = 0;
3105  }
3106  } else
3107  {
3109  "ARI BridgeCreated has undocumented field %s\n",
3110  ast_json_object_iter_key(iter));
3111  res = 0;
3112  }
3113  }
3114 
3115  if (!has_type) {
3116  ast_log(LOG_ERROR, "ARI BridgeCreated missing required field type\n");
3117  res = 0;
3118  }
3119 
3120  if (!has_application) {
3121  ast_log(LOG_ERROR, "ARI BridgeCreated missing required field application\n");
3122  res = 0;
3123  }
3124 
3125  if (!has_timestamp) {
3126  ast_log(LOG_ERROR, "ARI BridgeCreated missing required field timestamp\n");
3127  res = 0;
3128  }
3129 
3130  if (!has_bridge) {
3131  ast_log(LOG_ERROR, "ARI BridgeCreated missing required field bridge\n");
3132  res = 0;
3133  }
3134 
3135  return res;
3136 }
Iterator for JSON object key/values.
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:429
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_bridge(struct ast_json *json)
Validator for Bridge.
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ ast_ari_validate_bridge_created_fn()

ari_validator ast_ari_validate_bridge_created_fn ( void  )

Function pointer to ast_ari_validate_bridge_created().

See ast_ari_model_validators.h for more details.

Definition at line 3138 of file ari_model_validators.c.

References ast_ari_validate_bridge_created().

3139 {
3141 }
int ast_ari_validate_bridge_created(struct ast_json *json)
Validator for BridgeCreated.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 3143 of file ari_model_validators.c.

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().

3144 {
3145  int res = 1;
3146  struct ast_json_iter *iter;
3147  int has_type = 0;
3148  int has_application = 0;
3149  int has_timestamp = 0;
3150  int has_bridge = 0;
3151 
3152  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3153  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3154  int prop_is_valid;
3155  prop_is_valid = ast_ari_validate_string(
3157  if (!prop_is_valid) {
3158  ast_log(LOG_ERROR, "ARI BridgeDestroyed field asterisk_id failed validation\n");
3159  res = 0;
3160  }
3161  } else
3162  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3163  int prop_is_valid;
3164  has_type = 1;
3165  prop_is_valid = ast_ari_validate_string(
3167  if (!prop_is_valid) {
3168  ast_log(LOG_ERROR, "ARI BridgeDestroyed field type failed validation\n");
3169  res = 0;
3170  }
3171  } else
3172  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3173  int prop_is_valid;
3174  has_application = 1;
3175  prop_is_valid = ast_ari_validate_string(
3177  if (!prop_is_valid) {
3178  ast_log(LOG_ERROR, "ARI BridgeDestroyed field application failed validation\n");
3179  res = 0;
3180  }
3181  } else
3182  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3183  int prop_is_valid;
3184  has_timestamp = 1;
3185  prop_is_valid = ast_ari_validate_date(
3187  if (!prop_is_valid) {
3188  ast_log(LOG_ERROR, "ARI BridgeDestroyed field timestamp failed validation\n");
3189  res = 0;
3190  }
3191  } else
3192  if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
3193  int prop_is_valid;
3194  has_bridge = 1;
3195  prop_is_valid = ast_ari_validate_bridge(
3197  if (!prop_is_valid) {
3198  ast_log(LOG_ERROR, "ARI BridgeDestroyed field bridge failed validation\n");
3199  res = 0;
3200  }
3201  } else
3202  {
3204  "ARI BridgeDestroyed has undocumented field %s\n",
3205  ast_json_object_iter_key(iter));
3206  res = 0;
3207  }
3208  }
3209 
3210  if (!has_type) {
3211  ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field type\n");
3212  res = 0;
3213  }
3214 
3215  if (!has_application) {
3216  ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field application\n");
3217  res = 0;
3218  }
3219 
3220  if (!has_timestamp) {
3221  ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field timestamp\n");
3222  res = 0;
3223  }
3224 
3225  if (!has_bridge) {
3226  ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field bridge\n");
3227  res = 0;
3228  }
3229 
3230  return res;
3231 }
Iterator for JSON object key/values.
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:429
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_bridge(struct ast_json *json)
Validator for Bridge.
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ ast_ari_validate_bridge_destroyed_fn()

ari_validator ast_ari_validate_bridge_destroyed_fn ( void  )

Function pointer to ast_ari_validate_bridge_destroyed().

See ast_ari_model_validators.h for more details.

Definition at line 3233 of file ari_model_validators.c.

References ast_ari_validate_bridge_destroyed().

3234 {
3236 }
int ast_ari_validate_bridge_destroyed(struct ast_json *json)
Validator for BridgeDestroyed.

◆ ast_ari_validate_bridge_fn()

ari_validator ast_ari_validate_bridge_fn ( void  )

Function pointer to ast_ari_validate_bridge().

See ast_ari_model_validators.h for more details.

Definition at line 1870 of file ari_model_validators.c.

References ast_ari_validate_bridge().

Referenced by ast_ari_bridges_list_cb().

1871 {
1872  return ast_ari_validate_bridge;
1873 }
int ast_ari_validate_bridge(struct ast_json *json)
Validator for Bridge.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 3238 of file ari_model_validators.c.

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().

3239 {
3240  int res = 1;
3241  struct ast_json_iter *iter;
3242  int has_type = 0;
3243  int has_application = 0;
3244  int has_timestamp = 0;
3245  int has_bridge = 0;
3246  int has_bridge_from = 0;
3247 
3248  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3249  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3250  int prop_is_valid;
3251  prop_is_valid = ast_ari_validate_string(
3253  if (!prop_is_valid) {
3254  ast_log(LOG_ERROR, "ARI BridgeMerged field asterisk_id failed validation\n");
3255  res = 0;
3256  }
3257  } else
3258  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3259  int prop_is_valid;
3260  has_type = 1;
3261  prop_is_valid = ast_ari_validate_string(
3263  if (!prop_is_valid) {
3264  ast_log(LOG_ERROR, "ARI BridgeMerged field type failed validation\n");
3265  res = 0;
3266  }
3267  } else
3268  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3269  int prop_is_valid;
3270  has_application = 1;
3271  prop_is_valid = ast_ari_validate_string(
3273  if (!prop_is_valid) {
3274  ast_log(LOG_ERROR, "ARI BridgeMerged field application failed validation\n");
3275  res = 0;
3276  }
3277  } else
3278  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3279  int prop_is_valid;
3280  has_timestamp = 1;
3281  prop_is_valid = ast_ari_validate_date(
3283  if (!prop_is_valid) {
3284  ast_log(LOG_ERROR, "ARI BridgeMerged field timestamp failed validation\n");
3285  res = 0;
3286  }
3287  } else
3288  if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
3289  int prop_is_valid;
3290  has_bridge = 1;
3291  prop_is_valid = ast_ari_validate_bridge(
3293  if (!prop_is_valid) {
3294  ast_log(LOG_ERROR, "ARI BridgeMerged field bridge failed validation\n");
3295  res = 0;
3296  }
3297  } else
3298  if (strcmp("bridge_from", ast_json_object_iter_key(iter)) == 0) {
3299  int prop_is_valid;
3300  has_bridge_from = 1;
3301  prop_is_valid = ast_ari_validate_bridge(
3303  if (!prop_is_valid) {
3304  ast_log(LOG_ERROR, "ARI BridgeMerged field bridge_from failed validation\n");
3305  res = 0;
3306  }
3307  } else
3308  {
3310  "ARI BridgeMerged has undocumented field %s\n",
3311  ast_json_object_iter_key(iter));
3312  res = 0;
3313  }
3314  }
3315 
3316  if (!has_type) {
3317  ast_log(LOG_ERROR, "ARI BridgeMerged missing required field type\n");
3318  res = 0;
3319  }
3320 
3321  if (!has_application) {
3322  ast_log(LOG_ERROR, "ARI BridgeMerged missing required field application\n");
3323  res = 0;
3324  }
3325 
3326  if (!has_timestamp) {
3327  ast_log(LOG_ERROR, "ARI BridgeMerged missing required field timestamp\n");
3328  res = 0;
3329  }
3330 
3331  if (!has_bridge) {
3332  ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge\n");
3333  res = 0;
3334  }
3335 
3336  if (!has_bridge_from) {
3337  ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge_from\n");
3338  res = 0;
3339  }
3340 
3341  return res;
3342 }
Iterator for JSON object key/values.
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:429
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_bridge(struct ast_json *json)
Validator for Bridge.
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ ast_ari_validate_bridge_merged_fn()

ari_validator ast_ari_validate_bridge_merged_fn ( void  )

Function pointer to ast_ari_validate_bridge_merged().

See ast_ari_model_validators.h for more details.

Definition at line 3344 of file ari_model_validators.c.

References ast_ari_validate_bridge_merged().

3345 {
3347 }
int ast_ari_validate_bridge_merged(struct ast_json *json)
Validator for BridgeMerged.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 3349 of file ari_model_validators.c.

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().

3350 {
3351  int res = 1;
3352  struct ast_json_iter *iter;
3353  int has_type = 0;
3354  int has_application = 0;
3355  int has_timestamp = 0;
3356  int has_bridge = 0;
3357 
3358  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3359  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3360  int prop_is_valid;
3361  prop_is_valid = ast_ari_validate_string(
3363  if (!prop_is_valid) {
3364  ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field asterisk_id failed validation\n");
3365  res = 0;
3366  }
3367  } else
3368  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3369  int prop_is_valid;
3370  has_type = 1;
3371  prop_is_valid = ast_ari_validate_string(
3373  if (!prop_is_valid) {
3374  ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field type failed validation\n");
3375  res = 0;
3376  }
3377  } else
3378  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3379  int prop_is_valid;
3380  has_application = 1;
3381  prop_is_valid = ast_ari_validate_string(
3383  if (!prop_is_valid) {
3384  ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field application failed validation\n");
3385  res = 0;
3386  }
3387  } else
3388  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3389  int prop_is_valid;
3390  has_timestamp = 1;
3391  prop_is_valid = ast_ari_validate_date(
3393  if (!prop_is_valid) {
3394  ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field timestamp failed validation\n");
3395  res = 0;
3396  }
3397  } else
3398  if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
3399  int prop_is_valid;
3400  has_bridge = 1;
3401  prop_is_valid = ast_ari_validate_bridge(
3403  if (!prop_is_valid) {
3404  ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field bridge failed validation\n");
3405  res = 0;
3406  }
3407  } else
3408  if (strcmp("old_video_source_id", ast_json_object_iter_key(iter)) == 0) {
3409  int prop_is_valid;
3410  prop_is_valid = ast_ari_validate_string(
3412  if (!prop_is_valid) {
3413  ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field old_video_source_id failed validation\n");
3414  res = 0;
3415  }
3416  } else
3417  {
3419  "ARI BridgeVideoSourceChanged has undocumented field %s\n",
3420  ast_json_object_iter_key(iter));
3421  res = 0;
3422  }
3423  }
3424 
3425  if (!has_type) {
3426  ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged missing required field type\n");
3427  res = 0;
3428  }
3429 
3430  if (!has_application) {
3431  ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged missing required field application\n");
3432  res = 0;
3433  }
3434 
3435  if (!has_timestamp) {
3436  ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged missing required field timestamp\n");
3437  res = 0;
3438  }
3439 
3440  if (!has_bridge) {
3441  ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged missing required field bridge\n");
3442  res = 0;
3443  }
3444 
3445  return res;
3446 }
Iterator for JSON object key/values.
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:429
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_bridge(struct ast_json *json)
Validator for Bridge.
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ 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().

See ast_ari_model_validators.h for more details.

Definition at line 3448 of file ari_model_validators.c.

References ast_ari_validate_bridge_video_source_changed().

3449 {
3451 }
int ast_ari_validate_bridge_video_source_changed(struct ast_json *json)
Validator for BridgeVideoSourceChanged.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 164 of file ari_model_validators.c.

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().

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 }
Iterator for JSON object key/values.
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:429
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ ast_ari_validate_build_info_fn()

ari_validator ast_ari_validate_build_info_fn ( void  )

Function pointer to ast_ari_validate_build_info().

See ast_ari_model_validators.h for more details.

Definition at line 277 of file ari_model_validators.c.

References ast_ari_validate_build_info().

278 {
280 }
int ast_ari_validate_build_info(struct ast_json *json)
Validator for BuildInfo.

◆ ast_ari_validate_byte()

int ast_ari_validate_byte ( struct ast_json json)

Validator for native Swagger byte.

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

Definition at line 101 of file res_ari_model.c.

References check_range().

Referenced by AST_TEST_DEFINE().

102 {
103  /* Java bytes are signed, which accounts for great fun for all */
104  return check_range(-128, 255, json);
105 }
static int check_range(intmax_t minval, intmax_t maxval, struct ast_json *json)
Definition: res_ari_model.c:74

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 980 of file ari_model_validators.c.

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().

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",
1011  ast_json_object_iter_key(iter));
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 }
Iterator for JSON object key/values.
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:429
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ ast_ari_validate_caller_id_fn()

ari_validator ast_ari_validate_caller_id_fn ( void  )

Function pointer to ast_ari_validate_caller_id().

See ast_ari_model_validators.h for more details.

Definition at line 1029 of file ari_model_validators.c.

References ast_ari_validate_caller_id().

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

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 1034 of file ari_model_validators.c.

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_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().

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_state = 0;
1047 
1048  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1049  if (strcmp("accountcode", ast_json_object_iter_key(iter)) == 0) {
1050  int prop_is_valid;
1051  has_accountcode = 1;
1052  prop_is_valid = ast_ari_validate_string(
1054  if (!prop_is_valid) {
1055  ast_log(LOG_ERROR, "ARI Channel field accountcode failed validation\n");
1056  res = 0;
1057  }
1058  } else
1059  if (strcmp("caller", ast_json_object_iter_key(iter)) == 0) {
1060  int prop_is_valid;
1061  has_caller = 1;
1062  prop_is_valid = ast_ari_validate_caller_id(
1064  if (!prop_is_valid) {
1065  ast_log(LOG_ERROR, "ARI Channel field caller failed validation\n");
1066  res = 0;
1067  }
1068  } else
1069  if (strcmp("channelvars", ast_json_object_iter_key(iter)) == 0) {
1070  int prop_is_valid;
1071  prop_is_valid = ast_ari_validate_object(
1073  if (!prop_is_valid) {
1074  ast_log(LOG_ERROR, "ARI Channel field channelvars failed validation\n");
1075  res = 0;
1076  }
1077  } else
1078  if (strcmp("connected", ast_json_object_iter_key(iter)) == 0) {
1079  int prop_is_valid;
1080  has_connected = 1;
1081  prop_is_valid = ast_ari_validate_caller_id(
1083  if (!prop_is_valid) {
1084  ast_log(LOG_ERROR, "ARI Channel field connected failed validation\n");
1085  res = 0;
1086  }
1087  } else
1088  if (strcmp("creationtime", ast_json_object_iter_key(iter)) == 0) {
1089  int prop_is_valid;
1090  has_creationtime = 1;
1091  prop_is_valid = ast_ari_validate_date(
1093  if (!prop_is_valid) {
1094  ast_log(LOG_ERROR, "ARI Channel field creationtime failed validation\n");
1095  res = 0;
1096  }
1097  } else
1098  if (strcmp("dialplan", ast_json_object_iter_key(iter)) == 0) {
1099  int prop_is_valid;
1100  has_dialplan = 1;
1101  prop_is_valid = ast_ari_validate_dialplan_cep(
1103  if (!prop_is_valid) {
1104  ast_log(LOG_ERROR, "ARI Channel field dialplan failed validation\n");
1105  res = 0;
1106  }
1107  } else
1108  if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
1109  int prop_is_valid;
1110  has_id = 1;
1111  prop_is_valid = ast_ari_validate_string(
1113  if (!prop_is_valid) {
1114  ast_log(LOG_ERROR, "ARI Channel field id failed validation\n");
1115  res = 0;
1116  }
1117  } else
1118  if (strcmp("language", ast_json_object_iter_key(iter)) == 0) {
1119  int prop_is_valid;
1120  has_language = 1;
1121  prop_is_valid = ast_ari_validate_string(
1123  if (!prop_is_valid) {
1124  ast_log(LOG_ERROR, "ARI Channel field language failed validation\n");
1125  res = 0;
1126  }
1127  } else
1128  if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1129  int prop_is_valid;
1130  has_name = 1;
1131  prop_is_valid = ast_ari_validate_string(
1133  if (!prop_is_valid) {
1134  ast_log(LOG_ERROR, "ARI Channel field name failed validation\n");
1135  res = 0;
1136  }
1137  } else
1138  if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
1139  int prop_is_valid;
1140  has_state = 1;
1141  prop_is_valid = ast_ari_validate_string(
1143  if (!prop_is_valid) {
1144  ast_log(LOG_ERROR, "ARI Channel field state failed validation\n");
1145  res = 0;
1146  }
1147  } else
1148  {
1150  "ARI Channel has undocumented field %s\n",
1151  ast_json_object_iter_key(iter));
1152  res = 0;
1153  }
1154  }
1155 
1156  if (!has_accountcode) {
1157  ast_log(LOG_ERROR, "ARI Channel missing required field accountcode\n");
1158  res = 0;
1159  }
1160 
1161  if (!has_caller) {
1162  ast_log(LOG_ERROR, "ARI Channel missing required field caller\n");
1163  res = 0;
1164  }
1165 
1166  if (!has_connected) {
1167  ast_log(LOG_ERROR, "ARI Channel missing required field connected\n");
1168  res = 0;
1169  }
1170 
1171  if (!has_creationtime) {
1172  ast_log(LOG_ERROR, "ARI Channel missing required field creationtime\n");
1173  res = 0;
1174  }
1175 
1176  if (!has_dialplan) {
1177  ast_log(LOG_ERROR, "ARI Channel missing required field dialplan\n");
1178  res = 0;
1179  }
1180 
1181  if (!has_id) {
1182  ast_log(LOG_ERROR, "ARI Channel missing required field id\n");
1183  res = 0;
1184  }
1185 
1186  if (!has_language) {
1187  ast_log(LOG_ERROR, "ARI Channel missing required field language\n");
1188  res = 0;
1189  }
1190 
1191  if (!has_name) {
1192  ast_log(LOG_ERROR, "ARI Channel missing required field name\n");
1193  res = 0;
1194  }
1195 
1196  if (!has_state) {
1197  ast_log(LOG_ERROR, "ARI Channel missing required field state\n");
1198  res = 0;
1199  }
1200 
1201  return res;
1202 }
Iterator for JSON object key/values.
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:429
int ast_ari_validate_caller_id(struct ast_json *json)
Validator for CallerID.
int ast_ari_validate_dialplan_cep(struct ast_json *json)
Validator for DialplanCEP.
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
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.
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:437

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 3453 of file ari_model_validators.c.

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().

3454 {
3455  int res = 1;
3456  struct ast_json_iter *iter;
3457  int has_type = 0;
3458  int has_application = 0;
3459  int has_timestamp = 0;
3460  int has_caller_presentation = 0;
3461  int has_caller_presentation_txt = 0;
3462  int has_channel = 0;
3463 
3464  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3465  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3466  int prop_is_valid;
3467  prop_is_valid = ast_ari_validate_string(
3469  if (!prop_is_valid) {
3470  ast_log(LOG_ERROR, "ARI ChannelCallerId field asterisk_id failed validation\n");
3471  res = 0;
3472  }
3473  } else
3474  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3475  int prop_is_valid;
3476  has_type = 1;
3477  prop_is_valid = ast_ari_validate_string(
3479  if (!prop_is_valid) {
3480  ast_log(LOG_ERROR, "ARI ChannelCallerId field type failed validation\n");
3481  res = 0;
3482  }
3483  } else
3484  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3485  int prop_is_valid;
3486  has_application = 1;
3487  prop_is_valid = ast_ari_validate_string(
3489  if (!prop_is_valid) {
3490  ast_log(LOG_ERROR, "ARI ChannelCallerId field application failed validation\n");
3491  res = 0;
3492  }
3493  } else
3494  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3495  int prop_is_valid;
3496  has_timestamp = 1;
3497  prop_is_valid = ast_ari_validate_date(
3499  if (!prop_is_valid) {
3500  ast_log(LOG_ERROR, "ARI ChannelCallerId field timestamp failed validation\n");
3501  res = 0;
3502  }
3503  } else
3504  if (strcmp("caller_presentation", ast_json_object_iter_key(iter)) == 0) {
3505  int prop_is_valid;
3506  has_caller_presentation = 1;
3507  prop_is_valid = ast_ari_validate_int(
3509  if (!prop_is_valid) {
3510  ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation failed validation\n");
3511  res = 0;
3512  }
3513  } else
3514  if (strcmp("caller_presentation_txt", ast_json_object_iter_key(iter)) == 0) {
3515  int prop_is_valid;
3516  has_caller_presentation_txt = 1;
3517  prop_is_valid = ast_ari_validate_string(
3519  if (!prop_is_valid) {
3520  ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation_txt failed validation\n");
3521  res = 0;
3522  }
3523  } else
3524  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
3525  int prop_is_valid;
3526  has_channel = 1;
3527  prop_is_valid = ast_ari_validate_channel(
3529  if (!prop_is_valid) {
3530  ast_log(LOG_ERROR, "ARI ChannelCallerId field channel failed validation\n");
3531  res = 0;
3532  }
3533  } else
3534  {
3536  "ARI ChannelCallerId has undocumented field %s\n",
3537  ast_json_object_iter_key(iter));
3538  res = 0;
3539  }
3540  }
3541 
3542  if (!has_type) {
3543  ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field type\n");
3544  res = 0;
3545  }
3546 
3547  if (!has_application) {
3548  ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field application\n");
3549  res = 0;
3550  }
3551 
3552  if (!has_timestamp) {
3553  ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field timestamp\n");
3554  res = 0;
3555  }
3556 
3557  if (!has_caller_presentation) {
3558  ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation\n");
3559  res = 0;
3560  }
3561 
3562  if (!has_caller_presentation_txt) {
3563  ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation_txt\n");
3564  res = 0;
3565  }
3566 
3567  if (!has_channel) {
3568  ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field channel\n");
3569  res = 0;
3570  }
3571 
3572  return res;
3573 }
Iterator for JSON object key/values.
int ast_ari_validate_channel(struct ast_json *json)
Validator for Channel.
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:429
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_int(struct ast_json *json)
Validator for native Swagger int.
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ 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().

See ast_ari_model_validators.h for more details.

Definition at line 3575 of file ari_model_validators.c.

References ast_ari_validate_channel_caller_id().

3576 {
3578 }
int ast_ari_validate_channel_caller_id(struct ast_json *json)
Validator for ChannelCallerId.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 3580 of file ari_model_validators.c.

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().

3581 {
3582  int res = 1;
3583  struct ast_json_iter *iter;
3584  int has_type = 0;
3585  int has_application = 0;
3586  int has_timestamp = 0;
3587  int has_channel = 0;
3588 
3589  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3590  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3591  int prop_is_valid;
3592  prop_is_valid = ast_ari_validate_string(
3594  if (!prop_is_valid) {
3595  ast_log(LOG_ERROR, "ARI ChannelConnectedLine field asterisk_id failed validation\n");
3596  res = 0;
3597  }
3598  } else
3599  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3600  int prop_is_valid;
3601  has_type = 1;
3602  prop_is_valid = ast_ari_validate_string(
3604  if (!prop_is_valid) {
3605  ast_log(LOG_ERROR, "ARI ChannelConnectedLine field type failed validation\n");
3606  res = 0;
3607  }
3608  } else
3609  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3610  int prop_is_valid;
3611  has_application = 1;
3612  prop_is_valid = ast_ari_validate_string(
3614  if (!prop_is_valid) {
3615  ast_log(LOG_ERROR, "ARI ChannelConnectedLine field application failed validation\n");
3616  res = 0;
3617  }
3618  } else
3619  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3620  int prop_is_valid;
3621  has_timestamp = 1;
3622  prop_is_valid = ast_ari_validate_date(
3624  if (!prop_is_valid) {
3625  ast_log(LOG_ERROR, "ARI ChannelConnectedLine field timestamp failed validation\n");
3626  res = 0;
3627  }
3628  } else
3629  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
3630  int prop_is_valid;
3631  has_channel = 1;
3632  prop_is_valid = ast_ari_validate_channel(
3634  if (!prop_is_valid) {
3635  ast_log(LOG_ERROR, "ARI ChannelConnectedLine field channel failed validation\n");
3636  res = 0;
3637  }
3638  } else
3639  {
3641  "ARI ChannelConnectedLine has undocumented field %s\n",
3642  ast_json_object_iter_key(iter));
3643  res = 0;
3644  }
3645  }
3646 
3647  if (!has_type) {
3648  ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field type\n");
3649  res = 0;
3650  }
3651 
3652  if (!has_application) {
3653  ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field application\n");
3654  res = 0;
3655  }
3656 
3657  if (!has_timestamp) {
3658  ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field timestamp\n");
3659  res = 0;
3660  }
3661 
3662  if (!has_channel) {
3663  ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field channel\n");
3664  res = 0;
3665  }
3666 
3667  return res;
3668 }
Iterator for JSON object key/values.
int ast_ari_validate_channel(struct ast_json *json)
Validator for Channel.
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:429
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ 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().

See ast_ari_model_validators.h for more details.

Definition at line 3670 of file ari_model_validators.c.

References ast_ari_validate_channel_connected_line().

3671 {
3673 }
int ast_ari_validate_channel_connected_line(struct ast_json *json)
Validator for ChannelConnectedLine.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 3675 of file ari_model_validators.c.

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().

3676 {
3677  int res = 1;
3678  struct ast_json_iter *iter;
3679  int has_type = 0;
3680  int has_application = 0;
3681  int has_timestamp = 0;
3682  int has_channel = 0;
3683 
3684  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3685  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3686  int prop_is_valid;
3687  prop_is_valid = ast_ari_validate_string(
3689  if (!prop_is_valid) {
3690  ast_log(LOG_ERROR, "ARI ChannelCreated field asterisk_id failed validation\n");
3691  res = 0;
3692  }
3693  } else
3694  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3695  int prop_is_valid;
3696  has_type = 1;
3697  prop_is_valid = ast_ari_validate_string(
3699  if (!prop_is_valid) {
3700  ast_log(LOG_ERROR, "ARI ChannelCreated field type failed validation\n");
3701  res = 0;
3702  }
3703  } else
3704  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3705  int prop_is_valid;
3706  has_application = 1;
3707  prop_is_valid = ast_ari_validate_string(
3709  if (!prop_is_valid) {
3710  ast_log(LOG_ERROR, "ARI ChannelCreated field application failed validation\n");
3711  res = 0;
3712  }
3713  } else
3714  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3715  int prop_is_valid;
3716  has_timestamp = 1;
3717  prop_is_valid = ast_ari_validate_date(
3719  if (!prop_is_valid) {
3720  ast_log(LOG_ERROR, "ARI ChannelCreated field timestamp failed validation\n");
3721  res = 0;
3722  }
3723  } else
3724  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
3725  int prop_is_valid;
3726  has_channel = 1;
3727  prop_is_valid = ast_ari_validate_channel(
3729  if (!prop_is_valid) {
3730  ast_log(LOG_ERROR, "ARI ChannelCreated field channel failed validation\n");
3731  res = 0;
3732  }
3733  } else
3734  {
3736  "ARI ChannelCreated has undocumented field %s\n",
3737  ast_json_object_iter_key(iter));
3738  res = 0;
3739  }
3740  }
3741 
3742  if (!has_type) {
3743  ast_log(LOG_ERROR, "ARI ChannelCreated missing required field type\n");
3744  res = 0;
3745  }
3746 
3747  if (!has_application) {
3748  ast_log(LOG_ERROR, "ARI ChannelCreated missing required field application\n");
3749  res = 0;
3750  }
3751 
3752  if (!has_timestamp) {
3753  ast_log(LOG_ERROR, "ARI ChannelCreated missing required field timestamp\n");
3754  res = 0;
3755  }
3756 
3757  if (!has_channel) {
3758  ast_log(LOG_ERROR, "ARI ChannelCreated missing required field channel\n");
3759  res = 0;
3760  }
3761 
3762  return res;
3763 }
Iterator for JSON object key/values.
int ast_ari_validate_channel(struct ast_json *json)
Validator for Channel.
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:429
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ ast_ari_validate_channel_created_fn()

ari_validator ast_ari_validate_channel_created_fn ( void  )

Function pointer to ast_ari_validate_channel_created().

See ast_ari_model_validators.h for more details.

Definition at line 3765 of file ari_model_validators.c.

References ast_ari_validate_channel_created().

3766 {
3768 }
int ast_ari_validate_channel_created(struct ast_json *json)
Validator for ChannelCreated.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 3770 of file ari_model_validators.c.

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().

3771 {
3772  int res = 1;
3773  struct ast_json_iter *iter;
3774  int has_type = 0;
3775  int has_application = 0;
3776  int has_timestamp = 0;
3777  int has_cause = 0;
3778  int has_cause_txt = 0;
3779  int has_channel = 0;
3780 
3781  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3782  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3783  int prop_is_valid;
3784  prop_is_valid = ast_ari_validate_string(
3786  if (!prop_is_valid) {
3787  ast_log(LOG_ERROR, "ARI ChannelDestroyed field asterisk_id failed validation\n");
3788  res = 0;
3789  }
3790  } else
3791  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3792  int prop_is_valid;
3793  has_type = 1;
3794  prop_is_valid = ast_ari_validate_string(
3796  if (!prop_is_valid) {
3797  ast_log(LOG_ERROR, "ARI ChannelDestroyed field type failed validation\n");
3798  res = 0;
3799  }
3800  } else
3801  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3802  int prop_is_valid;
3803  has_application = 1;
3804  prop_is_valid = ast_ari_validate_string(
3806  if (!prop_is_valid) {
3807  ast_log(LOG_ERROR, "ARI ChannelDestroyed field application failed validation\n");
3808  res = 0;
3809  }
3810  } else
3811  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3812  int prop_is_valid;
3813  has_timestamp = 1;
3814  prop_is_valid = ast_ari_validate_date(
3816  if (!prop_is_valid) {
3817  ast_log(LOG_ERROR, "ARI ChannelDestroyed field timestamp failed validation\n");
3818  res = 0;
3819  }
3820  } else
3821  if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
3822  int prop_is_valid;
3823  has_cause = 1;
3824  prop_is_valid = ast_ari_validate_int(
3826  if (!prop_is_valid) {
3827  ast_log(LOG_ERROR, "ARI ChannelDestroyed field cause failed validation\n");
3828  res = 0;
3829  }
3830  } else
3831  if (strcmp("cause_txt", ast_json_object_iter_key(iter)) == 0) {
3832  int prop_is_valid;
3833  has_cause_txt = 1;
3834  prop_is_valid = ast_ari_validate_string(
3836  if (!prop_is_valid) {
3837  ast_log(LOG_ERROR, "ARI ChannelDestroyed field cause_txt failed validation\n");
3838  res = 0;
3839  }
3840  } else
3841  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
3842  int prop_is_valid;
3843  has_channel = 1;
3844  prop_is_valid = ast_ari_validate_channel(
3846  if (!prop_is_valid) {
3847  ast_log(LOG_ERROR, "ARI ChannelDestroyed field channel failed validation\n");
3848  res = 0;
3849  }
3850  } else
3851  {
3853  "ARI ChannelDestroyed has undocumented field %s\n",
3854  ast_json_object_iter_key(iter));
3855  res = 0;
3856  }
3857  }
3858 
3859  if (!has_type) {
3860  ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field type\n");
3861  res = 0;
3862  }
3863 
3864  if (!has_application) {
3865  ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field application\n");
3866  res = 0;
3867  }
3868 
3869  if (!has_timestamp) {
3870  ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field timestamp\n");
3871  res = 0;
3872  }
3873 
3874  if (!has_cause) {
3875  ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field cause\n");
3876  res = 0;
3877  }
3878 
3879  if (!has_cause_txt) {
3880  ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field cause_txt\n");
3881  res = 0;
3882  }
3883 
3884  if (!has_channel) {
3885  ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field channel\n");
3886  res = 0;
3887  }
3888 
3889  return res;
3890 }
Iterator for JSON object key/values.
int ast_ari_validate_channel(struct ast_json *json)
Validator for Channel.
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:429
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_int(struct ast_json *json)
Validator for native Swagger int.
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ ast_ari_validate_channel_destroyed_fn()

ari_validator ast_ari_validate_channel_destroyed_fn ( void  )

Function pointer to ast_ari_validate_channel_destroyed().

See ast_ari_model_validators.h for more details.

Definition at line 3892 of file ari_model_validators.c.

References ast_ari_validate_channel_destroyed().

3893 {
3895 }
int ast_ari_validate_channel_destroyed(struct ast_json *json)
Validator for ChannelDestroyed.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 3897 of file ari_model_validators.c.

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().

3898 {
3899  int res = 1;
3900  struct ast_json_iter *iter;
3901  int has_type = 0;
3902  int has_application = 0;
3903  int has_timestamp = 0;
3904  int has_channel = 0;
3905  int has_dialplan_app = 0;
3906  int has_dialplan_app_data = 0;
3907 
3908  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3909  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3910  int prop_is_valid;
3911  prop_is_valid = ast_ari_validate_string(
3913  if (!prop_is_valid) {
3914  ast_log(LOG_ERROR, "ARI ChannelDialplan field asterisk_id failed validation\n");
3915  res = 0;
3916  }
3917  } else
3918  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3919  int prop_is_valid;
3920  has_type = 1;
3921  prop_is_valid = ast_ari_validate_string(
3923  if (!prop_is_valid) {
3924  ast_log(LOG_ERROR, "ARI ChannelDialplan field type failed validation\n");
3925  res = 0;
3926  }
3927  } else
3928  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3929  int prop_is_valid;
3930  has_application = 1;
3931  prop_is_valid = ast_ari_validate_string(
3933  if (!prop_is_valid) {
3934  ast_log(LOG_ERROR, "ARI ChannelDialplan field application failed validation\n");
3935  res = 0;
3936  }
3937  } else
3938  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3939  int prop_is_valid;
3940  has_timestamp = 1;
3941  prop_is_valid = ast_ari_validate_date(
3943  if (!prop_is_valid) {
3944  ast_log(LOG_ERROR, "ARI ChannelDialplan field timestamp failed validation\n");
3945  res = 0;
3946  }
3947  } else
3948  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
3949  int prop_is_valid;
3950  has_channel = 1;
3951  prop_is_valid = ast_ari_validate_channel(
3953  if (!prop_is_valid) {
3954  ast_log(LOG_ERROR, "ARI ChannelDialplan field channel failed validation\n");
3955  res = 0;
3956  }
3957  } else
3958  if (strcmp("dialplan_app", ast_json_object_iter_key(iter)) == 0) {
3959  int prop_is_valid;
3960  has_dialplan_app = 1;
3961  prop_is_valid = ast_ari_validate_string(
3963  if (!prop_is_valid) {
3964  ast_log(LOG_ERROR, "ARI ChannelDialplan field dialplan_app failed validation\n");
3965  res = 0;
3966  }
3967  } else
3968  if (strcmp("dialplan_app_data", ast_json_object_iter_key(iter)) == 0) {
3969  int prop_is_valid;
3970  has_dialplan_app_data = 1;
3971  prop_is_valid = ast_ari_validate_string(
3973  if (!prop_is_valid) {
3974  ast_log(LOG_ERROR, "ARI ChannelDialplan field dialplan_app_data failed validation\n");
3975  res = 0;
3976  }
3977  } else
3978  {
3980  "ARI ChannelDialplan has undocumented field %s\n",
3981  ast_json_object_iter_key(iter));
3982  res = 0;
3983  }
3984  }
3985 
3986  if (!has_type) {
3987  ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field type\n");
3988  res = 0;
3989  }
3990 
3991  if (!has_application) {
3992  ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field application\n");
3993  res = 0;
3994  }
3995 
3996  if (!has_timestamp) {
3997  ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field timestamp\n");
3998  res = 0;
3999  }
4000 
4001  if (!has_channel) {
4002  ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field channel\n");
4003  res = 0;
4004  }
4005 
4006  if (!has_dialplan_app) {
4007  ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field dialplan_app\n");
4008  res = 0;
4009  }
4010 
4011  if (!has_dialplan_app_data) {
4012  ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field dialplan_app_data\n");
4013  res = 0;
4014  }
4015 
4016  return res;
4017 }
Iterator for JSON object key/values.
int ast_ari_validate_channel(struct ast_json *json)
Validator for Channel.
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:429
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ ast_ari_validate_channel_dialplan_fn()

ari_validator ast_ari_validate_channel_dialplan_fn ( void  )

Function pointer to ast_ari_validate_channel_dialplan().

See ast_ari_model_validators.h for more details.

Definition at line 4019 of file ari_model_validators.c.

References ast_ari_validate_channel_dialplan().

4020 {
4022 }
int ast_ari_validate_channel_dialplan(struct ast_json *json)
Validator for ChannelDialplan.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 4024 of file ari_model_validators.c.

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().

4025 {
4026  int res = 1;
4027  struct ast_json_iter *iter;
4028  int has_type = 0;
4029  int has_application = 0;
4030  int has_timestamp = 0;
4031  int has_channel = 0;
4032  int has_digit = 0;
4033  int has_duration_ms = 0;
4034 
4035  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4036  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4037  int prop_is_valid;
4038  prop_is_valid = ast_ari_validate_string(
4040  if (!prop_is_valid) {
4041  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field asterisk_id failed validation\n");
4042  res = 0;
4043  }
4044  } else
4045  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4046  int prop_is_valid;
4047  has_type = 1;
4048  prop_is_valid = ast_ari_validate_string(
4050  if (!prop_is_valid) {
4051  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field type failed validation\n");
4052  res = 0;
4053  }
4054  } else
4055  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4056  int prop_is_valid;
4057  has_application = 1;
4058  prop_is_valid = ast_ari_validate_string(
4060  if (!prop_is_valid) {
4061  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field application failed validation\n");
4062  res = 0;
4063  }
4064  } else
4065  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4066  int prop_is_valid;
4067  has_timestamp = 1;
4068  prop_is_valid = ast_ari_validate_date(
4070  if (!prop_is_valid) {
4071  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field timestamp failed validation\n");
4072  res = 0;
4073  }
4074  } else
4075  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4076  int prop_is_valid;
4077  has_channel = 1;
4078  prop_is_valid = ast_ari_validate_channel(
4080  if (!prop_is_valid) {
4081  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field channel failed validation\n");
4082  res = 0;
4083  }
4084  } else
4085  if (strcmp("digit", ast_json_object_iter_key(iter)) == 0) {
4086  int prop_is_valid;
4087  has_digit = 1;
4088  prop_is_valid = ast_ari_validate_string(
4090  if (!prop_is_valid) {
4091  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field digit failed validation\n");
4092  res = 0;
4093  }
4094  } else
4095  if (strcmp("duration_ms", ast_json_object_iter_key(iter)) == 0) {
4096  int prop_is_valid;
4097  has_duration_ms = 1;
4098  prop_is_valid = ast_ari_validate_int(
4100  if (!prop_is_valid) {
4101  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field duration_ms failed validation\n");
4102  res = 0;
4103  }
4104  } else
4105  {
4107  "ARI ChannelDtmfReceived has undocumented field %s\n",
4108  ast_json_object_iter_key(iter));
4109  res = 0;
4110  }
4111  }
4112 
4113  if (!has_type) {
4114  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field type\n");
4115  res = 0;
4116  }
4117 
4118  if (!has_application) {
4119  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field application\n");
4120  res = 0;
4121  }
4122 
4123  if (!has_timestamp) {
4124  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field timestamp\n");
4125  res = 0;
4126  }
4127 
4128  if (!has_channel) {
4129  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field channel\n");
4130  res = 0;
4131  }
4132 
4133  if (!has_digit) {
4134  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field digit\n");
4135  res = 0;
4136  }
4137 
4138  if (!has_duration_ms) {
4139  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field duration_ms\n");
4140  res = 0;
4141  }
4142 
4143  return res;
4144 }
Iterator for JSON object key/values.
int ast_ari_validate_channel(struct ast_json *json)
Validator for Channel.
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:429
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_int(struct ast_json *json)
Validator for native Swagger int.
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ 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().

See ast_ari_model_validators.h for more details.

Definition at line 4146 of file ari_model_validators.c.

References ast_ari_validate_channel_dtmf_received().

4147 {
4149 }
int ast_ari_validate_channel_dtmf_received(struct ast_json *json)
Validator for ChannelDtmfReceived.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 4151 of file ari_model_validators.c.

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().

4152 {
4153  int res = 1;
4154  struct ast_json_iter *iter;
4155  int has_type = 0;
4156  int has_application = 0;
4157  int has_timestamp = 0;
4158  int has_bridge = 0;
4159 
4160  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4161  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4162  int prop_is_valid;
4163  prop_is_valid = ast_ari_validate_string(
4165  if (!prop_is_valid) {
4166  ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field asterisk_id failed validation\n");
4167  res = 0;
4168  }
4169  } else
4170  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4171  int prop_is_valid;
4172  has_type = 1;
4173  prop_is_valid = ast_ari_validate_string(
4175  if (!prop_is_valid) {
4176  ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field type failed validation\n");
4177  res = 0;
4178  }
4179  } else
4180  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4181  int prop_is_valid;
4182  has_application = 1;
4183  prop_is_valid = ast_ari_validate_string(
4185  if (!prop_is_valid) {
4186  ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field application failed validation\n");
4187  res = 0;
4188  }
4189  } else
4190  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4191  int prop_is_valid;
4192  has_timestamp = 1;
4193  prop_is_valid = ast_ari_validate_date(
4195  if (!prop_is_valid) {
4196  ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field timestamp failed validation\n");
4197  res = 0;
4198  }
4199  } else
4200  if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
4201  int prop_is_valid;
4202  has_bridge = 1;
4203  prop_is_valid = ast_ari_validate_bridge(
4205  if (!prop_is_valid) {
4206  ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field bridge failed validation\n");
4207  res = 0;
4208  }
4209  } else
4210  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4211  int prop_is_valid;
4212  prop_is_valid = ast_ari_validate_channel(
4214  if (!prop_is_valid) {
4215  ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field channel failed validation\n");
4216  res = 0;
4217  }
4218  } else
4219  {
4221  "ARI ChannelEnteredBridge has undocumented field %s\n",
4222  ast_json_object_iter_key(iter));
4223  res = 0;
4224  }
4225  }
4226 
4227  if (!has_type) {
4228  ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field type\n");
4229  res = 0;
4230  }
4231 
4232  if (!has_application) {
4233  ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field application\n");
4234  res = 0;
4235  }
4236 
4237  if (!has_timestamp) {
4238  ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field timestamp\n");
4239  res = 0;
4240  }
4241 
4242  if (!has_bridge) {
4243  ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field bridge\n");
4244  res = 0;
4245  }
4246 
4247  return res;
4248 }
Iterator for JSON object key/values.
int ast_ari_validate_channel(struct ast_json *json)
Validator for Channel.
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:429
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_bridge(struct ast_json *json)
Validator for Bridge.
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ 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().

See ast_ari_model_validators.h for more details.

Definition at line 4250 of file ari_model_validators.c.

References ast_ari_validate_channel_entered_bridge().

4251 {
4253 }
int ast_ari_validate_channel_entered_bridge(struct ast_json *json)
Validator for ChannelEnteredBridge.

◆ ast_ari_validate_channel_fn()

ari_validator ast_ari_validate_channel_fn ( void  )

Function pointer to ast_ari_validate_channel().

See ast_ari_model_validators.h for more details.

Definition at line 1204 of file ari_model_validators.c.

References ast_ari_validate_channel().

Referenced by ast_ari_channels_list_cb().

1205 {
1206  return ast_ari_validate_channel;
1207 }
int ast_ari_validate_channel(struct ast_json *json)
Validator for Channel.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 4255 of file ari_model_validators.c.

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().

4256 {
4257  int res = 1;
4258  struct ast_json_iter *iter;
4259  int has_type = 0;
4260  int has_application = 0;
4261  int has_timestamp = 0;
4262  int has_channel = 0;
4263 
4264  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4265  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4266  int prop_is_valid;
4267  prop_is_valid = ast_ari_validate_string(
4269  if (!prop_is_valid) {
4270  ast_log(LOG_ERROR, "ARI ChannelHangupRequest field asterisk_id failed validation\n");
4271  res = 0;
4272  }
4273  } else
4274  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4275  int prop_is_valid;
4276  has_type = 1;
4277  prop_is_valid = ast_ari_validate_string(
4279  if (!prop_is_valid) {
4280  ast_log(LOG_ERROR, "ARI ChannelHangupRequest field type failed validation\n");
4281  res = 0;
4282  }
4283  } else
4284  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4285  int prop_is_valid;
4286  has_application = 1;
4287  prop_is_valid = ast_ari_validate_string(
4289  if (!prop_is_valid) {
4290  ast_log(LOG_ERROR, "ARI ChannelHangupRequest field application failed validation\n");
4291  res = 0;
4292  }
4293  } else
4294  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4295  int prop_is_valid;
4296  has_timestamp = 1;
4297  prop_is_valid = ast_ari_validate_date(
4299  if (!prop_is_valid) {
4300  ast_log(LOG_ERROR, "ARI ChannelHangupRequest field timestamp failed validation\n");
4301  res = 0;
4302  }
4303  } else
4304  if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
4305  int prop_is_valid;
4306  prop_is_valid = ast_ari_validate_int(
4308  if (!prop_is_valid) {
4309  ast_log(LOG_ERROR, "ARI ChannelHangupRequest field cause failed validation\n");
4310  res = 0;
4311  }
4312  } else
4313  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4314  int prop_is_valid;
4315  has_channel = 1;
4316  prop_is_valid = ast_ari_validate_channel(
4318  if (!prop_is_valid) {
4319  ast_log(LOG_ERROR, "ARI ChannelHangupRequest field channel failed validation\n");
4320  res = 0;
4321  }
4322  } else
4323  if (strcmp("soft", ast_json_object_iter_key(iter)) == 0) {
4324  int prop_is_valid;
4325  prop_is_valid = ast_ari_validate_boolean(
4327  if (!prop_is_valid) {
4328  ast_log(LOG_ERROR, "ARI ChannelHangupRequest field soft failed validation\n");
4329  res = 0;
4330  }
4331  } else
4332  {
4334  "ARI ChannelHangupRequest has undocumented field %s\n",
4335  ast_json_object_iter_key(iter));
4336  res = 0;
4337  }
4338  }
4339 
4340  if (!has_type) {
4341  ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field type\n");
4342  res = 0;
4343  }
4344 
4345  if (!has_application) {
4346  ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field application\n");
4347  res = 0;
4348  }
4349 
4350  if (!has_timestamp) {
4351  ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field timestamp\n");
4352  res = 0;
4353  }
4354 
4355  if (!has_channel) {
4356  ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field channel\n");
4357  res = 0;
4358  }
4359 
4360  return res;
4361 }
Iterator for JSON object key/values.
int ast_ari_validate_channel(struct ast_json *json)
Validator for Channel.
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:429
int ast_ari_validate_boolean(struct ast_json *json)
Validator for native Swagger boolean.
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_int(struct ast_json *json)
Validator for native Swagger int.
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ 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().

See ast_ari_model_validators.h for more details.

Definition at line 4363 of file ari_model_validators.c.

References ast_ari_validate_channel_hangup_request().

4364 {
4366 }
int ast_ari_validate_channel_hangup_request(struct ast_json *json)
Validator for ChannelHangupRequest.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 4368 of file ari_model_validators.c.

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().

4369 {
4370  int res = 1;
4371  struct ast_json_iter *iter;
4372  int has_type = 0;
4373  int has_application = 0;
4374  int has_timestamp = 0;
4375  int has_channel = 0;
4376 
4377  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4378  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4379  int prop_is_valid;
4380  prop_is_valid = ast_ari_validate_string(
4382  if (!prop_is_valid) {
4383  ast_log(LOG_ERROR, "ARI ChannelHold field asterisk_id failed validation\n");
4384  res = 0;
4385  }
4386  } else
4387  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4388  int prop_is_valid;
4389  has_type = 1;
4390  prop_is_valid = ast_ari_validate_string(
4392  if (!prop_is_valid) {
4393  ast_log(LOG_ERROR, "ARI ChannelHold field type failed validation\n");
4394  res = 0;
4395  }
4396  } else
4397  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4398  int prop_is_valid;
4399  has_application = 1;
4400  prop_is_valid = ast_ari_validate_string(
4402  if (!prop_is_valid) {
4403  ast_log(LOG_ERROR, "ARI ChannelHold field application failed validation\n");
4404  res = 0;
4405  }
4406  } else
4407  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4408  int prop_is_valid;
4409  has_timestamp = 1;
4410  prop_is_valid = ast_ari_validate_date(
4412  if (!prop_is_valid) {
4413  ast_log(LOG_ERROR, "ARI ChannelHold field timestamp failed validation\n");
4414  res = 0;
4415  }
4416  } else
4417  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4418  int prop_is_valid;
4419  has_channel = 1;
4420  prop_is_valid = ast_ari_validate_channel(
4422  if (!prop_is_valid) {
4423  ast_log(LOG_ERROR, "ARI ChannelHold field channel failed validation\n");
4424  res = 0;
4425  }
4426  } else
4427  if (strcmp("musicclass", ast_json_object_iter_key(iter)) == 0) {
4428  int prop_is_valid;
4429  prop_is_valid = ast_ari_validate_string(
4431  if (!prop_is_valid) {
4432  ast_log(LOG_ERROR, "ARI ChannelHold field musicclass failed validation\n");
4433  res = 0;
4434  }
4435  } else
4436  {
4438  "ARI ChannelHold has undocumented field %s\n",
4439  ast_json_object_iter_key(iter));
4440  res = 0;
4441  }
4442  }
4443 
4444  if (!has_type) {
4445  ast_log(LOG_ERROR, "ARI ChannelHold missing required field type\n");
4446  res = 0;
4447  }
4448 
4449  if (!has_application) {
4450  ast_log(LOG_ERROR, "ARI ChannelHold missing required field application\n");
4451  res = 0;
4452  }
4453 
4454  if (!has_timestamp) {
4455  ast_log(LOG_ERROR, "ARI ChannelHold missing required field timestamp\n");
4456  res = 0;
4457  }
4458 
4459  if (!has_channel) {
4460  ast_log(LOG_ERROR, "ARI ChannelHold missing required field channel\n");
4461  res = 0;
4462  }
4463 
4464  return res;
4465 }
Iterator for JSON object key/values.
int ast_ari_validate_channel(struct ast_json *json)
Validator for Channel.
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:429
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ ast_ari_validate_channel_hold_fn()

ari_validator ast_ari_validate_channel_hold_fn ( void  )

Function pointer to ast_ari_validate_channel_hold().

See ast_ari_model_validators.h for more details.

Definition at line 4467 of file ari_model_validators.c.

References ast_ari_validate_channel_hold().

4468 {
4470 }
int ast_ari_validate_channel_hold(struct ast_json *json)
Validator for ChannelHold.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 4472 of file ari_model_validators.c.

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().

4473 {
4474  int res = 1;
4475  struct ast_json_iter *iter;
4476  int has_type = 0;
4477  int has_application = 0;
4478  int has_timestamp = 0;
4479  int has_bridge = 0;
4480  int has_channel = 0;
4481 
4482  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4483  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4484  int prop_is_valid;
4485  prop_is_valid = ast_ari_validate_string(
4487  if (!prop_is_valid) {
4488  ast_log(LOG_ERROR, "ARI ChannelLeftBridge field asterisk_id failed validation\n");
4489  res = 0;
4490  }
4491  } else
4492  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4493  int prop_is_valid;
4494  has_type = 1;
4495  prop_is_valid = ast_ari_validate_string(
4497  if (!prop_is_valid) {
4498  ast_log(LOG_ERROR, "ARI ChannelLeftBridge field type failed validation\n");
4499  res = 0;
4500  }
4501  } else
4502  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4503  int prop_is_valid;
4504  has_application = 1;
4505  prop_is_valid = ast_ari_validate_string(
4507  if (!prop_is_valid) {
4508  ast_log(LOG_ERROR, "ARI ChannelLeftBridge field application failed validation\n");
4509  res = 0;
4510  }
4511  } else
4512  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4513  int prop_is_valid;
4514  has_timestamp = 1;
4515  prop_is_valid = ast_ari_validate_date(
4517  if (!prop_is_valid) {
4518  ast_log(LOG_ERROR, "ARI ChannelLeftBridge field timestamp failed validation\n");
4519  res = 0;
4520  }
4521  } else
4522  if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
4523  int prop_is_valid;
4524  has_bridge = 1;
4525  prop_is_valid = ast_ari_validate_bridge(
4527  if (!prop_is_valid) {
4528  ast_log(LOG_ERROR, "ARI ChannelLeftBridge field bridge failed validation\n");
4529  res = 0;
4530  }
4531  } else
4532  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4533  int prop_is_valid;
4534  has_channel = 1;
4535  prop_is_valid = ast_ari_validate_channel(
4537  if (!prop_is_valid) {
4538  ast_log(LOG_ERROR, "ARI ChannelLeftBridge field channel failed validation\n");
4539  res = 0;
4540  }
4541  } else
4542  {
4544  "ARI ChannelLeftBridge has undocumented field %s\n",
4545  ast_json_object_iter_key(iter));
4546  res = 0;
4547  }
4548  }
4549 
4550  if (!has_type) {
4551  ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field type\n");
4552  res = 0;
4553  }
4554 
4555  if (!has_application) {
4556  ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field application\n");
4557  res = 0;
4558  }
4559 
4560  if (!has_timestamp) {
4561  ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field timestamp\n");
4562  res = 0;
4563  }
4564 
4565  if (!has_bridge) {
4566  ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field bridge\n");
4567  res = 0;
4568  }
4569 
4570  if (!has_channel) {
4571  ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field channel\n");
4572  res = 0;
4573  }
4574 
4575  return res;
4576 }
Iterator for JSON object key/values.
int ast_ari_validate_channel(struct ast_json *json)
Validator for Channel.
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:429
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_bridge(struct ast_json *json)
Validator for Bridge.
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ 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().

See ast_ari_model_validators.h for more details.

Definition at line 4578 of file ari_model_validators.c.

References ast_ari_validate_channel_left_bridge().

4579 {
4581 }
int ast_ari_validate_channel_left_bridge(struct ast_json *json)
Validator for ChannelLeftBridge.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 4583 of file ari_model_validators.c.

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().

4584 {
4585  int res = 1;
4586  struct ast_json_iter *iter;
4587  int has_type = 0;
4588  int has_application = 0;
4589  int has_timestamp = 0;
4590  int has_channel = 0;
4591 
4592  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4593  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4594  int prop_is_valid;
4595  prop_is_valid = ast_ari_validate_string(
4597  if (!prop_is_valid) {
4598  ast_log(LOG_ERROR, "ARI ChannelStateChange field asterisk_id failed validation\n");
4599  res = 0;
4600  }
4601  } else
4602  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4603  int prop_is_valid;
4604  has_type = 1;
4605  prop_is_valid = ast_ari_validate_string(
4607  if (!prop_is_valid) {
4608  ast_log(LOG_ERROR, "ARI ChannelStateChange field type failed validation\n");
4609  res = 0;
4610  }
4611  } else
4612  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4613  int prop_is_valid;
4614  has_application = 1;
4615  prop_is_valid = ast_ari_validate_string(
4617  if (!prop_is_valid) {
4618  ast_log(LOG_ERROR, "ARI ChannelStateChange field application failed validation\n");
4619  res = 0;
4620  }
4621  } else
4622  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4623  int prop_is_valid;
4624  has_timestamp = 1;
4625  prop_is_valid = ast_ari_validate_date(
4627  if (!prop_is_valid) {
4628  ast_log(LOG_ERROR, "ARI ChannelStateChange field timestamp failed validation\n");
4629  res = 0;
4630  }
4631  } else
4632  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4633  int prop_is_valid;
4634  has_channel = 1;
4635  prop_is_valid = ast_ari_validate_channel(
4637  if (!prop_is_valid) {
4638  ast_log(LOG_ERROR, "ARI ChannelStateChange field channel failed validation\n");
4639  res = 0;
4640  }
4641  } else
4642  {
4644  "ARI ChannelStateChange has undocumented field %s\n",
4645  ast_json_object_iter_key(iter));
4646  res = 0;
4647  }
4648  }
4649 
4650  if (!has_type) {
4651  ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field type\n");
4652  res = 0;
4653  }
4654 
4655  if (!has_application) {
4656  ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field application\n");
4657  res = 0;
4658  }
4659 
4660  if (!has_timestamp) {
4661  ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field timestamp\n");
4662  res = 0;
4663  }
4664 
4665  if (!has_channel) {
4666  ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field channel\n");
4667  res = 0;
4668  }
4669 
4670  return res;
4671 }
Iterator for JSON object key/values.
int ast_ari_validate_channel(struct ast_json *json)
Validator for Channel.
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:429
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ 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().

See ast_ari_model_validators.h for more details.

Definition at line 4673 of file ari_model_validators.c.

References ast_ari_validate_channel_state_change().

4674 {
4676 }
int ast_ari_validate_channel_state_change(struct ast_json *json)
Validator for ChannelStateChange.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 4678 of file ari_model_validators.c.

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().

4679 {
4680  int res = 1;
4681  struct ast_json_iter *iter;
4682  int has_type = 0;
4683  int has_application = 0;
4684  int has_timestamp = 0;
4685  int has_channel = 0;
4686  int has_duration = 0;
4687 
4688  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4689  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4690  int prop_is_valid;
4691  prop_is_valid = ast_ari_validate_string(
4693  if (!prop_is_valid) {
4694  ast_log(LOG_ERROR, "ARI ChannelTalkingFinished field asterisk_id failed validation\n");
4695  res = 0;
4696  }
4697  } else
4698  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4699  int prop_is_valid;
4700  has_type = 1;
4701  prop_is_valid = ast_ari_validate_string(
4703  if (!prop_is_valid) {
4704  ast_log(LOG_ERROR, "ARI ChannelTalkingFinished field type failed validation\n");
4705  res = 0;
4706  }
4707  } else
4708  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4709  int prop_is_valid;
4710  has_application = 1;
4711  prop_is_valid = ast_ari_validate_string(
4713  if (!prop_is_valid) {
4714  ast_log(LOG_ERROR, "ARI ChannelTalkingFinished field application failed validation\n");
4715  res = 0;
4716  }
4717  } else
4718  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4719  int prop_is_valid;
4720  has_timestamp = 1;
4721  prop_is_valid = ast_ari_validate_date(
4723  if (!prop_is_valid) {
4724  ast_log(LOG_ERROR, "ARI ChannelTalkingFinished field timestamp failed validation\n");
4725  res = 0;
4726  }
4727  } else
4728  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4729  int prop_is_valid;
4730  has_channel = 1;
4731  prop_is_valid = ast_ari_validate_channel(
4733  if (!prop_is_valid) {
4734  ast_log(LOG_ERROR, "ARI ChannelTalkingFinished field channel failed validation\n");
4735  res = 0;
4736  }
4737  } else
4738  if (strcmp("duration", ast_json_object_iter_key(iter)) == 0) {
4739  int prop_is_valid;
4740  has_duration = 1;
4741  prop_is_valid = ast_ari_validate_int(
4743  if (!prop_is_valid) {
4744  ast_log(LOG_ERROR, "ARI ChannelTalkingFinished field duration failed validation\n");
4745  res = 0;
4746  }
4747  } else
4748  {
4750  "ARI ChannelTalkingFinished has undocumented field %s\n",
4751  ast_json_object_iter_key(iter));
4752  res = 0;
4753  }
4754  }
4755 
4756  if (!has_type) {
4757  ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field type\n");
4758  res = 0;
4759  }
4760 
4761  if (!has_application) {
4762  ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field application\n");
4763  res = 0;
4764  }
4765 
4766  if (!has_timestamp) {
4767  ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field timestamp\n");
4768  res = 0;
4769  }
4770 
4771  if (!has_channel) {
4772  ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field channel\n");
4773  res = 0;
4774  }
4775 
4776  if (!has_duration) {
4777  ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field duration\n");
4778  res = 0;
4779  }
4780 
4781  return res;
4782 }
Iterator for JSON object key/values.
int ast_ari_validate_channel(struct ast_json *json)
Validator for Channel.
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:429
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_int(struct ast_json *json)
Validator for native Swagger int.
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ 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().

See ast_ari_model_validators.h for more details.

Definition at line 4784 of file ari_model_validators.c.

References ast_ari_validate_channel_talking_finished().

4785 {
4787 }
int ast_ari_validate_channel_talking_finished(struct ast_json *json)
Validator for ChannelTalkingFinished.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 4789 of file ari_model_validators.c.

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().

4790 {
4791  int res = 1;
4792  struct ast_json_iter *iter;
4793  int has_type = 0;
4794  int has_application = 0;
4795  int has_timestamp = 0;
4796  int has_channel = 0;
4797 
4798  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4799  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4800  int prop_is_valid;
4801  prop_is_valid = ast_ari_validate_string(
4803  if (!prop_is_valid) {
4804  ast_log(LOG_ERROR, "ARI ChannelTalkingStarted field asterisk_id failed validation\n");
4805  res = 0;
4806  }
4807  } else
4808  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4809  int prop_is_valid;
4810  has_type = 1;
4811  prop_is_valid = ast_ari_validate_string(
4813  if (!prop_is_valid) {
4814  ast_log(LOG_ERROR, "ARI ChannelTalkingStarted field type failed validation\n");
4815  res = 0;
4816  }
4817  } else
4818  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4819  int prop_is_valid;
4820  has_application = 1;
4821  prop_is_valid = ast_ari_validate_string(
4823  if (!prop_is_valid) {
4824  ast_log(LOG_ERROR, "ARI ChannelTalkingStarted field application failed validation\n");
4825  res = 0;
4826  }
4827  } else
4828  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4829  int prop_is_valid;
4830  has_timestamp = 1;
4831  prop_is_valid = ast_ari_validate_date(
4833  if (!prop_is_valid) {
4834  ast_log(LOG_ERROR, "ARI ChannelTalkingStarted field timestamp failed validation\n");
4835  res = 0;
4836  }
4837  } else
4838  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4839  int prop_is_valid;
4840  has_channel = 1;
4841  prop_is_valid = ast_ari_validate_channel(
4843  if (!prop_is_valid) {
4844  ast_log(LOG_ERROR, "ARI ChannelTalkingStarted field channel failed validation\n");
4845  res = 0;
4846  }
4847  } else
4848  {
4850  "ARI ChannelTalkingStarted has undocumented field %s\n",
4851  ast_json_object_iter_key(iter));
4852  res = 0;
4853  }
4854  }
4855 
4856  if (!has_type) {
4857  ast_log(LOG_ERROR, "ARI ChannelTalkingStarted missing required field type\n");
4858  res = 0;
4859  }
4860 
4861  if (!has_application) {
4862  ast_log(LOG_ERROR, "ARI ChannelTalkingStarted missing required field application\n");
4863  res = 0;
4864  }
4865 
4866  if (!has_timestamp) {
4867  ast_log(LOG_ERROR, "ARI ChannelTalkingStarted missing required field timestamp\n");
4868  res = 0;
4869  }
4870 
4871  if (!has_channel) {
4872  ast_log(LOG_ERROR, "ARI ChannelTalkingStarted missing required field channel\n");
4873  res = 0;
4874  }
4875 
4876  return res;
4877 }
Iterator for JSON object key/values.
int ast_ari_validate_channel(struct ast_json *json)
Validator for Channel.
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:429
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ 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().

See ast_ari_model_validators.h for more details.

Definition at line 4879 of file ari_model_validators.c.

References ast_ari_validate_channel_talking_started().

4880 {
4882 }
int ast_ari_validate_channel_talking_started(struct ast_json *json)
Validator for ChannelTalkingStarted.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 4884 of file ari_model_validators.c.

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().

4885 {
4886  int res = 1;
4887  struct ast_json_iter *iter;
4888  int has_type = 0;
4889  int has_application = 0;
4890  int has_timestamp = 0;
4891  int has_channel = 0;
4892 
4893  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4894  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4895  int prop_is_valid;
4896  prop_is_valid = ast_ari_validate_string(
4898  if (!prop_is_valid) {
4899  ast_log(LOG_ERROR, "ARI ChannelUnhold field asterisk_id failed validation\n");
4900  res = 0;
4901  }
4902  } else
4903  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4904  int prop_is_valid;
4905  has_type = 1;
4906  prop_is_valid = ast_ari_validate_string(
4908  if (!prop_is_valid) {
4909  ast_log(LOG_ERROR, "ARI ChannelUnhold field type failed validation\n");
4910  res = 0;
4911  }
4912  } else
4913  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4914  int prop_is_valid;
4915  has_application = 1;
4916  prop_is_valid = ast_ari_validate_string(
4918  if (!prop_is_valid) {
4919  ast_log(LOG_ERROR, "ARI ChannelUnhold field application failed validation\n");
4920  res = 0;
4921  }
4922  } else
4923  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4924  int prop_is_valid;
4925  has_timestamp = 1;
4926  prop_is_valid = ast_ari_validate_date(
4928  if (!prop_is_valid) {
4929  ast_log(LOG_ERROR, "ARI ChannelUnhold field timestamp failed validation\n");
4930  res = 0;
4931  }
4932  } else
4933  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4934  int prop_is_valid;
4935  has_channel = 1;
4936  prop_is_valid = ast_ari_validate_channel(
4938  if (!prop_is_valid) {
4939  ast_log(LOG_ERROR, "ARI ChannelUnhold field channel failed validation\n");
4940  res = 0;
4941  }
4942  } else
4943  {
4945  "ARI ChannelUnhold has undocumented field %s\n",
4946  ast_json_object_iter_key(iter));
4947  res = 0;
4948  }
4949  }
4950 
4951  if (!has_type) {
4952  ast_log(LOG_ERROR, "ARI ChannelUnhold missing required field type\n");
4953  res = 0;
4954  }
4955 
4956  if (!has_application) {
4957  ast_log(LOG_ERROR, "ARI ChannelUnhold missing required field application\n");
4958  res = 0;
4959  }
4960 
4961  if (!has_timestamp) {
4962  ast_log(LOG_ERROR, "ARI ChannelUnhold missing required field timestamp\n");
4963  res = 0;
4964  }
4965 
4966  if (!has_channel) {
4967  ast_log(LOG_ERROR, "ARI ChannelUnhold missing required field channel\n");
4968  res = 0;
4969  }
4970 
4971  return res;
4972 }
Iterator for JSON object key/values.
int ast_ari_validate_channel(struct ast_json *json)
Validator for Channel.
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:429
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ ast_ari_validate_channel_unhold_fn()

ari_validator ast_ari_validate_channel_unhold_fn ( void  )

Function pointer to ast_ari_validate_channel_unhold().

See ast_ari_model_validators.h for more details.

Definition at line 4974 of file ari_model_validators.c.

References ast_ari_validate_channel_unhold().

4975 {
4977 }
int ast_ari_validate_channel_unhold(struct ast_json *json)
Validator for ChannelUnhold.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 4979 of file ari_model_validators.c.

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().

4980 {
4981  int res = 1;
4982  struct ast_json_iter *iter;
4983  int has_type = 0;
4984  int has_application = 0;
4985  int has_timestamp = 0;
4986  int has_eventname = 0;
4987  int has_userevent = 0;
4988 
4989  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4990  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4991  int prop_is_valid;
4992  prop_is_valid = ast_ari_validate_string(
4994  if (!prop_is_valid) {
4995  ast_log(LOG_ERROR, "ARI ChannelUserevent field asterisk_id failed validation\n");
4996  res = 0;
4997  }
4998  } else
4999  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
5000  int prop_is_valid;
5001  has_type = 1;
5002  prop_is_valid = ast_ari_validate_string(
5004  if (!prop_is_valid) {
5005  ast_log(LOG_ERROR, "ARI ChannelUserevent field type failed validation\n");
5006  res = 0;
5007  }
5008  } else
5009  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
5010  int prop_is_valid;
5011  has_application = 1;
5012  prop_is_valid = ast_ari_validate_string(
5014  if (!prop_is_valid) {
5015  ast_log(LOG_ERROR, "ARI ChannelUserevent field application failed validation\n");
5016  res = 0;
5017  }
5018  } else
5019  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
5020  int prop_is_valid;
5021  has_timestamp = 1;
5022  prop_is_valid = ast_ari_validate_date(
5024  if (!prop_is_valid) {
5025  ast_log(LOG_ERROR, "ARI ChannelUserevent field timestamp failed validation\n");
5026  res = 0;
5027  }
5028  } else
5029  if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
5030  int prop_is_valid;
5031  prop_is_valid = ast_ari_validate_bridge(
5033  if (!prop_is_valid) {
5034  ast_log(LOG_ERROR, "ARI ChannelUserevent field bridge failed validation\n");
5035  res = 0;
5036  }
5037  } else
5038  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
5039  int prop_is_valid;
5040  prop_is_valid = ast_ari_validate_channel(
5042  if (!prop_is_valid) {
5043  ast_log(LOG_ERROR, "ARI ChannelUserevent field channel failed validation\n");
5044  res = 0;
5045  }
5046  } else
5047  if (strcmp("endpoint", ast_json_object_iter_key(iter)) == 0) {
5048  int prop_is_valid;
5049  prop_is_valid = ast_ari_validate_endpoint(
5051  if (!prop_is_valid) {
5052  ast_log(LOG_ERROR, "ARI ChannelUserevent field endpoint failed validation\n");
5053  res = 0;
5054  }
5055  } else
5056  if (strcmp("eventname", ast_json_object_iter_key(iter)) == 0) {
5057  int prop_is_valid;
5058  has_eventname = 1;
5059  prop_is_valid = ast_ari_validate_string(
5061  if (!prop_is_valid) {
5062  ast_log(LOG_ERROR, "ARI ChannelUserevent field eventname failed validation\n");
5063  res = 0;
5064  }
5065  } else
5066  if (strcmp("userevent", ast_json_object_iter_key(iter)) == 0) {
5067  int prop_is_valid;
5068  has_userevent = 1;
5069  prop_is_valid = ast_ari_validate_object(
5071  if (!prop_is_valid) {
5072  ast_log(LOG_ERROR, "ARI ChannelUserevent field userevent failed validation\n");
5073  res = 0;
5074  }
5075  } else
5076  {
5078  "ARI ChannelUserevent has undocumented field %s\n",
5079  ast_json_object_iter_key(iter));
5080  res = 0;
5081  }
5082  }
5083 
5084  if (!has_type) {
5085  ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field type\n");
5086  res = 0;
5087  }
5088 
5089  if (!has_application) {
5090  ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field application\n");
5091  res = 0;
5092  }
5093 
5094  if (!has_timestamp) {
5095  ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field timestamp\n");
5096  res = 0;
5097  }
5098 
5099  if (!has_eventname) {
5100  ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field eventname\n");
5101  res = 0;
5102  }
5103 
5104  if (!has_userevent) {
5105  ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field userevent\n");
5106  res = 0;
5107  }
5108 
5109  return res;
5110 }
Iterator for JSON object key/values.
int ast_ari_validate_channel(struct ast_json *json)
Validator for Channel.
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:429
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_endpoint(struct ast_json *json)
Validator for Endpoint.
int ast_ari_validate_bridge(struct ast_json *json)
Validator for Bridge.
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.
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:437

◆ ast_ari_validate_channel_userevent_fn()

ari_validator ast_ari_validate_channel_userevent_fn ( void  )

Function pointer to ast_ari_validate_channel_userevent().

See ast_ari_model_validators.h for more details.

Definition at line 5112 of file ari_model_validators.c.

References ast_ari_validate_channel_userevent().

5113 {
5115 }
int ast_ari_validate_channel_userevent(struct ast_json *json)
Validator for ChannelUserevent.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 5117 of file ari_model_validators.c.

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().

5118 {
5119  int res = 1;
5120  struct ast_json_iter *iter;
5121  int has_type = 0;
5122  int has_application = 0;
5123  int has_timestamp = 0;
5124  int has_value = 0;
5125  int has_variable = 0;
5126 
5127  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
5128  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
5129  int prop_is_valid;
5130  prop_is_valid = ast_ari_validate_string(
5132  if (!prop_is_valid) {
5133  ast_log(LOG_ERROR, "ARI ChannelVarset field asterisk_id failed validation\n");
5134  res = 0;
5135  }
5136  } else
5137  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
5138  int prop_is_valid;
5139  has_type = 1;
5140  prop_is_valid = ast_ari_validate_string(
5142  if (!prop_is_valid) {
5143  ast_log(LOG_ERROR, "ARI ChannelVarset field type failed validation\n");
5144  res = 0;
5145  }
5146  } else
5147  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
5148  int prop_is_valid;
5149  has_application = 1;
5150  prop_is_valid = ast_ari_validate_string(
5152  if (!prop_is_valid) {
5153  ast_log(LOG_ERROR, "ARI ChannelVarset field application failed validation\n");
5154  res = 0;
5155  }
5156  } else
5157  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
5158  int prop_is_valid;
5159  has_timestamp = 1;
5160  prop_is_valid = ast_ari_validate_date(
5162  if (!prop_is_valid) {
5163  ast_log(LOG_ERROR, "ARI ChannelVarset field timestamp 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 ChannelVarset field channel failed validation\n");
5173  res = 0;
5174  }
5175  } else
5176  if (strcmp("value", ast_json_object_iter_key(iter)) == 0) {
5177  int prop_is_valid;
5178  has_value = 1;
5179  prop_is_valid = ast_ari_validate_string(
5181  if (!prop_is_valid) {
5182  ast_log(LOG_ERROR, "ARI ChannelVarset field value failed validation\n");
5183  res = 0;
5184  }
5185  } else
5186  if (strcmp("variable", ast_json_object_iter_key(iter)) == 0) {
5187  int prop_is_valid;
5188  has_variable = 1;
5189  prop_is_valid = ast_ari_validate_string(
5191  if (!prop_is_valid) {
5192  ast_log(LOG_ERROR, "ARI ChannelVarset field variable failed validation\n");
5193  res = 0;
5194  }
5195  } else
5196  {
5198  "ARI ChannelVarset has undocumented field %s\n",
5199  ast_json_object_iter_key(iter));
5200  res = 0;
5201  }
5202  }
5203 
5204  if (!has_type) {
5205  ast_log(LOG_ERROR, "ARI ChannelVarset missing required field type\n");
5206  res = 0;
5207  }
5208 
5209  if (!has_application) {
5210  ast_log(LOG_ERROR, "ARI ChannelVarset missing required field application\n");
5211  res = 0;
5212  }
5213 
5214  if (!has_timestamp) {
5215  ast_log(LOG_ERROR, "ARI ChannelVarset missing required field timestamp\n");
5216  res = 0;
5217  }
5218 
5219  if (!has_value) {
5220  ast_log(LOG_ERROR, "ARI ChannelVarset missing required field value\n");
5221  res = 0;
5222  }
5223 
5224  if (!has_variable) {
5225  ast_log(LOG_ERROR, "ARI ChannelVarset missing required field variable\n");
5226  res = 0;
5227  }
5228 
5229  return res;
5230 }
Iterator for JSON object key/values.
int ast_ari_validate_channel(struct ast_json *json)
Validator for Channel.
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:429
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
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:437

◆ ast_ari_validate_channel_varset_fn()

ari_validator ast_ari_validate_channel_varset_fn ( void  )

Function pointer to ast_ari_validate_channel_varset().

See ast_ari_model_validators.h for more details.

Definition at line 5232 of file ari_model_validators.c.

References ast_ari_validate_channel_varset().

5233 {
5235 }
int ast_ari_validate_channel_varset(struct ast_json *json)
Validator for ChannelVarset.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 282 of file ari_model_validators.c.

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().

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 }
Iterator for JSON object key/values.
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:429
#define ast_log
Definition: astobj2.c:42
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:445
int ast_ari_validate_double(struct ast_json *json)
Validator for native Swagger double.
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_int(struct ast_json *json)
Validator for native Swagger int.
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
int ast_ari_validate_set_id(struct ast_json *json)
Validator for SetId.
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:437

◆ ast_ari_validate_config_info_fn()

ari_validator ast_ari_validate_config_info_fn ( void  )

Function pointer to ast_ari_validate_config_info().

See ast_ari_model_validators.h for more details.

Definition at line 374 of file ari_model_validators.c.

References ast_ari_validate_config_info().

375 {
377 }
int ast_ari_validate_config_info(struct ast_json *json)
Validator for ConfigInfo.

◆ 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.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 379 of file ari_model_validators.c.

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().

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(