ARI: Add support for push configuration of dynamic object
[asterisk/asterisk.git] / res / ari / ari_model_validators.c
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2013, Digium, Inc.
5  *
6  * See http://www.asterisk.org for more information about
7  * the Asterisk project. Please do not directly contact
8  * any of the maintainers of this project for assistance;
9  * the project provides a web site, mailing lists and IRC
10  * channels for your use.
11  *
12  * This program is free software, distributed under the terms of
13  * the GNU General Public License Version 2. See the LICENSE file
14  * at the top of the source tree.
15  */
16
17 /*! \file
18  *
19  * \brief Generated file - Build validators for ARI model objects.
20  */
21
22  /*
23  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
24  * !!!!!                               DO NOT EDIT                        !!!!!
25  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
26  * This file is generated by a mustache template. Please see the original
27  * template in rest-api-templates/ari_model_validators.c.mustache
28  */
29
30 #include "asterisk.h"
31
32 ASTERISK_REGISTER_FILE()
33
34 #include "asterisk/logger.h"
35 #include "asterisk/module.h"
36 #include "ari_model_validators.h"
37
38 int ast_ari_validate_asterisk_info(struct ast_json *json)
39 {
40         int res = 1;
41         struct ast_json_iter *iter;
42
43         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
44                 if (strcmp("build", ast_json_object_iter_key(iter)) == 0) {
45                         int prop_is_valid;
46                         prop_is_valid = ast_ari_validate_build_info(
47                                 ast_json_object_iter_value(iter));
48                         if (!prop_is_valid) {
49                                 ast_log(LOG_ERROR, "ARI AsteriskInfo field build failed validation\n");
50                                 res = 0;
51                         }
52                 } else
53                 if (strcmp("config", ast_json_object_iter_key(iter)) == 0) {
54                         int prop_is_valid;
55                         prop_is_valid = ast_ari_validate_config_info(
56                                 ast_json_object_iter_value(iter));
57                         if (!prop_is_valid) {
58                                 ast_log(LOG_ERROR, "ARI AsteriskInfo field config failed validation\n");
59                                 res = 0;
60                         }
61                 } else
62                 if (strcmp("status", ast_json_object_iter_key(iter)) == 0) {
63                         int prop_is_valid;
64                         prop_is_valid = ast_ari_validate_status_info(
65                                 ast_json_object_iter_value(iter));
66                         if (!prop_is_valid) {
67                                 ast_log(LOG_ERROR, "ARI AsteriskInfo field status failed validation\n");
68                                 res = 0;
69                         }
70                 } else
71                 if (strcmp("system", ast_json_object_iter_key(iter)) == 0) {
72                         int prop_is_valid;
73                         prop_is_valid = ast_ari_validate_system_info(
74                                 ast_json_object_iter_value(iter));
75                         if (!prop_is_valid) {
76                                 ast_log(LOG_ERROR, "ARI AsteriskInfo field system failed validation\n");
77                                 res = 0;
78                         }
79                 } else
80                 {
81                         ast_log(LOG_ERROR,
82                                 "ARI AsteriskInfo has undocumented field %s\n",
83                                 ast_json_object_iter_key(iter));
84                         res = 0;
85                 }
86         }
87
88         return res;
89 }
90
91 ari_validator ast_ari_validate_asterisk_info_fn(void)
92 {
93         return ast_ari_validate_asterisk_info;
94 }
95
96 int ast_ari_validate_build_info(struct ast_json *json)
97 {
98         int res = 1;
99         struct ast_json_iter *iter;
100         int has_date = 0;
101         int has_kernel = 0;
102         int has_machine = 0;
103         int has_options = 0;
104         int has_os = 0;
105         int has_user = 0;
106
107         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
108                 if (strcmp("date", ast_json_object_iter_key(iter)) == 0) {
109                         int prop_is_valid;
110                         has_date = 1;
111                         prop_is_valid = ast_ari_validate_string(
112                                 ast_json_object_iter_value(iter));
113                         if (!prop_is_valid) {
114                                 ast_log(LOG_ERROR, "ARI BuildInfo field date failed validation\n");
115                                 res = 0;
116                         }
117                 } else
118                 if (strcmp("kernel", ast_json_object_iter_key(iter)) == 0) {
119                         int prop_is_valid;
120                         has_kernel = 1;
121                         prop_is_valid = ast_ari_validate_string(
122                                 ast_json_object_iter_value(iter));
123                         if (!prop_is_valid) {
124                                 ast_log(LOG_ERROR, "ARI BuildInfo field kernel failed validation\n");
125                                 res = 0;
126                         }
127                 } else
128                 if (strcmp("machine", ast_json_object_iter_key(iter)) == 0) {
129                         int prop_is_valid;
130                         has_machine = 1;
131                         prop_is_valid = ast_ari_validate_string(
132                                 ast_json_object_iter_value(iter));
133                         if (!prop_is_valid) {
134                                 ast_log(LOG_ERROR, "ARI BuildInfo field machine failed validation\n");
135                                 res = 0;
136                         }
137                 } else
138                 if (strcmp("options", ast_json_object_iter_key(iter)) == 0) {
139                         int prop_is_valid;
140                         has_options = 1;
141                         prop_is_valid = ast_ari_validate_string(
142                                 ast_json_object_iter_value(iter));
143                         if (!prop_is_valid) {
144                                 ast_log(LOG_ERROR, "ARI BuildInfo field options failed validation\n");
145                                 res = 0;
146                         }
147                 } else
148                 if (strcmp("os", ast_json_object_iter_key(iter)) == 0) {
149                         int prop_is_valid;
150                         has_os = 1;
151                         prop_is_valid = ast_ari_validate_string(
152                                 ast_json_object_iter_value(iter));
153                         if (!prop_is_valid) {
154                                 ast_log(LOG_ERROR, "ARI BuildInfo field os failed validation\n");
155                                 res = 0;
156                         }
157                 } else
158                 if (strcmp("user", ast_json_object_iter_key(iter)) == 0) {
159                         int prop_is_valid;
160                         has_user = 1;
161                         prop_is_valid = ast_ari_validate_string(
162                                 ast_json_object_iter_value(iter));
163                         if (!prop_is_valid) {
164                                 ast_log(LOG_ERROR, "ARI BuildInfo field user failed validation\n");
165                                 res = 0;
166                         }
167                 } else
168                 {
169                         ast_log(LOG_ERROR,
170                                 "ARI BuildInfo has undocumented field %s\n",
171                                 ast_json_object_iter_key(iter));
172                         res = 0;
173                 }
174         }
175
176         if (!has_date) {
177                 ast_log(LOG_ERROR, "ARI BuildInfo missing required field date\n");
178                 res = 0;
179         }
180
181         if (!has_kernel) {
182                 ast_log(LOG_ERROR, "ARI BuildInfo missing required field kernel\n");
183                 res = 0;
184         }
185
186         if (!has_machine) {
187                 ast_log(LOG_ERROR, "ARI BuildInfo missing required field machine\n");
188                 res = 0;
189         }
190
191         if (!has_options) {
192                 ast_log(LOG_ERROR, "ARI BuildInfo missing required field options\n");
193                 res = 0;
194         }
195
196         if (!has_os) {
197                 ast_log(LOG_ERROR, "ARI BuildInfo missing required field os\n");
198                 res = 0;
199         }
200
201         if (!has_user) {
202                 ast_log(LOG_ERROR, "ARI BuildInfo missing required field user\n");
203                 res = 0;
204         }
205
206         return res;
207 }
208
209 ari_validator ast_ari_validate_build_info_fn(void)
210 {
211         return ast_ari_validate_build_info;
212 }
213
214 int ast_ari_validate_config_info(struct ast_json *json)
215 {
216         int res = 1;
217         struct ast_json_iter *iter;
218         int has_default_language = 0;
219         int has_name = 0;
220         int has_setid = 0;
221
222         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
223                 if (strcmp("default_language", ast_json_object_iter_key(iter)) == 0) {
224                         int prop_is_valid;
225                         has_default_language = 1;
226                         prop_is_valid = ast_ari_validate_string(
227                                 ast_json_object_iter_value(iter));
228                         if (!prop_is_valid) {
229                                 ast_log(LOG_ERROR, "ARI ConfigInfo field default_language failed validation\n");
230                                 res = 0;
231                         }
232                 } else
233                 if (strcmp("max_channels", ast_json_object_iter_key(iter)) == 0) {
234                         int prop_is_valid;
235                         prop_is_valid = ast_ari_validate_int(
236                                 ast_json_object_iter_value(iter));
237                         if (!prop_is_valid) {
238                                 ast_log(LOG_ERROR, "ARI ConfigInfo field max_channels failed validation\n");
239                                 res = 0;
240                         }
241                 } else
242                 if (strcmp("max_load", ast_json_object_iter_key(iter)) == 0) {
243                         int prop_is_valid;
244                         prop_is_valid = ast_ari_validate_double(
245                                 ast_json_object_iter_value(iter));
246                         if (!prop_is_valid) {
247                                 ast_log(LOG_ERROR, "ARI ConfigInfo field max_load failed validation\n");
248                                 res = 0;
249                         }
250                 } else
251                 if (strcmp("max_open_files", ast_json_object_iter_key(iter)) == 0) {
252                         int prop_is_valid;
253                         prop_is_valid = ast_ari_validate_int(
254                                 ast_json_object_iter_value(iter));
255                         if (!prop_is_valid) {
256                                 ast_log(LOG_ERROR, "ARI ConfigInfo field max_open_files failed validation\n");
257                                 res = 0;
258                         }
259                 } else
260                 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
261                         int prop_is_valid;
262                         has_name = 1;
263                         prop_is_valid = ast_ari_validate_string(
264                                 ast_json_object_iter_value(iter));
265                         if (!prop_is_valid) {
266                                 ast_log(LOG_ERROR, "ARI ConfigInfo field name failed validation\n");
267                                 res = 0;
268                         }
269                 } else
270                 if (strcmp("setid", ast_json_object_iter_key(iter)) == 0) {
271                         int prop_is_valid;
272                         has_setid = 1;
273                         prop_is_valid = ast_ari_validate_set_id(
274                                 ast_json_object_iter_value(iter));
275                         if (!prop_is_valid) {
276                                 ast_log(LOG_ERROR, "ARI ConfigInfo field setid failed validation\n");
277                                 res = 0;
278                         }
279                 } else
280                 {
281                         ast_log(LOG_ERROR,
282                                 "ARI ConfigInfo has undocumented field %s\n",
283                                 ast_json_object_iter_key(iter));
284                         res = 0;
285                 }
286         }
287
288         if (!has_default_language) {
289                 ast_log(LOG_ERROR, "ARI ConfigInfo missing required field default_language\n");
290                 res = 0;
291         }
292
293         if (!has_name) {
294                 ast_log(LOG_ERROR, "ARI ConfigInfo missing required field name\n");
295                 res = 0;
296         }
297
298         if (!has_setid) {
299                 ast_log(LOG_ERROR, "ARI ConfigInfo missing required field setid\n");
300                 res = 0;
301         }
302
303         return res;
304 }
305
306 ari_validator ast_ari_validate_config_info_fn(void)
307 {
308         return ast_ari_validate_config_info;
309 }
310
311 int ast_ari_validate_config_tuple(struct ast_json *json)
312 {
313         int res = 1;
314         struct ast_json_iter *iter;
315         int has_attribute = 0;
316         int has_value = 0;
317
318         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
319                 if (strcmp("attribute", ast_json_object_iter_key(iter)) == 0) {
320                         int prop_is_valid;
321                         has_attribute = 1;
322                         prop_is_valid = ast_ari_validate_string(
323                                 ast_json_object_iter_value(iter));
324                         if (!prop_is_valid) {
325                                 ast_log(LOG_ERROR, "ARI ConfigTuple field attribute failed validation\n");
326                                 res = 0;
327                         }
328                 } else
329                 if (strcmp("value", ast_json_object_iter_key(iter)) == 0) {
330                         int prop_is_valid;
331                         has_value = 1;
332                         prop_is_valid = ast_ari_validate_string(
333                                 ast_json_object_iter_value(iter));
334                         if (!prop_is_valid) {
335                                 ast_log(LOG_ERROR, "ARI ConfigTuple field value failed validation\n");
336                                 res = 0;
337                         }
338                 } else
339                 {
340                         ast_log(LOG_ERROR,
341                                 "ARI ConfigTuple has undocumented field %s\n",
342                                 ast_json_object_iter_key(iter));
343                         res = 0;
344                 }
345         }
346
347         if (!has_attribute) {
348                 ast_log(LOG_ERROR, "ARI ConfigTuple missing required field attribute\n");
349                 res = 0;
350         }
351
352         if (!has_value) {
353                 ast_log(LOG_ERROR, "ARI ConfigTuple missing required field value\n");
354                 res = 0;
355         }
356
357         return res;
358 }
359
360 ari_validator ast_ari_validate_config_tuple_fn(void)
361 {
362         return ast_ari_validate_config_tuple;
363 }
364
365 int ast_ari_validate_module(struct ast_json *json)
366 {
367         int res = 1;
368         struct ast_json_iter *iter;
369         int has_description = 0;
370         int has_name = 0;
371         int has_status = 0;
372         int has_support_level = 0;
373         int has_use_count = 0;
374
375         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
376                 if (strcmp("description", ast_json_object_iter_key(iter)) == 0) {
377                         int prop_is_valid;
378                         has_description = 1;
379                         prop_is_valid = ast_ari_validate_string(
380                                 ast_json_object_iter_value(iter));
381                         if (!prop_is_valid) {
382                                 ast_log(LOG_ERROR, "ARI Module field description failed validation\n");
383                                 res = 0;
384                         }
385                 } else
386                 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
387                         int prop_is_valid;
388                         has_name = 1;
389                         prop_is_valid = ast_ari_validate_string(
390                                 ast_json_object_iter_value(iter));
391                         if (!prop_is_valid) {
392                                 ast_log(LOG_ERROR, "ARI Module field name failed validation\n");
393                                 res = 0;
394                         }
395                 } else
396                 if (strcmp("status", ast_json_object_iter_key(iter)) == 0) {
397                         int prop_is_valid;
398                         has_status = 1;
399                         prop_is_valid = ast_ari_validate_string(
400                                 ast_json_object_iter_value(iter));
401                         if (!prop_is_valid) {
402                                 ast_log(LOG_ERROR, "ARI Module field status failed validation\n");
403                                 res = 0;
404                         }
405                 } else
406                 if (strcmp("support_level", ast_json_object_iter_key(iter)) == 0) {
407                         int prop_is_valid;
408                         has_support_level = 1;
409                         prop_is_valid = ast_ari_validate_string(
410                                 ast_json_object_iter_value(iter));
411                         if (!prop_is_valid) {
412                                 ast_log(LOG_ERROR, "ARI Module field support_level failed validation\n");
413                                 res = 0;
414                         }
415                 } else
416                 if (strcmp("use_count", ast_json_object_iter_key(iter)) == 0) {
417                         int prop_is_valid;
418                         has_use_count = 1;
419                         prop_is_valid = ast_ari_validate_int(
420                                 ast_json_object_iter_value(iter));
421                         if (!prop_is_valid) {
422                                 ast_log(LOG_ERROR, "ARI Module field use_count failed validation\n");
423                                 res = 0;
424                         }
425                 } else
426                 {
427                         ast_log(LOG_ERROR,
428                                 "ARI Module has undocumented field %s\n",
429                                 ast_json_object_iter_key(iter));
430                         res = 0;
431                 }
432         }
433
434         if (!has_description) {
435                 ast_log(LOG_ERROR, "ARI Module missing required field description\n");
436                 res = 0;
437         }
438
439         if (!has_name) {
440                 ast_log(LOG_ERROR, "ARI Module missing required field name\n");
441                 res = 0;
442         }
443
444         if (!has_status) {
445                 ast_log(LOG_ERROR, "ARI Module missing required field status\n");
446                 res = 0;
447         }
448
449         if (!has_support_level) {
450                 ast_log(LOG_ERROR, "ARI Module missing required field support_level\n");
451                 res = 0;
452         }
453
454         if (!has_use_count) {
455                 ast_log(LOG_ERROR, "ARI Module missing required field use_count\n");
456                 res = 0;
457         }
458
459         return res;
460 }
461
462 ari_validator ast_ari_validate_module_fn(void)
463 {
464         return ast_ari_validate_module;
465 }
466
467 int ast_ari_validate_set_id(struct ast_json *json)
468 {
469         int res = 1;
470         struct ast_json_iter *iter;
471         int has_group = 0;
472         int has_user = 0;
473
474         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
475                 if (strcmp("group", ast_json_object_iter_key(iter)) == 0) {
476                         int prop_is_valid;
477                         has_group = 1;
478                         prop_is_valid = ast_ari_validate_string(
479                                 ast_json_object_iter_value(iter));
480                         if (!prop_is_valid) {
481                                 ast_log(LOG_ERROR, "ARI SetId field group failed validation\n");
482                                 res = 0;
483                         }
484                 } else
485                 if (strcmp("user", ast_json_object_iter_key(iter)) == 0) {
486                         int prop_is_valid;
487                         has_user = 1;
488                         prop_is_valid = ast_ari_validate_string(
489                                 ast_json_object_iter_value(iter));
490                         if (!prop_is_valid) {
491                                 ast_log(LOG_ERROR, "ARI SetId field user failed validation\n");
492                                 res = 0;
493                         }
494                 } else
495                 {
496                         ast_log(LOG_ERROR,
497                                 "ARI SetId has undocumented field %s\n",
498                                 ast_json_object_iter_key(iter));
499                         res = 0;
500                 }
501         }
502
503         if (!has_group) {
504                 ast_log(LOG_ERROR, "ARI SetId missing required field group\n");
505                 res = 0;
506         }
507
508         if (!has_user) {
509                 ast_log(LOG_ERROR, "ARI SetId missing required field user\n");
510                 res = 0;
511         }
512
513         return res;
514 }
515
516 ari_validator ast_ari_validate_set_id_fn(void)
517 {
518         return ast_ari_validate_set_id;
519 }
520
521 int ast_ari_validate_status_info(struct ast_json *json)
522 {
523         int res = 1;
524         struct ast_json_iter *iter;
525         int has_last_reload_time = 0;
526         int has_startup_time = 0;
527
528         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
529                 if (strcmp("last_reload_time", ast_json_object_iter_key(iter)) == 0) {
530                         int prop_is_valid;
531                         has_last_reload_time = 1;
532                         prop_is_valid = ast_ari_validate_date(
533                                 ast_json_object_iter_value(iter));
534                         if (!prop_is_valid) {
535                                 ast_log(LOG_ERROR, "ARI StatusInfo field last_reload_time failed validation\n");
536                                 res = 0;
537                         }
538                 } else
539                 if (strcmp("startup_time", ast_json_object_iter_key(iter)) == 0) {
540                         int prop_is_valid;
541                         has_startup_time = 1;
542                         prop_is_valid = ast_ari_validate_date(
543                                 ast_json_object_iter_value(iter));
544                         if (!prop_is_valid) {
545                                 ast_log(LOG_ERROR, "ARI StatusInfo field startup_time failed validation\n");
546                                 res = 0;
547                         }
548                 } else
549                 {
550                         ast_log(LOG_ERROR,
551                                 "ARI StatusInfo has undocumented field %s\n",
552                                 ast_json_object_iter_key(iter));
553                         res = 0;
554                 }
555         }
556
557         if (!has_last_reload_time) {
558                 ast_log(LOG_ERROR, "ARI StatusInfo missing required field last_reload_time\n");
559                 res = 0;
560         }
561
562         if (!has_startup_time) {
563                 ast_log(LOG_ERROR, "ARI StatusInfo missing required field startup_time\n");
564                 res = 0;
565         }
566
567         return res;
568 }
569
570 ari_validator ast_ari_validate_status_info_fn(void)
571 {
572         return ast_ari_validate_status_info;
573 }
574
575 int ast_ari_validate_system_info(struct ast_json *json)
576 {
577         int res = 1;
578         struct ast_json_iter *iter;
579         int has_entity_id = 0;
580         int has_version = 0;
581
582         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
583                 if (strcmp("entity_id", ast_json_object_iter_key(iter)) == 0) {
584                         int prop_is_valid;
585                         has_entity_id = 1;
586                         prop_is_valid = ast_ari_validate_string(
587                                 ast_json_object_iter_value(iter));
588                         if (!prop_is_valid) {
589                                 ast_log(LOG_ERROR, "ARI SystemInfo field entity_id failed validation\n");
590                                 res = 0;
591                         }
592                 } else
593                 if (strcmp("version", ast_json_object_iter_key(iter)) == 0) {
594                         int prop_is_valid;
595                         has_version = 1;
596                         prop_is_valid = ast_ari_validate_string(
597                                 ast_json_object_iter_value(iter));
598                         if (!prop_is_valid) {
599                                 ast_log(LOG_ERROR, "ARI SystemInfo field version failed validation\n");
600                                 res = 0;
601                         }
602                 } else
603                 {
604                         ast_log(LOG_ERROR,
605                                 "ARI SystemInfo has undocumented field %s\n",
606                                 ast_json_object_iter_key(iter));
607                         res = 0;
608                 }
609         }
610
611         if (!has_entity_id) {
612                 ast_log(LOG_ERROR, "ARI SystemInfo missing required field entity_id\n");
613                 res = 0;
614         }
615
616         if (!has_version) {
617                 ast_log(LOG_ERROR, "ARI SystemInfo missing required field version\n");
618                 res = 0;
619         }
620
621         return res;
622 }
623
624 ari_validator ast_ari_validate_system_info_fn(void)
625 {
626         return ast_ari_validate_system_info;
627 }
628
629 int ast_ari_validate_variable(struct ast_json *json)
630 {
631         int res = 1;
632         struct ast_json_iter *iter;
633         int has_value = 0;
634
635         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
636                 if (strcmp("value", ast_json_object_iter_key(iter)) == 0) {
637                         int prop_is_valid;
638                         has_value = 1;
639                         prop_is_valid = ast_ari_validate_string(
640                                 ast_json_object_iter_value(iter));
641                         if (!prop_is_valid) {
642                                 ast_log(LOG_ERROR, "ARI Variable field value failed validation\n");
643                                 res = 0;
644                         }
645                 } else
646                 {
647                         ast_log(LOG_ERROR,
648                                 "ARI Variable has undocumented field %s\n",
649                                 ast_json_object_iter_key(iter));
650                         res = 0;
651                 }
652         }
653
654         if (!has_value) {
655                 ast_log(LOG_ERROR, "ARI Variable missing required field value\n");
656                 res = 0;
657         }
658
659         return res;
660 }
661
662 ari_validator ast_ari_validate_variable_fn(void)
663 {
664         return ast_ari_validate_variable;
665 }
666
667 int ast_ari_validate_endpoint(struct ast_json *json)
668 {
669         int res = 1;
670         struct ast_json_iter *iter;
671         int has_channel_ids = 0;
672         int has_resource = 0;
673         int has_technology = 0;
674
675         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
676                 if (strcmp("channel_ids", ast_json_object_iter_key(iter)) == 0) {
677                         int prop_is_valid;
678                         has_channel_ids = 1;
679                         prop_is_valid = ast_ari_validate_list(
680                                 ast_json_object_iter_value(iter),
681                                 ast_ari_validate_string);
682                         if (!prop_is_valid) {
683                                 ast_log(LOG_ERROR, "ARI Endpoint field channel_ids failed validation\n");
684                                 res = 0;
685                         }
686                 } else
687                 if (strcmp("resource", ast_json_object_iter_key(iter)) == 0) {
688                         int prop_is_valid;
689                         has_resource = 1;
690                         prop_is_valid = ast_ari_validate_string(
691                                 ast_json_object_iter_value(iter));
692                         if (!prop_is_valid) {
693                                 ast_log(LOG_ERROR, "ARI Endpoint field resource failed validation\n");
694                                 res = 0;
695                         }
696                 } else
697                 if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
698                         int prop_is_valid;
699                         prop_is_valid = ast_ari_validate_string(
700                                 ast_json_object_iter_value(iter));
701                         if (!prop_is_valid) {
702                                 ast_log(LOG_ERROR, "ARI Endpoint field state failed validation\n");
703                                 res = 0;
704                         }
705                 } else
706                 if (strcmp("technology", ast_json_object_iter_key(iter)) == 0) {
707                         int prop_is_valid;
708                         has_technology = 1;
709                         prop_is_valid = ast_ari_validate_string(
710                                 ast_json_object_iter_value(iter));
711                         if (!prop_is_valid) {
712                                 ast_log(LOG_ERROR, "ARI Endpoint field technology failed validation\n");
713                                 res = 0;
714                         }
715                 } else
716                 {
717                         ast_log(LOG_ERROR,
718                                 "ARI Endpoint has undocumented field %s\n",
719                                 ast_json_object_iter_key(iter));
720                         res = 0;
721                 }
722         }
723
724         if (!has_channel_ids) {
725                 ast_log(LOG_ERROR, "ARI Endpoint missing required field channel_ids\n");
726                 res = 0;
727         }
728
729         if (!has_resource) {
730                 ast_log(LOG_ERROR, "ARI Endpoint missing required field resource\n");
731                 res = 0;
732         }
733
734         if (!has_technology) {
735                 ast_log(LOG_ERROR, "ARI Endpoint missing required field technology\n");
736                 res = 0;
737         }
738
739         return res;
740 }
741
742 ari_validator ast_ari_validate_endpoint_fn(void)
743 {
744         return ast_ari_validate_endpoint;
745 }
746
747 int ast_ari_validate_text_message(struct ast_json *json)
748 {
749         int res = 1;
750         struct ast_json_iter *iter;
751         int has_body = 0;
752         int has_from = 0;
753         int has_to = 0;
754
755         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
756                 if (strcmp("body", ast_json_object_iter_key(iter)) == 0) {
757                         int prop_is_valid;
758                         has_body = 1;
759                         prop_is_valid = ast_ari_validate_string(
760                                 ast_json_object_iter_value(iter));
761                         if (!prop_is_valid) {
762                                 ast_log(LOG_ERROR, "ARI TextMessage field body failed validation\n");
763                                 res = 0;
764                         }
765                 } else
766                 if (strcmp("from", ast_json_object_iter_key(iter)) == 0) {
767                         int prop_is_valid;
768                         has_from = 1;
769                         prop_is_valid = ast_ari_validate_string(
770                                 ast_json_object_iter_value(iter));
771                         if (!prop_is_valid) {
772                                 ast_log(LOG_ERROR, "ARI TextMessage field from failed validation\n");
773                                 res = 0;
774                         }
775                 } else
776                 if (strcmp("to", ast_json_object_iter_key(iter)) == 0) {
777                         int prop_is_valid;
778                         has_to = 1;
779                         prop_is_valid = ast_ari_validate_string(
780                                 ast_json_object_iter_value(iter));
781                         if (!prop_is_valid) {
782                                 ast_log(LOG_ERROR, "ARI TextMessage field to failed validation\n");
783                                 res = 0;
784                         }
785                 } else
786                 if (strcmp("variables", ast_json_object_iter_key(iter)) == 0) {
787                         int prop_is_valid;
788                         prop_is_valid = ast_ari_validate_list(
789                                 ast_json_object_iter_value(iter),
790                                 ast_ari_validate_text_message_variable);
791                         if (!prop_is_valid) {
792                                 ast_log(LOG_ERROR, "ARI TextMessage field variables failed validation\n");
793                                 res = 0;
794                         }
795                 } else
796                 {
797                         ast_log(LOG_ERROR,
798                                 "ARI TextMessage has undocumented field %s\n",
799                                 ast_json_object_iter_key(iter));
800                         res = 0;
801                 }
802         }
803
804         if (!has_body) {
805                 ast_log(LOG_ERROR, "ARI TextMessage missing required field body\n");
806                 res = 0;
807         }
808
809         if (!has_from) {
810                 ast_log(LOG_ERROR, "ARI TextMessage missing required field from\n");
811                 res = 0;
812         }
813
814         if (!has_to) {
815                 ast_log(LOG_ERROR, "ARI TextMessage missing required field to\n");
816                 res = 0;
817         }
818
819         return res;
820 }
821
822 ari_validator ast_ari_validate_text_message_fn(void)
823 {
824         return ast_ari_validate_text_message;
825 }
826
827 int ast_ari_validate_text_message_variable(struct ast_json *json)
828 {
829         int res = 1;
830         struct ast_json_iter *iter;
831         int has_key = 0;
832         int has_value = 0;
833
834         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
835                 if (strcmp("key", ast_json_object_iter_key(iter)) == 0) {
836                         int prop_is_valid;
837                         has_key = 1;
838                         prop_is_valid = ast_ari_validate_string(
839                                 ast_json_object_iter_value(iter));
840                         if (!prop_is_valid) {
841                                 ast_log(LOG_ERROR, "ARI TextMessageVariable field key failed validation\n");
842                                 res = 0;
843                         }
844                 } else
845                 if (strcmp("value", ast_json_object_iter_key(iter)) == 0) {
846                         int prop_is_valid;
847                         has_value = 1;
848                         prop_is_valid = ast_ari_validate_string(
849                                 ast_json_object_iter_value(iter));
850                         if (!prop_is_valid) {
851                                 ast_log(LOG_ERROR, "ARI TextMessageVariable field value failed validation\n");
852                                 res = 0;
853                         }
854                 } else
855                 {
856                         ast_log(LOG_ERROR,
857                                 "ARI TextMessageVariable has undocumented field %s\n",
858                                 ast_json_object_iter_key(iter));
859                         res = 0;
860                 }
861         }
862
863         if (!has_key) {
864                 ast_log(LOG_ERROR, "ARI TextMessageVariable missing required field key\n");
865                 res = 0;
866         }
867
868         if (!has_value) {
869                 ast_log(LOG_ERROR, "ARI TextMessageVariable missing required field value\n");
870                 res = 0;
871         }
872
873         return res;
874 }
875
876 ari_validator ast_ari_validate_text_message_variable_fn(void)
877 {
878         return ast_ari_validate_text_message_variable;
879 }
880
881 int ast_ari_validate_caller_id(struct ast_json *json)
882 {
883         int res = 1;
884         struct ast_json_iter *iter;
885         int has_name = 0;
886         int has_number = 0;
887
888         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
889                 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
890                         int prop_is_valid;
891                         has_name = 1;
892                         prop_is_valid = ast_ari_validate_string(
893                                 ast_json_object_iter_value(iter));
894                         if (!prop_is_valid) {
895                                 ast_log(LOG_ERROR, "ARI CallerID field name failed validation\n");
896                                 res = 0;
897                         }
898                 } else
899                 if (strcmp("number", ast_json_object_iter_key(iter)) == 0) {
900                         int prop_is_valid;
901                         has_number = 1;
902                         prop_is_valid = ast_ari_validate_string(
903                                 ast_json_object_iter_value(iter));
904                         if (!prop_is_valid) {
905                                 ast_log(LOG_ERROR, "ARI CallerID field number failed validation\n");
906                                 res = 0;
907                         }
908                 } else
909                 {
910                         ast_log(LOG_ERROR,
911                                 "ARI CallerID has undocumented field %s\n",
912                                 ast_json_object_iter_key(iter));
913                         res = 0;
914                 }
915         }
916
917         if (!has_name) {
918                 ast_log(LOG_ERROR, "ARI CallerID missing required field name\n");
919                 res = 0;
920         }
921
922         if (!has_number) {
923                 ast_log(LOG_ERROR, "ARI CallerID missing required field number\n");
924                 res = 0;
925         }
926
927         return res;
928 }
929
930 ari_validator ast_ari_validate_caller_id_fn(void)
931 {
932         return ast_ari_validate_caller_id;
933 }
934
935 int ast_ari_validate_channel(struct ast_json *json)
936 {
937         int res = 1;
938         struct ast_json_iter *iter;
939         int has_accountcode = 0;
940         int has_caller = 0;
941         int has_connected = 0;
942         int has_creationtime = 0;
943         int has_dialplan = 0;
944         int has_id = 0;
945         int has_language = 0;
946         int has_name = 0;
947         int has_state = 0;
948
949         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
950                 if (strcmp("accountcode", ast_json_object_iter_key(iter)) == 0) {
951                         int prop_is_valid;
952                         has_accountcode = 1;
953                         prop_is_valid = ast_ari_validate_string(
954                                 ast_json_object_iter_value(iter));
955                         if (!prop_is_valid) {
956                                 ast_log(LOG_ERROR, "ARI Channel field accountcode failed validation\n");
957                                 res = 0;
958                         }
959                 } else
960                 if (strcmp("caller", ast_json_object_iter_key(iter)) == 0) {
961                         int prop_is_valid;
962                         has_caller = 1;
963                         prop_is_valid = ast_ari_validate_caller_id(
964                                 ast_json_object_iter_value(iter));
965                         if (!prop_is_valid) {
966                                 ast_log(LOG_ERROR, "ARI Channel field caller failed validation\n");
967                                 res = 0;
968                         }
969                 } else
970                 if (strcmp("connected", ast_json_object_iter_key(iter)) == 0) {
971                         int prop_is_valid;
972                         has_connected = 1;
973                         prop_is_valid = ast_ari_validate_caller_id(
974                                 ast_json_object_iter_value(iter));
975                         if (!prop_is_valid) {
976                                 ast_log(LOG_ERROR, "ARI Channel field connected failed validation\n");
977                                 res = 0;
978                         }
979                 } else
980                 if (strcmp("creationtime", ast_json_object_iter_key(iter)) == 0) {
981                         int prop_is_valid;
982                         has_creationtime = 1;
983                         prop_is_valid = ast_ari_validate_date(
984                                 ast_json_object_iter_value(iter));
985                         if (!prop_is_valid) {
986                                 ast_log(LOG_ERROR, "ARI Channel field creationtime failed validation\n");
987                                 res = 0;
988                         }
989                 } else
990                 if (strcmp("dialplan", ast_json_object_iter_key(iter)) == 0) {
991                         int prop_is_valid;
992                         has_dialplan = 1;
993                         prop_is_valid = ast_ari_validate_dialplan_cep(
994                                 ast_json_object_iter_value(iter));
995                         if (!prop_is_valid) {
996                                 ast_log(LOG_ERROR, "ARI Channel field dialplan failed validation\n");
997                                 res = 0;
998                         }
999                 } else
1000                 if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
1001                         int prop_is_valid;
1002                         has_id = 1;
1003                         prop_is_valid = ast_ari_validate_string(
1004                                 ast_json_object_iter_value(iter));
1005                         if (!prop_is_valid) {
1006                                 ast_log(LOG_ERROR, "ARI Channel field id failed validation\n");
1007                                 res = 0;
1008                         }
1009                 } else
1010                 if (strcmp("language", ast_json_object_iter_key(iter)) == 0) {
1011                         int prop_is_valid;
1012                         has_language = 1;
1013                         prop_is_valid = ast_ari_validate_string(
1014                                 ast_json_object_iter_value(iter));
1015                         if (!prop_is_valid) {
1016                                 ast_log(LOG_ERROR, "ARI Channel field language failed validation\n");
1017                                 res = 0;
1018                         }
1019                 } else
1020                 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1021                         int prop_is_valid;
1022                         has_name = 1;
1023                         prop_is_valid = ast_ari_validate_string(
1024                                 ast_json_object_iter_value(iter));
1025                         if (!prop_is_valid) {
1026                                 ast_log(LOG_ERROR, "ARI Channel field name failed validation\n");
1027                                 res = 0;
1028                         }
1029                 } else
1030                 if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
1031                         int prop_is_valid;
1032                         has_state = 1;
1033                         prop_is_valid = ast_ari_validate_string(
1034                                 ast_json_object_iter_value(iter));
1035                         if (!prop_is_valid) {
1036                                 ast_log(LOG_ERROR, "ARI Channel field state failed validation\n");
1037                                 res = 0;
1038                         }
1039                 } else
1040                 {
1041                         ast_log(LOG_ERROR,
1042                                 "ARI Channel has undocumented field %s\n",
1043                                 ast_json_object_iter_key(iter));
1044                         res = 0;
1045                 }
1046         }
1047
1048         if (!has_accountcode) {
1049                 ast_log(LOG_ERROR, "ARI Channel missing required field accountcode\n");
1050                 res = 0;
1051         }
1052
1053         if (!has_caller) {
1054                 ast_log(LOG_ERROR, "ARI Channel missing required field caller\n");
1055                 res = 0;
1056         }
1057
1058         if (!has_connected) {
1059                 ast_log(LOG_ERROR, "ARI Channel missing required field connected\n");
1060                 res = 0;
1061         }
1062
1063         if (!has_creationtime) {
1064                 ast_log(LOG_ERROR, "ARI Channel missing required field creationtime\n");
1065                 res = 0;
1066         }
1067
1068         if (!has_dialplan) {
1069                 ast_log(LOG_ERROR, "ARI Channel missing required field dialplan\n");
1070                 res = 0;
1071         }
1072
1073         if (!has_id) {
1074                 ast_log(LOG_ERROR, "ARI Channel missing required field id\n");
1075                 res = 0;
1076         }
1077
1078         if (!has_language) {
1079                 ast_log(LOG_ERROR, "ARI Channel missing required field language\n");
1080                 res = 0;
1081         }
1082
1083         if (!has_name) {
1084                 ast_log(LOG_ERROR, "ARI Channel missing required field name\n");
1085                 res = 0;
1086         }
1087
1088         if (!has_state) {
1089                 ast_log(LOG_ERROR, "ARI Channel missing required field state\n");
1090                 res = 0;
1091         }
1092
1093         return res;
1094 }
1095
1096 ari_validator ast_ari_validate_channel_fn(void)
1097 {
1098         return ast_ari_validate_channel;
1099 }
1100
1101 int ast_ari_validate_dialed(struct ast_json *json)
1102 {
1103         int res = 1;
1104         struct ast_json_iter *iter;
1105
1106         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1107                 {
1108                         ast_log(LOG_ERROR,
1109                                 "ARI Dialed has undocumented field %s\n",
1110                                 ast_json_object_iter_key(iter));
1111                         res = 0;
1112                 }
1113         }
1114
1115         return res;
1116 }
1117
1118 ari_validator ast_ari_validate_dialed_fn(void)
1119 {
1120         return ast_ari_validate_dialed;
1121 }
1122
1123 int ast_ari_validate_dialplan_cep(struct ast_json *json)
1124 {
1125         int res = 1;
1126         struct ast_json_iter *iter;
1127         int has_context = 0;
1128         int has_exten = 0;
1129         int has_priority = 0;
1130
1131         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1132                 if (strcmp("context", ast_json_object_iter_key(iter)) == 0) {
1133                         int prop_is_valid;
1134                         has_context = 1;
1135                         prop_is_valid = ast_ari_validate_string(
1136                                 ast_json_object_iter_value(iter));
1137                         if (!prop_is_valid) {
1138                                 ast_log(LOG_ERROR, "ARI DialplanCEP field context failed validation\n");
1139                                 res = 0;
1140                         }
1141                 } else
1142                 if (strcmp("exten", ast_json_object_iter_key(iter)) == 0) {
1143                         int prop_is_valid;
1144                         has_exten = 1;
1145                         prop_is_valid = ast_ari_validate_string(
1146                                 ast_json_object_iter_value(iter));
1147                         if (!prop_is_valid) {
1148                                 ast_log(LOG_ERROR, "ARI DialplanCEP field exten failed validation\n");
1149                                 res = 0;
1150                         }
1151                 } else
1152                 if (strcmp("priority", ast_json_object_iter_key(iter)) == 0) {
1153                         int prop_is_valid;
1154                         has_priority = 1;
1155                         prop_is_valid = ast_ari_validate_long(
1156                                 ast_json_object_iter_value(iter));
1157                         if (!prop_is_valid) {
1158                                 ast_log(LOG_ERROR, "ARI DialplanCEP field priority failed validation\n");
1159                                 res = 0;
1160                         }
1161                 } else
1162                 {
1163                         ast_log(LOG_ERROR,
1164                                 "ARI DialplanCEP has undocumented field %s\n",
1165                                 ast_json_object_iter_key(iter));
1166                         res = 0;
1167                 }
1168         }
1169
1170         if (!has_context) {
1171                 ast_log(LOG_ERROR, "ARI DialplanCEP missing required field context\n");
1172                 res = 0;
1173         }
1174
1175         if (!has_exten) {
1176                 ast_log(LOG_ERROR, "ARI DialplanCEP missing required field exten\n");
1177                 res = 0;
1178         }
1179
1180         if (!has_priority) {
1181                 ast_log(LOG_ERROR, "ARI DialplanCEP missing required field priority\n");
1182                 res = 0;
1183         }
1184
1185         return res;
1186 }
1187
1188 ari_validator ast_ari_validate_dialplan_cep_fn(void)
1189 {
1190         return ast_ari_validate_dialplan_cep;
1191 }
1192
1193 int ast_ari_validate_bridge(struct ast_json *json)
1194 {
1195         int res = 1;
1196         struct ast_json_iter *iter;
1197         int has_bridge_class = 0;
1198         int has_bridge_type = 0;
1199         int has_channels = 0;
1200         int has_creator = 0;
1201         int has_id = 0;
1202         int has_name = 0;
1203         int has_technology = 0;
1204
1205         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1206                 if (strcmp("bridge_class", ast_json_object_iter_key(iter)) == 0) {
1207                         int prop_is_valid;
1208                         has_bridge_class = 1;
1209                         prop_is_valid = ast_ari_validate_string(
1210                                 ast_json_object_iter_value(iter));
1211                         if (!prop_is_valid) {
1212                                 ast_log(LOG_ERROR, "ARI Bridge field bridge_class failed validation\n");
1213                                 res = 0;
1214                         }
1215                 } else
1216                 if (strcmp("bridge_type", ast_json_object_iter_key(iter)) == 0) {
1217                         int prop_is_valid;
1218                         has_bridge_type = 1;
1219                         prop_is_valid = ast_ari_validate_string(
1220                                 ast_json_object_iter_value(iter));
1221                         if (!prop_is_valid) {
1222                                 ast_log(LOG_ERROR, "ARI Bridge field bridge_type failed validation\n");
1223                                 res = 0;
1224                         }
1225                 } else
1226                 if (strcmp("channels", ast_json_object_iter_key(iter)) == 0) {
1227                         int prop_is_valid;
1228                         has_channels = 1;
1229                         prop_is_valid = ast_ari_validate_list(
1230                                 ast_json_object_iter_value(iter),
1231                                 ast_ari_validate_string);
1232                         if (!prop_is_valid) {
1233                                 ast_log(LOG_ERROR, "ARI Bridge field channels failed validation\n");
1234                                 res = 0;
1235                         }
1236                 } else
1237                 if (strcmp("creator", ast_json_object_iter_key(iter)) == 0) {
1238                         int prop_is_valid;
1239                         has_creator = 1;
1240                         prop_is_valid = ast_ari_validate_string(
1241                                 ast_json_object_iter_value(iter));
1242                         if (!prop_is_valid) {
1243                                 ast_log(LOG_ERROR, "ARI Bridge field creator failed validation\n");
1244                                 res = 0;
1245                         }
1246                 } else
1247                 if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
1248                         int prop_is_valid;
1249                         has_id = 1;
1250                         prop_is_valid = ast_ari_validate_string(
1251                                 ast_json_object_iter_value(iter));
1252                         if (!prop_is_valid) {
1253                                 ast_log(LOG_ERROR, "ARI Bridge field id failed validation\n");
1254                                 res = 0;
1255                         }
1256                 } else
1257                 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1258                         int prop_is_valid;
1259                         has_name = 1;
1260                         prop_is_valid = ast_ari_validate_string(
1261                                 ast_json_object_iter_value(iter));
1262                         if (!prop_is_valid) {
1263                                 ast_log(LOG_ERROR, "ARI Bridge field name failed validation\n");
1264                                 res = 0;
1265                         }
1266                 } else
1267                 if (strcmp("technology", ast_json_object_iter_key(iter)) == 0) {
1268                         int prop_is_valid;
1269                         has_technology = 1;
1270                         prop_is_valid = ast_ari_validate_string(
1271                                 ast_json_object_iter_value(iter));
1272                         if (!prop_is_valid) {
1273                                 ast_log(LOG_ERROR, "ARI Bridge field technology failed validation\n");
1274                                 res = 0;
1275                         }
1276                 } else
1277                 {
1278                         ast_log(LOG_ERROR,
1279                                 "ARI Bridge has undocumented field %s\n",
1280                                 ast_json_object_iter_key(iter));
1281                         res = 0;
1282                 }
1283         }
1284
1285         if (!has_bridge_class) {
1286                 ast_log(LOG_ERROR, "ARI Bridge missing required field bridge_class\n");
1287                 res = 0;
1288         }
1289
1290         if (!has_bridge_type) {
1291                 ast_log(LOG_ERROR, "ARI Bridge missing required field bridge_type\n");
1292                 res = 0;
1293         }
1294
1295         if (!has_channels) {
1296                 ast_log(LOG_ERROR, "ARI Bridge missing required field channels\n");
1297                 res = 0;
1298         }
1299
1300         if (!has_creator) {
1301                 ast_log(LOG_ERROR, "ARI Bridge missing required field creator\n");
1302                 res = 0;
1303         }
1304
1305         if (!has_id) {
1306                 ast_log(LOG_ERROR, "ARI Bridge missing required field id\n");
1307                 res = 0;
1308         }
1309
1310         if (!has_name) {
1311                 ast_log(LOG_ERROR, "ARI Bridge missing required field name\n");
1312                 res = 0;
1313         }
1314
1315         if (!has_technology) {
1316                 ast_log(LOG_ERROR, "ARI Bridge missing required field technology\n");
1317                 res = 0;
1318         }
1319
1320         return res;
1321 }
1322
1323 ari_validator ast_ari_validate_bridge_fn(void)
1324 {
1325         return ast_ari_validate_bridge;
1326 }
1327
1328 int ast_ari_validate_live_recording(struct ast_json *json)
1329 {
1330         int res = 1;
1331         struct ast_json_iter *iter;
1332         int has_format = 0;
1333         int has_name = 0;
1334         int has_state = 0;
1335         int has_target_uri = 0;
1336
1337         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1338                 if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
1339                         int prop_is_valid;
1340                         prop_is_valid = ast_ari_validate_string(
1341                                 ast_json_object_iter_value(iter));
1342                         if (!prop_is_valid) {
1343                                 ast_log(LOG_ERROR, "ARI LiveRecording field cause failed validation\n");
1344                                 res = 0;
1345                         }
1346                 } else
1347                 if (strcmp("duration", ast_json_object_iter_key(iter)) == 0) {
1348                         int prop_is_valid;
1349                         prop_is_valid = ast_ari_validate_int(
1350                                 ast_json_object_iter_value(iter));
1351                         if (!prop_is_valid) {
1352                                 ast_log(LOG_ERROR, "ARI LiveRecording field duration failed validation\n");
1353                                 res = 0;
1354                         }
1355                 } else
1356                 if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
1357                         int prop_is_valid;
1358                         has_format = 1;
1359                         prop_is_valid = ast_ari_validate_string(
1360                                 ast_json_object_iter_value(iter));
1361                         if (!prop_is_valid) {
1362                                 ast_log(LOG_ERROR, "ARI LiveRecording field format failed validation\n");
1363                                 res = 0;
1364                         }
1365                 } else
1366                 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1367                         int prop_is_valid;
1368                         has_name = 1;
1369                         prop_is_valid = ast_ari_validate_string(
1370                                 ast_json_object_iter_value(iter));
1371                         if (!prop_is_valid) {
1372                                 ast_log(LOG_ERROR, "ARI LiveRecording field name failed validation\n");
1373                                 res = 0;
1374                         }
1375                 } else
1376                 if (strcmp("silence_duration", ast_json_object_iter_key(iter)) == 0) {
1377                         int prop_is_valid;
1378                         prop_is_valid = ast_ari_validate_int(
1379                                 ast_json_object_iter_value(iter));
1380                         if (!prop_is_valid) {
1381                                 ast_log(LOG_ERROR, "ARI LiveRecording field silence_duration failed validation\n");
1382                                 res = 0;
1383                         }
1384                 } else
1385                 if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
1386                         int prop_is_valid;
1387                         has_state = 1;
1388                         prop_is_valid = ast_ari_validate_string(
1389                                 ast_json_object_iter_value(iter));
1390                         if (!prop_is_valid) {
1391                                 ast_log(LOG_ERROR, "ARI LiveRecording field state failed validation\n");
1392                                 res = 0;
1393                         }
1394                 } else
1395                 if (strcmp("talking_duration", ast_json_object_iter_key(iter)) == 0) {
1396                         int prop_is_valid;
1397                         prop_is_valid = ast_ari_validate_int(
1398                                 ast_json_object_iter_value(iter));
1399                         if (!prop_is_valid) {
1400                                 ast_log(LOG_ERROR, "ARI LiveRecording field talking_duration failed validation\n");
1401                                 res = 0;
1402                         }
1403                 } else
1404                 if (strcmp("target_uri", ast_json_object_iter_key(iter)) == 0) {
1405                         int prop_is_valid;
1406                         has_target_uri = 1;
1407                         prop_is_valid = ast_ari_validate_string(
1408                                 ast_json_object_iter_value(iter));
1409                         if (!prop_is_valid) {
1410                                 ast_log(LOG_ERROR, "ARI LiveRecording field target_uri failed validation\n");
1411                                 res = 0;
1412                         }
1413                 } else
1414                 {
1415                         ast_log(LOG_ERROR,
1416                                 "ARI LiveRecording has undocumented field %s\n",
1417                                 ast_json_object_iter_key(iter));
1418                         res = 0;
1419                 }
1420         }
1421
1422         if (!has_format) {
1423                 ast_log(LOG_ERROR, "ARI LiveRecording missing required field format\n");
1424                 res = 0;
1425         }
1426
1427         if (!has_name) {
1428                 ast_log(LOG_ERROR, "ARI LiveRecording missing required field name\n");
1429                 res = 0;
1430         }
1431
1432         if (!has_state) {
1433                 ast_log(LOG_ERROR, "ARI LiveRecording missing required field state\n");
1434                 res = 0;
1435         }
1436
1437         if (!has_target_uri) {
1438                 ast_log(LOG_ERROR, "ARI LiveRecording missing required field target_uri\n");
1439                 res = 0;
1440         }
1441
1442         return res;
1443 }
1444
1445 ari_validator ast_ari_validate_live_recording_fn(void)
1446 {
1447         return ast_ari_validate_live_recording;
1448 }
1449
1450 int ast_ari_validate_stored_recording(struct ast_json *json)
1451 {
1452         int res = 1;
1453         struct ast_json_iter *iter;
1454         int has_format = 0;
1455         int has_name = 0;
1456
1457         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1458                 if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
1459                         int prop_is_valid;
1460                         has_format = 1;
1461                         prop_is_valid = ast_ari_validate_string(
1462                                 ast_json_object_iter_value(iter));
1463                         if (!prop_is_valid) {
1464                                 ast_log(LOG_ERROR, "ARI StoredRecording field format failed validation\n");
1465                                 res = 0;
1466                         }
1467                 } else
1468                 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1469                         int prop_is_valid;
1470                         has_name = 1;
1471                         prop_is_valid = ast_ari_validate_string(
1472                                 ast_json_object_iter_value(iter));
1473                         if (!prop_is_valid) {
1474                                 ast_log(LOG_ERROR, "ARI StoredRecording field name failed validation\n");
1475                                 res = 0;
1476                         }
1477                 } else
1478                 {
1479                         ast_log(LOG_ERROR,
1480                                 "ARI StoredRecording has undocumented field %s\n",
1481                                 ast_json_object_iter_key(iter));
1482                         res = 0;
1483                 }
1484         }
1485
1486         if (!has_format) {
1487                 ast_log(LOG_ERROR, "ARI StoredRecording missing required field format\n");
1488                 res = 0;
1489         }
1490
1491         if (!has_name) {
1492                 ast_log(LOG_ERROR, "ARI StoredRecording missing required field name\n");
1493                 res = 0;
1494         }
1495
1496         return res;
1497 }
1498
1499 ari_validator ast_ari_validate_stored_recording_fn(void)
1500 {
1501         return ast_ari_validate_stored_recording;
1502 }
1503
1504 int ast_ari_validate_format_lang_pair(struct ast_json *json)
1505 {
1506         int res = 1;
1507         struct ast_json_iter *iter;
1508         int has_format = 0;
1509         int has_language = 0;
1510
1511         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1512                 if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
1513                         int prop_is_valid;
1514                         has_format = 1;
1515                         prop_is_valid = ast_ari_validate_string(
1516                                 ast_json_object_iter_value(iter));
1517                         if (!prop_is_valid) {
1518                                 ast_log(LOG_ERROR, "ARI FormatLangPair field format failed validation\n");
1519                                 res = 0;
1520                         }
1521                 } else
1522                 if (strcmp("language", ast_json_object_iter_key(iter)) == 0) {
1523                         int prop_is_valid;
1524                         has_language = 1;
1525                         prop_is_valid = ast_ari_validate_string(
1526                                 ast_json_object_iter_value(iter));
1527                         if (!prop_is_valid) {
1528                                 ast_log(LOG_ERROR, "ARI FormatLangPair field language failed validation\n");
1529                                 res = 0;
1530                         }
1531                 } else
1532                 {
1533                         ast_log(LOG_ERROR,
1534                                 "ARI FormatLangPair has undocumented field %s\n",
1535                                 ast_json_object_iter_key(iter));
1536                         res = 0;
1537                 }
1538         }
1539
1540         if (!has_format) {
1541                 ast_log(LOG_ERROR, "ARI FormatLangPair missing required field format\n");
1542                 res = 0;
1543         }
1544
1545         if (!has_language) {
1546                 ast_log(LOG_ERROR, "ARI FormatLangPair missing required field language\n");
1547                 res = 0;
1548         }
1549
1550         return res;
1551 }
1552
1553 ari_validator ast_ari_validate_format_lang_pair_fn(void)
1554 {
1555         return ast_ari_validate_format_lang_pair;
1556 }
1557
1558 int ast_ari_validate_sound(struct ast_json *json)
1559 {
1560         int res = 1;
1561         struct ast_json_iter *iter;
1562         int has_formats = 0;
1563         int has_id = 0;
1564
1565         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1566                 if (strcmp("formats", ast_json_object_iter_key(iter)) == 0) {
1567                         int prop_is_valid;
1568                         has_formats = 1;
1569                         prop_is_valid = ast_ari_validate_list(
1570                                 ast_json_object_iter_value(iter),
1571                                 ast_ari_validate_format_lang_pair);
1572                         if (!prop_is_valid) {
1573                                 ast_log(LOG_ERROR, "ARI Sound field formats failed validation\n");
1574                                 res = 0;
1575                         }
1576                 } else
1577                 if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
1578                         int prop_is_valid;
1579                         has_id = 1;
1580                         prop_is_valid = ast_ari_validate_string(
1581                                 ast_json_object_iter_value(iter));
1582                         if (!prop_is_valid) {
1583                                 ast_log(LOG_ERROR, "ARI Sound field id failed validation\n");
1584                                 res = 0;
1585                         }
1586                 } else
1587                 if (strcmp("text", ast_json_object_iter_key(iter)) == 0) {
1588                         int prop_is_valid;
1589                         prop_is_valid = ast_ari_validate_string(
1590                                 ast_json_object_iter_value(iter));
1591                         if (!prop_is_valid) {
1592                                 ast_log(LOG_ERROR, "ARI Sound field text failed validation\n");
1593                                 res = 0;
1594                         }
1595                 } else
1596                 {
1597                         ast_log(LOG_ERROR,
1598                                 "ARI Sound has undocumented field %s\n",
1599                                 ast_json_object_iter_key(iter));
1600                         res = 0;
1601                 }
1602         }
1603
1604         if (!has_formats) {
1605                 ast_log(LOG_ERROR, "ARI Sound missing required field formats\n");
1606                 res = 0;
1607         }
1608
1609         if (!has_id) {
1610                 ast_log(LOG_ERROR, "ARI Sound missing required field id\n");
1611                 res = 0;
1612         }
1613
1614         return res;
1615 }
1616
1617 ari_validator ast_ari_validate_sound_fn(void)
1618 {
1619         return ast_ari_validate_sound;
1620 }
1621
1622 int ast_ari_validate_playback(struct ast_json *json)
1623 {
1624         int res = 1;
1625         struct ast_json_iter *iter;
1626         int has_id = 0;
1627         int has_media_uri = 0;
1628         int has_state = 0;
1629         int has_target_uri = 0;
1630
1631         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1632                 if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
1633                         int prop_is_valid;
1634                         has_id = 1;
1635                         prop_is_valid = ast_ari_validate_string(
1636                                 ast_json_object_iter_value(iter));
1637                         if (!prop_is_valid) {
1638                                 ast_log(LOG_ERROR, "ARI Playback field id failed validation\n");
1639                                 res = 0;
1640                         }
1641                 } else
1642                 if (strcmp("language", ast_json_object_iter_key(iter)) == 0) {
1643                         int prop_is_valid;
1644                         prop_is_valid = ast_ari_validate_string(
1645                                 ast_json_object_iter_value(iter));
1646                         if (!prop_is_valid) {
1647                                 ast_log(LOG_ERROR, "ARI Playback field language failed validation\n");
1648                                 res = 0;
1649                         }
1650                 } else
1651                 if (strcmp("media_uri", ast_json_object_iter_key(iter)) == 0) {
1652                         int prop_is_valid;
1653                         has_media_uri = 1;
1654                         prop_is_valid = ast_ari_validate_string(
1655                                 ast_json_object_iter_value(iter));
1656                         if (!prop_is_valid) {
1657                                 ast_log(LOG_ERROR, "ARI Playback field media_uri failed validation\n");
1658                                 res = 0;
1659                         }
1660                 } else
1661                 if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
1662                         int prop_is_valid;
1663                         has_state = 1;
1664                         prop_is_valid = ast_ari_validate_string(
1665                                 ast_json_object_iter_value(iter));
1666                         if (!prop_is_valid) {
1667                                 ast_log(LOG_ERROR, "ARI Playback field state failed validation\n");
1668                                 res = 0;
1669                         }
1670                 } else
1671                 if (strcmp("target_uri", ast_json_object_iter_key(iter)) == 0) {
1672                         int prop_is_valid;
1673                         has_target_uri = 1;
1674                         prop_is_valid = ast_ari_validate_string(
1675                                 ast_json_object_iter_value(iter));
1676                         if (!prop_is_valid) {
1677                                 ast_log(LOG_ERROR, "ARI Playback field target_uri failed validation\n");
1678                                 res = 0;
1679                         }
1680                 } else
1681                 {
1682                         ast_log(LOG_ERROR,
1683                                 "ARI Playback has undocumented field %s\n",
1684                                 ast_json_object_iter_key(iter));
1685                         res = 0;
1686                 }
1687         }
1688
1689         if (!has_id) {
1690                 ast_log(LOG_ERROR, "ARI Playback missing required field id\n");
1691                 res = 0;
1692         }
1693
1694         if (!has_media_uri) {
1695                 ast_log(LOG_ERROR, "ARI Playback missing required field media_uri\n");
1696                 res = 0;
1697         }
1698
1699         if (!has_state) {
1700                 ast_log(LOG_ERROR, "ARI Playback missing required field state\n");
1701                 res = 0;
1702         }
1703
1704         if (!has_target_uri) {
1705                 ast_log(LOG_ERROR, "ARI Playback missing required field target_uri\n");
1706                 res = 0;
1707         }
1708
1709         return res;
1710 }
1711
1712 ari_validator ast_ari_validate_playback_fn(void)
1713 {
1714         return ast_ari_validate_playback;
1715 }
1716
1717 int ast_ari_validate_device_state(struct ast_json *json)
1718 {
1719         int res = 1;
1720         struct ast_json_iter *iter;
1721         int has_name = 0;
1722         int has_state = 0;
1723
1724         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1725                 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1726                         int prop_is_valid;
1727                         has_name = 1;
1728                         prop_is_valid = ast_ari_validate_string(
1729                                 ast_json_object_iter_value(iter));
1730                         if (!prop_is_valid) {
1731                                 ast_log(LOG_ERROR, "ARI DeviceState field name failed validation\n");
1732                                 res = 0;
1733                         }
1734                 } else
1735                 if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
1736                         int prop_is_valid;
1737                         has_state = 1;
1738                         prop_is_valid = ast_ari_validate_string(
1739                                 ast_json_object_iter_value(iter));
1740                         if (!prop_is_valid) {
1741                                 ast_log(LOG_ERROR, "ARI DeviceState field state failed validation\n");
1742                                 res = 0;
1743                         }
1744                 } else
1745                 {
1746                         ast_log(LOG_ERROR,
1747                                 "ARI DeviceState has undocumented field %s\n",
1748                                 ast_json_object_iter_key(iter));
1749                         res = 0;
1750                 }
1751         }
1752
1753         if (!has_name) {
1754                 ast_log(LOG_ERROR, "ARI DeviceState missing required field name\n");
1755                 res = 0;
1756         }
1757
1758         if (!has_state) {
1759                 ast_log(LOG_ERROR, "ARI DeviceState missing required field state\n");
1760                 res = 0;
1761         }
1762
1763         return res;
1764 }
1765
1766 ari_validator ast_ari_validate_device_state_fn(void)
1767 {
1768         return ast_ari_validate_device_state;
1769 }
1770
1771 int ast_ari_validate_mailbox(struct ast_json *json)
1772 {
1773         int res = 1;
1774         struct ast_json_iter *iter;
1775         int has_name = 0;
1776         int has_new_messages = 0;
1777         int has_old_messages = 0;
1778
1779         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1780                 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1781                         int prop_is_valid;
1782                         has_name = 1;
1783                         prop_is_valid = ast_ari_validate_string(
1784                                 ast_json_object_iter_value(iter));
1785                         if (!prop_is_valid) {
1786                                 ast_log(LOG_ERROR, "ARI Mailbox field name failed validation\n");
1787                                 res = 0;
1788                         }
1789                 } else
1790                 if (strcmp("new_messages", ast_json_object_iter_key(iter)) == 0) {
1791                         int prop_is_valid;
1792                         has_new_messages = 1;
1793                         prop_is_valid = ast_ari_validate_int(
1794                                 ast_json_object_iter_value(iter));
1795                         if (!prop_is_valid) {
1796                                 ast_log(LOG_ERROR, "ARI Mailbox field new_messages failed validation\n");
1797                                 res = 0;
1798                         }
1799                 } else
1800                 if (strcmp("old_messages", ast_json_object_iter_key(iter)) == 0) {
1801                         int prop_is_valid;
1802                         has_old_messages = 1;
1803                         prop_is_valid = ast_ari_validate_int(
1804                                 ast_json_object_iter_value(iter));
1805                         if (!prop_is_valid) {
1806                                 ast_log(LOG_ERROR, "ARI Mailbox field old_messages failed validation\n");
1807                                 res = 0;
1808                         }
1809                 } else
1810                 {
1811                         ast_log(LOG_ERROR,
1812                                 "ARI Mailbox has undocumented field %s\n",
1813                                 ast_json_object_iter_key(iter));
1814                         res = 0;
1815                 }
1816         }
1817
1818         if (!has_name) {
1819                 ast_log(LOG_ERROR, "ARI Mailbox missing required field name\n");
1820                 res = 0;
1821         }
1822
1823         if (!has_new_messages) {
1824                 ast_log(LOG_ERROR, "ARI Mailbox missing required field new_messages\n");
1825                 res = 0;
1826         }
1827
1828         if (!has_old_messages) {
1829                 ast_log(LOG_ERROR, "ARI Mailbox missing required field old_messages\n");
1830                 res = 0;
1831         }
1832
1833         return res;
1834 }
1835
1836 ari_validator ast_ari_validate_mailbox_fn(void)
1837 {
1838         return ast_ari_validate_mailbox;
1839 }
1840
1841 int ast_ari_validate_application_replaced(struct ast_json *json)
1842 {
1843         int res = 1;
1844         struct ast_json_iter *iter;
1845         int has_type = 0;
1846         int has_application = 0;
1847
1848         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1849                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1850                         int prop_is_valid;
1851                         has_type = 1;
1852                         prop_is_valid = ast_ari_validate_string(
1853                                 ast_json_object_iter_value(iter));
1854                         if (!prop_is_valid) {
1855                                 ast_log(LOG_ERROR, "ARI ApplicationReplaced field type failed validation\n");
1856                                 res = 0;
1857                         }
1858                 } else
1859                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1860                         int prop_is_valid;
1861                         has_application = 1;
1862                         prop_is_valid = ast_ari_validate_string(
1863                                 ast_json_object_iter_value(iter));
1864                         if (!prop_is_valid) {
1865                                 ast_log(LOG_ERROR, "ARI ApplicationReplaced field application failed validation\n");
1866                                 res = 0;
1867                         }
1868                 } else
1869                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1870                         int prop_is_valid;
1871                         prop_is_valid = ast_ari_validate_date(
1872                                 ast_json_object_iter_value(iter));
1873                         if (!prop_is_valid) {
1874                                 ast_log(LOG_ERROR, "ARI ApplicationReplaced field timestamp failed validation\n");
1875                                 res = 0;
1876                         }
1877                 } else
1878                 {
1879                         ast_log(LOG_ERROR,
1880                                 "ARI ApplicationReplaced has undocumented field %s\n",
1881                                 ast_json_object_iter_key(iter));
1882                         res = 0;
1883                 }
1884         }
1885
1886         if (!has_type) {
1887                 ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field type\n");
1888                 res = 0;
1889         }
1890
1891         if (!has_application) {
1892                 ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field application\n");
1893                 res = 0;
1894         }
1895
1896         return res;
1897 }
1898
1899 ari_validator ast_ari_validate_application_replaced_fn(void)
1900 {
1901         return ast_ari_validate_application_replaced;
1902 }
1903
1904 int ast_ari_validate_bridge_attended_transfer(struct ast_json *json)
1905 {
1906         int res = 1;
1907         struct ast_json_iter *iter;
1908         int has_type = 0;
1909         int has_application = 0;
1910         int has_destination_type = 0;
1911         int has_is_external = 0;
1912         int has_result = 0;
1913         int has_transferer_first_leg = 0;
1914         int has_transferer_second_leg = 0;
1915
1916         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1917                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1918                         int prop_is_valid;
1919                         has_type = 1;
1920                         prop_is_valid = ast_ari_validate_string(
1921                                 ast_json_object_iter_value(iter));
1922                         if (!prop_is_valid) {
1923                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field type failed validation\n");
1924                                 res = 0;
1925                         }
1926                 } else
1927                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1928                         int prop_is_valid;
1929                         has_application = 1;
1930                         prop_is_valid = ast_ari_validate_string(
1931                                 ast_json_object_iter_value(iter));
1932                         if (!prop_is_valid) {
1933                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field application failed validation\n");
1934                                 res = 0;
1935                         }
1936                 } else
1937                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1938                         int prop_is_valid;
1939                         prop_is_valid = ast_ari_validate_date(
1940                                 ast_json_object_iter_value(iter));
1941                         if (!prop_is_valid) {
1942                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field timestamp failed validation\n");
1943                                 res = 0;
1944                         }
1945                 } else
1946                 if (strcmp("destination_application", ast_json_object_iter_key(iter)) == 0) {
1947                         int prop_is_valid;
1948                         prop_is_valid = ast_ari_validate_string(
1949                                 ast_json_object_iter_value(iter));
1950                         if (!prop_is_valid) {
1951                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_application failed validation\n");
1952                                 res = 0;
1953                         }
1954                 } else
1955                 if (strcmp("destination_bridge", ast_json_object_iter_key(iter)) == 0) {
1956                         int prop_is_valid;
1957                         prop_is_valid = ast_ari_validate_string(
1958                                 ast_json_object_iter_value(iter));
1959                         if (!prop_is_valid) {
1960                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_bridge failed validation\n");
1961                                 res = 0;
1962                         }
1963                 } else
1964                 if (strcmp("destination_link_first_leg", ast_json_object_iter_key(iter)) == 0) {
1965                         int prop_is_valid;
1966                         prop_is_valid = ast_ari_validate_channel(
1967                                 ast_json_object_iter_value(iter));
1968                         if (!prop_is_valid) {
1969                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_link_first_leg failed validation\n");
1970                                 res = 0;
1971                         }
1972                 } else
1973                 if (strcmp("destination_link_second_leg", ast_json_object_iter_key(iter)) == 0) {
1974                         int prop_is_valid;
1975                         prop_is_valid = ast_ari_validate_channel(
1976                                 ast_json_object_iter_value(iter));
1977                         if (!prop_is_valid) {
1978                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_link_second_leg failed validation\n");
1979                                 res = 0;
1980                         }
1981                 } else
1982                 if (strcmp("destination_threeway_bridge", ast_json_object_iter_key(iter)) == 0) {
1983                         int prop_is_valid;
1984                         prop_is_valid = ast_ari_validate_bridge(
1985                                 ast_json_object_iter_value(iter));
1986                         if (!prop_is_valid) {
1987                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_threeway_bridge failed validation\n");
1988                                 res = 0;
1989                         }
1990                 } else
1991                 if (strcmp("destination_threeway_channel", ast_json_object_iter_key(iter)) == 0) {
1992                         int prop_is_valid;
1993                         prop_is_valid = ast_ari_validate_channel(
1994                                 ast_json_object_iter_value(iter));
1995                         if (!prop_is_valid) {
1996                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_threeway_channel failed validation\n");
1997                                 res = 0;
1998                         }
1999                 } else
2000                 if (strcmp("destination_type", ast_json_object_iter_key(iter)) == 0) {
2001                         int prop_is_valid;
2002                         has_destination_type = 1;
2003                         prop_is_valid = ast_ari_validate_string(
2004                                 ast_json_object_iter_value(iter));
2005                         if (!prop_is_valid) {
2006                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_type failed validation\n");
2007                                 res = 0;
2008                         }
2009                 } else
2010                 if (strcmp("is_external", ast_json_object_iter_key(iter)) == 0) {
2011                         int prop_is_valid;
2012                         has_is_external = 1;
2013                         prop_is_valid = ast_ari_validate_boolean(
2014                                 ast_json_object_iter_value(iter));
2015                         if (!prop_is_valid) {
2016                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field is_external failed validation\n");
2017                                 res = 0;
2018                         }
2019                 } else
2020                 if (strcmp("replace_channel", ast_json_object_iter_key(iter)) == 0) {
2021                         int prop_is_valid;
2022                         prop_is_valid = ast_ari_validate_channel(
2023                                 ast_json_object_iter_value(iter));
2024                         if (!prop_is_valid) {
2025                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field replace_channel failed validation\n");
2026                                 res = 0;
2027                         }
2028                 } else
2029                 if (strcmp("result", ast_json_object_iter_key(iter)) == 0) {
2030                         int prop_is_valid;
2031                         has_result = 1;
2032                         prop_is_valid = ast_ari_validate_string(
2033                                 ast_json_object_iter_value(iter));
2034                         if (!prop_is_valid) {
2035                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field result failed validation\n");
2036                                 res = 0;
2037                         }
2038                 } else
2039                 if (strcmp("transfer_target", ast_json_object_iter_key(iter)) == 0) {
2040                         int prop_is_valid;
2041                         prop_is_valid = ast_ari_validate_channel(
2042                                 ast_json_object_iter_value(iter));
2043                         if (!prop_is_valid) {
2044                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transfer_target failed validation\n");
2045                                 res = 0;
2046                         }
2047                 } else
2048                 if (strcmp("transferee", ast_json_object_iter_key(iter)) == 0) {
2049                         int prop_is_valid;
2050                         prop_is_valid = ast_ari_validate_channel(
2051                                 ast_json_object_iter_value(iter));
2052                         if (!prop_is_valid) {
2053                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferee failed validation\n");
2054                                 res = 0;
2055                         }
2056                 } else
2057                 if (strcmp("transferer_first_leg", ast_json_object_iter_key(iter)) == 0) {
2058                         int prop_is_valid;
2059                         has_transferer_first_leg = 1;
2060                         prop_is_valid = ast_ari_validate_channel(
2061                                 ast_json_object_iter_value(iter));
2062                         if (!prop_is_valid) {
2063                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_first_leg failed validation\n");
2064                                 res = 0;
2065                         }
2066                 } else
2067                 if (strcmp("transferer_first_leg_bridge", ast_json_object_iter_key(iter)) == 0) {
2068                         int prop_is_valid;
2069                         prop_is_valid = ast_ari_validate_bridge(
2070                                 ast_json_object_iter_value(iter));
2071                         if (!prop_is_valid) {
2072                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_first_leg_bridge failed validation\n");
2073                                 res = 0;
2074                         }
2075                 } else
2076                 if (strcmp("transferer_second_leg", ast_json_object_iter_key(iter)) == 0) {
2077                         int prop_is_valid;
2078                         has_transferer_second_leg = 1;
2079                         prop_is_valid = ast_ari_validate_channel(
2080                                 ast_json_object_iter_value(iter));
2081                         if (!prop_is_valid) {
2082                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_second_leg failed validation\n");
2083                                 res = 0;
2084                         }
2085                 } else
2086                 if (strcmp("transferer_second_leg_bridge", ast_json_object_iter_key(iter)) == 0) {
2087                         int prop_is_valid;
2088                         prop_is_valid = ast_ari_validate_bridge(
2089                                 ast_json_object_iter_value(iter));
2090                         if (!prop_is_valid) {
2091                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_second_leg_bridge failed validation\n");
2092                                 res = 0;
2093                         }
2094                 } else
2095                 {
2096                         ast_log(LOG_ERROR,
2097                                 "ARI BridgeAttendedTransfer has undocumented field %s\n",
2098                                 ast_json_object_iter_key(iter));
2099                         res = 0;
2100                 }
2101         }
2102
2103         if (!has_type) {
2104                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field type\n");
2105                 res = 0;
2106         }
2107
2108         if (!has_application) {
2109                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field application\n");
2110                 res = 0;
2111         }
2112
2113         if (!has_destination_type) {
2114                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field destination_type\n");
2115                 res = 0;
2116         }
2117
2118         if (!has_is_external) {
2119                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field is_external\n");
2120                 res = 0;
2121         }
2122
2123         if (!has_result) {
2124                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field result\n");
2125                 res = 0;
2126         }
2127
2128         if (!has_transferer_first_leg) {
2129                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field transferer_first_leg\n");
2130                 res = 0;
2131         }
2132
2133         if (!has_transferer_second_leg) {
2134                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field transferer_second_leg\n");
2135                 res = 0;
2136         }
2137
2138         return res;
2139 }
2140
2141 ari_validator ast_ari_validate_bridge_attended_transfer_fn(void)
2142 {
2143         return ast_ari_validate_bridge_attended_transfer;
2144 }
2145
2146 int ast_ari_validate_bridge_blind_transfer(struct ast_json *json)
2147 {
2148         int res = 1;
2149         struct ast_json_iter *iter;
2150         int has_type = 0;
2151         int has_application = 0;
2152         int has_channel = 0;
2153         int has_context = 0;
2154         int has_exten = 0;
2155         int has_is_external = 0;
2156         int has_result = 0;
2157
2158         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2159                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2160                         int prop_is_valid;
2161                         has_type = 1;
2162                         prop_is_valid = ast_ari_validate_string(
2163                                 ast_json_object_iter_value(iter));
2164                         if (!prop_is_valid) {
2165                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field type failed validation\n");
2166                                 res = 0;
2167                         }
2168                 } else
2169                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2170                         int prop_is_valid;
2171                         has_application = 1;
2172                         prop_is_valid = ast_ari_validate_string(
2173                                 ast_json_object_iter_value(iter));
2174                         if (!prop_is_valid) {
2175                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field application failed validation\n");
2176                                 res = 0;
2177                         }
2178                 } else
2179                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2180                         int prop_is_valid;
2181                         prop_is_valid = ast_ari_validate_date(
2182                                 ast_json_object_iter_value(iter));
2183                         if (!prop_is_valid) {
2184                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field timestamp failed validation\n");
2185                                 res = 0;
2186                         }
2187                 } else
2188                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2189                         int prop_is_valid;
2190                         prop_is_valid = ast_ari_validate_bridge(
2191                                 ast_json_object_iter_value(iter));
2192                         if (!prop_is_valid) {
2193                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field bridge failed validation\n");
2194                                 res = 0;
2195                         }
2196                 } else
2197                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2198                         int prop_is_valid;
2199                         has_channel = 1;
2200                         prop_is_valid = ast_ari_validate_channel(
2201                                 ast_json_object_iter_value(iter));
2202                         if (!prop_is_valid) {
2203                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field channel failed validation\n");
2204                                 res = 0;
2205                         }
2206                 } else
2207                 if (strcmp("context", ast_json_object_iter_key(iter)) == 0) {
2208                         int prop_is_valid;
2209                         has_context = 1;
2210                         prop_is_valid = ast_ari_validate_string(
2211                                 ast_json_object_iter_value(iter));
2212                         if (!prop_is_valid) {
2213                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field context failed validation\n");
2214                                 res = 0;
2215                         }
2216                 } else
2217                 if (strcmp("exten", ast_json_object_iter_key(iter)) == 0) {
2218                         int prop_is_valid;
2219                         has_exten = 1;
2220                         prop_is_valid = ast_ari_validate_string(
2221                                 ast_json_object_iter_value(iter));
2222                         if (!prop_is_valid) {
2223                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field exten failed validation\n");
2224                                 res = 0;
2225                         }
2226                 } else
2227                 if (strcmp("is_external", ast_json_object_iter_key(iter)) == 0) {
2228                         int prop_is_valid;
2229                         has_is_external = 1;
2230                         prop_is_valid = ast_ari_validate_boolean(
2231                                 ast_json_object_iter_value(iter));
2232                         if (!prop_is_valid) {
2233                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field is_external failed validation\n");
2234                                 res = 0;
2235                         }
2236                 } else
2237                 if (strcmp("replace_channel", ast_json_object_iter_key(iter)) == 0) {
2238                         int prop_is_valid;
2239                         prop_is_valid = ast_ari_validate_channel(
2240                                 ast_json_object_iter_value(iter));
2241                         if (!prop_is_valid) {
2242                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field replace_channel failed validation\n");
2243                                 res = 0;
2244                         }
2245                 } else
2246                 if (strcmp("result", ast_json_object_iter_key(iter)) == 0) {
2247                         int prop_is_valid;
2248                         has_result = 1;
2249                         prop_is_valid = ast_ari_validate_string(
2250                                 ast_json_object_iter_value(iter));
2251                         if (!prop_is_valid) {
2252                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field result failed validation\n");
2253                                 res = 0;
2254                         }
2255                 } else
2256                 if (strcmp("transferee", ast_json_object_iter_key(iter)) == 0) {
2257                         int prop_is_valid;
2258                         prop_is_valid = ast_ari_validate_channel(
2259                                 ast_json_object_iter_value(iter));
2260                         if (!prop_is_valid) {
2261                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field transferee failed validation\n");
2262                                 res = 0;
2263                         }
2264                 } else
2265                 {
2266                         ast_log(LOG_ERROR,
2267                                 "ARI BridgeBlindTransfer has undocumented field %s\n",
2268                                 ast_json_object_iter_key(iter));
2269                         res = 0;
2270                 }
2271         }
2272
2273         if (!has_type) {
2274                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field type\n");
2275                 res = 0;
2276         }
2277
2278         if (!has_application) {
2279                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field application\n");
2280                 res = 0;
2281         }
2282
2283         if (!has_channel) {
2284                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field channel\n");
2285                 res = 0;
2286         }
2287
2288         if (!has_context) {
2289                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field context\n");
2290                 res = 0;
2291         }
2292
2293         if (!has_exten) {
2294                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field exten\n");
2295                 res = 0;
2296         }
2297
2298         if (!has_is_external) {
2299                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field is_external\n");
2300                 res = 0;
2301         }
2302
2303         if (!has_result) {
2304                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field result\n");
2305                 res = 0;
2306         }
2307
2308         return res;
2309 }
2310
2311 ari_validator ast_ari_validate_bridge_blind_transfer_fn(void)
2312 {
2313         return ast_ari_validate_bridge_blind_transfer;
2314 }
2315
2316 int ast_ari_validate_bridge_created(struct ast_json *json)
2317 {
2318         int res = 1;
2319         struct ast_json_iter *iter;
2320         int has_type = 0;
2321         int has_application = 0;
2322         int has_bridge = 0;
2323
2324         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2325                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2326                         int prop_is_valid;
2327                         has_type = 1;
2328                         prop_is_valid = ast_ari_validate_string(
2329                                 ast_json_object_iter_value(iter));
2330                         if (!prop_is_valid) {
2331                                 ast_log(LOG_ERROR, "ARI BridgeCreated field type failed validation\n");
2332                                 res = 0;
2333                         }
2334                 } else
2335                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2336                         int prop_is_valid;
2337                         has_application = 1;
2338                         prop_is_valid = ast_ari_validate_string(
2339                                 ast_json_object_iter_value(iter));
2340                         if (!prop_is_valid) {
2341                                 ast_log(LOG_ERROR, "ARI BridgeCreated field application failed validation\n");
2342                                 res = 0;
2343                         }
2344                 } else
2345                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2346                         int prop_is_valid;
2347                         prop_is_valid = ast_ari_validate_date(
2348                                 ast_json_object_iter_value(iter));
2349                         if (!prop_is_valid) {
2350                                 ast_log(LOG_ERROR, "ARI BridgeCreated field timestamp failed validation\n");
2351                                 res = 0;
2352                         }
2353                 } else
2354                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2355                         int prop_is_valid;
2356                         has_bridge = 1;
2357                         prop_is_valid = ast_ari_validate_bridge(
2358                                 ast_json_object_iter_value(iter));
2359                         if (!prop_is_valid) {
2360                                 ast_log(LOG_ERROR, "ARI BridgeCreated field bridge failed validation\n");
2361                                 res = 0;
2362                         }
2363                 } else
2364                 {
2365                         ast_log(LOG_ERROR,
2366                                 "ARI BridgeCreated has undocumented field %s\n",
2367                                 ast_json_object_iter_key(iter));
2368                         res = 0;
2369                 }
2370         }
2371
2372         if (!has_type) {
2373                 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field type\n");
2374                 res = 0;
2375         }
2376
2377         if (!has_application) {
2378                 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field application\n");
2379                 res = 0;
2380         }
2381
2382         if (!has_bridge) {
2383                 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field bridge\n");
2384                 res = 0;
2385         }
2386
2387         return res;
2388 }
2389
2390 ari_validator ast_ari_validate_bridge_created_fn(void)
2391 {
2392         return ast_ari_validate_bridge_created;
2393 }
2394
2395 int ast_ari_validate_bridge_destroyed(struct ast_json *json)
2396 {
2397         int res = 1;
2398         struct ast_json_iter *iter;
2399         int has_type = 0;
2400         int has_application = 0;
2401         int has_bridge = 0;
2402
2403         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2404                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2405                         int prop_is_valid;
2406                         has_type = 1;
2407                         prop_is_valid = ast_ari_validate_string(
2408                                 ast_json_object_iter_value(iter));
2409                         if (!prop_is_valid) {
2410                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field type failed validation\n");
2411                                 res = 0;
2412                         }
2413                 } else
2414                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2415                         int prop_is_valid;
2416                         has_application = 1;
2417                         prop_is_valid = ast_ari_validate_string(
2418                                 ast_json_object_iter_value(iter));
2419                         if (!prop_is_valid) {
2420                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field application failed validation\n");
2421                                 res = 0;
2422                         }
2423                 } else
2424                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2425                         int prop_is_valid;
2426                         prop_is_valid = ast_ari_validate_date(
2427                                 ast_json_object_iter_value(iter));
2428                         if (!prop_is_valid) {
2429                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field timestamp failed validation\n");
2430                                 res = 0;
2431                         }
2432                 } else
2433                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2434                         int prop_is_valid;
2435                         has_bridge = 1;
2436                         prop_is_valid = ast_ari_validate_bridge(
2437                                 ast_json_object_iter_value(iter));
2438                         if (!prop_is_valid) {
2439                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field bridge failed validation\n");
2440                                 res = 0;
2441                         }
2442                 } else
2443                 {
2444                         ast_log(LOG_ERROR,
2445                                 "ARI BridgeDestroyed has undocumented field %s\n",
2446                                 ast_json_object_iter_key(iter));
2447                         res = 0;
2448                 }
2449         }
2450
2451         if (!has_type) {
2452                 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field type\n");
2453                 res = 0;
2454         }
2455
2456         if (!has_application) {
2457                 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field application\n");
2458                 res = 0;
2459         }
2460
2461         if (!has_bridge) {
2462                 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field bridge\n");
2463                 res = 0;
2464         }
2465
2466         return res;
2467 }
2468
2469 ari_validator ast_ari_validate_bridge_destroyed_fn(void)
2470 {
2471         return ast_ari_validate_bridge_destroyed;
2472 }
2473
2474 int ast_ari_validate_bridge_merged(struct ast_json *json)
2475 {
2476         int res = 1;
2477         struct ast_json_iter *iter;
2478         int has_type = 0;
2479         int has_application = 0;
2480         int has_bridge = 0;
2481         int has_bridge_from = 0;
2482
2483         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2484                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2485                         int prop_is_valid;
2486                         has_type = 1;
2487                         prop_is_valid = ast_ari_validate_string(
2488                                 ast_json_object_iter_value(iter));
2489                         if (!prop_is_valid) {
2490                                 ast_log(LOG_ERROR, "ARI BridgeMerged field type failed validation\n");
2491                                 res = 0;
2492                         }
2493                 } else
2494                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2495                         int prop_is_valid;
2496                         has_application = 1;
2497                         prop_is_valid = ast_ari_validate_string(
2498                                 ast_json_object_iter_value(iter));
2499                         if (!prop_is_valid) {
2500                                 ast_log(LOG_ERROR, "ARI BridgeMerged field application failed validation\n");
2501                                 res = 0;
2502                         }
2503                 } else
2504                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2505                         int prop_is_valid;
2506                         prop_is_valid = ast_ari_validate_date(
2507                                 ast_json_object_iter_value(iter));
2508                         if (!prop_is_valid) {
2509                                 ast_log(LOG_ERROR, "ARI BridgeMerged field timestamp failed validation\n");
2510                                 res = 0;
2511                         }
2512                 } else
2513                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2514                         int prop_is_valid;
2515                         has_bridge = 1;
2516                         prop_is_valid = ast_ari_validate_bridge(
2517                                 ast_json_object_iter_value(iter));
2518                         if (!prop_is_valid) {
2519                                 ast_log(LOG_ERROR, "ARI BridgeMerged field bridge failed validation\n");
2520                                 res = 0;
2521                         }
2522                 } else
2523                 if (strcmp("bridge_from", ast_json_object_iter_key(iter)) == 0) {
2524                         int prop_is_valid;
2525                         has_bridge_from = 1;
2526                         prop_is_valid = ast_ari_validate_bridge(
2527                                 ast_json_object_iter_value(iter));
2528                         if (!prop_is_valid) {
2529                                 ast_log(LOG_ERROR, "ARI BridgeMerged field bridge_from failed validation\n");
2530                                 res = 0;
2531                         }
2532                 } else
2533                 {
2534                         ast_log(LOG_ERROR,
2535                                 "ARI BridgeMerged has undocumented field %s\n",
2536                                 ast_json_object_iter_key(iter));
2537                         res = 0;
2538                 }
2539         }
2540
2541         if (!has_type) {
2542                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field type\n");
2543                 res = 0;
2544         }
2545
2546         if (!has_application) {
2547                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field application\n");
2548                 res = 0;
2549         }
2550
2551         if (!has_bridge) {
2552                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge\n");
2553                 res = 0;
2554         }
2555
2556         if (!has_bridge_from) {
2557                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge_from\n");
2558                 res = 0;
2559         }
2560
2561         return res;
2562 }
2563
2564 ari_validator ast_ari_validate_bridge_merged_fn(void)
2565 {
2566         return ast_ari_validate_bridge_merged;
2567 }
2568
2569 int ast_ari_validate_channel_caller_id(struct ast_json *json)
2570 {
2571         int res = 1;
2572         struct ast_json_iter *iter;
2573         int has_type = 0;
2574         int has_application = 0;
2575         int has_caller_presentation = 0;
2576         int has_caller_presentation_txt = 0;
2577         int has_channel = 0;
2578
2579         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2580                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2581                         int prop_is_valid;
2582                         has_type = 1;
2583                         prop_is_valid = ast_ari_validate_string(
2584                                 ast_json_object_iter_value(iter));
2585                         if (!prop_is_valid) {
2586                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field type failed validation\n");
2587                                 res = 0;
2588                         }
2589                 } else
2590                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2591                         int prop_is_valid;
2592                         has_application = 1;
2593                         prop_is_valid = ast_ari_validate_string(
2594                                 ast_json_object_iter_value(iter));
2595                         if (!prop_is_valid) {
2596                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field application failed validation\n");
2597                                 res = 0;
2598                         }
2599                 } else
2600                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2601                         int prop_is_valid;
2602                         prop_is_valid = ast_ari_validate_date(
2603                                 ast_json_object_iter_value(iter));
2604                         if (!prop_is_valid) {
2605                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field timestamp failed validation\n");
2606                                 res = 0;
2607                         }
2608                 } else
2609                 if (strcmp("caller_presentation", ast_json_object_iter_key(iter)) == 0) {
2610                         int prop_is_valid;
2611                         has_caller_presentation = 1;
2612                         prop_is_valid = ast_ari_validate_int(
2613                                 ast_json_object_iter_value(iter));
2614                         if (!prop_is_valid) {
2615                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation failed validation\n");
2616                                 res = 0;
2617                         }
2618                 } else
2619                 if (strcmp("caller_presentation_txt", ast_json_object_iter_key(iter)) == 0) {
2620                         int prop_is_valid;
2621                         has_caller_presentation_txt = 1;
2622                         prop_is_valid = ast_ari_validate_string(
2623                                 ast_json_object_iter_value(iter));
2624                         if (!prop_is_valid) {
2625                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation_txt failed validation\n");
2626                                 res = 0;
2627                         }
2628                 } else
2629                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2630                         int prop_is_valid;
2631                         has_channel = 1;
2632                         prop_is_valid = ast_ari_validate_channel(
2633                                 ast_json_object_iter_value(iter));
2634                         if (!prop_is_valid) {
2635                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field channel failed validation\n");
2636                                 res = 0;
2637                         }
2638                 } else
2639                 {
2640                         ast_log(LOG_ERROR,
2641                                 "ARI ChannelCallerId has undocumented field %s\n",
2642                                 ast_json_object_iter_key(iter));
2643                         res = 0;
2644                 }
2645         }
2646
2647         if (!has_type) {
2648                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field type\n");
2649                 res = 0;
2650         }
2651
2652         if (!has_application) {
2653                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field application\n");
2654                 res = 0;
2655         }
2656
2657         if (!has_caller_presentation) {
2658                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation\n");
2659                 res = 0;
2660         }
2661
2662         if (!has_caller_presentation_txt) {
2663                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation_txt\n");
2664                 res = 0;
2665         }
2666
2667         if (!has_channel) {
2668                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field channel\n");
2669                 res = 0;
2670         }
2671
2672         return res;
2673 }
2674
2675 ari_validator ast_ari_validate_channel_caller_id_fn(void)
2676 {
2677         return ast_ari_validate_channel_caller_id;
2678 }
2679
2680 int ast_ari_validate_channel_connected_line(struct ast_json *json)
2681 {
2682         int res = 1;
2683         struct ast_json_iter *iter;
2684         int has_type = 0;
2685         int has_application = 0;
2686         int has_channel = 0;
2687
2688         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2689                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2690                         int prop_is_valid;
2691                         has_type = 1;
2692                         prop_is_valid = ast_ari_validate_string(
2693                                 ast_json_object_iter_value(iter));
2694                         if (!prop_is_valid) {
2695                                 ast_log(LOG_ERROR, "ARI ChannelConnectedLine field type failed validation\n");
2696                                 res = 0;
2697                         }
2698                 } else
2699                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2700                         int prop_is_valid;
2701                         has_application = 1;
2702                         prop_is_valid = ast_ari_validate_string(
2703                                 ast_json_object_iter_value(iter));
2704                         if (!prop_is_valid) {
2705                                 ast_log(LOG_ERROR, "ARI ChannelConnectedLine field application failed validation\n");
2706                                 res = 0;
2707                         }
2708                 } else
2709                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2710                         int prop_is_valid;
2711                         prop_is_valid = ast_ari_validate_date(
2712                                 ast_json_object_iter_value(iter));
2713                         if (!prop_is_valid) {
2714                                 ast_log(LOG_ERROR, "ARI ChannelConnectedLine field timestamp failed validation\n");
2715                                 res = 0;
2716                         }
2717                 } else
2718                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2719                         int prop_is_valid;
2720                         has_channel = 1;
2721                         prop_is_valid = ast_ari_validate_channel(
2722                                 ast_json_object_iter_value(iter));
2723                         if (!prop_is_valid) {
2724                                 ast_log(LOG_ERROR, "ARI ChannelConnectedLine field channel failed validation\n");
2725                                 res = 0;
2726                         }
2727                 } else
2728                 {
2729                         ast_log(LOG_ERROR,
2730                                 "ARI ChannelConnectedLine has undocumented field %s\n",
2731                                 ast_json_object_iter_key(iter));
2732                         res = 0;
2733                 }
2734         }
2735
2736         if (!has_type) {
2737                 ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field type\n");
2738                 res = 0;
2739         }
2740
2741         if (!has_application) {
2742                 ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field application\n");
2743                 res = 0;
2744         }
2745
2746         if (!has_channel) {
2747                 ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field channel\n");
2748                 res = 0;
2749         }
2750
2751         return res;
2752 }
2753
2754 ari_validator ast_ari_validate_channel_connected_line_fn(void)
2755 {
2756         return ast_ari_validate_channel_connected_line;
2757 }
2758
2759 int ast_ari_validate_channel_created(struct ast_json *json)
2760 {
2761         int res = 1;
2762         struct ast_json_iter *iter;
2763         int has_type = 0;
2764         int has_application = 0;
2765         int has_channel = 0;
2766
2767         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2768                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2769                         int prop_is_valid;
2770                         has_type = 1;
2771                         prop_is_valid = ast_ari_validate_string(
2772                                 ast_json_object_iter_value(iter));
2773                         if (!prop_is_valid) {
2774                                 ast_log(LOG_ERROR, "ARI ChannelCreated field type failed validation\n");
2775                                 res = 0;
2776                         }
2777                 } else
2778                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2779                         int prop_is_valid;
2780                         has_application = 1;
2781                         prop_is_valid = ast_ari_validate_string(
2782                                 ast_json_object_iter_value(iter));
2783                         if (!prop_is_valid) {
2784                                 ast_log(LOG_ERROR, "ARI ChannelCreated field application failed validation\n");
2785                                 res = 0;
2786                         }
2787                 } else
2788                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2789                         int prop_is_valid;
2790                         prop_is_valid = ast_ari_validate_date(
2791                                 ast_json_object_iter_value(iter));
2792                         if (!prop_is_valid) {
2793                                 ast_log(LOG_ERROR, "ARI ChannelCreated field timestamp failed validation\n");
2794                                 res = 0;
2795                         }
2796                 } else
2797                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2798                         int prop_is_valid;
2799                         has_channel = 1;
2800                         prop_is_valid = ast_ari_validate_channel(
2801                                 ast_json_object_iter_value(iter));
2802                         if (!prop_is_valid) {
2803                                 ast_log(LOG_ERROR, "ARI ChannelCreated field channel failed validation\n");
2804                                 res = 0;
2805                         }
2806                 } else
2807                 {
2808                         ast_log(LOG_ERROR,
2809                                 "ARI ChannelCreated has undocumented field %s\n",
2810                                 ast_json_object_iter_key(iter));
2811                         res = 0;