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

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

#include "asterisk/json.h"

Go to the source code of this file.

Typedefs

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

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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
ari_validator ast_ari_validate_bridge_fn (void)
 Function pointer to ast_ari_validate_bridge().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
ari_validator ast_ari_validate_channel_fn (void)
 Function pointer to ast_ari_validate_channel().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
ari_validator ast_ari_validate_device_state_fn (void)
 Function pointer to ast_ari_validate_device_state().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
ari_validator ast_ari_validate_playback_fn (void)
 Function pointer to ast_ari_validate_playback().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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().
 
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.

Function Documentation

int ast_ari_validate_application ( struct ast_json json)

Validator for Application.

Details of a Stasis application

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

Definition at line 7320 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(), and ast_json_object_iter_value().

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

7321 {
7322  int res = 1;
7323  struct ast_json_iter *iter;
7324  int has_bridge_ids = 0;
7325  int has_channel_ids = 0;
7326  int has_device_names = 0;
7327  int has_endpoint_ids = 0;
7328  int has_events_allowed = 0;
7329  int has_events_disallowed = 0;
7330  int has_name = 0;
7331 
7332  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
7333  if (strcmp("bridge_ids", ast_json_object_iter_key(iter)) == 0) {
7334  int prop_is_valid;
7335  has_bridge_ids = 1;
7336  prop_is_valid = ast_ari_validate_list(
7339  if (!prop_is_valid) {
7340  ast_log(LOG_ERROR, "ARI Application field bridge_ids failed validation\n");
7341  res = 0;
7342  }
7343  } else
7344  if (strcmp("channel_ids", ast_json_object_iter_key(iter)) == 0) {
7345  int prop_is_valid;
7346  has_channel_ids = 1;
7347  prop_is_valid = ast_ari_validate_list(
7350  if (!prop_is_valid) {
7351  ast_log(LOG_ERROR, "ARI Application field channel_ids failed validation\n");
7352  res = 0;
7353  }
7354  } else
7355  if (strcmp("device_names", ast_json_object_iter_key(iter)) == 0) {
7356  int prop_is_valid;
7357  has_device_names = 1;
7358  prop_is_valid = ast_ari_validate_list(
7361  if (!prop_is_valid) {
7362  ast_log(LOG_ERROR, "ARI Application field device_names failed validation\n");
7363  res = 0;
7364  }
7365  } else
7366  if (strcmp("endpoint_ids", ast_json_object_iter_key(iter)) == 0) {
7367  int prop_is_valid;
7368  has_endpoint_ids = 1;
7369  prop_is_valid = ast_ari_validate_list(
7372  if (!prop_is_valid) {
7373  ast_log(LOG_ERROR, "ARI Application field endpoint_ids failed validation\n");
7374  res = 0;
7375  }
7376  } else
7377  if (strcmp("events_allowed", ast_json_object_iter_key(iter)) == 0) {
7378  int prop_is_valid;
7379  has_events_allowed = 1;
7380  prop_is_valid = ast_ari_validate_list(
7383  if (!prop_is_valid) {
7384  ast_log(LOG_ERROR, "ARI Application field events_allowed failed validation\n");
7385  res = 0;
7386  }
7387  } else
7388  if (strcmp("events_disallowed", ast_json_object_iter_key(iter)) == 0) {
7389  int prop_is_valid;
7390  has_events_disallowed = 1;
7391  prop_is_valid = ast_ari_validate_list(
7394  if (!prop_is_valid) {
7395  ast_log(LOG_ERROR, "ARI Application field events_disallowed failed validation\n");
7396  res = 0;
7397  }
7398  } else
7399  if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
7400  int prop_is_valid;
7401  has_name = 1;
7402  prop_is_valid = ast_ari_validate_string(
7404  if (!prop_is_valid) {
7405  ast_log(LOG_ERROR, "ARI Application field name failed validation\n");
7406  res = 0;
7407  }
7408  } else
7409  {
7410  ast_log(LOG_ERROR,
7411  "ARI Application has undocumented field %s\n",
7412  ast_json_object_iter_key(iter));
7413  res = 0;
7414  }
7415  }
7416 
7417  if (!has_bridge_ids) {
7418  ast_log(LOG_ERROR, "ARI Application missing required field bridge_ids\n");
7419  res = 0;
7420  }
7421 
7422  if (!has_channel_ids) {
7423  ast_log(LOG_ERROR, "ARI Application missing required field channel_ids\n");
7424  res = 0;
7425  }
7426 
7427  if (!has_device_names) {
7428  ast_log(LOG_ERROR, "ARI Application missing required field device_names\n");
7429  res = 0;
7430  }
7431 
7432  if (!has_endpoint_ids) {
7433  ast_log(LOG_ERROR, "ARI Application missing required field endpoint_ids\n");
7434  res = 0;
7435  }
7436 
7437  if (!has_events_allowed) {
7438  ast_log(LOG_ERROR, "ARI Application missing required field events_allowed\n");
7439  res = 0;
7440  }
7441 
7442  if (!has_events_disallowed) {
7443  ast_log(LOG_ERROR, "ARI Application missing required field events_disallowed\n");
7444  res = 0;
7445  }
7446 
7447  if (!has_name) {
7448  ast_log(LOG_ERROR, "ARI Application missing required field name\n");
7449  res = 0;
7450  }
7451 
7452  return res;
7453 }
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:439
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_application_move_failed ( struct ast_json json)

Validator for ApplicationMoveFailed.

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

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

Definition at line 2422 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(), and ast_json_object_iter_value().

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

2423 {
2424  int res = 1;
2425  struct ast_json_iter *iter;
2426  int has_type = 0;
2427  int has_application = 0;
2428  int has_timestamp = 0;
2429  int has_args = 0;
2430  int has_channel = 0;
2431  int has_destination = 0;
2432 
2433  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2434  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2435  int prop_is_valid;
2436  prop_is_valid = ast_ari_validate_string(
2438  if (!prop_is_valid) {
2439  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field asterisk_id failed validation\n");
2440  res = 0;
2441  }
2442  } else
2443  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2444  int prop_is_valid;
2445  has_type = 1;
2446  prop_is_valid = ast_ari_validate_string(
2448  if (!prop_is_valid) {
2449  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field type failed validation\n");
2450  res = 0;
2451  }
2452  } else
2453  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2454  int prop_is_valid;
2455  has_application = 1;
2456  prop_is_valid = ast_ari_validate_string(
2458  if (!prop_is_valid) {
2459  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field application failed validation\n");
2460  res = 0;
2461  }
2462  } else
2463  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2464  int prop_is_valid;
2465  has_timestamp = 1;
2466  prop_is_valid = ast_ari_validate_date(
2468  if (!prop_is_valid) {
2469  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field timestamp failed validation\n");
2470  res = 0;
2471  }
2472  } else
2473  if (strcmp("args", ast_json_object_iter_key(iter)) == 0) {
2474  int prop_is_valid;
2475  has_args = 1;
2476  prop_is_valid = ast_ari_validate_list(
2479  if (!prop_is_valid) {
2480  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field args failed validation\n");
2481  res = 0;
2482  }
2483  } else
2484  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2485  int prop_is_valid;
2486  has_channel = 1;
2487  prop_is_valid = ast_ari_validate_channel(
2489  if (!prop_is_valid) {
2490  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field channel failed validation\n");
2491  res = 0;
2492  }
2493  } else
2494  if (strcmp("destination", ast_json_object_iter_key(iter)) == 0) {
2495  int prop_is_valid;
2496  has_destination = 1;
2497  prop_is_valid = ast_ari_validate_string(
2499  if (!prop_is_valid) {
2500  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field destination failed validation\n");
2501  res = 0;
2502  }
2503  } else
2504  {
2505  ast_log(LOG_ERROR,
2506  "ARI ApplicationMoveFailed has undocumented field %s\n",
2507  ast_json_object_iter_key(iter));
2508  res = 0;
2509  }
2510  }
2511 
2512  if (!has_type) {
2513  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed missing required field type\n");
2514  res = 0;
2515  }
2516 
2517  if (!has_application) {
2518  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed missing required field application\n");
2519  res = 0;
2520  }
2521 
2522  if (!has_timestamp) {
2523  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed missing required field timestamp\n");
2524  res = 0;
2525  }
2526 
2527  if (!has_args) {
2528  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed missing required field args\n");
2529  res = 0;
2530  }
2531 
2532  if (!has_channel) {
2533  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed missing required field channel\n");
2534  res = 0;
2535  }
2536 
2537  if (!has_destination) {
2538  ast_log(LOG_ERROR, "ARI ApplicationMoveFailed missing required field destination\n");
2539  res = 0;
2540  }
2541 
2542  return res;
2543 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_application_replaced ( struct ast_json json)

Validator for ApplicationReplaced.

Notification that another WebSocket has taken over for an application.

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

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

Definition at line 2550 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(), and ast_json_object_iter_value().

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

2551 {
2552  int res = 1;
2553  struct ast_json_iter *iter;
2554  int has_type = 0;
2555  int has_application = 0;
2556  int has_timestamp = 0;
2557 
2558  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2559  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2560  int prop_is_valid;
2561  prop_is_valid = ast_ari_validate_string(
2563  if (!prop_is_valid) {
2564  ast_log(LOG_ERROR, "ARI ApplicationReplaced field asterisk_id failed validation\n");
2565  res = 0;
2566  }
2567  } else
2568  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2569  int prop_is_valid;
2570  has_type = 1;
2571  prop_is_valid = ast_ari_validate_string(
2573  if (!prop_is_valid) {
2574  ast_log(LOG_ERROR, "ARI ApplicationReplaced field type failed validation\n");
2575  res = 0;
2576  }
2577  } else
2578  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2579  int prop_is_valid;
2580  has_application = 1;
2581  prop_is_valid = ast_ari_validate_string(
2583  if (!prop_is_valid) {
2584  ast_log(LOG_ERROR, "ARI ApplicationReplaced field application failed validation\n");
2585  res = 0;
2586  }
2587  } else
2588  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2589  int prop_is_valid;
2590  has_timestamp = 1;
2591  prop_is_valid = ast_ari_validate_date(
2593  if (!prop_is_valid) {
2594  ast_log(LOG_ERROR, "ARI ApplicationReplaced field timestamp failed validation\n");
2595  res = 0;
2596  }
2597  } else
2598  {
2599  ast_log(LOG_ERROR,
2600  "ARI ApplicationReplaced has undocumented field %s\n",
2601  ast_json_object_iter_key(iter));
2602  res = 0;
2603  }
2604  }
2605 
2606  if (!has_type) {
2607  ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field type\n");
2608  res = 0;
2609  }
2610 
2611  if (!has_application) {
2612  ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field application\n");
2613  res = 0;
2614  }
2615 
2616  if (!has_timestamp) {
2617  ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field timestamp\n");
2618  res = 0;
2619  }
2620 
2621  return res;
2622 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_asterisk_info ( struct ast_json json)

Validator for AsteriskInfo.

Asterisk system information

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

Definition at line 36 of file ari_model_validators.c.

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(), and ast_json_object_iter_value().

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  {
79  ast_log(LOG_ERROR,
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:439
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.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
struct ast_json_iter * ast_json_object_iter_next(struct ast_json *object, struct ast_json_iter *iter)
Get the next iterator.
Definition: json.c:447
int ast_ari_validate_asterisk_ping ( struct ast_json json)

Validator for AsteriskPing.

Asterisk ping information

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

Definition at line 94 of file ari_model_validators.c.

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

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  {
134  ast_log(LOG_ERROR,
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:439
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_boolean ( struct ast_json json)

Validator for native Swagger boolean.

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

Definition at line 107 of file res_ari_model.c.

References ast_json_typename(), and ast_json_typeof().

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

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
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
int ast_ari_validate_bridge ( struct ast_json json)

Validator for Bridge.

The merging of media from one or more channels.

Everyone on the bridge receives the same audio.

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

Definition at line 1731 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(), and ast_json_object_iter_value().

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

1732 {
1733  int res = 1;
1734  struct ast_json_iter *iter;
1735  int has_bridge_class = 0;
1736  int has_bridge_type = 0;
1737  int has_channels = 0;
1738  int has_creationtime = 0;
1739  int has_creator = 0;
1740  int has_id = 0;
1741  int has_name = 0;
1742  int has_technology = 0;
1743 
1744  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1745  if (strcmp("bridge_class", ast_json_object_iter_key(iter)) == 0) {
1746  int prop_is_valid;
1747  has_bridge_class = 1;
1748  prop_is_valid = ast_ari_validate_string(
1750  if (!prop_is_valid) {
1751  ast_log(LOG_ERROR, "ARI Bridge field bridge_class failed validation\n");
1752  res = 0;
1753  }
1754  } else
1755  if (strcmp("bridge_type", ast_json_object_iter_key(iter)) == 0) {
1756  int prop_is_valid;
1757  has_bridge_type = 1;
1758  prop_is_valid = ast_ari_validate_string(
1760  if (!prop_is_valid) {
1761  ast_log(LOG_ERROR, "ARI Bridge field bridge_type failed validation\n");
1762  res = 0;
1763  }
1764  } else
1765  if (strcmp("channels", ast_json_object_iter_key(iter)) == 0) {
1766  int prop_is_valid;
1767  has_channels = 1;
1768  prop_is_valid = ast_ari_validate_list(
1771  if (!prop_is_valid) {
1772  ast_log(LOG_ERROR, "ARI Bridge field channels failed validation\n");
1773  res = 0;
1774  }
1775  } else
1776  if (strcmp("creationtime", ast_json_object_iter_key(iter)) == 0) {
1777  int prop_is_valid;
1778  has_creationtime = 1;
1779  prop_is_valid = ast_ari_validate_date(
1781  if (!prop_is_valid) {
1782  ast_log(LOG_ERROR, "ARI Bridge field creationtime failed validation\n");
1783  res = 0;
1784  }
1785  } else
1786  if (strcmp("creator", ast_json_object_iter_key(iter)) == 0) {
1787  int prop_is_valid;
1788  has_creator = 1;
1789  prop_is_valid = ast_ari_validate_string(
1791  if (!prop_is_valid) {
1792  ast_log(LOG_ERROR, "ARI Bridge field creator failed validation\n");
1793  res = 0;
1794  }
1795  } else
1796  if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
1797  int prop_is_valid;
1798  has_id = 1;
1799  prop_is_valid = ast_ari_validate_string(
1801  if (!prop_is_valid) {
1802  ast_log(LOG_ERROR, "ARI Bridge field id failed validation\n");
1803  res = 0;
1804  }
1805  } else
1806  if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1807  int prop_is_valid;
1808  has_name = 1;
1809  prop_is_valid = ast_ari_validate_string(
1811  if (!prop_is_valid) {
1812  ast_log(LOG_ERROR, "ARI Bridge field name failed validation\n");
1813  res = 0;
1814  }
1815  } else
1816  if (strcmp("technology", ast_json_object_iter_key(iter)) == 0) {
1817  int prop_is_valid;
1818  has_technology = 1;
1819  prop_is_valid = ast_ari_validate_string(
1821  if (!prop_is_valid) {
1822  ast_log(LOG_ERROR, "ARI Bridge field technology failed validation\n");
1823  res = 0;
1824  }
1825  } else
1826  if (strcmp("video_mode", ast_json_object_iter_key(iter)) == 0) {
1827  int prop_is_valid;
1828  prop_is_valid = ast_ari_validate_string(
1830  if (!prop_is_valid) {
1831  ast_log(LOG_ERROR, "ARI Bridge field video_mode failed validation\n");
1832  res = 0;
1833  }
1834  } else
1835  if (strcmp("video_source_id", ast_json_object_iter_key(iter)) == 0) {
1836  int prop_is_valid;
1837  prop_is_valid = ast_ari_validate_string(
1839  if (!prop_is_valid) {
1840  ast_log(LOG_ERROR, "ARI Bridge field video_source_id failed validation\n");
1841  res = 0;
1842  }
1843  } else
1844  {
1845  ast_log(LOG_ERROR,
1846  "ARI Bridge has undocumented field %s\n",
1847  ast_json_object_iter_key(iter));
1848  res = 0;
1849  }
1850  }
1851 
1852  if (!has_bridge_class) {
1853  ast_log(LOG_ERROR, "ARI Bridge missing required field bridge_class\n");
1854  res = 0;
1855  }
1856 
1857  if (!has_bridge_type) {
1858  ast_log(LOG_ERROR, "ARI Bridge missing required field bridge_type\n");
1859  res = 0;
1860  }
1861 
1862  if (!has_channels) {
1863  ast_log(LOG_ERROR, "ARI Bridge missing required field channels\n");
1864  res = 0;
1865  }
1866 
1867  if (!has_creationtime) {
1868  ast_log(LOG_ERROR, "ARI Bridge missing required field creationtime\n");
1869  res = 0;
1870  }
1871 
1872  if (!has_creator) {
1873  ast_log(LOG_ERROR, "ARI Bridge missing required field creator\n");
1874  res = 0;
1875  }
1876 
1877  if (!has_id) {
1878  ast_log(LOG_ERROR, "ARI Bridge missing required field id\n");
1879  res = 0;
1880  }
1881 
1882  if (!has_name) {
1883  ast_log(LOG_ERROR, "ARI Bridge missing required field name\n");
1884  res = 0;
1885  }
1886 
1887  if (!has_technology) {
1888  ast_log(LOG_ERROR, "ARI Bridge missing required field technology\n");
1889  res = 0;
1890  }
1891 
1892  return res;
1893 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_bridge_attended_transfer ( struct ast_json json)

Validator for BridgeAttendedTransfer.

Notification that an attended transfer has occurred.

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

Definition at line 2629 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(), and ast_json_object_iter_value().

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

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

Validator for BridgeBlindTransfer.

Notification that a blind transfer has occurred.

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

Definition at line 2887 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(), and ast_json_object_iter_value().

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

2888 {
2889  int res = 1;
2890  struct ast_json_iter *iter;
2891  int has_type = 0;
2892  int has_application = 0;
2893  int has_timestamp = 0;
2894  int has_channel = 0;
2895  int has_context = 0;
2896  int has_exten = 0;
2897  int has_is_external = 0;
2898  int has_result = 0;
2899 
2900  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2901  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2902  int prop_is_valid;
2903  prop_is_valid = ast_ari_validate_string(
2905  if (!prop_is_valid) {
2906  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field asterisk_id failed validation\n");
2907  res = 0;
2908  }
2909  } else
2910  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2911  int prop_is_valid;
2912  has_type = 1;
2913  prop_is_valid = ast_ari_validate_string(
2915  if (!prop_is_valid) {
2916  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field type failed validation\n");
2917  res = 0;
2918  }
2919  } else
2920  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2921  int prop_is_valid;
2922  has_application = 1;
2923  prop_is_valid = ast_ari_validate_string(
2925  if (!prop_is_valid) {
2926  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field application failed validation\n");
2927  res = 0;
2928  }
2929  } else
2930  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2931  int prop_is_valid;
2932  has_timestamp = 1;
2933  prop_is_valid = ast_ari_validate_date(
2935  if (!prop_is_valid) {
2936  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field timestamp failed validation\n");
2937  res = 0;
2938  }
2939  } else
2940  if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2941  int prop_is_valid;
2942  prop_is_valid = ast_ari_validate_bridge(
2944  if (!prop_is_valid) {
2945  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field bridge failed validation\n");
2946  res = 0;
2947  }
2948  } else
2949  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2950  int prop_is_valid;
2951  has_channel = 1;
2952  prop_is_valid = ast_ari_validate_channel(
2954  if (!prop_is_valid) {
2955  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field channel failed validation\n");
2956  res = 0;
2957  }
2958  } else
2959  if (strcmp("context", ast_json_object_iter_key(iter)) == 0) {
2960  int prop_is_valid;
2961  has_context = 1;
2962  prop_is_valid = ast_ari_validate_string(
2964  if (!prop_is_valid) {
2965  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field context failed validation\n");
2966  res = 0;
2967  }
2968  } else
2969  if (strcmp("exten", ast_json_object_iter_key(iter)) == 0) {
2970  int prop_is_valid;
2971  has_exten = 1;
2972  prop_is_valid = ast_ari_validate_string(
2974  if (!prop_is_valid) {
2975  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field exten failed validation\n");
2976  res = 0;
2977  }
2978  } else
2979  if (strcmp("is_external", ast_json_object_iter_key(iter)) == 0) {
2980  int prop_is_valid;
2981  has_is_external = 1;
2982  prop_is_valid = ast_ari_validate_boolean(
2984  if (!prop_is_valid) {
2985  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field is_external failed validation\n");
2986  res = 0;
2987  }
2988  } else
2989  if (strcmp("replace_channel", ast_json_object_iter_key(iter)) == 0) {
2990  int prop_is_valid;
2991  prop_is_valid = ast_ari_validate_channel(
2993  if (!prop_is_valid) {
2994  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field replace_channel failed validation\n");
2995  res = 0;
2996  }
2997  } else
2998  if (strcmp("result", ast_json_object_iter_key(iter)) == 0) {
2999  int prop_is_valid;
3000  has_result = 1;
3001  prop_is_valid = ast_ari_validate_string(
3003  if (!prop_is_valid) {
3004  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field result failed validation\n");
3005  res = 0;
3006  }
3007  } else
3008  if (strcmp("transferee", ast_json_object_iter_key(iter)) == 0) {
3009  int prop_is_valid;
3010  prop_is_valid = ast_ari_validate_channel(
3012  if (!prop_is_valid) {
3013  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field transferee failed validation\n");
3014  res = 0;
3015  }
3016  } else
3017  {
3018  ast_log(LOG_ERROR,
3019  "ARI BridgeBlindTransfer has undocumented field %s\n",
3020  ast_json_object_iter_key(iter));
3021  res = 0;
3022  }
3023  }
3024 
3025  if (!has_type) {
3026  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field type\n");
3027  res = 0;
3028  }
3029 
3030  if (!has_application) {
3031  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field application\n");
3032  res = 0;
3033  }
3034 
3035  if (!has_timestamp) {
3036  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field timestamp\n");
3037  res = 0;
3038  }
3039 
3040  if (!has_channel) {
3041  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field channel\n");
3042  res = 0;
3043  }
3044 
3045  if (!has_context) {
3046  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field context\n");
3047  res = 0;
3048  }
3049 
3050  if (!has_exten) {
3051  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field exten\n");
3052  res = 0;
3053  }
3054 
3055  if (!has_is_external) {
3056  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field is_external\n");
3057  res = 0;
3058  }
3059 
3060  if (!has_result) {
3061  ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field result\n");
3062  res = 0;
3063  }
3064 
3065  return res;
3066 }
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:439
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.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_bridge_created ( struct ast_json json)

Validator for BridgeCreated.

Notification that a bridge has been created.

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

Definition at line 3073 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(), and ast_json_object_iter_value().

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

3074 {
3075  int res = 1;
3076  struct ast_json_iter *iter;
3077  int has_type = 0;
3078  int has_application = 0;
3079  int has_timestamp = 0;
3080  int has_bridge = 0;
3081 
3082  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3083  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3084  int prop_is_valid;
3085  prop_is_valid = ast_ari_validate_string(
3087  if (!prop_is_valid) {
3088  ast_log(LOG_ERROR, "ARI BridgeCreated field asterisk_id failed validation\n");
3089  res = 0;
3090  }
3091  } else
3092  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3093  int prop_is_valid;
3094  has_type = 1;
3095  prop_is_valid = ast_ari_validate_string(
3097  if (!prop_is_valid) {
3098  ast_log(LOG_ERROR, "ARI BridgeCreated field type failed validation\n");
3099  res = 0;
3100  }
3101  } else
3102  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3103  int prop_is_valid;
3104  has_application = 1;
3105  prop_is_valid = ast_ari_validate_string(
3107  if (!prop_is_valid) {
3108  ast_log(LOG_ERROR, "ARI BridgeCreated field application failed validation\n");
3109  res = 0;
3110  }
3111  } else
3112  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3113  int prop_is_valid;
3114  has_timestamp = 1;
3115  prop_is_valid = ast_ari_validate_date(
3117  if (!prop_is_valid) {
3118  ast_log(LOG_ERROR, "ARI BridgeCreated field timestamp failed validation\n");
3119  res = 0;
3120  }
3121  } else
3122  if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
3123  int prop_is_valid;
3124  has_bridge = 1;
3125  prop_is_valid = ast_ari_validate_bridge(
3127  if (!prop_is_valid) {
3128  ast_log(LOG_ERROR, "ARI BridgeCreated field bridge failed validation\n");
3129  res = 0;
3130  }
3131  } else
3132  {
3133  ast_log(LOG_ERROR,
3134  "ARI BridgeCreated has undocumented field %s\n",
3135  ast_json_object_iter_key(iter));
3136  res = 0;
3137  }
3138  }
3139 
3140  if (!has_type) {
3141  ast_log(LOG_ERROR, "ARI BridgeCreated missing required field type\n");
3142  res = 0;
3143  }
3144 
3145  if (!has_application) {
3146  ast_log(LOG_ERROR, "ARI BridgeCreated missing required field application\n");
3147  res = 0;
3148  }
3149 
3150  if (!has_timestamp) {
3151  ast_log(LOG_ERROR, "ARI BridgeCreated missing required field timestamp\n");
3152  res = 0;
3153  }
3154 
3155  if (!has_bridge) {
3156  ast_log(LOG_ERROR, "ARI BridgeCreated missing required field bridge\n");
3157  res = 0;
3158  }
3159 
3160  return res;
3161 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_bridge_destroyed ( struct ast_json json)

Validator for BridgeDestroyed.

Notification that a bridge has been destroyed.

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

Definition at line 3168 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(), and ast_json_object_iter_value().

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

3169 {
3170  int res = 1;
3171  struct ast_json_iter *iter;
3172  int has_type = 0;
3173  int has_application = 0;
3174  int has_timestamp = 0;
3175  int has_bridge = 0;
3176 
3177  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3178  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3179  int prop_is_valid;
3180  prop_is_valid = ast_ari_validate_string(
3182  if (!prop_is_valid) {
3183  ast_log(LOG_ERROR, "ARI BridgeDestroyed field asterisk_id failed validation\n");
3184  res = 0;
3185  }
3186  } else
3187  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3188  int prop_is_valid;
3189  has_type = 1;
3190  prop_is_valid = ast_ari_validate_string(
3192  if (!prop_is_valid) {
3193  ast_log(LOG_ERROR, "ARI BridgeDestroyed field type failed validation\n");
3194  res = 0;
3195  }
3196  } else
3197  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3198  int prop_is_valid;
3199  has_application = 1;
3200  prop_is_valid = ast_ari_validate_string(
3202  if (!prop_is_valid) {
3203  ast_log(LOG_ERROR, "ARI BridgeDestroyed field application failed validation\n");
3204  res = 0;
3205  }
3206  } else
3207  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3208  int prop_is_valid;
3209  has_timestamp = 1;
3210  prop_is_valid = ast_ari_validate_date(
3212  if (!prop_is_valid) {
3213  ast_log(LOG_ERROR, "ARI BridgeDestroyed field timestamp failed validation\n");
3214  res = 0;
3215  }
3216  } else
3217  if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
3218  int prop_is_valid;
3219  has_bridge = 1;
3220  prop_is_valid = ast_ari_validate_bridge(
3222  if (!prop_is_valid) {
3223  ast_log(LOG_ERROR, "ARI BridgeDestroyed field bridge failed validation\n");
3224  res = 0;
3225  }
3226  } else
3227  {
3228  ast_log(LOG_ERROR,
3229  "ARI BridgeDestroyed has undocumented field %s\n",
3230  ast_json_object_iter_key(iter));
3231  res = 0;
3232  }
3233  }
3234 
3235  if (!has_type) {
3236  ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field type\n");
3237  res = 0;
3238  }
3239 
3240  if (!has_application) {
3241  ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field application\n");
3242  res = 0;
3243  }
3244 
3245  if (!has_timestamp) {
3246  ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field timestamp\n");
3247  res = 0;
3248  }
3249 
3250  if (!has_bridge) {
3251  ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field bridge\n");
3252  res = 0;
3253  }
3254 
3255  return res;
3256 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_bridge_merged ( struct ast_json json)

Validator for BridgeMerged.

Notification that one bridge has merged into another.

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

Definition at line 3263 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(), and ast_json_object_iter_value().

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

3264 {
3265  int res = 1;
3266  struct ast_json_iter *iter;
3267  int has_type = 0;
3268  int has_application = 0;
3269  int has_timestamp = 0;
3270  int has_bridge = 0;
3271  int has_bridge_from = 0;
3272 
3273  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3274  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3275  int prop_is_valid;
3276  prop_is_valid = ast_ari_validate_string(
3278  if (!prop_is_valid) {
3279  ast_log(LOG_ERROR, "ARI BridgeMerged field asterisk_id failed validation\n");
3280  res = 0;
3281  }
3282  } else
3283  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3284  int prop_is_valid;
3285  has_type = 1;
3286  prop_is_valid = ast_ari_validate_string(
3288  if (!prop_is_valid) {
3289  ast_log(LOG_ERROR, "ARI BridgeMerged field type failed validation\n");
3290  res = 0;
3291  }
3292  } else
3293  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3294  int prop_is_valid;
3295  has_application = 1;
3296  prop_is_valid = ast_ari_validate_string(
3298  if (!prop_is_valid) {
3299  ast_log(LOG_ERROR, "ARI BridgeMerged field application failed validation\n");
3300  res = 0;
3301  }
3302  } else
3303  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3304  int prop_is_valid;
3305  has_timestamp = 1;
3306  prop_is_valid = ast_ari_validate_date(
3308  if (!prop_is_valid) {
3309  ast_log(LOG_ERROR, "ARI BridgeMerged field timestamp failed validation\n");
3310  res = 0;
3311  }
3312  } else
3313  if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
3314  int prop_is_valid;
3315  has_bridge = 1;
3316  prop_is_valid = ast_ari_validate_bridge(
3318  if (!prop_is_valid) {
3319  ast_log(LOG_ERROR, "ARI BridgeMerged field bridge failed validation\n");
3320  res = 0;
3321  }
3322  } else
3323  if (strcmp("bridge_from", ast_json_object_iter_key(iter)) == 0) {
3324  int prop_is_valid;
3325  has_bridge_from = 1;
3326  prop_is_valid = ast_ari_validate_bridge(
3328  if (!prop_is_valid) {
3329  ast_log(LOG_ERROR, "ARI BridgeMerged field bridge_from failed validation\n");
3330  res = 0;
3331  }
3332  } else
3333  {
3334  ast_log(LOG_ERROR,
3335  "ARI BridgeMerged has undocumented field %s\n",
3336  ast_json_object_iter_key(iter));
3337  res = 0;
3338  }
3339  }
3340 
3341  if (!has_type) {
3342  ast_log(LOG_ERROR, "ARI BridgeMerged missing required field type\n");
3343  res = 0;
3344  }
3345 
3346  if (!has_application) {
3347  ast_log(LOG_ERROR, "ARI BridgeMerged missing required field application\n");
3348  res = 0;
3349  }
3350 
3351  if (!has_timestamp) {
3352  ast_log(LOG_ERROR, "ARI BridgeMerged missing required field timestamp\n");
3353  res = 0;
3354  }
3355 
3356  if (!has_bridge) {
3357  ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge\n");
3358  res = 0;
3359  }
3360 
3361  if (!has_bridge_from) {
3362  ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge_from\n");
3363  res = 0;
3364  }
3365 
3366  return res;
3367 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_bridge_video_source_changed ( struct ast_json json)

Validator for BridgeVideoSourceChanged.

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

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

Definition at line 3374 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(), and ast_json_object_iter_value().

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

3375 {
3376  int res = 1;
3377  struct ast_json_iter *iter;
3378  int has_type = 0;
3379  int has_application = 0;
3380  int has_timestamp = 0;
3381  int has_bridge = 0;
3382 
3383  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3384  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3385  int prop_is_valid;
3386  prop_is_valid = ast_ari_validate_string(
3388  if (!prop_is_valid) {
3389  ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field asterisk_id failed validation\n");
3390  res = 0;
3391  }
3392  } else
3393  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3394  int prop_is_valid;
3395  has_type = 1;
3396  prop_is_valid = ast_ari_validate_string(
3398  if (!prop_is_valid) {
3399  ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field type failed validation\n");
3400  res = 0;
3401  }
3402  } else
3403  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3404  int prop_is_valid;
3405  has_application = 1;
3406  prop_is_valid = ast_ari_validate_string(
3408  if (!prop_is_valid) {
3409  ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field application failed validation\n");
3410  res = 0;
3411  }
3412  } else
3413  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3414  int prop_is_valid;
3415  has_timestamp = 1;
3416  prop_is_valid = ast_ari_validate_date(
3418  if (!prop_is_valid) {
3419  ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field timestamp failed validation\n");
3420  res = 0;
3421  }
3422  } else
3423  if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
3424  int prop_is_valid;
3425  has_bridge = 1;
3426  prop_is_valid = ast_ari_validate_bridge(
3428  if (!prop_is_valid) {
3429  ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field bridge failed validation\n");
3430  res = 0;
3431  }
3432  } else
3433  if (strcmp("old_video_source_id", ast_json_object_iter_key(iter)) == 0) {
3434  int prop_is_valid;
3435  prop_is_valid = ast_ari_validate_string(
3437  if (!prop_is_valid) {
3438  ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field old_video_source_id failed validation\n");
3439  res = 0;
3440  }
3441  } else
3442  {
3443  ast_log(LOG_ERROR,
3444  "ARI BridgeVideoSourceChanged has undocumented field %s\n",
3445  ast_json_object_iter_key(iter));
3446  res = 0;
3447  }
3448  }
3449 
3450  if (!has_type) {
3451  ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged missing required field type\n");
3452  res = 0;
3453  }
3454 
3455  if (!has_application) {
3456  ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged missing required field application\n");
3457  res = 0;
3458  }
3459 
3460  if (!has_timestamp) {
3461  ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged missing required field timestamp\n");
3462  res = 0;
3463  }
3464 
3465  if (!has_bridge) {
3466  ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged missing required field bridge\n");
3467  res = 0;
3468  }
3469 
3470  return res;
3471 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_build_info ( struct ast_json json)

Validator for BuildInfo.

Info about how Asterisk was built

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

Definition at line 164 of file ari_model_validators.c.

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

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  {
237  ast_log(LOG_ERROR,
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:439
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_byte ( struct ast_json json)

Validator for native Swagger byte.

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

Definition at line 101 of file res_ari_model.c.

102 {
103  /* Java bytes are signed, which accounts for great fun for all */
104  return check_range(-128, 255, json);
105 }
int ast_ari_validate_caller_id ( struct ast_json json)

Validator for CallerID.

Caller identification

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

Definition at line 980 of file ari_model_validators.c.

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

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  {
1009  ast_log(LOG_ERROR,
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:439
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_channel ( struct ast_json json)

Validator for Channel.

A specific communication connection between Asterisk and an Endpoint.

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

Definition at line 1034 of file ari_model_validators.c.

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(), and ast_json_object_iter_value().

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

Validator for ChannelCallerId.

Channel changed Caller ID.

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

Definition at line 3478 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(), and ast_json_object_iter_value().

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

3479 {
3480  int res = 1;
3481  struct ast_json_iter *iter;
3482  int has_type = 0;
3483  int has_application = 0;
3484  int has_timestamp = 0;
3485  int has_caller_presentation = 0;
3486  int has_caller_presentation_txt = 0;
3487  int has_channel = 0;
3488 
3489  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3490  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3491  int prop_is_valid;
3492  prop_is_valid = ast_ari_validate_string(
3494  if (!prop_is_valid) {
3495  ast_log(LOG_ERROR, "ARI ChannelCallerId field asterisk_id failed validation\n");
3496  res = 0;
3497  }
3498  } else
3499  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3500  int prop_is_valid;
3501  has_type = 1;
3502  prop_is_valid = ast_ari_validate_string(
3504  if (!prop_is_valid) {
3505  ast_log(LOG_ERROR, "ARI ChannelCallerId field type failed validation\n");
3506  res = 0;
3507  }
3508  } else
3509  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3510  int prop_is_valid;
3511  has_application = 1;
3512  prop_is_valid = ast_ari_validate_string(
3514  if (!prop_is_valid) {
3515  ast_log(LOG_ERROR, "ARI ChannelCallerId field application failed validation\n");
3516  res = 0;
3517  }
3518  } else
3519  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3520  int prop_is_valid;
3521  has_timestamp = 1;
3522  prop_is_valid = ast_ari_validate_date(
3524  if (!prop_is_valid) {
3525  ast_log(LOG_ERROR, "ARI ChannelCallerId field timestamp failed validation\n");
3526  res = 0;
3527  }
3528  } else
3529  if (strcmp("caller_presentation", ast_json_object_iter_key(iter)) == 0) {
3530  int prop_is_valid;
3531  has_caller_presentation = 1;
3532  prop_is_valid = ast_ari_validate_int(
3534  if (!prop_is_valid) {
3535  ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation failed validation\n");
3536  res = 0;
3537  }
3538  } else
3539  if (strcmp("caller_presentation_txt", ast_json_object_iter_key(iter)) == 0) {
3540  int prop_is_valid;
3541  has_caller_presentation_txt = 1;
3542  prop_is_valid = ast_ari_validate_string(
3544  if (!prop_is_valid) {
3545  ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation_txt failed validation\n");
3546  res = 0;
3547  }
3548  } else
3549  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
3550  int prop_is_valid;
3551  has_channel = 1;
3552  prop_is_valid = ast_ari_validate_channel(
3554  if (!prop_is_valid) {
3555  ast_log(LOG_ERROR, "ARI ChannelCallerId field channel failed validation\n");
3556  res = 0;
3557  }
3558  } else
3559  {
3560  ast_log(LOG_ERROR,
3561  "ARI ChannelCallerId has undocumented field %s\n",
3562  ast_json_object_iter_key(iter));
3563  res = 0;
3564  }
3565  }
3566 
3567  if (!has_type) {
3568  ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field type\n");
3569  res = 0;
3570  }
3571 
3572  if (!has_application) {
3573  ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field application\n");
3574  res = 0;
3575  }
3576 
3577  if (!has_timestamp) {
3578  ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field timestamp\n");
3579  res = 0;
3580  }
3581 
3582  if (!has_caller_presentation) {
3583  ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation\n");
3584  res = 0;
3585  }
3586 
3587  if (!has_caller_presentation_txt) {
3588  ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation_txt\n");
3589  res = 0;
3590  }
3591 
3592  if (!has_channel) {
3593  ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field channel\n");
3594  res = 0;
3595  }
3596 
3597  return res;
3598 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_channel_connected_line ( struct ast_json json)

Validator for ChannelConnectedLine.

Channel changed Connected Line.

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

Definition at line 3605 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(), and ast_json_object_iter_value().

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

3606 {
3607  int res = 1;
3608  struct ast_json_iter *iter;
3609  int has_type = 0;
3610  int has_application = 0;
3611  int has_timestamp = 0;
3612  int has_channel = 0;
3613 
3614  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3615  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3616  int prop_is_valid;
3617  prop_is_valid = ast_ari_validate_string(
3619  if (!prop_is_valid) {
3620  ast_log(LOG_ERROR, "ARI ChannelConnectedLine field asterisk_id failed validation\n");
3621  res = 0;
3622  }
3623  } else
3624  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3625  int prop_is_valid;
3626  has_type = 1;
3627  prop_is_valid = ast_ari_validate_string(
3629  if (!prop_is_valid) {
3630  ast_log(LOG_ERROR, "ARI ChannelConnectedLine field type failed validation\n");
3631  res = 0;
3632  }
3633  } else
3634  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3635  int prop_is_valid;
3636  has_application = 1;
3637  prop_is_valid = ast_ari_validate_string(
3639  if (!prop_is_valid) {
3640  ast_log(LOG_ERROR, "ARI ChannelConnectedLine field application failed validation\n");
3641  res = 0;
3642  }
3643  } else
3644  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3645  int prop_is_valid;
3646  has_timestamp = 1;
3647  prop_is_valid = ast_ari_validate_date(
3649  if (!prop_is_valid) {
3650  ast_log(LOG_ERROR, "ARI ChannelConnectedLine field timestamp failed validation\n");
3651  res = 0;
3652  }
3653  } else
3654  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
3655  int prop_is_valid;
3656  has_channel = 1;
3657  prop_is_valid = ast_ari_validate_channel(
3659  if (!prop_is_valid) {
3660  ast_log(LOG_ERROR, "ARI ChannelConnectedLine field channel failed validation\n");
3661  res = 0;
3662  }
3663  } else
3664  {
3665  ast_log(LOG_ERROR,
3666  "ARI ChannelConnectedLine has undocumented field %s\n",
3667  ast_json_object_iter_key(iter));
3668  res = 0;
3669  }
3670  }
3671 
3672  if (!has_type) {
3673  ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field type\n");
3674  res = 0;
3675  }
3676 
3677  if (!has_application) {
3678  ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field application\n");
3679  res = 0;
3680  }
3681 
3682  if (!has_timestamp) {
3683  ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field timestamp\n");
3684  res = 0;
3685  }
3686 
3687  if (!has_channel) {
3688  ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field channel\n");
3689  res = 0;
3690  }
3691 
3692  return res;
3693 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_channel_created ( struct ast_json json)

Validator for ChannelCreated.

Notification that a channel has been created.

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

Definition at line 3700 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(), and ast_json_object_iter_value().

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

3701 {
3702  int res = 1;
3703  struct ast_json_iter *iter;
3704  int has_type = 0;
3705  int has_application = 0;
3706  int has_timestamp = 0;
3707  int has_channel = 0;
3708 
3709  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3710  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3711  int prop_is_valid;
3712  prop_is_valid = ast_ari_validate_string(
3714  if (!prop_is_valid) {
3715  ast_log(LOG_ERROR, "ARI ChannelCreated field asterisk_id failed validation\n");
3716  res = 0;
3717  }
3718  } else
3719  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3720  int prop_is_valid;
3721  has_type = 1;
3722  prop_is_valid = ast_ari_validate_string(
3724  if (!prop_is_valid) {
3725  ast_log(LOG_ERROR, "ARI ChannelCreated field type failed validation\n");
3726  res = 0;
3727  }
3728  } else
3729  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3730  int prop_is_valid;
3731  has_application = 1;
3732  prop_is_valid = ast_ari_validate_string(
3734  if (!prop_is_valid) {
3735  ast_log(LOG_ERROR, "ARI ChannelCreated field application failed validation\n");
3736  res = 0;
3737  }
3738  } else
3739  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3740  int prop_is_valid;
3741  has_timestamp = 1;
3742  prop_is_valid = ast_ari_validate_date(
3744  if (!prop_is_valid) {
3745  ast_log(LOG_ERROR, "ARI ChannelCreated field timestamp failed validation\n");
3746  res = 0;
3747  }
3748  } else
3749  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
3750  int prop_is_valid;
3751  has_channel = 1;
3752  prop_is_valid = ast_ari_validate_channel(
3754  if (!prop_is_valid) {
3755  ast_log(LOG_ERROR, "ARI ChannelCreated field channel failed validation\n");
3756  res = 0;
3757  }
3758  } else
3759  {
3760  ast_log(LOG_ERROR,
3761  "ARI ChannelCreated has undocumented field %s\n",
3762  ast_json_object_iter_key(iter));
3763  res = 0;
3764  }
3765  }
3766 
3767  if (!has_type) {
3768  ast_log(LOG_ERROR, "ARI ChannelCreated missing required field type\n");
3769  res = 0;
3770  }
3771 
3772  if (!has_application) {
3773  ast_log(LOG_ERROR, "ARI ChannelCreated missing required field application\n");
3774  res = 0;
3775  }
3776 
3777  if (!has_timestamp) {
3778  ast_log(LOG_ERROR, "ARI ChannelCreated missing required field timestamp\n");
3779  res = 0;
3780  }
3781 
3782  if (!has_channel) {
3783  ast_log(LOG_ERROR, "ARI ChannelCreated missing required field channel\n");
3784  res = 0;
3785  }
3786 
3787  return res;
3788 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_channel_destroyed ( struct ast_json json)

Validator for ChannelDestroyed.

Notification that a channel has been destroyed.

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

Definition at line 3795 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(), and ast_json_object_iter_value().

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

3796 {
3797  int res = 1;
3798  struct ast_json_iter *iter;
3799  int has_type = 0;
3800  int has_application = 0;
3801  int has_timestamp = 0;
3802  int has_cause = 0;
3803  int has_cause_txt = 0;
3804  int has_channel = 0;
3805 
3806  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3807  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3808  int prop_is_valid;
3809  prop_is_valid = ast_ari_validate_string(
3811  if (!prop_is_valid) {
3812  ast_log(LOG_ERROR, "ARI ChannelDestroyed field asterisk_id failed validation\n");
3813  res = 0;
3814  }
3815  } else
3816  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3817  int prop_is_valid;
3818  has_type = 1;
3819  prop_is_valid = ast_ari_validate_string(
3821  if (!prop_is_valid) {
3822  ast_log(LOG_ERROR, "ARI ChannelDestroyed field type failed validation\n");
3823  res = 0;
3824  }
3825  } else
3826  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3827  int prop_is_valid;
3828  has_application = 1;
3829  prop_is_valid = ast_ari_validate_string(
3831  if (!prop_is_valid) {
3832  ast_log(LOG_ERROR, "ARI ChannelDestroyed field application failed validation\n");
3833  res = 0;
3834  }
3835  } else
3836  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3837  int prop_is_valid;
3838  has_timestamp = 1;
3839  prop_is_valid = ast_ari_validate_date(
3841  if (!prop_is_valid) {
3842  ast_log(LOG_ERROR, "ARI ChannelDestroyed field timestamp failed validation\n");
3843  res = 0;
3844  }
3845  } else
3846  if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
3847  int prop_is_valid;
3848  has_cause = 1;
3849  prop_is_valid = ast_ari_validate_int(
3851  if (!prop_is_valid) {
3852  ast_log(LOG_ERROR, "ARI ChannelDestroyed field cause failed validation\n");
3853  res = 0;
3854  }
3855  } else
3856  if (strcmp("cause_txt", ast_json_object_iter_key(iter)) == 0) {
3857  int prop_is_valid;
3858  has_cause_txt = 1;
3859  prop_is_valid = ast_ari_validate_string(
3861  if (!prop_is_valid) {
3862  ast_log(LOG_ERROR, "ARI ChannelDestroyed field cause_txt failed validation\n");
3863  res = 0;
3864  }
3865  } else
3866  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
3867  int prop_is_valid;
3868  has_channel = 1;
3869  prop_is_valid = ast_ari_validate_channel(
3871  if (!prop_is_valid) {
3872  ast_log(LOG_ERROR, "ARI ChannelDestroyed field channel failed validation\n");
3873  res = 0;
3874  }
3875  } else
3876  {
3877  ast_log(LOG_ERROR,
3878  "ARI ChannelDestroyed has undocumented field %s\n",
3879  ast_json_object_iter_key(iter));
3880  res = 0;
3881  }
3882  }
3883 
3884  if (!has_type) {
3885  ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field type\n");
3886  res = 0;
3887  }
3888 
3889  if (!has_application) {
3890  ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field application\n");
3891  res = 0;
3892  }
3893 
3894  if (!has_timestamp) {
3895  ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field timestamp\n");
3896  res = 0;
3897  }
3898 
3899  if (!has_cause) {
3900  ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field cause\n");
3901  res = 0;
3902  }
3903 
3904  if (!has_cause_txt) {
3905  ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field cause_txt\n");
3906  res = 0;
3907  }
3908 
3909  if (!has_channel) {
3910  ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field channel\n");
3911  res = 0;
3912  }
3913 
3914  return res;
3915 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_channel_dialplan ( struct ast_json json)

Validator for ChannelDialplan.

Channel changed location in the dialplan.

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

Definition at line 3922 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(), and ast_json_object_iter_value().

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

3923 {
3924  int res = 1;
3925  struct ast_json_iter *iter;
3926  int has_type = 0;
3927  int has_application = 0;
3928  int has_timestamp = 0;
3929  int has_channel = 0;
3930  int has_dialplan_app = 0;
3931  int has_dialplan_app_data = 0;
3932 
3933  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3934  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3935  int prop_is_valid;
3936  prop_is_valid = ast_ari_validate_string(
3938  if (!prop_is_valid) {
3939  ast_log(LOG_ERROR, "ARI ChannelDialplan field asterisk_id failed validation\n");
3940  res = 0;
3941  }
3942  } else
3943  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3944  int prop_is_valid;
3945  has_type = 1;
3946  prop_is_valid = ast_ari_validate_string(
3948  if (!prop_is_valid) {
3949  ast_log(LOG_ERROR, "ARI ChannelDialplan field type failed validation\n");
3950  res = 0;
3951  }
3952  } else
3953  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3954  int prop_is_valid;
3955  has_application = 1;
3956  prop_is_valid = ast_ari_validate_string(
3958  if (!prop_is_valid) {
3959  ast_log(LOG_ERROR, "ARI ChannelDialplan field application failed validation\n");
3960  res = 0;
3961  }
3962  } else
3963  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3964  int prop_is_valid;
3965  has_timestamp = 1;
3966  prop_is_valid = ast_ari_validate_date(
3968  if (!prop_is_valid) {
3969  ast_log(LOG_ERROR, "ARI ChannelDialplan field timestamp failed validation\n");
3970  res = 0;
3971  }
3972  } else
3973  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
3974  int prop_is_valid;
3975  has_channel = 1;
3976  prop_is_valid = ast_ari_validate_channel(
3978  if (!prop_is_valid) {
3979  ast_log(LOG_ERROR, "ARI ChannelDialplan field channel failed validation\n");
3980  res = 0;
3981  }
3982  } else
3983  if (strcmp("dialplan_app", ast_json_object_iter_key(iter)) == 0) {
3984  int prop_is_valid;
3985  has_dialplan_app = 1;
3986  prop_is_valid = ast_ari_validate_string(
3988  if (!prop_is_valid) {
3989  ast_log(LOG_ERROR, "ARI ChannelDialplan field dialplan_app failed validation\n");
3990  res = 0;
3991  }
3992  } else
3993  if (strcmp("dialplan_app_data", ast_json_object_iter_key(iter)) == 0) {
3994  int prop_is_valid;
3995  has_dialplan_app_data = 1;
3996  prop_is_valid = ast_ari_validate_string(
3998  if (!prop_is_valid) {
3999  ast_log(LOG_ERROR, "ARI ChannelDialplan field dialplan_app_data failed validation\n");
4000  res = 0;
4001  }
4002  } else
4003  {
4004  ast_log(LOG_ERROR,
4005  "ARI ChannelDialplan has undocumented field %s\n",
4006  ast_json_object_iter_key(iter));
4007  res = 0;
4008  }
4009  }
4010 
4011  if (!has_type) {
4012  ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field type\n");
4013  res = 0;
4014  }
4015 
4016  if (!has_application) {
4017  ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field application\n");
4018  res = 0;
4019  }
4020 
4021  if (!has_timestamp) {
4022  ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field timestamp\n");
4023  res = 0;
4024  }
4025 
4026  if (!has_channel) {
4027  ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field channel\n");
4028  res = 0;
4029  }
4030 
4031  if (!has_dialplan_app) {
4032  ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field dialplan_app\n");
4033  res = 0;
4034  }
4035 
4036  if (!has_dialplan_app_data) {
4037  ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field dialplan_app_data\n");
4038  res = 0;
4039  }
4040 
4041  return res;
4042 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_channel_dtmf_received ( struct ast_json json)

Validator for ChannelDtmfReceived.

DTMF received on a channel.

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

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

Definition at line 4049 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(), and ast_json_object_iter_value().

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

4050 {
4051  int res = 1;
4052  struct ast_json_iter *iter;
4053  int has_type = 0;
4054  int has_application = 0;
4055  int has_timestamp = 0;
4056  int has_channel = 0;
4057  int has_digit = 0;
4058  int has_duration_ms = 0;
4059 
4060  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4061  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4062  int prop_is_valid;
4063  prop_is_valid = ast_ari_validate_string(
4065  if (!prop_is_valid) {
4066  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field asterisk_id failed validation\n");
4067  res = 0;
4068  }
4069  } else
4070  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4071  int prop_is_valid;
4072  has_type = 1;
4073  prop_is_valid = ast_ari_validate_string(
4075  if (!prop_is_valid) {
4076  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field type failed validation\n");
4077  res = 0;
4078  }
4079  } else
4080  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4081  int prop_is_valid;
4082  has_application = 1;
4083  prop_is_valid = ast_ari_validate_string(
4085  if (!prop_is_valid) {
4086  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field application failed validation\n");
4087  res = 0;
4088  }
4089  } else
4090  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4091  int prop_is_valid;
4092  has_timestamp = 1;
4093  prop_is_valid = ast_ari_validate_date(
4095  if (!prop_is_valid) {
4096  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field timestamp failed validation\n");
4097  res = 0;
4098  }
4099  } else
4100  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4101  int prop_is_valid;
4102  has_channel = 1;
4103  prop_is_valid = ast_ari_validate_channel(
4105  if (!prop_is_valid) {
4106  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field channel failed validation\n");
4107  res = 0;
4108  }
4109  } else
4110  if (strcmp("digit", ast_json_object_iter_key(iter)) == 0) {
4111  int prop_is_valid;
4112  has_digit = 1;
4113  prop_is_valid = ast_ari_validate_string(
4115  if (!prop_is_valid) {
4116  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field digit failed validation\n");
4117  res = 0;
4118  }
4119  } else
4120  if (strcmp("duration_ms", ast_json_object_iter_key(iter)) == 0) {
4121  int prop_is_valid;
4122  has_duration_ms = 1;
4123  prop_is_valid = ast_ari_validate_int(
4125  if (!prop_is_valid) {
4126  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field duration_ms failed validation\n");
4127  res = 0;
4128  }
4129  } else
4130  {
4131  ast_log(LOG_ERROR,
4132  "ARI ChannelDtmfReceived has undocumented field %s\n",
4133  ast_json_object_iter_key(iter));
4134  res = 0;
4135  }
4136  }
4137 
4138  if (!has_type) {
4139  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field type\n");
4140  res = 0;
4141  }
4142 
4143  if (!has_application) {
4144  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field application\n");
4145  res = 0;
4146  }
4147 
4148  if (!has_timestamp) {
4149  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field timestamp\n");
4150  res = 0;
4151  }
4152 
4153  if (!has_channel) {
4154  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field channel\n");
4155  res = 0;
4156  }
4157 
4158  if (!has_digit) {
4159  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field digit\n");
4160  res = 0;
4161  }
4162 
4163  if (!has_duration_ms) {
4164  ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field duration_ms\n");
4165  res = 0;
4166  }
4167 
4168  return res;
4169 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_channel_entered_bridge ( struct ast_json json)

Validator for ChannelEnteredBridge.

Notification that a channel has entered a bridge.

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

Definition at line 4176 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(), and ast_json_object_iter_value().

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

4177 {
4178  int res = 1;
4179  struct ast_json_iter *iter;
4180  int has_type = 0;
4181  int has_application = 0;
4182  int has_timestamp = 0;
4183  int has_bridge = 0;
4184 
4185  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4186  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4187  int prop_is_valid;
4188  prop_is_valid = ast_ari_validate_string(
4190  if (!prop_is_valid) {
4191  ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field asterisk_id failed validation\n");
4192  res = 0;
4193  }
4194  } else
4195  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4196  int prop_is_valid;
4197  has_type = 1;
4198  prop_is_valid = ast_ari_validate_string(
4200  if (!prop_is_valid) {
4201  ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field type failed validation\n");
4202  res = 0;
4203  }
4204  } else
4205  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4206  int prop_is_valid;
4207  has_application = 1;
4208  prop_is_valid = ast_ari_validate_string(
4210  if (!prop_is_valid) {
4211  ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field application failed validation\n");
4212  res = 0;
4213  }
4214  } else
4215  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4216  int prop_is_valid;
4217  has_timestamp = 1;
4218  prop_is_valid = ast_ari_validate_date(
4220  if (!prop_is_valid) {
4221  ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field timestamp failed validation\n");
4222  res = 0;
4223  }
4224  } else
4225  if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
4226  int prop_is_valid;
4227  has_bridge = 1;
4228  prop_is_valid = ast_ari_validate_bridge(
4230  if (!prop_is_valid) {
4231  ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field bridge failed validation\n");
4232  res = 0;
4233  }
4234  } else
4235  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4236  int prop_is_valid;
4237  prop_is_valid = ast_ari_validate_channel(
4239  if (!prop_is_valid) {
4240  ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field channel failed validation\n");
4241  res = 0;
4242  }
4243  } else
4244  {
4245  ast_log(LOG_ERROR,
4246  "ARI ChannelEnteredBridge has undocumented field %s\n",
4247  ast_json_object_iter_key(iter));
4248  res = 0;
4249  }
4250  }
4251 
4252  if (!has_type) {
4253  ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field type\n");
4254  res = 0;
4255  }
4256 
4257  if (!has_application) {
4258  ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field application\n");
4259  res = 0;
4260  }
4261 
4262  if (!has_timestamp) {
4263  ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field timestamp\n");
4264  res = 0;
4265  }
4266 
4267  if (!has_bridge) {
4268  ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field bridge\n");
4269  res = 0;
4270  }
4271 
4272  return res;
4273 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_channel_hangup_request ( struct ast_json json)

Validator for ChannelHangupRequest.

A hangup was requested on the channel.

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

Definition at line 4280 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(), and ast_json_object_iter_value().

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

4281 {
4282  int res = 1;
4283  struct ast_json_iter *iter;
4284  int has_type = 0;
4285  int has_application = 0;
4286  int has_timestamp = 0;
4287  int has_channel = 0;
4288 
4289  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4290  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4291  int prop_is_valid;
4292  prop_is_valid = ast_ari_validate_string(
4294  if (!prop_is_valid) {
4295  ast_log(LOG_ERROR, "ARI ChannelHangupRequest field asterisk_id failed validation\n");
4296  res = 0;
4297  }
4298  } else
4299  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4300  int prop_is_valid;
4301  has_type = 1;
4302  prop_is_valid = ast_ari_validate_string(
4304  if (!prop_is_valid) {
4305  ast_log(LOG_ERROR, "ARI ChannelHangupRequest field type failed validation\n");
4306  res = 0;
4307  }
4308  } else
4309  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4310  int prop_is_valid;
4311  has_application = 1;
4312  prop_is_valid = ast_ari_validate_string(
4314  if (!prop_is_valid) {
4315  ast_log(LOG_ERROR, "ARI ChannelHangupRequest field application failed validation\n");
4316  res = 0;
4317  }
4318  } else
4319  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4320  int prop_is_valid;
4321  has_timestamp = 1;
4322  prop_is_valid = ast_ari_validate_date(
4324  if (!prop_is_valid) {
4325  ast_log(LOG_ERROR, "ARI ChannelHangupRequest field timestamp failed validation\n");
4326  res = 0;
4327  }
4328  } else
4329  if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
4330  int prop_is_valid;
4331  prop_is_valid = ast_ari_validate_int(
4333  if (!prop_is_valid) {
4334  ast_log(LOG_ERROR, "ARI ChannelHangupRequest field cause failed validation\n");
4335  res = 0;
4336  }
4337  } else
4338  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4339  int prop_is_valid;
4340  has_channel = 1;
4341  prop_is_valid = ast_ari_validate_channel(
4343  if (!prop_is_valid) {
4344  ast_log(LOG_ERROR, "ARI ChannelHangupRequest field channel failed validation\n");
4345  res = 0;
4346  }
4347  } else
4348  if (strcmp("soft", ast_json_object_iter_key(iter)) == 0) {
4349  int prop_is_valid;
4350  prop_is_valid = ast_ari_validate_boolean(
4352  if (!prop_is_valid) {
4353  ast_log(LOG_ERROR, "ARI ChannelHangupRequest field soft failed validation\n");
4354  res = 0;
4355  }
4356  } else
4357  {
4358  ast_log(LOG_ERROR,
4359  "ARI ChannelHangupRequest has undocumented field %s\n",
4360  ast_json_object_iter_key(iter));
4361  res = 0;
4362  }
4363  }
4364 
4365  if (!has_type) {
4366  ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field type\n");
4367  res = 0;
4368  }
4369 
4370  if (!has_application) {
4371  ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field application\n");
4372  res = 0;
4373  }
4374 
4375  if (!has_timestamp) {
4376  ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field timestamp\n");
4377  res = 0;
4378  }
4379 
4380  if (!has_channel) {
4381  ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field channel\n");
4382  res = 0;
4383  }
4384 
4385  return res;
4386 }
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:439
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.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_channel_hold ( struct ast_json json)

Validator for ChannelHold.

A channel initiated a media hold.

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

Definition at line 4393 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(), and ast_json_object_iter_value().

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

4394 {
4395  int res = 1;
4396  struct ast_json_iter *iter;
4397  int has_type = 0;
4398  int has_application = 0;
4399  int has_timestamp = 0;
4400  int has_channel = 0;
4401 
4402  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4403  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4404  int prop_is_valid;
4405  prop_is_valid = ast_ari_validate_string(
4407  if (!prop_is_valid) {
4408  ast_log(LOG_ERROR, "ARI ChannelHold field asterisk_id failed validation\n");
4409  res = 0;
4410  }
4411  } else
4412  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4413  int prop_is_valid;
4414  has_type = 1;
4415  prop_is_valid = ast_ari_validate_string(
4417  if (!prop_is_valid) {
4418  ast_log(LOG_ERROR, "ARI ChannelHold field type failed validation\n");
4419  res = 0;
4420  }
4421  } else
4422  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4423  int prop_is_valid;
4424  has_application = 1;
4425  prop_is_valid = ast_ari_validate_string(
4427  if (!prop_is_valid) {
4428  ast_log(LOG_ERROR, "ARI ChannelHold field application failed validation\n");
4429  res = 0;
4430  }
4431  } else
4432  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4433  int prop_is_valid;
4434  has_timestamp = 1;
4435  prop_is_valid = ast_ari_validate_date(
4437  if (!prop_is_valid) {
4438  ast_log(LOG_ERROR, "ARI ChannelHold field timestamp failed validation\n");
4439  res = 0;
4440  }
4441  } else
4442  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4443  int prop_is_valid;
4444  has_channel = 1;
4445  prop_is_valid = ast_ari_validate_channel(
4447  if (!prop_is_valid) {
4448  ast_log(LOG_ERROR, "ARI ChannelHold field channel failed validation\n");
4449  res = 0;
4450  }
4451  } else
4452  if (strcmp("musicclass", ast_json_object_iter_key(iter)) == 0) {
4453  int prop_is_valid;
4454  prop_is_valid = ast_ari_validate_string(
4456  if (!prop_is_valid) {
4457  ast_log(LOG_ERROR, "ARI ChannelHold field musicclass failed validation\n");
4458  res = 0;
4459  }
4460  } else
4461  {
4462  ast_log(LOG_ERROR,
4463  "ARI ChannelHold has undocumented field %s\n",
4464  ast_json_object_iter_key(iter));
4465  res = 0;
4466  }
4467  }
4468 
4469  if (!has_type) {
4470  ast_log(LOG_ERROR, "ARI ChannelHold missing required field type\n");
4471  res = 0;
4472  }
4473 
4474  if (!has_application) {
4475  ast_log(LOG_ERROR, "ARI ChannelHold missing required field application\n");
4476  res = 0;
4477  }
4478 
4479  if (!has_timestamp) {
4480  ast_log(LOG_ERROR, "ARI ChannelHold missing required field timestamp\n");
4481  res = 0;
4482  }
4483 
4484  if (!has_channel) {
4485  ast_log(LOG_ERROR, "ARI ChannelHold missing required field channel\n");
4486  res = 0;
4487  }
4488 
4489  return res;
4490 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_channel_left_bridge ( struct ast_json json)

Validator for ChannelLeftBridge.

Notification that a channel has left a bridge.

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

Definition at line 4497 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(), and ast_json_object_iter_value().

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

4498 {
4499  int res = 1;
4500  struct ast_json_iter *iter;
4501  int has_type = 0;
4502  int has_application = 0;
4503  int has_timestamp = 0;
4504  int has_bridge = 0;
4505  int has_channel = 0;
4506 
4507  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4508  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4509  int prop_is_valid;
4510  prop_is_valid = ast_ari_validate_string(
4512  if (!prop_is_valid) {
4513  ast_log(LOG_ERROR, "ARI ChannelLeftBridge field asterisk_id failed validation\n");
4514  res = 0;
4515  }
4516  } else
4517  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4518  int prop_is_valid;
4519  has_type = 1;
4520  prop_is_valid = ast_ari_validate_string(
4522  if (!prop_is_valid) {
4523  ast_log(LOG_ERROR, "ARI ChannelLeftBridge field type failed validation\n");
4524  res = 0;
4525  }
4526  } else
4527  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4528  int prop_is_valid;
4529  has_application = 1;
4530  prop_is_valid = ast_ari_validate_string(
4532  if (!prop_is_valid) {
4533  ast_log(LOG_ERROR, "ARI ChannelLeftBridge field application failed validation\n");
4534  res = 0;
4535  }
4536  } else
4537  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4538  int prop_is_valid;
4539  has_timestamp = 1;
4540  prop_is_valid = ast_ari_validate_date(
4542  if (!prop_is_valid) {
4543  ast_log(LOG_ERROR, "ARI ChannelLeftBridge field timestamp failed validation\n");
4544  res = 0;
4545  }
4546  } else
4547  if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
4548  int prop_is_valid;
4549  has_bridge = 1;
4550  prop_is_valid = ast_ari_validate_bridge(
4552  if (!prop_is_valid) {
4553  ast_log(LOG_ERROR, "ARI ChannelLeftBridge field bridge failed validation\n");
4554  res = 0;
4555  }
4556  } else
4557  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4558  int prop_is_valid;
4559  has_channel = 1;
4560  prop_is_valid = ast_ari_validate_channel(
4562  if (!prop_is_valid) {
4563  ast_log(LOG_ERROR, "ARI ChannelLeftBridge field channel failed validation\n");
4564  res = 0;
4565  }
4566  } else
4567  {
4568  ast_log(LOG_ERROR,
4569  "ARI ChannelLeftBridge has undocumented field %s\n",
4570  ast_json_object_iter_key(iter));
4571  res = 0;
4572  }
4573  }
4574 
4575  if (!has_type) {
4576  ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field type\n");
4577  res = 0;
4578  }
4579 
4580  if (!has_application) {
4581  ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field application\n");
4582  res = 0;
4583  }
4584 
4585  if (!has_timestamp) {
4586  ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field timestamp\n");
4587  res = 0;
4588  }
4589 
4590  if (!has_bridge) {
4591  ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field bridge\n");
4592  res = 0;
4593  }
4594 
4595  if (!has_channel) {
4596  ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field channel\n");
4597  res = 0;
4598  }
4599 
4600  return res;
4601 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_channel_state_change ( struct ast_json json)

Validator for ChannelStateChange.

Notification of a channel's state change.

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

Definition at line 4608 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(), and ast_json_object_iter_value().

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

4609 {
4610  int res = 1;
4611  struct ast_json_iter *iter;
4612  int has_type = 0;
4613  int has_application = 0;
4614  int has_timestamp = 0;
4615  int has_channel = 0;
4616 
4617  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4618  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4619  int prop_is_valid;
4620  prop_is_valid = ast_ari_validate_string(
4622  if (!prop_is_valid) {
4623  ast_log(LOG_ERROR, "ARI ChannelStateChange field asterisk_id failed validation\n");
4624  res = 0;
4625  }
4626  } else
4627  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4628  int prop_is_valid;
4629  has_type = 1;
4630  prop_is_valid = ast_ari_validate_string(
4632  if (!prop_is_valid) {
4633  ast_log(LOG_ERROR, "ARI ChannelStateChange field type failed validation\n");
4634  res = 0;
4635  }
4636  } else
4637  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4638  int prop_is_valid;
4639  has_application = 1;
4640  prop_is_valid = ast_ari_validate_string(
4642  if (!prop_is_valid) {
4643  ast_log(LOG_ERROR, "ARI ChannelStateChange field application failed validation\n");
4644  res = 0;
4645  }
4646  } else
4647  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4648  int prop_is_valid;
4649  has_timestamp = 1;
4650  prop_is_valid = ast_ari_validate_date(
4652  if (!prop_is_valid) {
4653  ast_log(LOG_ERROR, "ARI ChannelStateChange field timestamp failed validation\n");
4654  res = 0;
4655  }
4656  } else
4657  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4658  int prop_is_valid;
4659  has_channel = 1;
4660  prop_is_valid = ast_ari_validate_channel(
4662  if (!prop_is_valid) {
4663  ast_log(LOG_ERROR, "ARI ChannelStateChange field channel failed validation\n");
4664  res = 0;
4665  }
4666  } else
4667  {
4668  ast_log(LOG_ERROR,
4669  "ARI ChannelStateChange has undocumented field %s\n",
4670  ast_json_object_iter_key(iter));
4671  res = 0;
4672  }
4673  }
4674 
4675  if (!has_type) {
4676  ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field type\n");
4677  res = 0;
4678  }
4679 
4680  if (!has_application) {
4681  ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field application\n");
4682  res = 0;
4683  }
4684 
4685  if (!has_timestamp) {
4686  ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field timestamp\n");
4687  res = 0;
4688  }
4689 
4690  if (!has_channel) {
4691  ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field channel\n");
4692  res = 0;
4693  }
4694 
4695  return res;
4696 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_channel_talking_finished ( struct ast_json json)

Validator for ChannelTalkingFinished.

Talking is no longer detected on the channel.

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

Definition at line 4703 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(), and ast_json_object_iter_value().

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

4704 {
4705  int res = 1;
4706  struct ast_json_iter *iter;
4707  int has_type = 0;
4708  int has_application = 0;
4709  int has_timestamp = 0;
4710  int has_channel = 0;
4711  int has_duration = 0;
4712 
4713  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4714  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4715  int prop_is_valid;
4716  prop_is_valid = ast_ari_validate_string(
4718  if (!prop_is_valid) {
4719  ast_log(LOG_ERROR, "ARI ChannelTalkingFinished field asterisk_id failed validation\n");
4720  res = 0;
4721  }
4722  } else
4723  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4724  int prop_is_valid;
4725  has_type = 1;
4726  prop_is_valid = ast_ari_validate_string(
4728  if (!prop_is_valid) {
4729  ast_log(LOG_ERROR, "ARI ChannelTalkingFinished field type failed validation\n");
4730  res = 0;
4731  }
4732  } else
4733  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4734  int prop_is_valid;
4735  has_application = 1;
4736  prop_is_valid = ast_ari_validate_string(
4738  if (!prop_is_valid) {
4739  ast_log(LOG_ERROR, "ARI ChannelTalkingFinished field application failed validation\n");
4740  res = 0;
4741  }
4742  } else
4743  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4744  int prop_is_valid;
4745  has_timestamp = 1;
4746  prop_is_valid = ast_ari_validate_date(
4748  if (!prop_is_valid) {
4749  ast_log(LOG_ERROR, "ARI ChannelTalkingFinished field timestamp failed validation\n");
4750  res = 0;
4751  }
4752  } else
4753  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4754  int prop_is_valid;
4755  has_channel = 1;
4756  prop_is_valid = ast_ari_validate_channel(
4758  if (!prop_is_valid) {
4759  ast_log(LOG_ERROR, "ARI ChannelTalkingFinished field channel failed validation\n");
4760  res = 0;
4761  }
4762  } else
4763  if (strcmp("duration", ast_json_object_iter_key(iter)) == 0) {
4764  int prop_is_valid;
4765  has_duration = 1;
4766  prop_is_valid = ast_ari_validate_int(
4768  if (!prop_is_valid) {
4769  ast_log(LOG_ERROR, "ARI ChannelTalkingFinished field duration failed validation\n");
4770  res = 0;
4771  }
4772  } else
4773  {
4774  ast_log(LOG_ERROR,
4775  "ARI ChannelTalkingFinished has undocumented field %s\n",
4776  ast_json_object_iter_key(iter));
4777  res = 0;
4778  }
4779  }
4780 
4781  if (!has_type) {
4782  ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field type\n");
4783  res = 0;
4784  }
4785 
4786  if (!has_application) {
4787  ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field application\n");
4788  res = 0;
4789  }
4790 
4791  if (!has_timestamp) {
4792  ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field timestamp\n");
4793  res = 0;
4794  }
4795 
4796  if (!has_channel) {
4797  ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field channel\n");
4798  res = 0;
4799  }
4800 
4801  if (!has_duration) {
4802  ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field duration\n");
4803  res = 0;
4804  }
4805 
4806  return res;
4807 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_channel_talking_started ( struct ast_json json)

Validator for ChannelTalkingStarted.

Talking was detected on the channel.

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

Definition at line 4814 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(), and ast_json_object_iter_value().

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

4815 {
4816  int res = 1;
4817  struct ast_json_iter *iter;
4818  int has_type = 0;
4819  int has_application = 0;
4820  int has_timestamp = 0;
4821  int has_channel = 0;
4822 
4823  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4824  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4825  int prop_is_valid;
4826  prop_is_valid = ast_ari_validate_string(
4828  if (!prop_is_valid) {
4829  ast_log(LOG_ERROR, "ARI ChannelTalkingStarted field asterisk_id failed validation\n");
4830  res = 0;
4831  }
4832  } else
4833  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4834  int prop_is_valid;
4835  has_type = 1;
4836  prop_is_valid = ast_ari_validate_string(
4838  if (!prop_is_valid) {
4839  ast_log(LOG_ERROR, "ARI ChannelTalkingStarted field type failed validation\n");
4840  res = 0;
4841  }
4842  } else
4843  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4844  int prop_is_valid;
4845  has_application = 1;
4846  prop_is_valid = ast_ari_validate_string(
4848  if (!prop_is_valid) {
4849  ast_log(LOG_ERROR, "ARI ChannelTalkingStarted field application failed validation\n");
4850  res = 0;
4851  }
4852  } else
4853  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4854  int prop_is_valid;
4855  has_timestamp = 1;
4856  prop_is_valid = ast_ari_validate_date(
4858  if (!prop_is_valid) {
4859  ast_log(LOG_ERROR, "ARI ChannelTalkingStarted field timestamp failed validation\n");
4860  res = 0;
4861  }
4862  } else
4863  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4864  int prop_is_valid;
4865  has_channel = 1;
4866  prop_is_valid = ast_ari_validate_channel(
4868  if (!prop_is_valid) {
4869  ast_log(LOG_ERROR, "ARI ChannelTalkingStarted field channel failed validation\n");
4870  res = 0;
4871  }
4872  } else
4873  {
4874  ast_log(LOG_ERROR,
4875  "ARI ChannelTalkingStarted has undocumented field %s\n",
4876  ast_json_object_iter_key(iter));
4877  res = 0;
4878  }
4879  }
4880 
4881  if (!has_type) {
4882  ast_log(LOG_ERROR, "ARI ChannelTalkingStarted missing required field type\n");
4883  res = 0;
4884  }
4885 
4886  if (!has_application) {
4887  ast_log(LOG_ERROR, "ARI ChannelTalkingStarted missing required field application\n");
4888  res = 0;
4889  }
4890 
4891  if (!has_timestamp) {
4892  ast_log(LOG_ERROR, "ARI ChannelTalkingStarted missing required field timestamp\n");
4893  res = 0;
4894  }
4895 
4896  if (!has_channel) {
4897  ast_log(LOG_ERROR, "ARI ChannelTalkingStarted missing required field channel\n");
4898  res = 0;
4899  }
4900 
4901  return res;
4902 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_channel_unhold ( struct ast_json json)

Validator for ChannelUnhold.

A channel initiated a media unhold.

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

Definition at line 4909 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(), and ast_json_object_iter_value().

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

4910 {
4911  int res = 1;
4912  struct ast_json_iter *iter;
4913  int has_type = 0;
4914  int has_application = 0;
4915  int has_timestamp = 0;
4916  int has_channel = 0;
4917 
4918  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
4919  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
4920  int prop_is_valid;
4921  prop_is_valid = ast_ari_validate_string(
4923  if (!prop_is_valid) {
4924  ast_log(LOG_ERROR, "ARI ChannelUnhold field asterisk_id failed validation\n");
4925  res = 0;
4926  }
4927  } else
4928  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
4929  int prop_is_valid;
4930  has_type = 1;
4931  prop_is_valid = ast_ari_validate_string(
4933  if (!prop_is_valid) {
4934  ast_log(LOG_ERROR, "ARI ChannelUnhold field type failed validation\n");
4935  res = 0;
4936  }
4937  } else
4938  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
4939  int prop_is_valid;
4940  has_application = 1;
4941  prop_is_valid = ast_ari_validate_string(
4943  if (!prop_is_valid) {
4944  ast_log(LOG_ERROR, "ARI ChannelUnhold field application failed validation\n");
4945  res = 0;
4946  }
4947  } else
4948  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
4949  int prop_is_valid;
4950  has_timestamp = 1;
4951  prop_is_valid = ast_ari_validate_date(
4953  if (!prop_is_valid) {
4954  ast_log(LOG_ERROR, "ARI ChannelUnhold field timestamp failed validation\n");
4955  res = 0;
4956  }
4957  } else
4958  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
4959  int prop_is_valid;
4960  has_channel = 1;
4961  prop_is_valid = ast_ari_validate_channel(
4963  if (!prop_is_valid) {
4964  ast_log(LOG_ERROR, "ARI ChannelUnhold field channel failed validation\n");
4965  res = 0;
4966  }
4967  } else
4968  {
4969  ast_log(LOG_ERROR,
4970  "ARI ChannelUnhold has undocumented field %s\n",
4971  ast_json_object_iter_key(iter));
4972  res = 0;
4973  }
4974  }
4975 
4976  if (!has_type) {
4977  ast_log(LOG_ERROR, "ARI ChannelUnhold missing required field type\n");
4978  res = 0;
4979  }
4980 
4981  if (!has_application) {
4982  ast_log(LOG_ERROR, "ARI ChannelUnhold missing required field application\n");
4983  res = 0;
4984  }
4985 
4986  if (!has_timestamp) {
4987  ast_log(LOG_ERROR, "ARI ChannelUnhold missing required field timestamp\n");
4988  res = 0;
4989  }
4990 
4991  if (!has_channel) {
4992  ast_log(LOG_ERROR, "ARI ChannelUnhold missing required field channel\n");
4993  res = 0;
4994  }
4995 
4996  return res;
4997 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_channel_userevent ( struct ast_json json)

Validator for ChannelUserevent.

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

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

Definition at line 5004 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(), and ast_json_object_iter_value().

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

5005 {
5006  int res = 1;
5007  struct ast_json_iter *iter;
5008  int has_type = 0;
5009  int has_application = 0;
5010  int has_timestamp = 0;
5011  int has_eventname = 0;
5012  int has_userevent = 0;
5013 
5014  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
5015  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
5016  int prop_is_valid;
5017  prop_is_valid = ast_ari_validate_string(
5019  if (!prop_is_valid) {
5020  ast_log(LOG_ERROR, "ARI ChannelUserevent field asterisk_id failed validation\n");
5021  res = 0;
5022  }
5023  } else
5024  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
5025  int prop_is_valid;
5026  has_type = 1;
5027  prop_is_valid = ast_ari_validate_string(
5029  if (!prop_is_valid) {
5030  ast_log(LOG_ERROR, "ARI ChannelUserevent field type failed validation\n");
5031  res = 0;
5032  }
5033  } else
5034  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
5035  int prop_is_valid;
5036  has_application = 1;
5037  prop_is_valid = ast_ari_validate_string(
5039  if (!prop_is_valid) {
5040  ast_log(LOG_ERROR, "ARI ChannelUserevent field application failed validation\n");
5041  res = 0;
5042  }
5043  } else
5044  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
5045  int prop_is_valid;
5046  has_timestamp = 1;
5047  prop_is_valid = ast_ari_validate_date(
5049  if (!prop_is_valid) {
5050  ast_log(LOG_ERROR, "ARI ChannelUserevent field timestamp failed validation\n");
5051  res = 0;
5052  }
5053  } else
5054  if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
5055  int prop_is_valid;
5056  prop_is_valid = ast_ari_validate_bridge(
5058  if (!prop_is_valid) {
5059  ast_log(LOG_ERROR, "ARI ChannelUserevent field bridge failed validation\n");
5060  res = 0;
5061  }
5062  } else
5063  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
5064  int prop_is_valid;
5065  prop_is_valid = ast_ari_validate_channel(
5067  if (!prop_is_valid) {
5068  ast_log(LOG_ERROR, "ARI ChannelUserevent field channel failed validation\n");
5069  res = 0;
5070  }
5071  } else
5072  if (strcmp("endpoint", ast_json_object_iter_key(iter)) == 0) {
5073  int prop_is_valid;
5074  prop_is_valid = ast_ari_validate_endpoint(
5076  if (!prop_is_valid) {
5077  ast_log(LOG_ERROR, "ARI ChannelUserevent field endpoint failed validation\n");
5078  res = 0;
5079  }
5080  } else
5081  if (strcmp("eventname", ast_json_object_iter_key(iter)) == 0) {
5082  int prop_is_valid;
5083  has_eventname = 1;
5084  prop_is_valid = ast_ari_validate_string(
5086  if (!prop_is_valid) {
5087  ast_log(LOG_ERROR, "ARI ChannelUserevent field eventname failed validation\n");
5088  res = 0;
5089  }
5090  } else
5091  if (strcmp("userevent", ast_json_object_iter_key(iter)) == 0) {
5092  int prop_is_valid;
5093  has_userevent = 1;
5094  prop_is_valid = ast_ari_validate_object(
5096  if (!prop_is_valid) {
5097  ast_log(LOG_ERROR, "ARI ChannelUserevent field userevent failed validation\n");
5098  res = 0;
5099  }
5100  } else
5101  {
5102  ast_log(LOG_ERROR,
5103  "ARI ChannelUserevent has undocumented field %s\n",
5104  ast_json_object_iter_key(iter));
5105  res = 0;
5106  }
5107  }
5108 
5109  if (!has_type) {
5110  ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field type\n");
5111  res = 0;
5112  }
5113 
5114  if (!has_application) {
5115  ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field application\n");
5116  res = 0;
5117  }
5118 
5119  if (!has_timestamp) {
5120  ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field timestamp\n");
5121  res = 0;
5122  }
5123 
5124  if (!has_eventname) {
5125  ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field eventname\n");
5126  res = 0;
5127  }
5128 
5129  if (!has_userevent) {
5130  ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field userevent\n");
5131  res = 0;
5132  }
5133 
5134  return res;
5135 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_channel_varset ( struct ast_json json)

Validator for ChannelVarset.

Channel variable changed.

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

Definition at line 5142 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(), and ast_json_object_iter_value().

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

5143 {
5144  int res = 1;
5145  struct ast_json_iter *iter;
5146  int has_type = 0;
5147  int has_application = 0;
5148  int has_timestamp = 0;
5149  int has_value = 0;
5150  int has_variable = 0;
5151 
5152  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
5153  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
5154  int prop_is_valid;
5155  prop_is_valid = ast_ari_validate_string(
5157  if (!prop_is_valid) {
5158  ast_log(LOG_ERROR, "ARI ChannelVarset field asterisk_id failed validation\n");
5159  res = 0;
5160  }
5161  } else
5162  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
5163  int prop_is_valid;
5164  has_type = 1;
5165  prop_is_valid = ast_ari_validate_string(
5167  if (!prop_is_valid) {
5168  ast_log(LOG_ERROR, "ARI ChannelVarset field type failed validation\n");
5169  res = 0;
5170  }
5171  } else
5172  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
5173  int prop_is_valid;
5174  has_application = 1;
5175  prop_is_valid = ast_ari_validate_string(
5177  if (!prop_is_valid) {
5178  ast_log(LOG_ERROR, "ARI ChannelVarset field application failed validation\n");
5179  res = 0;
5180  }
5181  } else
5182  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
5183  int prop_is_valid;
5184  has_timestamp = 1;
5185  prop_is_valid = ast_ari_validate_date(
5187  if (!prop_is_valid) {
5188  ast_log(LOG_ERROR, "ARI ChannelVarset field timestamp failed validation\n");
5189  res = 0;
5190  }
5191  } else
5192  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
5193  int prop_is_valid;
5194  prop_is_valid = ast_ari_validate_channel(
5196  if (!prop_is_valid) {
5197  ast_log(LOG_ERROR, "ARI ChannelVarset field channel failed validation\n");
5198  res = 0;
5199  }
5200  } else
5201  if (strcmp("value", ast_json_object_iter_key(iter)) == 0) {
5202  int prop_is_valid;
5203  has_value = 1;
5204  prop_is_valid = ast_ari_validate_string(
5206  if (!prop_is_valid) {
5207  ast_log(LOG_ERROR, "ARI ChannelVarset field value failed validation\n");
5208  res = 0;
5209  }
5210  } else
5211  if (strcmp("variable", ast_json_object_iter_key(iter)) == 0) {
5212  int prop_is_valid;
5213  has_variable = 1;
5214  prop_is_valid = ast_ari_validate_string(
5216  if (!prop_is_valid) {
5217  ast_log(LOG_ERROR, "ARI ChannelVarset field variable failed validation\n");
5218  res = 0;
5219  }
5220  } else
5221  {
5222  ast_log(LOG_ERROR,
5223  "ARI ChannelVarset has undocumented field %s\n",
5224  ast_json_object_iter_key(iter));
5225  res = 0;
5226  }
5227  }
5228 
5229  if (!has_type) {
5230  ast_log(LOG_ERROR, "ARI ChannelVarset missing required field type\n");
5231  res = 0;
5232  }
5233 
5234  if (!has_application) {
5235  ast_log(LOG_ERROR, "ARI ChannelVarset missing required field application\n");
5236  res = 0;
5237  }
5238 
5239  if (!has_timestamp) {
5240  ast_log(LOG_ERROR, "ARI ChannelVarset missing required field timestamp\n");
5241  res = 0;
5242  }
5243 
5244  if (!has_value) {
5245  ast_log(LOG_ERROR, "ARI ChannelVarset missing required field value\n");
5246  res = 0;
5247  }
5248 
5249  if (!has_variable) {
5250  ast_log(LOG_ERROR, "ARI ChannelVarset missing required field variable\n");
5251  res = 0;
5252  }
5253 
5254  return res;
5255 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_config_info ( struct ast_json json)

Validator for ConfigInfo.

Info about Asterisk configuration

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

Definition at line 282 of file ari_model_validators.c.

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(), and ast_json_object_iter_value().

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  {
349  ast_log(LOG_ERROR,
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:439
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
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:451
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:447
int ast_ari_validate_config_tuple ( struct ast_json json)

Validator for ConfigTuple.

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

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

Definition at line 379 of file ari_model_validators.c.

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

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  {
408  ast_log(LOG_ERROR,
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:439
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_contact_info ( struct ast_json json)

Validator for ContactInfo.

Detailed information about a contact on an endpoint.

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

Definition at line 5262 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(), and ast_json_object_iter_value().

Referenced by ast_ari_validate_contact_info_fn(), and ast_ari_validate_contact_status_change().

5263 {
5264  int res = 1;
5265  struct ast_json_iter *iter;
5266  int has_aor = 0;
5267  int has_contact_status = 0;
5268  int has_uri = 0;
5269 
5270  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
5271  if (strcmp("aor", ast_json_object_iter_key(iter)) == 0) {
5272  int prop_is_valid;
5273  has_aor = 1;
5274  prop_is_valid = ast_ari_validate_string(
5276  if (!prop_is_valid) {
5277  ast_log(LOG_ERROR, "ARI ContactInfo field aor failed validation\n");
5278  res = 0;
5279  }
5280  } else
5281  if (strcmp("contact_status", ast_json_object_iter_key(iter)) == 0) {
5282  int prop_is_valid;
5283  has_contact_status = 1;
5284  prop_is_valid = ast_ari_validate_string(
5286  if (!prop_is_valid) {
5287  ast_log(LOG_ERROR, "ARI ContactInfo field contact_status failed validation\n");
5288  res = 0;
5289  }
5290  } else
5291  if (strcmp("roundtrip_usec", ast_json_object_iter_key(iter)) == 0) {
5292  int prop_is_valid;
5293  prop_is_valid = ast_ari_validate_string(
5295  if (!prop_is_valid) {
5296  ast_log(LOG_ERROR, "ARI ContactInfo field roundtrip_usec failed validation\n");
5297  res = 0;
5298  }
5299  } else
5300  if (strcmp("uri", ast_json_object_iter_key(iter)) == 0) {
5301  int prop_is_valid;
5302  has_uri = 1;
5303  prop_is_valid = ast_ari_validate_string(
5305  if (!prop_is_valid) {
5306  ast_log(LOG_ERROR, "ARI ContactInfo field uri failed validation\n");
5307  res = 0;
5308  }
5309  } else
5310  {
5311  ast_log(LOG_ERROR,
5312  "ARI ContactInfo has undocumented field %s\n",
5313  ast_json_object_iter_key(iter));
5314  res = 0;
5315  }
5316  }
5317 
5318  if (!has_aor) {
5319  ast_log(LOG_ERROR, "ARI ContactInfo missing required field aor\n");
5320  res = 0;
5321  }
5322 
5323  if (!has_contact_status) {
5324  ast_log(LOG_ERROR, "ARI ContactInfo missing required field contact_status\n");
5325  res = 0;
5326  }
5327 
5328  if (!has_uri) {
5329  ast_log(LOG_ERROR, "ARI ContactInfo missing required field uri\n");
5330  res = 0;
5331  }
5332 
5333  return res;
5334 }
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:439
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_contact_status_change ( struct ast_json json)

Validator for ContactStatusChange.

The state of a contact on an endpoint has changed.

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

Definition at line 5341 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(), and ast_json_object_iter_value().

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

5342 {
5343  int res = 1;
5344  struct ast_json_iter *iter;
5345  int has_type = 0;
5346  int has_application = 0;
5347  int has_timestamp = 0;
5348  int has_contact_info = 0;
5349  int has_endpoint = 0;
5350 
5351  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
5352  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
5353  int prop_is_valid;
5354  prop_is_valid = ast_ari_validate_string(
5356  if (!prop_is_valid) {
5357  ast_log(LOG_ERROR, "ARI ContactStatusChange field asterisk_id failed validation\n");
5358  res = 0;
5359  }
5360  } else
5361  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
5362  int prop_is_valid;
5363  has_type = 1;
5364  prop_is_valid = ast_ari_validate_string(
5366  if (!prop_is_valid) {
5367  ast_log(LOG_ERROR, "ARI ContactStatusChange field type failed validation\n");
5368  res = 0;
5369  }
5370  } else
5371  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
5372  int prop_is_valid;
5373  has_application = 1;
5374  prop_is_valid = ast_ari_validate_string(
5376  if (!prop_is_valid) {
5377  ast_log(LOG_ERROR, "ARI ContactStatusChange field application failed validation\n");
5378  res = 0;
5379  }
5380  } else
5381  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
5382  int prop_is_valid;
5383  has_timestamp = 1;
5384  prop_is_valid = ast_ari_validate_date(
5386  if (!prop_is_valid) {
5387  ast_log(LOG_ERROR, "ARI ContactStatusChange field timestamp failed validation\n");
5388  res = 0;
5389  }
5390  } else
5391  if (strcmp("contact_info", ast_json_object_iter_key(iter)) == 0) {
5392  int prop_is_valid;
5393  has_contact_info = 1;
5394  prop_is_valid = ast_ari_validate_contact_info(
5396  if (!prop_is_valid) {
5397  ast_log(LOG_ERROR, "ARI ContactStatusChange field contact_info failed validation\n");
5398  res = 0;
5399  }
5400  } else
5401  if (strcmp("endpoint", ast_json_object_iter_key(iter)) == 0) {
5402  int prop_is_valid;
5403  has_endpoint = 1;
5404  prop_is_valid = ast_ari_validate_endpoint(
5406  if (!prop_is_valid) {
5407  ast_log(LOG_ERROR, "ARI ContactStatusChange field endpoint failed validation\n");
5408  res = 0;
5409  }
5410  } else
5411  {
5412  ast_log(LOG_ERROR,
5413  "ARI ContactStatusChange has undocumented field %s\n",
5414  ast_json_object_iter_key(iter));
5415  res = 0;
5416  }
5417  }
5418 
5419  if (!has_type) {
5420  ast_log(LOG_ERROR, "ARI ContactStatusChange missing required field type\n");
5421  res = 0;
5422  }
5423 
5424  if (!has_application) {
5425  ast_log(LOG_ERROR, "ARI ContactStatusChange missing required field application\n");
5426  res = 0;
5427  }
5428 
5429  if (!has_timestamp) {
5430  ast_log(LOG_ERROR, "ARI ContactStatusChange missing required field timestamp\n");
5431  res = 0;
5432  }
5433 
5434  if (!has_contact_info) {
5435  ast_log(LOG_ERROR, "ARI ContactStatusChange missing required field contact_info\n");
5436  res = 0;
5437  }
5438 
5439  if (!has_endpoint) {
5440  ast_log(LOG_ERROR, "ARI ContactStatusChange missing required field endpoint\n");
5441  res = 0;
5442  }
5443 
5444  return res;
5445 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_date ( struct ast_json json)

Validator for native Swagger date.

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

Definition at line 148 of file res_ari_model.c.

References ast_json_string_get().

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(), and ast_ari_validate_text_message_received().

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 }
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
Definition: json.c:283
int ast_ari_validate_device_state ( struct ast_json json)

Validator for DeviceState.

Represents the state of a device.

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

Definition at line 2298 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(), and ast_json_object_iter_value().

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

2299 {
2300  int res = 1;
2301  struct ast_json_iter *iter;
2302  int has_name = 0;
2303  int has_state = 0;
2304 
2305  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2306  if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
2307  int prop_is_valid;
2308  has_name = 1;
2309  prop_is_valid = ast_ari_validate_string(
2311  if (!prop_is_valid) {
2312  ast_log(LOG_ERROR, "ARI DeviceState field name failed validation\n");
2313  res = 0;
2314  }
2315  } else
2316  if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
2317  int prop_is_valid;
2318  has_state = 1;
2319  prop_is_valid = ast_ari_validate_string(
2321  if (!prop_is_valid) {
2322  ast_log(LOG_ERROR, "ARI DeviceState field state failed validation\n");
2323  res = 0;
2324  }
2325  } else
2326  {
2327  ast_log(LOG_ERROR,
2328  "ARI DeviceState has undocumented field %s\n",
2329  ast_json_object_iter_key(iter));
2330  res = 0;
2331  }
2332  }
2333 
2334  if (!has_name) {
2335  ast_log(LOG_ERROR, "ARI DeviceState missing required field name\n");
2336  res = 0;
2337  }
2338 
2339  if (!has_state) {
2340  ast_log(LOG_ERROR, "ARI DeviceState missing required field state\n");
2341  res = 0;
2342  }
2343 
2344  return res;
2345 }
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:439
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_device_state_changed ( struct ast_json json)

Validator for DeviceStateChanged.

Notification that a device state has changed.

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

Definition at line 5452 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(), and ast_json_object_iter_value().

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

5453 {
5454  int res = 1;
5455  struct ast_json_iter *iter;
5456  int has_type = 0;
5457  int has_application = 0;
5458  int has_timestamp = 0;
5459  int has_device_state = 0;
5460 
5461  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
5462  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
5463  int prop_is_valid;
5464  prop_is_valid = ast_ari_validate_string(
5466  if (!prop_is_valid) {
5467  ast_log(LOG_ERROR, "ARI DeviceStateChanged field asterisk_id failed validation\n");
5468  res = 0;
5469  }
5470  } else
5471  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
5472  int prop_is_valid;
5473  has_type = 1;
5474  prop_is_valid = ast_ari_validate_string(
5476  if (!prop_is_valid) {
5477  ast_log(LOG_ERROR, "ARI DeviceStateChanged field type failed validation\n");
5478  res = 0;
5479  }
5480  } else
5481  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
5482  int prop_is_valid;
5483  has_application = 1;
5484  prop_is_valid = ast_ari_validate_string(
5486  if (!prop_is_valid) {
5487  ast_log(LOG_ERROR, "ARI DeviceStateChanged field application failed validation\n");
5488  res = 0;
5489  }
5490  } else
5491  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
5492  int prop_is_valid;
5493  has_timestamp = 1;
5494  prop_is_valid = ast_ari_validate_date(
5496  if (!prop_is_valid) {
5497  ast_log(LOG_ERROR, "ARI DeviceStateChanged field timestamp failed validation\n");
5498  res = 0;
5499  }
5500  } else
5501  if (strcmp("device_state", ast_json_object_iter_key(iter)) == 0) {
5502  int prop_is_valid;
5503  has_device_state = 1;
5504  prop_is_valid = ast_ari_validate_device_state(
5506  if (!prop_is_valid) {
5507  ast_log(LOG_ERROR, "ARI DeviceStateChanged field device_state failed validation\n");
5508  res = 0;
5509  }
5510  } else
5511  {
5512  ast_log(LOG_ERROR,
5513  "ARI DeviceStateChanged has undocumented field %s\n",
5514  ast_json_object_iter_key(iter));
5515  res = 0;
5516  }
5517  }
5518 
5519  if (!has_type) {
5520  ast_log(LOG_ERROR, "ARI DeviceStateChanged missing required field type\n");
5521  res = 0;
5522  }
5523 
5524  if (!has_application) {
5525  ast_log(LOG_ERROR, "ARI DeviceStateChanged missing required field application\n");
5526  res = 0;
5527  }
5528 
5529  if (!has_timestamp) {
5530  ast_log(LOG_ERROR, "ARI DeviceStateChanged missing required field timestamp\n");
5531  res = 0;
5532  }
5533 
5534  if (!has_device_state) {
5535  ast_log(LOG_ERROR, "ARI DeviceStateChanged missing required field device_state\n");
5536  res = 0;
5537  }
5538 
5539  return res;
5540 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_dial ( struct ast_json json)

Validator for Dial.

Dialing state has changed.

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

Definition at line 5547 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(), and ast_json_object_iter_value().

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

5548 {
5549  int res = 1;
5550  struct ast_json_iter *iter;
5551  int has_type = 0;
5552  int has_application = 0;
5553  int has_timestamp = 0;
5554  int has_dialstatus = 0;
5555  int has_peer = 0;
5556 
5557  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
5558  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
5559  int prop_is_valid;
5560  prop_is_valid = ast_ari_validate_string(
5562  if (!prop_is_valid) {
5563  ast_log(LOG_ERROR, "ARI Dial field asterisk_id failed validation\n");
5564  res = 0;
5565  }
5566  } else
5567  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
5568  int prop_is_valid;
5569  has_type = 1;
5570  prop_is_valid = ast_ari_validate_string(
5572  if (!prop_is_valid) {
5573  ast_log(LOG_ERROR, "ARI Dial field type failed validation\n");
5574  res = 0;
5575  }
5576  } else
5577  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
5578  int prop_is_valid;
5579  has_application = 1;
5580  prop_is_valid = ast_ari_validate_string(
5582  if (!prop_is_valid) {
5583  ast_log(LOG_ERROR, "ARI Dial field application failed validation\n");
5584  res = 0;
5585  }
5586  } else
5587  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
5588  int prop_is_valid;
5589  has_timestamp = 1;
5590  prop_is_valid = ast_ari_validate_date(
5592  if (!prop_is_valid) {
5593  ast_log(LOG_ERROR, "ARI Dial field timestamp failed validation\n");
5594  res = 0;
5595  }
5596  } else
5597  if (strcmp("caller", ast_json_object_iter_key(iter)) == 0) {
5598  int prop_is_valid;
5599  prop_is_valid = ast_ari_validate_channel(
5601  if (!prop_is_valid) {
5602  ast_log(LOG_ERROR, "ARI Dial field caller failed validation\n");
5603  res = 0;
5604  }
5605  } else
5606  if (strcmp("dialstatus", ast_json_object_iter_key(iter)) == 0) {
5607  int prop_is_valid;
5608  has_dialstatus = 1;
5609  prop_is_valid = ast_ari_validate_string(
5611  if (!prop_is_valid) {
5612  ast_log(LOG_ERROR, "ARI Dial field dialstatus failed validation\n");
5613  res = 0;
5614  }
5615  } else
5616  if (strcmp("dialstring", ast_json_object_iter_key(iter)) == 0) {
5617  int prop_is_valid;
5618  prop_is_valid = ast_ari_validate_string(
5620  if (!prop_is_valid) {
5621  ast_log(LOG_ERROR, "ARI Dial field dialstring failed validation\n");
5622  res = 0;
5623  }
5624  } else
5625  if (strcmp("forward", ast_json_object_iter_key(iter)) == 0) {
5626  int prop_is_valid;
5627  prop_is_valid = ast_ari_validate_string(
5629  if (!prop_is_valid) {
5630  ast_log(LOG_ERROR, "ARI Dial field forward failed validation\n");
5631  res = 0;
5632  }
5633  } else
5634  if (strcmp("forwarded", ast_json_object_iter_key(iter)) == 0) {
5635  int prop_is_valid;
5636  prop_is_valid = ast_ari_validate_channel(
5638  if (!prop_is_valid) {
5639  ast_log(LOG_ERROR, "ARI Dial field forwarded failed validation\n");
5640  res = 0;
5641  }
5642  } else
5643  if (strcmp("peer", ast_json_object_iter_key(iter)) == 0) {
5644  int prop_is_valid;
5645  has_peer = 1;
5646  prop_is_valid = ast_ari_validate_channel(
5648  if (!prop_is_valid) {
5649  ast_log(LOG_ERROR, "ARI Dial field peer failed validation\n");
5650  res = 0;
5651  }
5652  } else
5653  {
5654  ast_log(LOG_ERROR,
5655  "ARI Dial has undocumented field %s\n",
5656  ast_json_object_iter_key(iter));
5657  res = 0;
5658  }
5659  }
5660 
5661  if (!has_type) {
5662  ast_log(LOG_ERROR, "ARI Dial missing required field type\n");
5663  res = 0;
5664  }
5665 
5666  if (!has_application) {
5667  ast_log(LOG_ERROR, "ARI Dial missing required field application\n");
5668  res = 0;
5669  }
5670 
5671  if (!has_timestamp) {
5672  ast_log(LOG_ERROR, "ARI Dial missing required field timestamp\n");
5673  res = 0;
5674  }
5675 
5676  if (!has_dialstatus) {
5677  ast_log(LOG_ERROR, "ARI Dial missing required field dialstatus\n");
5678  res = 0;
5679  }
5680 
5681  if (!has_peer) {
5682  ast_log(LOG_ERROR, "ARI Dial missing required field peer\n");
5683  res = 0;
5684  }
5685 
5686  return res;
5687 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_dialed ( struct ast_json json)

Validator for Dialed.

Dialed channel information.

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

Definition at line 1234 of file ari_model_validators.c.

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

Referenced by ast_ari_validate_dialed_fn().

1235 {
1236  int res = 1;
1237  struct ast_json_iter *iter;
1238 
1239  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1240  {
1241  ast_log(LOG_ERROR,
1242  "ARI Dialed has undocumented field %s\n",
1243  ast_json_object_iter_key(iter));
1244  res = 0;
1245  }
1246  }
1247 
1248  return res;
1249 }
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:439
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
struct ast_json_iter * ast_json_object_iter_next(struct ast_json *object, struct ast_json_iter *iter)
Get the next iterator.
Definition: json.c:447
int ast_ari_validate_dialplan_cep ( struct ast_json json)

Validator for DialplanCEP.

Dialplan location (context/extension/priority)

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

Definition at line 1256 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(), and has_priority().

Referenced by ast_ari_validate_channel(), and ast_ari_validate_dialplan_cep_fn().

1257 {
1258  int res = 1;
1259  struct ast_json_iter *iter;
1260  int has_app_data = 0;
1261  int has_app_name = 0;
1262  int has_context = 0;
1263  int has_exten = 0;
1264  int has_priority = 0;
1265 
1266  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1267  if (strcmp("app_data", ast_json_object_iter_key(iter)) == 0) {
1268  int prop_is_valid;
1269  has_app_data = 1;
1270  prop_is_valid = ast_ari_validate_string(
1272  if (!prop_is_valid) {
1273  ast_log(LOG_ERROR, "ARI DialplanCEP field app_data failed validation\n");
1274  res = 0;
1275  }
1276  } else
1277  if (strcmp("app_name", ast_json_object_iter_key(iter)) == 0) {
1278  int prop_is_valid;
1279  has_app_name = 1;
1280  prop_is_valid = ast_ari_validate_string(
1282  if (!prop_is_valid) {
1283  ast_log(LOG_ERROR, "ARI DialplanCEP field app_name failed validation\n");
1284  res = 0;
1285  }
1286  } else
1287  if (strcmp("context", ast_json_object_iter_key(iter)) == 0) {
1288  int prop_is_valid;
1289  has_context = 1;
1290  prop_is_valid = ast_ari_validate_string(
1292  if (!prop_is_valid) {
1293  ast_log(LOG_ERROR, "ARI DialplanCEP field context failed validation\n");
1294  res = 0;
1295  }
1296  } else
1297  if (strcmp("exten", ast_json_object_iter_key(iter)) == 0) {
1298  int prop_is_valid;
1299  has_exten = 1;
1300  prop_is_valid = ast_ari_validate_string(
1302  if (!prop_is_valid) {
1303  ast_log(LOG_ERROR, "ARI DialplanCEP field exten failed validation\n");
1304  res = 0;
1305  }
1306  } else
1307  if (strcmp("priority", ast_json_object_iter_key(iter)) == 0) {
1308  int prop_is_valid;
1309  has_priority = 1;
1310  prop_is_valid = ast_ari_validate_long(
1312  if (!prop_is_valid) {
1313  ast_log(LOG_ERROR, "ARI DialplanCEP field priority failed validation\n");
1314  res = 0;
1315  }
1316  } else
1317  {
1318  ast_log(LOG_ERROR,
1319  "ARI DialplanCEP has undocumented field %s\n",
1320  ast_json_object_iter_key(iter));
1321  res = 0;
1322  }
1323  }
1324 
1325  if (!has_app_data) {
1326  ast_log(LOG_ERROR, "ARI DialplanCEP missing required field app_data\n");
1327  res = 0;
1328  }
1329 
1330  if (!has_app_name) {
1331  ast_log(LOG_ERROR, "ARI DialplanCEP missing required field app_name\n");
1332  res = 0;
1333  }
1334 
1335  if (!has_context) {
1336  ast_log(LOG_ERROR, "ARI DialplanCEP missing required field context\n");
1337  res = 0;
1338  }
1339 
1340  if (!has_exten) {
1341  ast_log(LOG_ERROR, "ARI DialplanCEP missing required field exten\n");
1342  res = 0;
1343  }
1344 
1345  if (!has_priority) {
1346  ast_log(LOG_ERROR, "ARI DialplanCEP missing required field priority\n");
1347  res = 0;
1348  }
1349 
1350  return res;
1351 }
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:439
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
int ast_ari_validate_long(struct ast_json *json)
Validator for native Swagger long.
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:1778
struct ast_json_iter * ast_json_object_iter_next(struct ast_json *object, struct ast_json_iter *iter)
Get the next iterator.
Definition: json.c:447
int ast_ari_validate_double ( struct ast_json json)

Validator for native Swagger double.

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

Definition at line 138 of file res_ari_model.c.

Referenced by ast_ari_validate_config_info(), and ast_ari_validate_rtpstat().

139 {
140  return check_type(json, AST_JSON_REAL);
141 }
int ast_ari_validate_endpoint ( struct ast_json json)

Validator for Endpoint.

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

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

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

Definition at line 821 of file ari_model_validators.c.

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

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  {
871  ast_log(LOG_ERROR,
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:439
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_endpoint_state_change ( struct ast_json json)

Validator for EndpointStateChange.

Endpoint state changed.

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

Definition at line 5694 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(), and ast_json_object_iter_value().

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

5695 {
5696  int res = 1;
5697  struct ast_json_iter *iter;
5698  int has_type = 0;
5699  int has_application = 0;
5700  int has_timestamp = 0;
5701  int has_endpoint = 0;
5702 
5703  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
5704  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
5705  int prop_is_valid;
5706  prop_is_valid = ast_ari_validate_string(
5708  if (!prop_is_valid) {
5709  ast_log(LOG_ERROR, "ARI EndpointStateChange field asterisk_id failed validation\n");
5710  res = 0;
5711  }
5712  } else
5713  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
5714  int prop_is_valid;
5715  has_type = 1;
5716  prop_is_valid = ast_ari_validate_string(
5718  if (!prop_is_valid) {
5719  ast_log(LOG_ERROR, "ARI EndpointStateChange field type failed validation\n");
5720  res = 0;
5721  }
5722  } else
5723  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
5724  int prop_is_valid;
5725  has_application = 1;
5726  prop_is_valid = ast_ari_validate_string(
5728  if (!prop_is_valid) {
5729  ast_log(LOG_ERROR, "ARI EndpointStateChange field application failed validation\n");
5730  res = 0;
5731  }
5732  } else
5733  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
5734  int prop_is_valid;
5735  has_timestamp = 1;
5736  prop_is_valid = ast_ari_validate_date(
5738  if (!prop_is_valid) {
5739  ast_log(LOG_ERROR, "ARI EndpointStateChange field timestamp failed validation\n");
5740  res = 0;
5741  }
5742  } else
5743  if (strcmp("endpoint", ast_json_object_iter_key(iter)) == 0) {
5744  int prop_is_valid;
5745  has_endpoint = 1;
5746  prop_is_valid = ast_ari_validate_endpoint(
5748  if (!prop_is_valid) {
5749  ast_log(LOG_ERROR, "ARI EndpointStateChange field endpoint failed validation\n");
5750  res = 0;
5751  }
5752  } else
5753  {
5754  ast_log(LOG_ERROR,
5755  "ARI EndpointStateChange has undocumented field %s\n",
5756  ast_json_object_iter_key(iter));
5757  res = 0;
5758  }
5759  }
5760 
5761  if (!has_type) {
5762  ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field type\n");
5763  res = 0;
5764  }
5765 
5766  if (!has_application) {
5767  ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field application\n");
5768  res = 0;
5769  }
5770 
5771  if (!has_timestamp) {
5772  ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field timestamp\n");
5773  res = 0;
5774  }
5775 
5776  if (!has_endpoint) {
5777  ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field endpoint\n");
5778  res = 0;
5779  }
5780 
5781  return res;
5782 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_event ( struct ast_json json)

Validator for Event.

Base type for asynchronous events from Asterisk.

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

Definition at line 5789 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(), and ast_json_string_get().

Referenced by ast_ari_validate_event_fn(), and ast_ari_validate_message().

5790 {
5791  int res = 1;
5792  struct ast_json_iter *iter;
5793  int has_type = 0;
5794  int has_application = 0;
5795  int has_timestamp = 0;
5796  const char *discriminator;
5797 
5798  discriminator = ast_json_string_get(ast_json_object_get(json, "type"));
5799  if (!discriminator) {
5800  ast_log(LOG_ERROR, "ARI Event missing required field type\n");
5801  return 0;
5802  }
5803 
5804  if (strcmp("Event", discriminator) == 0) {
5805  /* Self type; fall through */
5806  } else
5807  if (strcmp("ApplicationMoveFailed", discriminator) == 0) {
5809  } else
5810  if (strcmp("ApplicationReplaced", discriminator) == 0) {
5812  } else
5813  if (strcmp("BridgeAttendedTransfer", discriminator) == 0) {
5815  } else
5816  if (strcmp("BridgeBlindTransfer", discriminator) == 0) {
5818  } else
5819  if (strcmp("BridgeCreated", discriminator) == 0) {
5820  return ast_ari_validate_bridge_created(json);
5821  } else
5822  if (strcmp("BridgeDestroyed", discriminator) == 0) {
5823  return ast_ari_validate_bridge_destroyed(json);
5824  } else
5825  if (strcmp("BridgeMerged", discriminator) == 0) {
5826  return ast_ari_validate_bridge_merged(json);
5827  } else
5828  if (strcmp("BridgeVideoSourceChanged", discriminator) == 0) {
5830  } else
5831  if (strcmp("ChannelCallerId", discriminator) == 0) {
5833  } else
5834  if (strcmp("ChannelConnectedLine", discriminator) == 0) {
5836  } else
5837  if (strcmp("ChannelCreated", discriminator) == 0) {
5838  return ast_ari_validate_channel_created(json);
5839  } else
5840  if (strcmp("ChannelDestroyed", discriminator) == 0) {
5842  } else
5843  if (strcmp("ChannelDialplan", discriminator) == 0) {
5844  return ast_ari_validate_channel_dialplan(json);
5845  } else
5846  if (strcmp("ChannelDtmfReceived", discriminator) == 0) {
5848  } else
5849  if (strcmp("ChannelEnteredBridge", discriminator) == 0) {
5851  } else
5852  if (strcmp("ChannelHangupRequest", discriminator) == 0) {
5854  } else
5855  if (strcmp("ChannelHold", discriminator) == 0) {
5856  return ast_ari_validate_channel_hold(json);
5857  } else
5858  if (strcmp("ChannelLeftBridge", discriminator) == 0) {
5860  } else
5861  if (strcmp("ChannelStateChange", discriminator) == 0) {
5863  } else
5864  if (strcmp("ChannelTalkingFinished", discriminator) == 0) {
5866  } else
5867  if (strcmp("ChannelTalkingStarted", discriminator) == 0) {
5869  } else
5870  if (strcmp("ChannelUnhold", discriminator) == 0) {
5871  return ast_ari_validate_channel_unhold(json);
5872  } else
5873  if (strcmp("ChannelUserevent", discriminator) == 0) {
5875  } else
5876  if (strcmp("ChannelVarset", discriminator) == 0) {
5877  return ast_ari_validate_channel_varset(json);
5878  } else
5879  if (strcmp("ContactStatusChange", discriminator) == 0) {
5881  } else
5882  if (strcmp("DeviceStateChanged", discriminator) == 0) {
5884  } else
5885  if (strcmp("Dial", discriminator) == 0) {
5886  return ast_ari_validate_dial(json);
5887  } else
5888  if (strcmp("EndpointStateChange", discriminator) == 0) {
5890  } else
5891  if (strcmp("PeerStatusChange", discriminator) == 0) {
5893  } else
5894  if (strcmp("PlaybackContinuing", discriminator) == 0) {
5896  } else
5897  if (strcmp("PlaybackFinished", discriminator) == 0) {
5899  } else
5900  if (strcmp("PlaybackStarted", discriminator) == 0) {
5901  return ast_ari_validate_playback_started(json);
5902  } else
5903  if (strcmp("RecordingFailed", discriminator) == 0) {
5904  return ast_ari_validate_recording_failed(json);
5905  } else
5906  if (strcmp("RecordingFinished", discriminator) == 0) {
5908  } else
5909  if (strcmp("RecordingStarted", discriminator) == 0) {
5911  } else
5912  if (strcmp("StasisEnd", discriminator) == 0) {
5913  return ast_ari_validate_stasis_end(json);
5914  } else
5915  if (strcmp("StasisStart", discriminator) == 0) {
5916  return ast_ari_validate_stasis_start(json);
5917  } else
5918  if (strcmp("TextMessageReceived", discriminator) == 0) {
5920  } else
5921  {
5922  ast_log(LOG_ERROR, "ARI Event has undocumented subtype %s\n",
5923  discriminator);
5924  res = 0;
5925  }
5926 
5927  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
5928  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
5929  int prop_is_valid;
5930  prop_is_valid = ast_ari_validate_string(
5932  if (!prop_is_valid) {
5933  ast_log(LOG_ERROR, "ARI Event field asterisk_id failed validation\n");
5934  res = 0;
5935  }
5936  } else
5937  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
5938  int prop_is_valid;
5939  has_type = 1;
5940  prop_is_valid = ast_ari_validate_string(
5942  if (!prop_is_valid) {
5943  ast_log(LOG_ERROR, "ARI Event field type failed validation\n");
5944  res = 0;
5945  }
5946  } else
5947  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
5948  int prop_is_valid;
5949  has_application = 1;
5950  prop_is_valid = ast_ari_validate_string(
5952  if (!prop_is_valid) {
5953  ast_log(LOG_ERROR, "ARI Event field application failed validation\n");
5954  res = 0;
5955  }
5956  } else
5957  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
5958  int prop_is_valid;
5959  has_timestamp = 1;
5960  prop_is_valid = ast_ari_validate_date(
5962  if (!prop_is_valid) {
5963  ast_log(LOG_ERROR, "ARI Event field timestamp failed validation\n");
5964  res = 0;
5965  }
5966  } else
5967  {
5968  ast_log(LOG_ERROR,
5969  "ARI Event has undocumented field %s\n",
5970  ast_json_object_iter_key(iter));
5971  res = 0;
5972  }
5973  }
5974 
5975  if (!has_type) {
5976  ast_log(LOG_ERROR, "ARI Event missing required field type\n");
5977  res = 0;
5978  }
5979 
5980  if (!has_application) {
5981  ast_log(LOG_ERROR, "ARI Event missing required field application\n");
5982  res = 0;
5983  }
5984 
5985  if (!has_timestamp) {
5986  ast_log(LOG_ERROR, "ARI Event missing required field timestamp\n");
5987  res = 0;
5988  }
5989 
5990  return res;
5991 }
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:439
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.
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:455
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:283
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:451
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.
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:407
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:447
int ast_ari_validate_float ( struct ast_json json)

Validator for native Swagger float.

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

Definition at line 133 of file res_ari_model.c.

134 {
135  return check_type(json, AST_JSON_REAL);
136 }
int ast_ari_validate_format_lang_pair ( struct ast_json json)

Validator for FormatLangPair.

Identifies the format and language of a sound file

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

Definition at line 2076 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(), and ast_json_object_iter_value().

Referenced by ast_ari_validate_format_lang_pair_fn(), and ast_ari_validate_sound().

2077 {
2078  int res = 1;
2079  struct ast_json_iter *iter;
2080  int has_format = 0;
2081  int has_language = 0;
2082 
2083  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2084  if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
2085  int prop_is_valid;
2086  has_format = 1;
2087  prop_is_valid = ast_ari_validate_string(
2089  if (!prop_is_valid) {
2090  ast_log(LOG_ERROR, "ARI FormatLangPair field format failed validation\n");
2091  res = 0;
2092  }
2093  } else
2094  if (strcmp("language", ast_json_object_iter_key(iter)) == 0) {
2095  int prop_is_valid;
2096  has_language = 1;
2097  prop_is_valid = ast_ari_validate_string(
2099  if (!prop_is_valid) {
2100  ast_log(LOG_ERROR, "ARI FormatLangPair field language failed validation\n");
2101  res = 0;
2102  }
2103  } else
2104  {
2105  ast_log(LOG_ERROR,
2106  "ARI FormatLangPair has undocumented field %s\n",
2107  ast_json_object_iter_key(iter));
2108  res = 0;
2109  }
2110  }
2111 
2112  if (!has_format) {
2113  ast_log(LOG_ERROR, "ARI FormatLangPair missing required field format\n");
2114  res = 0;
2115  }
2116 
2117  if (!has_language) {
2118  ast_log(LOG_ERROR, "ARI FormatLangPair missing required field language\n");
2119  res = 0;
2120  }
2121 
2122  return res;
2123 }
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:439
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_int ( struct ast_json json)

Validator for native Swagger int.

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

Definition at line 121 of file res_ari_model.c.

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(), and ast_ari_validate_rtpstat().

122 {
123  /* Swagger int's are 32-bit */
124  return check_range(-2147483648LL, 2147483647LL, json);
125 }
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.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 164 of file res_ari_model.c.

References ast_json_array_get(), and ast_json_array_size().

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(), and ast_ari_validate_stasis_start().

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) {
177  ast_log(LOG_ERROR,
178  "Array member %zu failed validation\n", i);
179  res = 0;
180  }
181  }
182 
183  return res;
184 }
size_t ast_json_array_size(const struct ast_json *array)
Get the size of a JSON array.
Definition: json.c:366
struct ast_json * ast_json_array_get(const struct ast_json *array, size_t index)
Get an element from an array.
Definition: json.c:370
int ast_ari_validate_live_recording ( struct ast_json json)

Validator for LiveRecording.

A recording that is in progress

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

Definition at line 1900 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(), and ast_json_object_iter_value().

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

1901 {
1902  int res = 1;
1903  struct ast_json_iter *iter;
1904  int has_format = 0;
1905  int has_name = 0;
1906  int has_state = 0;
1907  int has_target_uri = 0;
1908 
1909  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1910  if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
1911  int prop_is_valid;
1912  prop_is_valid = ast_ari_validate_string(
1914  if (!prop_is_valid) {
1915  ast_log(LOG_ERROR, "ARI LiveRecording field cause failed validation\n");
1916  res = 0;
1917  }
1918  } else
1919  if (strcmp("duration", ast_json_object_iter_key(iter)) == 0) {
1920  int prop_is_valid;
1921  prop_is_valid = ast_ari_validate_int(
1923  if (!prop_is_valid) {
1924  ast_log(LOG_ERROR, "ARI LiveRecording field duration failed validation\n");
1925  res = 0;
1926  }
1927  } else
1928  if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
1929  int prop_is_valid;
1930  has_format = 1;
1931  prop_is_valid = ast_ari_validate_string(
1933  if (!prop_is_valid) {
1934  ast_log(LOG_ERROR, "ARI LiveRecording field format failed validation\n");
1935  res = 0;
1936  }
1937  } else
1938  if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1939  int prop_is_valid;
1940  has_name = 1;
1941  prop_is_valid = ast_ari_validate_string(
1943  if (!prop_is_valid) {
1944  ast_log(LOG_ERROR, "ARI LiveRecording field name failed validation\n");
1945  res = 0;
1946  }
1947  } else
1948  if (strcmp("silence_duration", ast_json_object_iter_key(iter)) == 0) {
1949  int prop_is_valid;
1950  prop_is_valid = ast_ari_validate_int(
1952  if (!prop_is_valid) {
1953  ast_log(LOG_ERROR, "ARI LiveRecording field silence_duration failed validation\n");
1954  res = 0;
1955  }
1956  } else
1957  if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
1958  int prop_is_valid;
1959  has_state = 1;
1960  prop_is_valid = ast_ari_validate_string(
1962  if (!prop_is_valid) {
1963  ast_log(LOG_ERROR, "ARI LiveRecording field state failed validation\n");
1964  res = 0;
1965  }
1966  } else
1967  if (strcmp("talking_duration", ast_json_object_iter_key(iter)) == 0) {
1968  int prop_is_valid;
1969  prop_is_valid = ast_ari_validate_int(
1971  if (!prop_is_valid) {
1972  ast_log(LOG_ERROR, "ARI LiveRecording field talking_duration failed validation\n");
1973  res = 0;
1974  }
1975  } else
1976  if (strcmp("target_uri", ast_json_object_iter_key(iter)) == 0) {
1977  int prop_is_valid;
1978  has_target_uri = 1;
1979  prop_is_valid = ast_ari_validate_string(
1981  if (!prop_is_valid) {
1982  ast_log(LOG_ERROR, "ARI LiveRecording field target_uri failed validation\n");
1983  res = 0;
1984  }
1985  } else
1986  {
1987  ast_log(LOG_ERROR,
1988  "ARI LiveRecording has undocumented field %s\n",
1989  ast_json_object_iter_key(iter));
1990  res = 0;
1991  }
1992  }
1993 
1994  if (!has_format) {
1995  ast_log(LOG_ERROR, "ARI LiveRecording missing required field format\n");
1996  res = 0;
1997  }
1998 
1999  if (!has_name) {
2000  ast_log(LOG_ERROR, "ARI LiveRecording missing required field name\n");
2001  res = 0;
2002  }
2003 
2004  if (!has_state) {
2005  ast_log(LOG_ERROR, "ARI LiveRecording missing required field state\n");
2006  res = 0;
2007  }
2008 
2009  if (!has_target_uri) {
2010  ast_log(LOG_ERROR, "ARI LiveRecording missing required field target_uri\n");
2011  res = 0;
2012  }
2013 
2014  return res;
2015 }
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:439
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_log_channel ( struct ast_json json)

Validator for LogChannel.

Details of an Asterisk log channel

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

Definition at line 433 of file ari_model_validators.c.

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

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  {
484  ast_log(LOG_ERROR,
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:439
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_long ( struct ast_json json)

Validator for native Swagger long.

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

Definition at line 127 of file res_ari_model.c.

Referenced by ast_ari_validate_dialplan_cep().

128 {
129  /* All integral values are valid longs. No need for range check. */
130  return check_type(json, AST_JSON_INTEGER);
131 }
int ast_ari_validate_mailbox ( struct ast_json json)

Validator for Mailbox.

Represents the state of a mailbox.

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

Definition at line 2352 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(), and ast_json_object_iter_value().

Referenced by ast_ari_mailboxes_get_cb(), and ast_ari_validate_mailbox_fn().

2353 {
2354  int res = 1;
2355  struct ast_json_iter *iter;
2356  int has_name = 0;
2357  int has_new_messages = 0;
2358  int has_old_messages = 0;
2359 
2360  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2361  if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
2362  int prop_is_valid;
2363  has_name = 1;
2364  prop_is_valid = ast_ari_validate_string(
2366  if (!prop_is_valid) {
2367  ast_log(LOG_ERROR, "ARI Mailbox field name failed validation\n");
2368  res = 0;
2369  }
2370  } else
2371  if (strcmp("new_messages", ast_json_object_iter_key(iter)) == 0) {
2372  int prop_is_valid;
2373  has_new_messages = 1;
2374  prop_is_valid = ast_ari_validate_int(
2376  if (!prop_is_valid) {
2377  ast_log(LOG_ERROR, "ARI Mailbox field new_messages failed validation\n");
2378  res = 0;
2379  }
2380  } else
2381  if (strcmp("old_messages", ast_json_object_iter_key(iter)) == 0) {
2382  int prop_is_valid;
2383  has_old_messages = 1;
2384  prop_is_valid = ast_ari_validate_int(
2386  if (!prop_is_valid) {
2387  ast_log(LOG_ERROR, "ARI Mailbox field old_messages failed validation\n");
2388  res = 0;
2389  }
2390  } else
2391  {
2392  ast_log(LOG_ERROR,
2393  "ARI Mailbox has undocumented field %s\n",
2394  ast_json_object_iter_key(iter));
2395  res = 0;
2396  }
2397  }
2398 
2399  if (!has_name) {
2400  ast_log(LOG_ERROR, "ARI Mailbox missing required field name\n");
2401  res = 0;
2402  }
2403 
2404  if (!has_new_messages) {
2405  ast_log(LOG_ERROR, "ARI Mailbox missing required field new_messages\n");
2406  res = 0;
2407  }
2408 
2409  if (!has_old_messages) {
2410  ast_log(LOG_ERROR, "ARI Mailbox missing required field old_messages\n");
2411  res = 0;
2412  }
2413 
2414  return res;
2415 }
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:439
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_message ( struct ast_json json)

Validator for Message.

Base type for errors and events

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

Definition at line 5998 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(), and ast_json_string_get().

Referenced by ast_ari_validate_message_fn().

5999 {
6000  int res = 1;
6001  struct ast_json_iter *iter;
6002  int has_type = 0;
6003  const char *discriminator;
6004 
6005  discriminator = ast_json_string_get(ast_json_object_get(json, "type"));
6006  if (!discriminator) {
6007  ast_log(LOG_ERROR, "ARI Message missing required field type\n");
6008  return 0;
6009  }
6010 
6011  if (strcmp("Message", discriminator) == 0) {
6012  /* Self type; fall through */
6013  } else
6014  if (strcmp("ApplicationMoveFailed", discriminator) == 0) {
6016  } else
6017  if (strcmp("ApplicationReplaced", discriminator) == 0) {
6019  } else
6020  if (strcmp("BridgeAttendedTransfer", discriminator) == 0) {
6022  } else
6023  if (strcmp("BridgeBlindTransfer", discriminator) == 0) {
6025  } else
6026  if (strcmp("BridgeCreated", discriminator) == 0) {
6027  return ast_ari_validate_bridge_created(json);
6028  } else
6029  if (strcmp("BridgeDestroyed", discriminator) == 0) {
6030  return ast_ari_validate_bridge_destroyed(json);
6031  } else
6032  if (strcmp("BridgeMerged", discriminator) == 0) {
6033  return ast_ari_validate_bridge_merged(json);
6034  } else
6035  if (strcmp("BridgeVideoSourceChanged", discriminator) == 0) {
6037  } else
6038  if (strcmp("ChannelCallerId", discriminator) == 0) {
6040  } else
6041  if (strcmp("ChannelConnectedLine", discriminator) == 0) {
6043  } else
6044  if (strcmp("ChannelCreated", discriminator) == 0) {
6045  return ast_ari_validate_channel_created(json);
6046  } else
6047  if (strcmp("ChannelDestroyed", discriminator) == 0) {
6049  } else
6050  if (strcmp("ChannelDialplan", discriminator) == 0) {
6051  return ast_ari_validate_channel_dialplan(json);
6052  } else
6053  if (strcmp("ChannelDtmfReceived", discriminator) == 0) {
6055  } else
6056  if (strcmp("ChannelEnteredBridge", discriminator) == 0) {
6058  } else
6059  if (strcmp("ChannelHangupRequest", discriminator) == 0) {
6061  } else
6062  if (strcmp("ChannelHold", discriminator) == 0) {
6063  return ast_ari_validate_channel_hold(json);
6064  } else
6065  if (strcmp("ChannelLeftBridge", discriminator) == 0) {
6067  } else
6068  if (strcmp("ChannelStateChange", discriminator) == 0) {
6070  } else
6071  if (strcmp("ChannelTalkingFinished", discriminator) == 0) {
6073  } else
6074  if (strcmp("ChannelTalkingStarted", discriminator) == 0) {
6076  } else
6077  if (strcmp("ChannelUnhold", discriminator) == 0) {
6078  return ast_ari_validate_channel_unhold(json);
6079  } else
6080  if (strcmp("ChannelUserevent", discriminator) == 0) {
6082  } else
6083  if (strcmp("ChannelVarset", discriminator) == 0) {
6084  return ast_ari_validate_channel_varset(json);
6085  } else
6086  if (strcmp("ContactStatusChange", discriminator) == 0) {
6088  } else
6089  if (strcmp("DeviceStateChanged", discriminator) == 0) {
6091  } else
6092  if (strcmp("Dial", discriminator) == 0) {
6093  return ast_ari_validate_dial(json);
6094  } else
6095  if (strcmp("EndpointStateChange", discriminator) == 0) {
6097  } else
6098  if (strcmp("Event", discriminator) == 0) {
6099  return ast_ari_validate_event(json);
6100  } else
6101  if (strcmp("MissingParams", discriminator) == 0) {
6102  return ast_ari_validate_missing_params(json);
6103  } else
6104  if (strcmp("PeerStatusChange", discriminator) == 0) {
6106  } else
6107  if (strcmp("PlaybackContinuing", discriminator) == 0) {
6109  } else
6110  if (strcmp("PlaybackFinished", discriminator) == 0) {
6112  } else
6113  if (strcmp("PlaybackStarted", discriminator) == 0) {
6114  return ast_ari_validate_playback_started(json);
6115  } else
6116  if (strcmp("RecordingFailed", discriminator) == 0) {
6117  return ast_ari_validate_recording_failed(json);
6118  } else
6119  if (strcmp("RecordingFinished", discriminator) == 0) {
6121  } else
6122  if (strcmp("RecordingStarted", discriminator) == 0) {
6124  } else
6125  if (strcmp("StasisEnd", discriminator) == 0) {
6126  return ast_ari_validate_stasis_end(json);
6127  } else
6128  if (strcmp("StasisStart", discriminator) == 0) {
6129  return ast_ari_validate_stasis_start(json);
6130  } else
6131  if (strcmp("TextMessageReceived", discriminator) == 0) {
6133  } else
6134  {
6135  ast_log(LOG_ERROR, "ARI Message has undocumented subtype %s\n",
6136  discriminator);
6137  res = 0;
6138  }
6139 
6140  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6141  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6142  int prop_is_valid;
6143  prop_is_valid = ast_ari_validate_string(
6145  if (!prop_is_valid) {
6146  ast_log(LOG_ERROR, "ARI Message field asterisk_id failed validation\n");
6147  res = 0;
6148  }
6149  } else
6150  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6151  int prop_is_valid;
6152  has_type = 1;
6153  prop_is_valid = ast_ari_validate_string(
6155  if (!prop_is_valid) {
6156  ast_log(LOG_ERROR, "ARI Message field type failed validation\n");
6157  res = 0;
6158  }
6159  } else
6160  {
6161  ast_log(LOG_ERROR,
6162  "ARI Message has undocumented field %s\n",
6163  ast_json_object_iter_key(iter));
6164  res = 0;
6165  }
6166  }
6167 
6168  if (!has_type) {
6169  ast_log(LOG_ERROR, "ARI Message missing required field type\n");
6170  res = 0;
6171  }
6172 
6173  return res;
6174 }
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:439
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_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:455
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:283
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:451
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.
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:407
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:447
int ast_ari_validate_missing_params ( struct ast_json json)

Validator for MissingParams.

Error event sent when required params are missing.

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

Definition at line 6181 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(), and ast_json_object_iter_value().

Referenced by ast_ari_validate_message(), and ast_ari_validate_missing_params_fn().

6182 {
6183  int res = 1;
6184  struct ast_json_iter *iter;
6185  int has_type = 0;
6186  int has_params = 0;
6187 
6188  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6189  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6190  int prop_is_valid;
6191  prop_is_valid = ast_ari_validate_string(
6193  if (!prop_is_valid) {
6194  ast_log(LOG_ERROR, "ARI MissingParams field asterisk_id failed validation\n");
6195  res = 0;
6196  }
6197  } else
6198  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6199  int prop_is_valid;
6200  has_type = 1;
6201  prop_is_valid = ast_ari_validate_string(
6203  if (!prop_is_valid) {
6204  ast_log(LOG_ERROR, "ARI MissingParams field type failed validation\n");
6205  res = 0;
6206  }
6207  } else
6208  if (strcmp("params", ast_json_object_iter_key(iter)) == 0) {
6209  int prop_is_valid;
6210  has_params = 1;
6211  prop_is_valid = ast_ari_validate_list(
6214  if (!prop_is_valid) {
6215  ast_log(LOG_ERROR, "ARI MissingParams field params failed validation\n");
6216  res = 0;
6217  }
6218  } else
6219  {
6220  ast_log(LOG_ERROR,
6221  "ARI MissingParams has undocumented field %s\n",
6222  ast_json_object_iter_key(iter));
6223  res = 0;
6224  }
6225  }
6226 
6227  if (!has_type) {
6228  ast_log(LOG_ERROR, "ARI MissingParams missing required field type\n");
6229  res = 0;
6230  }
6231 
6232  if (!has_params) {
6233  ast_log(LOG_ERROR, "ARI MissingParams missing required field params\n");
6234  res = 0;
6235  }
6236 
6237  return res;
6238 }
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:439
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_module ( struct ast_json json)

Validator for Module.

Details of an Asterisk module

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

Definition at line 519 of file ari_model_validators.c.

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

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  {
581  ast_log(LOG_ERROR,
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:439
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_object ( struct ast_json json)

Validator for native Swagger object.

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

Definition at line 96 of file res_ari_model.c.

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 }
int ast_ari_validate_peer ( struct ast_json json)

Validator for Peer.

Detailed information about a remote peer that communicates with Asterisk.

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

Definition at line 6245 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(), and ast_json_object_iter_value().

Referenced by ast_ari_validate_peer_fn(), and ast_ari_validate_peer_status_change().

6246 {
6247  int res = 1;
6248  struct ast_json_iter *iter;
6249  int has_peer_status = 0;
6250 
6251  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6252  if (strcmp("address", ast_json_object_iter_key(iter)) == 0) {
6253  int prop_is_valid;
6254  prop_is_valid = ast_ari_validate_string(
6256  if (!prop_is_valid) {
6257  ast_log(LOG_ERROR, "ARI Peer field address failed validation\n");
6258  res = 0;
6259  }
6260  } else
6261  if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
6262  int prop_is_valid;
6263  prop_is_valid = ast_ari_validate_string(
6265  if (!prop_is_valid) {
6266  ast_log(LOG_ERROR, "ARI Peer field cause failed validation\n");
6267  res = 0;
6268  }
6269  } else
6270  if (strcmp("peer_status", ast_json_object_iter_key(iter)) == 0) {
6271  int prop_is_valid;
6272  has_peer_status = 1;
6273  prop_is_valid = ast_ari_validate_string(
6275  if (!prop_is_valid) {
6276  ast_log(LOG_ERROR, "ARI Peer field peer_status failed validation\n");
6277  res = 0;
6278  }
6279  } else
6280  if (strcmp("port", ast_json_object_iter_key(iter)) == 0) {
6281  int prop_is_valid;
6282  prop_is_valid = ast_ari_validate_string(
6284  if (!prop_is_valid) {
6285  ast_log(LOG_ERROR, "ARI Peer field port failed validation\n");
6286  res = 0;
6287  }
6288  } else
6289  if (strcmp("time", ast_json_object_iter_key(iter)) == 0) {
6290  int prop_is_valid;
6291  prop_is_valid = ast_ari_validate_string(
6293  if (!prop_is_valid) {
6294  ast_log(LOG_ERROR, "ARI Peer field time failed validation\n");
6295  res = 0;
6296  }
6297  } else
6298  {
6299  ast_log(LOG_ERROR,
6300  "ARI Peer has undocumented field %s\n",
6301  ast_json_object_iter_key(iter));
6302  res = 0;
6303  }
6304  }
6305 
6306  if (!has_peer_status) {
6307  ast_log(LOG_ERROR, "ARI Peer missing required field peer_status\n");
6308  res = 0;
6309  }
6310 
6311  return res;
6312 }
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:439
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_peer_status_change ( struct ast_json json)

Validator for PeerStatusChange.

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

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

Definition at line 6319 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(), and ast_json_object_iter_value().

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

6320 {
6321  int res = 1;
6322  struct ast_json_iter *iter;
6323  int has_type = 0;
6324  int has_application = 0;
6325  int has_timestamp = 0;
6326  int has_endpoint = 0;
6327  int has_peer = 0;
6328 
6329  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6330  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6331  int prop_is_valid;
6332  prop_is_valid = ast_ari_validate_string(
6334  if (!prop_is_valid) {
6335  ast_log(LOG_ERROR, "ARI PeerStatusChange field asterisk_id failed validation\n");
6336  res = 0;
6337  }
6338  } else
6339  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6340  int prop_is_valid;
6341  has_type = 1;
6342  prop_is_valid = ast_ari_validate_string(
6344  if (!prop_is_valid) {
6345  ast_log(LOG_ERROR, "ARI PeerStatusChange field type failed validation\n");
6346  res = 0;
6347  }
6348  } else
6349  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
6350  int prop_is_valid;
6351  has_application = 1;
6352  prop_is_valid = ast_ari_validate_string(
6354  if (!prop_is_valid) {
6355  ast_log(LOG_ERROR, "ARI PeerStatusChange field application failed validation\n");
6356  res = 0;
6357  }
6358  } else
6359  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
6360  int prop_is_valid;
6361  has_timestamp = 1;
6362  prop_is_valid = ast_ari_validate_date(
6364  if (!prop_is_valid) {
6365  ast_log(LOG_ERROR, "ARI PeerStatusChange field timestamp failed validation\n");
6366  res = 0;
6367  }
6368  } else
6369  if (strcmp("endpoint", ast_json_object_iter_key(iter)) == 0) {
6370  int prop_is_valid;
6371  has_endpoint = 1;
6372  prop_is_valid = ast_ari_validate_endpoint(
6374  if (!prop_is_valid) {
6375  ast_log(LOG_ERROR, "ARI PeerStatusChange field endpoint failed validation\n");
6376  res = 0;
6377  }
6378  } else
6379  if (strcmp("peer", ast_json_object_iter_key(iter)) == 0) {
6380  int prop_is_valid;
6381  has_peer = 1;
6382  prop_is_valid = ast_ari_validate_peer(
6384  if (!prop_is_valid) {
6385  ast_log(LOG_ERROR, "ARI PeerStatusChange field peer failed validation\n");
6386  res = 0;
6387  }
6388  } else
6389  {
6390  ast_log(LOG_ERROR,
6391  "ARI PeerStatusChange has undocumented field %s\n",
6392  ast_json_object_iter_key(iter));
6393  res = 0;
6394  }
6395  }
6396 
6397  if (!has_type) {
6398  ast_log(LOG_ERROR, "ARI PeerStatusChange missing required field type\n");
6399  res = 0;
6400  }
6401 
6402  if (!has_application) {
6403  ast_log(LOG_ERROR, "ARI PeerStatusChange missing required field application\n");
6404  res = 0;
6405  }
6406 
6407  if (!has_timestamp) {
6408  ast_log(LOG_ERROR, "ARI PeerStatusChange missing required field timestamp\n");
6409  res = 0;
6410  }
6411 
6412  if (!has_endpoint) {
6413  ast_log(LOG_ERROR, "ARI PeerStatusChange missing required field endpoint\n");
6414  res = 0;
6415  }
6416 
6417  if (!has_peer) {
6418  ast_log(LOG_ERROR, "ARI PeerStatusChange missing required field peer\n");
6419  res = 0;
6420  }
6421 
6422  return res;
6423 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_playback ( struct ast_json json)

Validator for Playback.

Object representing the playback of media to a channel

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

Definition at line 2194 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(), and ast_json_object_iter_value().

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

2195 {
2196  int res = 1;
2197  struct ast_json_iter *iter;
2198  int has_id = 0;
2199  int has_media_uri = 0;
2200  int has_state = 0;
2201  int has_target_uri = 0;
2202 
2203  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2204  if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
2205  int prop_is_valid;
2206  has_id = 1;
2207  prop_is_valid = ast_ari_validate_string(
2209  if (!prop_is_valid) {
2210  ast_log(LOG_ERROR, "ARI Playback field id failed validation\n");
2211  res = 0;
2212  }
2213  } else
2214  if (strcmp("language", ast_json_object_iter_key(iter)) == 0) {
2215  int prop_is_valid;
2216  prop_is_valid = ast_ari_validate_string(
2218  if (!prop_is_valid) {
2219  ast_log(LOG_ERROR, "ARI Playback field language failed validation\n");
2220  res = 0;
2221  }
2222  } else
2223  if (strcmp("media_uri", ast_json_object_iter_key(iter)) == 0) {
2224  int prop_is_valid;
2225  has_media_uri = 1;
2226  prop_is_valid = ast_ari_validate_string(
2228  if (!prop_is_valid) {
2229  ast_log(LOG_ERROR, "ARI Playback field media_uri failed validation\n");
2230  res = 0;
2231  }
2232  } else
2233  if (strcmp("next_media_uri", ast_json_object_iter_key(iter)) == 0) {
2234  int prop_is_valid;
2235  prop_is_valid = ast_ari_validate_string(
2237  if (!prop_is_valid) {
2238  ast_log(LOG_ERROR, "ARI Playback field next_media_uri failed validation\n");
2239  res = 0;
2240  }
2241  } else
2242  if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
2243  int prop_is_valid;
2244  has_state = 1;
2245  prop_is_valid = ast_ari_validate_string(
2247  if (!prop_is_valid) {
2248  ast_log(LOG_ERROR, "ARI Playback field state failed validation\n");
2249  res = 0;
2250  }
2251  } else
2252  if (strcmp("target_uri", ast_json_object_iter_key(iter)) == 0) {
2253  int prop_is_valid;
2254  has_target_uri = 1;
2255  prop_is_valid = ast_ari_validate_string(
2257  if (!prop_is_valid) {
2258  ast_log(LOG_ERROR, "ARI Playback field target_uri failed validation\n");
2259  res = 0;
2260  }
2261  } else
2262  {
2263  ast_log(LOG_ERROR,
2264  "ARI Playback has undocumented field %s\n",
2265  ast_json_object_iter_key(iter));
2266  res = 0;
2267  }
2268  }
2269 
2270  if (!has_id) {
2271  ast_log(LOG_ERROR, "ARI Playback missing required field id\n");
2272  res = 0;
2273  }
2274 
2275  if (!has_media_uri) {
2276  ast_log(LOG_ERROR, "ARI Playback missing required field media_uri\n");
2277  res = 0;
2278  }
2279 
2280  if (!has_state) {
2281  ast_log(LOG_ERROR, "ARI Playback missing required field state\n");
2282  res = 0;
2283  }
2284 
2285  if (!has_target_uri) {
2286  ast_log(LOG_ERROR, "ARI Playback missing required field target_uri\n");
2287  res = 0;
2288  }
2289 
2290  return res;
2291 }
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:439
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_playback_continuing ( struct ast_json json)

Validator for PlaybackContinuing.

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

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

Definition at line 6430 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(), and ast_json_object_iter_value().

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

6431 {
6432  int res = 1;
6433  struct ast_json_iter *iter;
6434  int has_type = 0;
6435  int has_application = 0;
6436  int has_timestamp = 0;
6437  int has_playback = 0;
6438 
6439  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6440  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6441  int prop_is_valid;
6442  prop_is_valid = ast_ari_validate_string(
6444  if (!prop_is_valid) {
6445  ast_log(LOG_ERROR, "ARI PlaybackContinuing field asterisk_id failed validation\n");
6446  res = 0;
6447  }
6448  } else
6449  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6450  int prop_is_valid;
6451  has_type = 1;
6452  prop_is_valid = ast_ari_validate_string(
6454  if (!prop_is_valid) {
6455  ast_log(LOG_ERROR, "ARI PlaybackContinuing field type failed validation\n");
6456  res = 0;
6457  }
6458  } else
6459  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
6460  int prop_is_valid;
6461  has_application = 1;
6462  prop_is_valid = ast_ari_validate_string(
6464  if (!prop_is_valid) {
6465  ast_log(LOG_ERROR, "ARI PlaybackContinuing field application failed validation\n");
6466  res = 0;
6467  }
6468  } else
6469  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
6470  int prop_is_valid;
6471  has_timestamp = 1;
6472  prop_is_valid = ast_ari_validate_date(
6474  if (!prop_is_valid) {
6475  ast_log(LOG_ERROR, "ARI PlaybackContinuing field timestamp failed validation\n");
6476  res = 0;
6477  }
6478  } else
6479  if (strcmp("playback", ast_json_object_iter_key(iter)) == 0) {
6480  int prop_is_valid;
6481  has_playback = 1;
6482  prop_is_valid = ast_ari_validate_playback(
6484  if (!prop_is_valid) {
6485  ast_log(LOG_ERROR, "ARI PlaybackContinuing field playback failed validation\n");
6486  res = 0;
6487  }
6488  } else
6489  {
6490  ast_log(LOG_ERROR,
6491  "ARI PlaybackContinuing has undocumented field %s\n",
6492  ast_json_object_iter_key(iter));
6493  res = 0;
6494  }
6495  }
6496 
6497  if (!has_type) {
6498  ast_log(LOG_ERROR, "ARI PlaybackContinuing missing required field type\n");
6499  res = 0;
6500  }
6501 
6502  if (!has_application) {
6503  ast_log(LOG_ERROR, "ARI PlaybackContinuing missing required field application\n");
6504  res = 0;
6505  }
6506 
6507  if (!has_timestamp) {
6508  ast_log(LOG_ERROR, "ARI PlaybackContinuing missing required field timestamp\n");
6509  res = 0;
6510  }
6511 
6512  if (!has_playback) {
6513  ast_log(LOG_ERROR, "ARI PlaybackContinuing missing required field playback\n");
6514  res = 0;
6515  }
6516 
6517  return res;
6518 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
int ast_ari_validate_playback(struct ast_json *json)
Validator for Playback.
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:447
int ast_ari_validate_playback_finished ( struct ast_json json)

Validator for PlaybackFinished.

Event showing the completion of a media playback operation.

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

Definition at line 6525 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(), and ast_json_object_iter_value().

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

6526 {
6527  int res = 1;
6528  struct ast_json_iter *iter;
6529  int has_type = 0;
6530  int has_application = 0;
6531  int has_timestamp = 0;
6532  int has_playback = 0;
6533 
6534  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6535  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6536  int prop_is_valid;
6537  prop_is_valid = ast_ari_validate_string(
6539  if (!prop_is_valid) {
6540  ast_log(LOG_ERROR, "ARI PlaybackFinished field asterisk_id failed validation\n");
6541  res = 0;
6542  }
6543  } else
6544  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6545  int prop_is_valid;
6546  has_type = 1;
6547  prop_is_valid = ast_ari_validate_string(
6549  if (!prop_is_valid) {
6550  ast_log(LOG_ERROR, "ARI PlaybackFinished field type failed validation\n");
6551  res = 0;
6552  }
6553  } else
6554  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
6555  int prop_is_valid;
6556  has_application = 1;
6557  prop_is_valid = ast_ari_validate_string(
6559  if (!prop_is_valid) {
6560  ast_log(LOG_ERROR, "ARI PlaybackFinished field application failed validation\n");
6561  res = 0;
6562  }
6563  } else
6564  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
6565  int prop_is_valid;
6566  has_timestamp = 1;
6567  prop_is_valid = ast_ari_validate_date(
6569  if (!prop_is_valid) {
6570  ast_log(LOG_ERROR, "ARI PlaybackFinished field timestamp failed validation\n");
6571  res = 0;
6572  }
6573  } else
6574  if (strcmp("playback", ast_json_object_iter_key(iter)) == 0) {
6575  int prop_is_valid;
6576  has_playback = 1;
6577  prop_is_valid = ast_ari_validate_playback(
6579  if (!prop_is_valid) {
6580  ast_log(LOG_ERROR, "ARI PlaybackFinished field playback failed validation\n");
6581  res = 0;
6582  }
6583  } else
6584  {
6585  ast_log(LOG_ERROR,
6586  "ARI PlaybackFinished has undocumented field %s\n",
6587  ast_json_object_iter_key(iter));
6588  res = 0;
6589  }
6590  }
6591 
6592  if (!has_type) {
6593  ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field type\n");
6594  res = 0;
6595  }
6596 
6597  if (!has_application) {
6598  ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field application\n");
6599  res = 0;
6600  }
6601 
6602  if (!has_timestamp) {
6603  ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field timestamp\n");
6604  res = 0;
6605  }
6606 
6607  if (!has_playback) {
6608  ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field playback\n");
6609  res = 0;
6610  }
6611 
6612  return res;
6613 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
int ast_ari_validate_playback(struct ast_json *json)
Validator for Playback.
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:447
int ast_ari_validate_playback_started ( struct ast_json json)

Validator for PlaybackStarted.

Event showing the start of a media playback operation.

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

Definition at line 6620 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(), and ast_json_object_iter_value().

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

6621 {
6622  int res = 1;
6623  struct ast_json_iter *iter;
6624  int has_type = 0;
6625  int has_application = 0;
6626  int has_timestamp = 0;
6627  int has_playback = 0;
6628 
6629  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6630  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6631  int prop_is_valid;
6632  prop_is_valid = ast_ari_validate_string(
6634  if (!prop_is_valid) {
6635  ast_log(LOG_ERROR, "ARI PlaybackStarted field asterisk_id failed validation\n");
6636  res = 0;
6637  }
6638  } else
6639  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6640  int prop_is_valid;
6641  has_type = 1;
6642  prop_is_valid = ast_ari_validate_string(
6644  if (!prop_is_valid) {
6645  ast_log(LOG_ERROR, "ARI PlaybackStarted field type failed validation\n");
6646  res = 0;
6647  }
6648  } else
6649  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
6650  int prop_is_valid;
6651  has_application = 1;
6652  prop_is_valid = ast_ari_validate_string(
6654  if (!prop_is_valid) {
6655  ast_log(LOG_ERROR, "ARI PlaybackStarted field application failed validation\n");
6656  res = 0;
6657  }
6658  } else
6659  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
6660  int prop_is_valid;
6661  has_timestamp = 1;
6662  prop_is_valid = ast_ari_validate_date(
6664  if (!prop_is_valid) {
6665  ast_log(LOG_ERROR, "ARI PlaybackStarted field timestamp failed validation\n");
6666  res = 0;
6667  }
6668  } else
6669  if (strcmp("playback", ast_json_object_iter_key(iter)) == 0) {
6670  int prop_is_valid;
6671  has_playback = 1;
6672  prop_is_valid = ast_ari_validate_playback(
6674  if (!prop_is_valid) {
6675  ast_log(LOG_ERROR, "ARI PlaybackStarted field playback failed validation\n");
6676  res = 0;
6677  }
6678  } else
6679  {
6680  ast_log(LOG_ERROR,
6681  "ARI PlaybackStarted has undocumented field %s\n",
6682  ast_json_object_iter_key(iter));
6683  res = 0;
6684  }
6685  }
6686 
6687  if (!has_type) {
6688  ast_log(LOG_ERROR, "ARI PlaybackStarted missing required field type\n");
6689  res = 0;
6690  }
6691 
6692  if (!has_application) {
6693  ast_log(LOG_ERROR, "ARI PlaybackStarted missing required field application\n");
6694  res = 0;
6695  }
6696 
6697  if (!has_timestamp) {
6698  ast_log(LOG_ERROR, "ARI PlaybackStarted missing required field timestamp\n");
6699  res = 0;
6700  }
6701 
6702  if (!has_playback) {
6703  ast_log(LOG_ERROR, "ARI PlaybackStarted missing required field playback\n");
6704  res = 0;
6705  }
6706 
6707  return res;
6708 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
int ast_ari_validate_playback(struct ast_json *json)
Validator for Playback.
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:447
int ast_ari_validate_recording_failed ( struct ast_json json)

Validator for RecordingFailed.

Event showing failure of a recording operation.

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

Definition at line 6715 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(), and ast_json_object_iter_value().

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

6716 {
6717  int res = 1;
6718  struct ast_json_iter *iter;
6719  int has_type = 0;
6720  int has_application = 0;
6721  int has_timestamp = 0;
6722  int has_recording = 0;
6723 
6724  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6725  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6726  int prop_is_valid;
6727  prop_is_valid = ast_ari_validate_string(
6729  if (!prop_is_valid) {
6730  ast_log(LOG_ERROR, "ARI RecordingFailed field asterisk_id failed validation\n");
6731  res = 0;
6732  }
6733  } else
6734  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6735  int prop_is_valid;
6736  has_type = 1;
6737  prop_is_valid = ast_ari_validate_string(
6739  if (!prop_is_valid) {
6740  ast_log(LOG_ERROR, "ARI RecordingFailed field type failed validation\n");
6741  res = 0;
6742  }
6743  } else
6744  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
6745  int prop_is_valid;
6746  has_application = 1;
6747  prop_is_valid = ast_ari_validate_string(
6749  if (!prop_is_valid) {
6750  ast_log(LOG_ERROR, "ARI RecordingFailed field application failed validation\n");
6751  res = 0;
6752  }
6753  } else
6754  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
6755  int prop_is_valid;
6756  has_timestamp = 1;
6757  prop_is_valid = ast_ari_validate_date(
6759  if (!prop_is_valid) {
6760  ast_log(LOG_ERROR, "ARI RecordingFailed field timestamp failed validation\n");
6761  res = 0;
6762  }
6763  } else
6764  if (strcmp("recording", ast_json_object_iter_key(iter)) == 0) {
6765  int prop_is_valid;
6766  has_recording = 1;
6767  prop_is_valid = ast_ari_validate_live_recording(
6769  if (!prop_is_valid) {
6770  ast_log(LOG_ERROR, "ARI RecordingFailed field recording failed validation\n");
6771  res = 0;
6772  }
6773  } else
6774  {
6775  ast_log(LOG_ERROR,
6776  "ARI RecordingFailed has undocumented field %s\n",
6777  ast_json_object_iter_key(iter));
6778  res = 0;
6779  }
6780  }
6781 
6782  if (!has_type) {
6783  ast_log(LOG_ERROR, "ARI RecordingFailed missing required field type\n");
6784  res = 0;
6785  }
6786 
6787  if (!has_application) {
6788  ast_log(LOG_ERROR, "ARI RecordingFailed missing required field application\n");
6789  res = 0;
6790  }
6791 
6792  if (!has_timestamp) {
6793  ast_log(LOG_ERROR, "ARI RecordingFailed missing required field timestamp\n");
6794  res = 0;
6795  }
6796 
6797  if (!has_recording) {
6798  ast_log(LOG_ERROR, "ARI RecordingFailed missing required field recording\n");
6799  res = 0;
6800  }
6801 
6802  return res;
6803 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_recording_finished ( struct ast_json json)

Validator for RecordingFinished.

Event showing the completion of a recording operation.

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

Definition at line 6810 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(), and ast_json_object_iter_value().

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

6811 {
6812  int res = 1;
6813  struct ast_json_iter *iter;
6814  int has_type = 0;
6815  int has_application = 0;
6816  int has_timestamp = 0;
6817  int has_recording = 0;
6818 
6819  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6820  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6821  int prop_is_valid;
6822  prop_is_valid = ast_ari_validate_string(
6824  if (!prop_is_valid) {
6825  ast_log(LOG_ERROR, "ARI RecordingFinished field asterisk_id failed validation\n");
6826  res = 0;
6827  }
6828  } else
6829  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6830  int prop_is_valid;
6831  has_type = 1;
6832  prop_is_valid = ast_ari_validate_string(
6834  if (!prop_is_valid) {
6835  ast_log(LOG_ERROR, "ARI RecordingFinished field type failed validation\n");
6836  res = 0;
6837  }
6838  } else
6839  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
6840  int prop_is_valid;
6841  has_application = 1;
6842  prop_is_valid = ast_ari_validate_string(
6844  if (!prop_is_valid) {
6845  ast_log(LOG_ERROR, "ARI RecordingFinished field application failed validation\n");
6846  res = 0;
6847  }
6848  } else
6849  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
6850  int prop_is_valid;
6851  has_timestamp = 1;
6852  prop_is_valid = ast_ari_validate_date(
6854  if (!prop_is_valid) {
6855  ast_log(LOG_ERROR, "ARI RecordingFinished field timestamp failed validation\n");
6856  res = 0;
6857  }
6858  } else
6859  if (strcmp("recording", ast_json_object_iter_key(iter)) == 0) {
6860  int prop_is_valid;
6861  has_recording = 1;
6862  prop_is_valid = ast_ari_validate_live_recording(
6864  if (!prop_is_valid) {
6865  ast_log(LOG_ERROR, "ARI RecordingFinished field recording failed validation\n");
6866  res = 0;
6867  }
6868  } else
6869  {
6870  ast_log(LOG_ERROR,
6871  "ARI RecordingFinished has undocumented field %s\n",
6872  ast_json_object_iter_key(iter));
6873  res = 0;
6874  }
6875  }
6876 
6877  if (!has_type) {
6878  ast_log(LOG_ERROR, "ARI RecordingFinished missing required field type\n");
6879  res = 0;
6880  }
6881 
6882  if (!has_application) {
6883  ast_log(LOG_ERROR, "ARI RecordingFinished missing required field application\n");
6884  res = 0;
6885  }
6886 
6887  if (!has_timestamp) {
6888  ast_log(LOG_ERROR, "ARI RecordingFinished missing required field timestamp\n");
6889  res = 0;
6890  }
6891 
6892  if (!has_recording) {
6893  ast_log(LOG_ERROR, "ARI RecordingFinished missing required field recording\n");
6894  res = 0;
6895  }
6896 
6897  return res;
6898 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_recording_started ( struct ast_json json)

Validator for RecordingStarted.

Event showing the start of a recording operation.

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

Definition at line 6905 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(), and ast_json_object_iter_value().

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

6906 {
6907  int res = 1;
6908  struct ast_json_iter *iter;
6909  int has_type = 0;
6910  int has_application = 0;
6911  int has_timestamp = 0;
6912  int has_recording = 0;
6913 
6914  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
6915  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
6916  int prop_is_valid;
6917  prop_is_valid = ast_ari_validate_string(
6919  if (!prop_is_valid) {
6920  ast_log(LOG_ERROR, "ARI RecordingStarted field asterisk_id failed validation\n");
6921  res = 0;
6922  }
6923  } else
6924  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
6925  int prop_is_valid;
6926  has_type = 1;
6927  prop_is_valid = ast_ari_validate_string(
6929  if (!prop_is_valid) {
6930  ast_log(LOG_ERROR, "ARI RecordingStarted field type failed validation\n");
6931  res = 0;
6932  }
6933  } else
6934  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
6935  int prop_is_valid;
6936  has_application = 1;
6937  prop_is_valid = ast_ari_validate_string(
6939  if (!prop_is_valid) {
6940  ast_log(LOG_ERROR, "ARI RecordingStarted field application failed validation\n");
6941  res = 0;
6942  }
6943  } else
6944  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
6945  int prop_is_valid;
6946  has_timestamp = 1;
6947  prop_is_valid = ast_ari_validate_date(
6949  if (!prop_is_valid) {
6950  ast_log(LOG_ERROR, "ARI RecordingStarted field timestamp failed validation\n");
6951  res = 0;
6952  }
6953  } else
6954  if (strcmp("recording", ast_json_object_iter_key(iter)) == 0) {
6955  int prop_is_valid;
6956  has_recording = 1;
6957  prop_is_valid = ast_ari_validate_live_recording(
6959  if (!prop_is_valid) {
6960  ast_log(LOG_ERROR, "ARI RecordingStarted field recording failed validation\n");
6961  res = 0;
6962  }
6963  } else
6964  {
6965  ast_log(LOG_ERROR,
6966  "ARI RecordingStarted has undocumented field %s\n",
6967  ast_json_object_iter_key(iter));
6968  res = 0;
6969  }
6970  }
6971 
6972  if (!has_type) {
6973  ast_log(LOG_ERROR, "ARI RecordingStarted missing required field type\n");
6974  res = 0;
6975  }
6976 
6977  if (!has_application) {
6978  ast_log(LOG_ERROR, "ARI RecordingStarted missing required field application\n");
6979  res = 0;
6980  }
6981 
6982  if (!has_timestamp) {
6983  ast_log(LOG_ERROR, "ARI RecordingStarted missing required field timestamp\n");
6984  res = 0;
6985  }
6986 
6987  if (!has_recording) {
6988  ast_log(LOG_ERROR, "ARI RecordingStarted missing required field recording\n");
6989  res = 0;
6990  }
6991 
6992  return res;
6993 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_rtpstat ( struct ast_json json)

Validator for RTPstat.

A statistics of a RTP.

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

Definition at line 1358 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(), and ast_json_object_iter_value().

Referenced by ast_ari_channels_rtpstatistics_cb(), and ast_ari_validate_rtpstat_fn().

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

Validator for SetId.

Effective user/group id

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

Definition at line 621 of file ari_model_validators.c.

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

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  {
650  ast_log(LOG_ERROR,
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:439
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_sound ( struct ast_json json)

Validator for Sound.

A media file that may be played back.

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

Definition at line 2130 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(), and ast_json_object_iter_value().

Referenced by ast_ari_sounds_get_cb(), and ast_ari_validate_sound_fn().

2131 {
2132  int res = 1;
2133  struct ast_json_iter *iter;
2134  int has_formats = 0;
2135  int has_id = 0;
2136 
2137  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2138  if (strcmp("formats", ast_json_object_iter_key(iter)) == 0) {
2139  int prop_is_valid;
2140  has_formats = 1;
2141  prop_is_valid = ast_ari_validate_list(
2144  if (!prop_is_valid) {
2145  ast_log(LOG_ERROR, "ARI Sound field formats failed validation\n");
2146  res = 0;
2147  }
2148  } else
2149  if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
2150  int prop_is_valid;
2151  has_id = 1;
2152  prop_is_valid = ast_ari_validate_string(
2154  if (!prop_is_valid) {
2155  ast_log(LOG_ERROR, "ARI Sound field id failed validation\n");
2156  res = 0;
2157  }
2158  } else
2159  if (strcmp("text", ast_json_object_iter_key(iter)) == 0) {
2160  int prop_is_valid;
2161  prop_is_valid = ast_ari_validate_string(
2163  if (!prop_is_valid) {
2164  ast_log(LOG_ERROR, "ARI Sound field text failed validation\n");
2165  res = 0;
2166  }
2167  } else
2168  {
2169  ast_log(LOG_ERROR,
2170  "ARI Sound has undocumented field %s\n",
2171  ast_json_object_iter_key(iter));
2172  res = 0;
2173  }
2174  }
2175 
2176  if (!has_formats) {
2177  ast_log(LOG_ERROR, "ARI Sound missing required field formats\n");
2178  res = 0;
2179  }
2180 
2181  if (!has_id) {
2182  ast_log(LOG_ERROR, "ARI Sound missing required field id\n");
2183  res = 0;
2184  }
2185 
2186  return res;
2187 }
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:439
int ast_ari_validate_format_lang_pair(struct ast_json *json)
Validator for FormatLangPair.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_stasis_end ( struct ast_json json)

Validator for StasisEnd.

Notification that a channel has left a Stasis application.

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

Definition at line 7000 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(), and ast_json_object_iter_value().

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

7001 {
7002  int res = 1;
7003  struct ast_json_iter *iter;
7004  int has_type = 0;
7005  int has_application = 0;
7006  int has_timestamp = 0;
7007  int has_channel = 0;
7008 
7009  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
7010  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
7011  int prop_is_valid;
7012  prop_is_valid = ast_ari_validate_string(
7014  if (!prop_is_valid) {
7015  ast_log(LOG_ERROR, "ARI StasisEnd field asterisk_id failed validation\n");
7016  res = 0;
7017  }
7018  } else
7019  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
7020  int prop_is_valid;
7021  has_type = 1;
7022  prop_is_valid = ast_ari_validate_string(
7024  if (!prop_is_valid) {
7025  ast_log(LOG_ERROR, "ARI StasisEnd field type failed validation\n");
7026  res = 0;
7027  }
7028  } else
7029  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
7030  int prop_is_valid;
7031  has_application = 1;
7032  prop_is_valid = ast_ari_validate_string(
7034  if (!prop_is_valid) {
7035  ast_log(LOG_ERROR, "ARI StasisEnd field application failed validation\n");
7036  res = 0;
7037  }
7038  } else
7039  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
7040  int prop_is_valid;
7041  has_timestamp = 1;
7042  prop_is_valid = ast_ari_validate_date(
7044  if (!prop_is_valid) {
7045  ast_log(LOG_ERROR, "ARI StasisEnd field timestamp failed validation\n");
7046  res = 0;
7047  }
7048  } else
7049  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
7050  int prop_is_valid;
7051  has_channel = 1;
7052  prop_is_valid = ast_ari_validate_channel(
7054  if (!prop_is_valid) {
7055  ast_log(LOG_ERROR, "ARI StasisEnd field channel failed validation\n");
7056  res = 0;
7057  }
7058  } else
7059  {
7060  ast_log(LOG_ERROR,
7061  "ARI StasisEnd has undocumented field %s\n",
7062  ast_json_object_iter_key(iter));
7063  res = 0;
7064  }
7065  }
7066 
7067  if (!has_type) {
7068  ast_log(LOG_ERROR, "ARI StasisEnd missing required field type\n");
7069  res = 0;
7070  }
7071 
7072  if (!has_application) {
7073  ast_log(LOG_ERROR, "ARI StasisEnd missing required field application\n");
7074  res = 0;
7075  }
7076 
7077  if (!has_timestamp) {
7078  ast_log(LOG_ERROR, "ARI StasisEnd missing required field timestamp\n");
7079  res = 0;
7080  }
7081 
7082  if (!has_channel) {
7083  ast_log(LOG_ERROR, "ARI StasisEnd missing required field channel\n");
7084  res = 0;
7085  }
7086 
7087  return res;
7088 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_stasis_start ( struct ast_json json)

Validator for StasisStart.

Notification that a channel has entered a Stasis application.

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

Definition at line 7095 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(), and ast_json_object_iter_value().

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

7096 {
7097  int res = 1;
7098  struct ast_json_iter *iter;
7099  int has_type = 0;
7100  int has_application = 0;
7101  int has_timestamp = 0;
7102  int has_args = 0;
7103  int has_channel = 0;
7104 
7105  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
7106  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
7107  int prop_is_valid;
7108  prop_is_valid = ast_ari_validate_string(
7110  if (!prop_is_valid) {
7111  ast_log(LOG_ERROR, "ARI StasisStart field asterisk_id failed validation\n");
7112  res = 0;
7113  }
7114  } else
7115  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
7116  int prop_is_valid;
7117  has_type = 1;
7118  prop_is_valid = ast_ari_validate_string(
7120  if (!prop_is_valid) {
7121  ast_log(LOG_ERROR, "ARI StasisStart field type failed validation\n");
7122  res = 0;
7123  }
7124  } else
7125  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
7126  int prop_is_valid;
7127  has_application = 1;
7128  prop_is_valid = ast_ari_validate_string(
7130  if (!prop_is_valid) {
7131  ast_log(LOG_ERROR, "ARI StasisStart field application failed validation\n");
7132  res = 0;
7133  }
7134  } else
7135  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
7136  int prop_is_valid;
7137  has_timestamp = 1;
7138  prop_is_valid = ast_ari_validate_date(
7140  if (!prop_is_valid) {
7141  ast_log(LOG_ERROR, "ARI StasisStart field timestamp failed validation\n");
7142  res = 0;
7143  }
7144  } else
7145  if (strcmp("args", ast_json_object_iter_key(iter)) == 0) {
7146  int prop_is_valid;
7147  has_args = 1;
7148  prop_is_valid = ast_ari_validate_list(
7151  if (!prop_is_valid) {
7152  ast_log(LOG_ERROR, "ARI StasisStart field args failed validation\n");
7153  res = 0;
7154  }
7155  } else
7156  if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
7157  int prop_is_valid;
7158  has_channel = 1;
7159  prop_is_valid = ast_ari_validate_channel(
7161  if (!prop_is_valid) {
7162  ast_log(LOG_ERROR, "ARI StasisStart field channel failed validation\n");
7163  res = 0;
7164  }
7165  } else
7166  if (strcmp("replace_channel", ast_json_object_iter_key(iter)) == 0) {
7167  int prop_is_valid;
7168  prop_is_valid = ast_ari_validate_channel(
7170  if (!prop_is_valid) {
7171  ast_log(LOG_ERROR, "ARI StasisStart field replace_channel failed validation\n");
7172  res = 0;
7173  }
7174  } else
7175  {
7176  ast_log(LOG_ERROR,
7177  "ARI StasisStart has undocumented field %s\n",
7178  ast_json_object_iter_key(iter));
7179  res = 0;
7180  }
7181  }
7182 
7183  if (!has_type) {
7184  ast_log(LOG_ERROR, "ARI StasisStart missing required field type\n");
7185  res = 0;
7186  }
7187 
7188  if (!has_application) {
7189  ast_log(LOG_ERROR, "ARI StasisStart missing required field application\n");
7190  res = 0;
7191  }
7192 
7193  if (!has_timestamp) {
7194  ast_log(LOG_ERROR, "ARI StasisStart missing required field timestamp\n");
7195  res = 0;
7196  }
7197 
7198  if (!has_args) {
7199  ast_log(LOG_ERROR, "ARI StasisStart missing required field args\n");
7200  res = 0;
7201  }
7202 
7203  if (!has_channel) {
7204  ast_log(LOG_ERROR, "ARI StasisStart missing required field channel\n");
7205  res = 0;
7206  }
7207 
7208  return res;
7209 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_status_info ( struct ast_json json)

Validator for StatusInfo.

Info about Asterisk status

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

Definition at line 675 of file ari_model_validators.c.

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

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  {
704  ast_log(LOG_ERROR,
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
struct ast_json_iter * ast_json_object_iter_next(struct ast_json *object, struct ast_json_iter *iter)
Get the next iterator.
Definition: json.c:447
int ast_ari_validate_stored_recording ( struct ast_json json)

Validator for StoredRecording.

A past recording that may be played back.

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

Definition at line 2022 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(), and ast_json_object_iter_value().

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

2023 {
2024  int res = 1;
2025  struct ast_json_iter *iter;
2026  int has_format = 0;
2027  int has_name = 0;
2028 
2029  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2030  if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
2031  int prop_is_valid;
2032  has_format = 1;
2033  prop_is_valid = ast_ari_validate_string(
2035  if (!prop_is_valid) {
2036  ast_log(LOG_ERROR, "ARI StoredRecording field format failed validation\n");
2037  res = 0;
2038  }
2039  } else
2040  if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
2041  int prop_is_valid;
2042  has_name = 1;
2043  prop_is_valid = ast_ari_validate_string(
2045  if (!prop_is_valid) {
2046  ast_log(LOG_ERROR, "ARI StoredRecording field name failed validation\n");
2047  res = 0;
2048  }
2049  } else
2050  {
2051  ast_log(LOG_ERROR,
2052  "ARI StoredRecording has undocumented field %s\n",
2053  ast_json_object_iter_key(iter));
2054  res = 0;
2055  }
2056  }
2057 
2058  if (!has_format) {
2059  ast_log(LOG_ERROR, "ARI StoredRecording missing required field format\n");
2060  res = 0;
2061  }
2062 
2063  if (!has_name) {
2064  ast_log(LOG_ERROR, "ARI StoredRecording missing required field name\n");
2065  res = 0;
2066  }
2067 
2068  return res;
2069 }
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:439
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_string ( struct ast_json json)

Validator for native Swagger string.

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

Definition at line 143 of file res_ari_model.c.

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(), and ast_ari_validate_variable().

144 {
145  return check_type(json, AST_JSON_STRING);
146 }
int ast_ari_validate_system_info ( struct ast_json json)

Validator for SystemInfo.

Info about Asterisk

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

Definition at line 729 of file ari_model_validators.c.

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

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  {
758  ast_log(LOG_ERROR,
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:439
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_text_message ( struct ast_json json)

Validator for TextMessage.

A text message.

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

Definition at line 901 of file ari_model_validators.c.

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

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  {
950  ast_log(LOG_ERROR,
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:439
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_text_message_received ( struct ast_json json)

Validator for TextMessageReceived.

A text message was received from an endpoint.

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

Definition at line 7216 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(), and ast_json_object_iter_value().

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

7217 {
7218  int res = 1;
7219  struct ast_json_iter *iter;
7220  int has_type = 0;
7221  int has_application = 0;
7222  int has_timestamp = 0;
7223  int has_message = 0;
7224 
7225  for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
7226  if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
7227  int prop_is_valid;
7228  prop_is_valid = ast_ari_validate_string(
7230  if (!prop_is_valid) {
7231  ast_log(LOG_ERROR, "ARI TextMessageReceived field asterisk_id failed validation\n");
7232  res = 0;
7233  }
7234  } else
7235  if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
7236  int prop_is_valid;
7237  has_type = 1;
7238  prop_is_valid = ast_ari_validate_string(
7240  if (!prop_is_valid) {
7241  ast_log(LOG_ERROR, "ARI TextMessageReceived field type failed validation\n");
7242  res = 0;
7243  }
7244  } else
7245  if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
7246  int prop_is_valid;
7247  has_application = 1;
7248  prop_is_valid = ast_ari_validate_string(
7250  if (!prop_is_valid) {
7251  ast_log(LOG_ERROR, "ARI TextMessageReceived field application failed validation\n");
7252  res = 0;
7253  }
7254  } else
7255  if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
7256  int prop_is_valid;
7257  has_timestamp = 1;
7258  prop_is_valid = ast_ari_validate_date(
7260  if (!prop_is_valid) {
7261  ast_log(LOG_ERROR, "ARI TextMessageReceived field timestamp failed validation\n");
7262  res = 0;
7263  }
7264  } else
7265  if (strcmp("endpoint", ast_json_object_iter_key(iter)) == 0) {
7266  int prop_is_valid;
7267  prop_is_valid = ast_ari_validate_endpoint(
7269  if (!prop_is_valid) {
7270  ast_log(LOG_ERROR, "ARI TextMessageReceived field endpoint failed validation\n");
7271  res = 0;
7272  }
7273  } else
7274  if (strcmp("message", ast_json_object_iter_key(iter)) == 0) {
7275  int prop_is_valid;
7276  has_message = 1;
7277  prop_is_valid = ast_ari_validate_text_message(
7279  if (!prop_is_valid) {
7280  ast_log(LOG_ERROR, "ARI TextMessageReceived field message failed validation\n");
7281  res = 0;
7282  }
7283  } else
7284  {
7285  ast_log(LOG_ERROR,
7286  "ARI TextMessageReceived has undocumented field %s\n",
7287  ast_json_object_iter_key(iter));
7288  res = 0;
7289  }
7290  }
7291 
7292  if (!has_type) {
7293  ast_log(LOG_ERROR, "ARI TextMessageReceived missing required field type\n");
7294  res = 0;
7295  }
7296 
7297  if (!has_application) {
7298  ast_log(LOG_ERROR, "ARI TextMessageReceived missing required field application\n");
7299  res = 0;
7300  }
7301 
7302  if (!has_timestamp) {
7303  ast_log(LOG_ERROR, "ARI TextMessageReceived missing required field timestamp\n");
7304  res = 0;
7305  }
7306 
7307  if (!has_message) {
7308  ast_log(LOG_ERROR, "ARI TextMessageReceived missing required field message\n");
7309  res = 0;
7310  }
7311 
7312  return res;
7313 }
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:439
int ast_ari_validate_date(struct ast_json *json)
Validator for native Swagger date.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_variable ( struct ast_json json)

Validator for Variable.

The value of a channel variable

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

Definition at line 783 of file ari_model_validators.c.

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

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  {
801  ast_log(LOG_ERROR,
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:439
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
Definition: json.c:455
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
Definition: json.c:451
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:447
int ast_ari_validate_void ( struct ast_json json)

Validator for native Swagger void.

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

Definition at line 91 of file res_ari_model.c.

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_refer_cb(), ast_ari_endpoints_refer_to_endpoint_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 }