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(LOG_ERROR, "ARI ConfigTuple missing required field attribute\n");
417  res = 0;
418  }
419 
420  if (!has_value) {
421  ast_log(LOG_ERROR, "ARI ConfigTuple missing required field value\n");
422  res = 0;
423  }
424 
425  return res;
426 }
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_config_tuple_fn()

ari_validator ast_ari_validate_config_tuple_fn ( void  )

Function pointer to ast_ari_validate_config_tuple().

See ast_ari_model_validators.h for more details.

Definition at line 428 of file ari_model_validators.c.

References ast_ari_validate_config_tuple().

Referenced by ast_ari_asterisk_get_object_cb(), and ast_ari_asterisk_update_object_cb().

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

◆ ast_ari_validate_contact_info()

int ast_ari_validate_contact_info ( struct ast_json json)

Validator for ContactInfo.

Detailed information about a contact on an endpoint.

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

Definition at line 5237 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_contact_info_fn(), and ast_ari_validate_contact_status_change().

5238 {
5239  int res = 1;
5240  struct ast_json_iter *iter;
5241  int has_aor = 0;
5242  int has_contact_status = 0;
5243  int has_uri = 0;
5244 
5245  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
5246  if (strcmp("aor", ast_json_object_iter_key(iter)) == 0) {
5247  int prop_is_valid;
5248  has_aor = 1;
5249  prop_is_valid = ast_ari_validate_string(
5251  if (!prop_is_valid) {
5252  ast_log(LOG_ERROR, "ARI ContactInfo field aor failed validation\n");
5253  res = 0;
5254  }
5255  } else
5256  if (strcmp("contact_status", ast_json_object_iter_key(iter)) == 0) {
5257  int prop_is_valid;
5258  has_contact_status = 1;
5259  prop_is_valid = ast_ari_validate_string(
5261  if (!prop_is_valid) {
5262  ast_log(LOG_ERROR, "ARI ContactInfo field contact_status failed validation\n");
5263  res = 0;
5264  }
5265  } else
5266  if (strcmp("roundtrip_usec", ast_json_object_iter_key(iter)) == 0) {
5267  int prop_is_valid;
5268  prop_is_valid = ast_ari_validate_string(
5270  if (!prop_is_valid) {
5271  ast_log(LOG_ERROR, "ARI ContactInfo field roundtrip_usec failed validation\n");
5272  res = 0;
5273  }
5274  } else
5275  if (strcmp("uri", ast_json_object_iter_key(iter)) == 0) {
5276  int prop_is_valid;
5277  has_uri = 1;
5278  prop_is_valid = ast_ari_validate_string(
5280  if (!prop_is_valid) {
5281  ast_log(LOG_ERROR, "ARI ContactInfo field uri failed validation\n");
5282  res = 0;
5283  }
5284  } else
5285  {
5287  "ARI ContactInfo has undocumented field %s\n",
5288  ast_json_object_iter_key(iter));
5289  res = 0;
5290  }
5291  }
5292 
5293  if (!has_aor) {
5294  ast_log(LOG_ERROR, "ARI ContactInfo missing required field aor\n");
5295  res = 0;
5296  }
5297 
5298  if (!has_contact_status) {
5299  ast_log(LOG_ERROR, "ARI ContactInfo missing required field contact_status\n");
5300  res = 0;
5301  }
5302 
5303  if (!has_uri) {
5304  ast_log(LOG_ERROR, "ARI ContactInfo missing required field uri\n");
5305  res = 0;
5306  }
5307 
5308  return res;
5309 }
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_contact_info_fn()

ari_validator ast_ari_validate_contact_info_fn ( void  )

Function pointer to ast_ari_validate_contact_info().

See ast_ari_model_validators.h for more details.

Definition at line 5311 of file ari_model_validators.c.

References ast_ari_validate_contact_info().

5312 {
5314 }
int ast_ari_validate_contact_info(struct ast_json *json)
Validator for ContactInfo.

◆ ast_ari_validate_contact_status_change()

int ast_ari_validate_contact_status_change ( struct ast_json json)

Validator for ContactStatusChange.

The state of a contact on an endpoint has changed.

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

Definition at line 5316 of file ari_model_validators.c.

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

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

5317 {
5318  int res = 1;
5319  struct ast_json_iter *iter;
5320  int has_type = 0;
5321  int has_application = 0;
5322  int has_timestamp = 0;
5323  int has_contact_info = 0;
5324  int has_endpoint = 0;
5325 
5326  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
5327  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
5328  int prop_is_valid;
5329  prop_is_valid = ast_ari_validate_string(
5331  if (!prop_is_valid) {
5332  ast_log(LOG_ERROR, "ARI ContactStatusChange field asterisk_id failed validation\n");
5333  res = 0;
5334  }
5335  } else
5336  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
5337  int prop_is_valid;
5338  has_type = 1;
5339  prop_is_valid = ast_ari_validate_string(
5341  if (!prop_is_valid) {
5342  ast_log(LOG_ERROR, "ARI ContactStatusChange field type failed validation\n");
5343  res = 0;
5344  }
5345  } else
5346  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
5347  int prop_is_valid;
5348  has_application = 1;
5349  prop_is_valid = ast_ari_validate_string(
5351  if (!prop_is_valid) {
5352  ast_log(LOG_ERROR, "ARI ContactStatusChange field application failed validation\n");
5353  res = 0;
5354  }
5355  } else
5356  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
5357  int prop_is_valid;
5358  has_timestamp = 1;
5359  prop_is_valid = ast_ari_validate_date(
5361  if (!prop_is_valid) {
5362  ast_log(LOG_ERROR, "ARI ContactStatusChange field timestamp failed validation\n");
5363  res = 0;
5364  }
5365  } else
5366  if (strcmp("contact_info", ast_json_object_iter_key(iter)) == 0) {
5367  int prop_is_valid;
5368  has_contact_info = 1;
5369  prop_is_valid = ast_ari_validate_contact_info(
5371  if (!prop_is_valid) {
5372  ast_log(LOG_ERROR, "ARI ContactStatusChange field contact_info failed validation\n");
5373  res = 0;
5374  }
5375  } else
5376  if (strcmp("endpoint", ast_json_object_iter_key(iter)) == 0) {
5377  int prop_is_valid;
5378  has_endpoint = 1;
5379  prop_is_valid = ast_ari_validate_endpoint(
5381  if (!prop_is_valid) {
5382  ast_log(LOG_ERROR, "ARI ContactStatusChange field endpoint failed validation\n");
5383  res = 0;
5384  }
5385  } else
5386  {
5388  "ARI ContactStatusChange has undocumented field %s\n",
5389  ast_json_object_iter_key(iter));
5390  res = 0;
5391  }
5392  }
5393 
5394  if (!has_type) {
5395  ast_log(LOG_ERROR, "ARI ContactStatusChange missing required field type\n");
5396  res = 0;
5397  }
5398 
5399  if (!has_application) {
5400  ast_log(LOG_ERROR, "ARI ContactStatusChange missing required field application\n");
5401  res = 0;
5402  }
5403 
5404  if (!has_timestamp) {
5405  ast_log(LOG_ERROR, "ARI ContactStatusChange missing required field timestamp\n");
5406  res = 0;
5407  }
5408 
5409  if (!has_contact_info) {
5410  ast_log(LOG_ERROR, "ARI ContactStatusChange missing required field contact_info\n");
5411  res = 0;
5412  }
5413 
5414  if (!has_endpoint) {
5415  ast_log(LOG_ERROR, "ARI ContactStatusChange missing required field endpoint\n");
5416  res = 0;
5417  }
5418 
5419  return res;
5420 }
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_endpoint(struct ast_json *json)
Validator for Endpoint.
int ast_ari_validate_contact_info(struct ast_json *json)
Validator for ContactInfo.
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_contact_status_change_fn()

ari_validator ast_ari_validate_contact_status_change_fn ( void  )

Function pointer to ast_ari_validate_contact_status_change().

See ast_ari_model_validators.h for more details.

Definition at line 5422 of file ari_model_validators.c.

References ast_ari_validate_contact_status_change().

5423 {
5425 }
int ast_ari_validate_contact_status_change(struct ast_json *json)
Validator for ContactStatusChange.

◆ ast_ari_validate_date()

int ast_ari_validate_date ( struct ast_json json)

Validator for native Swagger date.

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

Definition at line 148 of file res_ari_model.c.

References ast_assert, AST_JSON_STRING, ast_json_string_get(), ast_log, check_type(), date_regex, LOG_ERROR, NULL, and str.

Referenced by ast_ari_validate_application_move_failed(), ast_ari_validate_application_replaced(), ast_ari_validate_bridge(), ast_ari_validate_bridge_attended_transfer(), ast_ari_validate_bridge_blind_transfer(), ast_ari_validate_bridge_created(), ast_ari_validate_bridge_destroyed(), ast_ari_validate_bridge_merged(), ast_ari_validate_bridge_video_source_changed(), ast_ari_validate_channel(), ast_ari_validate_channel_caller_id(), ast_ari_validate_channel_connected_line(), ast_ari_validate_channel_created(), ast_ari_validate_channel_destroyed(), ast_ari_validate_channel_dialplan(), ast_ari_validate_channel_dtmf_received(), ast_ari_validate_channel_entered_bridge(), ast_ari_validate_channel_hangup_request(), ast_ari_validate_channel_hold(), ast_ari_validate_channel_left_bridge(), ast_ari_validate_channel_state_change(), ast_ari_validate_channel_talking_finished(), ast_ari_validate_channel_talking_started(), ast_ari_validate_channel_unhold(), ast_ari_validate_channel_userevent(), ast_ari_validate_channel_varset(), ast_ari_validate_contact_status_change(), ast_ari_validate_device_state_changed(), ast_ari_validate_dial(), ast_ari_validate_endpoint_state_change(), ast_ari_validate_event(), ast_ari_validate_peer_status_change(), ast_ari_validate_playback_continuing(), ast_ari_validate_playback_finished(), ast_ari_validate_playback_started(), ast_ari_validate_recording_failed(), ast_ari_validate_recording_finished(), ast_ari_validate_recording_started(), ast_ari_validate_stasis_end(), ast_ari_validate_stasis_start(), ast_ari_validate_status_info(), ast_ari_validate_text_message_received(), and AST_TEST_DEFINE().

149 {
150  /* Dates are ISO-8601 strings */
151  const char *str;
152  if (!check_type(json, AST_JSON_STRING)) {
153  return 0;
154  }
155  str = ast_json_string_get(json);
156  ast_assert(str != NULL);
157  if (regexec(&date_regex, str, 0, NULL, 0) != 0) {
158  ast_log(LOG_ERROR, "Date field is malformed: '%s'\n", str);
159  return 0;
160  }
161  return 1;
162 }
static regex_t date_regex
Definition: res_ari_model.c:40
#define ast_assert(a)
Definition: utils.h:695
const char * str
Definition: app_jack.c:147
#define NULL
Definition: resample.c:96
static int check_type(struct ast_json *json, enum ast_json_type expected)
Definition: res_ari_model.c:55
#define ast_log
Definition: astobj2.c:42
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
Definition: json.c:273
#define LOG_ERROR
Definition: logger.h:285

◆ ast_ari_validate_device_state()

int ast_ari_validate_device_state ( struct ast_json json)

Validator for DeviceState.

Represents the state of a device.

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

Definition at line 2273 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_device_states_get_cb(), ast_ari_validate_device_state_changed(), and ast_ari_validate_device_state_fn().

2274 {
2275  int res = 1;
2276  struct ast_json_iter *iter;
2277  int has_name = 0;
2278  int has_state = 0;
2279 
2280  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2281  if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
2282  int prop_is_valid;
2283  has_name = 1;
2284  prop_is_valid = ast_ari_validate_string(
2286  if (!prop_is_valid) {
2287  ast_log(LOG_ERROR, "ARI DeviceState field name failed validation\n");
2288  res = 0;
2289  }
2290  } else
2291  if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
2292  int prop_is_valid;
2293  has_state = 1;
2294  prop_is_valid = ast_ari_validate_string(
2296  if (!prop_is_valid) {
2297  ast_log(LOG_ERROR, "ARI DeviceState field state failed validation\n");
2298  res = 0;
2299  }
2300  } else
2301  {
2303  "ARI DeviceState has undocumented field %s\n",
2304  ast_json_object_iter_key(iter));
2305  res = 0;
2306  }
2307  }
2308 
2309  if (!has_name) {
2310  ast_log(LOG_ERROR, "ARI DeviceState missing required field name\n");
2311  res = 0;
2312  }
2313 
2314  if (!has_state) {
2315  ast_log(LOG_ERROR, "ARI DeviceState missing required field state\n");
2316  res = 0;
2317  }
2318 
2319  return res;
2320 }
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_device_state_changed()

int ast_ari_validate_device_state_changed ( struct ast_json json)

Validator for DeviceStateChanged.

Notification that a device state has changed.

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

Definition at line 5427 of file ari_model_validators.c.

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

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

5428 {
5429  int res = 1;
5430  struct ast_json_iter *iter;
5431  int has_type = 0;
5432  int has_application = 0;
5433  int has_timestamp = 0;
5434  int has_device_state = 0;
5435 
5436  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
5437  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
5438  int prop_is_valid;
5439  prop_is_valid = ast_ari_validate_string(
5441  if (!prop_is_valid) {
5442  ast_log(LOG_ERROR, "ARI DeviceStateChanged field asterisk_id failed validation\n");
5443  res = 0;
5444  }
5445  } else
5446  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
5447  int prop_is_valid;
5448  has_type = 1;
5449  prop_is_valid = ast_ari_validate_string(
5451  if (!prop_is_valid) {
5452  ast_log(LOG_ERROR, "ARI DeviceStateChanged field type failed validation\n");
5453  res = 0;
5454  }
5455  } else
5456  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
5457  int prop_is_valid;
5458  has_application = 1;
5459  prop_is_valid = ast_ari_validate_string(
5461  if (!prop_is_valid) {
5462  ast_log(LOG_ERROR, "ARI DeviceStateChanged field application failed validation\n");
5463  res = 0;
5464  }
5465  } else
5466  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
5467  int prop_is_valid;
5468  has_timestamp = 1;
5469  prop_is_valid = ast_ari_validate_date(
5471  if (!prop_is_valid) {
5472  ast_log(LOG_ERROR, "ARI DeviceStateChanged field timestamp failed validation\n");
5473  res = 0;
5474  }
5475  } else
5476  if (strcmp("device_state", ast_json_object_iter_key(iter)) == 0) {
5477  int prop_is_valid;
5478  has_device_state = 1;
5479  prop_is_valid = ast_ari_validate_device_state(
5481  if (!prop_is_valid) {
5482  ast_log(LOG_ERROR, "ARI DeviceStateChanged field device_state failed validation\n");
5483  res = 0;
5484  }
5485  } else
5486  {
5488  "ARI DeviceStateChanged has undocumented field %s\n",
5489  ast_json_object_iter_key(iter));
5490  res = 0;
5491  }
5492  }
5493 
5494  if (!has_type) {
5495  ast_log(LOG_ERROR, "ARI DeviceStateChanged missing required field type\n");
5496  res = 0;
5497  }
5498 
5499  if (!has_application) {
5500  ast_log(LOG_ERROR, "ARI DeviceStateChanged missing required field application\n");
5501  res = 0;
5502  }
5503 
5504  if (!has_timestamp) {
5505  ast_log(LOG_ERROR, "ARI DeviceStateChanged missing required field timestamp\n");
5506  res = 0;
5507  }
5508 
5509  if (!has_device_state) {
5510  ast_log(LOG_ERROR, "ARI DeviceStateChanged missing required field device_state\n");
5511  res = 0;
5512  }
5513 
5514  return res;
5515 }
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_device_state(struct ast_json *json)
Validator for DeviceState.
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_device_state_changed_fn()

ari_validator ast_ari_validate_device_state_changed_fn ( void  )

Function pointer to ast_ari_validate_device_state_changed().

See ast_ari_model_validators.h for more details.

Definition at line 5517 of file ari_model_validators.c.

References ast_ari_validate_device_state_changed().

5518 {
5520 }
int ast_ari_validate_device_state_changed(struct ast_json *json)
Validator for DeviceStateChanged.

◆ ast_ari_validate_device_state_fn()

ari_validator ast_ari_validate_device_state_fn ( void  )

Function pointer to ast_ari_validate_device_state().

See ast_ari_model_validators.h for more details.

Definition at line 2322 of file ari_model_validators.c.

References ast_ari_validate_device_state().

Referenced by ast_ari_device_states_list_cb().

2323 {
2325 }
int ast_ari_validate_device_state(struct ast_json *json)
Validator for DeviceState.

◆ ast_ari_validate_dial()

int ast_ari_validate_dial ( struct ast_json json)

Validator for Dial.

Dialing state has changed.

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

Definition at line 5522 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_dial_fn(), ast_ari_validate_event(), and ast_ari_validate_message().

