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