ari_model_validators.c

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 2013, Digium, Inc.
00005  *
00006  * See http://www.asterisk.org for more information about
00007  * the Asterisk project. Please do not directly contact
00008  * any of the maintainers of this project for assistance;
00009  * the project provides a web site, mailing lists and IRC
00010  * channels for your use.
00011  *
00012  * This program is free software, distributed under the terms of
00013  * the GNU General Public License Version 2. See the LICENSE file
00014  * at the top of the source tree.
00015  */
00016 
00017 /*! \file
00018  *
00019  * \brief Generated file - Build validators for ARI model objects.
00020  */
00021 
00022  /*
00023  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
00024  * !!!!!                               DO NOT EDIT                        !!!!!
00025  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
00026  * This file is generated by a mustache template. Please see the original
00027  * template in rest-api-templates/ari_model_validators.h.mustache
00028  */
00029 
00030 #include "asterisk.h"
00031 
00032 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 434598 $")
00033 
00034 #include "asterisk/logger.h"
00035 #include "asterisk/module.h"
00036 #include "ari_model_validators.h"
00037 
00038 int ast_ari_validate_asterisk_info(struct ast_json *json)
00039 {
00040    int res = 1;
00041    struct ast_json_iter *iter;
00042 
00043    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
00044       if (strcmp("build", ast_json_object_iter_key(iter)) == 0) {
00045          int prop_is_valid;
00046          prop_is_valid = ast_ari_validate_build_info(
00047             ast_json_object_iter_value(iter));
00048          if (!prop_is_valid) {
00049             ast_log(LOG_ERROR, "ARI AsteriskInfo field build failed validation\n");
00050             res = 0;
00051          }
00052       } else
00053       if (strcmp("config", ast_json_object_iter_key(iter)) == 0) {
00054          int prop_is_valid;
00055          prop_is_valid = ast_ari_validate_config_info(
00056             ast_json_object_iter_value(iter));
00057          if (!prop_is_valid) {
00058             ast_log(LOG_ERROR, "ARI AsteriskInfo field config failed validation\n");
00059             res = 0;
00060          }
00061       } else
00062       if (strcmp("status", ast_json_object_iter_key(iter)) == 0) {
00063          int prop_is_valid;
00064          prop_is_valid = ast_ari_validate_status_info(
00065             ast_json_object_iter_value(iter));
00066          if (!prop_is_valid) {
00067             ast_log(LOG_ERROR, "ARI AsteriskInfo field status failed validation\n");
00068             res = 0;
00069          }
00070       } else
00071       if (strcmp("system", ast_json_object_iter_key(iter)) == 0) {
00072          int prop_is_valid;
00073          prop_is_valid = ast_ari_validate_system_info(
00074             ast_json_object_iter_value(iter));
00075          if (!prop_is_valid) {
00076             ast_log(LOG_ERROR, "ARI AsteriskInfo field system failed validation\n");
00077             res = 0;
00078          }
00079       } else
00080       {
00081          ast_log(LOG_ERROR,
00082             "ARI AsteriskInfo has undocumented field %s\n",
00083             ast_json_object_iter_key(iter));
00084          res = 0;
00085       }
00086    }
00087 
00088    return res;
00089 }
00090 
00091 ari_validator ast_ari_validate_asterisk_info_fn(void)
00092 {
00093    return ast_ari_validate_asterisk_info;
00094 }
00095 
00096 int ast_ari_validate_build_info(struct ast_json *json)
00097 {
00098    int res = 1;
00099    struct ast_json_iter *iter;
00100    int has_date = 0;
00101    int has_kernel = 0;
00102    int has_machine = 0;
00103    int has_options = 0;
00104    int has_os = 0;
00105    int has_user = 0;
00106 
00107    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
00108       if (strcmp("date", ast_json_object_iter_key(iter)) == 0) {
00109          int prop_is_valid;
00110          has_date = 1;
00111          prop_is_valid = ast_ari_validate_string(
00112             ast_json_object_iter_value(iter));
00113          if (!prop_is_valid) {
00114             ast_log(LOG_ERROR, "ARI BuildInfo field date failed validation\n");
00115             res = 0;
00116          }
00117       } else
00118       if (strcmp("kernel", ast_json_object_iter_key(iter)) == 0) {
00119          int prop_is_valid;
00120          has_kernel = 1;
00121          prop_is_valid = ast_ari_validate_string(
00122             ast_json_object_iter_value(iter));
00123          if (!prop_is_valid) {
00124             ast_log(LOG_ERROR, "ARI BuildInfo field kernel failed validation\n");
00125             res = 0;
00126          }
00127       } else
00128       if (strcmp("machine", ast_json_object_iter_key(iter)) == 0) {
00129          int prop_is_valid;
00130          has_machine = 1;
00131          prop_is_valid = ast_ari_validate_string(
00132             ast_json_object_iter_value(iter));
00133          if (!prop_is_valid) {
00134             ast_log(LOG_ERROR, "ARI BuildInfo field machine failed validation\n");
00135             res = 0;
00136          }
00137       } else
00138       if (strcmp("options", ast_json_object_iter_key(iter)) == 0) {
00139          int prop_is_valid;
00140          has_options = 1;
00141          prop_is_valid = ast_ari_validate_string(
00142             ast_json_object_iter_value(iter));
00143          if (!prop_is_valid) {
00144             ast_log(LOG_ERROR, "ARI BuildInfo field options failed validation\n");
00145             res = 0;
00146          }
00147       } else
00148       if (strcmp("os", ast_json_object_iter_key(iter)) == 0) {
00149          int prop_is_valid;
00150          has_os = 1;
00151          prop_is_valid = ast_ari_validate_string(
00152             ast_json_object_iter_value(iter));
00153          if (!prop_is_valid) {
00154             ast_log(LOG_ERROR, "ARI BuildInfo field os failed validation\n");
00155             res = 0;
00156          }
00157       } else
00158       if (strcmp("user", ast_json_object_iter_key(iter)) == 0) {
00159          int prop_is_valid;
00160          has_user = 1;
00161          prop_is_valid = ast_ari_validate_string(
00162             ast_json_object_iter_value(iter));
00163          if (!prop_is_valid) {
00164             ast_log(LOG_ERROR, "ARI BuildInfo field user failed validation\n");
00165             res = 0;
00166          }
00167       } else
00168       {
00169          ast_log(LOG_ERROR,
00170             "ARI BuildInfo has undocumented field %s\n",
00171             ast_json_object_iter_key(iter));
00172          res = 0;
00173       }
00174    }
00175 
00176    if (!has_date) {
00177       ast_log(LOG_ERROR, "ARI BuildInfo missing required field date\n");
00178       res = 0;
00179    }
00180 
00181    if (!has_kernel) {
00182       ast_log(LOG_ERROR, "ARI BuildInfo missing required field kernel\n");
00183       res = 0;
00184    }
00185 
00186    if (!has_machine) {
00187       ast_log(LOG_ERROR, "ARI BuildInfo missing required field machine\n");
00188       res = 0;
00189    }
00190 
00191    if (!has_options) {
00192       ast_log(LOG_ERROR, "ARI BuildInfo missing required field options\n");
00193       res = 0;
00194    }
00195 
00196    if (!has_os) {
00197       ast_log(LOG_ERROR, "ARI BuildInfo missing required field os\n");
00198       res = 0;
00199    }
00200 
00201    if (!has_user) {
00202       ast_log(LOG_ERROR, "ARI BuildInfo missing required field user\n");
00203       res = 0;
00204    }
00205 
00206    return res;
00207 }
00208 
00209 ari_validator ast_ari_validate_build_info_fn(void)
00210 {
00211    return ast_ari_validate_build_info;
00212 }
00213 
00214 int ast_ari_validate_config_info(struct ast_json *json)
00215 {
00216    int res = 1;
00217    struct ast_json_iter *iter;
00218    int has_default_language = 0;
00219    int has_name = 0;
00220    int has_setid = 0;
00221 
00222    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
00223       if (strcmp("default_language", ast_json_object_iter_key(iter)) == 0) {
00224          int prop_is_valid;
00225          has_default_language = 1;
00226          prop_is_valid = ast_ari_validate_string(
00227             ast_json_object_iter_value(iter));
00228          if (!prop_is_valid) {
00229             ast_log(LOG_ERROR, "ARI ConfigInfo field default_language failed validation\n");
00230             res = 0;
00231          }
00232       } else
00233       if (strcmp("max_channels", ast_json_object_iter_key(iter)) == 0) {
00234          int prop_is_valid;
00235          prop_is_valid = ast_ari_validate_int(
00236             ast_json_object_iter_value(iter));
00237          if (!prop_is_valid) {
00238             ast_log(LOG_ERROR, "ARI ConfigInfo field max_channels failed validation\n");
00239             res = 0;
00240          }
00241       } else
00242       if (strcmp("max_load", ast_json_object_iter_key(iter)) == 0) {
00243          int prop_is_valid;
00244          prop_is_valid = ast_ari_validate_double(
00245             ast_json_object_iter_value(iter));
00246          if (!prop_is_valid) {
00247             ast_log(LOG_ERROR, "ARI ConfigInfo field max_load failed validation\n");
00248             res = 0;
00249          }
00250       } else
00251       if (strcmp("max_open_files", ast_json_object_iter_key(iter)) == 0) {
00252          int prop_is_valid;
00253          prop_is_valid = ast_ari_validate_int(
00254             ast_json_object_iter_value(iter));
00255          if (!prop_is_valid) {
00256             ast_log(LOG_ERROR, "ARI ConfigInfo field max_open_files failed validation\n");
00257             res = 0;
00258          }
00259       } else
00260       if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
00261          int prop_is_valid;
00262          has_name = 1;
00263          prop_is_valid = ast_ari_validate_string(
00264             ast_json_object_iter_value(iter));
00265          if (!prop_is_valid) {
00266             ast_log(LOG_ERROR, "ARI ConfigInfo field name failed validation\n");
00267             res = 0;
00268          }
00269       } else
00270       if (strcmp("setid", ast_json_object_iter_key(iter)) == 0) {
00271          int prop_is_valid;
00272          has_setid = 1;
00273          prop_is_valid = ast_ari_validate_set_id(
00274             ast_json_object_iter_value(iter));
00275          if (!prop_is_valid) {
00276             ast_log(LOG_ERROR, "ARI ConfigInfo field setid failed validation\n");
00277             res = 0;
00278          }
00279       } else
00280       {
00281          ast_log(LOG_ERROR,
00282             "ARI ConfigInfo has undocumented field %s\n",
00283             ast_json_object_iter_key(iter));
00284          res = 0;
00285       }
00286    }
00287 
00288    if (!has_default_language) {
00289       ast_log(LOG_ERROR, "ARI ConfigInfo missing required field default_language\n");
00290       res = 0;
00291    }
00292 
00293    if (!has_name) {
00294       ast_log(LOG_ERROR, "ARI ConfigInfo missing required field name\n");
00295       res = 0;
00296    }
00297 
00298    if (!has_setid) {
00299       ast_log(LOG_ERROR, "ARI ConfigInfo missing required field setid\n");
00300       res = 0;
00301    }
00302 
00303    return res;
00304 }
00305 
00306 ari_validator ast_ari_validate_config_info_fn(void)
00307 {
00308    return ast_ari_validate_config_info;
00309 }
00310 
00311 int ast_ari_validate_set_id(struct ast_json *json)
00312 {
00313    int res = 1;
00314    struct ast_json_iter *iter;
00315    int has_group = 0;
00316    int has_user = 0;
00317 
00318    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
00319       if (strcmp("group", ast_json_object_iter_key(iter)) == 0) {
00320          int prop_is_valid;
00321          has_group = 1;
00322          prop_is_valid = ast_ari_validate_string(
00323             ast_json_object_iter_value(iter));
00324          if (!prop_is_valid) {
00325             ast_log(LOG_ERROR, "ARI SetId field group failed validation\n");
00326             res = 0;
00327          }
00328       } else
00329       if (strcmp("user", ast_json_object_iter_key(iter)) == 0) {
00330          int prop_is_valid;
00331          has_user = 1;
00332          prop_is_valid = ast_ari_validate_string(
00333             ast_json_object_iter_value(iter));
00334          if (!prop_is_valid) {
00335             ast_log(LOG_ERROR, "ARI SetId field user failed validation\n");
00336             res = 0;
00337          }
00338       } else
00339       {
00340          ast_log(LOG_ERROR,
00341             "ARI SetId has undocumented field %s\n",
00342             ast_json_object_iter_key(iter));
00343          res = 0;
00344       }
00345    }
00346 
00347    if (!has_group) {
00348       ast_log(LOG_ERROR, "ARI SetId missing required field group\n");
00349       res = 0;
00350    }
00351 
00352    if (!has_user) {
00353       ast_log(LOG_ERROR, "ARI SetId missing required field user\n");
00354       res = 0;
00355    }
00356 
00357    return res;
00358 }
00359 
00360 ari_validator ast_ari_validate_set_id_fn(void)
00361 {
00362    return ast_ari_validate_set_id;
00363 }
00364 
00365 int ast_ari_validate_status_info(struct ast_json *json)
00366 {
00367    int res = 1;
00368    struct ast_json_iter *iter;
00369    int has_last_reload_time = 0;
00370    int has_startup_time = 0;
00371 
00372    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
00373       if (strcmp("last_reload_time", ast_json_object_iter_key(iter)) == 0) {
00374          int prop_is_valid;
00375          has_last_reload_time = 1;
00376          prop_is_valid = ast_ari_validate_date(
00377             ast_json_object_iter_value(iter));
00378          if (!prop_is_valid) {
00379             ast_log(LOG_ERROR, "ARI StatusInfo field last_reload_time failed validation\n");
00380             res = 0;
00381          }
00382       } else
00383       if (strcmp("startup_time", ast_json_object_iter_key(iter)) == 0) {
00384          int prop_is_valid;
00385          has_startup_time = 1;
00386          prop_is_valid = ast_ari_validate_date(
00387             ast_json_object_iter_value(iter));
00388          if (!prop_is_valid) {
00389             ast_log(LOG_ERROR, "ARI StatusInfo field startup_time failed validation\n");
00390             res = 0;
00391          }
00392       } else
00393       {
00394          ast_log(LOG_ERROR,
00395             "ARI StatusInfo has undocumented field %s\n",
00396             ast_json_object_iter_key(iter));
00397          res = 0;
00398       }
00399    }
00400 
00401    if (!has_last_reload_time) {
00402       ast_log(LOG_ERROR, "ARI StatusInfo missing required field last_reload_time\n");
00403       res = 0;
00404    }
00405 
00406    if (!has_startup_time) {
00407       ast_log(LOG_ERROR, "ARI StatusInfo missing required field startup_time\n");
00408       res = 0;
00409    }
00410 
00411    return res;
00412 }
00413 
00414 ari_validator ast_ari_validate_status_info_fn(void)
00415 {
00416    return ast_ari_validate_status_info;
00417 }
00418 
00419 int ast_ari_validate_system_info(struct ast_json *json)
00420 {
00421    int res = 1;
00422    struct ast_json_iter *iter;
00423    int has_entity_id = 0;
00424    int has_version = 0;
00425 
00426    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
00427       if (strcmp("entity_id", ast_json_object_iter_key(iter)) == 0) {
00428          int prop_is_valid;
00429          has_entity_id = 1;
00430          prop_is_valid = ast_ari_validate_string(
00431             ast_json_object_iter_value(iter));
00432          if (!prop_is_valid) {
00433             ast_log(LOG_ERROR, "ARI SystemInfo field entity_id failed validation\n");
00434             res = 0;
00435          }
00436       } else
00437       if (strcmp("version", ast_json_object_iter_key(iter)) == 0) {
00438          int prop_is_valid;
00439          has_version = 1;
00440          prop_is_valid = ast_ari_validate_string(
00441             ast_json_object_iter_value(iter));
00442          if (!prop_is_valid) {
00443             ast_log(LOG_ERROR, "ARI SystemInfo field version failed validation\n");
00444             res = 0;
00445          }
00446       } else
00447       {
00448          ast_log(LOG_ERROR,
00449             "ARI SystemInfo has undocumented field %s\n",
00450             ast_json_object_iter_key(iter));
00451          res = 0;
00452       }
00453    }
00454 
00455    if (!has_entity_id) {
00456       ast_log(LOG_ERROR, "ARI SystemInfo missing required field entity_id\n");
00457       res = 0;
00458    }
00459 
00460    if (!has_version) {
00461       ast_log(LOG_ERROR, "ARI SystemInfo missing required field version\n");
00462       res = 0;
00463    }
00464 
00465    return res;
00466 }
00467 
00468 ari_validator ast_ari_validate_system_info_fn(void)
00469 {
00470    return ast_ari_validate_system_info;
00471 }
00472 
00473 int ast_ari_validate_variable(struct ast_json *json)
00474 {
00475    int res = 1;
00476    struct ast_json_iter *iter;
00477    int has_value = 0;
00478 
00479    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
00480       if (strcmp("value", ast_json_object_iter_key(iter)) == 0) {
00481          int prop_is_valid;
00482          has_value = 1;
00483          prop_is_valid = ast_ari_validate_string(
00484             ast_json_object_iter_value(iter));
00485          if (!prop_is_valid) {
00486             ast_log(LOG_ERROR, "ARI Variable field value failed validation\n");
00487             res = 0;
00488          }
00489       } else
00490       {
00491          ast_log(LOG_ERROR,
00492             "ARI Variable has undocumented field %s\n",
00493             ast_json_object_iter_key(iter));
00494          res = 0;
00495       }
00496    }
00497 
00498    if (!has_value) {
00499       ast_log(LOG_ERROR, "ARI Variable missing required field value\n");
00500       res = 0;
00501    }
00502 
00503    return res;
00504 }
00505 
00506 ari_validator ast_ari_validate_variable_fn(void)
00507 {
00508    return ast_ari_validate_variable;
00509 }
00510 
00511 int ast_ari_validate_endpoint(struct ast_json *json)
00512 {
00513    int res = 1;
00514    struct ast_json_iter *iter;
00515    int has_channel_ids = 0;
00516    int has_resource = 0;
00517    int has_technology = 0;
00518 
00519    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
00520       if (strcmp("channel_ids", ast_json_object_iter_key(iter)) == 0) {
00521          int prop_is_valid;
00522          has_channel_ids = 1;
00523          prop_is_valid = ast_ari_validate_list(
00524             ast_json_object_iter_value(iter),
00525             ast_ari_validate_string);
00526          if (!prop_is_valid) {
00527             ast_log(LOG_ERROR, "ARI Endpoint field channel_ids failed validation\n");
00528             res = 0;
00529          }
00530       } else
00531       if (strcmp("resource", ast_json_object_iter_key(iter)) == 0) {
00532          int prop_is_valid;
00533          has_resource = 1;
00534          prop_is_valid = ast_ari_validate_string(
00535             ast_json_object_iter_value(iter));
00536          if (!prop_is_valid) {
00537             ast_log(LOG_ERROR, "ARI Endpoint field resource failed validation\n");
00538             res = 0;
00539          }
00540       } else
00541       if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
00542          int prop_is_valid;
00543          prop_is_valid = ast_ari_validate_string(
00544             ast_json_object_iter_value(iter));
00545          if (!prop_is_valid) {
00546             ast_log(LOG_ERROR, "ARI Endpoint field state failed validation\n");
00547             res = 0;
00548          }
00549       } else
00550       if (strcmp("technology", ast_json_object_iter_key(iter)) == 0) {
00551          int prop_is_valid;
00552          has_technology = 1;
00553          prop_is_valid = ast_ari_validate_string(
00554             ast_json_object_iter_value(iter));
00555          if (!prop_is_valid) {
00556             ast_log(LOG_ERROR, "ARI Endpoint field technology failed validation\n");
00557             res = 0;
00558          }
00559       } else
00560       {
00561          ast_log(LOG_ERROR,
00562             "ARI Endpoint has undocumented field %s\n",
00563             ast_json_object_iter_key(iter));
00564          res = 0;
00565       }
00566    }
00567 
00568    if (!has_channel_ids) {
00569       ast_log(LOG_ERROR, "ARI Endpoint missing required field channel_ids\n");
00570       res = 0;
00571    }
00572 
00573    if (!has_resource) {
00574       ast_log(LOG_ERROR, "ARI Endpoint missing required field resource\n");
00575       res = 0;
00576    }
00577 
00578    if (!has_technology) {
00579       ast_log(LOG_ERROR, "ARI Endpoint missing required field technology\n");
00580       res = 0;
00581    }
00582 
00583    return res;
00584 }
00585 
00586 ari_validator ast_ari_validate_endpoint_fn(void)
00587 {
00588    return ast_ari_validate_endpoint;
00589 }
00590 
00591 int ast_ari_validate_text_message(struct ast_json *json)
00592 {
00593    int res = 1;
00594    struct ast_json_iter *iter;
00595    int has_body = 0;
00596    int has_from = 0;
00597    int has_to = 0;
00598 
00599    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
00600       if (strcmp("body", ast_json_object_iter_key(iter)) == 0) {
00601          int prop_is_valid;
00602          has_body = 1;
00603          prop_is_valid = ast_ari_validate_string(
00604             ast_json_object_iter_value(iter));
00605          if (!prop_is_valid) {
00606             ast_log(LOG_ERROR, "ARI TextMessage field body failed validation\n");
00607             res = 0;
00608          }
00609       } else
00610       if (strcmp("from", ast_json_object_iter_key(iter)) == 0) {
00611          int prop_is_valid;
00612          has_from = 1;
00613          prop_is_valid = ast_ari_validate_string(
00614             ast_json_object_iter_value(iter));
00615          if (!prop_is_valid) {
00616             ast_log(LOG_ERROR, "ARI TextMessage field from failed validation\n");
00617             res = 0;
00618          }
00619       } else
00620       if (strcmp("to", ast_json_object_iter_key(iter)) == 0) {
00621          int prop_is_valid;
00622          has_to = 1;
00623          prop_is_valid = ast_ari_validate_string(
00624             ast_json_object_iter_value(iter));
00625          if (!prop_is_valid) {
00626             ast_log(LOG_ERROR, "ARI TextMessage field to failed validation\n");
00627             res = 0;
00628          }
00629       } else
00630       if (strcmp("variables", ast_json_object_iter_key(iter)) == 0) {
00631          int prop_is_valid;
00632          prop_is_valid = ast_ari_validate_list(
00633             ast_json_object_iter_value(iter),
00634             ast_ari_validate_text_message_variable);
00635          if (!prop_is_valid) {
00636             ast_log(LOG_ERROR, "ARI TextMessage field variables failed validation\n");
00637             res = 0;
00638          }
00639       } else
00640       {
00641          ast_log(LOG_ERROR,
00642             "ARI TextMessage has undocumented field %s\n",
00643             ast_json_object_iter_key(iter));
00644          res = 0;
00645       }
00646    }
00647 
00648    if (!has_body) {
00649       ast_log(LOG_ERROR, "ARI TextMessage missing required field body\n");
00650       res = 0;
00651    }
00652 
00653    if (!has_from) {
00654       ast_log(LOG_ERROR, "ARI TextMessage missing required field from\n");
00655       res = 0;
00656    }
00657 
00658    if (!has_to) {
00659       ast_log(LOG_ERROR, "ARI TextMessage missing required field to\n");
00660       res = 0;
00661    }
00662 
00663    return res;
00664 }
00665 
00666 ari_validator ast_ari_validate_text_message_fn(void)
00667 {
00668    return ast_ari_validate_text_message;
00669 }
00670 
00671 int ast_ari_validate_text_message_variable(struct ast_json *json)
00672 {
00673    int res = 1;
00674    struct ast_json_iter *iter;
00675    int has_key = 0;
00676    int has_value = 0;
00677 
00678    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
00679       if (strcmp("key", ast_json_object_iter_key(iter)) == 0) {
00680          int prop_is_valid;
00681          has_key = 1;
00682          prop_is_valid = ast_ari_validate_string(
00683             ast_json_object_iter_value(iter));
00684          if (!prop_is_valid) {
00685             ast_log(LOG_ERROR, "ARI TextMessageVariable field key failed validation\n");
00686             res = 0;
00687          }
00688       } else
00689       if (strcmp("value", ast_json_object_iter_key(iter)) == 0) {
00690          int prop_is_valid;
00691          has_value = 1;
00692          prop_is_valid = ast_ari_validate_string(
00693             ast_json_object_iter_value(iter));
00694          if (!prop_is_valid) {
00695             ast_log(LOG_ERROR, "ARI TextMessageVariable field value failed validation\n");
00696             res = 0;
00697          }
00698       } else
00699       {
00700          ast_log(LOG_ERROR,
00701             "ARI TextMessageVariable has undocumented field %s\n",
00702             ast_json_object_iter_key(iter));
00703          res = 0;
00704       }
00705    }
00706 
00707    if (!has_key) {
00708       ast_log(LOG_ERROR, "ARI TextMessageVariable missing required field key\n");
00709       res = 0;
00710    }
00711 
00712    if (!has_value) {
00713       ast_log(LOG_ERROR, "ARI TextMessageVariable missing required field value\n");
00714       res = 0;
00715    }
00716 
00717    return res;
00718 }
00719 
00720 ari_validator ast_ari_validate_text_message_variable_fn(void)
00721 {
00722    return ast_ari_validate_text_message_variable;
00723 }
00724 
00725 int ast_ari_validate_caller_id(struct ast_json *json)
00726 {
00727    int res = 1;
00728    struct ast_json_iter *iter;
00729    int has_name = 0;
00730    int has_number = 0;
00731 
00732    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
00733       if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
00734          int prop_is_valid;
00735          has_name = 1;
00736          prop_is_valid = ast_ari_validate_string(
00737             ast_json_object_iter_value(iter));
00738          if (!prop_is_valid) {
00739             ast_log(LOG_ERROR, "ARI CallerID field name failed validation\n");
00740             res = 0;
00741          }
00742       } else
00743       if (strcmp("number", ast_json_object_iter_key(iter)) == 0) {
00744          int prop_is_valid;
00745          has_number = 1;
00746          prop_is_valid = ast_ari_validate_string(
00747             ast_json_object_iter_value(iter));
00748          if (!prop_is_valid) {
00749             ast_log(LOG_ERROR, "ARI CallerID field number failed validation\n");
00750             res = 0;
00751          }
00752       } else
00753       {
00754          ast_log(LOG_ERROR,
00755             "ARI CallerID has undocumented field %s\n",
00756             ast_json_object_iter_key(iter));
00757          res = 0;
00758       }
00759    }
00760 
00761    if (!has_name) {
00762       ast_log(LOG_ERROR, "ARI CallerID missing required field name\n");
00763       res = 0;
00764    }
00765 
00766    if (!has_number) {
00767       ast_log(LOG_ERROR, "ARI CallerID missing required field number\n");
00768       res = 0;
00769    }
00770 
00771    return res;
00772 }
00773 
00774 ari_validator ast_ari_validate_caller_id_fn(void)
00775 {
00776    return ast_ari_validate_caller_id;
00777 }
00778 
00779 int ast_ari_validate_channel(struct ast_json *json)
00780 {
00781    int res = 1;
00782    struct ast_json_iter *iter;
00783    int has_accountcode = 0;
00784    int has_caller = 0;
00785    int has_connected = 0;
00786    int has_creationtime = 0;
00787    int has_dialplan = 0;
00788    int has_id = 0;
00789    int has_language = 0;
00790    int has_name = 0;
00791    int has_state = 0;
00792 
00793    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
00794       if (strcmp("accountcode", ast_json_object_iter_key(iter)) == 0) {
00795          int prop_is_valid;
00796          has_accountcode = 1;
00797          prop_is_valid = ast_ari_validate_string(
00798             ast_json_object_iter_value(iter));
00799          if (!prop_is_valid) {
00800             ast_log(LOG_ERROR, "ARI Channel field accountcode failed validation\n");
00801             res = 0;
00802          }
00803       } else
00804       if (strcmp("caller", ast_json_object_iter_key(iter)) == 0) {
00805          int prop_is_valid;
00806          has_caller = 1;
00807          prop_is_valid = ast_ari_validate_caller_id(
00808             ast_json_object_iter_value(iter));
00809          if (!prop_is_valid) {
00810             ast_log(LOG_ERROR, "ARI Channel field caller failed validation\n");
00811             res = 0;
00812          }
00813       } else
00814       if (strcmp("connected", ast_json_object_iter_key(iter)) == 0) {
00815          int prop_is_valid;
00816          has_connected = 1;
00817          prop_is_valid = ast_ari_validate_caller_id(
00818             ast_json_object_iter_value(iter));
00819          if (!prop_is_valid) {
00820             ast_log(LOG_ERROR, "ARI Channel field connected failed validation\n");
00821             res = 0;
00822          }
00823       } else
00824       if (strcmp("creationtime", ast_json_object_iter_key(iter)) == 0) {
00825          int prop_is_valid;
00826          has_creationtime = 1;
00827          prop_is_valid = ast_ari_validate_date(
00828             ast_json_object_iter_value(iter));
00829          if (!prop_is_valid) {
00830             ast_log(LOG_ERROR, "ARI Channel field creationtime failed validation\n");
00831             res = 0;
00832          }
00833       } else
00834       if (strcmp("dialplan", ast_json_object_iter_key(iter)) == 0) {
00835          int prop_is_valid;
00836          has_dialplan = 1;
00837          prop_is_valid = ast_ari_validate_dialplan_cep(
00838             ast_json_object_iter_value(iter));
00839          if (!prop_is_valid) {
00840             ast_log(LOG_ERROR, "ARI Channel field dialplan failed validation\n");
00841             res = 0;
00842          }
00843       } else
00844       if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
00845          int prop_is_valid;
00846          has_id = 1;
00847          prop_is_valid = ast_ari_validate_string(
00848             ast_json_object_iter_value(iter));
00849          if (!prop_is_valid) {
00850             ast_log(LOG_ERROR, "ARI Channel field id failed validation\n");
00851             res = 0;
00852          }
00853       } else
00854       if (strcmp("language", ast_json_object_iter_key(iter)) == 0) {
00855          int prop_is_valid;
00856          has_language = 1;
00857          prop_is_valid = ast_ari_validate_string(
00858             ast_json_object_iter_value(iter));
00859          if (!prop_is_valid) {
00860             ast_log(LOG_ERROR, "ARI Channel field language failed validation\n");
00861             res = 0;
00862          }
00863       } else
00864       if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
00865          int prop_is_valid;
00866          has_name = 1;
00867          prop_is_valid = ast_ari_validate_string(
00868             ast_json_object_iter_value(iter));
00869          if (!prop_is_valid) {
00870             ast_log(LOG_ERROR, "ARI Channel field name failed validation\n");
00871             res = 0;
00872          }
00873       } else
00874       if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
00875          int prop_is_valid;
00876          has_state = 1;
00877          prop_is_valid = ast_ari_validate_string(
00878             ast_json_object_iter_value(iter));
00879          if (!prop_is_valid) {
00880             ast_log(LOG_ERROR, "ARI Channel field state failed validation\n");
00881             res = 0;
00882          }
00883       } else
00884       {
00885          ast_log(LOG_ERROR,
00886             "ARI Channel has undocumented field %s\n",
00887             ast_json_object_iter_key(iter));
00888          res = 0;
00889       }
00890    }
00891 
00892    if (!has_accountcode) {
00893       ast_log(LOG_ERROR, "ARI Channel missing required field accountcode\n");
00894       res = 0;
00895    }
00896 
00897    if (!has_caller) {
00898       ast_log(LOG_ERROR, "ARI Channel missing required field caller\n");
00899       res = 0;
00900    }
00901 
00902    if (!has_connected) {
00903       ast_log(LOG_ERROR, "ARI Channel missing required field connected\n");
00904       res = 0;
00905    }
00906 
00907    if (!has_creationtime) {
00908       ast_log(LOG_ERROR, "ARI Channel missing required field creationtime\n");
00909       res = 0;
00910    }
00911 
00912    if (!has_dialplan) {
00913       ast_log(LOG_ERROR, "ARI Channel missing required field dialplan\n");
00914       res = 0;
00915    }
00916 
00917    if (!has_id) {
00918       ast_log(LOG_ERROR, "ARI Channel missing required field id\n");
00919       res = 0;
00920    }
00921 
00922    if (!has_language) {
00923       ast_log(LOG_ERROR, "ARI Channel missing required field language\n");
00924       res = 0;
00925    }
00926 
00927    if (!has_name) {
00928       ast_log(LOG_ERROR, "ARI Channel missing required field name\n");
00929       res = 0;
00930    }
00931 
00932    if (!has_state) {
00933       ast_log(LOG_ERROR, "ARI Channel missing required field state\n");
00934       res = 0;
00935    }
00936 
00937    return res;
00938 }
00939 
00940 ari_validator ast_ari_validate_channel_fn(void)
00941 {
00942    return ast_ari_validate_channel;
00943 }
00944 
00945 int ast_ari_validate_dialed(struct ast_json *json)
00946 {
00947    int res = 1;
00948    struct ast_json_iter *iter;
00949 
00950    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
00951       {
00952          ast_log(LOG_ERROR,
00953             "ARI Dialed has undocumented field %s\n",
00954             ast_json_object_iter_key(iter));
00955          res = 0;
00956       }
00957    }
00958 
00959    return res;
00960 }
00961 
00962 ari_validator ast_ari_validate_dialed_fn(void)
00963 {
00964    return ast_ari_validate_dialed;
00965 }
00966 
00967 int ast_ari_validate_dialplan_cep(struct ast_json *json)
00968 {
00969    int res = 1;
00970    struct ast_json_iter *iter;
00971    int has_context = 0;
00972    int has_exten = 0;
00973    int has_priority = 0;
00974 
00975    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
00976       if (strcmp("context", ast_json_object_iter_key(iter)) == 0) {
00977          int prop_is_valid;
00978          has_context = 1;
00979          prop_is_valid = ast_ari_validate_string(
00980             ast_json_object_iter_value(iter));
00981          if (!prop_is_valid) {
00982             ast_log(LOG_ERROR, "ARI DialplanCEP field context failed validation\n");
00983             res = 0;
00984          }
00985       } else
00986       if (strcmp("exten", ast_json_object_iter_key(iter)) == 0) {
00987          int prop_is_valid;
00988          has_exten = 1;
00989          prop_is_valid = ast_ari_validate_string(
00990             ast_json_object_iter_value(iter));
00991          if (!prop_is_valid) {
00992             ast_log(LOG_ERROR, "ARI DialplanCEP field exten failed validation\n");
00993             res = 0;
00994          }
00995       } else
00996       if (strcmp("priority", ast_json_object_iter_key(iter)) == 0) {
00997          int prop_is_valid;
00998          has_priority = 1;
00999          prop_is_valid = ast_ari_validate_long(
01000             ast_json_object_iter_value(iter));
01001          if (!prop_is_valid) {
01002             ast_log(LOG_ERROR, "ARI DialplanCEP field priority failed validation\n");
01003             res = 0;
01004          }
01005       } else
01006       {
01007          ast_log(LOG_ERROR,
01008             "ARI DialplanCEP has undocumented field %s\n",
01009             ast_json_object_iter_key(iter));
01010          res = 0;
01011       }
01012    }
01013 
01014    if (!has_context) {
01015       ast_log(LOG_ERROR, "ARI DialplanCEP missing required field context\n");
01016       res = 0;
01017    }
01018 
01019    if (!has_exten) {
01020       ast_log(LOG_ERROR, "ARI DialplanCEP missing required field exten\n");
01021       res = 0;
01022    }
01023 
01024    if (!has_priority) {
01025       ast_log(LOG_ERROR, "ARI DialplanCEP missing required field priority\n");
01026       res = 0;
01027    }
01028 
01029    return res;
01030 }
01031 
01032 ari_validator ast_ari_validate_dialplan_cep_fn(void)
01033 {
01034    return ast_ari_validate_dialplan_cep;
01035 }
01036 
01037 int ast_ari_validate_bridge(struct ast_json *json)
01038 {
01039    int res = 1;
01040    struct ast_json_iter *iter;
01041    int has_bridge_class = 0;
01042    int has_bridge_type = 0;
01043    int has_channels = 0;
01044    int has_creator = 0;
01045    int has_id = 0;
01046    int has_name = 0;
01047    int has_technology = 0;
01048 
01049    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
01050       if (strcmp("bridge_class", ast_json_object_iter_key(iter)) == 0) {
01051          int prop_is_valid;
01052          has_bridge_class = 1;
01053          prop_is_valid = ast_ari_validate_string(
01054             ast_json_object_iter_value(iter));
01055          if (!prop_is_valid) {
01056             ast_log(LOG_ERROR, "ARI Bridge field bridge_class failed validation\n");
01057             res = 0;
01058          }
01059       } else
01060       if (strcmp("bridge_type", ast_json_object_iter_key(iter)) == 0) {
01061          int prop_is_valid;
01062          has_bridge_type = 1;
01063          prop_is_valid = ast_ari_validate_string(
01064             ast_json_object_iter_value(iter));
01065          if (!prop_is_valid) {
01066             ast_log(LOG_ERROR, "ARI Bridge field bridge_type failed validation\n");
01067             res = 0;
01068          }
01069       } else
01070       if (strcmp("channels", ast_json_object_iter_key(iter)) == 0) {
01071          int prop_is_valid;
01072          has_channels = 1;
01073          prop_is_valid = ast_ari_validate_list(
01074             ast_json_object_iter_value(iter),
01075             ast_ari_validate_string);
01076          if (!prop_is_valid) {
01077             ast_log(LOG_ERROR, "ARI Bridge field channels failed validation\n");
01078             res = 0;
01079          }
01080       } else
01081       if (strcmp("creator", ast_json_object_iter_key(iter)) == 0) {
01082          int prop_is_valid;
01083          has_creator = 1;
01084          prop_is_valid = ast_ari_validate_string(
01085             ast_json_object_iter_value(iter));
01086          if (!prop_is_valid) {
01087             ast_log(LOG_ERROR, "ARI Bridge field creator failed validation\n");
01088             res = 0;
01089          }
01090       } else
01091       if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
01092          int prop_is_valid;
01093          has_id = 1;
01094          prop_is_valid = ast_ari_validate_string(
01095             ast_json_object_iter_value(iter));
01096          if (!prop_is_valid) {
01097             ast_log(LOG_ERROR, "ARI Bridge field id failed validation\n");
01098             res = 0;
01099          }
01100       } else
01101       if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
01102          int prop_is_valid;
01103          has_name = 1;
01104          prop_is_valid = ast_ari_validate_string(
01105             ast_json_object_iter_value(iter));
01106          if (!prop_is_valid) {
01107             ast_log(LOG_ERROR, "ARI Bridge field name failed validation\n");
01108             res = 0;
01109          }
01110       } else
01111       if (strcmp("technology", ast_json_object_iter_key(iter)) == 0) {
01112          int prop_is_valid;
01113          has_technology = 1;
01114          prop_is_valid = ast_ari_validate_string(
01115             ast_json_object_iter_value(iter));
01116          if (!prop_is_valid) {
01117             ast_log(LOG_ERROR, "ARI Bridge field technology failed validation\n");
01118             res = 0;
01119          }
01120       } else
01121       {
01122          ast_log(LOG_ERROR,
01123             "ARI Bridge has undocumented field %s\n",
01124             ast_json_object_iter_key(iter));
01125          res = 0;
01126       }
01127    }
01128 
01129    if (!has_bridge_class) {
01130       ast_log(LOG_ERROR, "ARI Bridge missing required field bridge_class\n");
01131       res = 0;
01132    }
01133 
01134    if (!has_bridge_type) {
01135       ast_log(LOG_ERROR, "ARI Bridge missing required field bridge_type\n");
01136       res = 0;
01137    }
01138 
01139    if (!has_channels) {
01140       ast_log(LOG_ERROR, "ARI Bridge missing required field channels\n");
01141       res = 0;
01142    }
01143 
01144    if (!has_creator) {
01145       ast_log(LOG_ERROR, "ARI Bridge missing required field creator\n");
01146       res = 0;
01147    }
01148 
01149    if (!has_id) {
01150       ast_log(LOG_ERROR, "ARI Bridge missing required field id\n");
01151       res = 0;
01152    }
01153 
01154    if (!has_name) {
01155       ast_log(LOG_ERROR, "ARI Bridge missing required field name\n");
01156       res = 0;
01157    }
01158 
01159    if (!has_technology) {
01160       ast_log(LOG_ERROR, "ARI Bridge missing required field technology\n");
01161       res = 0;
01162    }
01163 
01164    return res;
01165 }
01166 
01167 ari_validator ast_ari_validate_bridge_fn(void)
01168 {
01169    return ast_ari_validate_bridge;
01170 }
01171 
01172 int ast_ari_validate_live_recording(struct ast_json *json)
01173 {
01174    int res = 1;
01175    struct ast_json_iter *iter;
01176    int has_format = 0;
01177    int has_name = 0;
01178    int has_state = 0;
01179    int has_target_uri = 0;
01180 
01181    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
01182       if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
01183          int prop_is_valid;
01184          prop_is_valid = ast_ari_validate_string(
01185             ast_json_object_iter_value(iter));
01186          if (!prop_is_valid) {
01187             ast_log(LOG_ERROR, "ARI LiveRecording field cause failed validation\n");
01188             res = 0;
01189          }
01190       } else
01191       if (strcmp("duration", ast_json_object_iter_key(iter)) == 0) {
01192          int prop_is_valid;
01193          prop_is_valid = ast_ari_validate_int(
01194             ast_json_object_iter_value(iter));
01195          if (!prop_is_valid) {
01196             ast_log(LOG_ERROR, "ARI LiveRecording field duration failed validation\n");
01197             res = 0;
01198          }
01199       } else
01200       if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
01201          int prop_is_valid;
01202          has_format = 1;
01203          prop_is_valid = ast_ari_validate_string(
01204             ast_json_object_iter_value(iter));
01205          if (!prop_is_valid) {
01206             ast_log(LOG_ERROR, "ARI LiveRecording field format failed validation\n");
01207             res = 0;
01208          }
01209       } else
01210       if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
01211          int prop_is_valid;
01212          has_name = 1;
01213          prop_is_valid = ast_ari_validate_string(
01214             ast_json_object_iter_value(iter));
01215          if (!prop_is_valid) {
01216             ast_log(LOG_ERROR, "ARI LiveRecording field name failed validation\n");
01217             res = 0;
01218          }
01219       } else
01220       if (strcmp("silence_duration", ast_json_object_iter_key(iter)) == 0) {
01221          int prop_is_valid;
01222          prop_is_valid = ast_ari_validate_int(
01223             ast_json_object_iter_value(iter));
01224          if (!prop_is_valid) {
01225             ast_log(LOG_ERROR, "ARI LiveRecording field silence_duration failed validation\n");
01226             res = 0;
01227          }
01228       } else
01229       if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
01230          int prop_is_valid;
01231          has_state = 1;
01232          prop_is_valid = ast_ari_validate_string(
01233             ast_json_object_iter_value(iter));
01234          if (!prop_is_valid) {
01235             ast_log(LOG_ERROR, "ARI LiveRecording field state failed validation\n");
01236             res = 0;
01237          }
01238       } else
01239       if (strcmp("talking_duration", ast_json_object_iter_key(iter)) == 0) {
01240          int prop_is_valid;
01241          prop_is_valid = ast_ari_validate_int(
01242             ast_json_object_iter_value(iter));
01243          if (!prop_is_valid) {
01244             ast_log(LOG_ERROR, "ARI LiveRecording field talking_duration failed validation\n");
01245             res = 0;
01246          }
01247       } else
01248       if (strcmp("target_uri", ast_json_object_iter_key(iter)) == 0) {
01249          int prop_is_valid;
01250          has_target_uri = 1;
01251          prop_is_valid = ast_ari_validate_string(
01252             ast_json_object_iter_value(iter));
01253          if (!prop_is_valid) {
01254             ast_log(LOG_ERROR, "ARI LiveRecording field target_uri failed validation\n");
01255             res = 0;
01256          }
01257       } else
01258       {
01259          ast_log(LOG_ERROR,
01260             "ARI LiveRecording has undocumented field %s\n",
01261             ast_json_object_iter_key(iter));
01262          res = 0;
01263       }
01264    }
01265 
01266    if (!has_format) {
01267       ast_log(LOG_ERROR, "ARI LiveRecording missing required field format\n");
01268       res = 0;
01269    }
01270 
01271    if (!has_name) {
01272       ast_log(LOG_ERROR, "ARI LiveRecording missing required field name\n");
01273       res = 0;
01274    }
01275 
01276    if (!has_state) {
01277       ast_log(LOG_ERROR, "ARI LiveRecording missing required field state\n");
01278       res = 0;
01279    }
01280 
01281    if (!has_target_uri) {
01282       ast_log(LOG_ERROR, "ARI LiveRecording missing required field target_uri\n");
01283       res = 0;
01284    }
01285 
01286    return res;
01287 }
01288 
01289 ari_validator ast_ari_validate_live_recording_fn(void)
01290 {
01291    return ast_ari_validate_live_recording;
01292 }
01293 
01294 int ast_ari_validate_stored_recording(struct ast_json *json)
01295 {
01296    int res = 1;
01297    struct ast_json_iter *iter;
01298    int has_format = 0;
01299    int has_name = 0;
01300 
01301    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
01302       if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
01303          int prop_is_valid;
01304          has_format = 1;
01305          prop_is_valid = ast_ari_validate_string(
01306             ast_json_object_iter_value(iter));
01307          if (!prop_is_valid) {
01308             ast_log(LOG_ERROR, "ARI StoredRecording field format failed validation\n");
01309             res = 0;
01310          }
01311       } else
01312       if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
01313          int prop_is_valid;
01314          has_name = 1;
01315          prop_is_valid = ast_ari_validate_string(
01316             ast_json_object_iter_value(iter));
01317          if (!prop_is_valid) {
01318             ast_log(LOG_ERROR, "ARI StoredRecording field name failed validation\n");
01319             res = 0;
01320          }
01321       } else
01322       {
01323          ast_log(LOG_ERROR,
01324             "ARI StoredRecording has undocumented field %s\n",
01325             ast_json_object_iter_key(iter));
01326          res = 0;
01327       }
01328    }
01329 
01330    if (!has_format) {
01331       ast_log(LOG_ERROR, "ARI StoredRecording missing required field format\n");
01332       res = 0;
01333    }
01334 
01335    if (!has_name) {
01336       ast_log(LOG_ERROR, "ARI StoredRecording missing required field name\n");
01337       res = 0;
01338    }
01339 
01340    return res;
01341 }
01342 
01343 ari_validator ast_ari_validate_stored_recording_fn(void)
01344 {
01345    return ast_ari_validate_stored_recording;
01346 }
01347 
01348 int ast_ari_validate_format_lang_pair(struct ast_json *json)
01349 {
01350    int res = 1;
01351    struct ast_json_iter *iter;
01352    int has_format = 0;
01353    int has_language = 0;
01354 
01355    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
01356       if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
01357          int prop_is_valid;
01358          has_format = 1;
01359          prop_is_valid = ast_ari_validate_string(
01360             ast_json_object_iter_value(iter));
01361          if (!prop_is_valid) {
01362             ast_log(LOG_ERROR, "ARI FormatLangPair field format failed validation\n");
01363             res = 0;
01364          }
01365       } else
01366       if (strcmp("language", ast_json_object_iter_key(iter)) == 0) {
01367          int prop_is_valid;
01368          has_language = 1;
01369          prop_is_valid = ast_ari_validate_string(
01370             ast_json_object_iter_value(iter));
01371          if (!prop_is_valid) {
01372             ast_log(LOG_ERROR, "ARI FormatLangPair field language failed validation\n");
01373             res = 0;
01374          }
01375       } else
01376       {
01377          ast_log(LOG_ERROR,
01378             "ARI FormatLangPair has undocumented field %s\n",
01379             ast_json_object_iter_key(iter));
01380          res = 0;
01381       }
01382    }
01383 
01384    if (!has_format) {
01385       ast_log(LOG_ERROR, "ARI FormatLangPair missing required field format\n");
01386       res = 0;
01387    }
01388 
01389    if (!has_language) {
01390       ast_log(LOG_ERROR, "ARI FormatLangPair missing required field language\n");
01391       res = 0;
01392    }
01393 
01394    return res;
01395 }
01396 
01397 ari_validator ast_ari_validate_format_lang_pair_fn(void)
01398 {
01399    return ast_ari_validate_format_lang_pair;
01400 }
01401 
01402 int ast_ari_validate_sound(struct ast_json *json)
01403 {
01404    int res = 1;
01405    struct ast_json_iter *iter;
01406    int has_formats = 0;
01407    int has_id = 0;
01408 
01409    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
01410       if (strcmp("formats", ast_json_object_iter_key(iter)) == 0) {
01411          int prop_is_valid;
01412          has_formats = 1;
01413          prop_is_valid = ast_ari_validate_list(
01414             ast_json_object_iter_value(iter),
01415             ast_ari_validate_format_lang_pair);
01416          if (!prop_is_valid) {
01417             ast_log(LOG_ERROR, "ARI Sound field formats failed validation\n");
01418             res = 0;
01419          }
01420       } else
01421       if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
01422          int prop_is_valid;
01423          has_id = 1;
01424          prop_is_valid = ast_ari_validate_string(
01425             ast_json_object_iter_value(iter));
01426          if (!prop_is_valid) {
01427             ast_log(LOG_ERROR, "ARI Sound field id failed validation\n");
01428             res = 0;
01429          }
01430       } else
01431       if (strcmp("text", ast_json_object_iter_key(iter)) == 0) {
01432          int prop_is_valid;
01433          prop_is_valid = ast_ari_validate_string(
01434             ast_json_object_iter_value(iter));
01435          if (!prop_is_valid) {
01436             ast_log(LOG_ERROR, "ARI Sound field text failed validation\n");
01437             res = 0;
01438          }
01439       } else
01440       {
01441          ast_log(LOG_ERROR,
01442             "ARI Sound has undocumented field %s\n",
01443             ast_json_object_iter_key(iter));
01444          res = 0;
01445       }
01446    }
01447 
01448    if (!has_formats) {
01449       ast_log(LOG_ERROR, "ARI Sound missing required field formats\n");
01450       res = 0;
01451    }
01452 
01453    if (!has_id) {
01454       ast_log(LOG_ERROR, "ARI Sound missing required field id\n");
01455       res = 0;
01456    }
01457 
01458    return res;
01459 }
01460 
01461 ari_validator ast_ari_validate_sound_fn(void)
01462 {
01463    return ast_ari_validate_sound;
01464 }
01465 
01466 int ast_ari_validate_playback(struct ast_json *json)
01467 {
01468    int res = 1;
01469    struct ast_json_iter *iter;
01470    int has_id = 0;
01471    int has_media_uri = 0;
01472    int has_state = 0;
01473    int has_target_uri = 0;
01474 
01475    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
01476       if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
01477          int prop_is_valid;
01478          has_id = 1;
01479          prop_is_valid = ast_ari_validate_string(
01480             ast_json_object_iter_value(iter));
01481          if (!prop_is_valid) {
01482             ast_log(LOG_ERROR, "ARI Playback field id failed validation\n");
01483             res = 0;
01484          }
01485       } else
01486       if (strcmp("language", ast_json_object_iter_key(iter)) == 0) {
01487          int prop_is_valid;
01488          prop_is_valid = ast_ari_validate_string(
01489             ast_json_object_iter_value(iter));
01490          if (!prop_is_valid) {
01491             ast_log(LOG_ERROR, "ARI Playback field language failed validation\n");
01492             res = 0;
01493          }
01494       } else
01495       if (strcmp("media_uri", ast_json_object_iter_key(iter)) == 0) {
01496          int prop_is_valid;
01497          has_media_uri = 1;
01498          prop_is_valid = ast_ari_validate_string(
01499             ast_json_object_iter_value(iter));
01500          if (!prop_is_valid) {
01501             ast_log(LOG_ERROR, "ARI Playback field media_uri failed validation\n");
01502             res = 0;
01503          }
01504       } else
01505       if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
01506          int prop_is_valid;
01507          has_state = 1;
01508          prop_is_valid = ast_ari_validate_string(
01509             ast_json_object_iter_value(iter));
01510          if (!prop_is_valid) {
01511             ast_log(LOG_ERROR, "ARI Playback field state failed validation\n");
01512             res = 0;
01513          }
01514       } else
01515       if (strcmp("target_uri", ast_json_object_iter_key(iter)) == 0) {
01516          int prop_is_valid;
01517          has_target_uri = 1;
01518          prop_is_valid = ast_ari_validate_string(
01519             ast_json_object_iter_value(iter));
01520          if (!prop_is_valid) {
01521             ast_log(LOG_ERROR, "ARI Playback field target_uri failed validation\n");
01522             res = 0;
01523          }
01524       } else
01525       {
01526          ast_log(LOG_ERROR,
01527             "ARI Playback has undocumented field %s\n",
01528             ast_json_object_iter_key(iter));
01529          res = 0;
01530       }
01531    }
01532 
01533    if (!has_id) {
01534       ast_log(LOG_ERROR, "ARI Playback missing required field id\n");
01535       res = 0;
01536    }
01537 
01538    if (!has_media_uri) {
01539       ast_log(LOG_ERROR, "ARI Playback missing required field media_uri\n");
01540       res = 0;
01541    }
01542 
01543    if (!has_state) {
01544       ast_log(LOG_ERROR, "ARI Playback missing required field state\n");
01545       res = 0;
01546    }
01547 
01548    if (!has_target_uri) {
01549       ast_log(LOG_ERROR, "ARI Playback missing required field target_uri\n");
01550       res = 0;
01551    }
01552 
01553    return res;
01554 }
01555 
01556 ari_validator ast_ari_validate_playback_fn(void)
01557 {
01558    return ast_ari_validate_playback;
01559 }
01560 
01561 int ast_ari_validate_device_state(struct ast_json *json)
01562 {
01563    int res = 1;
01564    struct ast_json_iter *iter;
01565    int has_name = 0;
01566    int has_state = 0;
01567 
01568    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
01569       if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
01570          int prop_is_valid;
01571          has_name = 1;
01572          prop_is_valid = ast_ari_validate_string(
01573             ast_json_object_iter_value(iter));
01574          if (!prop_is_valid) {
01575             ast_log(LOG_ERROR, "ARI DeviceState field name failed validation\n");
01576             res = 0;
01577          }
01578       } else
01579       if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
01580          int prop_is_valid;
01581          has_state = 1;
01582          prop_is_valid = ast_ari_validate_string(
01583             ast_json_object_iter_value(iter));
01584          if (!prop_is_valid) {
01585             ast_log(LOG_ERROR, "ARI DeviceState field state failed validation\n");
01586             res = 0;
01587          }
01588       } else
01589       {
01590          ast_log(LOG_ERROR,
01591             "ARI DeviceState has undocumented field %s\n",
01592             ast_json_object_iter_key(iter));
01593          res = 0;
01594       }
01595    }
01596 
01597    if (!has_name) {
01598       ast_log(LOG_ERROR, "ARI DeviceState missing required field name\n");
01599       res = 0;
01600    }
01601 
01602    if (!has_state) {
01603       ast_log(LOG_ERROR, "ARI DeviceState missing required field state\n");
01604       res = 0;
01605    }
01606 
01607    return res;
01608 }
01609 
01610 ari_validator ast_ari_validate_device_state_fn(void)
01611 {
01612    return ast_ari_validate_device_state;
01613 }
01614 
01615 int ast_ari_validate_mailbox(struct ast_json *json)
01616 {
01617    int res = 1;
01618    struct ast_json_iter *iter;
01619    int has_name = 0;
01620    int has_new_messages = 0;
01621    int has_old_messages = 0;
01622 
01623    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
01624       if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
01625          int prop_is_valid;
01626          has_name = 1;
01627          prop_is_valid = ast_ari_validate_string(
01628             ast_json_object_iter_value(iter));
01629          if (!prop_is_valid) {
01630             ast_log(LOG_ERROR, "ARI Mailbox field name failed validation\n");
01631             res = 0;
01632          }
01633       } else
01634       if (strcmp("new_messages", ast_json_object_iter_key(iter)) == 0) {
01635          int prop_is_valid;
01636          has_new_messages = 1;
01637          prop_is_valid = ast_ari_validate_int(
01638             ast_json_object_iter_value(iter));
01639          if (!prop_is_valid) {
01640             ast_log(LOG_ERROR, "ARI Mailbox field new_messages failed validation\n");
01641             res = 0;
01642          }
01643       } else
01644       if (strcmp("old_messages", ast_json_object_iter_key(iter)) == 0) {
01645          int prop_is_valid;
01646          has_old_messages = 1;
01647          prop_is_valid = ast_ari_validate_int(
01648             ast_json_object_iter_value(iter));
01649          if (!prop_is_valid) {
01650             ast_log(LOG_ERROR, "ARI Mailbox field old_messages failed validation\n");
01651             res = 0;
01652          }
01653       } else
01654       {
01655          ast_log(LOG_ERROR,
01656             "ARI Mailbox has undocumented field %s\n",
01657             ast_json_object_iter_key(iter));
01658          res = 0;
01659       }
01660    }
01661 
01662    if (!has_name) {
01663       ast_log(LOG_ERROR, "ARI Mailbox missing required field name\n");
01664       res = 0;
01665    }
01666 
01667    if (!has_new_messages) {
01668       ast_log(LOG_ERROR, "ARI Mailbox missing required field new_messages\n");
01669       res = 0;
01670    }
01671 
01672    if (!has_old_messages) {
01673       ast_log(LOG_ERROR, "ARI Mailbox missing required field old_messages\n");
01674       res = 0;
01675    }
01676 
01677    return res;
01678 }
01679 
01680 ari_validator ast_ari_validate_mailbox_fn(void)
01681 {
01682    return ast_ari_validate_mailbox;
01683 }
01684 
01685 int ast_ari_validate_application_replaced(struct ast_json *json)
01686 {
01687    int res = 1;
01688    struct ast_json_iter *iter;
01689    int has_type = 0;
01690    int has_application = 0;
01691 
01692    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
01693       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
01694          int prop_is_valid;
01695          has_type = 1;
01696          prop_is_valid = ast_ari_validate_string(
01697             ast_json_object_iter_value(iter));
01698          if (!prop_is_valid) {
01699             ast_log(LOG_ERROR, "ARI ApplicationReplaced field type failed validation\n");
01700             res = 0;
01701          }
01702       } else
01703       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
01704          int prop_is_valid;
01705          has_application = 1;
01706          prop_is_valid = ast_ari_validate_string(
01707             ast_json_object_iter_value(iter));
01708          if (!prop_is_valid) {
01709             ast_log(LOG_ERROR, "ARI ApplicationReplaced field application failed validation\n");
01710             res = 0;
01711          }
01712       } else
01713       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
01714          int prop_is_valid;
01715          prop_is_valid = ast_ari_validate_date(
01716             ast_json_object_iter_value(iter));
01717          if (!prop_is_valid) {
01718             ast_log(LOG_ERROR, "ARI ApplicationReplaced field timestamp failed validation\n");
01719             res = 0;
01720          }
01721       } else
01722       {
01723          ast_log(LOG_ERROR,
01724             "ARI ApplicationReplaced has undocumented field %s\n",
01725             ast_json_object_iter_key(iter));
01726          res = 0;
01727       }
01728    }
01729 
01730    if (!has_type) {
01731       ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field type\n");
01732       res = 0;
01733    }
01734 
01735    if (!has_application) {
01736       ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field application\n");
01737       res = 0;
01738    }
01739 
01740    return res;
01741 }
01742 
01743 ari_validator ast_ari_validate_application_replaced_fn(void)
01744 {
01745    return ast_ari_validate_application_replaced;
01746 }
01747 
01748 int ast_ari_validate_bridge_attended_transfer(struct ast_json *json)
01749 {
01750    int res = 1;
01751    struct ast_json_iter *iter;
01752    int has_type = 0;
01753    int has_application = 0;
01754    int has_destination_type = 0;
01755    int has_is_external = 0;
01756    int has_result = 0;
01757    int has_transferer_first_leg = 0;
01758    int has_transferer_second_leg = 0;
01759 
01760    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
01761       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
01762          int prop_is_valid;
01763          has_type = 1;
01764          prop_is_valid = ast_ari_validate_string(
01765             ast_json_object_iter_value(iter));
01766          if (!prop_is_valid) {
01767             ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field type failed validation\n");
01768             res = 0;
01769          }
01770       } else
01771       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
01772          int prop_is_valid;
01773          has_application = 1;
01774          prop_is_valid = ast_ari_validate_string(
01775             ast_json_object_iter_value(iter));
01776          if (!prop_is_valid) {
01777             ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field application failed validation\n");
01778             res = 0;
01779          }
01780       } else
01781       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
01782          int prop_is_valid;
01783          prop_is_valid = ast_ari_validate_date(
01784             ast_json_object_iter_value(iter));
01785          if (!prop_is_valid) {
01786             ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field timestamp failed validation\n");
01787             res = 0;
01788          }
01789       } else
01790       if (strcmp("destination_application", ast_json_object_iter_key(iter)) == 0) {
01791          int prop_is_valid;
01792          prop_is_valid = ast_ari_validate_string(
01793             ast_json_object_iter_value(iter));
01794          if (!prop_is_valid) {
01795             ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_application failed validation\n");
01796             res = 0;
01797          }
01798       } else
01799       if (strcmp("destination_bridge", ast_json_object_iter_key(iter)) == 0) {
01800          int prop_is_valid;
01801          prop_is_valid = ast_ari_validate_string(
01802             ast_json_object_iter_value(iter));
01803          if (!prop_is_valid) {
01804             ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_bridge failed validation\n");
01805             res = 0;
01806          }
01807       } else
01808       if (strcmp("destination_link_first_leg", ast_json_object_iter_key(iter)) == 0) {
01809          int prop_is_valid;
01810          prop_is_valid = ast_ari_validate_channel(
01811             ast_json_object_iter_value(iter));
01812          if (!prop_is_valid) {
01813             ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_link_first_leg failed validation\n");
01814             res = 0;
01815          }
01816       } else
01817       if (strcmp("destination_link_second_leg", ast_json_object_iter_key(iter)) == 0) {
01818          int prop_is_valid;
01819          prop_is_valid = ast_ari_validate_channel(
01820             ast_json_object_iter_value(iter));
01821          if (!prop_is_valid) {
01822             ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_link_second_leg failed validation\n");
01823             res = 0;
01824          }
01825       } else
01826       if (strcmp("destination_threeway_bridge", ast_json_object_iter_key(iter)) == 0) {
01827          int prop_is_valid;
01828          prop_is_valid = ast_ari_validate_bridge(
01829             ast_json_object_iter_value(iter));
01830          if (!prop_is_valid) {
01831             ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_threeway_bridge failed validation\n");
01832             res = 0;
01833          }
01834       } else
01835       if (strcmp("destination_threeway_channel", ast_json_object_iter_key(iter)) == 0) {
01836          int prop_is_valid;
01837          prop_is_valid = ast_ari_validate_channel(
01838             ast_json_object_iter_value(iter));
01839          if (!prop_is_valid) {
01840             ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_threeway_channel failed validation\n");
01841             res = 0;
01842          }
01843       } else
01844       if (strcmp("destination_type", ast_json_object_iter_key(iter)) == 0) {
01845          int prop_is_valid;
01846          has_destination_type = 1;
01847          prop_is_valid = ast_ari_validate_string(
01848             ast_json_object_iter_value(iter));
01849          if (!prop_is_valid) {
01850             ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_type failed validation\n");
01851             res = 0;
01852          }
01853       } else
01854       if (strcmp("is_external", ast_json_object_iter_key(iter)) == 0) {
01855          int prop_is_valid;
01856          has_is_external = 1;
01857          prop_is_valid = ast_ari_validate_boolean(
01858             ast_json_object_iter_value(iter));
01859          if (!prop_is_valid) {
01860             ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field is_external failed validation\n");
01861             res = 0;
01862          }
01863       } else
01864       if (strcmp("replace_channel", ast_json_object_iter_key(iter)) == 0) {
01865          int prop_is_valid;
01866          prop_is_valid = ast_ari_validate_channel(
01867             ast_json_object_iter_value(iter));
01868          if (!prop_is_valid) {
01869             ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field replace_channel failed validation\n");
01870             res = 0;
01871          }
01872       } else
01873       if (strcmp("result", ast_json_object_iter_key(iter)) == 0) {
01874          int prop_is_valid;
01875          has_result = 1;
01876          prop_is_valid = ast_ari_validate_string(
01877             ast_json_object_iter_value(iter));
01878          if (!prop_is_valid) {
01879             ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field result failed validation\n");
01880             res = 0;
01881          }
01882       } else
01883       if (strcmp("transfer_target", ast_json_object_iter_key(iter)) == 0) {
01884          int prop_is_valid;
01885          prop_is_valid = ast_ari_validate_channel(
01886             ast_json_object_iter_value(iter));
01887          if (!prop_is_valid) {
01888             ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transfer_target failed validation\n");
01889             res = 0;
01890          }
01891       } else
01892       if (strcmp("transferee", ast_json_object_iter_key(iter)) == 0) {
01893          int prop_is_valid;
01894          prop_is_valid = ast_ari_validate_channel(
01895             ast_json_object_iter_value(iter));
01896          if (!prop_is_valid) {
01897             ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferee failed validation\n");
01898             res = 0;
01899          }
01900       } else
01901       if (strcmp("transferer_first_leg", ast_json_object_iter_key(iter)) == 0) {
01902          int prop_is_valid;
01903          has_transferer_first_leg = 1;
01904          prop_is_valid = ast_ari_validate_channel(
01905             ast_json_object_iter_value(iter));
01906          if (!prop_is_valid) {
01907             ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_first_leg failed validation\n");
01908             res = 0;
01909          }
01910       } else
01911       if (strcmp("transferer_first_leg_bridge", ast_json_object_iter_key(iter)) == 0) {
01912          int prop_is_valid;
01913          prop_is_valid = ast_ari_validate_bridge(
01914             ast_json_object_iter_value(iter));
01915          if (!prop_is_valid) {
01916             ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_first_leg_bridge failed validation\n");
01917             res = 0;
01918          }
01919       } else
01920       if (strcmp("transferer_second_leg", ast_json_object_iter_key(iter)) == 0) {
01921          int prop_is_valid;
01922          has_transferer_second_leg = 1;
01923          prop_is_valid = ast_ari_validate_channel(
01924             ast_json_object_iter_value(iter));
01925          if (!prop_is_valid) {
01926             ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_second_leg failed validation\n");
01927             res = 0;
01928          }
01929       } else
01930       if (strcmp("transferer_second_leg_bridge", ast_json_object_iter_key(iter)) == 0) {
01931          int prop_is_valid;
01932          prop_is_valid = ast_ari_validate_bridge(
01933             ast_json_object_iter_value(iter));
01934          if (!prop_is_valid) {
01935             ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_second_leg_bridge failed validation\n");
01936             res = 0;
01937          }
01938       } else
01939       {
01940          ast_log(LOG_ERROR,
01941             "ARI BridgeAttendedTransfer has undocumented field %s\n",
01942             ast_json_object_iter_key(iter));
01943          res = 0;
01944       }
01945    }
01946 
01947    if (!has_type) {
01948       ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field type\n");
01949       res = 0;
01950    }
01951 
01952    if (!has_application) {
01953       ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field application\n");
01954       res = 0;
01955    }
01956 
01957    if (!has_destination_type) {
01958       ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field destination_type\n");
01959       res = 0;
01960    }
01961 
01962    if (!has_is_external) {
01963       ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field is_external\n");
01964       res = 0;
01965    }
01966 
01967    if (!has_result) {
01968       ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field result\n");
01969       res = 0;
01970    }
01971 
01972    if (!has_transferer_first_leg) {
01973       ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field transferer_first_leg\n");
01974       res = 0;
01975    }
01976 
01977    if (!has_transferer_second_leg) {
01978       ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field transferer_second_leg\n");
01979       res = 0;
01980    }
01981 
01982    return res;
01983 }
01984 
01985 ari_validator ast_ari_validate_bridge_attended_transfer_fn(void)
01986 {
01987    return ast_ari_validate_bridge_attended_transfer;
01988 }
01989 
01990 int ast_ari_validate_bridge_blind_transfer(struct ast_json *json)
01991 {
01992    int res = 1;
01993    struct ast_json_iter *iter;
01994    int has_type = 0;
01995    int has_application = 0;
01996    int has_channel = 0;
01997    int has_context = 0;
01998    int has_exten = 0;
01999    int has_is_external = 0;
02000    int has_result = 0;
02001 
02002    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
02003       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
02004          int prop_is_valid;
02005          has_type = 1;
02006          prop_is_valid = ast_ari_validate_string(
02007             ast_json_object_iter_value(iter));
02008          if (!prop_is_valid) {
02009             ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field type failed validation\n");
02010             res = 0;
02011          }
02012       } else
02013       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
02014          int prop_is_valid;
02015          has_application = 1;
02016          prop_is_valid = ast_ari_validate_string(
02017             ast_json_object_iter_value(iter));
02018          if (!prop_is_valid) {
02019             ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field application failed validation\n");
02020             res = 0;
02021          }
02022       } else
02023       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
02024          int prop_is_valid;
02025          prop_is_valid = ast_ari_validate_date(
02026             ast_json_object_iter_value(iter));
02027          if (!prop_is_valid) {
02028             ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field timestamp failed validation\n");
02029             res = 0;
02030          }
02031       } else
02032       if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
02033          int prop_is_valid;
02034          prop_is_valid = ast_ari_validate_bridge(
02035             ast_json_object_iter_value(iter));
02036          if (!prop_is_valid) {
02037             ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field bridge failed validation\n");
02038             res = 0;
02039          }
02040       } else
02041       if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
02042          int prop_is_valid;
02043          has_channel = 1;
02044          prop_is_valid = ast_ari_validate_channel(
02045             ast_json_object_iter_value(iter));
02046          if (!prop_is_valid) {
02047             ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field channel failed validation\n");
02048             res = 0;
02049          }
02050       } else
02051       if (strcmp("context", ast_json_object_iter_key(iter)) == 0) {
02052          int prop_is_valid;
02053          has_context = 1;
02054          prop_is_valid = ast_ari_validate_string(
02055             ast_json_object_iter_value(iter));
02056          if (!prop_is_valid) {
02057             ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field context failed validation\n");
02058             res = 0;
02059          }
02060       } else
02061       if (strcmp("exten", ast_json_object_iter_key(iter)) == 0) {
02062          int prop_is_valid;
02063          has_exten = 1;
02064          prop_is_valid = ast_ari_validate_string(
02065             ast_json_object_iter_value(iter));
02066          if (!prop_is_valid) {
02067             ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field exten failed validation\n");
02068             res = 0;
02069          }
02070       } else
02071       if (strcmp("is_external", ast_json_object_iter_key(iter)) == 0) {
02072          int prop_is_valid;
02073          has_is_external = 1;
02074          prop_is_valid = ast_ari_validate_boolean(
02075             ast_json_object_iter_value(iter));
02076          if (!prop_is_valid) {
02077             ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field is_external failed validation\n");
02078             res = 0;
02079          }
02080       } else
02081       if (strcmp("replace_channel", ast_json_object_iter_key(iter)) == 0) {
02082          int prop_is_valid;
02083          prop_is_valid = ast_ari_validate_channel(
02084             ast_json_object_iter_value(iter));
02085          if (!prop_is_valid) {
02086             ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field replace_channel failed validation\n");
02087             res = 0;
02088          }
02089       } else
02090       if (strcmp("result", ast_json_object_iter_key(iter)) == 0) {
02091          int prop_is_valid;
02092          has_result = 1;
02093          prop_is_valid = ast_ari_validate_string(
02094             ast_json_object_iter_value(iter));
02095          if (!prop_is_valid) {
02096             ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field result failed validation\n");
02097             res = 0;
02098          }
02099       } else
02100       if (strcmp("transferee", ast_json_object_iter_key(iter)) == 0) {
02101          int prop_is_valid;
02102          prop_is_valid = ast_ari_validate_channel(
02103             ast_json_object_iter_value(iter));
02104          if (!prop_is_valid) {
02105             ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field transferee failed validation\n");
02106             res = 0;
02107          }
02108       } else
02109       {
02110          ast_log(LOG_ERROR,
02111             "ARI BridgeBlindTransfer has undocumented field %s\n",
02112             ast_json_object_iter_key(iter));
02113          res = 0;
02114       }
02115    }
02116 
02117    if (!has_type) {
02118       ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field type\n");
02119       res = 0;
02120    }
02121 
02122    if (!has_application) {
02123       ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field application\n");
02124       res = 0;
02125    }
02126 
02127    if (!has_channel) {
02128       ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field channel\n");
02129       res = 0;
02130    }
02131 
02132    if (!has_context) {
02133       ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field context\n");
02134       res = 0;
02135    }
02136 
02137    if (!has_exten) {
02138       ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field exten\n");
02139       res = 0;
02140    }
02141 
02142    if (!has_is_external) {
02143       ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field is_external\n");
02144       res = 0;
02145    }
02146 
02147    if (!has_result) {
02148       ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field result\n");
02149       res = 0;
02150    }
02151 
02152    return res;
02153 }
02154 
02155 ari_validator ast_ari_validate_bridge_blind_transfer_fn(void)
02156 {
02157    return ast_ari_validate_bridge_blind_transfer;
02158 }
02159 
02160 int ast_ari_validate_bridge_created(struct ast_json *json)
02161 {
02162    int res = 1;
02163    struct ast_json_iter *iter;
02164    int has_type = 0;
02165    int has_application = 0;
02166    int has_bridge = 0;
02167 
02168    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
02169       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
02170          int prop_is_valid;
02171          has_type = 1;
02172          prop_is_valid = ast_ari_validate_string(
02173             ast_json_object_iter_value(iter));
02174          if (!prop_is_valid) {
02175             ast_log(LOG_ERROR, "ARI BridgeCreated field type failed validation\n");
02176             res = 0;
02177          }
02178       } else
02179       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
02180          int prop_is_valid;
02181          has_application = 1;
02182          prop_is_valid = ast_ari_validate_string(
02183             ast_json_object_iter_value(iter));
02184          if (!prop_is_valid) {
02185             ast_log(LOG_ERROR, "ARI BridgeCreated field application failed validation\n");
02186             res = 0;
02187          }
02188       } else
02189       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
02190          int prop_is_valid;
02191          prop_is_valid = ast_ari_validate_date(
02192             ast_json_object_iter_value(iter));
02193          if (!prop_is_valid) {
02194             ast_log(LOG_ERROR, "ARI BridgeCreated field timestamp failed validation\n");
02195             res = 0;
02196          }
02197       } else
02198       if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
02199          int prop_is_valid;
02200          has_bridge = 1;
02201          prop_is_valid = ast_ari_validate_bridge(
02202             ast_json_object_iter_value(iter));
02203          if (!prop_is_valid) {
02204             ast_log(LOG_ERROR, "ARI BridgeCreated field bridge failed validation\n");
02205             res = 0;
02206          }
02207       } else
02208       {
02209          ast_log(LOG_ERROR,
02210             "ARI BridgeCreated has undocumented field %s\n",
02211             ast_json_object_iter_key(iter));
02212          res = 0;
02213       }
02214    }
02215 
02216    if (!has_type) {
02217       ast_log(LOG_ERROR, "ARI BridgeCreated missing required field type\n");
02218       res = 0;
02219    }
02220 
02221    if (!has_application) {
02222       ast_log(LOG_ERROR, "ARI BridgeCreated missing required field application\n");
02223       res = 0;
02224    }
02225 
02226    if (!has_bridge) {
02227       ast_log(LOG_ERROR, "ARI BridgeCreated missing required field bridge\n");
02228       res = 0;
02229    }
02230 
02231    return res;
02232 }
02233 
02234 ari_validator ast_ari_validate_bridge_created_fn(void)
02235 {
02236    return ast_ari_validate_bridge_created;
02237 }
02238 
02239 int ast_ari_validate_bridge_destroyed(struct ast_json *json)
02240 {
02241    int res = 1;
02242    struct ast_json_iter *iter;
02243    int has_type = 0;
02244    int has_application = 0;
02245    int has_bridge = 0;
02246 
02247    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
02248       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
02249          int prop_is_valid;
02250          has_type = 1;
02251          prop_is_valid = ast_ari_validate_string(
02252             ast_json_object_iter_value(iter));
02253          if (!prop_is_valid) {
02254             ast_log(LOG_ERROR, "ARI BridgeDestroyed field type failed validation\n");
02255             res = 0;
02256          }
02257       } else
02258       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
02259          int prop_is_valid;
02260          has_application = 1;
02261          prop_is_valid = ast_ari_validate_string(
02262             ast_json_object_iter_value(iter));
02263          if (!prop_is_valid) {
02264             ast_log(LOG_ERROR, "ARI BridgeDestroyed field application failed validation\n");
02265             res = 0;
02266          }
02267       } else
02268       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
02269          int prop_is_valid;
02270          prop_is_valid = ast_ari_validate_date(
02271             ast_json_object_iter_value(iter));
02272          if (!prop_is_valid) {
02273             ast_log(LOG_ERROR, "ARI BridgeDestroyed field timestamp failed validation\n");
02274             res = 0;
02275          }
02276       } else
02277       if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
02278          int prop_is_valid;
02279          has_bridge = 1;
02280          prop_is_valid = ast_ari_validate_bridge(
02281             ast_json_object_iter_value(iter));
02282          if (!prop_is_valid) {
02283             ast_log(LOG_ERROR, "ARI BridgeDestroyed field bridge failed validation\n");
02284             res = 0;
02285          }
02286       } else
02287       {
02288          ast_log(LOG_ERROR,
02289             "ARI BridgeDestroyed has undocumented field %s\n",
02290             ast_json_object_iter_key(iter));
02291          res = 0;
02292       }
02293    }
02294 
02295    if (!has_type) {
02296       ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field type\n");
02297       res = 0;
02298    }
02299 
02300    if (!has_application) {
02301       ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field application\n");
02302       res = 0;
02303    }
02304 
02305    if (!has_bridge) {
02306       ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field bridge\n");
02307       res = 0;
02308    }
02309 
02310    return res;
02311 }
02312 
02313 ari_validator ast_ari_validate_bridge_destroyed_fn(void)
02314 {
02315    return ast_ari_validate_bridge_destroyed;
02316 }
02317 
02318 int ast_ari_validate_bridge_merged(struct ast_json *json)
02319 {
02320    int res = 1;
02321    struct ast_json_iter *iter;
02322    int has_type = 0;
02323    int has_application = 0;
02324    int has_bridge = 0;
02325    int has_bridge_from = 0;
02326 
02327    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
02328       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
02329          int prop_is_valid;
02330          has_type = 1;
02331          prop_is_valid = ast_ari_validate_string(
02332             ast_json_object_iter_value(iter));
02333          if (!prop_is_valid) {
02334             ast_log(LOG_ERROR, "ARI BridgeMerged field type failed validation\n");
02335             res = 0;
02336          }
02337       } else
02338       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
02339          int prop_is_valid;
02340          has_application = 1;
02341          prop_is_valid = ast_ari_validate_string(
02342             ast_json_object_iter_value(iter));
02343          if (!prop_is_valid) {
02344             ast_log(LOG_ERROR, "ARI BridgeMerged field application failed validation\n");
02345             res = 0;
02346          }
02347       } else
02348       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
02349          int prop_is_valid;
02350          prop_is_valid = ast_ari_validate_date(
02351             ast_json_object_iter_value(iter));
02352          if (!prop_is_valid) {
02353             ast_log(LOG_ERROR, "ARI BridgeMerged field timestamp failed validation\n");
02354             res = 0;
02355          }
02356       } else
02357       if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
02358          int prop_is_valid;
02359          has_bridge = 1;
02360          prop_is_valid = ast_ari_validate_bridge(
02361             ast_json_object_iter_value(iter));
02362          if (!prop_is_valid) {
02363             ast_log(LOG_ERROR, "ARI BridgeMerged field bridge failed validation\n");
02364             res = 0;
02365          }
02366       } else
02367       if (strcmp("bridge_from", ast_json_object_iter_key(iter)) == 0) {
02368          int prop_is_valid;
02369          has_bridge_from = 1;
02370          prop_is_valid = ast_ari_validate_bridge(
02371             ast_json_object_iter_value(iter));
02372          if (!prop_is_valid) {
02373             ast_log(LOG_ERROR, "ARI BridgeMerged field bridge_from failed validation\n");
02374             res = 0;
02375          }
02376       } else
02377       {
02378          ast_log(LOG_ERROR,
02379             "ARI BridgeMerged has undocumented field %s\n",
02380             ast_json_object_iter_key(iter));
02381          res = 0;
02382       }
02383    }
02384 
02385    if (!has_type) {
02386       ast_log(LOG_ERROR, "ARI BridgeMerged missing required field type\n");
02387       res = 0;
02388    }
02389 
02390    if (!has_application) {
02391       ast_log(LOG_ERROR, "ARI BridgeMerged missing required field application\n");
02392       res = 0;
02393    }
02394 
02395    if (!has_bridge) {
02396       ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge\n");
02397       res = 0;
02398    }
02399 
02400    if (!has_bridge_from) {
02401       ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge_from\n");
02402       res = 0;
02403    }
02404 
02405    return res;
02406 }
02407 
02408 ari_validator ast_ari_validate_bridge_merged_fn(void)
02409 {
02410    return ast_ari_validate_bridge_merged;
02411 }
02412 
02413 int ast_ari_validate_channel_caller_id(struct ast_json *json)
02414 {
02415    int res = 1;
02416    struct ast_json_iter *iter;
02417    int has_type = 0;
02418    int has_application = 0;
02419    int has_caller_presentation = 0;
02420    int has_caller_presentation_txt = 0;
02421    int has_channel = 0;
02422 
02423    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
02424       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
02425          int prop_is_valid;
02426          has_type = 1;
02427          prop_is_valid = ast_ari_validate_string(
02428             ast_json_object_iter_value(iter));
02429          if (!prop_is_valid) {
02430             ast_log(LOG_ERROR, "ARI ChannelCallerId field type failed validation\n");
02431             res = 0;
02432          }
02433       } else
02434       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
02435          int prop_is_valid;
02436          has_application = 1;
02437          prop_is_valid = ast_ari_validate_string(
02438             ast_json_object_iter_value(iter));
02439          if (!prop_is_valid) {
02440             ast_log(LOG_ERROR, "ARI ChannelCallerId field application failed validation\n");
02441             res = 0;
02442          }
02443       } else
02444       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
02445          int prop_is_valid;
02446          prop_is_valid = ast_ari_validate_date(
02447             ast_json_object_iter_value(iter));
02448          if (!prop_is_valid) {
02449             ast_log(LOG_ERROR, "ARI ChannelCallerId field timestamp failed validation\n");
02450             res = 0;
02451          }
02452       } else
02453       if (strcmp("caller_presentation", ast_json_object_iter_key(iter)) == 0) {
02454          int prop_is_valid;
02455          has_caller_presentation = 1;
02456          prop_is_valid = ast_ari_validate_int(
02457             ast_json_object_iter_value(iter));
02458          if (!prop_is_valid) {
02459             ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation failed validation\n");
02460             res = 0;
02461          }
02462       } else
02463       if (strcmp("caller_presentation_txt", ast_json_object_iter_key(iter)) == 0) {
02464          int prop_is_valid;
02465          has_caller_presentation_txt = 1;
02466          prop_is_valid = ast_ari_validate_string(
02467             ast_json_object_iter_value(iter));
02468          if (!prop_is_valid) {
02469             ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation_txt failed validation\n");
02470             res = 0;
02471          }
02472       } else
02473       if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
02474          int prop_is_valid;
02475          has_channel = 1;
02476          prop_is_valid = ast_ari_validate_channel(
02477             ast_json_object_iter_value(iter));
02478          if (!prop_is_valid) {
02479             ast_log(LOG_ERROR, "ARI ChannelCallerId field channel failed validation\n");
02480             res = 0;
02481          }
02482       } else
02483       {
02484          ast_log(LOG_ERROR,
02485             "ARI ChannelCallerId has undocumented field %s\n",
02486             ast_json_object_iter_key(iter));
02487          res = 0;
02488       }
02489    }
02490 
02491    if (!has_type) {
02492       ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field type\n");
02493       res = 0;
02494    }
02495 
02496    if (!has_application) {
02497       ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field application\n");
02498       res = 0;
02499    }
02500 
02501    if (!has_caller_presentation) {
02502       ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation\n");
02503       res = 0;
02504    }
02505 
02506    if (!has_caller_presentation_txt) {
02507       ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation_txt\n");
02508       res = 0;
02509    }
02510 
02511    if (!has_channel) {
02512       ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field channel\n");
02513       res = 0;
02514    }
02515 
02516    return res;
02517 }
02518 
02519 ari_validator ast_ari_validate_channel_caller_id_fn(void)
02520 {
02521    return ast_ari_validate_channel_caller_id;
02522 }
02523 
02524 int ast_ari_validate_channel_connected_line(struct ast_json *json)
02525 {
02526    int res = 1;
02527    struct ast_json_iter *iter;
02528    int has_type = 0;
02529    int has_application = 0;
02530    int has_channel = 0;
02531 
02532    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
02533       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
02534          int prop_is_valid;
02535          has_type = 1;
02536          prop_is_valid = ast_ari_validate_string(
02537             ast_json_object_iter_value(iter));
02538          if (!prop_is_valid) {
02539             ast_log(LOG_ERROR, "ARI ChannelConnectedLine field type failed validation\n");
02540             res = 0;
02541          }
02542       } else
02543       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
02544          int prop_is_valid;
02545          has_application = 1;
02546          prop_is_valid = ast_ari_validate_string(
02547             ast_json_object_iter_value(iter));
02548          if (!prop_is_valid) {
02549             ast_log(LOG_ERROR, "ARI ChannelConnectedLine field application failed validation\n");
02550             res = 0;
02551          }
02552       } else
02553       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
02554          int prop_is_valid;
02555          prop_is_valid = ast_ari_validate_date(
02556             ast_json_object_iter_value(iter));
02557          if (!prop_is_valid) {
02558             ast_log(LOG_ERROR, "ARI ChannelConnectedLine field timestamp failed validation\n");
02559             res = 0;
02560          }
02561       } else
02562       if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
02563          int prop_is_valid;
02564          has_channel = 1;
02565          prop_is_valid = ast_ari_validate_channel(
02566             ast_json_object_iter_value(iter));
02567          if (!prop_is_valid) {
02568             ast_log(LOG_ERROR, "ARI ChannelConnectedLine field channel failed validation\n");
02569             res = 0;
02570          }
02571       } else
02572       {
02573          ast_log(LOG_ERROR,
02574             "ARI ChannelConnectedLine has undocumented field %s\n",
02575             ast_json_object_iter_key(iter));
02576          res = 0;
02577       }
02578    }
02579 
02580    if (!has_type) {
02581       ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field type\n");
02582       res = 0;
02583    }
02584 
02585    if (!has_application) {
02586       ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field application\n");
02587       res = 0;
02588    }
02589 
02590    if (!has_channel) {
02591       ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field channel\n");
02592       res = 0;
02593    }
02594 
02595    return res;
02596 }
02597 
02598 ari_validator ast_ari_validate_channel_connected_line_fn(void)
02599 {
02600    return ast_ari_validate_channel_connected_line;
02601 }
02602 
02603 int ast_ari_validate_channel_created(struct ast_json *json)
02604 {
02605    int res = 1;
02606    struct ast_json_iter *iter;
02607    int has_type = 0;
02608    int has_application = 0;
02609    int has_channel = 0;
02610 
02611    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
02612       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
02613          int prop_is_valid;
02614          has_type = 1;
02615          prop_is_valid = ast_ari_validate_string(
02616             ast_json_object_iter_value(iter));
02617          if (!prop_is_valid) {
02618             ast_log(LOG_ERROR, "ARI ChannelCreated field type failed validation\n");
02619             res = 0;
02620          }
02621       } else
02622       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
02623          int prop_is_valid;
02624          has_application = 1;
02625          prop_is_valid = ast_ari_validate_string(
02626             ast_json_object_iter_value(iter));
02627          if (!prop_is_valid) {
02628             ast_log(LOG_ERROR, "ARI ChannelCreated field application failed validation\n");
02629             res = 0;
02630          }
02631       } else
02632       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
02633          int prop_is_valid;
02634          prop_is_valid = ast_ari_validate_date(
02635             ast_json_object_iter_value(iter));
02636          if (!prop_is_valid) {
02637             ast_log(LOG_ERROR, "ARI ChannelCreated field timestamp failed validation\n");
02638             res = 0;
02639          }
02640       } else
02641       if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
02642          int prop_is_valid;
02643          has_channel = 1;
02644          prop_is_valid = ast_ari_validate_channel(
02645             ast_json_object_iter_value(iter));
02646          if (!prop_is_valid) {
02647             ast_log(LOG_ERROR, "ARI ChannelCreated field channel failed validation\n");
02648             res = 0;
02649          }
02650       } else
02651       {
02652          ast_log(LOG_ERROR,
02653             "ARI ChannelCreated has undocumented field %s\n",
02654             ast_json_object_iter_key(iter));
02655          res = 0;
02656       }
02657    }
02658 
02659    if (!has_type) {
02660       ast_log(LOG_ERROR, "ARI ChannelCreated missing required field type\n");
02661       res = 0;
02662    }
02663 
02664    if (!has_application) {
02665       ast_log(LOG_ERROR, "ARI ChannelCreated missing required field application\n");
02666       res = 0;
02667    }
02668 
02669    if (!has_channel) {
02670       ast_log(LOG_ERROR, "ARI ChannelCreated missing required field channel\n");
02671       res = 0;
02672    }
02673 
02674    return res;
02675 }
02676 
02677 ari_validator ast_ari_validate_channel_created_fn(void)
02678 {
02679    return ast_ari_validate_channel_created;
02680 }
02681 
02682 int ast_ari_validate_channel_destroyed(struct ast_json *json)
02683 {
02684    int res = 1;
02685    struct ast_json_iter *iter;
02686    int has_type = 0;
02687    int has_application = 0;
02688    int has_cause = 0;
02689    int has_cause_txt = 0;
02690    int has_channel = 0;
02691 
02692    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
02693       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
02694          int prop_is_valid;
02695          has_type = 1;
02696          prop_is_valid = ast_ari_validate_string(
02697             ast_json_object_iter_value(iter));
02698          if (!prop_is_valid) {
02699             ast_log(LOG_ERROR, "ARI ChannelDestroyed field type failed validation\n");
02700             res = 0;
02701          }
02702       } else
02703       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
02704          int prop_is_valid;
02705          has_application = 1;
02706          prop_is_valid = ast_ari_validate_string(
02707             ast_json_object_iter_value(iter));
02708          if (!prop_is_valid) {
02709             ast_log(LOG_ERROR, "ARI ChannelDestroyed field application failed validation\n");
02710             res = 0;
02711          }
02712       } else
02713       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
02714          int prop_is_valid;
02715          prop_is_valid = ast_ari_validate_date(
02716             ast_json_object_iter_value(iter));
02717          if (!prop_is_valid) {
02718             ast_log(LOG_ERROR, "ARI ChannelDestroyed field timestamp failed validation\n");
02719             res = 0;
02720          }
02721       } else
02722       if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
02723          int prop_is_valid;
02724          has_cause = 1;
02725          prop_is_valid = ast_ari_validate_int(
02726             ast_json_object_iter_value(iter));
02727          if (!prop_is_valid) {
02728             ast_log(LOG_ERROR, "ARI ChannelDestroyed field cause failed validation\n");
02729             res = 0;
02730          }
02731       } else
02732       if (strcmp("cause_txt", ast_json_object_iter_key(iter)) == 0) {
02733          int prop_is_valid;
02734          has_cause_txt = 1;
02735          prop_is_valid = ast_ari_validate_string(
02736             ast_json_object_iter_value(iter));
02737          if (!prop_is_valid) {
02738             ast_log(LOG_ERROR, "ARI ChannelDestroyed field cause_txt failed validation\n");
02739             res = 0;
02740          }
02741       } else
02742       if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
02743          int prop_is_valid;
02744          has_channel = 1;
02745          prop_is_valid = ast_ari_validate_channel(
02746             ast_json_object_iter_value(iter));
02747          if (!prop_is_valid) {
02748             ast_log(LOG_ERROR, "ARI ChannelDestroyed field channel failed validation\n");
02749             res = 0;
02750          }
02751       } else
02752       {
02753          ast_log(LOG_ERROR,
02754             "ARI ChannelDestroyed has undocumented field %s\n",
02755             ast_json_object_iter_key(iter));
02756          res = 0;
02757       }
02758    }
02759 
02760    if (!has_type) {
02761       ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field type\n");
02762       res = 0;
02763    }
02764 
02765    if (!has_application) {
02766       ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field application\n");
02767       res = 0;
02768    }
02769 
02770    if (!has_cause) {
02771       ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field cause\n");
02772       res = 0;
02773    }
02774 
02775    if (!has_cause_txt) {
02776       ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field cause_txt\n");
02777       res = 0;
02778    }
02779 
02780    if (!has_channel) {
02781       ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field channel\n");
02782       res = 0;
02783    }
02784 
02785    return res;
02786 }
02787 
02788 ari_validator ast_ari_validate_channel_destroyed_fn(void)
02789 {
02790    return ast_ari_validate_channel_destroyed;
02791 }
02792 
02793 int ast_ari_validate_channel_dialplan(struct ast_json *json)
02794 {
02795    int res = 1;
02796    struct ast_json_iter *iter;
02797    int has_type = 0;
02798    int has_application = 0;
02799    int has_channel = 0;
02800    int has_dialplan_app = 0;
02801    int has_dialplan_app_data = 0;
02802 
02803    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
02804       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
02805          int prop_is_valid;
02806          has_type = 1;
02807          prop_is_valid = ast_ari_validate_string(
02808             ast_json_object_iter_value(iter));
02809          if (!prop_is_valid) {
02810             ast_log(LOG_ERROR, "ARI ChannelDialplan field type failed validation\n");
02811             res = 0;
02812          }
02813       } else
02814       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
02815          int prop_is_valid;
02816          has_application = 1;
02817          prop_is_valid = ast_ari_validate_string(
02818             ast_json_object_iter_value(iter));
02819          if (!prop_is_valid) {
02820             ast_log(LOG_ERROR, "ARI ChannelDialplan field application failed validation\n");
02821             res = 0;
02822          }
02823       } else
02824       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
02825          int prop_is_valid;
02826          prop_is_valid = ast_ari_validate_date(
02827             ast_json_object_iter_value(iter));
02828          if (!prop_is_valid) {
02829             ast_log(LOG_ERROR, "ARI ChannelDialplan field timestamp failed validation\n");
02830             res = 0;
02831          }
02832       } else
02833       if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
02834          int prop_is_valid;
02835          has_channel = 1;
02836          prop_is_valid = ast_ari_validate_channel(
02837             ast_json_object_iter_value(iter));
02838          if (!prop_is_valid) {
02839             ast_log(LOG_ERROR, "ARI ChannelDialplan field channel failed validation\n");
02840             res = 0;
02841          }
02842       } else
02843       if (strcmp("dialplan_app", ast_json_object_iter_key(iter)) == 0) {
02844          int prop_is_valid;
02845          has_dialplan_app = 1;
02846          prop_is_valid = ast_ari_validate_string(
02847             ast_json_object_iter_value(iter));
02848          if (!prop_is_valid) {
02849             ast_log(LOG_ERROR, "ARI ChannelDialplan field dialplan_app failed validation\n");
02850             res = 0;
02851          }
02852       } else
02853       if (strcmp("dialplan_app_data", ast_json_object_iter_key(iter)) == 0) {
02854          int prop_is_valid;
02855          has_dialplan_app_data = 1;
02856          prop_is_valid = ast_ari_validate_string(
02857             ast_json_object_iter_value(iter));
02858          if (!prop_is_valid) {
02859             ast_log(LOG_ERROR, "ARI ChannelDialplan field dialplan_app_data failed validation\n");
02860             res = 0;
02861          }
02862       } else
02863       {
02864          ast_log(LOG_ERROR,
02865             "ARI ChannelDialplan has undocumented field %s\n",
02866             ast_json_object_iter_key(iter));
02867          res = 0;
02868       }
02869    }
02870 
02871    if (!has_type) {
02872       ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field type\n");
02873       res = 0;
02874    }
02875 
02876    if (!has_application) {
02877       ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field application\n");
02878       res = 0;
02879    }
02880 
02881    if (!has_channel) {
02882       ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field channel\n");
02883       res = 0;
02884    }
02885 
02886    if (!has_dialplan_app) {
02887       ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field dialplan_app\n");
02888       res = 0;
02889    }
02890 
02891    if (!has_dialplan_app_data) {
02892       ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field dialplan_app_data\n");
02893       res = 0;
02894    }
02895 
02896    return res;
02897 }
02898 
02899 ari_validator ast_ari_validate_channel_dialplan_fn(void)
02900 {
02901    return ast_ari_validate_channel_dialplan;
02902 }
02903 
02904 int ast_ari_validate_channel_dtmf_received(struct ast_json *json)
02905 {
02906    int res = 1;
02907    struct ast_json_iter *iter;
02908    int has_type = 0;
02909    int has_application = 0;
02910    int has_channel = 0;
02911    int has_digit = 0;
02912    int has_duration_ms = 0;
02913 
02914    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
02915       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
02916          int prop_is_valid;
02917          has_type = 1;
02918          prop_is_valid = ast_ari_validate_string(
02919             ast_json_object_iter_value(iter));
02920          if (!prop_is_valid) {
02921             ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field type failed validation\n");
02922             res = 0;
02923          }
02924       } else
02925       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
02926          int prop_is_valid;
02927          has_application = 1;
02928          prop_is_valid = ast_ari_validate_string(
02929             ast_json_object_iter_value(iter));
02930          if (!prop_is_valid) {
02931             ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field application failed validation\n");
02932             res = 0;
02933          }
02934       } else
02935       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
02936          int prop_is_valid;
02937          prop_is_valid = ast_ari_validate_date(
02938             ast_json_object_iter_value(iter));
02939          if (!prop_is_valid) {
02940             ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field timestamp failed validation\n");
02941             res = 0;
02942          }
02943       } else
02944       if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
02945          int prop_is_valid;
02946          has_channel = 1;
02947          prop_is_valid = ast_ari_validate_channel(
02948             ast_json_object_iter_value(iter));
02949          if (!prop_is_valid) {
02950             ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field channel failed validation\n");
02951             res = 0;
02952          }
02953       } else
02954       if (strcmp("digit", ast_json_object_iter_key(iter)) == 0) {
02955          int prop_is_valid;
02956          has_digit = 1;
02957          prop_is_valid = ast_ari_validate_string(
02958             ast_json_object_iter_value(iter));
02959          if (!prop_is_valid) {
02960             ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field digit failed validation\n");
02961             res = 0;
02962          }
02963       } else
02964       if (strcmp("duration_ms", ast_json_object_iter_key(iter)) == 0) {
02965          int prop_is_valid;
02966          has_duration_ms = 1;
02967          prop_is_valid = ast_ari_validate_int(
02968             ast_json_object_iter_value(iter));
02969          if (!prop_is_valid) {
02970             ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field duration_ms failed validation\n");
02971             res = 0;
02972          }
02973       } else
02974       {
02975          ast_log(LOG_ERROR,
02976             "ARI ChannelDtmfReceived has undocumented field %s\n",
02977             ast_json_object_iter_key(iter));
02978          res = 0;
02979       }
02980    }
02981 
02982    if (!has_type) {
02983       ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field type\n");
02984       res = 0;
02985    }
02986 
02987    if (!has_application) {
02988       ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field application\n");
02989       res = 0;
02990    }
02991 
02992    if (!has_channel) {
02993       ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field channel\n");
02994       res = 0;
02995    }
02996 
02997    if (!has_digit) {
02998       ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field digit\n");
02999       res = 0;
03000    }
03001 
03002    if (!has_duration_ms) {
03003       ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field duration_ms\n");
03004       res = 0;
03005    }
03006 
03007    return res;
03008 }
03009 
03010 ari_validator ast_ari_validate_channel_dtmf_received_fn(void)
03011 {
03012    return ast_ari_validate_channel_dtmf_received;
03013 }
03014 
03015 int ast_ari_validate_channel_entered_bridge(struct ast_json *json)
03016 {
03017    int res = 1;
03018    struct ast_json_iter *iter;
03019    int has_type = 0;
03020    int has_application = 0;
03021    int has_bridge = 0;
03022 
03023    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
03024       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
03025          int prop_is_valid;
03026          has_type = 1;
03027          prop_is_valid = ast_ari_validate_string(
03028             ast_json_object_iter_value(iter));
03029          if (!prop_is_valid) {
03030             ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field type failed validation\n");
03031             res = 0;
03032          }
03033       } else
03034       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
03035          int prop_is_valid;
03036          has_application = 1;
03037          prop_is_valid = ast_ari_validate_string(
03038             ast_json_object_iter_value(iter));
03039          if (!prop_is_valid) {
03040             ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field application failed validation\n");
03041             res = 0;
03042          }
03043       } else
03044       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
03045          int prop_is_valid;
03046          prop_is_valid = ast_ari_validate_date(
03047             ast_json_object_iter_value(iter));
03048          if (!prop_is_valid) {
03049             ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field timestamp failed validation\n");
03050             res = 0;
03051          }
03052       } else
03053       if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
03054          int prop_is_valid;
03055          has_bridge = 1;
03056          prop_is_valid = ast_ari_validate_bridge(
03057             ast_json_object_iter_value(iter));
03058          if (!prop_is_valid) {
03059             ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field bridge failed validation\n");
03060             res = 0;
03061          }
03062       } else
03063       if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
03064          int prop_is_valid;
03065          prop_is_valid = ast_ari_validate_channel(
03066             ast_json_object_iter_value(iter));
03067          if (!prop_is_valid) {
03068             ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field channel failed validation\n");
03069             res = 0;
03070          }
03071       } else
03072       {
03073          ast_log(LOG_ERROR,
03074             "ARI ChannelEnteredBridge has undocumented field %s\n",
03075             ast_json_object_iter_key(iter));
03076          res = 0;
03077       }
03078    }
03079 
03080    if (!has_type) {
03081       ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field type\n");
03082       res = 0;
03083    }
03084 
03085    if (!has_application) {
03086       ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field application\n");
03087       res = 0;
03088    }
03089 
03090    if (!has_bridge) {
03091       ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field bridge\n");
03092       res = 0;
03093    }
03094 
03095    return res;
03096 }
03097 
03098 ari_validator ast_ari_validate_channel_entered_bridge_fn(void)
03099 {
03100    return ast_ari_validate_channel_entered_bridge;
03101 }
03102 
03103 int ast_ari_validate_channel_hangup_request(struct ast_json *json)
03104 {
03105    int res = 1;
03106    struct ast_json_iter *iter;
03107    int has_type = 0;
03108    int has_application = 0;
03109    int has_channel = 0;
03110 
03111    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
03112       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
03113          int prop_is_valid;
03114          has_type = 1;
03115          prop_is_valid = ast_ari_validate_string(
03116             ast_json_object_iter_value(iter));
03117          if (!prop_is_valid) {
03118             ast_log(LOG_ERROR, "ARI ChannelHangupRequest field type failed validation\n");
03119             res = 0;
03120          }
03121       } else
03122       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
03123          int prop_is_valid;
03124          has_application = 1;
03125          prop_is_valid = ast_ari_validate_string(
03126             ast_json_object_iter_value(iter));
03127          if (!prop_is_valid) {
03128             ast_log(LOG_ERROR, "ARI ChannelHangupRequest field application failed validation\n");
03129             res = 0;
03130          }
03131       } else
03132       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
03133          int prop_is_valid;
03134          prop_is_valid = ast_ari_validate_date(
03135             ast_json_object_iter_value(iter));
03136          if (!prop_is_valid) {
03137             ast_log(LOG_ERROR, "ARI ChannelHangupRequest field timestamp failed validation\n");
03138             res = 0;
03139          }
03140       } else
03141       if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
03142          int prop_is_valid;
03143          prop_is_valid = ast_ari_validate_int(
03144             ast_json_object_iter_value(iter));
03145          if (!prop_is_valid) {
03146             ast_log(LOG_ERROR, "ARI ChannelHangupRequest field cause failed validation\n");
03147             res = 0;
03148          }
03149       } else
03150       if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
03151          int prop_is_valid;
03152          has_channel = 1;
03153          prop_is_valid = ast_ari_validate_channel(
03154             ast_json_object_iter_value(iter));
03155          if (!prop_is_valid) {
03156             ast_log(LOG_ERROR, "ARI ChannelHangupRequest field channel failed validation\n");
03157             res = 0;
03158          }
03159       } else
03160       if (strcmp("soft", ast_json_object_iter_key(iter)) == 0) {
03161          int prop_is_valid;
03162          prop_is_valid = ast_ari_validate_boolean(
03163             ast_json_object_iter_value(iter));
03164          if (!prop_is_valid) {
03165             ast_log(LOG_ERROR, "ARI ChannelHangupRequest field soft failed validation\n");
03166             res = 0;
03167          }
03168       } else
03169       {
03170          ast_log(LOG_ERROR,
03171             "ARI ChannelHangupRequest has undocumented field %s\n",
03172             ast_json_object_iter_key(iter));
03173          res = 0;
03174       }
03175    }
03176 
03177    if (!has_type) {
03178       ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field type\n");
03179       res = 0;
03180    }
03181 
03182    if (!has_application) {
03183       ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field application\n");
03184       res = 0;
03185    }
03186 
03187    if (!has_channel) {
03188       ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field channel\n");
03189       res = 0;
03190    }
03191 
03192    return res;
03193 }
03194 
03195 ari_validator ast_ari_validate_channel_hangup_request_fn(void)
03196 {
03197    return ast_ari_validate_channel_hangup_request;
03198 }
03199 
03200 int ast_ari_validate_channel_hold(struct ast_json *json)
03201 {
03202    int res = 1;
03203    struct ast_json_iter *iter;
03204    int has_type = 0;
03205    int has_application = 0;
03206    int has_channel = 0;
03207 
03208    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
03209       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
03210          int prop_is_valid;
03211          has_type = 1;
03212          prop_is_valid = ast_ari_validate_string(
03213             ast_json_object_iter_value(iter));
03214          if (!prop_is_valid) {
03215             ast_log(LOG_ERROR, "ARI ChannelHold field type failed validation\n");
03216             res = 0;
03217          }
03218       } else
03219       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
03220          int prop_is_valid;
03221          has_application = 1;
03222          prop_is_valid = ast_ari_validate_string(
03223             ast_json_object_iter_value(iter));
03224          if (!prop_is_valid) {
03225             ast_log(LOG_ERROR, "ARI ChannelHold field application failed validation\n");
03226             res = 0;
03227          }
03228       } else
03229       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
03230          int prop_is_valid;
03231          prop_is_valid = ast_ari_validate_date(
03232             ast_json_object_iter_value(iter));
03233          if (!prop_is_valid) {
03234             ast_log(LOG_ERROR, "ARI ChannelHold field timestamp failed validation\n");
03235             res = 0;
03236          }
03237       } else
03238       if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
03239          int prop_is_valid;
03240          has_channel = 1;
03241          prop_is_valid = ast_ari_validate_channel(
03242             ast_json_object_iter_value(iter));
03243          if (!prop_is_valid) {
03244             ast_log(LOG_ERROR, "ARI ChannelHold field channel failed validation\n");
03245             res = 0;
03246          }
03247       } else
03248       if (strcmp("musicclass", ast_json_object_iter_key(iter)) == 0) {
03249          int prop_is_valid;
03250          prop_is_valid = ast_ari_validate_string(
03251             ast_json_object_iter_value(iter));
03252          if (!prop_is_valid) {
03253             ast_log(LOG_ERROR, "ARI ChannelHold field musicclass failed validation\n");
03254             res = 0;
03255          }
03256       } else
03257       {
03258          ast_log(LOG_ERROR,
03259             "ARI ChannelHold has undocumented field %s\n",
03260             ast_json_object_iter_key(iter));
03261          res = 0;
03262       }
03263    }
03264 
03265    if (!has_type) {
03266       ast_log(LOG_ERROR, "ARI ChannelHold missing required field type\n");
03267       res = 0;
03268    }
03269 
03270    if (!has_application) {
03271       ast_log(LOG_ERROR, "ARI ChannelHold missing required field application\n");
03272       res = 0;
03273    }
03274 
03275    if (!has_channel) {
03276       ast_log(LOG_ERROR, "ARI ChannelHold missing required field channel\n");
03277       res = 0;
03278    }
03279 
03280    return res;
03281 }
03282 
03283 ari_validator ast_ari_validate_channel_hold_fn(void)
03284 {
03285    return ast_ari_validate_channel_hold;
03286 }
03287 
03288 int ast_ari_validate_channel_left_bridge(struct ast_json *json)
03289 {
03290    int res = 1;
03291    struct ast_json_iter *iter;
03292    int has_type = 0;
03293    int has_application = 0;
03294    int has_bridge = 0;
03295    int has_channel = 0;
03296 
03297    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
03298       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
03299          int prop_is_valid;
03300          has_type = 1;
03301          prop_is_valid = ast_ari_validate_string(
03302             ast_json_object_iter_value(iter));
03303          if (!prop_is_valid) {
03304             ast_log(LOG_ERROR, "ARI ChannelLeftBridge field type failed validation\n");
03305             res = 0;
03306          }
03307       } else
03308       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
03309          int prop_is_valid;
03310          has_application = 1;
03311          prop_is_valid = ast_ari_validate_string(
03312             ast_json_object_iter_value(iter));
03313          if (!prop_is_valid) {
03314             ast_log(LOG_ERROR, "ARI ChannelLeftBridge field application failed validation\n");
03315             res = 0;
03316          }
03317       } else
03318       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
03319          int prop_is_valid;
03320          prop_is_valid = ast_ari_validate_date(
03321             ast_json_object_iter_value(iter));
03322          if (!prop_is_valid) {
03323             ast_log(LOG_ERROR, "ARI ChannelLeftBridge field timestamp failed validation\n");
03324             res = 0;
03325          }
03326       } else
03327       if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
03328          int prop_is_valid;
03329          has_bridge = 1;
03330          prop_is_valid = ast_ari_validate_bridge(
03331             ast_json_object_iter_value(iter));
03332          if (!prop_is_valid) {
03333             ast_log(LOG_ERROR, "ARI ChannelLeftBridge field bridge failed validation\n");
03334             res = 0;
03335          }
03336       } else
03337       if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
03338          int prop_is_valid;
03339          has_channel = 1;
03340          prop_is_valid = ast_ari_validate_channel(
03341             ast_json_object_iter_value(iter));
03342          if (!prop_is_valid) {
03343             ast_log(LOG_ERROR, "ARI ChannelLeftBridge field channel failed validation\n");
03344             res = 0;
03345          }
03346       } else
03347       {
03348          ast_log(LOG_ERROR,
03349             "ARI ChannelLeftBridge has undocumented field %s\n",
03350             ast_json_object_iter_key(iter));
03351          res = 0;
03352       }
03353    }
03354 
03355    if (!has_type) {
03356       ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field type\n");
03357       res = 0;
03358    }
03359 
03360    if (!has_application) {
03361       ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field application\n");
03362       res = 0;
03363    }
03364 
03365    if (!has_bridge) {
03366       ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field bridge\n");
03367       res = 0;
03368    }
03369 
03370    if (!has_channel) {
03371       ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field channel\n");
03372       res = 0;
03373    }
03374 
03375    return res;
03376 }
03377 
03378 ari_validator ast_ari_validate_channel_left_bridge_fn(void)
03379 {
03380    return ast_ari_validate_channel_left_bridge;
03381 }
03382 
03383 int ast_ari_validate_channel_state_change(struct ast_json *json)
03384 {
03385    int res = 1;
03386    struct ast_json_iter *iter;
03387    int has_type = 0;
03388    int has_application = 0;
03389    int has_channel = 0;
03390 
03391    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
03392       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
03393          int prop_is_valid;
03394          has_type = 1;
03395          prop_is_valid = ast_ari_validate_string(
03396             ast_json_object_iter_value(iter));
03397          if (!prop_is_valid) {
03398             ast_log(LOG_ERROR, "ARI ChannelStateChange field type failed validation\n");
03399             res = 0;
03400          }
03401       } else
03402       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
03403          int prop_is_valid;
03404          has_application = 1;
03405          prop_is_valid = ast_ari_validate_string(
03406             ast_json_object_iter_value(iter));
03407          if (!prop_is_valid) {
03408             ast_log(LOG_ERROR, "ARI ChannelStateChange field application failed validation\n");
03409             res = 0;
03410          }
03411       } else
03412       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
03413          int prop_is_valid;
03414          prop_is_valid = ast_ari_validate_date(
03415             ast_json_object_iter_value(iter));
03416          if (!prop_is_valid) {
03417             ast_log(LOG_ERROR, "ARI ChannelStateChange field timestamp failed validation\n");
03418             res = 0;
03419          }
03420       } else
03421       if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
03422          int prop_is_valid;
03423          has_channel = 1;
03424          prop_is_valid = ast_ari_validate_channel(
03425             ast_json_object_iter_value(iter));
03426          if (!prop_is_valid) {
03427             ast_log(LOG_ERROR, "ARI ChannelStateChange field channel failed validation\n");
03428             res = 0;
03429          }
03430       } else
03431       {
03432          ast_log(LOG_ERROR,
03433             "ARI ChannelStateChange has undocumented field %s\n",
03434             ast_json_object_iter_key(iter));
03435          res = 0;
03436       }
03437    }
03438 
03439    if (!has_type) {
03440       ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field type\n");
03441       res = 0;
03442    }
03443 
03444    if (!has_application) {
03445       ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field application\n");
03446       res = 0;
03447    }
03448 
03449    if (!has_channel) {
03450       ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field channel\n");
03451       res = 0;
03452    }
03453 
03454    return res;
03455 }
03456 
03457 ari_validator ast_ari_validate_channel_state_change_fn(void)
03458 {
03459    return ast_ari_validate_channel_state_change;
03460 }
03461 
03462 int ast_ari_validate_channel_talking_finished(struct ast_json *json)
03463 {
03464    int res = 1;
03465    struct ast_json_iter *iter;
03466    int has_type = 0;
03467    int has_application = 0;
03468    int has_channel = 0;
03469    int has_duration = 0;
03470 
03471    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
03472       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
03473          int prop_is_valid;
03474          has_type = 1;
03475          prop_is_valid = ast_ari_validate_string(
03476             ast_json_object_iter_value(iter));
03477          if (!prop_is_valid) {
03478             ast_log(LOG_ERROR, "ARI ChannelTalkingFinished field type failed validation\n");
03479             res = 0;
03480          }
03481       } else
03482       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
03483          int prop_is_valid;
03484          has_application = 1;
03485          prop_is_valid = ast_ari_validate_string(
03486             ast_json_object_iter_value(iter));
03487          if (!prop_is_valid) {
03488             ast_log(LOG_ERROR, "ARI ChannelTalkingFinished field application failed validation\n");
03489             res = 0;
03490          }
03491       } else
03492       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
03493          int prop_is_valid;
03494          prop_is_valid = ast_ari_validate_date(
03495             ast_json_object_iter_value(iter));
03496          if (!prop_is_valid) {
03497             ast_log(LOG_ERROR, "ARI ChannelTalkingFinished field timestamp failed validation\n");
03498             res = 0;
03499          }
03500       } else
03501       if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
03502          int prop_is_valid;
03503          has_channel = 1;
03504          prop_is_valid = ast_ari_validate_channel(
03505             ast_json_object_iter_value(iter));
03506          if (!prop_is_valid) {
03507             ast_log(LOG_ERROR, "ARI ChannelTalkingFinished field channel failed validation\n");
03508             res = 0;
03509          }
03510       } else
03511       if (strcmp("duration", ast_json_object_iter_key(iter)) == 0) {
03512          int prop_is_valid;
03513          has_duration = 1;
03514          prop_is_valid = ast_ari_validate_int(
03515             ast_json_object_iter_value(iter));
03516          if (!prop_is_valid) {
03517             ast_log(LOG_ERROR, "ARI ChannelTalkingFinished field duration failed validation\n");
03518             res = 0;
03519          }
03520       } else
03521       {
03522          ast_log(LOG_ERROR,
03523             "ARI ChannelTalkingFinished has undocumented field %s\n",
03524             ast_json_object_iter_key(iter));
03525          res = 0;
03526       }
03527    }
03528 
03529    if (!has_type) {
03530       ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field type\n");
03531       res = 0;
03532    }
03533 
03534    if (!has_application) {
03535       ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field application\n");
03536       res = 0;
03537    }
03538 
03539    if (!has_channel) {
03540       ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field channel\n");
03541       res = 0;
03542    }
03543 
03544    if (!has_duration) {
03545       ast_log(LOG_ERROR, "ARI ChannelTalkingFinished missing required field duration\n");
03546       res = 0;
03547    }
03548 
03549    return res;
03550 }
03551 
03552 ari_validator ast_ari_validate_channel_talking_finished_fn(void)
03553 {
03554    return ast_ari_validate_channel_talking_finished;
03555 }
03556 
03557 int ast_ari_validate_channel_talking_started(struct ast_json *json)
03558 {
03559    int res = 1;
03560    struct ast_json_iter *iter;
03561    int has_type = 0;
03562    int has_application = 0;
03563    int has_channel = 0;
03564 
03565    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
03566       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
03567          int prop_is_valid;
03568          has_type = 1;
03569          prop_is_valid = ast_ari_validate_string(
03570             ast_json_object_iter_value(iter));
03571          if (!prop_is_valid) {
03572             ast_log(LOG_ERROR, "ARI ChannelTalkingStarted field type failed validation\n");
03573             res = 0;
03574          }
03575       } else
03576       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
03577          int prop_is_valid;
03578          has_application = 1;
03579          prop_is_valid = ast_ari_validate_string(
03580             ast_json_object_iter_value(iter));
03581          if (!prop_is_valid) {
03582             ast_log(LOG_ERROR, "ARI ChannelTalkingStarted field application failed validation\n");
03583             res = 0;
03584          }
03585       } else
03586       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
03587          int prop_is_valid;
03588          prop_is_valid = ast_ari_validate_date(
03589             ast_json_object_iter_value(iter));
03590          if (!prop_is_valid) {
03591             ast_log(LOG_ERROR, "ARI ChannelTalkingStarted field timestamp failed validation\n");
03592             res = 0;
03593          }
03594       } else
03595       if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
03596          int prop_is_valid;
03597          has_channel = 1;
03598          prop_is_valid = ast_ari_validate_channel(
03599             ast_json_object_iter_value(iter));
03600          if (!prop_is_valid) {
03601             ast_log(LOG_ERROR, "ARI ChannelTalkingStarted field channel failed validation\n");
03602             res = 0;
03603          }
03604       } else
03605       {
03606          ast_log(LOG_ERROR,
03607             "ARI ChannelTalkingStarted has undocumented field %s\n",
03608             ast_json_object_iter_key(iter));
03609          res = 0;
03610       }
03611    }
03612 
03613    if (!has_type) {
03614       ast_log(LOG_ERROR, "ARI ChannelTalkingStarted missing required field type\n");
03615       res = 0;
03616    }
03617 
03618    if (!has_application) {
03619       ast_log(LOG_ERROR, "ARI ChannelTalkingStarted missing required field application\n");
03620       res = 0;
03621    }
03622 
03623    if (!has_channel) {
03624       ast_log(LOG_ERROR, "ARI ChannelTalkingStarted missing required field channel\n");
03625       res = 0;
03626    }
03627 
03628    return res;
03629 }
03630 
03631 ari_validator ast_ari_validate_channel_talking_started_fn(void)
03632 {
03633    return ast_ari_validate_channel_talking_started;
03634 }
03635 
03636 int ast_ari_validate_channel_unhold(struct ast_json *json)
03637 {
03638    int res = 1;
03639    struct ast_json_iter *iter;
03640    int has_type = 0;
03641    int has_application = 0;
03642    int has_channel = 0;
03643 
03644    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
03645       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
03646          int prop_is_valid;
03647          has_type = 1;
03648          prop_is_valid = ast_ari_validate_string(
03649             ast_json_object_iter_value(iter));
03650          if (!prop_is_valid) {
03651             ast_log(LOG_ERROR, "ARI ChannelUnhold field type failed validation\n");
03652             res = 0;
03653          }
03654       } else
03655       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
03656          int prop_is_valid;
03657          has_application = 1;
03658          prop_is_valid = ast_ari_validate_string(
03659             ast_json_object_iter_value(iter));
03660          if (!prop_is_valid) {
03661             ast_log(LOG_ERROR, "ARI ChannelUnhold field application failed validation\n");
03662             res = 0;
03663          }
03664       } else
03665       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
03666          int prop_is_valid;
03667          prop_is_valid = ast_ari_validate_date(
03668             ast_json_object_iter_value(iter));
03669          if (!prop_is_valid) {
03670             ast_log(LOG_ERROR, "ARI ChannelUnhold field timestamp failed validation\n");
03671             res = 0;
03672          }
03673       } else
03674       if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
03675          int prop_is_valid;
03676          has_channel = 1;
03677          prop_is_valid = ast_ari_validate_channel(
03678             ast_json_object_iter_value(iter));
03679          if (!prop_is_valid) {
03680             ast_log(LOG_ERROR, "ARI ChannelUnhold field channel failed validation\n");
03681             res = 0;
03682          }
03683       } else
03684       {
03685          ast_log(LOG_ERROR,
03686             "ARI ChannelUnhold has undocumented field %s\n",
03687             ast_json_object_iter_key(iter));
03688          res = 0;
03689       }
03690    }
03691 
03692    if (!has_type) {
03693       ast_log(LOG_ERROR, "ARI ChannelUnhold missing required field type\n");
03694       res = 0;
03695    }
03696 
03697    if (!has_application) {
03698       ast_log(LOG_ERROR, "ARI ChannelUnhold missing required field application\n");
03699       res = 0;
03700    }
03701 
03702    if (!has_channel) {
03703       ast_log(LOG_ERROR, "ARI ChannelUnhold missing required field channel\n");
03704       res = 0;
03705    }
03706 
03707    return res;
03708 }
03709 
03710 ari_validator ast_ari_validate_channel_unhold_fn(void)
03711 {
03712    return ast_ari_validate_channel_unhold;
03713 }
03714 
03715 int ast_ari_validate_channel_userevent(struct ast_json *json)
03716 {
03717    int res = 1;
03718    struct ast_json_iter *iter;
03719    int has_type = 0;
03720    int has_application = 0;
03721    int has_eventname = 0;
03722    int has_userevent = 0;
03723 
03724    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
03725       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
03726          int prop_is_valid;
03727          has_type = 1;
03728          prop_is_valid = ast_ari_validate_string(
03729             ast_json_object_iter_value(iter));
03730          if (!prop_is_valid) {
03731             ast_log(LOG_ERROR, "ARI ChannelUserevent field type failed validation\n");
03732             res = 0;
03733          }
03734       } else
03735       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
03736          int prop_is_valid;
03737          has_application = 1;
03738          prop_is_valid = ast_ari_validate_string(
03739             ast_json_object_iter_value(iter));
03740          if (!prop_is_valid) {
03741             ast_log(LOG_ERROR, "ARI ChannelUserevent field application failed validation\n");
03742             res = 0;
03743          }
03744       } else
03745       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
03746          int prop_is_valid;
03747          prop_is_valid = ast_ari_validate_date(
03748             ast_json_object_iter_value(iter));
03749          if (!prop_is_valid) {
03750             ast_log(LOG_ERROR, "ARI ChannelUserevent field timestamp failed validation\n");
03751             res = 0;
03752          }
03753       } else
03754       if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
03755          int prop_is_valid;
03756          prop_is_valid = ast_ari_validate_bridge(
03757             ast_json_object_iter_value(iter));
03758          if (!prop_is_valid) {
03759             ast_log(LOG_ERROR, "ARI ChannelUserevent field bridge failed validation\n");
03760             res = 0;
03761          }
03762       } else
03763       if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
03764          int prop_is_valid;
03765          prop_is_valid = ast_ari_validate_channel(
03766             ast_json_object_iter_value(iter));
03767          if (!prop_is_valid) {
03768             ast_log(LOG_ERROR, "ARI ChannelUserevent field channel failed validation\n");
03769             res = 0;
03770          }
03771       } else
03772       if (strcmp("endpoint", ast_json_object_iter_key(iter)) == 0) {
03773          int prop_is_valid;
03774          prop_is_valid = ast_ari_validate_endpoint(
03775             ast_json_object_iter_value(iter));
03776          if (!prop_is_valid) {
03777             ast_log(LOG_ERROR, "ARI ChannelUserevent field endpoint failed validation\n");
03778             res = 0;
03779          }
03780       } else
03781       if (strcmp("eventname", ast_json_object_iter_key(iter)) == 0) {
03782          int prop_is_valid;
03783          has_eventname = 1;
03784          prop_is_valid = ast_ari_validate_string(
03785             ast_json_object_iter_value(iter));
03786          if (!prop_is_valid) {
03787             ast_log(LOG_ERROR, "ARI ChannelUserevent field eventname failed validation\n");
03788             res = 0;
03789          }
03790       } else
03791       if (strcmp("userevent", ast_json_object_iter_key(iter)) == 0) {
03792          int prop_is_valid;
03793          has_userevent = 1;
03794          prop_is_valid = ast_ari_validate_object(
03795             ast_json_object_iter_value(iter));
03796          if (!prop_is_valid) {
03797             ast_log(LOG_ERROR, "ARI ChannelUserevent field userevent failed validation\n");
03798             res = 0;
03799          }
03800       } else
03801       {
03802          ast_log(LOG_ERROR,
03803             "ARI ChannelUserevent has undocumented field %s\n",
03804             ast_json_object_iter_key(iter));
03805          res = 0;
03806       }
03807    }
03808 
03809    if (!has_type) {
03810       ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field type\n");
03811       res = 0;
03812    }
03813 
03814    if (!has_application) {
03815       ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field application\n");
03816       res = 0;
03817    }
03818 
03819    if (!has_eventname) {
03820       ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field eventname\n");
03821       res = 0;
03822    }
03823 
03824    if (!has_userevent) {
03825       ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field userevent\n");
03826       res = 0;
03827    }
03828 
03829    return res;
03830 }
03831 
03832 ari_validator ast_ari_validate_channel_userevent_fn(void)
03833 {
03834    return ast_ari_validate_channel_userevent;
03835 }
03836 
03837 int ast_ari_validate_channel_varset(struct ast_json *json)
03838 {
03839    int res = 1;
03840    struct ast_json_iter *iter;
03841    int has_type = 0;
03842    int has_application = 0;
03843    int has_value = 0;
03844    int has_variable = 0;
03845 
03846    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
03847       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
03848          int prop_is_valid;
03849          has_type = 1;
03850          prop_is_valid = ast_ari_validate_string(
03851             ast_json_object_iter_value(iter));
03852          if (!prop_is_valid) {
03853             ast_log(LOG_ERROR, "ARI ChannelVarset field type failed validation\n");
03854             res = 0;
03855          }
03856       } else
03857       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
03858          int prop_is_valid;
03859          has_application = 1;
03860          prop_is_valid = ast_ari_validate_string(
03861             ast_json_object_iter_value(iter));
03862          if (!prop_is_valid) {
03863             ast_log(LOG_ERROR, "ARI ChannelVarset field application failed validation\n");
03864             res = 0;
03865          }
03866       } else
03867       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
03868          int prop_is_valid;
03869          prop_is_valid = ast_ari_validate_date(
03870             ast_json_object_iter_value(iter));
03871          if (!prop_is_valid) {
03872             ast_log(LOG_ERROR, "ARI ChannelVarset field timestamp failed validation\n");
03873             res = 0;
03874          }
03875       } else
03876       if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
03877          int prop_is_valid;
03878          prop_is_valid = ast_ari_validate_channel(
03879             ast_json_object_iter_value(iter));
03880          if (!prop_is_valid) {
03881             ast_log(LOG_ERROR, "ARI ChannelVarset field channel failed validation\n");
03882             res = 0;
03883          }
03884       } else
03885       if (strcmp("value", ast_json_object_iter_key(iter)) == 0) {
03886          int prop_is_valid;
03887          has_value = 1;
03888          prop_is_valid = ast_ari_validate_string(
03889             ast_json_object_iter_value(iter));
03890          if (!prop_is_valid) {
03891             ast_log(LOG_ERROR, "ARI ChannelVarset field value failed validation\n");
03892             res = 0;
03893          }
03894       } else
03895       if (strcmp("variable", ast_json_object_iter_key(iter)) == 0) {
03896          int prop_is_valid;
03897          has_variable = 1;
03898          prop_is_valid = ast_ari_validate_string(
03899             ast_json_object_iter_value(iter));
03900          if (!prop_is_valid) {
03901             ast_log(LOG_ERROR, "ARI ChannelVarset field variable failed validation\n");
03902             res = 0;
03903          }
03904       } else
03905       {
03906          ast_log(LOG_ERROR,
03907             "ARI ChannelVarset has undocumented field %s\n",
03908             ast_json_object_iter_key(iter));
03909          res = 0;
03910       }
03911    }
03912 
03913    if (!has_type) {
03914       ast_log(LOG_ERROR, "ARI ChannelVarset missing required field type\n");
03915       res = 0;
03916    }
03917 
03918    if (!has_application) {
03919       ast_log(LOG_ERROR, "ARI ChannelVarset missing required field application\n");
03920       res = 0;
03921    }
03922 
03923    if (!has_value) {
03924       ast_log(LOG_ERROR, "ARI ChannelVarset missing required field value\n");
03925       res = 0;
03926    }
03927 
03928    if (!has_variable) {
03929       ast_log(LOG_ERROR, "ARI ChannelVarset missing required field variable\n");
03930       res = 0;
03931    }
03932 
03933    return res;
03934 }
03935 
03936 ari_validator ast_ari_validate_channel_varset_fn(void)
03937 {
03938    return ast_ari_validate_channel_varset;
03939 }
03940 
03941 int ast_ari_validate_device_state_changed(struct ast_json *json)
03942 {
03943    int res = 1;
03944    struct ast_json_iter *iter;
03945    int has_type = 0;
03946    int has_application = 0;
03947    int has_device_state = 0;
03948 
03949    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
03950       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
03951          int prop_is_valid;
03952          has_type = 1;
03953          prop_is_valid = ast_ari_validate_string(
03954             ast_json_object_iter_value(iter));
03955          if (!prop_is_valid) {
03956             ast_log(LOG_ERROR, "ARI DeviceStateChanged field type failed validation\n");
03957             res = 0;
03958          }
03959       } else
03960       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
03961          int prop_is_valid;
03962          has_application = 1;
03963          prop_is_valid = ast_ari_validate_string(
03964             ast_json_object_iter_value(iter));
03965          if (!prop_is_valid) {
03966             ast_log(LOG_ERROR, "ARI DeviceStateChanged field application failed validation\n");
03967             res = 0;
03968          }
03969       } else
03970       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
03971          int prop_is_valid;
03972          prop_is_valid = ast_ari_validate_date(
03973             ast_json_object_iter_value(iter));
03974          if (!prop_is_valid) {
03975             ast_log(LOG_ERROR, "ARI DeviceStateChanged field timestamp failed validation\n");
03976             res = 0;
03977          }
03978       } else
03979       if (strcmp("device_state", ast_json_object_iter_key(iter)) == 0) {
03980          int prop_is_valid;
03981          has_device_state = 1;
03982          prop_is_valid = ast_ari_validate_device_state(
03983             ast_json_object_iter_value(iter));
03984          if (!prop_is_valid) {
03985             ast_log(LOG_ERROR, "ARI DeviceStateChanged field device_state failed validation\n");
03986             res = 0;
03987          }
03988       } else
03989       {
03990          ast_log(LOG_ERROR,
03991             "ARI DeviceStateChanged has undocumented field %s\n",
03992             ast_json_object_iter_key(iter));
03993          res = 0;
03994       }
03995    }
03996 
03997    if (!has_type) {
03998       ast_log(LOG_ERROR, "ARI DeviceStateChanged missing required field type\n");
03999       res = 0;
04000    }
04001 
04002    if (!has_application) {
04003       ast_log(LOG_ERROR, "ARI DeviceStateChanged missing required field application\n");
04004       res = 0;
04005    }
04006 
04007    if (!has_device_state) {
04008       ast_log(LOG_ERROR, "ARI DeviceStateChanged missing required field device_state\n");
04009       res = 0;
04010    }
04011 
04012    return res;
04013 }
04014 
04015 ari_validator ast_ari_validate_device_state_changed_fn(void)
04016 {
04017    return ast_ari_validate_device_state_changed;
04018 }
04019 
04020 int ast_ari_validate_dial(struct ast_json *json)
04021 {
04022    int res = 1;
04023    struct ast_json_iter *iter;
04024    int has_type = 0;
04025    int has_application = 0;
04026    int has_dialstatus = 0;
04027    int has_peer = 0;
04028 
04029    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
04030       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
04031          int prop_is_valid;
04032          has_type = 1;
04033          prop_is_valid = ast_ari_validate_string(
04034             ast_json_object_iter_value(iter));
04035          if (!prop_is_valid) {
04036             ast_log(LOG_ERROR, "ARI Dial field type failed validation\n");
04037             res = 0;
04038          }
04039       } else
04040       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
04041          int prop_is_valid;
04042          has_application = 1;
04043          prop_is_valid = ast_ari_validate_string(
04044             ast_json_object_iter_value(iter));
04045          if (!prop_is_valid) {
04046             ast_log(LOG_ERROR, "ARI Dial field application failed validation\n");
04047             res = 0;
04048          }
04049       } else
04050       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
04051          int prop_is_valid;
04052          prop_is_valid = ast_ari_validate_date(
04053             ast_json_object_iter_value(iter));
04054          if (!prop_is_valid) {
04055             ast_log(LOG_ERROR, "ARI Dial field timestamp failed validation\n");
04056             res = 0;
04057          }
04058       } else
04059       if (strcmp("caller", ast_json_object_iter_key(iter)) == 0) {
04060          int prop_is_valid;
04061          prop_is_valid = ast_ari_validate_channel(
04062             ast_json_object_iter_value(iter));
04063          if (!prop_is_valid) {
04064             ast_log(LOG_ERROR, "ARI Dial field caller failed validation\n");
04065             res = 0;
04066          }
04067       } else
04068       if (strcmp("dialstatus", ast_json_object_iter_key(iter)) == 0) {
04069          int prop_is_valid;
04070          has_dialstatus = 1;
04071          prop_is_valid = ast_ari_validate_string(
04072             ast_json_object_iter_value(iter));
04073          if (!prop_is_valid) {
04074             ast_log(LOG_ERROR, "ARI Dial field dialstatus failed validation\n");
04075             res = 0;
04076          }
04077       } else
04078       if (strcmp("dialstring", ast_json_object_iter_key(iter)) == 0) {
04079          int prop_is_valid;
04080          prop_is_valid = ast_ari_validate_string(
04081             ast_json_object_iter_value(iter));
04082          if (!prop_is_valid) {
04083             ast_log(LOG_ERROR, "ARI Dial field dialstring failed validation\n");
04084             res = 0;
04085          }
04086       } else
04087       if (strcmp("forward", ast_json_object_iter_key(iter)) == 0) {
04088          int prop_is_valid;
04089          prop_is_valid = ast_ari_validate_string(
04090             ast_json_object_iter_value(iter));
04091          if (!prop_is_valid) {
04092             ast_log(LOG_ERROR, "ARI Dial field forward failed validation\n");
04093             res = 0;
04094          }
04095       } else
04096       if (strcmp("forwarded", ast_json_object_iter_key(iter)) == 0) {
04097          int prop_is_valid;
04098          prop_is_valid = ast_ari_validate_channel(
04099             ast_json_object_iter_value(iter));
04100          if (!prop_is_valid) {
04101             ast_log(LOG_ERROR, "ARI Dial field forwarded failed validation\n");
04102             res = 0;
04103          }
04104       } else
04105       if (strcmp("peer", ast_json_object_iter_key(iter)) == 0) {
04106          int prop_is_valid;
04107          has_peer = 1;
04108          prop_is_valid = ast_ari_validate_channel(
04109             ast_json_object_iter_value(iter));
04110          if (!prop_is_valid) {
04111             ast_log(LOG_ERROR, "ARI Dial field peer failed validation\n");
04112             res = 0;
04113          }
04114       } else
04115       {
04116          ast_log(LOG_ERROR,
04117             "ARI Dial has undocumented field %s\n",
04118             ast_json_object_iter_key(iter));
04119          res = 0;
04120       }
04121    }
04122 
04123    if (!has_type) {
04124       ast_log(LOG_ERROR, "ARI Dial missing required field type\n");
04125       res = 0;
04126    }
04127 
04128    if (!has_application) {
04129       ast_log(LOG_ERROR, "ARI Dial missing required field application\n");
04130       res = 0;
04131    }
04132 
04133    if (!has_dialstatus) {
04134       ast_log(LOG_ERROR, "ARI Dial missing required field dialstatus\n");
04135       res = 0;
04136    }
04137 
04138    if (!has_peer) {
04139       ast_log(LOG_ERROR, "ARI Dial missing required field peer\n");
04140       res = 0;
04141    }
04142 
04143    return res;
04144 }
04145 
04146 ari_validator ast_ari_validate_dial_fn(void)
04147 {
04148    return ast_ari_validate_dial;
04149 }
04150 
04151 int ast_ari_validate_endpoint_state_change(struct ast_json *json)
04152 {
04153    int res = 1;
04154    struct ast_json_iter *iter;
04155    int has_type = 0;
04156    int has_application = 0;
04157    int has_endpoint = 0;
04158 
04159    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
04160       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
04161          int prop_is_valid;
04162          has_type = 1;
04163          prop_is_valid = ast_ari_validate_string(
04164             ast_json_object_iter_value(iter));
04165          if (!prop_is_valid) {
04166             ast_log(LOG_ERROR, "ARI EndpointStateChange field type failed validation\n");
04167             res = 0;
04168          }
04169       } else
04170       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
04171          int prop_is_valid;
04172          has_application = 1;
04173          prop_is_valid = ast_ari_validate_string(
04174             ast_json_object_iter_value(iter));
04175          if (!prop_is_valid) {
04176             ast_log(LOG_ERROR, "ARI EndpointStateChange field application failed validation\n");
04177             res = 0;
04178          }
04179       } else
04180       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
04181          int prop_is_valid;
04182          prop_is_valid = ast_ari_validate_date(
04183             ast_json_object_iter_value(iter));
04184          if (!prop_is_valid) {
04185             ast_log(LOG_ERROR, "ARI EndpointStateChange field timestamp failed validation\n");
04186             res = 0;
04187          }
04188       } else
04189       if (strcmp("endpoint", ast_json_object_iter_key(iter)) == 0) {
04190          int prop_is_valid;
04191          has_endpoint = 1;
04192          prop_is_valid = ast_ari_validate_endpoint(
04193             ast_json_object_iter_value(iter));
04194          if (!prop_is_valid) {
04195             ast_log(LOG_ERROR, "ARI EndpointStateChange field endpoint failed validation\n");
04196             res = 0;
04197          }
04198       } else
04199       {
04200          ast_log(LOG_ERROR,
04201             "ARI EndpointStateChange has undocumented field %s\n",
04202             ast_json_object_iter_key(iter));
04203          res = 0;
04204       }
04205    }
04206 
04207    if (!has_type) {
04208       ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field type\n");
04209       res = 0;
04210    }
04211 
04212    if (!has_application) {
04213       ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field application\n");
04214       res = 0;
04215    }
04216 
04217    if (!has_endpoint) {
04218       ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field endpoint\n");
04219       res = 0;
04220    }
04221 
04222    return res;
04223 }
04224 
04225 ari_validator ast_ari_validate_endpoint_state_change_fn(void)
04226 {
04227    return ast_ari_validate_endpoint_state_change;
04228 }
04229 
04230 int ast_ari_validate_event(struct ast_json *json)
04231 {
04232    int res = 1;
04233    struct ast_json_iter *iter;
04234    int has_type = 0;
04235    int has_application = 0;
04236    const char *discriminator;
04237 
04238    discriminator = ast_json_string_get(ast_json_object_get(json, "type"));
04239    if (!discriminator) {
04240       ast_log(LOG_ERROR, "ARI Event missing required field type");
04241       return 0;
04242    }
04243 
04244    if (strcmp("Event", discriminator) == 0) {
04245       /* Self type; fall through */
04246    } else
04247    if (strcmp("ApplicationReplaced", discriminator) == 0) {
04248       return ast_ari_validate_application_replaced(json);
04249    } else
04250    if (strcmp("BridgeAttendedTransfer", discriminator) == 0) {
04251       return ast_ari_validate_bridge_attended_transfer(json);
04252    } else
04253    if (strcmp("BridgeBlindTransfer", discriminator) == 0) {
04254       return ast_ari_validate_bridge_blind_transfer(json);
04255    } else
04256    if (strcmp("BridgeCreated", discriminator) == 0) {
04257       return ast_ari_validate_bridge_created(json);
04258    } else
04259    if (strcmp("BridgeDestroyed", discriminator) == 0) {
04260       return ast_ari_validate_bridge_destroyed(json);
04261    } else
04262    if (strcmp("BridgeMerged", discriminator) == 0) {
04263       return ast_ari_validate_bridge_merged(json);
04264    } else
04265    if (strcmp("ChannelCallerId", discriminator) == 0) {
04266       return ast_ari_validate_channel_caller_id(json);
04267    } else
04268    if (strcmp("ChannelConnectedLine", discriminator) == 0) {
04269       return ast_ari_validate_channel_connected_line(json);
04270    } else
04271    if (strcmp("ChannelCreated", discriminator) == 0) {
04272       return ast_ari_validate_channel_created(json);
04273    } else
04274    if (strcmp("ChannelDestroyed", discriminator) == 0) {
04275       return ast_ari_validate_channel_destroyed(json);
04276    } else
04277    if (strcmp("ChannelDialplan", discriminator) == 0) {
04278       return ast_ari_validate_channel_dialplan(json);
04279    } else
04280    if (strcmp("ChannelDtmfReceived", discriminator) == 0) {
04281       return ast_ari_validate_channel_dtmf_received(json);
04282    } else
04283    if (strcmp("ChannelEnteredBridge", discriminator) == 0) {
04284       return ast_ari_validate_channel_entered_bridge(json);
04285    } else
04286    if (strcmp("ChannelHangupRequest", discriminator) == 0) {
04287       return ast_ari_validate_channel_hangup_request(json);
04288    } else
04289    if (strcmp("ChannelHold", discriminator) == 0) {
04290       return ast_ari_validate_channel_hold(json);
04291    } else
04292    if (strcmp("ChannelLeftBridge", discriminator) == 0) {
04293       return ast_ari_validate_channel_left_bridge(json);
04294    } else
04295    if (strcmp("ChannelStateChange", discriminator) == 0) {
04296       return ast_ari_validate_channel_state_change(json);
04297    } else
04298    if (strcmp("ChannelTalkingFinished", discriminator) == 0) {
04299       return ast_ari_validate_channel_talking_finished(json);
04300    } else
04301    if (strcmp("ChannelTalkingStarted", discriminator) == 0) {
04302       return ast_ari_validate_channel_talking_started(json);
04303    } else
04304    if (strcmp("ChannelUnhold", discriminator) == 0) {
04305       return ast_ari_validate_channel_unhold(json);
04306    } else
04307    if (strcmp("ChannelUserevent", discriminator) == 0) {
04308       return ast_ari_validate_channel_userevent(json);
04309    } else
04310    if (strcmp("ChannelVarset", discriminator) == 0) {
04311       return ast_ari_validate_channel_varset(json);
04312    } else
04313    if (strcmp("DeviceStateChanged", discriminator) == 0) {
04314       return ast_ari_validate_device_state_changed(json);
04315    } else
04316    if (strcmp("Dial", discriminator) == 0) {
04317       return ast_ari_validate_dial(json);
04318    } else
04319    if (strcmp("EndpointStateChange", discriminator) == 0) {
04320       return ast_ari_validate_endpoint_state_change(json);
04321    } else
04322    if (strcmp("PlaybackFinished", discriminator) == 0) {
04323       return ast_ari_validate_playback_finished(json);
04324    } else
04325    if (strcmp("PlaybackStarted", discriminator) == 0) {
04326       return ast_ari_validate_playback_started(json);
04327    } else
04328    if (strcmp("RecordingFailed", discriminator) == 0) {
04329       return ast_ari_validate_recording_failed(json);
04330    } else
04331    if (strcmp("RecordingFinished", discriminator) == 0) {
04332       return ast_ari_validate_recording_finished(json);
04333    } else
04334    if (strcmp("RecordingStarted", discriminator) == 0) {
04335       return ast_ari_validate_recording_started(json);
04336    } else
04337    if (strcmp("StasisEnd", discriminator) == 0) {
04338       return ast_ari_validate_stasis_end(json);
04339    } else
04340    if (strcmp("StasisStart", discriminator) == 0) {
04341       return ast_ari_validate_stasis_start(json);
04342    } else
04343    if (strcmp("TextMessageReceived", discriminator) == 0) {
04344       return ast_ari_validate_text_message_received(json);
04345    } else
04346    {
04347       ast_log(LOG_ERROR, "ARI Event has undocumented subtype %s\n",
04348          discriminator);
04349       res = 0;
04350    }
04351 
04352    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
04353       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
04354          int prop_is_valid;
04355          has_type = 1;
04356          prop_is_valid = ast_ari_validate_string(
04357             ast_json_object_iter_value(iter));
04358          if (!prop_is_valid) {
04359             ast_log(LOG_ERROR, "ARI Event field type failed validation\n");
04360             res = 0;
04361          }
04362       } else
04363       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
04364          int prop_is_valid;
04365          has_application = 1;
04366          prop_is_valid = ast_ari_validate_string(
04367             ast_json_object_iter_value(iter));
04368          if (!prop_is_valid) {
04369             ast_log(LOG_ERROR, "ARI Event field application failed validation\n");
04370             res = 0;
04371          }
04372       } else
04373       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
04374          int prop_is_valid;
04375          prop_is_valid = ast_ari_validate_date(
04376             ast_json_object_iter_value(iter));
04377          if (!prop_is_valid) {
04378             ast_log(LOG_ERROR, "ARI Event field timestamp failed validation\n");
04379             res = 0;
04380          }
04381       } else
04382       {
04383          ast_log(LOG_ERROR,
04384             "ARI Event has undocumented field %s\n",
04385             ast_json_object_iter_key(iter));
04386          res = 0;
04387       }
04388    }
04389 
04390    if (!has_type) {
04391       ast_log(LOG_ERROR, "ARI Event missing required field type\n");
04392       res = 0;
04393    }
04394 
04395    if (!has_application) {
04396       ast_log(LOG_ERROR, "ARI Event missing required field application\n");
04397       res = 0;
04398    }
04399 
04400    return res;
04401 }
04402 
04403 ari_validator ast_ari_validate_event_fn(void)
04404 {
04405    return ast_ari_validate_event;
04406 }
04407 
04408 int ast_ari_validate_message(struct ast_json *json)
04409 {
04410    int res = 1;
04411    struct ast_json_iter *iter;
04412    int has_type = 0;
04413    const char *discriminator;
04414 
04415    discriminator = ast_json_string_get(ast_json_object_get(json, "type"));
04416    if (!discriminator) {
04417       ast_log(LOG_ERROR, "ARI Message missing required field type");
04418       return 0;
04419    }
04420 
04421    if (strcmp("Message", discriminator) == 0) {
04422       /* Self type; fall through */
04423    } else
04424    if (strcmp("ApplicationReplaced", discriminator) == 0) {
04425       return ast_ari_validate_application_replaced(json);
04426    } else
04427    if (strcmp("BridgeAttendedTransfer", discriminator) == 0) {
04428       return ast_ari_validate_bridge_attended_transfer(json);
04429    } else
04430    if (strcmp("BridgeBlindTransfer", discriminator) == 0) {
04431       return ast_ari_validate_bridge_blind_transfer(json);
04432    } else
04433    if (strcmp("BridgeCreated", discriminator) == 0) {
04434       return ast_ari_validate_bridge_created(json);
04435    } else
04436    if (strcmp("BridgeDestroyed", discriminator) == 0) {
04437       return ast_ari_validate_bridge_destroyed(json);
04438    } else
04439    if (strcmp("BridgeMerged", discriminator) == 0) {
04440       return ast_ari_validate_bridge_merged(json);
04441    } else
04442    if (strcmp("ChannelCallerId", discriminator) == 0) {
04443       return ast_ari_validate_channel_caller_id(json);
04444    } else
04445    if (strcmp("ChannelConnectedLine", discriminator) == 0) {
04446       return ast_ari_validate_channel_connected_line(json);
04447    } else
04448    if (strcmp("ChannelCreated", discriminator) == 0) {
04449       return ast_ari_validate_channel_created(json);
04450    } else
04451    if (strcmp("ChannelDestroyed", discriminator) == 0) {
04452       return ast_ari_validate_channel_destroyed(json);
04453    } else
04454    if (strcmp("ChannelDialplan", discriminator) == 0) {
04455       return ast_ari_validate_channel_dialplan(json);
04456    } else
04457    if (strcmp("ChannelDtmfReceived", discriminator) == 0) {
04458       return ast_ari_validate_channel_dtmf_received(json);
04459    } else
04460    if (strcmp("ChannelEnteredBridge", discriminator) == 0) {
04461       return ast_ari_validate_channel_entered_bridge(json);
04462    } else
04463    if (strcmp("ChannelHangupRequest", discriminator) == 0) {
04464       return ast_ari_validate_channel_hangup_request(json);
04465    } else
04466    if (strcmp("ChannelHold", discriminator) == 0) {
04467       return ast_ari_validate_channel_hold(json);
04468    } else
04469    if (strcmp("ChannelLeftBridge", discriminator) == 0) {
04470       return ast_ari_validate_channel_left_bridge(json);
04471    } else
04472    if (strcmp("ChannelStateChange", discriminator) == 0) {
04473       return ast_ari_validate_channel_state_change(json);
04474    } else
04475    if (strcmp("ChannelTalkingFinished", discriminator) == 0) {
04476       return ast_ari_validate_channel_talking_finished(json);
04477    } else
04478    if (strcmp("ChannelTalkingStarted", discriminator) == 0) {
04479       return ast_ari_validate_channel_talking_started(json);
04480    } else
04481    if (strcmp("ChannelUnhold", discriminator) == 0) {
04482       return ast_ari_validate_channel_unhold(json);
04483    } else
04484    if (strcmp("ChannelUserevent", discriminator) == 0) {
04485       return ast_ari_validate_channel_userevent(json);
04486    } else
04487    if (strcmp("ChannelVarset", discriminator) == 0) {
04488       return ast_ari_validate_channel_varset(json);
04489    } else
04490    if (strcmp("DeviceStateChanged", discriminator) == 0) {
04491       return ast_ari_validate_device_state_changed(json);
04492    } else
04493    if (strcmp("Dial", discriminator) == 0) {
04494       return ast_ari_validate_dial(json);
04495    } else
04496    if (strcmp("EndpointStateChange", discriminator) == 0) {
04497       return ast_ari_validate_endpoint_state_change(json);
04498    } else
04499    if (strcmp("Event", discriminator) == 0) {
04500       return ast_ari_validate_event(json);
04501    } else
04502    if (strcmp("MissingParams", discriminator) == 0) {
04503       return ast_ari_validate_missing_params(json);
04504    } else
04505    if (strcmp("PlaybackFinished", discriminator) == 0) {
04506       return ast_ari_validate_playback_finished(json);
04507    } else
04508    if (strcmp("PlaybackStarted", discriminator) == 0) {
04509       return ast_ari_validate_playback_started(json);
04510    } else
04511    if (strcmp("RecordingFailed", discriminator) == 0) {
04512       return ast_ari_validate_recording_failed(json);
04513    } else
04514    if (strcmp("RecordingFinished", discriminator) == 0) {
04515       return ast_ari_validate_recording_finished(json);
04516    } else
04517    if (strcmp("RecordingStarted", discriminator) == 0) {
04518       return ast_ari_validate_recording_started(json);
04519    } else
04520    if (strcmp("StasisEnd", discriminator) == 0) {
04521       return ast_ari_validate_stasis_end(json);
04522    } else
04523    if (strcmp("StasisStart", discriminator) == 0) {
04524       return ast_ari_validate_stasis_start(json);
04525    } else
04526    if (strcmp("TextMessageReceived", discriminator) == 0) {
04527       return ast_ari_validate_text_message_received(json);
04528    } else
04529    {
04530       ast_log(LOG_ERROR, "ARI Message has undocumented subtype %s\n",
04531          discriminator);
04532       res = 0;
04533    }
04534 
04535    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
04536       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
04537          int prop_is_valid;
04538          has_type = 1;
04539          prop_is_valid = ast_ari_validate_string(
04540             ast_json_object_iter_value(iter));
04541          if (!prop_is_valid) {
04542             ast_log(LOG_ERROR, "ARI Message field type failed validation\n");
04543             res = 0;
04544          }
04545       } else
04546       {
04547          ast_log(LOG_ERROR,
04548             "ARI Message has undocumented field %s\n",
04549             ast_json_object_iter_key(iter));
04550          res = 0;
04551       }
04552    }
04553 
04554    if (!has_type) {
04555       ast_log(LOG_ERROR, "ARI Message missing required field type\n");
04556       res = 0;
04557    }
04558 
04559    return res;
04560 }
04561 
04562 ari_validator ast_ari_validate_message_fn(void)
04563 {
04564    return ast_ari_validate_message;
04565 }
04566 
04567 int ast_ari_validate_missing_params(struct ast_json *json)
04568 {
04569    int res = 1;
04570    struct ast_json_iter *iter;
04571    int has_type = 0;
04572    int has_params = 0;
04573 
04574    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
04575       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
04576          int prop_is_valid;
04577          has_type = 1;
04578          prop_is_valid = ast_ari_validate_string(
04579             ast_json_object_iter_value(iter));
04580          if (!prop_is_valid) {
04581             ast_log(LOG_ERROR, "ARI MissingParams field type failed validation\n");
04582             res = 0;
04583          }
04584       } else
04585       if (strcmp("params", ast_json_object_iter_key(iter)) == 0) {
04586          int prop_is_valid;
04587          has_params = 1;
04588          prop_is_valid = ast_ari_validate_list(
04589             ast_json_object_iter_value(iter),
04590             ast_ari_validate_string);
04591          if (!prop_is_valid) {
04592             ast_log(LOG_ERROR, "ARI MissingParams field params failed validation\n");
04593             res = 0;
04594          }
04595       } else
04596       {
04597          ast_log(LOG_ERROR,
04598             "ARI MissingParams has undocumented field %s\n",
04599             ast_json_object_iter_key(iter));
04600          res = 0;
04601       }
04602    }
04603 
04604    if (!has_type) {
04605       ast_log(LOG_ERROR, "ARI MissingParams missing required field type\n");
04606       res = 0;
04607    }
04608 
04609    if (!has_params) {
04610       ast_log(LOG_ERROR, "ARI MissingParams missing required field params\n");
04611       res = 0;
04612    }
04613 
04614    return res;
04615 }
04616 
04617 ari_validator ast_ari_validate_missing_params_fn(void)
04618 {
04619    return ast_ari_validate_missing_params;
04620 }
04621 
04622 int ast_ari_validate_playback_finished(struct ast_json *json)
04623 {
04624    int res = 1;
04625    struct ast_json_iter *iter;
04626    int has_type = 0;
04627    int has_application = 0;
04628    int has_playback = 0;
04629 
04630    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
04631       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
04632          int prop_is_valid;
04633          has_type = 1;
04634          prop_is_valid = ast_ari_validate_string(
04635             ast_json_object_iter_value(iter));
04636          if (!prop_is_valid) {
04637             ast_log(LOG_ERROR, "ARI PlaybackFinished field type failed validation\n");
04638             res = 0;
04639          }
04640       } else
04641       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
04642          int prop_is_valid;
04643          has_application = 1;
04644          prop_is_valid = ast_ari_validate_string(
04645             ast_json_object_iter_value(iter));
04646          if (!prop_is_valid) {
04647             ast_log(LOG_ERROR, "ARI PlaybackFinished field application failed validation\n");
04648             res = 0;
04649          }
04650       } else
04651       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
04652          int prop_is_valid;
04653          prop_is_valid = ast_ari_validate_date(
04654             ast_json_object_iter_value(iter));
04655          if (!prop_is_valid) {
04656             ast_log(LOG_ERROR, "ARI PlaybackFinished field timestamp failed validation\n");
04657             res = 0;
04658          }
04659       } else
04660       if (strcmp("playback", ast_json_object_iter_key(iter)) == 0) {
04661          int prop_is_valid;
04662          has_playback = 1;
04663          prop_is_valid = ast_ari_validate_playback(
04664             ast_json_object_iter_value(iter));
04665          if (!prop_is_valid) {
04666             ast_log(LOG_ERROR, "ARI PlaybackFinished field playback failed validation\n");
04667             res = 0;
04668          }
04669       } else
04670       {
04671          ast_log(LOG_ERROR,
04672             "ARI PlaybackFinished has undocumented field %s\n",
04673             ast_json_object_iter_key(iter));
04674          res = 0;
04675       }
04676    }
04677 
04678    if (!has_type) {
04679       ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field type\n");
04680       res = 0;
04681    }
04682 
04683    if (!has_application) {
04684       ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field application\n");
04685       res = 0;
04686    }
04687 
04688    if (!has_playback) {
04689       ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field playback\n");
04690       res = 0;
04691    }
04692 
04693    return res;
04694 }
04695 
04696 ari_validator ast_ari_validate_playback_finished_fn(void)
04697 {
04698    return ast_ari_validate_playback_finished;
04699 }
04700 
04701 int ast_ari_validate_playback_started(struct ast_json *json)
04702 {
04703    int res = 1;
04704    struct ast_json_iter *iter;
04705    int has_type = 0;
04706    int has_application = 0;
04707    int has_playback = 0;
04708 
04709    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
04710       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
04711          int prop_is_valid;
04712          has_type = 1;
04713          prop_is_valid = ast_ari_validate_string(
04714             ast_json_object_iter_value(iter));
04715          if (!prop_is_valid) {
04716             ast_log(LOG_ERROR, "ARI PlaybackStarted field type failed validation\n");
04717             res = 0;
04718          }
04719       } else
04720       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
04721          int prop_is_valid;
04722          has_application = 1;
04723          prop_is_valid = ast_ari_validate_string(
04724             ast_json_object_iter_value(iter));
04725          if (!prop_is_valid) {
04726             ast_log(LOG_ERROR, "ARI PlaybackStarted field application failed validation\n");
04727             res = 0;
04728          }
04729       } else
04730       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
04731          int prop_is_valid;
04732          prop_is_valid = ast_ari_validate_date(
04733             ast_json_object_iter_value(iter));
04734          if (!prop_is_valid) {
04735             ast_log(LOG_ERROR, "ARI PlaybackStarted field timestamp failed validation\n");
04736             res = 0;
04737          }
04738       } else
04739       if (strcmp("playback", ast_json_object_iter_key(iter)) == 0) {
04740          int prop_is_valid;
04741          has_playback = 1;
04742          prop_is_valid = ast_ari_validate_playback(
04743             ast_json_object_iter_value(iter));
04744          if (!prop_is_valid) {
04745             ast_log(LOG_ERROR, "ARI PlaybackStarted field playback failed validation\n");
04746             res = 0;
04747          }
04748       } else
04749       {
04750          ast_log(LOG_ERROR,
04751             "ARI PlaybackStarted has undocumented field %s\n",
04752             ast_json_object_iter_key(iter));
04753          res = 0;
04754       }
04755    }
04756 
04757    if (!has_type) {
04758       ast_log(LOG_ERROR, "ARI PlaybackStarted missing required field type\n");
04759       res = 0;
04760    }
04761 
04762    if (!has_application) {
04763       ast_log(LOG_ERROR, "ARI PlaybackStarted missing required field application\n");
04764       res = 0;
04765    }
04766 
04767    if (!has_playback) {
04768       ast_log(LOG_ERROR, "ARI PlaybackStarted missing required field playback\n");
04769       res = 0;
04770    }
04771 
04772    return res;
04773 }
04774 
04775 ari_validator ast_ari_validate_playback_started_fn(void)
04776 {
04777    return ast_ari_validate_playback_started;
04778 }
04779 
04780 int ast_ari_validate_recording_failed(struct ast_json *json)
04781 {
04782    int res = 1;
04783    struct ast_json_iter *iter;
04784    int has_type = 0;
04785    int has_application = 0;
04786    int has_recording = 0;
04787 
04788    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
04789       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
04790          int prop_is_valid;
04791          has_type = 1;
04792          prop_is_valid = ast_ari_validate_string(
04793             ast_json_object_iter_value(iter));
04794          if (!prop_is_valid) {
04795             ast_log(LOG_ERROR, "ARI RecordingFailed field type failed validation\n");
04796             res = 0;
04797          }
04798       } else
04799       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
04800          int prop_is_valid;
04801          has_application = 1;
04802          prop_is_valid = ast_ari_validate_string(
04803             ast_json_object_iter_value(iter));
04804          if (!prop_is_valid) {
04805             ast_log(LOG_ERROR, "ARI RecordingFailed field application failed validation\n");
04806             res = 0;
04807          }
04808       } else
04809       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
04810          int prop_is_valid;
04811          prop_is_valid = ast_ari_validate_date(
04812             ast_json_object_iter_value(iter));
04813          if (!prop_is_valid) {
04814             ast_log(LOG_ERROR, "ARI RecordingFailed field timestamp failed validation\n");
04815             res = 0;
04816          }
04817       } else
04818       if (strcmp("recording", ast_json_object_iter_key(iter)) == 0) {
04819          int prop_is_valid;
04820          has_recording = 1;
04821          prop_is_valid = ast_ari_validate_live_recording(
04822             ast_json_object_iter_value(iter));
04823          if (!prop_is_valid) {
04824             ast_log(LOG_ERROR, "ARI RecordingFailed field recording failed validation\n");
04825             res = 0;
04826          }
04827       } else
04828       {
04829          ast_log(LOG_ERROR,
04830             "ARI RecordingFailed has undocumented field %s\n",
04831             ast_json_object_iter_key(iter));
04832          res = 0;
04833       }
04834    }
04835 
04836    if (!has_type) {
04837       ast_log(LOG_ERROR, "ARI RecordingFailed missing required field type\n");
04838       res = 0;
04839    }
04840 
04841    if (!has_application) {
04842       ast_log(LOG_ERROR, "ARI RecordingFailed missing required field application\n");
04843       res = 0;
04844    }
04845 
04846    if (!has_recording) {
04847       ast_log(LOG_ERROR, "ARI RecordingFailed missing required field recording\n");
04848       res = 0;
04849    }
04850 
04851    return res;
04852 }
04853 
04854 ari_validator ast_ari_validate_recording_failed_fn(void)
04855 {
04856    return ast_ari_validate_recording_failed;
04857 }
04858 
04859 int ast_ari_validate_recording_finished(struct ast_json *json)
04860 {
04861    int res = 1;
04862    struct ast_json_iter *iter;
04863    int has_type = 0;
04864    int has_application = 0;
04865    int has_recording = 0;
04866 
04867    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
04868       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
04869          int prop_is_valid;
04870          has_type = 1;
04871          prop_is_valid = ast_ari_validate_string(
04872             ast_json_object_iter_value(iter));
04873          if (!prop_is_valid) {
04874             ast_log(LOG_ERROR, "ARI RecordingFinished field type failed validation\n");
04875             res = 0;
04876          }
04877       } else
04878       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
04879          int prop_is_valid;
04880          has_application = 1;
04881          prop_is_valid = ast_ari_validate_string(
04882             ast_json_object_iter_value(iter));
04883          if (!prop_is_valid) {
04884             ast_log(LOG_ERROR, "ARI RecordingFinished field application failed validation\n");
04885             res = 0;
04886          }
04887       } else
04888       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
04889          int prop_is_valid;
04890          prop_is_valid = ast_ari_validate_date(
04891             ast_json_object_iter_value(iter));
04892          if (!prop_is_valid) {
04893             ast_log(LOG_ERROR, "ARI RecordingFinished field timestamp failed validation\n");
04894             res = 0;
04895          }
04896       } else
04897       if (strcmp("recording", ast_json_object_iter_key(iter)) == 0) {
04898          int prop_is_valid;
04899          has_recording = 1;
04900          prop_is_valid = ast_ari_validate_live_recording(
04901             ast_json_object_iter_value(iter));
04902          if (!prop_is_valid) {
04903             ast_log(LOG_ERROR, "ARI RecordingFinished field recording failed validation\n");
04904             res = 0;
04905          }
04906       } else
04907       {
04908          ast_log(LOG_ERROR,
04909             "ARI RecordingFinished has undocumented field %s\n",
04910             ast_json_object_iter_key(iter));
04911          res = 0;
04912       }
04913    }
04914 
04915    if (!has_type) {
04916       ast_log(LOG_ERROR, "ARI RecordingFinished missing required field type\n");
04917       res = 0;
04918    }
04919 
04920    if (!has_application) {
04921       ast_log(LOG_ERROR, "ARI RecordingFinished missing required field application\n");
04922       res = 0;
04923    }
04924 
04925    if (!has_recording) {
04926       ast_log(LOG_ERROR, "ARI RecordingFinished missing required field recording\n");
04927       res = 0;
04928    }
04929 
04930    return res;
04931 }
04932 
04933 ari_validator ast_ari_validate_recording_finished_fn(void)
04934 {
04935    return ast_ari_validate_recording_finished;
04936 }
04937 
04938 int ast_ari_validate_recording_started(struct ast_json *json)
04939 {
04940    int res = 1;
04941    struct ast_json_iter *iter;
04942    int has_type = 0;
04943    int has_application = 0;
04944    int has_recording = 0;
04945 
04946    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
04947       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
04948          int prop_is_valid;
04949          has_type = 1;
04950          prop_is_valid = ast_ari_validate_string(
04951             ast_json_object_iter_value(iter));
04952          if (!prop_is_valid) {
04953             ast_log(LOG_ERROR, "ARI RecordingStarted field type failed validation\n");
04954             res = 0;
04955          }
04956       } else
04957       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
04958          int prop_is_valid;
04959          has_application = 1;
04960          prop_is_valid = ast_ari_validate_string(
04961             ast_json_object_iter_value(iter));
04962          if (!prop_is_valid) {
04963             ast_log(LOG_ERROR, "ARI RecordingStarted field application failed validation\n");
04964             res = 0;
04965          }
04966       } else
04967       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
04968          int prop_is_valid;
04969          prop_is_valid = ast_ari_validate_date(
04970             ast_json_object_iter_value(iter));
04971          if (!prop_is_valid) {
04972             ast_log(LOG_ERROR, "ARI RecordingStarted field timestamp failed validation\n");
04973             res = 0;
04974          }
04975       } else
04976       if (strcmp("recording", ast_json_object_iter_key(iter)) == 0) {
04977          int prop_is_valid;
04978          has_recording = 1;
04979          prop_is_valid = ast_ari_validate_live_recording(
04980             ast_json_object_iter_value(iter));
04981          if (!prop_is_valid) {
04982             ast_log(LOG_ERROR, "ARI RecordingStarted field recording failed validation\n");
04983             res = 0;
04984          }
04985       } else
04986       {
04987          ast_log(LOG_ERROR,
04988             "ARI RecordingStarted has undocumented field %s\n",
04989             ast_json_object_iter_key(iter));
04990          res = 0;
04991       }
04992    }
04993 
04994    if (!has_type) {
04995       ast_log(LOG_ERROR, "ARI RecordingStarted missing required field type\n");
04996       res = 0;
04997    }
04998 
04999    if (!has_application) {
05000       ast_log(LOG_ERROR, "ARI RecordingStarted missing required field application\n");
05001       res = 0;
05002    }
05003 
05004    if (!has_recording) {
05005       ast_log(LOG_ERROR, "ARI RecordingStarted missing required field recording\n");
05006       res = 0;
05007    }
05008 
05009    return res;
05010 }
05011 
05012 ari_validator ast_ari_validate_recording_started_fn(void)
05013 {
05014    return ast_ari_validate_recording_started;
05015 }
05016 
05017 int ast_ari_validate_stasis_end(struct ast_json *json)
05018 {
05019    int res = 1;
05020    struct ast_json_iter *iter;
05021    int has_type = 0;
05022    int has_application = 0;
05023    int has_channel = 0;
05024 
05025    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
05026       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
05027          int prop_is_valid;
05028          has_type = 1;
05029          prop_is_valid = ast_ari_validate_string(
05030             ast_json_object_iter_value(iter));
05031          if (!prop_is_valid) {
05032             ast_log(LOG_ERROR, "ARI StasisEnd field type failed validation\n");
05033             res = 0;
05034          }
05035       } else
05036       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
05037          int prop_is_valid;
05038          has_application = 1;
05039          prop_is_valid = ast_ari_validate_string(
05040             ast_json_object_iter_value(iter));
05041          if (!prop_is_valid) {
05042             ast_log(LOG_ERROR, "ARI StasisEnd field application failed validation\n");
05043             res = 0;
05044          }
05045       } else
05046       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
05047          int prop_is_valid;
05048          prop_is_valid = ast_ari_validate_date(
05049             ast_json_object_iter_value(iter));
05050          if (!prop_is_valid) {
05051             ast_log(LOG_ERROR, "ARI StasisEnd field timestamp failed validation\n");
05052             res = 0;
05053          }
05054       } else
05055       if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
05056          int prop_is_valid;
05057          has_channel = 1;
05058          prop_is_valid = ast_ari_validate_channel(
05059             ast_json_object_iter_value(iter));
05060          if (!prop_is_valid) {
05061             ast_log(LOG_ERROR, "ARI StasisEnd field channel failed validation\n");
05062             res = 0;
05063          }
05064       } else
05065       {
05066          ast_log(LOG_ERROR,
05067             "ARI StasisEnd has undocumented field %s\n",
05068             ast_json_object_iter_key(iter));
05069          res = 0;
05070       }
05071    }
05072 
05073    if (!has_type) {
05074       ast_log(LOG_ERROR, "ARI StasisEnd missing required field type\n");
05075       res = 0;
05076    }
05077 
05078    if (!has_application) {
05079       ast_log(LOG_ERROR, "ARI StasisEnd missing required field application\n");
05080       res = 0;
05081    }
05082 
05083    if (!has_channel) {
05084       ast_log(LOG_ERROR, "ARI StasisEnd missing required field channel\n");
05085       res = 0;
05086    }
05087 
05088    return res;
05089 }
05090 
05091 ari_validator ast_ari_validate_stasis_end_fn(void)
05092 {
05093    return ast_ari_validate_stasis_end;
05094 }
05095 
05096 int ast_ari_validate_stasis_start(struct ast_json *json)
05097 {
05098    int res = 1;
05099    struct ast_json_iter *iter;
05100    int has_type = 0;
05101    int has_application = 0;
05102    int has_args = 0;
05103    int has_channel = 0;
05104 
05105    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
05106       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
05107          int prop_is_valid;
05108          has_type = 1;
05109          prop_is_valid = ast_ari_validate_string(
05110             ast_json_object_iter_value(iter));
05111          if (!prop_is_valid) {
05112             ast_log(LOG_ERROR, "ARI StasisStart field type failed validation\n");
05113             res = 0;
05114          }
05115       } else
05116       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
05117          int prop_is_valid;
05118          has_application = 1;
05119          prop_is_valid = ast_ari_validate_string(
05120             ast_json_object_iter_value(iter));
05121          if (!prop_is_valid) {
05122             ast_log(LOG_ERROR, "ARI StasisStart field application failed validation\n");
05123             res = 0;
05124          }
05125       } else
05126       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
05127          int prop_is_valid;
05128          prop_is_valid = ast_ari_validate_date(
05129             ast_json_object_iter_value(iter));
05130          if (!prop_is_valid) {
05131             ast_log(LOG_ERROR, "ARI StasisStart field timestamp failed validation\n");
05132             res = 0;
05133          }
05134       } else
05135       if (strcmp("args", ast_json_object_iter_key(iter)) == 0) {
05136          int prop_is_valid;
05137          has_args = 1;
05138          prop_is_valid = ast_ari_validate_list(
05139             ast_json_object_iter_value(iter),
05140             ast_ari_validate_string);
05141          if (!prop_is_valid) {
05142             ast_log(LOG_ERROR, "ARI StasisStart field args failed validation\n");
05143             res = 0;
05144          }
05145       } else
05146       if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
05147          int prop_is_valid;
05148          has_channel = 1;
05149          prop_is_valid = ast_ari_validate_channel(
05150             ast_json_object_iter_value(iter));
05151          if (!prop_is_valid) {
05152             ast_log(LOG_ERROR, "ARI StasisStart field channel failed validation\n");
05153             res = 0;
05154          }
05155       } else
05156       if (strcmp("replace_channel", ast_json_object_iter_key(iter)) == 0) {
05157          int prop_is_valid;
05158          prop_is_valid = ast_ari_validate_channel(
05159             ast_json_object_iter_value(iter));
05160          if (!prop_is_valid) {
05161             ast_log(LOG_ERROR, "ARI StasisStart field replace_channel failed validation\n");
05162             res = 0;
05163          }
05164       } else
05165       {
05166          ast_log(LOG_ERROR,
05167             "ARI StasisStart has undocumented field %s\n",
05168             ast_json_object_iter_key(iter));
05169          res = 0;
05170       }
05171    }
05172 
05173    if (!has_type) {
05174       ast_log(LOG_ERROR, "ARI StasisStart missing required field type\n");
05175       res = 0;
05176    }
05177 
05178    if (!has_application) {
05179       ast_log(LOG_ERROR, "ARI StasisStart missing required field application\n");
05180       res = 0;
05181    }
05182 
05183    if (!has_args) {
05184       ast_log(LOG_ERROR, "ARI StasisStart missing required field args\n");
05185       res = 0;
05186    }
05187 
05188    if (!has_channel) {
05189       ast_log(LOG_ERROR, "ARI StasisStart missing required field channel\n");
05190       res = 0;
05191    }
05192 
05193    return res;
05194 }
05195 
05196 ari_validator ast_ari_validate_stasis_start_fn(void)
05197 {
05198    return ast_ari_validate_stasis_start;
05199 }
05200 
05201 int ast_ari_validate_text_message_received(struct ast_json *json)
05202 {
05203    int res = 1;
05204    struct ast_json_iter *iter;
05205    int has_type = 0;
05206    int has_application = 0;
05207    int has_message = 0;
05208 
05209    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
05210       if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
05211          int prop_is_valid;
05212          has_type = 1;
05213          prop_is_valid = ast_ari_validate_string(
05214             ast_json_object_iter_value(iter));
05215          if (!prop_is_valid) {
05216             ast_log(LOG_ERROR, "ARI TextMessageReceived field type failed validation\n");
05217             res = 0;
05218          }
05219       } else
05220       if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
05221          int prop_is_valid;
05222          has_application = 1;
05223          prop_is_valid = ast_ari_validate_string(
05224             ast_json_object_iter_value(iter));
05225          if (!prop_is_valid) {
05226             ast_log(LOG_ERROR, "ARI TextMessageReceived field application failed validation\n");
05227             res = 0;
05228          }
05229       } else
05230       if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
05231          int prop_is_valid;
05232          prop_is_valid = ast_ari_validate_date(
05233             ast_json_object_iter_value(iter));
05234          if (!prop_is_valid) {
05235             ast_log(LOG_ERROR, "ARI TextMessageReceived field timestamp failed validation\n");
05236             res = 0;
05237          }
05238       } else
05239       if (strcmp("endpoint", ast_json_object_iter_key(iter)) == 0) {
05240          int prop_is_valid;
05241          prop_is_valid = ast_ari_validate_endpoint(
05242             ast_json_object_iter_value(iter));
05243          if (!prop_is_valid) {
05244             ast_log(LOG_ERROR, "ARI TextMessageReceived field endpoint failed validation\n");
05245             res = 0;
05246          }
05247       } else
05248       if (strcmp("message", ast_json_object_iter_key(iter)) == 0) {
05249          int prop_is_valid;
05250          has_message = 1;
05251          prop_is_valid = ast_ari_validate_text_message(
05252             ast_json_object_iter_value(iter));
05253          if (!prop_is_valid) {
05254             ast_log(LOG_ERROR, "ARI TextMessageReceived field message failed validation\n");
05255             res = 0;
05256          }
05257       } else
05258       {
05259          ast_log(LOG_ERROR,
05260             "ARI TextMessageReceived has undocumented field %s\n",
05261             ast_json_object_iter_key(iter));
05262          res = 0;
05263       }
05264    }
05265 
05266    if (!has_type) {
05267       ast_log(LOG_ERROR, "ARI TextMessageReceived missing required field type\n");
05268       res = 0;
05269    }
05270 
05271    if (!has_application) {
05272       ast_log(LOG_ERROR, "ARI TextMessageReceived missing required field application\n");
05273       res = 0;
05274    }
05275 
05276    if (!has_message) {
05277       ast_log(LOG_ERROR, "ARI TextMessageReceived missing required field message\n");
05278       res = 0;
05279    }
05280 
05281    return res;
05282 }
05283 
05284 ari_validator ast_ari_validate_text_message_received_fn(void)
05285 {
05286    return ast_ari_validate_text_message_received;
05287 }
05288 
05289 int ast_ari_validate_application(struct ast_json *json)
05290 {
05291    int res = 1;
05292    struct ast_json_iter *iter;
05293    int has_bridge_ids = 0;
05294    int has_channel_ids = 0;
05295    int has_device_names = 0;
05296    int has_endpoint_ids = 0;
05297    int has_name = 0;
05298 
05299    for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
05300       if (strcmp("bridge_ids", ast_json_object_iter_key(iter)) == 0) {
05301          int prop_is_valid;
05302          has_bridge_ids = 1;
05303          prop_is_valid = ast_ari_validate_list(
05304             ast_json_object_iter_value(iter),
05305             ast_ari_validate_string);
05306          if (!prop_is_valid) {
05307             ast_log(LOG_ERROR, "ARI Application field bridge_ids failed validation\n");
05308             res = 0;
05309          }
05310       } else
05311       if (strcmp("channel_ids", ast_json_object_iter_key(iter)) == 0) {
05312          int prop_is_valid;
05313          has_channel_ids = 1;
05314          prop_is_valid = ast_ari_validate_list(
05315             ast_json_object_iter_value(iter),
05316             ast_ari_validate_string);
05317          if (!prop_is_valid) {
05318             ast_log(LOG_ERROR, "ARI Application field channel_ids failed validation\n");
05319             res = 0;
05320          }
05321       } else
05322       if (strcmp("device_names", ast_json_object_iter_key(iter)) == 0) {
05323          int prop_is_valid;
05324          has_device_names = 1;
05325          prop_is_valid = ast_ari_validate_list(
05326             ast_json_object_iter_value(iter),
05327             ast_ari_validate_string);
05328          if (!prop_is_valid) {
05329             ast_log(LOG_ERROR, "ARI Application field device_names failed validation\n");
05330             res = 0;
05331          }
05332       } else
05333       if (strcmp("endpoint_ids", ast_json_object_iter_key(iter)) == 0) {
05334          int prop_is_valid;
05335          has_endpoint_ids = 1;
05336          prop_is_valid = ast_ari_validate_list(
05337             ast_json_object_iter_value(iter),
05338             ast_ari_validate_string);
05339          if (!prop_is_valid) {
05340             ast_log(LOG_ERROR, "ARI Application field endpoint_ids failed validation\n");
05341             res = 0;
05342          }
05343       } else
05344       if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
05345          int prop_is_valid;
05346          has_name = 1;
05347          prop_is_valid = ast_ari_validate_string(
05348             ast_json_object_iter_value(iter));
05349          if (!prop_is_valid) {
05350             ast_log(LOG_ERROR, "ARI Application field name failed validation\n");
05351             res = 0;
05352          }
05353       } else
05354       {
05355          ast_log(LOG_ERROR,
05356             "ARI Application has undocumented field %s\n",
05357             ast_json_object_iter_key(iter));
05358          res = 0;
05359       }
05360    }
05361 
05362    if (!has_bridge_ids) {
05363       ast_log(LOG_ERROR, "ARI Application missing required field bridge_ids\n");
05364       res = 0;
05365    }
05366 
05367    if (!has_channel_ids) {
05368       ast_log(LOG_ERROR, "ARI Application missing required field channel_ids\n");
05369       res = 0;
05370    }
05371 
05372    if (!has_device_names) {
05373       ast_log(LOG_ERROR, "ARI Application missing required field device_names\n");
05374       res = 0;
05375    }
05376 
05377    if (!has_endpoint_ids) {
05378       ast_log(LOG_ERROR, "ARI Application missing required field endpoint_ids\n");
05379       res = 0;
05380    }
05381 
05382    if (!has_name) {
05383       ast_log(LOG_ERROR, "ARI Application missing required field name\n");
05384       res = 0;
05385    }
05386 
05387    return res;
05388 }
05389 
05390 ari_validator ast_ari_validate_application_fn(void)
05391 {
05392    return ast_ari_validate_application;
05393 }

Generated on Thu Apr 16 06:27:14 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6