5523 {
5524  int res = 1;
5525  struct ast_json_iter *iter;
5526  int has_type = 0;
5527  int has_application = 0;
5528  int has_timestamp = 0;
5529  int has_dialstatus = 0;
5530  int has_peer = 0;
5531 
5532  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
5533  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
5534  int prop_is_valid;
5535  prop_is_valid = ast_ari_validate_string(
5537  if (!prop_is_valid) {
5538  ast_log(LOG_ERROR, "ARI Dial field asterisk_id failed validation\n");
5539  res = 0;
5540  }
5541  } else
5542  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
5543  int prop_is_valid;
5544  has_type = 1;
5545  prop_is_valid = ast_ari_validate_string(
5547  if (!prop_is_valid) {
5548  ast_log(LOG_ERROR, "ARI Dial field type failed validation\n");
5549  res = 0;
5550  }
5551  } else
5552  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
5553  int prop_is_valid;
5554  has_application = 1;
5555  prop_is_valid = ast_ari_validate_string(
5557  if (!prop_is_valid) {
5558  ast_log(LOG_ERROR, "ARI Dial field application failed validation\n");
5559  res = 0;
5560  }
5561  } else
5562  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
5563  int prop_is_valid;
5564  has_timestamp = 1;
5565  prop_is_valid = ast_ari_validate_date(
5567  if (!prop_is_valid) {
5568  ast_log(LOG_ERROR, "ARI Dial field timestamp failed validation\n");
5569  res = 0;
5570  }
5571  } else
5572  if (strcmp("caller", ast_json_object_iter_key(iter)) == 0) {
5573  int prop_is_valid;
5574  prop_is_valid = ast_ari_validate_channel(
5576  if (!prop_is_valid) {
5577  ast_log(LOG_ERROR, "ARI Dial field caller failed validation\n");
5578  res = 0;
5579  }
5580  } else
5581  if (strcmp("dialstatus", ast_json_object_iter_key(iter)) == 0) {
5582  int prop_is_valid;
5583  has_dialstatus = 1;
5584  prop_is_valid = ast_ari_validate_string(
5586  if (!prop_is_valid) {
5587  ast_log(LOG_ERROR, "ARI Dial field dialstatus failed validation\n");
5588  res = 0;
5589  }
5590  } else
5591  if (strcmp("dialstring", ast_json_object_iter_key(iter)) == 0) {
5592  int prop_is_valid;
5593  prop_is_valid = ast_ari_validate_string(
5595  if (!prop_is_valid) {
5596  ast_log(LOG_ERROR, "ARI Dial field dialstring failed validation\n");
5597  res = 0;
5598  }
5599  } else
5600  if (strcmp("forward", ast_json_object_iter_key(iter)) == 0) {
5601  int prop_is_valid;
5602  prop_is_valid = ast_ari_validate_string(
5604  if (!prop_is_valid) {
5605  ast_log(LOG_ERROR, "ARI Dial field forward failed validation\n");
5606  res = 0;
5607  }
5608  } else
5609  if (strcmp("forwarded", ast_json_object_iter_key(iter)) == 0) {
5610  int prop_is_valid;
5611  prop_is_valid = ast_ari_validate_channel(
5613  if (!prop_is_valid) {
5614  ast_log(LOG_ERROR, "ARI Dial field forwarded failed validation\n");
5615  res = 0;
5616  }
5617  } else
5618  if (strcmp("peer", ast_json_object_iter_key(iter)) == 0) {
5619  int prop_is_valid;
5620  has_peer = 1;
5621  prop_is_valid = ast_ari_validate_channel(
5623  if (!prop_is_valid) {
5624  ast_log(LOG_ERROR, "ARI Dial field peer failed validation\n");
5625  res = 0;
5626  }
5627  } else
5628  {
5630  "ARI Dial has undocumented field %s\n",
5631  ast_json_object_iter_key(iter));
5632  res = 0;
5633  }
5634  }
5635 
5636  if (!has_type) {
5637  ast_log(LOG_ERROR, "ARI Dial missing required field type\n");
5638  res = 0;
5639  }
5640 
5641  if (!has_application) {
5642  ast_log(LOG_ERROR, "ARI Dial missing required field application\n");
5643  res = 0;
5644  }
5645 
5646  if (!has_timestamp) {
5647  ast_log(LOG_ERROR, "ARI Dial missing required field timestamp\n");
5648  res = 0;
5649  }
5650 
5651  if (!has_dialstatus) {
5652  ast_log(LOG_ERROR, "ARI Dial missing required field dialstatus\n");
5653  res = 0;
5654  }
5655 
5656  if (!has_peer) {
5657  ast_log(LOG_ERROR, "ARI Dial missing required field peer\n");
5658  res = 0;
5659  }
5660 
5661  return res;
5662 }
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_dial_fn()

ari_validator ast_ari_validate_dial_fn ( void  )

Function pointer to ast_ari_validate_dial().

See ast_ari_model_validators.h for more details.

Definition at line 5664 of file ari_model_validators.c.

References ast_ari_validate_dial().

5665 {
5666  return ast_ari_validate_dial;
5667 }
int ast_ari_validate_dial(struct ast_json *json)
Validator for Dial.

◆ ast_ari_validate_dialed()

int ast_ari_validate_dialed ( struct ast_json json)

Validator for Dialed.

Dialed channel information.

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

Definition at line 1209 of file ari_model_validators.c.

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

Referenced by ast_ari_validate_dialed_fn().

1210 {
1211  int res = 1;
1212  struct ast_json_iter *iter;
1213 
1214  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1215  {
1217  "ARI Dialed has undocumented field %s\n",
1218  ast_json_object_iter_key(iter));
1219  res = 0;
1220  }
1221  }
1222 
1223  return res;
1224 }
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
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_dialed_fn()

ari_validator ast_ari_validate_dialed_fn ( void  )

Function pointer to ast_ari_validate_dialed().

See ast_ari_model_validators.h for more details.

Definition at line 1226 of file ari_model_validators.c.

References ast_ari_validate_dialed().

1227 {
1228  return ast_ari_validate_dialed;
1229 }
int ast_ari_validate_dialed(struct ast_json *json)
Validator for Dialed.

◆ ast_ari_validate_dialplan_cep()

int ast_ari_validate_dialplan_cep ( struct ast_json json)

Validator for DialplanCEP.

Dialplan location (context/extension/priority)

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

Definition at line 1231 of file ari_model_validators.c.

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

Referenced by ast_ari_validate_channel(), and ast_ari_validate_dialplan_cep_fn().

1232 {
1233  int res = 1;
1234  struct ast_json_iter *iter;
1235  int has_app_data = 0;
1236  int has_app_name = 0;
1237  int has_context = 0;
1238  int has_exten = 0;
1239  int has_priority = 0;
1240 
1241  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1242  if (strcmp("app_data", ast_json_object_iter_key(iter)) == 0) {
1243  int prop_is_valid;
1244  has_app_data = 1;
1245  prop_is_valid = ast_ari_validate_string(
1247  if (!prop_is_valid) {
1248  ast_log(LOG_ERROR, "ARI DialplanCEP field app_data failed validation\n");
1249  res = 0;
1250  }
1251  } else
1252  if (strcmp("app_name", ast_json_object_iter_key(iter)) == 0) {
1253  int prop_is_valid;
1254  has_app_name = 1;
1255  prop_is_valid = ast_ari_validate_string(
1257  if (!prop_is_valid) {
1258  ast_log(LOG_ERROR, "ARI DialplanCEP field app_name failed validation\n");
1259  res = 0;
1260  }
1261  } else
1262  if (strcmp("context", ast_json_object_iter_key(iter)) == 0) {
1263  int prop_is_valid;
1264  has_context = 1;
1265  prop_is_valid = ast_ari_validate_string(
1267  if (!prop_is_valid) {
1268  ast_log(LOG_ERROR, "ARI DialplanCEP field context failed validation\n");
1269  res = 0;
1270  }
1271  } else
1272  if (strcmp("exten", ast_json_object_iter_key(iter)) == 0) {
1273  int prop_is_valid;
1274  has_exten = 1;
1275  prop_is_valid = ast_ari_validate_string(
1277  if (!prop_is_valid) {
1278  ast_log(LOG_ERROR, "ARI DialplanCEP field exten failed validation\n");
1279  res = 0;
1280  }
1281  } else
1282  if (strcmp("priority", ast_json_object_iter_key(iter)) == 0) {
1283  int prop_is_valid;
1284  has_priority = 1;
1285  prop_is_valid = ast_ari_validate_long(
1287  if (!prop_is_valid) {
1288  ast_log(LOG_ERROR, "ARI DialplanCEP field priority failed validation\n");
1289  res = 0;
1290  }
1291  } else
1292  {
1294  "ARI DialplanCEP has undocumented field %s\n",
1295  ast_json_object_iter_key(iter));
1296  res = 0;
1297  }
1298  }
1299 
1300  if (!has_app_data) {
1301  ast_log(LOG_ERROR, "ARI DialplanCEP missing required field app_data\n");
1302  res = 0;
1303  }
1304 
1305  if (!has_app_name) {
1306  ast_log(LOG_ERROR, "ARI DialplanCEP missing required field app_name\n");
1307  res = 0;
1308  }
1309 
1310  if (!has_context) {
1311  ast_log(LOG_ERROR, "ARI DialplanCEP missing required field context\n");
1312  res = 0;
1313  }
1314 
1315  if (!has_exten) {
1316  ast_log(LOG_ERROR, "ARI DialplanCEP missing required field exten\n");
1317  res = 0;
1318  }
1319 
1320  if (!has_priority) {
1321  ast_log(LOG_ERROR, "ARI DialplanCEP missing required field priority\n");
1322  res = 0;
1323  }
1324 
1325  return res;
1326 }
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
int ast_ari_validate_long(struct ast_json *json)
Validator for native Swagger long.
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
static int has_priority(void)
Check whether we were set to high(er) priority.
Definition: asterisk.c:1736
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_dialplan_cep_fn()

ari_validator ast_ari_validate_dialplan_cep_fn ( void  )

Function pointer to ast_ari_validate_dialplan_cep().

See ast_ari_model_validators.h for more details.

Definition at line 1328 of file ari_model_validators.c.

References ast_ari_validate_dialplan_cep().

1329 {
1331 }
int ast_ari_validate_dialplan_cep(struct ast_json *json)
Validator for DialplanCEP.

◆ ast_ari_validate_double()

int ast_ari_validate_double ( struct ast_json json)

Validator for native Swagger double.

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

Definition at line 138 of file res_ari_model.c.

References AST_JSON_REAL, and check_type().

Referenced by ast_ari_validate_config_info(), and ast_ari_validate_rtpstat().

139 {
140  return check_type(json, AST_JSON_REAL);
141 }
static int check_type(struct ast_json *json, enum ast_json_type expected)
Definition: res_ari_model.c:55

◆ ast_ari_validate_endpoint()

int ast_ari_validate_endpoint ( struct ast_json json)

Validator for Endpoint.

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

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

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

Definition at line 821 of file ari_model_validators.c.

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

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

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

ari_validator ast_ari_validate_endpoint_fn ( void  )

Function pointer to ast_ari_validate_endpoint().

See ast_ari_model_validators.h for more details.

Definition at line 896 of file ari_model_validators.c.

References ast_ari_validate_endpoint().

Referenced by ast_ari_endpoints_list_by_tech_cb(), and ast_ari_endpoints_list_cb().

897 {
899 }
int ast_ari_validate_endpoint(struct ast_json *json)
Validator for Endpoint.

◆ ast_ari_validate_endpoint_state_change()

int ast_ari_validate_endpoint_state_change ( struct ast_json json)

Validator for EndpointStateChange.

Endpoint state changed.

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

Definition at line 5669 of file ari_model_validators.c.

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

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

5670 {
5671  int res = 1;
5672  struct ast_json_iter *iter;
5673  int has_type = 0;
5674  int has_application = 0;
5675  int has_timestamp = 0;
5676  int has_endpoint = 0;
5677 
5678  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
5679  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
5680  int prop_is_valid;
5681  prop_is_valid = ast_ari_validate_string(
5683  if (!prop_is_valid) {
5684  ast_log(LOG_ERROR, "ARI EndpointStateChange field asterisk_id failed validation\n");
5685  res = 0;
5686  }
5687  } else
5688  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
5689  int prop_is_valid;
5690  has_type = 1;
5691  prop_is_valid = ast_ari_validate_string(
5693  if (!prop_is_valid) {
5694  ast_log(LOG_ERROR, "ARI EndpointStateChange field type failed validation\n");
5695  res = 0;
5696  }
5697  } else
5698  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
5699  int prop_is_valid;
5700  has_application = 1;
5701  prop_is_valid = ast_ari_validate_string(
5703  if (!prop_is_valid) {
5704  ast_log(LOG_ERROR, "ARI EndpointStateChange field application failed validation\n");
5705  res = 0;
5706  }
5707  } else
5708  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
5709  int prop_is_valid;
5710  has_timestamp = 1;
5711  prop_is_valid = ast_ari_validate_date(
5713  if (!prop_is_valid) {
5714  ast_log(LOG_ERROR, "ARI EndpointStateChange field timestamp failed validation\n");
5715  res = 0;
5716  }
5717  } else
5718  if (strcmp("endpoint", ast_json_object_iter_key(iter)) == 0) {
5719  int prop_is_valid;
5720  has_endpoint = 1;
5721  prop_is_valid = ast_ari_validate_endpoint(
5723  if (!prop_is_valid) {
5724  ast_log(LOG_ERROR, "ARI EndpointStateChange field endpoint failed validation\n");
5725  res = 0;
5726  }
5727  } else
5728  {
5730  "ARI EndpointStateChange has undocumented field %s\n",
5731  ast_json_object_iter_key(iter));
5732  res = 0;
5733  }
5734  }
5735 
5736  if (!has_type) {
5737  ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field type\n");
5738  res = 0;
5739  }
5740 
5741  if (!has_application) {
5742  ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field application\n");
5743  res = 0;
5744  }
5745 
5746  if (!has_timestamp) {
5747  ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field timestamp\n");
5748  res = 0;
5749  }
5750 
5751  if (!has_endpoint) {
5752  ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field endpoint\n");
5753  res = 0;
5754  }
5755 
5756  return res;
5757 }
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_endpoint(struct ast_json *json)
Validator for Endpoint.
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_endpoint_state_change_fn()

ari_validator ast_ari_validate_endpoint_state_change_fn ( void  )

Function pointer to ast_ari_validate_endpoint_state_change().

See ast_ari_model_validators.h for more details.

Definition at line 5759 of file ari_model_validators.c.

References ast_ari_validate_endpoint_state_change().

5760 {
5762 }
int ast_ari_validate_endpoint_state_change(struct ast_json *json)
Validator for EndpointStateChange.

◆ ast_ari_validate_event()

int ast_ari_validate_event ( struct ast_json json)

Validator for Event.

Base type for asynchronous events from Asterisk.

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

Definition at line 5764 of file ari_model_validators.c.

References ast_ari_validate_application_move_failed(), ast_ari_validate_application_replaced(), ast_ari_validate_bridge_attended_transfer(), ast_ari_validate_bridge_blind_transfer(), ast_ari_validate_bridge_created(), ast_ari_validate_bridge_destroyed(), ast_ari_validate_bridge_merged(), ast_ari_validate_bridge_video_source_changed(), ast_ari_validate_channel_caller_id(), ast_ari_validate_channel_connected_line(), ast_ari_validate_channel_created(), ast_ari_validate_channel_destroyed(), ast_ari_validate_channel_dialplan(), ast_ari_validate_channel_dtmf_received(), ast_ari_validate_channel_entered_bridge(), ast_ari_validate_channel_hangup_request(), ast_ari_validate_channel_hold(), ast_ari_validate_channel_left_bridge(), ast_ari_validate_channel_state_change(), ast_ari_validate_channel_talking_finished(), ast_ari_validate_channel_talking_started(), ast_ari_validate_channel_unhold(), ast_ari_validate_channel_userevent(), ast_ari_validate_channel_varset(), ast_ari_validate_contact_status_change(), ast_ari_validate_date(), ast_ari_validate_device_state_changed(), ast_ari_validate_dial(), ast_ari_validate_endpoint_state_change(), ast_ari_validate_peer_status_change(), ast_ari_validate_playback_continuing(), ast_ari_validate_playback_finished(), ast_ari_validate_playback_started(), ast_ari_validate_recording_failed(), ast_ari_validate_recording_finished(), ast_ari_validate_recording_started(), ast_ari_validate_stasis_end(), ast_ari_validate_stasis_start(), ast_ari_validate_string(), ast_ari_validate_text_message_received(), ast_json_object_get(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_json_string_get(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_event_fn(), and ast_ari_validate_message().

5765 {
5766  int res = 1;
5767  struct ast_json_iter *iter;
5768  int has_type = 0;
5769  int has_application = 0;
5770  int has_timestamp = 0;
5771  const char *discriminator;
5772 
5773  discriminator = ast_json_string_get(ast_json_object_get(json, "type"));
5774  if (!discriminator) {
5775  ast_log(LOG_ERROR, "ARI Event missing required field type\n");
5776  return 0;
5777  }
5778 
5779  if (strcmp("Event", discriminator) == 0) {
5780  /* Self type; fall through */
5781  } else
5782  if (strcmp("ApplicationMoveFailed", discriminator) == 0) {
5784  } else
5785  if (strcmp("ApplicationReplaced", discriminator) == 0) {
5787  } else
5788  if (strcmp("BridgeAttendedTransfer", discriminator) == 0) {
5790  } else
5791  if (strcmp("BridgeBlindTransfer", discriminator) == 0) {
5793  } else
5794  if (strcmp("BridgeCreated", discriminator) == 0) {
5795  return ast_ari_validate_bridge_created(json);
5796  } else
5797  if (strcmp("BridgeDestroyed", discriminator) == 0) {
5798  return ast_ari_validate_bridge_destroyed(json);
5799  } else
5800  if (strcmp("BridgeMerged", discriminator) == 0) {
5801  return ast_ari_validate_bridge_merged(json);
5802  } else
5803  if (strcmp("BridgeVideoSourceChanged", discriminator) == 0) {
5805  } else
5806  if (strcmp("ChannelCallerId", discriminator) == 0) {
5808  } else
5809  if (strcmp("ChannelConnectedLine", discriminator) == 0) {
5811  } else
5812  if (strcmp("ChannelCreated", discriminator) == 0) {
5813  return ast_ari_validate_channel_created(json);
5814  } else
5815  if (strcmp("ChannelDestroyed", discriminator) == 0) {
5817  } else
5818  if (strcmp("ChannelDialplan", discriminator) == 0) {
5819  return ast_ari_validate_channel_dialplan(json);
5820  } else
5821  if (strcmp("ChannelDtmfReceived", discriminator) == 0) {
5823  } else
5824  if (strcmp("ChannelEnteredBridge", discriminator) == 0) {
5826  } else
5827  if (strcmp("ChannelHangupRequest", discriminator) == 0) {
5829  } else
5830  if (strcmp("ChannelHold", discriminator) == 0) {
5831  return ast_ari_validate_channel_hold(json);
5832  } else
5833  if (strcmp("ChannelLeftBridge", discriminator) == 0) {
5835  } else
5836  if (strcmp("ChannelStateChange", discriminator) == 0) {
5838  } else
5839  if (strcmp("ChannelTalkingFinished", discriminator) == 0) {
5841  } else
5842  if (strcmp("ChannelTalkingStarted", discriminator) == 0) {
5844  } else
5845  if (strcmp("ChannelUnhold", discriminator) == 0) {
5846  return ast_ari_validate_channel_unhold(json);
5847  } else
5848  if (strcmp("ChannelUserevent", discriminator) == 0) {
5850  } else
5851  if (strcmp("ChannelVarset", discriminator) == 0) {
5852  return ast_ari_validate_channel_varset(json);
5853  } else
5854  if (strcmp("ContactStatusChange", discriminator) == 0) {
5856  } else
5857  if (strcmp("DeviceStateChanged", discriminator) == 0) {
5859  } else
5860  if (strcmp("Dial", discriminator) == 0) {
5861  return ast_ari_validate_dial(json);
5862  } else
5863  if (strcmp("EndpointStateChange", discriminator) == 0) {
5865  } else
5866  if (strcmp("PeerStatusChange", discriminator) == 0) {
5868  } else
5869  if (strcmp("PlaybackContinuing", discriminator) == 0) {
5871  } else
5872  if (strcmp("PlaybackFinished", discriminator) == 0) {
5874  } else
5875  if (strcmp("PlaybackStarted", discriminator) == 0) {
5876  return ast_ari_validate_playback_started(json);
5877  } else
5878  if (strcmp("RecordingFailed", discriminator) == 0) {
5879  return ast_ari_validate_recording_failed(json);
5880  } else
5881  if (strcmp("RecordingFinished", discriminator) == 0) {
5883  } else
5884  if (strcmp("RecordingStarted", discriminator) == 0) {
5886  } else
5887  if (strcmp("StasisEnd", discriminator) == 0) {
5888  return ast_ari_validate_stasis_end(json);
5889  } else
5890  if (strcmp("StasisStart", discriminator) == 0) {
5891  return ast_ari_validate_stasis_start(json);
5892  } else
5893  if (strcmp("TextMessageReceived", discriminator) == 0) {
5895  } else
5896  {
5897  ast_log(LOG_ERROR, "ARI Event has undocumented subtype %s\n",
5898  discriminator);
5899  res = 0;
5900  }
5901 
5902  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
5903  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
5904  int prop_is_valid;
5905  prop_is_valid = ast_ari_validate_string(
5907  if (!prop_is_valid) {
5908  ast_log(LOG_ERROR, "ARI Event field asterisk_id failed validation\n");
5909  res = 0;
5910  }
5911  } else
5912  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
5913  int prop_is_valid;
5914  has_type = 1;
5915  prop_is_valid = ast_ari_validate_string(
5917  if (!prop_is_valid) {
5918  ast_log(LOG_ERROR, "ARI Event field type failed validation\n");
5919  res = 0;
5920  }
5921  } else
5922  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
5923  int prop_is_valid;
5924  has_application = 1;
5925  prop_is_valid = ast_ari_validate_string(
5927  if (!prop_is_valid) {
5928  ast_log(LOG_ERROR, "ARI Event field application failed validation\n");
5929  res = 0;
5930  }
5931  } else
5932  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
5933  int prop_is_valid;
5934  has_timestamp = 1;
5935  prop_is_valid = ast_ari_validate_date(
5937  if (!prop_is_valid) {
5938  ast_log(LOG_ERROR, "ARI Event field timestamp failed validation\n");
5939  res = 0;
5940  }
5941  } else
5942  {
5944  "ARI Event has undocumented field %s\n",
5945  ast_json_object_iter_key(iter));
5946  res = 0;
5947  }
5948  }
5949 
5950  if (!has_type) {
5951  ast_log(LOG_ERROR, "ARI Event missing required field type\n");
5952  res = 0;
5953  }
5954 
5955  if (!has_application) {
5956  ast_log(LOG_ERROR, "ARI Event missing required field application\n");
5957  res = 0;
5958  }
5959 
5960  if (!has_timestamp) {
5961  ast_log(LOG_ERROR, "ARI Event missing required field timestamp\n");
5962  res = 0;
5963  }
5964 
5965  return res;
5966 }
int ast_ari_validate_text_message_received(struct ast_json *json)
Validator for TextMessageReceived.
int ast_ari_validate_peer_status_change(struct ast_json *json)
Validator for PeerStatusChange.
int ast_ari_validate_channel_state_change(struct ast_json *json)
Validator for ChannelStateChange.
int ast_ari_validate_recording_started(struct ast_json *json)
Validator for RecordingStarted.
int ast_ari_validate_endpoint_state_change(struct ast_json *json)
Validator for EndpointStateChange.
int ast_ari_validate_channel_connected_line(struct ast_json *json)
Validator for ChannelConnectedLine.
int ast_ari_validate_bridge_blind_transfer(struct ast_json *json)
Validator for BridgeBlindTransfer.
int ast_ari_validate_channel_userevent(struct ast_json *json)
Validator for ChannelUserevent.
Iterator for JSON object key/values.
int ast_ari_validate_channel_created(struct ast_json *json)
Validator for ChannelCreated.
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_channel_hold(struct ast_json *json)
Validator for ChannelHold.
int ast_ari_validate_stasis_start(struct ast_json *json)
Validator for StasisStart.
int ast_ari_validate_bridge_attended_transfer(struct ast_json *json)
Validator for BridgeAttendedTransfer.
int ast_ari_validate_channel_caller_id(struct ast_json *json)
Validator for ChannelCallerId.
int ast_ari_validate_channel_varset(struct ast_json *json)
Validator for ChannelVarset.
int ast_ari_validate_recording_failed(struct ast_json *json)
Validator for RecordingFailed.
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
#define ast_log
Definition: astobj2.c:42
int ast_ari_validate_application_replaced(struct ast_json *json)
Validator for ApplicationReplaced.
int ast_ari_validate_contact_status_change(struct ast_json *json)
Validator for ContactStatusChange.
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_channel_destroyed(struct ast_json *json)
Validator for ChannelDestroyed.
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
Definition: json.c:273
int ast_ari_validate_bridge_video_source_changed(struct ast_json *json)
Validator for BridgeVideoSourceChanged.
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
int ast_ari_validate_channel_dtmf_received(struct ast_json *json)
Validator for ChannelDtmfReceived.
int ast_ari_validate_channel_unhold(struct ast_json *json)
Validator for ChannelUnhold.
int ast_ari_validate_channel_talking_finished(struct ast_json *json)
Validator for ChannelTalkingFinished.
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_application_move_failed(struct ast_json *json)
Validator for ApplicationMoveFailed.
int ast_ari_validate_bridge_destroyed(struct ast_json *json)
Validator for BridgeDestroyed.
int ast_ari_validate_dial(struct ast_json *json)
Validator for Dial.
int ast_ari_validate_playback_finished(struct ast_json *json)
Validator for PlaybackFinished.
int ast_ari_validate_recording_finished(struct ast_json *json)
Validator for RecordingFinished.
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
int ast_ari_validate_channel_entered_bridge(struct ast_json *json)
Validator for ChannelEnteredBridge.
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
Definition: json.c:397
int ast_ari_validate_playback_started(struct ast_json *json)
Validator for PlaybackStarted.
int ast_ari_validate_playback_continuing(struct ast_json *json)
Validator for PlaybackContinuing.
int ast_ari_validate_stasis_end(struct ast_json *json)
Validator for StasisEnd.
int ast_ari_validate_channel_left_bridge(struct ast_json *json)
Validator for ChannelLeftBridge.
int ast_ari_validate_channel_talking_started(struct ast_json *json)
Validator for ChannelTalkingStarted.
int ast_ari_validate_bridge_created(struct ast_json *json)
Validator for BridgeCreated.
int ast_ari_validate_channel_dialplan(struct ast_json *json)
Validator for ChannelDialplan.
int ast_ari_validate_bridge_merged(struct ast_json *json)
Validator for BridgeMerged.
int ast_ari_validate_device_state_changed(struct ast_json *json)
Validator for DeviceStateChanged.
int ast_ari_validate_channel_hangup_request(struct ast_json *json)
Validator for ChannelHangupRequest.
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_event_fn()

ari_validator ast_ari_validate_event_fn ( void  )

Function pointer to ast_ari_validate_event().

See ast_ari_model_validators.h for more details.

Definition at line 5968 of file ari_model_validators.c.

References ast_ari_validate_event().

5969 {
5970  return ast_ari_validate_event;
5971 }
int ast_ari_validate_event(struct ast_json *json)
Validator for Event.

◆ ast_ari_validate_float()

int ast_ari_validate_float ( struct ast_json json)

Validator for native Swagger float.

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

Definition at line 133 of file res_ari_model.c.

References AST_JSON_REAL, and check_type().

134 {
135  return check_type(json, AST_JSON_REAL);
136 }
static int check_type(struct ast_json *json, enum ast_json_type expected)
Definition: res_ari_model.c:55

◆ ast_ari_validate_format_lang_pair()

int ast_ari_validate_format_lang_pair ( struct ast_json json)

Validator for FormatLangPair.

Identifies the format and language of a sound file

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

Definition at line 2051 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_format_lang_pair_fn(), and ast_ari_validate_sound().

2052 {
2053  int res = 1;
2054  struct ast_json_iter *iter;
2055  int has_format = 0;
2056  int has_language = 0;
2057 
2058  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2059  if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
2060  int prop_is_valid;
2061  has_format = 1;
2062  prop_is_valid = ast_ari_validate_string(
2064  if (!prop_is_valid) {
2065  ast_log(LOG_ERROR, "ARI FormatLangPair field format failed validation\n");
2066  res = 0;
2067  }
2068  } else
2069  if (strcmp("language", ast_json_object_iter_key(iter)) == 0) {
2070  int prop_is_valid;
2071  has_language = 1;
2072  prop_is_valid = ast_ari_validate_string(
2074  if (!prop_is_valid) {
2075  ast_log(LOG_ERROR, "ARI FormatLangPair field language failed validation\n");
2076  res = 0;
2077  }
2078  } else
2079  {
2081  "ARI FormatLangPair has undocumented field %s\n",
2082  ast_json_object_iter_key(iter));
2083  res = 0;
2084  }
2085  }
2086 
2087  if (!has_format) {
2088  ast_log(LOG_ERROR, "ARI FormatLangPair missing required field format\n");
2089  res = 0;
2090  }
2091 
2092  if (!has_language) {
2093  ast_log(LOG_ERROR, "ARI FormatLangPair missing required field language\n");
2094  res = 0;
2095  }
2096 
2097  return res;
2098 }
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_format_lang_pair_fn()

ari_validator ast_ari_validate_format_lang_pair_fn ( void  )

Function pointer to ast_ari_validate_format_lang_pair().

See ast_ari_model_validators.h for more details.

Definition at line 2100 of file ari_model_validators.c.

References ast_ari_validate_format_lang_pair().

2101 {
2103 }
int ast_ari_validate_format_lang_pair(struct ast_json *json)
Validator for FormatLangPair.

◆ ast_ari_validate_int()

int ast_ari_validate_int ( struct ast_json json)

Validator for native Swagger int.

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

Definition at line 121 of file res_ari_model.c.

References check_range().

Referenced by ast_ari_validate_channel_caller_id(), ast_ari_validate_channel_destroyed(), ast_ari_validate_channel_dtmf_received(), ast_ari_validate_channel_hangup_request(), ast_ari_validate_channel_talking_finished(), ast_ari_validate_config_info(), ast_ari_validate_live_recording(), ast_ari_validate_mailbox(), ast_ari_validate_module(), ast_ari_validate_rtpstat(), AST_TEST_DEFINE(), and wrap_ast_ari_validate_int().

122 {
123  /* Swagger int's are 32-bit */
124  return check_range(-2147483648LL, 2147483647LL, json);
125 }
static int check_range(intmax_t minval, intmax_t maxval, struct ast_json *json)
Definition: res_ari_model.c:74

◆ ast_ari_validate_list()

int ast_ari_validate_list ( struct ast_json json,
int(*)(struct ast_json *)  fn 
)

Validator for a Swagger List[]/JSON array.

Parameters
jsonJSON object to validate.
fnValidator to call on every element in the array.
Returns
True (non-zero) if valid.
False (zero) if invalid.

Definition at line 164 of file res_ari_model.c.

References AST_JSON_ARRAY, ast_json_array_get(), ast_json_array_size(), ast_log, check_type(), and LOG_ERROR.

Referenced by ast_ari_applications_list_cb(), ast_ari_asterisk_get_object_cb(), ast_ari_asterisk_list_log_channels_cb(), ast_ari_asterisk_list_modules_cb(), ast_ari_asterisk_update_object_cb(), ast_ari_bridges_list_cb(), ast_ari_channels_list_cb(), ast_ari_device_states_list_cb(), ast_ari_endpoints_list_by_tech_cb(), ast_ari_endpoints_list_cb(), ast_ari_mailboxes_list_cb(), ast_ari_recordings_list_stored_cb(), ast_ari_sounds_list_cb(), ast_ari_validate_application(), ast_ari_validate_application_move_failed(), ast_ari_validate_bridge(), ast_ari_validate_endpoint(), ast_ari_validate_missing_params(), ast_ari_validate_sound(), ast_ari_validate_stasis_start(), and AST_TEST_DEFINE().

165 {
166  int res = 1;
167  size_t i;
168 
169  if (!check_type(json, AST_JSON_ARRAY)) {
170  return 0;
171  }
172 
173  for (i = 0; i < ast_json_array_size(json); ++i) {
174  int member_res;
175  member_res = fn(ast_json_array_get(json, i));
176  if (!member_res) {
178  "Array member %zu failed validation\n", i);
179  res = 0;
180  }
181  }
182 
183  return res;
184 }
static int check_type(struct ast_json *json, enum ast_json_type expected)
Definition: res_ari_model.c:55
#define ast_log
Definition: astobj2.c:42
#define LOG_ERROR
Definition: logger.h:285
size_t ast_json_array_size(const struct ast_json *array)
Get the size of a JSON array.
Definition: json.c:356
struct ast_json * ast_json_array_get(const struct ast_json *array, size_t index)
Get an element from an array.
Definition: json.c:360

◆ ast_ari_validate_live_recording()

int ast_ari_validate_live_recording ( struct ast_json json)

Validator for LiveRecording.

A recording that is in progress

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

Definition at line 1875 of file ari_model_validators.c.

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

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

1876 {
1877  int res = 1;
1878  struct ast_json_iter *iter;
1879  int has_format = 0;
1880  int has_name = 0;
1881  int has_state = 0;
1882  int has_target_uri = 0;
1883 
1884  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1885  if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
1886  int prop_is_valid;
1887  prop_is_valid = ast_ari_validate_string(
1889  if (!prop_is_valid) {
1890  ast_log(LOG_ERROR, "ARI LiveRecording field cause failed validation\n");
1891  res = 0;
1892  }
1893  } else
1894  if (strcmp("duration", ast_json_object_iter_key(iter)) == 0) {
1895  int prop_is_valid;
1896  prop_is_valid = ast_ari_validate_int(
1898  if (!prop_is_valid) {
1899  ast_log(LOG_ERROR, "ARI LiveRecording field duration failed validation\n");
1900  res = 0;
1901  }
1902  } else
1903  if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
1904  int prop_is_valid;
1905  has_format = 1;
1906  prop_is_valid = ast_ari_validate_string(
1908  if (!prop_is_valid) {
1909  ast_log(LOG_ERROR, "ARI LiveRecording field format failed validation\n");
1910  res = 0;
1911  }
1912  } else
1913  if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1914  int prop_is_valid;
1915  has_name = 1;
1916  prop_is_valid = ast_ari_validate_string(
1918  if (!prop_is_valid) {
1919  ast_log(LOG_ERROR, "ARI LiveRecording field name failed validation\n");
1920  res = 0;
1921  }
1922  } else
1923  if (strcmp("silence_duration", ast_json_object_iter_key(iter)) == 0) {
1924  int prop_is_valid;
1925  prop_is_valid = ast_ari_validate_int(
1927  if (!prop_is_valid) {
1928  ast_log(LOG_ERROR, "ARI LiveRecording field silence_duration failed validation\n");
1929  res = 0;
1930  }
1931  } else
1932  if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
1933  int prop_is_valid;
1934  has_state = 1;
1935  prop_is_valid = ast_ari_validate_string(
1937  if (!prop_is_valid) {
1938  ast_log(LOG_ERROR, "ARI LiveRecording field state failed validation\n");
1939  res = 0;
1940  }
1941  } else
1942  if (strcmp("talking_duration", ast_json_object_iter_key(iter)) == 0) {
1943  int prop_is_valid;
1944  prop_is_valid = ast_ari_validate_int(
1946  if (!prop_is_valid) {
1947  ast_log(LOG_ERROR, "ARI LiveRecording field talking_duration failed validation\n");
1948  res = 0;
1949  }
1950  } else
1951  if (strcmp("target_uri", ast_json_object_iter_key(iter)) == 0) {
1952  int prop_is_valid;
1953  has_target_uri = 1;
1954  prop_is_valid = ast_ari_validate_string(
1956  if (!prop_is_valid) {
1957  ast_log(LOG_ERROR, "ARI LiveRecording field target_uri failed validation\n");
1958  res = 0;
1959  }
1960  } else
1961  {
1963  "ARI LiveRecording has undocumented field %s\n",
1964  ast_json_object_iter_key(iter));
1965  res = 0;
1966  }
1967  }
1968 
1969  if (!has_format) {
1970  ast_log(LOG_ERROR, "ARI LiveRecording missing required field format\n");
1971  res = 0;
1972  }
1973 
1974  if (!has_name) {
1975  ast_log(LOG_ERROR, "ARI LiveRecording missing required field name\n");
1976  res = 0;
1977  }
1978 
1979  if (!has_state) {
1980  ast_log(LOG_ERROR, "ARI LiveRecording missing required field state\n");
1981  res = 0;
1982  }
1983 
1984  if (!has_target_uri) {
1985  ast_log(LOG_ERROR, "ARI LiveRecording missing required field target_uri\n");
1986  res = 0;
1987  }
1988 
1989  return res;
1990 }
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_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_live_recording_fn()

ari_validator ast_ari_validate_live_recording_fn ( void  )

Function pointer to ast_ari_validate_live_recording().

See ast_ari_model_validators.h for more details.

Definition at line 1992 of file ari_model_validators.c.

References ast_ari_validate_live_recording().

1993 {
1995 }
int ast_ari_validate_live_recording(struct ast_json *json)
Validator for LiveRecording.

◆ ast_ari_validate_log_channel()

int ast_ari_validate_log_channel ( struct ast_json json)

Validator for LogChannel.

Details of an Asterisk log channel

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

Definition at line 433 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_log_channel_fn().

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

ari_validator ast_ari_validate_log_channel_fn ( void  )

Function pointer to ast_ari_validate_log_channel().

See ast_ari_model_validators.h for more details.

Definition at line 514 of file ari_model_validators.c.

References ast_ari_validate_log_channel().

Referenced by ast_ari_asterisk_list_log_channels_cb().

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

◆ ast_ari_validate_long()

int ast_ari_validate_long ( struct ast_json json)

Validator for native Swagger long.

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

Definition at line 127 of file res_ari_model.c.

References AST_JSON_INTEGER, and check_type().

Referenced by ast_ari_validate_dialplan_cep(), and AST_TEST_DEFINE().

128 {
129  /* All integral values are valid longs. No need for range check. */
130  return check_type(json, AST_JSON_INTEGER);
131 }
static int check_type(struct ast_json *json, enum ast_json_type expected)
Definition: res_ari_model.c:55

◆ ast_ari_validate_mailbox()

int ast_ari_validate_mailbox ( struct ast_json json)

Validator for Mailbox.

Represents the state of a mailbox.

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

Definition at line 2327 of file ari_model_validators.c.

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

Referenced by ast_ari_mailboxes_get_cb(), and ast_ari_validate_mailbox_fn().

2328 {
2329  int res = 1;
2330  struct ast_json_iter *iter;
2331  int has_name = 0;
2332  int has_new_messages = 0;
2333  int has_old_messages = 0;
2334 
2335  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2336  if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
2337  int prop_is_valid;
2338  has_name = 1;
2339  prop_is_valid = ast_ari_validate_string(
2341  if (!prop_is_valid) {
2342  ast_log(LOG_ERROR, "ARI Mailbox field name failed validation\n");
2343  res = 0;
2344  }
2345  } else
2346  if (strcmp("new_messages", ast_json_object_iter_key(iter)) == 0) {
2347  int prop_is_valid;
2348  has_new_messages = 1;
2349  prop_is_valid = ast_ari_validate_int(
2351  if (!prop_is_valid) {
2352  ast_log(LOG_ERROR, "ARI Mailbox field new_messages failed validation\n");
2353  res = 0;
2354  }
2355  } else
2356  if (strcmp("old_messages", ast_json_object_iter_key(iter)) == 0) {
2357  int prop_is_valid;
2358  has_old_messages = 1;
2359  prop_is_valid = ast_ari_validate_int(
2361  if (!prop_is_valid) {
2362  ast_log(LOG_ERROR, "ARI Mailbox field old_messages failed validation\n");
2363  res = 0;
2364  }
2365  } else
2366  {
2368  "ARI Mailbox has undocumented field %s\n",
2369  ast_json_object_iter_key(iter));
2370  res = 0;
2371  }
2372  }
2373 
2374  if (!has_name) {
2375  ast_log(LOG_ERROR, "ARI Mailbox missing required field name\n");
2376  res = 0;
2377  }
2378 
2379  if (!has_new_messages) {
2380  ast_log(LOG_ERROR, "ARI Mailbox missing required field new_messages\n");
2381  res = 0;
2382  }
2383 
2384  if (!has_old_messages) {
2385  ast_log(LOG_ERROR, "ARI Mailbox missing required field old_messages\n");
2386  res = 0;
2387  }
2388 
2389  return res;
2390 }
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_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_mailbox_fn()

ari_validator ast_ari_validate_mailbox_fn ( void  )

Function pointer to ast_ari_validate_mailbox().

See ast_ari_model_validators.h for more details.

Definition at line 2392 of file ari_model_validators.c.

References ast_ari_validate_mailbox().

Referenced by ast_ari_mailboxes_list_cb().

2393 {
2394  return ast_ari_validate_mailbox;
2395 }
int ast_ari_validate_mailbox(struct ast_json *json)
Validator for Mailbox.

◆ ast_ari_validate_message()

int ast_ari_validate_message ( struct ast_json json)

Validator for Message.

Base type for errors and events

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

Definition at line 5973 of file ari_model_validators.c.

References ast_ari_validate_application_move_failed(), ast_ari_validate_application_replaced(), ast_ari_validate_bridge_attended_transfer(), ast_ari_validate_bridge_blind_transfer(), ast_ari_validate_bridge_created(), ast_ari_validate_bridge_destroyed(), ast_ari_validate_bridge_merged(), ast_ari_validate_bridge_video_source_changed(), ast_ari_validate_channel_caller_id(), ast_ari_validate_channel_connected_line(), ast_ari_validate_channel_created(), ast_ari_validate_channel_destroyed(), ast_ari_validate_channel_dialplan(), ast_ari_validate_channel_dtmf_received(), ast_ari_validate_channel_entered_bridge(), ast_ari_validate_channel_hangup_request(), ast_ari_validate_channel_hold(), ast_ari_validate_channel_left_bridge(), ast_ari_validate_channel_state_change(), ast_ari_validate_channel_talking_finished(), ast_ari_validate_channel_talking_started(), ast_ari_validate_channel_unhold(), ast_ari_validate_channel_userevent(), ast_ari_validate_channel_varset(), ast_ari_validate_contact_status_change(), ast_ari_validate_device_state_changed(), ast_ari_validate_dial(), ast_ari_validate_endpoint_state_change(), ast_ari_validate_event(), ast_ari_validate_missing_params(), ast_ari_validate_peer_status_change(), ast_ari_validate_playback_continuing(), ast_ari_validate_playback_finished(), ast_ari_validate_playback_started(), ast_ari_validate_recording_failed(), ast_ari_validate_recording_finished(), ast_ari_validate_recording_started(), ast_ari_validate_stasis_end(), ast_ari_validate_stasis_start(), ast_ari_validate_string(), ast_ari_validate_text_message_received(), ast_json_object_get(), ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), ast_json_string_get(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_message_fn().

5974 {
5975  int res = 1;
5976  struct ast_json_iter *iter;
5977  int has_type = 0;
5978  const char *discriminator;
5979 
5980  discriminator = ast_json_string_get(ast_json_object_get(json, "type"));
5981  if (!discriminator) {
5982  ast_log(LOG_ERROR, "ARI Message missing required field type\n");
5983  return 0;
5984  }
5985 
5986  if (strcmp("Message", discriminator) == 0) {
5987  /* Self type; fall through */
5988  } else
5989  if (strcmp("ApplicationMoveFailed", discriminator) == 0) {
5991  } else
5992  if (strcmp("ApplicationReplaced", discriminator) == 0) {
5994  } else
5995  if (strcmp("BridgeAttendedTransfer", discriminator) == 0) {
5997  } else
5998  if (strcmp("BridgeBlindTransfer", discriminator) == 0) {
6000  } else
6001  if (strcmp("BridgeCreated", discriminator) == 0) {
6002  return ast_ari_validate_bridge_created(json);
6003  } else
6004  if (strcmp("BridgeDestroyed", discriminator) == 0) {
6005  return ast_ari_validate_bridge_destroyed(json);
6006  } else
6007  if (strcmp("BridgeMerged", discriminator) == 0) {
6008  return ast_ari_validate_bridge_merged(json);
6009  } else
6010  if (strcmp("BridgeVideoSourceChanged", discriminator) == 0) {
6012  } else
6013  if (strcmp("ChannelCallerId", discriminator) == 0) {
6015  } else
6016  if (strcmp("ChannelConnectedLine", discriminator) == 0) {
6018  } else
6019  if (strcmp("ChannelCreated", discriminator) == 0) {
6020  return ast_ari_validate_channel_created(json);
6021  } else
6022  if (strcmp("ChannelDestroyed", discriminator) == 0) {
6024  } else
6025  if (strcmp("ChannelDialplan", discriminator) == 0) {
6026  return ast_ari_validate_channel_dialplan(json);
6027  } else
6028  if (strcmp("ChannelDtmfReceived", discriminator) == 0) {
6030  } else
6031  if (strcmp("ChannelEnteredBridge", discriminator) == 0) {
6033  } else
6034  if (strcmp("ChannelHangupRequest", discriminator) == 0) {
6036  } else
6037  if (strcmp("ChannelHold", discriminator) == 0) {
6038  return ast_ari_validate_channel_hold(json);
6039  } else
6040  if (strcmp("ChannelLeftBridge", discriminator) == 0) {
6042  } else
6043  if (strcmp("ChannelStateChange", discriminator) == 0) {
6045  } else
6046  if (strcmp("ChannelTalkingFinished", discriminator) == 0) {
6048  } else
6049  if (strcmp("ChannelTalkingStarted", discriminator) == 0) {
6051  } else
6052  if (strcmp("ChannelUnhold", discriminator) == 0) {
6053  return ast_ari_validate_channel_unhold(json);
6054  } else
6055  if (strcmp("ChannelUserevent", discriminator) == 0) {
6057  } else
6058  if (strcmp("ChannelVarset", discriminator) == 0) {
6059  return ast_ari_validate_channel_varset(json);
6060  } else
6061  if (strcmp("ContactStatusChange", discriminator) == 0) {
6063  } else
6064  if (strcmp("DeviceStateChanged", discriminator) == 0) {
6066  } else
6067  if (strcmp("Dial", discriminator) == 0) {
6068  return ast_ari_validate_dial(json);
6069  } else
6070  if (strcmp("EndpointStateChange", discriminator) == 0) {
6072  } else
6073  if (strcmp("Event", discriminator) == 0) {
6074  return ast_ari_validate_event(json);
6075  } else
6076  if (strcmp("MissingParams", discriminator) == 0) {
6077  return ast_ari_validate_missing_params(json);
6078  } else
6079  if (strcmp("PeerStatusChange", discriminator) == 0) {
6081  } else
6082  if (strcmp("PlaybackContinuing", discriminator) == 0) {
6084  } else
6085  if (strcmp("PlaybackFinished", discriminator) == 0) {
6087  } else
6088  if (strcmp("PlaybackStarted", discriminator) == 0) {
6089  return ast_ari_validate_playback_started(json);
6090  } else
6091  if (strcmp("RecordingFailed", discriminator) == 0) {
6092  return ast_ari_validate_recording_failed(json);
6093  } else
6094  if (strcmp("RecordingFinished", discriminator) == 0) {
6096  } else
6097  if (strcmp("RecordingStarted", discriminator) == 0) {
6099  } else
6100  if (strcmp("StasisEnd", discriminator) == 0) {
6101  return ast_ari_validate_stasis_end(json);
6102  } else
6103  if (strcmp("StasisStart", discriminator) == 0) {
6104  return ast_ari_validate_stasis_start(json);
6105  } else
6106  if (strcmp("TextMessageReceived", discriminator) == 0) {
6108  } else
6109  {
6110  ast_log(LOG_ERROR, "ARI Message has undocumented subtype %s\n",
6111  discriminator);
6112  res = 0;
6113  }
6114 
6115  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6116  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6117  int prop_is_valid;
6118  prop_is_valid = ast_ari_validate_string(
6120  if (!prop_is_valid) {
6121  ast_log(LOG_ERROR, "ARI Message field asterisk_id failed validation\n");
6122  res = 0;
6123  }
6124  } else
6125  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6126  int prop_is_valid;
6127  has_type = 1;
6128  prop_is_valid = ast_ari_validate_string(
6130  if (!prop_is_valid) {
6131  ast_log(LOG_ERROR, "ARI Message field type failed validation\n");
6132  res = 0;
6133  }
6134  } else
6135  {
6137  "ARI Message has undocumented field %s\n",
6138  ast_json_object_iter_key(iter));
6139  res = 0;
6140  }
6141  }
6142 
6143  if (!has_type) {
6144  ast_log(LOG_ERROR, "ARI Message missing required field type\n");
6145  res = 0;
6146  }
6147 
6148  return res;
6149 }
int ast_ari_validate_event(struct ast_json *json)
Validator for Event.
int ast_ari_validate_text_message_received(struct ast_json *json)
Validator for TextMessageReceived.
int ast_ari_validate_peer_status_change(struct ast_json *json)
Validator for PeerStatusChange.
int ast_ari_validate_channel_state_change(struct ast_json *json)
Validator for ChannelStateChange.
int ast_ari_validate_recording_started(struct ast_json *json)
Validator for RecordingStarted.
int ast_ari_validate_endpoint_state_change(struct ast_json *json)
Validator for EndpointStateChange.
int ast_ari_validate_channel_connected_line(struct ast_json *json)
Validator for ChannelConnectedLine.
int ast_ari_validate_bridge_blind_transfer(struct ast_json *json)
Validator for BridgeBlindTransfer.
int ast_ari_validate_channel_userevent(struct ast_json *json)
Validator for ChannelUserevent.
Iterator for JSON object key/values.
int ast_ari_validate_channel_created(struct ast_json *json)
Validator for ChannelCreated.
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_channel_hold(struct ast_json *json)
Validator for ChannelHold.
int ast_ari_validate_stasis_start(struct ast_json *json)
Validator for StasisStart.
int ast_ari_validate_bridge_attended_transfer(struct ast_json *json)
Validator for BridgeAttendedTransfer.
int ast_ari_validate_channel_caller_id(struct ast_json *json)
Validator for ChannelCallerId.
int ast_ari_validate_channel_varset(struct ast_json *json)
Validator for ChannelVarset.
int ast_ari_validate_recording_failed(struct ast_json *json)
Validator for RecordingFailed.
#define ast_log
Definition: astobj2.c:42
int ast_ari_validate_application_replaced(struct ast_json *json)
Validator for ApplicationReplaced.
int ast_ari_validate_contact_status_change(struct ast_json *json)
Validator for ContactStatusChange.
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_channel_destroyed(struct ast_json *json)
Validator for ChannelDestroyed.
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
Definition: json.c:273
int ast_ari_validate_bridge_video_source_changed(struct ast_json *json)
Validator for BridgeVideoSourceChanged.
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:441
int ast_ari_validate_channel_dtmf_received(struct ast_json *json)
Validator for ChannelDtmfReceived.
int ast_ari_validate_channel_unhold(struct ast_json *json)
Validator for ChannelUnhold.
int ast_ari_validate_channel_talking_finished(struct ast_json *json)
Validator for ChannelTalkingFinished.
#define LOG_ERROR
Definition: logger.h:285
int ast_ari_validate_application_move_failed(struct ast_json *json)
Validator for ApplicationMoveFailed.
int ast_ari_validate_bridge_destroyed(struct ast_json *json)
Validator for BridgeDestroyed.
int ast_ari_validate_dial(struct ast_json *json)
Validator for Dial.
int ast_ari_validate_missing_params(struct ast_json *json)
Validator for MissingParams.
int ast_ari_validate_playback_finished(struct ast_json *json)
Validator for PlaybackFinished.
int ast_ari_validate_recording_finished(struct ast_json *json)
Validator for RecordingFinished.
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
int ast_ari_validate_channel_entered_bridge(struct ast_json *json)
Validator for ChannelEnteredBridge.
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
Definition: json.c:397
int ast_ari_validate_playback_started(struct ast_json *json)
Validator for PlaybackStarted.
int ast_ari_validate_playback_continuing(struct ast_json *json)
Validator for PlaybackContinuing.
int ast_ari_validate_stasis_end(struct ast_json *json)
Validator for StasisEnd.
int ast_ari_validate_channel_left_bridge(struct ast_json *json)
Validator for ChannelLeftBridge.
int ast_ari_validate_channel_talking_started(struct ast_json *json)
Validator for ChannelTalkingStarted.
int ast_ari_validate_bridge_created(struct ast_json *json)
Validator for BridgeCreated.
int ast_ari_validate_channel_dialplan(struct ast_json *json)
Validator for ChannelDialplan.
int ast_ari_validate_bridge_merged(struct ast_json *json)
Validator for BridgeMerged.
int ast_ari_validate_device_state_changed(struct ast_json *json)
Validator for DeviceStateChanged.
int ast_ari_validate_channel_hangup_request(struct ast_json *json)
Validator for ChannelHangupRequest.
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_message_fn()

ari_validator ast_ari_validate_message_fn ( void  )

Function pointer to ast_ari_validate_message().

See ast_ari_model_validators.h for more details.

Definition at line 6151 of file ari_model_validators.c.

References ast_ari_validate_message().

Referenced by ast_ari_events_event_websocket_ws_established_cb().

6152 {
6153  return ast_ari_validate_message;
6154 }
int ast_ari_validate_message(struct ast_json *json)
Validator for Message.

◆ ast_ari_validate_missing_params()

int ast_ari_validate_missing_params ( struct ast_json json)

Validator for MissingParams.

Error event sent when required params are missing.

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

Definition at line 6156 of file ari_model_validators.c.

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

Referenced by ast_ari_validate_message(), and ast_ari_validate_missing_params_fn().

6157 {
6158  int res = 1;
6159  struct ast_json_iter *iter;
6160  int has_type = 0;
6161  int has_params = 0;
6162 
6163  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6164  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6165  int prop_is_valid;
6166  prop_is_valid = ast_ari_validate_string(
6168  if (!prop_is_valid) {
6169  ast_log(LOG_ERROR, "ARI MissingParams field asterisk_id failed validation\n");
6170  res = 0;
6171  }
6172  } else
6173  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6174  int prop_is_valid;
6175  has_type = 1;
6176  prop_is_valid = ast_ari_validate_string(
6178  if (!prop_is_valid) {
6179  ast_log(LOG_ERROR, "ARI MissingParams field type failed validation\n");
6180  res = 0;
6181  }
6182  } else
6183  if (strcmp("params", ast_json_object_iter_key(iter)) == 0) {
6184  int prop_is_valid;
6185  has_params = 1;
6186  prop_is_valid = ast_ari_validate_list(
6189  if (!prop_is_valid) {
6190  ast_log(LOG_ERROR, "ARI MissingParams field params failed validation\n");
6191  res = 0;
6192  }
6193  } else
6194  {
6196  "ARI MissingParams has undocumented field %s\n",
6197  ast_json_object_iter_key(iter));
6198  res = 0;
6199  }
6200  }
6201 
6202  if (!has_type) {
6203  ast_log(LOG_ERROR, "ARI MissingParams missing required field type\n");
6204  res = 0;
6205  }
6206 
6207  if (!has_params) {
6208  ast_log(LOG_ERROR, "ARI MissingParams missing required field params\n");
6209  res = 0;
6210  }
6211 
6212  return res;
6213 }
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.
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_missing_params_fn()

ari_validator ast_ari_validate_missing_params_fn ( void  )

Function pointer to ast_ari_validate_missing_params().

See ast_ari_model_validators.h for more details.

Definition at line 6215 of file ari_model_validators.c.

References ast_ari_validate_missing_params().

6216 {
6218 }
int ast_ari_validate_missing_params(struct ast_json *json)
Validator for MissingParams.

◆ ast_ari_validate_module()

int ast_ari_validate_module ( struct ast_json json)

Validator for Module.

Details of an Asterisk module

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

Definition at line 519 of file ari_model_validators.c.

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

Referenced by ast_ari_asterisk_get_module_cb(), and ast_ari_validate_module_fn().

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

ari_validator ast_ari_validate_module_fn ( void  )

Function pointer to ast_ari_validate_module().

See ast_ari_model_validators.h for more details.

Definition at line 616 of file ari_model_validators.c.

References ast_ari_validate_module().

Referenced by ast_ari_asterisk_list_modules_cb().

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

◆ ast_ari_validate_object()

int ast_ari_validate_object ( struct ast_json json)

Validator for native Swagger object.

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

Definition at line 96 of file res_ari_model.c.

References AST_JSON_OBJECT, and check_type().

Referenced by ast_ari_validate_application(), ast_ari_validate_channel(), ast_ari_validate_channel_userevent(), and ast_ari_validate_text_message().

97 {
98  return check_type(json, AST_JSON_OBJECT);
99 }
static int check_type(struct ast_json *json, enum ast_json_type expected)
Definition: res_ari_model.c:55

◆ ast_ari_validate_peer()

int ast_ari_validate_peer ( struct ast_json json)

Validator for Peer.

Detailed information about a remote peer that communicates with Asterisk.

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

Definition at line 6220 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_peer_fn(), and ast_ari_validate_peer_status_change().

6221 {
6222  int res = 1;
6223  struct ast_json_iter *iter;
6224  int has_peer_status = 0;
6225 
6226  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6227  if (strcmp("address", ast_json_object_iter_key(iter)) == 0) {
6228  int prop_is_valid;
6229  prop_is_valid = ast_ari_validate_string(
6231  if (!prop_is_valid) {
6232  ast_log(LOG_ERROR, "ARI Peer field address failed validation\n");
6233  res = 0;
6234  }
6235  } else
6236  if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
6237  int prop_is_valid;
6238  prop_is_valid = ast_ari_validate_string(
6240  if (!prop_is_valid) {
6241  ast_log(LOG_ERROR, "ARI Peer field cause failed validation\n");
6242  res = 0;
6243  }
6244  } else
6245  if (strcmp("peer_status", ast_json_object_iter_key(iter)) == 0) {
6246  int prop_is_valid;
6247  has_peer_status = 1;
6248  prop_is_valid = ast_ari_validate_string(
6250  if (!prop_is_valid) {
6251  ast_log(LOG_ERROR, "ARI Peer field peer_status failed validation\n");
6252  res = 0;
6253  }
6254  } else
6255  if (strcmp("port", ast_json_object_iter_key(iter)) == 0) {
6256  int prop_is_valid;
6257  prop_is_valid = ast_ari_validate_string(
6259  if (!prop_is_valid) {
6260  ast_log(LOG_ERROR, "ARI Peer field port failed validation\n");
6261  res = 0;
6262  }
6263  } else
6264  if (strcmp("time", ast_json_object_iter_key(iter)) == 0) {
6265  int prop_is_valid;
6266  prop_is_valid = ast_ari_validate_string(
6268  if (!prop_is_valid) {
6269  ast_log(LOG_ERROR, "ARI Peer field time failed validation\n");
6270  res = 0;
6271  }
6272  } else
6273  {
6275  "ARI Peer has undocumented field %s\n",
6276  ast_json_object_iter_key(iter));
6277  res = 0;
6278  }
6279  }
6280 
6281  if (!has_peer_status) {
6282  ast_log(LOG_ERROR, "ARI Peer missing required field peer_status\n");
6283  res = 0;
6284  }
6285 
6286  return res;
6287 }
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_peer_fn()

ari_validator ast_ari_validate_peer_fn ( void  )

Function pointer to ast_ari_validate_peer().

See ast_ari_model_validators.h for more details.

Definition at line 6289 of file ari_model_validators.c.

References ast_ari_validate_peer().

6290 {
6291  return ast_ari_validate_peer;
6292 }
int ast_ari_validate_peer(struct ast_json *json)
Validator for Peer.

◆ ast_ari_validate_peer_status_change()

int ast_ari_validate_peer_status_change ( struct ast_json json)

Validator for PeerStatusChange.

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

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

Definition at line 6294 of file ari_model_validators.c.

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

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

6295 {
6296  int res = 1;
6297  struct ast_json_iter *iter;
6298  int has_type = 0;
6299  int has_application = 0;
6300  int has_timestamp = 0;
6301  int has_endpoint = 0;
6302  int has_peer = 0;
6303 
6304  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6305  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6306  int prop_is_valid;
6307  prop_is_valid = ast_ari_validate_string(
6309  if (!prop_is_valid) {
6310  ast_log(LOG_ERROR, "ARI PeerStatusChange field asterisk_id failed validation\n");
6311  res = 0;
6312  }
6313  } else
6314  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6315  int prop_is_valid;
6316  has_type = 1;
6317  prop_is_valid = ast_ari_validate_string(
6319  if (!prop_is_valid) {
6320  ast_log(LOG_ERROR, "ARI PeerStatusChange field type failed validation\n");
6321  res = 0;
6322  }
6323  } else
6324  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
6325  int prop_is_valid;
6326  has_application = 1;
6327  prop_is_valid = ast_ari_validate_string(
6329  if (!prop_is_valid) {
6330  ast_log(LOG_ERROR, "ARI PeerStatusChange field application failed validation\n");
6331  res = 0;
6332  }
6333  } else
6334  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
6335  int prop_is_valid;
6336  has_timestamp = 1;
6337  prop_is_valid = ast_ari_validate_date(
6339  if (!prop_is_valid) {
6340  ast_log(LOG_ERROR, "ARI PeerStatusChange field timestamp failed validation\n");
6341  res = 0;
6342  }
6343  } else
6344  if (strcmp("endpoint", ast_json_object_iter_key(iter)) == 0) {
6345  int prop_is_valid;
6346  has_endpoint = 1;
6347  prop_is_valid = ast_ari_validate_endpoint(
6349  if (!prop_is_valid) {
6350  ast_log(LOG_ERROR, "ARI PeerStatusChange field endpoint failed validation\n");
6351  res = 0;
6352  }
6353  } else
6354  if (strcmp("peer", ast_json_object_iter_key(iter)) == 0) {
6355  int prop_is_valid;
6356  has_peer = 1;
6357  prop_is_valid = ast_ari_validate_peer(
6359  if (!prop_is_valid) {
6360  ast_log(LOG_ERROR, "ARI PeerStatusChange field peer failed validation\n");
6361  res = 0;
6362  }
6363  } else
6364  {
6366  "ARI PeerStatusChange has undocumented field %s\n",
6367  ast_json_object_iter_key(iter));
6368  res = 0;
6369  }
6370  }
6371 
6372  if (!has_type) {
6373  ast_log(LOG_ERROR, "ARI PeerStatusChange missing required field type\n");
6374  res = 0;
6375  }
6376 
6377  if (!has_application) {
6378  ast_log(LOG_ERROR, "ARI PeerStatusChange missing required field application\n");
6379  res = 0;
6380  }
6381 
6382  if (!has_timestamp) {
6383  ast_log(LOG_ERROR, "ARI PeerStatusChange missing required field timestamp\n");
6384  res = 0;
6385  }
6386 
6387  if (!has_endpoint) {
6388  ast_log(LOG_ERROR, "ARI PeerStatusChange missing required field endpoint\n");
6389  res = 0;
6390  }
6391 
6392  if (!has_peer) {
6393  ast_log(LOG_ERROR, "ARI PeerStatusChange missing required field peer\n");
6394  res = 0;
6395  }
6396 
6397  return res;
6398 }
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_endpoint(struct ast_json *json)
Validator for Endpoint.
int ast_ari_validate_string(struct ast_json *json)
Validator for native Swagger string.
int ast_ari_validate_peer(struct ast_json *json)
Validator for Peer.
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_peer_status_change_fn()

ari_validator ast_ari_validate_peer_status_change_fn ( void  )

Function pointer to ast_ari_validate_peer_status_change().

See ast_ari_model_validators.h for more details.

Definition at line 6400 of file ari_model_validators.c.

References ast_ari_validate_peer_status_change().

6401 {
6403 }
int ast_ari_validate_peer_status_change(struct ast_json *json)
Validator for PeerStatusChange.

◆ ast_ari_validate_playback()

int ast_ari_validate_playback ( struct ast_json json)

Validator for Playback.

Object representing the playback of media to a channel

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

Definition at line 2169 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_bridges_play_cb(), ast_ari_bridges_play_with_id_cb(), ast_ari_channels_play_cb(), ast_ari_channels_play_with_id_cb(), ast_ari_playbacks_get_cb(), ast_ari_validate_playback_continuing(), ast_ari_validate_playback_finished(), ast_ari_validate_playback_fn(), and ast_ari_validate_playback_started().

2170 {
2171  int res = 1;
2172  struct ast_json_iter *iter;
2173  int has_id = 0;
2174  int has_media_uri = 0;
2175  int has_state = 0;
2176  int has_target_uri = 0;
2177 
2178  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2179  if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
2180  int prop_is_valid;
2181  has_id = 1;
2182  prop_is_valid = ast_ari_validate_string(
2184  if (!prop_is_valid) {
2185  ast_log(LOG_ERROR, "ARI Playback field id failed validation\n");
2186  res = 0;
2187  }
2188  } else
2189  if (strcmp("language", ast_json_object_iter_key(iter)) == 0) {
2190  int prop_is_valid;
2191  prop_is_valid = ast_ari_validate_string(
2193  if (!prop_is_valid) {
2194  ast_log(LOG_ERROR, "ARI Playback field language failed validation\n");
2195  res = 0;
2196  }
2197  } else
2198  if (strcmp("media_uri", ast_json_object_iter_key(iter)) == 0) {
2199  int prop_is_valid;
2200  has_media_uri = 1;
2201  prop_is_valid = ast_ari_validate_string(
2203  if (!prop_is_valid) {
2204  ast_log(LOG_ERROR, "ARI Playback field media_uri failed validation\n");
2205  res = 0;
2206  }
2207  } else
2208  if (strcmp("next_media_uri", ast_json_object_iter_key(iter)) == 0) {
2209  int prop_is_valid;
2210  prop_is_valid = ast_ari_validate_string(
2212  if (!prop_is_valid) {
2213  ast_log(LOG_ERROR, "ARI Playback field next_media_uri failed validation\n");
2214  res = 0;
2215  }
2216  } else
2217  if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
2218  int prop_is_valid;
2219  has_state = 1;
2220  prop_is_valid = ast_ari_validate_string(
2222  if (!prop_is_valid) {
2223  ast_log(LOG_ERROR, "ARI Playback field state failed validation\n");
2224  res = 0;
2225  }
2226  } else
2227  if (strcmp("target_uri", ast_json_object_iter_key(iter)) == 0) {
2228  int prop_is_valid;
2229  has_target_uri = 1;
2230  prop_is_valid = ast_ari_validate_string(
2232  if (!prop_is_valid) {
2233  ast_log(LOG_ERROR, "ARI Playback field target_uri failed validation\n");
2234  res = 0;
2235  }
2236  } else
2237  {
2239  "ARI Playback has undocumented field %s\n",
2240  ast_json_object_iter_key(iter));
2241  res = 0;
2242  }
2243  }
2244 
2245  if (!has_id) {
2246  ast_log(LOG_ERROR, "ARI Playback missing required field id\n");
2247  res = 0;
2248  }
2249 
2250  if (!has_media_uri) {
2251  ast_log(LOG_ERROR, "ARI Playback missing required field media_uri\n");
2252  res = 0;
2253  }
2254 
2255  if (!has_state) {
2256  ast_log(LOG_ERROR, "ARI Playback missing required field state\n");
2257  res = 0;
2258  }
2259 
2260  if (!has_target_uri) {
2261  ast_log(LOG_ERROR, "ARI Playback missing required field target_uri\n");
2262  res = 0;
2263  }
2264 
2265  return res;
2266 }
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_playback_continuing()

int ast_ari_validate_playback_continuing ( struct ast_json json)

Validator for PlaybackContinuing.

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

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

Definition at line 6405 of file ari_model_validators.c.

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

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

6406 {
6407  int res = 1;
6408  struct ast_json_iter *iter;
6409  int has_type = 0;
6410  int has_application = 0;
6411  int has_timestamp = 0;
6412  int has_playback = 0;
6413 
6414  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6415  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6416  int prop_is_valid;
6417  prop_is_valid = ast_ari_validate_string(
6419  if (!prop_is_valid) {
6420  ast_log(LOG_ERROR, "ARI PlaybackContinuing field asterisk_id failed validation\n");
6421  res = 0;
6422  }
6423  } else
6424  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6425  int prop_is_valid;
6426  has_type = 1;
6427  prop_is_valid = ast_ari_validate_string(
6429  if (!prop_is_valid) {
6430  ast_log(LOG_ERROR, "ARI PlaybackContinuing field type failed validation\n");
6431  res = 0;
6432  }
6433  } else
6434  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
6435  int prop_is_valid;
6436  has_application = 1;
6437  prop_is_valid = ast_ari_validate_string(
6439  if (!prop_is_valid) {
6440  ast_log(LOG_ERROR, "ARI PlaybackContinuing field application failed validation\n");
6441  res = 0;
6442  }
6443  } else
6444  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
6445  int prop_is_valid;
6446  has_timestamp = 1;
6447  prop_is_valid = ast_ari_validate_date(
6449  if (!prop_is_valid) {
6450  ast_log(LOG_ERROR, "ARI PlaybackContinuing field timestamp failed validation\n");
6451  res = 0;
6452  }
6453  } else
6454  if (strcmp("playback", ast_json_object_iter_key(iter)) == 0) {
6455  int prop_is_valid;
6456  has_playback = 1;
6457  prop_is_valid = ast_ari_validate_playback(
6459  if (!prop_is_valid) {
6460  ast_log(LOG_ERROR, "ARI PlaybackContinuing field playback failed validation\n");
6461  res = 0;
6462  }
6463  } else
6464  {
6466  "ARI PlaybackContinuing has undocumented field %s\n",
6467  ast_json_object_iter_key(iter));
6468  res = 0;
6469  }
6470  }
6471 
6472  if (!has_type) {
6473  ast_log(LOG_ERROR, "ARI PlaybackContinuing missing required field type\n");
6474  res = 0;
6475  }
6476 
6477  if (!has_application) {
6478  ast_log(LOG_ERROR, "ARI PlaybackContinuing missing required field application\n");
6479  res = 0;
6480  }
6481 
6482  if (!has_timestamp) {
6483  ast_log(LOG_ERROR, "ARI PlaybackContinuing missing required field timestamp\n");
6484  res = 0;
6485  }
6486 
6487  if (!has_playback) {
6488  ast_log(LOG_ERROR, "ARI PlaybackContinuing missing required field playback\n");
6489  res = 0;
6490  }
6491 
6492  return res;
6493 }
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
int ast_ari_validate_playback(struct ast_json *json)
Validator for Playback.
#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_playback_continuing_fn()

ari_validator ast_ari_validate_playback_continuing_fn ( void  )

Function pointer to ast_ari_validate_playback_continuing().

See ast_ari_model_validators.h for more details.

Definition at line 6495 of file ari_model_validators.c.

References ast_ari_validate_playback_continuing().

6496 {
6498 }
int ast_ari_validate_playback_continuing(struct ast_json *json)
Validator for PlaybackContinuing.

◆ ast_ari_validate_playback_finished()

int ast_ari_validate_playback_finished ( struct ast_json json)

Validator for PlaybackFinished.

Event showing the completion of a media playback operation.

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

Definition at line 6500 of file ari_model_validators.c.

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

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

6501 {
6502  int res = 1;
6503  struct ast_json_iter *iter;
6504  int has_type = 0;
6505  int has_application = 0;
6506  int has_timestamp = 0;
6507  int has_playback = 0;
6508 
6509  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6510  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6511  int prop_is_valid;
6512  prop_is_valid = ast_ari_validate_string(
6514  if (!prop_is_valid) {
6515  ast_log(LOG_ERROR, "ARI PlaybackFinished field asterisk_id failed validation\n");
6516  res = 0;
6517  }
6518  } else
6519  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6520  int prop_is_valid;
6521  has_type = 1;
6522  prop_is_valid = ast_ari_validate_string(
6524  if (!prop_is_valid) {
6525  ast_log(LOG_ERROR, "ARI PlaybackFinished field type failed validation\n");
6526  res = 0;
6527  }
6528  } else
6529  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
6530  int prop_is_valid;
6531  has_application = 1;
6532  prop_is_valid = ast_ari_validate_string(
6534  if (!prop_is_valid) {
6535  ast_log(LOG_ERROR, "ARI PlaybackFinished field application failed validation\n");
6536  res = 0;
6537  }
6538  } else
6539  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
6540  int prop_is_valid;
6541  has_timestamp = 1;
6542  prop_is_valid = ast_ari_validate_date(
6544  if (!prop_is_valid) {
6545  ast_log(LOG_ERROR, "ARI PlaybackFinished field timestamp failed validation\n");
6546  res = 0;
6547  }
6548  } else
6549  if (strcmp("playback", ast_json_object_iter_key(iter)) == 0) {
6550  int prop_is_valid;
6551  has_playback = 1;
6552  prop_is_valid = ast_ari_validate_playback(
6554  if (!prop_is_valid) {
6555  ast_log(LOG_ERROR, "ARI PlaybackFinished field playback failed validation\n");
6556  res = 0;
6557  }
6558  } else
6559  {
6561  "ARI PlaybackFinished has undocumented field %s\n",
6562  ast_json_object_iter_key(iter));
6563  res = 0;
6564  }
6565  }
6566 
6567  if (!has_type) {
6568  ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field type\n");
6569  res = 0;
6570  }
6571 
6572  if (!has_application) {
6573  ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field application\n");
6574  res = 0;
6575  }
6576 
6577  if (!has_timestamp) {
6578  ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field timestamp\n");
6579  res = 0;
6580  }
6581 
6582  if (!has_playback) {
6583  ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field playback\n");
6584  res = 0;
6585  }
6586 
6587  return res;
6588 }
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
int ast_ari_validate_playback(struct ast_json *json)
Validator for Playback.
#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_playback_finished_fn()

ari_validator ast_ari_validate_playback_finished_fn ( void  )

Function pointer to ast_ari_validate_playback_finished().

See ast_ari_model_validators.h for more details.

Definition at line 6590 of file ari_model_validators.c.

References ast_ari_validate_playback_finished().

6591 {
6593 }
int ast_ari_validate_playback_finished(struct ast_json *json)
Validator for PlaybackFinished.

◆ ast_ari_validate_playback_fn()

ari_validator ast_ari_validate_playback_fn ( void  )

Function pointer to ast_ari_validate_playback().

See ast_ari_model_validators.h for more details.

Definition at line 2268 of file ari_model_validators.c.

References ast_ari_validate_playback().

2269 {
2271 }
int ast_ari_validate_playback(struct ast_json *json)
Validator for Playback.

◆ ast_ari_validate_playback_started()

int ast_ari_validate_playback_started ( struct ast_json json)

Validator for PlaybackStarted.

Event showing the start of a media playback operation.

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

Definition at line 6595 of file ari_model_validators.c.

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

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

6596 {
6597  int res = 1;
6598  struct ast_json_iter *iter;
6599  int has_type = 0;
6600  int has_application = 0;
6601  int has_timestamp = 0;
6602  int has_playback = 0;
6603 
6604  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6605  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6606  int prop_is_valid;
6607  prop_is_valid = ast_ari_validate_string(
6609  if (!prop_is_valid) {
6610  ast_log(LOG_ERROR, "ARI PlaybackStarted field asterisk_id failed validation\n");
6611  res = 0;
6612  }
6613  } else
6614  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6615  int prop_is_valid;
6616  has_type = 1;
6617  prop_is_valid = ast_ari_validate_string(
6619  if (!prop_is_valid) {
6620  ast_log(LOG_ERROR, "ARI PlaybackStarted field type failed validation\n");
6621  res = 0;
6622  }
6623  } else
6624  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
6625  int prop_is_valid;
6626  has_application = 1;
6627  prop_is_valid = ast_ari_validate_string(
6629  if (!prop_is_valid) {
6630  ast_log(LOG_ERROR, "ARI PlaybackStarted field application failed validation\n");
6631  res = 0;
6632  }
6633  } else
6634  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
6635  int prop_is_valid;
6636  has_timestamp = 1;
6637  prop_is_valid = ast_ari_validate_date(
6639  if (!prop_is_valid) {
6640  ast_log(LOG_ERROR, "ARI PlaybackStarted field timestamp failed validation\n");
6641  res = 0;
6642  }
6643  } else
6644  if (strcmp("playback", ast_json_object_iter_key(iter)) == 0) {
6645  int prop_is_valid;
6646  has_playback = 1;
6647  prop_is_valid = ast_ari_validate_playback(
6649  if (!prop_is_valid) {
6650  ast_log(LOG_ERROR, "ARI PlaybackStarted field playback failed validation\n");
6651  res = 0;
6652  }
6653  } else
6654  {
6656  "ARI PlaybackStarted has undocumented field %s\n",
6657  ast_json_object_iter_key(iter));
6658  res = 0;
6659  }
6660  }
6661 
6662  if (!has_type) {
6663  ast_log(LOG_ERROR, "ARI PlaybackStarted missing required field type\n");
6664  res = 0;
6665  }
6666 
6667  if (!has_application) {
6668  ast_log(LOG_ERROR, "ARI PlaybackStarted missing required field application\n");
6669  res = 0;
6670  }
6671 
6672  if (!has_timestamp) {
6673  ast_log(LOG_ERROR, "ARI PlaybackStarted missing required field timestamp\n");
6674  res = 0;
6675  }
6676 
6677  if (!has_playback) {
6678  ast_log(LOG_ERROR, "ARI PlaybackStarted missing required field playback\n");
6679  res = 0;
6680  }
6681 
6682  return res;
6683 }
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
int ast_ari_validate_playback(struct ast_json *json)
Validator for Playback.
#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_playback_started_fn()

ari_validator ast_ari_validate_playback_started_fn ( void  )

Function pointer to ast_ari_validate_playback_started().

See ast_ari_model_validators.h for more details.

Definition at line 6685 of file ari_model_validators.c.

References ast_ari_validate_playback_started().

6686 {
6688 }
int ast_ari_validate_playback_started(struct ast_json *json)
Validator for PlaybackStarted.

◆ ast_ari_validate_recording_failed()

int ast_ari_validate_recording_failed ( struct ast_json json)

Validator for RecordingFailed.

Event showing failure of a recording operation.

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

Definition at line 6690 of file ari_model_validators.c.

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

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

6691 {
6692  int res = 1;
6693  struct ast_json_iter *iter;
6694  int has_type = 0;
6695  int has_application = 0;
6696  int has_timestamp = 0;
6697  int has_recording = 0;
6698 
6699  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6700  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6701  int prop_is_valid;
6702  prop_is_valid = ast_ari_validate_string(
6704  if (!prop_is_valid) {
6705  ast_log(LOG_ERROR, "ARI RecordingFailed field asterisk_id failed validation\n");
6706  res = 0;
6707  }
6708  } else
6709  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6710  int prop_is_valid;
6711  has_type = 1;
6712  prop_is_valid = ast_ari_validate_string(
6714  if (!prop_is_valid) {
6715  ast_log(LOG_ERROR, "ARI RecordingFailed field type failed validation\n");
6716  res = 0;
6717  }
6718  } else
6719  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
6720  int prop_is_valid;
6721  has_application = 1;
6722  prop_is_valid = ast_ari_validate_string(
6724  if (!prop_is_valid) {
6725  ast_log(LOG_ERROR, "ARI RecordingFailed field application failed validation\n");
6726  res = 0;
6727  }
6728  } else
6729  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
6730  int prop_is_valid;
6731  has_timestamp = 1;
6732  prop_is_valid = ast_ari_validate_date(
6734  if (!prop_is_valid) {
6735  ast_log(LOG_ERROR, "ARI RecordingFailed field timestamp failed validation\n");
6736  res = 0;
6737  }
6738  } else
6739  if (strcmp("recording", ast_json_object_iter_key(iter)) == 0) {
6740  int prop_is_valid;
6741  has_recording = 1;
6742  prop_is_valid = ast_ari_validate_live_recording(
6744  if (!prop_is_valid) {
6745  ast_log(LOG_ERROR, "ARI RecordingFailed field recording failed validation\n");
6746  res = 0;
6747  }
6748  } else
6749  {
6751  "ARI RecordingFailed has undocumented field %s\n",
6752  ast_json_object_iter_key(iter));
6753  res = 0;
6754  }
6755  }
6756 
6757  if (!has_type) {
6758  ast_log(LOG_ERROR, "ARI RecordingFailed missing required field type\n");
6759  res = 0;
6760  }
6761 
6762  if (!has_application) {
6763  ast_log(LOG_ERROR, "ARI RecordingFailed missing required field application\n");
6764  res = 0;
6765  }
6766 
6767  if (!has_timestamp) {
6768  ast_log(LOG_ERROR, "ARI RecordingFailed missing required field timestamp\n");
6769  res = 0;
6770  }
6771 
6772  if (!has_recording) {
6773  ast_log(LOG_ERROR, "ARI RecordingFailed missing required field recording\n");
6774  res = 0;
6775  }
6776 
6777  return res;
6778 }
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_live_recording(struct ast_json *json)
Validator for LiveRecording.
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_recording_failed_fn()

ari_validator ast_ari_validate_recording_failed_fn ( void  )

Function pointer to ast_ari_validate_recording_failed().

See ast_ari_model_validators.h for more details.

Definition at line 6780 of file ari_model_validators.c.

References ast_ari_validate_recording_failed().

6781 {
6783 }
int ast_ari_validate_recording_failed(struct ast_json *json)
Validator for RecordingFailed.

◆ ast_ari_validate_recording_finished()

int ast_ari_validate_recording_finished ( struct ast_json json)

Validator for RecordingFinished.

Event showing the completion of a recording operation.

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

Definition at line 6785 of file ari_model_validators.c.

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

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

6786 {
6787  int res = 1;
6788  struct ast_json_iter *iter;
6789  int has_type = 0;
6790  int has_application = 0;
6791  int has_timestamp = 0;
6792  int has_recording = 0;
6793 
6794  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6795  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6796  int prop_is_valid;
6797  prop_is_valid = ast_ari_validate_string(
6799  if (!prop_is_valid) {
6800  ast_log(LOG_ERROR, "ARI RecordingFinished field asterisk_id failed validation\n");
6801  res = 0;
6802  }
6803  } else
6804  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6805  int prop_is_valid;
6806  has_type = 1;
6807  prop_is_valid = ast_ari_validate_string(
6809  if (!prop_is_valid) {
6810  ast_log(LOG_ERROR, "ARI RecordingFinished field type failed validation\n");
6811  res = 0;
6812  }
6813  } else
6814  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
6815  int prop_is_valid;
6816  has_application = 1;
6817  prop_is_valid = ast_ari_validate_string(
6819  if (!prop_is_valid) {
6820  ast_log(LOG_ERROR, "ARI RecordingFinished field application failed validation\n");
6821  res = 0;
6822  }
6823  } else
6824  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
6825  int prop_is_valid;
6826  has_timestamp = 1;
6827  prop_is_valid = ast_ari_validate_date(
6829  if (!prop_is_valid) {
6830  ast_log(LOG_ERROR, "ARI RecordingFinished field timestamp failed validation\n");
6831  res = 0;
6832  }
6833  } else
6834  if (strcmp("recording", ast_json_object_iter_key(iter)) == 0) {
6835  int prop_is_valid;
6836  has_recording = 1;
6837  prop_is_valid = ast_ari_validate_live_recording(
6839  if (!prop_is_valid) {
6840  ast_log(LOG_ERROR, "ARI RecordingFinished field recording failed validation\n");
6841  res = 0;
6842  }
6843  } else
6844  {
6846  "ARI RecordingFinished has undocumented field %s\n",
6847  ast_json_object_iter_key(iter));
6848  res = 0;
6849  }
6850  }
6851 
6852  if (!has_type) {
6853  ast_log(LOG_ERROR, "ARI RecordingFinished missing required field type\n");
6854  res = 0;
6855  }
6856 
6857  if (!has_application) {
6858  ast_log(LOG_ERROR, "ARI RecordingFinished missing required field application\n");
6859  res = 0;
6860  }
6861 
6862  if (!has_timestamp) {
6863  ast_log(LOG_ERROR, "ARI RecordingFinished missing required field timestamp\n");
6864  res = 0;
6865  }
6866 
6867  if (!has_recording) {
6868  ast_log(LOG_ERROR, "ARI RecordingFinished missing required field recording\n");
6869  res = 0;
6870  }
6871 
6872  return res;
6873 }
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_live_recording(struct ast_json *json)
Validator for LiveRecording.
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_recording_finished_fn()

ari_validator ast_ari_validate_recording_finished_fn ( void  )

Function pointer to ast_ari_validate_recording_finished().

See ast_ari_model_validators.h for more details.

Definition at line 6875 of file ari_model_validators.c.

References ast_ari_validate_recording_finished().

6876 {
6878 }
int ast_ari_validate_recording_finished(struct ast_json *json)
Validator for RecordingFinished.

◆ ast_ari_validate_recording_started()

int ast_ari_validate_recording_started ( struct ast_json json)

Validator for RecordingStarted.

Event showing the start of a recording operation.

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

Definition at line 6880 of file ari_model_validators.c.

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

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

6881 {
6882  int res = 1;
6883  struct ast_json_iter *iter;
6884  int has_type = 0;
6885  int has_application = 0;
6886  int has_timestamp = 0;
6887  int has_recording = 0;
6888 
6889  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6890  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6891  int prop_is_valid;
6892  prop_is_valid = ast_ari_validate_string(
6894  if (!prop_is_valid) {
6895  ast_log(LOG_ERROR, "ARI RecordingStarted field asterisk_id failed validation\n");
6896  res = 0;
6897  }
6898  } else
6899  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6900  int prop_is_valid;
6901  has_type = 1;
6902  prop_is_valid = ast_ari_validate_string(
6904  if (!prop_is_valid) {
6905  ast_log(LOG_ERROR, "ARI RecordingStarted field type failed validation\n");
6906  res = 0;
6907  }
6908  } else
6909  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
6910  int prop_is_valid;
6911  has_application = 1;
6912  prop_is_valid = ast_ari_validate_string(
6914  if (!prop_is_valid) {
6915  ast_log(LOG_ERROR, "ARI RecordingStarted field application failed validation\n");
6916  res = 0;
6917  }
6918  } else
6919  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
6920  int prop_is_valid;
6921  has_timestamp = 1;
6922  prop_is_valid = ast_ari_validate_date(
6924  if (!prop_is_valid) {
6925  ast_log(LOG_ERROR, "ARI RecordingStarted field timestamp failed validation\n");
6926  res = 0;
6927  }
6928  } else
6929  if (strcmp("recording", ast_json_object_iter_key(iter)) == 0) {
6930  int prop_is_valid;
6931  has_recording = 1;
6932  prop_is_valid = ast_ari_validate_live_recording(
6934  if (!prop_is_valid) {
6935  ast_log(LOG_ERROR, "ARI RecordingStarted field recording failed validation\n");
6936  res = 0;
6937  }
6938  } else
6939  {
6941  "ARI RecordingStarted has undocumented field %s\n",
6942  ast_json_object_iter_key(iter));
6943  res = 0;
6944  }
6945  }
6946 
6947  if (!has_type) {
6948  ast_log(LOG_ERROR, "ARI RecordingStarted missing required field type\n");
6949  res = 0;
6950  }
6951 
6952  if (!has_application) {
6953  ast_log(LOG_ERROR, "ARI RecordingStarted missing required field application\n");
6954  res = 0;
6955  }
6956 
6957  if (!has_timestamp) {
6958  ast_log(LOG_ERROR, "ARI RecordingStarted missing required field timestamp\n");
6959  res = 0;
6960  }
6961 
6962  if (!has_recording) {
6963  ast_log(LOG_ERROR, "ARI RecordingStarted missing required field recording\n");
6964  res = 0;
6965  }
6966 
6967  return res;
6968 }
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_live_recording(struct ast_json *json)
Validator for LiveRecording.
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_recording_started_fn()

ari_validator ast_ari_validate_recording_started_fn ( void  )

Function pointer to ast_ari_validate_recording_started().

See ast_ari_model_validators.h for more details.

Definition at line 6970 of file ari_model_validators.c.

References ast_ari_validate_recording_started().

6971 {
6973 }
int ast_ari_validate_recording_started(struct ast_json *json)
Validator for RecordingStarted.

◆ ast_ari_validate_rtpstat()

int ast_ari_validate_rtpstat ( struct ast_json json)

Validator for RTPstat.

A statistics of a RTP.

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

Definition at line 1333 of file ari_model_validators.c.

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

Referenced by ast_ari_channels_rtpstatistics_cb(), and ast_ari_validate_rtpstat_fn().

1334 {
1335  int res = 1;
1336  struct ast_json_iter *iter;
1337  int has_channel_uniqueid = 0;
1338  int has_local_ssrc = 0;
1339  int has_remote_ssrc = 0;
1340  int has_rxcount = 0;
1341  int has_rxoctetcount = 0;
1342  int has_rxploss = 0;
1343  int has_txcount = 0;
1344  int has_txoctetcount = 0;
1345  int has_txploss = 0;
1346 
1347  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1348  if (strcmp("channel_uniqueid", ast_json_object_iter_key(iter)) == 0) {
1349  int prop_is_valid;
1350  has_channel_uniqueid = 1;
1351  prop_is_valid = ast_ari_validate_string(
1353  if (!prop_is_valid) {
1354  ast_log(LOG_ERROR, "ARI RTPstat field channel_uniqueid failed validation\n");
1355  res = 0;
1356  }
1357  } else
1358  if (strcmp("local_maxjitter", ast_json_object_iter_key(iter)) == 0) {
1359  int prop_is_valid;
1360  prop_is_valid = ast_ari_validate_double(
1362  if (!prop_is_valid) {
1363  ast_log(LOG_ERROR, "ARI RTPstat field local_maxjitter failed validation\n");
1364  res = 0;
1365  }
1366  } else
1367  if (strcmp("local_maxrxploss", ast_json_object_iter_key(iter)) == 0) {
1368  int prop_is_valid;
1369  prop_is_valid = ast_ari_validate_double(
1371  if (!prop_is_valid) {
1372  ast_log(LOG_ERROR, "ARI RTPstat field local_maxrxploss failed validation\n");
1373  res = 0;
1374  }
1375  } else
1376  if (strcmp("local_minjitter", ast_json_object_iter_key(iter)) == 0) {
1377  int prop_is_valid;
1378  prop_is_valid = ast_ari_validate_double(
1380  if (!prop_is_valid) {
1381  ast_log(LOG_ERROR, "ARI RTPstat field local_minjitter failed validation\n");
1382  res = 0;
1383  }
1384  } else
1385  if (strcmp("local_minrxploss", ast_json_object_iter_key(iter)) == 0) {
1386  int prop_is_valid;
1387  prop_is_valid = ast_ari_validate_double(
1389  if (!prop_is_valid) {
1390  ast_log(LOG_ERROR, "ARI RTPstat field local_minrxploss failed validation\n");
1391  res = 0;
1392  }
1393  } else
1394  if (strcmp("local_normdevjitter", ast_json_object_iter_key(iter)) == 0) {
1395  int prop_is_valid;
1396  prop_is_valid = ast_ari_validate_double(
1398  if (!prop_is_valid) {
1399  ast_log(LOG_ERROR, "ARI RTPstat field local_normdevjitter failed validation\n");
1400  res = 0;
1401  }
1402  } else
1403  if (strcmp("local_normdevrxploss", ast_json_object_iter_key(iter)) == 0) {
1404  int prop_is_valid;
1405  prop_is_valid = ast_ari_validate_double(
1407  if (!prop_is_valid) {
1408  ast_log(LOG_ERROR, "ARI RTPstat field local_normdevrxploss failed validation\n");
1409  res = 0;
1410  }
1411  } else
1412  if (strcmp("local_ssrc", ast_json_object_iter_key(iter)) == 0) {
1413  int prop_is_valid;
1414  has_local_ssrc = 1;
1415  prop_is_valid = ast_ari_validate_int(
1417  if (!prop_is_valid) {
1418  ast_log(LOG_ERROR, "ARI RTPstat field local_ssrc failed validation\n");
1419  res = 0;
1420  }
1421  } else
1422  if (strcmp("local_stdevjitter", ast_json_object_iter_key(iter)) == 0) {
1423  int prop_is_valid;
1424  prop_is_valid = ast_ari_validate_double(
1426  if (!prop_is_valid) {
1427  ast_log(LOG_ERROR, "ARI RTPstat field local_stdevjitter failed validation\n");
1428  res = 0;
1429  }
1430  } else
1431  if (strcmp("local_stdevrxploss", ast_json_object_iter_key(iter)) == 0) {
1432  int prop_is_valid;
1433  prop_is_valid = ast_ari_validate_double(
1435  if (!prop_is_valid) {
1436  ast_log(LOG_ERROR, "ARI RTPstat field local_stdevrxploss failed validation\n");
1437  res = 0;
1438  }
1439  } else
1440  if (strcmp("maxrtt", ast_json_object_iter_key(iter)) == 0) {
1441  int prop_is_valid;
1442  prop_is_valid = ast_ari_validate_double(
1444  if (!prop_is_valid) {
1445  ast_log(LOG_ERROR, "ARI RTPstat field maxrtt failed validation\n");
1446  res = 0;
1447  }
1448  } else
1449  if (strcmp("minrtt", ast_json_object_iter_key(iter)) == 0) {
1450  int prop_is_valid;
1451  prop_is_valid = ast_ari_validate_double(
1453  if (!prop_is_valid) {
1454  ast_log(LOG_ERROR, "ARI RTPstat field minrtt failed validation\n");
1455  res = 0;
1456  }
1457  } else
1458  if (strcmp("normdevrtt", ast_json_object_iter_key(iter)) == 0) {
1459  int prop_is_valid;
1460  prop_is_valid = ast_ari_validate_double(
1462  if (!prop_is_valid) {
1463  ast_log(LOG_ERROR, "ARI RTPstat field normdevrtt failed validation\n");
1464  res = 0;
1465  }
1466  } else
1467  if (strcmp("remote_maxjitter", ast_json_object_iter_key(iter)) == 0) {
1468  int prop_is_valid;
1469  prop_is_valid = ast_ari_validate_double(
1471  if (!prop_is_valid) {
1472  ast_log(LOG_ERROR, "ARI RTPstat field remote_maxjitter failed validation\n");
1473  res = 0;
1474  }
1475  } else
1476  if (strcmp("remote_maxrxploss", ast_json_object_iter_key(iter)) == 0) {
1477  int prop_is_valid;
1478  prop_is_valid = ast_ari_validate_double(
1480  if (!prop_is_valid) {
1481  ast_log(LOG_ERROR, "ARI RTPstat field remote_maxrxploss failed validation\n");
1482  res = 0;
1483  }
1484  } else
1485  if (strcmp("remote_minjitter", ast_json_object_iter_key(iter)) == 0) {
1486  int prop_is_valid;
1487  prop_is_valid = ast_ari_validate_double(
1489  if (!prop_is_valid) {
1490  ast_log(LOG_ERROR, "ARI RTPstat field remote_minjitter failed validation\n");
1491  res = 0;
1492  }
1493  } else
1494  if (strcmp("remote_minrxploss", ast_json_object_iter_key(iter)) == 0) {
1495  int prop_is_valid;
1496  prop_is_valid = ast_ari_validate_double(
1498  if (!prop_is_valid) {
1499  ast_log(LOG_ERROR, "ARI RTPstat field remote_minrxploss failed validation\n");
1500  res = 0;
1501  }
1502  } else
1503  if (strcmp("remote_normdevjitter", ast_json_object_iter_key(iter)) == 0) {
1504  int prop_is_valid;
1505  prop_is_valid = ast_ari_validate_double(
1507  if (!prop_is_valid) {
1508  ast_log(LOG_ERROR, "ARI RTPstat field remote_normdevjitter failed validation\n");
1509  res = 0;
1510  }
1511  } else
1512  if (strcmp("remote_normdevrxploss", ast_json_object_iter_key(iter)) == 0) {
1513  int prop_is_valid;
1514  prop_is_valid = ast_ari_validate_double(
1516  if (!prop_is_valid) {
1517  ast_log(LOG_ERROR, "ARI RTPstat field remote_normdevrxploss failed validation\n");
1518  res = 0;
1519  }
1520  } else
1521  if (strcmp("remote_ssrc", ast_json_object_iter_key(iter)) == 0) {
1522  int prop_is_valid;
1523  has_remote_ssrc = 1;
1524  prop_is_valid = ast_ari_validate_int(
1526  if (!prop_is_valid) {
1527  ast_log(LOG_ERROR, "ARI RTPstat field remote_ssrc failed validation\n");
1528  res = 0;
1529  }
1530  } else
1531  if (strcmp("remote_stdevjitter", ast_json_object_iter_key(iter)) == 0) {
1532  int prop_is_valid;
1533  prop_is_valid = ast_ari_validate_double(
1535  if (!prop_is_valid) {
1536  ast_log(LOG_ERROR, "ARI RTPstat field remote_stdevjitter failed validation\n");
1537  res = 0;
1538  }
1539  } else
1540  if (strcmp("remote_stdevrxploss", ast_json_object_iter_key(iter)) == 0) {
1541  int prop_is_valid;
1542  prop_is_valid = ast_ari_validate_double(
1544  if (!prop_is_valid) {
1545  ast_log(LOG_ERROR, "ARI RTPstat field remote_stdevrxploss failed validation\n");
1546  res = 0;
1547  }
1548  } else
1549  if (strcmp("rtt", ast_json_object_iter_key(iter)) == 0) {
1550  int prop_is_valid;
1551  prop_is_valid = ast_ari_validate_double(
1553  if (!prop_is_valid) {
1554  ast_log(LOG_ERROR, "ARI RTPstat field rtt failed validation\n");
1555  res = 0;
1556  }
1557  } else
1558  if (strcmp("rxcount", ast_json_object_iter_key(iter)) == 0) {
1559  int prop_is_valid;
1560  has_rxcount = 1;
1561  prop_is_valid = ast_ari_validate_int(
1563  if (!prop_is_valid) {
1564  ast_log(LOG_ERROR, "ARI RTPstat field rxcount failed validation\n");
1565  res = 0;
1566  }
1567  } else
1568  if (strcmp("rxjitter", ast_json_object_iter_key(iter)) == 0) {
1569  int prop_is_valid;
1570  prop_is_valid = ast_ari_validate_double(
1572  if (!prop_is_valid) {
1573  ast_log(LOG_ERROR, "ARI RTPstat field rxjitter failed validation\n");
1574  res = 0;
1575  }
1576  } else
1577  if (strcmp("rxoctetcount", ast_json_object_iter_key(iter)) == 0) {
1578  int prop_is_valid;
1579  has_rxoctetcount = 1;
1580  prop_is_valid = ast_ari_validate_int(
1582  if (!prop_is_valid) {
1583  ast_log(LOG_ERROR, "ARI RTPstat field rxoctetcount failed validation\n");
1584  res = 0;
1585  }
1586  } else
1587  if (strcmp("rxploss", ast_json_object_iter_key(iter)) == 0) {
1588  int prop_is_valid;
1589  has_rxploss = 1;
1590  prop_is_valid = ast_ari_validate_int(
1592  if (!prop_is_valid) {
1593  ast_log(LOG_ERROR, "ARI RTPstat field rxploss failed validation\n");
1594  res = 0;
1595  }
1596  } else
1597  if (strcmp("stdevrtt", ast_json_object_iter_key(iter)) == 0) {
1598  int prop_is_valid;
1599  prop_is_valid = ast_ari_validate_double(
1601  if (!prop_is_valid) {
1602  ast_log(LOG_ERROR, "ARI RTPstat field stdevrtt failed validation\n");
1603  res = 0;
1604  }
1605  } else
1606  if (strcmp("txcount", ast_json_object_iter_key(iter)) == 0) {
1607  int prop_is_valid;
1608  has_txcount = 1;
1609  prop_is_valid = ast_ari_validate_int(
1611  if (!prop_is_valid) {
1612  ast_log(LOG_ERROR, "ARI RTPstat field txcount failed validation\n");
1613  res = 0;
1614  }
1615  } else
1616  if (strcmp("txjitter", ast_json_object_iter_key(iter)) == 0) {
1617  int prop_is_valid;
1618  prop_is_valid = ast_ari_validate_double(
1620  if (!prop_is_valid) {
1621  ast_log(LOG_ERROR, "ARI RTPstat field txjitter failed validation\n");
1622  res = 0;
1623  }
1624  } else
1625  if (strcmp("txoctetcount", ast_json_object_iter_key(iter)) == 0) {
1626  int prop_is_valid;
1627  has_txoctetcount = 1;
1628  prop_is_valid = ast_ari_validate_int(
1630  if (!prop_is_valid) {
1631  ast_log(LOG_ERROR, "ARI RTPstat field txoctetcount failed validation\n");
1632  res = 0;
1633  }
1634  } else
1635  if (strcmp("txploss", ast_json_object_iter_key(iter)) == 0) {
1636  int prop_is_valid;
1637  has_txploss = 1;
1638  prop_is_valid = ast_ari_validate_int(
1640  if (!prop_is_valid) {
1641  ast_log(LOG_ERROR, "ARI RTPstat field txploss failed validation\n");
1642  res = 0;
1643  }
1644  } else
1645  {
1647  "ARI RTPstat has undocumented field %s\n",
1648  ast_json_object_iter_key(iter));
1649  res = 0;
1650  }
1651  }
1652 
1653  if (!has_channel_uniqueid) {
1654  ast_log(LOG_ERROR, "ARI RTPstat missing required field channel_uniqueid\n");
1655  res = 0;
1656  }
1657 
1658  if (!has_local_ssrc) {
1659  ast_log(LOG_ERROR, "ARI RTPstat missing required field local_ssrc\n");
1660  res = 0;
1661  }
1662 
1663  if (!has_remote_ssrc) {
1664  ast_log(LOG_ERROR, "ARI RTPstat missing required field remote_ssrc\n");
1665  res = 0;
1666  }
1667 
1668  if (!has_rxcount) {
1669  ast_log(LOG_ERROR, "ARI RTPstat missing required field rxcount\n");
1670  res = 0;
1671  }
1672 
1673  if (!has_rxoctetcount) {
1674  ast_log(LOG_ERROR, "ARI RTPstat missing required field rxoctetcount\n");
1675  res = 0;
1676  }
1677 
1678  if (!has_rxploss) {
1679  ast_log(LOG_ERROR, "ARI RTPstat missing required field rxploss\n");
1680  res = 0;
1681  }
1682 
1683  if (!has_txcount) {
1684  ast_log(LOG_ERROR, "ARI RTPstat missing required field txcount\n");
1685  res = 0;
1686  }
1687 
1688  if (!has_txoctetcount) {
1689  ast_log(LOG_ERROR, "ARI RTPstat missing required field txoctetcount\n");
1690  res = 0;
1691  }
1692 
1693  if (!has_txploss) {
1694  ast_log(LOG_ERROR, "ARI RTPstat missing required field txploss\n");
1695  res = 0;
1696  }
1697 
1698  return res;
1699 }
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.
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_rtpstat_fn()

ari_validator ast_ari_validate_rtpstat_fn ( void  )

Function pointer to ast_ari_validate_rtpstat().

See ast_ari_model_validators.h for more details.

Definition at line 1701 of file ari_model_validators.c.

References ast_ari_validate_rtpstat().

1702 {
1703  return ast_ari_validate_rtpstat;
1704 }
int ast_ari_validate_rtpstat(struct ast_json *json)
Validator for RTPstat.

◆ ast_ari_validate_set_id()

int ast_ari_validate_set_id ( struct ast_json json)

Validator for SetId.

Effective user/group id

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

Definition at line 621 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_info(), and ast_ari_validate_set_id_fn().

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

ari_validator ast_ari_validate_set_id_fn ( void  )

Function pointer to ast_ari_validate_set_id().

See ast_ari_model_validators.h for more details.

Definition at line 670 of file ari_model_validators.c.

References ast_ari_validate_set_id().

671 {
673 }
int ast_ari_validate_set_id(struct ast_json *json)
Validator for SetId.

◆ ast_ari_validate_sound()

int ast_ari_validate_sound ( struct ast_json json)

Validator for Sound.

A media file that may be played back.

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

Definition at line 2105 of file ari_model_validators.c.

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

Referenced by ast_ari_sounds_get_cb(), and ast_ari_validate_sound_fn().

2106 {
2107  int res = 1;
2108  struct ast_json_iter *iter;
2109  int has_formats = 0;
2110  int has_id = 0;
2111 
2112  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2113  if (strcmp("formats", ast_json_object_iter_key(iter)) == 0) {
2114  int prop_is_valid;
2115  has_formats = 1;
2116  prop_is_valid = ast_ari_validate_list(
2119  if (!prop_is_valid) {
2120  ast_log(LOG_ERROR, "ARI Sound field formats failed validation\n");
2121  res = 0;
2122  }
2123  } else
2124  if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
2125  int prop_is_valid;
2126  has_id = 1;
2127  prop_is_valid = ast_ari_validate_string(
2129  if (!prop_is_valid) {
2130  ast_log(LOG_ERROR, "ARI Sound field id failed validation\n");
2131  res = 0;
2132  }
2133  } else
2134  if (strcmp("text", ast_json_object_iter_key(iter)) == 0) {
2135  int prop_is_valid;
2136  prop_is_valid = ast_ari_validate_string(
2138  if (!prop_is_valid) {
2139  ast_log(LOG_ERROR, "ARI Sound field text failed validation\n");
2140  res = 0;
2141  }
2142  } else
2143  {
2145  "ARI Sound has undocumented field %s\n",
2146  ast_json_object_iter_key(iter));
2147  res = 0;
2148  }
2149  }
2150 
2151  if (!has_formats) {
2152  ast_log(LOG_ERROR, "ARI Sound missing required field formats\n");
2153  res = 0;
2154  }
2155 
2156  if (!has_id) {
2157  ast_log(LOG_ERROR, "ARI Sound missing required field id\n");
2158  res = 0;
2159  }
2160 
2161  return res;
2162 }
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_format_lang_pair(struct ast_json *json)
Validator for FormatLangPair.
#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_sound_fn()

ari_validator ast_ari_validate_sound_fn ( void  )

Function pointer to ast_ari_validate_sound().

See ast_ari_model_validators.h for more details.

Definition at line 2164 of file ari_model_validators.c.

References ast_ari_validate_sound().

Referenced by ast_ari_sounds_list_cb().

2165 {
2166  return ast_ari_validate_sound;
2167 }
int ast_ari_validate_sound(struct ast_json *json)
Validator for Sound.

◆ ast_ari_validate_stasis_end()

int ast_ari_validate_stasis_end ( struct ast_json json)

Validator for StasisEnd.

Notification that a channel has left a Stasis application.

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

Definition at line 6975 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_event(), ast_ari_validate_message(), and ast_ari_validate_stasis_end_fn().

6976 {
6977  int res = 1;
6978  struct ast_json_iter *iter;
6979  int has_type = 0;
6980  int has_application = 0;
6981  int has_timestamp = 0;
6982  int has_channel = 0;
6983 
6984  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6985  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6986  int prop_is_valid;
6987  prop_is_valid = ast_ari_validate_string(
6989  if (!prop_is_valid) {
6990  ast_log(LOG_ERROR, "ARI StasisEnd field asterisk_id failed validation\n");
6991  res = 0;
6992  }
6993  } else
6994  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6995  int prop_is_valid;
6996  has_type = 1;
6997  prop_is_valid = ast_ari_validate_string(
6999  if (!prop_is_valid) {
7000  ast_log(LOG_ERROR, "ARI StasisEnd field type failed validation\n");
7001  res = 0;
7002  }
7003  } else
7004  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
7005  int prop_is_valid;
7006  has_application = 1;
7007  prop_is_valid = ast_ari_validate_string(
7009  if (!prop_is_valid) {
7010  ast_log(LOG_ERROR, "ARI StasisEnd field application failed validation\n");
7011  res = 0;
7012  }
7013  } else
7014  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
7015  int prop_is_valid;
7016  has_timestamp = 1;
7017  prop_is_valid = ast_ari_validate_date(
7019  if (!prop_is_valid) {
7020  ast_log(LOG_ERROR, "ARI StasisEnd field timestamp failed validation\n");
7021  res = 0;
7022  }
7023  } else
7024  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
7025  int prop_is_valid;
7026  has_channel = 1;
7027  prop_is_valid = ast_ari_validate_channel(
7029  if (!prop_is_valid) {
7030  ast_log(LOG_ERROR, "ARI StasisEnd field channel failed validation\n");
7031  res = 0;
7032  }
7033  } else
7034  {
7036  "ARI StasisEnd has undocumented field %s\n",
7037  ast_json_object_iter_key(iter));
7038  res = 0;
7039  }
7040  }
7041 
7042  if (!has_type) {
7043  ast_log(LOG_ERROR, "ARI StasisEnd missing required field type\n");
7044  res = 0;
7045  }
7046 
7047  if (!has_application) {
7048  ast_log(LOG_ERROR, "ARI StasisEnd missing required field application\n");
7049  res = 0;
7050  }
7051 
7052  if (!has_timestamp) {
7053  ast_log(LOG_ERROR, "ARI StasisEnd missing required field timestamp\n");
7054  res = 0;
7055  }
7056 
7057  if (!has_channel) {
7058  ast_log(LOG_ERROR, "ARI StasisEnd missing required field channel\n");
7059  res = 0;
7060  }
7061 
7062  return res;
7063 }
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_stasis_end_fn()

ari_validator ast_ari_validate_stasis_end_fn ( void  )

Function pointer to ast_ari_validate_stasis_end().

See ast_ari_model_validators.h for more details.

Definition at line 7065 of file ari_model_validators.c.

References ast_ari_validate_stasis_end().

7066 {
7068 }
int ast_ari_validate_stasis_end(struct ast_json *json)
Validator for StasisEnd.

◆ ast_ari_validate_stasis_start()

int ast_ari_validate_stasis_start ( struct ast_json json)

Validator for StasisStart.

Notification that a channel has entered a Stasis application.

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

Definition at line 7070 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_event(), ast_ari_validate_message(), and ast_ari_validate_stasis_start_fn().

7071 {
7072  int res = 1;
7073  struct ast_json_iter *iter;
7074  int has_type = 0;
7075  int has_application = 0;
7076  int has_timestamp = 0;
7077  int has_args = 0;
7078  int has_channel = 0;
7079 
7080  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
7081  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
7082  int prop_is_valid;
7083  prop_is_valid = ast_ari_validate_string(
7085  if (!prop_is_valid) {
7086  ast_log(LOG_ERROR, "ARI StasisStart field asterisk_id failed validation\n");
7087  res = 0;
7088  }
7089  } else
7090  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
7091  int prop_is_valid;
7092  has_type = 1;
7093  prop_is_valid = ast_ari_validate_string(
7095  if (!prop_is_valid) {
7096  ast_log(LOG_ERROR, "ARI StasisStart field type failed validation\n");
7097  res = 0;
7098  }
7099  } else
7100  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
7101  int prop_is_valid;
7102  has_application = 1;
7103  prop_is_valid = ast_ari_validate_string(
7105  if (!prop_is_valid) {
7106  ast_log(LOG_ERROR, "ARI StasisStart field application failed validation\n");
7107  res = 0;
7108  }
7109  } else
7110  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
7111  int prop_is_valid;
7112  has_timestamp = 1;
7113  prop_is_valid = ast_ari_validate_date(
7115  if (!prop_is_valid) {
7116  ast_log(LOG_ERROR, "ARI StasisStart field timestamp failed validation\n");
7117  res = 0;
7118  }
7119  } else
7120  if (strcmp("args", ast_json_object_iter_key(iter)) == 0) {
7121  int prop_is_valid;
7122  has_args = 1;
7123  prop_is_valid = ast_ari_validate_list(
7126  if (!prop_is_valid) {
7127  ast_log(LOG_ERROR, "ARI StasisStart field args failed validation\n");
7128  res = 0;
7129  }
7130  } else
7131  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
7132  int prop_is_valid;
7133  has_channel = 1;
7134  prop_is_valid = ast_ari_validate_channel(
7136  if (!prop_is_valid) {
7137  ast_log(LOG_ERROR, "ARI StasisStart field channel failed validation\n");
7138  res = 0;
7139  }
7140  } else
7141  if (strcmp("replace_channel", ast_json_object_iter_key(iter)) == 0) {
7142  int prop_is_valid;
7143  prop_is_valid = ast_ari_validate_channel(
7145  if (!prop_is_valid) {
7146  ast_log(LOG_ERROR, "ARI StasisStart field replace_channel failed validation\n");
7147  res = 0;
7148  }
7149  } else
7150  {
7152  "ARI StasisStart has undocumented field %s\n",
7153  ast_json_object_iter_key(iter));
7154  res = 0;
7155  }
7156  }
7157 
7158  if (!has_type) {
7159  ast_log(LOG_ERROR, "ARI StasisStart missing required field type\n");
7160  res = 0;
7161  }
7162 
7163  if (!has_application) {
7164  ast_log(LOG_ERROR, "ARI StasisStart missing required field application\n");
7165  res = 0;
7166  }
7167 
7168  if (!has_timestamp) {
7169  ast_log(LOG_ERROR, "ARI StasisStart missing required field timestamp\n");
7170  res = 0;
7171  }
7172 
7173  if (!has_args) {
7174  ast_log(LOG_ERROR, "ARI StasisStart missing required field args\n");
7175  res = 0;
7176  }
7177 
7178  if (!has_channel) {
7179  ast_log(LOG_ERROR, "ARI StasisStart missing required field channel\n");
7180  res = 0;
7181  }
7182 
7183  return res;
7184 }
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_stasis_start_fn()

ari_validator ast_ari_validate_stasis_start_fn ( void  )

Function pointer to ast_ari_validate_stasis_start().

See ast_ari_model_validators.h for more details.

Definition at line 7186 of file ari_model_validators.c.

References ast_ari_validate_stasis_start().

7187 {
7189 }
int ast_ari_validate_stasis_start(struct ast_json *json)
Validator for StasisStart.

◆ ast_ari_validate_status_info()

int ast_ari_validate_status_info ( struct ast_json json)

Validator for StatusInfo.

Info about Asterisk status

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

Definition at line 675 of file ari_model_validators.c.

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

Referenced by ast_ari_validate_asterisk_info(), and ast_ari_validate_status_info_fn().

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

ari_validator ast_ari_validate_status_info_fn ( void  )

Function pointer to ast_ari_validate_status_info().

See ast_ari_model_validators.h for more details.

Definition at line 724 of file ari_model_validators.c.

References ast_ari_validate_status_info().

725 {
727 }
int ast_ari_validate_status_info(struct ast_json *json)
Validator for StatusInfo.

◆ ast_ari_validate_stored_recording()

int ast_ari_validate_stored_recording ( struct ast_json json)

Validator for StoredRecording.

A past recording that may be played back.

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

Definition at line 1997 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_recordings_copy_stored_cb(), ast_ari_recordings_get_stored_cb(), and ast_ari_validate_stored_recording_fn().

1998 {
1999  int res = 1;
2000  struct ast_json_iter *iter;
2001  int has_format = 0;
2002  int has_name = 0;
2003 
2004  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2005  if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
2006  int prop_is_valid;
2007  has_format = 1;
2008  prop_is_valid = ast_ari_validate_string(
2010  if (!prop_is_valid) {
2011  ast_log(LOG_ERROR, "ARI StoredRecording field format failed validation\n");
2012  res = 0;
2013  }
2014  } else
2015  if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
2016  int prop_is_valid;
2017  has_name = 1;
2018  prop_is_valid = ast_ari_validate_string(
2020  if (!prop_is_valid) {
2021  ast_log(LOG_ERROR, "ARI StoredRecording field name failed validation\n");
2022  res = 0;
2023  }
2024  } else
2025  {
2027  "ARI StoredRecording has undocumented field %s\n",
2028  ast_json_object_iter_key(iter));
2029  res = 0;
2030  }
2031  }
2032 
2033  if (!has_format) {
2034  ast_log(LOG_ERROR, "ARI StoredRecording missing required field format\n");
2035  res = 0;
2036  }
2037 
2038  if (!has_name) {
2039  ast_log(LOG_ERROR, "ARI StoredRecording missing required field name\n");
2040  res = 0;
2041  }
2042 
2043  return res;
2044 }
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_stored_recording_fn()

ari_validator ast_ari_validate_stored_recording_fn ( void  )

Function pointer to ast_ari_validate_stored_recording().

See ast_ari_model_validators.h for more details.

Definition at line 2046 of file ari_model_validators.c.

References ast_ari_validate_stored_recording().

Referenced by ast_ari_recordings_list_stored_cb().

2047 {
2049 }
int ast_ari_validate_stored_recording(struct ast_json *json)
Validator for StoredRecording.

◆ ast_ari_validate_string()

int ast_ari_validate_string ( struct ast_json json)

Validator for native Swagger string.

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

Definition at line 143 of file res_ari_model.c.

References AST_JSON_STRING, and check_type().

Referenced by ast_ari_validate_application(), ast_ari_validate_application_move_failed(), ast_ari_validate_application_replaced(), ast_ari_validate_asterisk_ping(), ast_ari_validate_bridge(), ast_ari_validate_bridge_attended_transfer(), ast_ari_validate_bridge_blind_transfer(), ast_ari_validate_bridge_created(), ast_ari_validate_bridge_destroyed(), ast_ari_validate_bridge_merged(), ast_ari_validate_bridge_video_source_changed(), ast_ari_validate_build_info(), ast_ari_validate_caller_id(), ast_ari_validate_channel(), ast_ari_validate_channel_caller_id(), ast_ari_validate_channel_connected_line(), ast_ari_validate_channel_created(), ast_ari_validate_channel_destroyed(), ast_ari_validate_channel_dialplan(), ast_ari_validate_channel_dtmf_received(), ast_ari_validate_channel_entered_bridge(), ast_ari_validate_channel_hangup_request(), ast_ari_validate_channel_hold(), ast_ari_validate_channel_left_bridge(), ast_ari_validate_channel_state_change(), ast_ari_validate_channel_talking_finished(), ast_ari_validate_channel_talking_started(), ast_ari_validate_channel_unhold(), ast_ari_validate_channel_userevent(), ast_ari_validate_channel_varset(), ast_ari_validate_config_info(), ast_ari_validate_config_tuple(), ast_ari_validate_contact_info(), ast_ari_validate_contact_status_change(), ast_ari_validate_device_state(), ast_ari_validate_device_state_changed(), ast_ari_validate_dial(), ast_ari_validate_dialplan_cep(), ast_ari_validate_endpoint(), ast_ari_validate_endpoint_state_change(), ast_ari_validate_event(), ast_ari_validate_format_lang_pair(), ast_ari_validate_live_recording(), ast_ari_validate_log_channel(), ast_ari_validate_mailbox(), ast_ari_validate_message(), ast_ari_validate_missing_params(), ast_ari_validate_module(), ast_ari_validate_peer(), ast_ari_validate_peer_status_change(), ast_ari_validate_playback(), ast_ari_validate_playback_continuing(), ast_ari_validate_playback_finished(), ast_ari_validate_playback_started(), ast_ari_validate_recording_failed(), ast_ari_validate_recording_finished(), ast_ari_validate_recording_started(), ast_ari_validate_rtpstat(), ast_ari_validate_set_id(), ast_ari_validate_sound(), ast_ari_validate_stasis_end(), ast_ari_validate_stasis_start(), ast_ari_validate_stored_recording(), ast_ari_validate_system_info(), ast_ari_validate_text_message(), ast_ari_validate_text_message_received(), ast_ari_validate_variable(), AST_TEST_DEFINE(), and wrap_ast_ari_validate_string().

144 {
145  return check_type(json, AST_JSON_STRING);
146 }
static int check_type(struct ast_json *json, enum ast_json_type expected)
Definition: res_ari_model.c:55

◆ ast_ari_validate_system_info()

int ast_ari_validate_system_info ( struct ast_json json)

Validator for SystemInfo.

Info about Asterisk

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

Definition at line 729 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_system_info_fn().

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

ari_validator ast_ari_validate_system_info_fn ( void  )

Function pointer to ast_ari_validate_system_info().

See ast_ari_model_validators.h for more details.

Definition at line 778 of file ari_model_validators.c.

References ast_ari_validate_system_info().

779 {
781 }
int ast_ari_validate_system_info(struct ast_json *json)
Validator for SystemInfo.

◆ ast_ari_validate_text_message()

int ast_ari_validate_text_message ( struct ast_json json)

Validator for TextMessage.

A text message.

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

Definition at line 901 of file ari_model_validators.c.

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

Referenced by ast_ari_validate_text_message_fn(), and ast_ari_validate_text_message_received().

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

ari_validator ast_ari_validate_text_message_fn ( void  )

Function pointer to ast_ari_validate_text_message().

See ast_ari_model_validators.h for more details.

Definition at line 975 of file ari_model_validators.c.

References ast_ari_validate_text_message().

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

◆ ast_ari_validate_text_message_received()

int ast_ari_validate_text_message_received ( struct ast_json json)

Validator for TextMessageReceived.

A text message was received from an endpoint.

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

Definition at line 7191 of file ari_model_validators.c.

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

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

7192 {
7193  int res = 1;
7194  struct ast_json_iter *iter;
7195  int has_type = 0;
7196  int has_application = 0;
7197  int has_timestamp = 0;
7198  int has_message = 0;
7199 
7200  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
7201  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
7202  int prop_is_valid;
7203  prop_is_valid = ast_ari_validate_string(
7205  if (!prop_is_valid) {
7206  ast_log(LOG_ERROR, "ARI TextMessageReceived field asterisk_id failed validation\n");
7207  res = 0;
7208  }
7209  } else
7210  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
7211  int prop_is_valid;
7212  has_type = 1;
7213  prop_is_valid = ast_ari_validate_string(
7215  if (!prop_is_valid) {
7216  ast_log(LOG_ERROR, "ARI TextMessageReceived field type failed validation\n");
7217  res = 0;
7218  }
7219  } else
7220  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
7221  int prop_is_valid;
7222  has_application = 1;
7223  prop_is_valid = ast_ari_validate_string(
7225  if (!prop_is_valid) {
7226  ast_log(LOG_ERROR, "ARI TextMessageReceived field application failed validation\n");
7227  res = 0;
7228  }
7229  } else
7230  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
7231  int prop_is_valid;
7232  has_timestamp = 1;
7233  prop_is_valid = ast_ari_validate_date(
7235  if (!prop_is_valid) {
7236  ast_log(LOG_ERROR, "ARI TextMessageReceived field timestamp failed validation\n");
7237  res = 0;
7238  }
7239  } else
7240  if (strcmp("endpoint", ast_json_object_iter_key(iter)) == 0) {
7241  int prop_is_valid;
7242  prop_is_valid = ast_ari_validate_endpoint(
7244  if (!prop_is_valid) {
7245  ast_log(LOG_ERROR, "ARI TextMessageReceived field endpoint failed validation\n");
7246  res = 0;
7247  }
7248  } else
7249  if (strcmp("message", ast_json_object_iter_key(iter)) == 0) {
7250  int prop_is_valid;
7251  has_message = 1;
7252  prop_is_valid = ast_ari_validate_text_message(
7254  if (!prop_is_valid) {
7255  ast_log(LOG_ERROR, "ARI TextMessageReceived field message failed validation\n");
7256  res = 0;
7257  }
7258  } else
7259  {
7261  "ARI TextMessageReceived has undocumented field %s\n",
7262  ast_json_object_iter_key(iter));
7263  res = 0;
7264  }
7265  }
7266 
7267  if (!has_type) {
7268  ast_log(LOG_ERROR, "ARI TextMessageReceived missing required field type\n");
7269  res = 0;
7270  }
7271 
7272  if (!has_application) {
7273  ast_log(LOG_ERROR, "ARI TextMessageReceived missing required field application\n");
7274  res = 0;
7275  }
7276 
7277  if (!has_timestamp) {
7278  ast_log(LOG_ERROR, "ARI TextMessageReceived missing required field timestamp\n");
7279  res = 0;
7280  }
7281 
7282  if (!has_message) {
7283  ast_log(LOG_ERROR, "ARI TextMessageReceived missing required field message\n");
7284  res = 0;
7285  }
7286 
7287  return res;
7288 }
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_endpoint(struct ast_json *json)
Validator for Endpoint.
int ast_ari_validate_text_message(struct ast_json *json)
Validator for TextMessage.
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_text_message_received_fn()

ari_validator ast_ari_validate_text_message_received_fn ( void  )

Function pointer to ast_ari_validate_text_message_received().

See ast_ari_model_validators.h for more details.

Definition at line 7290 of file ari_model_validators.c.

References ast_ari_validate_text_message_received().

7291 {
7293 }
int ast_ari_validate_text_message_received(struct ast_json *json)
Validator for TextMessageReceived.

◆ ast_ari_validate_variable()

int ast_ari_validate_variable ( struct ast_json json)

Validator for Variable.

The value of a channel variable

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

Definition at line 783 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_get_global_var_cb(), ast_ari_channels_get_channel_var_cb(), and ast_ari_validate_variable_fn().

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

ari_validator ast_ari_validate_variable_fn ( void  )

Function pointer to ast_ari_validate_variable().

See ast_ari_model_validators.h for more details.

Definition at line 816 of file ari_model_validators.c.

References ast_ari_validate_variable().

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

◆ ast_ari_validate_void()

int ast_ari_validate_void ( struct ast_json json)

Validator for native Swagger void.

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

Definition at line 91 of file res_ari_model.c.

References AST_JSON_NULL, and check_type().

Referenced by ast_ari_asterisk_add_log_cb(), ast_ari_asterisk_delete_log_cb(), ast_ari_asterisk_delete_object_cb(), ast_ari_asterisk_load_module_cb(), ast_ari_asterisk_reload_module_cb(), ast_ari_asterisk_rotate_log_cb(), ast_ari_asterisk_set_global_var_cb(), ast_ari_asterisk_unload_module_cb(), ast_ari_bridges_add_channel_cb(), ast_ari_bridges_clear_video_source_cb(), ast_ari_bridges_destroy_cb(), ast_ari_bridges_remove_channel_cb(), ast_ari_bridges_set_video_source_cb(), ast_ari_bridges_start_moh_cb(), ast_ari_bridges_stop_moh_cb(), ast_ari_channels_answer_cb(), ast_ari_channels_continue_in_dialplan_cb(), ast_ari_channels_dial_cb(), ast_ari_channels_hangup_cb(), ast_ari_channels_hold_cb(), ast_ari_channels_move_cb(), ast_ari_channels_mute_cb(), ast_ari_channels_redirect_cb(), ast_ari_channels_ring_cb(), ast_ari_channels_ring_stop_cb(), ast_ari_channels_send_dtmf_cb(), ast_ari_channels_set_channel_var_cb(), ast_ari_channels_start_moh_cb(), ast_ari_channels_start_silence_cb(), ast_ari_channels_stop_moh_cb(), ast_ari_channels_stop_silence_cb(), ast_ari_channels_unhold_cb(), ast_ari_channels_unmute_cb(), ast_ari_device_states_delete_cb(), ast_ari_device_states_update_cb(), ast_ari_endpoints_send_message_cb(), ast_ari_endpoints_send_message_to_endpoint_cb(), ast_ari_events_user_event_cb(), ast_ari_mailboxes_delete_cb(), ast_ari_mailboxes_update_cb(), ast_ari_playbacks_control_cb(), ast_ari_playbacks_stop_cb(), ast_ari_recordings_cancel_cb(), ast_ari_recordings_delete_stored_cb(), ast_ari_recordings_mute_cb(), ast_ari_recordings_pause_cb(), ast_ari_recordings_stop_cb(), ast_ari_recordings_unmute_cb(), and ast_ari_recordings_unpause_cb().

92 {
93  return check_type(json, AST_JSON_NULL);
94 }
static int check_type(struct ast_json *json, enum ast_json_type expected)
Definition: res_ari_model.c:55