d99240bd8681e8cdab281e98089766721a159e2e
[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_id = 0;
895         int has_technology = 0;
896
897         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
898                 if (strcmp("bridge_class", ast_json_object_iter_key(iter)) == 0) {
899                         int prop_is_valid;
900                         has_bridge_class = 1;
901                         prop_is_valid = ast_ari_validate_string(
902                                 ast_json_object_iter_value(iter));
903                         if (!prop_is_valid) {
904                                 ast_log(LOG_ERROR, "ARI Bridge field bridge_class failed validation\n");
905                                 res = 0;
906                         }
907                 } else
908                 if (strcmp("bridge_type", ast_json_object_iter_key(iter)) == 0) {
909                         int prop_is_valid;
910                         has_bridge_type = 1;
911                         prop_is_valid = ast_ari_validate_string(
912                                 ast_json_object_iter_value(iter));
913                         if (!prop_is_valid) {
914                                 ast_log(LOG_ERROR, "ARI Bridge field bridge_type failed validation\n");
915                                 res = 0;
916                         }
917                 } else
918                 if (strcmp("channels", ast_json_object_iter_key(iter)) == 0) {
919                         int prop_is_valid;
920                         has_channels = 1;
921                         prop_is_valid = ast_ari_validate_list(
922                                 ast_json_object_iter_value(iter),
923                                 ast_ari_validate_string);
924                         if (!prop_is_valid) {
925                                 ast_log(LOG_ERROR, "ARI Bridge field channels failed validation\n");
926                                 res = 0;
927                         }
928                 } else
929                 if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
930                         int prop_is_valid;
931                         has_id = 1;
932                         prop_is_valid = ast_ari_validate_string(
933                                 ast_json_object_iter_value(iter));
934                         if (!prop_is_valid) {
935                                 ast_log(LOG_ERROR, "ARI Bridge field id failed validation\n");
936                                 res = 0;
937                         }
938                 } else
939                 if (strcmp("technology", ast_json_object_iter_key(iter)) == 0) {
940                         int prop_is_valid;
941                         has_technology = 1;
942                         prop_is_valid = ast_ari_validate_string(
943                                 ast_json_object_iter_value(iter));
944                         if (!prop_is_valid) {
945                                 ast_log(LOG_ERROR, "ARI Bridge field technology failed validation\n");
946                                 res = 0;
947                         }
948                 } else
949                 {
950                         ast_log(LOG_ERROR,
951                                 "ARI Bridge has undocumented field %s\n",
952                                 ast_json_object_iter_key(iter));
953                         res = 0;
954                 }
955         }
956
957         if (!has_bridge_class) {
958                 ast_log(LOG_ERROR, "ARI Bridge missing required field bridge_class\n");
959                 res = 0;
960         }
961
962         if (!has_bridge_type) {
963                 ast_log(LOG_ERROR, "ARI Bridge missing required field bridge_type\n");
964                 res = 0;
965         }
966
967         if (!has_channels) {
968                 ast_log(LOG_ERROR, "ARI Bridge missing required field channels\n");
969                 res = 0;
970         }
971
972         if (!has_id) {
973                 ast_log(LOG_ERROR, "ARI Bridge missing required field id\n");
974                 res = 0;
975         }
976
977         if (!has_technology) {
978                 ast_log(LOG_ERROR, "ARI Bridge missing required field technology\n");
979                 res = 0;
980         }
981
982         return res;
983 }
984
985 ari_validator ast_ari_validate_bridge_fn(void)
986 {
987         return ast_ari_validate_bridge;
988 }
989
990 int ast_ari_validate_live_recording(struct ast_json *json)
991 {
992         int res = 1;
993         struct ast_json_iter *iter;
994         int has_format = 0;
995         int has_name = 0;
996         int has_state = 0;
997
998         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
999                 if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
1000                         int prop_is_valid;
1001                         prop_is_valid = ast_ari_validate_string(
1002                                 ast_json_object_iter_value(iter));
1003                         if (!prop_is_valid) {
1004                                 ast_log(LOG_ERROR, "ARI LiveRecording field cause failed validation\n");
1005                                 res = 0;
1006                         }
1007                 } else
1008                 if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
1009                         int prop_is_valid;
1010                         has_format = 1;
1011                         prop_is_valid = ast_ari_validate_string(
1012                                 ast_json_object_iter_value(iter));
1013                         if (!prop_is_valid) {
1014                                 ast_log(LOG_ERROR, "ARI LiveRecording field format failed validation\n");
1015                                 res = 0;
1016                         }
1017                 } else
1018                 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1019                         int prop_is_valid;
1020                         has_name = 1;
1021                         prop_is_valid = ast_ari_validate_string(
1022                                 ast_json_object_iter_value(iter));
1023                         if (!prop_is_valid) {
1024                                 ast_log(LOG_ERROR, "ARI LiveRecording field name failed validation\n");
1025                                 res = 0;
1026                         }
1027                 } else
1028                 if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
1029                         int prop_is_valid;
1030                         has_state = 1;
1031                         prop_is_valid = ast_ari_validate_string(
1032                                 ast_json_object_iter_value(iter));
1033                         if (!prop_is_valid) {
1034                                 ast_log(LOG_ERROR, "ARI LiveRecording field state failed validation\n");
1035                                 res = 0;
1036                         }
1037                 } else
1038                 {
1039                         ast_log(LOG_ERROR,
1040                                 "ARI LiveRecording has undocumented field %s\n",
1041                                 ast_json_object_iter_key(iter));
1042                         res = 0;
1043                 }
1044         }
1045
1046         if (!has_format) {
1047                 ast_log(LOG_ERROR, "ARI LiveRecording missing required field format\n");
1048                 res = 0;
1049         }
1050
1051         if (!has_name) {
1052                 ast_log(LOG_ERROR, "ARI LiveRecording missing required field name\n");
1053                 res = 0;
1054         }
1055
1056         if (!has_state) {
1057                 ast_log(LOG_ERROR, "ARI LiveRecording missing required field state\n");
1058                 res = 0;
1059         }
1060
1061         return res;
1062 }
1063
1064 ari_validator ast_ari_validate_live_recording_fn(void)
1065 {
1066         return ast_ari_validate_live_recording;
1067 }
1068
1069 int ast_ari_validate_stored_recording(struct ast_json *json)
1070 {
1071         int res = 1;
1072         struct ast_json_iter *iter;
1073         int has_format = 0;
1074         int has_name = 0;
1075
1076         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1077                 if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
1078                         int prop_is_valid;
1079                         has_format = 1;
1080                         prop_is_valid = ast_ari_validate_string(
1081                                 ast_json_object_iter_value(iter));
1082                         if (!prop_is_valid) {
1083                                 ast_log(LOG_ERROR, "ARI StoredRecording field format failed validation\n");
1084                                 res = 0;
1085                         }
1086                 } else
1087                 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1088                         int prop_is_valid;
1089                         has_name = 1;
1090                         prop_is_valid = ast_ari_validate_string(
1091                                 ast_json_object_iter_value(iter));
1092                         if (!prop_is_valid) {
1093                                 ast_log(LOG_ERROR, "ARI StoredRecording field name failed validation\n");
1094                                 res = 0;
1095                         }
1096                 } else
1097                 {
1098                         ast_log(LOG_ERROR,
1099                                 "ARI StoredRecording has undocumented field %s\n",
1100                                 ast_json_object_iter_key(iter));
1101                         res = 0;
1102                 }
1103         }
1104
1105         if (!has_format) {
1106                 ast_log(LOG_ERROR, "ARI StoredRecording missing required field format\n");
1107                 res = 0;
1108         }
1109
1110         if (!has_name) {
1111                 ast_log(LOG_ERROR, "ARI StoredRecording missing required field name\n");
1112                 res = 0;
1113         }
1114
1115         return res;
1116 }
1117
1118 ari_validator ast_ari_validate_stored_recording_fn(void)
1119 {
1120         return ast_ari_validate_stored_recording;
1121 }
1122
1123 int ast_ari_validate_format_lang_pair(struct ast_json *json)
1124 {
1125         int res = 1;
1126         struct ast_json_iter *iter;
1127         int has_format = 0;
1128         int has_language = 0;
1129
1130         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1131                 if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
1132                         int prop_is_valid;
1133                         has_format = 1;
1134                         prop_is_valid = ast_ari_validate_string(
1135                                 ast_json_object_iter_value(iter));
1136                         if (!prop_is_valid) {
1137                                 ast_log(LOG_ERROR, "ARI FormatLangPair field format failed validation\n");
1138                                 res = 0;
1139                         }
1140                 } else
1141                 if (strcmp("language", ast_json_object_iter_key(iter)) == 0) {
1142                         int prop_is_valid;
1143                         has_language = 1;
1144                         prop_is_valid = ast_ari_validate_string(
1145                                 ast_json_object_iter_value(iter));
1146                         if (!prop_is_valid) {
1147                                 ast_log(LOG_ERROR, "ARI FormatLangPair field language failed validation\n");
1148                                 res = 0;
1149                         }
1150                 } else
1151                 {
1152                         ast_log(LOG_ERROR,
1153                                 "ARI FormatLangPair has undocumented field %s\n",
1154                                 ast_json_object_iter_key(iter));
1155                         res = 0;
1156                 }
1157         }
1158
1159         if (!has_format) {
1160                 ast_log(LOG_ERROR, "ARI FormatLangPair missing required field format\n");
1161                 res = 0;
1162         }
1163
1164         if (!has_language) {
1165                 ast_log(LOG_ERROR, "ARI FormatLangPair missing required field language\n");
1166                 res = 0;
1167         }
1168
1169         return res;
1170 }
1171
1172 ari_validator ast_ari_validate_format_lang_pair_fn(void)
1173 {
1174         return ast_ari_validate_format_lang_pair;
1175 }
1176
1177 int ast_ari_validate_sound(struct ast_json *json)
1178 {
1179         int res = 1;
1180         struct ast_json_iter *iter;
1181         int has_formats = 0;
1182         int has_id = 0;
1183
1184         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1185                 if (strcmp("formats", ast_json_object_iter_key(iter)) == 0) {
1186                         int prop_is_valid;
1187                         has_formats = 1;
1188                         prop_is_valid = ast_ari_validate_list(
1189                                 ast_json_object_iter_value(iter),
1190                                 ast_ari_validate_format_lang_pair);
1191                         if (!prop_is_valid) {
1192                                 ast_log(LOG_ERROR, "ARI Sound field formats failed validation\n");
1193                                 res = 0;
1194                         }
1195                 } else
1196                 if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
1197                         int prop_is_valid;
1198                         has_id = 1;
1199                         prop_is_valid = ast_ari_validate_string(
1200                                 ast_json_object_iter_value(iter));
1201                         if (!prop_is_valid) {
1202                                 ast_log(LOG_ERROR, "ARI Sound field id failed validation\n");
1203                                 res = 0;
1204                         }
1205                 } else
1206                 if (strcmp("text", ast_json_object_iter_key(iter)) == 0) {
1207                         int prop_is_valid;
1208                         prop_is_valid = ast_ari_validate_string(
1209                                 ast_json_object_iter_value(iter));
1210                         if (!prop_is_valid) {
1211                                 ast_log(LOG_ERROR, "ARI Sound field text failed validation\n");
1212                                 res = 0;
1213                         }
1214                 } else
1215                 {
1216                         ast_log(LOG_ERROR,
1217                                 "ARI Sound has undocumented field %s\n",
1218                                 ast_json_object_iter_key(iter));
1219                         res = 0;
1220                 }
1221         }
1222
1223         if (!has_formats) {
1224                 ast_log(LOG_ERROR, "ARI Sound missing required field formats\n");
1225                 res = 0;
1226         }
1227
1228         if (!has_id) {
1229                 ast_log(LOG_ERROR, "ARI Sound missing required field id\n");
1230                 res = 0;
1231         }
1232
1233         return res;
1234 }
1235
1236 ari_validator ast_ari_validate_sound_fn(void)
1237 {
1238         return ast_ari_validate_sound;
1239 }
1240
1241 int ast_ari_validate_playback(struct ast_json *json)
1242 {
1243         int res = 1;
1244         struct ast_json_iter *iter;
1245         int has_id = 0;
1246         int has_media_uri = 0;
1247         int has_state = 0;
1248         int has_target_uri = 0;
1249
1250         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1251                 if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
1252                         int prop_is_valid;
1253                         has_id = 1;
1254                         prop_is_valid = ast_ari_validate_string(
1255                                 ast_json_object_iter_value(iter));
1256                         if (!prop_is_valid) {
1257                                 ast_log(LOG_ERROR, "ARI Playback field id failed validation\n");
1258                                 res = 0;
1259                         }
1260                 } else
1261                 if (strcmp("language", ast_json_object_iter_key(iter)) == 0) {
1262                         int prop_is_valid;
1263                         prop_is_valid = ast_ari_validate_string(
1264                                 ast_json_object_iter_value(iter));
1265                         if (!prop_is_valid) {
1266                                 ast_log(LOG_ERROR, "ARI Playback field language failed validation\n");
1267                                 res = 0;
1268                         }
1269                 } else
1270                 if (strcmp("media_uri", ast_json_object_iter_key(iter)) == 0) {
1271                         int prop_is_valid;
1272                         has_media_uri = 1;
1273                         prop_is_valid = ast_ari_validate_string(
1274                                 ast_json_object_iter_value(iter));
1275                         if (!prop_is_valid) {
1276                                 ast_log(LOG_ERROR, "ARI Playback field media_uri failed validation\n");
1277                                 res = 0;
1278                         }
1279                 } else
1280                 if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
1281                         int prop_is_valid;
1282                         has_state = 1;
1283                         prop_is_valid = ast_ari_validate_string(
1284                                 ast_json_object_iter_value(iter));
1285                         if (!prop_is_valid) {
1286                                 ast_log(LOG_ERROR, "ARI Playback field state failed validation\n");
1287                                 res = 0;
1288                         }
1289                 } else
1290                 if (strcmp("target_uri", ast_json_object_iter_key(iter)) == 0) {
1291                         int prop_is_valid;
1292                         has_target_uri = 1;
1293                         prop_is_valid = ast_ari_validate_string(
1294                                 ast_json_object_iter_value(iter));
1295                         if (!prop_is_valid) {
1296                                 ast_log(LOG_ERROR, "ARI Playback field target_uri failed validation\n");
1297                                 res = 0;
1298                         }
1299                 } else
1300                 {
1301                         ast_log(LOG_ERROR,
1302                                 "ARI Playback has undocumented field %s\n",
1303                                 ast_json_object_iter_key(iter));
1304                         res = 0;
1305                 }
1306         }
1307
1308         if (!has_id) {
1309                 ast_log(LOG_ERROR, "ARI Playback missing required field id\n");
1310                 res = 0;
1311         }
1312
1313         if (!has_media_uri) {
1314                 ast_log(LOG_ERROR, "ARI Playback missing required field media_uri\n");
1315                 res = 0;
1316         }
1317
1318         if (!has_state) {
1319                 ast_log(LOG_ERROR, "ARI Playback missing required field state\n");
1320                 res = 0;
1321         }
1322
1323         if (!has_target_uri) {
1324                 ast_log(LOG_ERROR, "ARI Playback missing required field target_uri\n");
1325                 res = 0;
1326         }
1327
1328         return res;
1329 }
1330
1331 ari_validator ast_ari_validate_playback_fn(void)
1332 {
1333         return ast_ari_validate_playback;
1334 }
1335
1336 int ast_ari_validate_device_state(struct ast_json *json)
1337 {
1338         int res = 1;
1339         struct ast_json_iter *iter;
1340         int has_name = 0;
1341         int has_state = 0;
1342
1343         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1344                 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1345                         int prop_is_valid;
1346                         has_name = 1;
1347                         prop_is_valid = ast_ari_validate_string(
1348                                 ast_json_object_iter_value(iter));
1349                         if (!prop_is_valid) {
1350                                 ast_log(LOG_ERROR, "ARI DeviceState field name failed validation\n");
1351                                 res = 0;
1352                         }
1353                 } else
1354                 if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
1355                         int prop_is_valid;
1356                         has_state = 1;
1357                         prop_is_valid = ast_ari_validate_string(
1358                                 ast_json_object_iter_value(iter));
1359                         if (!prop_is_valid) {
1360                                 ast_log(LOG_ERROR, "ARI DeviceState field state failed validation\n");
1361                                 res = 0;
1362                         }
1363                 } else
1364                 {
1365                         ast_log(LOG_ERROR,
1366                                 "ARI DeviceState has undocumented field %s\n",
1367                                 ast_json_object_iter_key(iter));
1368                         res = 0;
1369                 }
1370         }
1371
1372         if (!has_name) {
1373                 ast_log(LOG_ERROR, "ARI DeviceState missing required field name\n");
1374                 res = 0;
1375         }
1376
1377         if (!has_state) {
1378                 ast_log(LOG_ERROR, "ARI DeviceState missing required field state\n");
1379                 res = 0;
1380         }
1381
1382         return res;
1383 }
1384
1385 ari_validator ast_ari_validate_device_state_fn(void)
1386 {
1387         return ast_ari_validate_device_state;
1388 }
1389
1390 int ast_ari_validate_application_replaced(struct ast_json *json)
1391 {
1392         int res = 1;
1393         struct ast_json_iter *iter;
1394         int has_type = 0;
1395         int has_application = 0;
1396
1397         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1398                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1399                         int prop_is_valid;
1400                         has_type = 1;
1401                         prop_is_valid = ast_ari_validate_string(
1402                                 ast_json_object_iter_value(iter));
1403                         if (!prop_is_valid) {
1404                                 ast_log(LOG_ERROR, "ARI ApplicationReplaced field type failed validation\n");
1405                                 res = 0;
1406                         }
1407                 } else
1408                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1409                         int prop_is_valid;
1410                         has_application = 1;
1411                         prop_is_valid = ast_ari_validate_string(
1412                                 ast_json_object_iter_value(iter));
1413                         if (!prop_is_valid) {
1414                                 ast_log(LOG_ERROR, "ARI ApplicationReplaced field application failed validation\n");
1415                                 res = 0;
1416                         }
1417                 } else
1418                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1419                         int prop_is_valid;
1420                         prop_is_valid = ast_ari_validate_date(
1421                                 ast_json_object_iter_value(iter));
1422                         if (!prop_is_valid) {
1423                                 ast_log(LOG_ERROR, "ARI ApplicationReplaced field timestamp failed validation\n");
1424                                 res = 0;
1425                         }
1426                 } else
1427                 {
1428                         ast_log(LOG_ERROR,
1429                                 "ARI ApplicationReplaced has undocumented field %s\n",
1430                                 ast_json_object_iter_key(iter));
1431                         res = 0;
1432                 }
1433         }
1434
1435         if (!has_type) {
1436                 ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field type\n");
1437                 res = 0;
1438         }
1439
1440         if (!has_application) {
1441                 ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field application\n");
1442                 res = 0;
1443         }
1444
1445         return res;
1446 }
1447
1448 ari_validator ast_ari_validate_application_replaced_fn(void)
1449 {
1450         return ast_ari_validate_application_replaced;
1451 }
1452
1453 int ast_ari_validate_bridge_created(struct ast_json *json)
1454 {
1455         int res = 1;
1456         struct ast_json_iter *iter;
1457         int has_type = 0;
1458         int has_application = 0;
1459         int has_bridge = 0;
1460
1461         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1462                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1463                         int prop_is_valid;
1464                         has_type = 1;
1465                         prop_is_valid = ast_ari_validate_string(
1466                                 ast_json_object_iter_value(iter));
1467                         if (!prop_is_valid) {
1468                                 ast_log(LOG_ERROR, "ARI BridgeCreated field type failed validation\n");
1469                                 res = 0;
1470                         }
1471                 } else
1472                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1473                         int prop_is_valid;
1474                         has_application = 1;
1475                         prop_is_valid = ast_ari_validate_string(
1476                                 ast_json_object_iter_value(iter));
1477                         if (!prop_is_valid) {
1478                                 ast_log(LOG_ERROR, "ARI BridgeCreated field application failed validation\n");
1479                                 res = 0;
1480                         }
1481                 } else
1482                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1483                         int prop_is_valid;
1484                         prop_is_valid = ast_ari_validate_date(
1485                                 ast_json_object_iter_value(iter));
1486                         if (!prop_is_valid) {
1487                                 ast_log(LOG_ERROR, "ARI BridgeCreated field timestamp failed validation\n");
1488                                 res = 0;
1489                         }
1490                 } else
1491                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
1492                         int prop_is_valid;
1493                         has_bridge = 1;
1494                         prop_is_valid = ast_ari_validate_bridge(
1495                                 ast_json_object_iter_value(iter));
1496                         if (!prop_is_valid) {
1497                                 ast_log(LOG_ERROR, "ARI BridgeCreated field bridge failed validation\n");
1498                                 res = 0;
1499                         }
1500                 } else
1501                 {
1502                         ast_log(LOG_ERROR,
1503                                 "ARI BridgeCreated has undocumented field %s\n",
1504                                 ast_json_object_iter_key(iter));
1505                         res = 0;
1506                 }
1507         }
1508
1509         if (!has_type) {
1510                 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field type\n");
1511                 res = 0;
1512         }
1513
1514         if (!has_application) {
1515                 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field application\n");
1516                 res = 0;
1517         }
1518
1519         if (!has_bridge) {
1520                 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field bridge\n");
1521                 res = 0;
1522         }
1523
1524         return res;
1525 }
1526
1527 ari_validator ast_ari_validate_bridge_created_fn(void)
1528 {
1529         return ast_ari_validate_bridge_created;
1530 }
1531
1532 int ast_ari_validate_bridge_destroyed(struct ast_json *json)
1533 {
1534         int res = 1;
1535         struct ast_json_iter *iter;
1536         int has_type = 0;
1537         int has_application = 0;
1538         int has_bridge = 0;
1539
1540         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1541                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1542                         int prop_is_valid;
1543                         has_type = 1;
1544                         prop_is_valid = ast_ari_validate_string(
1545                                 ast_json_object_iter_value(iter));
1546                         if (!prop_is_valid) {
1547                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field type failed validation\n");
1548                                 res = 0;
1549                         }
1550                 } else
1551                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1552                         int prop_is_valid;
1553                         has_application = 1;
1554                         prop_is_valid = ast_ari_validate_string(
1555                                 ast_json_object_iter_value(iter));
1556                         if (!prop_is_valid) {
1557                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field application failed validation\n");
1558                                 res = 0;
1559                         }
1560                 } else
1561                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1562                         int prop_is_valid;
1563                         prop_is_valid = ast_ari_validate_date(
1564                                 ast_json_object_iter_value(iter));
1565                         if (!prop_is_valid) {
1566                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field timestamp failed validation\n");
1567                                 res = 0;
1568                         }
1569                 } else
1570                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
1571                         int prop_is_valid;
1572                         has_bridge = 1;
1573                         prop_is_valid = ast_ari_validate_bridge(
1574                                 ast_json_object_iter_value(iter));
1575                         if (!prop_is_valid) {
1576                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field bridge failed validation\n");
1577                                 res = 0;
1578                         }
1579                 } else
1580                 {
1581                         ast_log(LOG_ERROR,
1582                                 "ARI BridgeDestroyed has undocumented field %s\n",
1583                                 ast_json_object_iter_key(iter));
1584                         res = 0;
1585                 }
1586         }
1587
1588         if (!has_type) {
1589                 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field type\n");
1590                 res = 0;
1591         }
1592
1593         if (!has_application) {
1594                 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field application\n");
1595                 res = 0;
1596         }
1597
1598         if (!has_bridge) {
1599                 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field bridge\n");
1600                 res = 0;
1601         }
1602
1603         return res;
1604 }
1605
1606 ari_validator ast_ari_validate_bridge_destroyed_fn(void)
1607 {
1608         return ast_ari_validate_bridge_destroyed;
1609 }
1610
1611 int ast_ari_validate_bridge_merged(struct ast_json *json)
1612 {
1613         int res = 1;
1614         struct ast_json_iter *iter;
1615         int has_type = 0;
1616         int has_application = 0;
1617         int has_bridge = 0;
1618         int has_bridge_from = 0;
1619
1620         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1621                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1622                         int prop_is_valid;
1623                         has_type = 1;
1624                         prop_is_valid = ast_ari_validate_string(
1625                                 ast_json_object_iter_value(iter));
1626                         if (!prop_is_valid) {
1627                                 ast_log(LOG_ERROR, "ARI BridgeMerged field type failed validation\n");
1628                                 res = 0;
1629                         }
1630                 } else
1631                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1632                         int prop_is_valid;
1633                         has_application = 1;
1634                         prop_is_valid = ast_ari_validate_string(
1635                                 ast_json_object_iter_value(iter));
1636                         if (!prop_is_valid) {
1637                                 ast_log(LOG_ERROR, "ARI BridgeMerged field application failed validation\n");
1638                                 res = 0;
1639                         }
1640                 } else
1641                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1642                         int prop_is_valid;
1643                         prop_is_valid = ast_ari_validate_date(
1644                                 ast_json_object_iter_value(iter));
1645                         if (!prop_is_valid) {
1646                                 ast_log(LOG_ERROR, "ARI BridgeMerged field timestamp failed validation\n");
1647                                 res = 0;
1648                         }
1649                 } else
1650                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
1651                         int prop_is_valid;
1652                         has_bridge = 1;
1653                         prop_is_valid = ast_ari_validate_bridge(
1654                                 ast_json_object_iter_value(iter));
1655                         if (!prop_is_valid) {
1656                                 ast_log(LOG_ERROR, "ARI BridgeMerged field bridge failed validation\n");
1657                                 res = 0;
1658                         }
1659                 } else
1660                 if (strcmp("bridge_from", ast_json_object_iter_key(iter)) == 0) {
1661                         int prop_is_valid;
1662                         has_bridge_from = 1;
1663                         prop_is_valid = ast_ari_validate_bridge(
1664                                 ast_json_object_iter_value(iter));
1665                         if (!prop_is_valid) {
1666                                 ast_log(LOG_ERROR, "ARI BridgeMerged field bridge_from failed validation\n");
1667                                 res = 0;
1668                         }
1669                 } else
1670                 {
1671                         ast_log(LOG_ERROR,
1672                                 "ARI BridgeMerged has undocumented field %s\n",
1673                                 ast_json_object_iter_key(iter));
1674                         res = 0;
1675                 }
1676         }
1677
1678         if (!has_type) {
1679                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field type\n");
1680                 res = 0;
1681         }
1682
1683         if (!has_application) {
1684                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field application\n");
1685                 res = 0;
1686         }
1687
1688         if (!has_bridge) {
1689                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge\n");
1690                 res = 0;
1691         }
1692
1693         if (!has_bridge_from) {
1694                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge_from\n");
1695                 res = 0;
1696         }
1697
1698         return res;
1699 }
1700
1701 ari_validator ast_ari_validate_bridge_merged_fn(void)
1702 {
1703         return ast_ari_validate_bridge_merged;
1704 }
1705
1706 int ast_ari_validate_channel_caller_id(struct ast_json *json)
1707 {
1708         int res = 1;
1709         struct ast_json_iter *iter;
1710         int has_type = 0;
1711         int has_application = 0;
1712         int has_caller_presentation = 0;
1713         int has_caller_presentation_txt = 0;
1714         int has_channel = 0;
1715
1716         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1717                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1718                         int prop_is_valid;
1719                         has_type = 1;
1720                         prop_is_valid = ast_ari_validate_string(
1721                                 ast_json_object_iter_value(iter));
1722                         if (!prop_is_valid) {
1723                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field type failed validation\n");
1724                                 res = 0;
1725                         }
1726                 } else
1727                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1728                         int prop_is_valid;
1729                         has_application = 1;
1730                         prop_is_valid = ast_ari_validate_string(
1731                                 ast_json_object_iter_value(iter));
1732                         if (!prop_is_valid) {
1733                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field application failed validation\n");
1734                                 res = 0;
1735                         }
1736                 } else
1737                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1738                         int prop_is_valid;
1739                         prop_is_valid = ast_ari_validate_date(
1740                                 ast_json_object_iter_value(iter));
1741                         if (!prop_is_valid) {
1742                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field timestamp failed validation\n");
1743                                 res = 0;
1744                         }
1745                 } else
1746                 if (strcmp("caller_presentation", ast_json_object_iter_key(iter)) == 0) {
1747                         int prop_is_valid;
1748                         has_caller_presentation = 1;
1749                         prop_is_valid = ast_ari_validate_int(
1750                                 ast_json_object_iter_value(iter));
1751                         if (!prop_is_valid) {
1752                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation failed validation\n");
1753                                 res = 0;
1754                         }
1755                 } else
1756                 if (strcmp("caller_presentation_txt", ast_json_object_iter_key(iter)) == 0) {
1757                         int prop_is_valid;
1758                         has_caller_presentation_txt = 1;
1759                         prop_is_valid = ast_ari_validate_string(
1760                                 ast_json_object_iter_value(iter));
1761                         if (!prop_is_valid) {
1762                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation_txt failed validation\n");
1763                                 res = 0;
1764                         }
1765                 } else
1766                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
1767                         int prop_is_valid;
1768                         has_channel = 1;
1769                         prop_is_valid = ast_ari_validate_channel(
1770                                 ast_json_object_iter_value(iter));
1771                         if (!prop_is_valid) {
1772                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field channel failed validation\n");
1773                                 res = 0;
1774                         }
1775                 } else
1776                 {
1777                         ast_log(LOG_ERROR,
1778                                 "ARI ChannelCallerId has undocumented field %s\n",
1779                                 ast_json_object_iter_key(iter));
1780                         res = 0;
1781                 }
1782         }
1783
1784         if (!has_type) {
1785                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field type\n");
1786                 res = 0;
1787         }
1788
1789         if (!has_application) {
1790                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field application\n");
1791                 res = 0;
1792         }
1793
1794         if (!has_caller_presentation) {
1795                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation\n");
1796                 res = 0;
1797         }
1798
1799         if (!has_caller_presentation_txt) {
1800                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation_txt\n");
1801                 res = 0;
1802         }
1803
1804         if (!has_channel) {
1805                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field channel\n");
1806                 res = 0;
1807         }
1808
1809         return res;
1810 }
1811
1812 ari_validator ast_ari_validate_channel_caller_id_fn(void)
1813 {
1814         return ast_ari_validate_channel_caller_id;
1815 }
1816
1817 int ast_ari_validate_channel_created(struct ast_json *json)
1818 {
1819         int res = 1;
1820         struct ast_json_iter *iter;
1821         int has_type = 0;
1822         int has_application = 0;
1823         int has_channel = 0;
1824
1825         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1826                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1827                         int prop_is_valid;
1828                         has_type = 1;
1829                         prop_is_valid = ast_ari_validate_string(
1830                                 ast_json_object_iter_value(iter));
1831                         if (!prop_is_valid) {
1832                                 ast_log(LOG_ERROR, "ARI ChannelCreated field type failed validation\n");
1833                                 res = 0;
1834                         }
1835                 } else
1836                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1837                         int prop_is_valid;
1838                         has_application = 1;
1839                         prop_is_valid = ast_ari_validate_string(
1840                                 ast_json_object_iter_value(iter));
1841                         if (!prop_is_valid) {
1842                                 ast_log(LOG_ERROR, "ARI ChannelCreated field application failed validation\n");
1843                                 res = 0;
1844                         }
1845                 } else
1846                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1847                         int prop_is_valid;
1848                         prop_is_valid = ast_ari_validate_date(
1849                                 ast_json_object_iter_value(iter));
1850                         if (!prop_is_valid) {
1851                                 ast_log(LOG_ERROR, "ARI ChannelCreated field timestamp failed validation\n");
1852                                 res = 0;
1853                         }
1854                 } else
1855                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
1856                         int prop_is_valid;
1857                         has_channel = 1;
1858                         prop_is_valid = ast_ari_validate_channel(
1859                                 ast_json_object_iter_value(iter));
1860                         if (!prop_is_valid) {
1861                                 ast_log(LOG_ERROR, "ARI ChannelCreated field channel failed validation\n");
1862                                 res = 0;
1863                         }
1864                 } else
1865                 {
1866                         ast_log(LOG_ERROR,
1867                                 "ARI ChannelCreated has undocumented field %s\n",
1868                                 ast_json_object_iter_key(iter));
1869                         res = 0;
1870                 }
1871         }
1872
1873         if (!has_type) {
1874                 ast_log(LOG_ERROR, "ARI ChannelCreated missing required field type\n");
1875                 res = 0;
1876         }
1877
1878         if (!has_application) {
1879                 ast_log(LOG_ERROR, "ARI ChannelCreated missing required field application\n");
1880                 res = 0;
1881         }
1882
1883         if (!has_channel) {
1884                 ast_log(LOG_ERROR, "ARI ChannelCreated missing required field channel\n");
1885                 res = 0;
1886         }
1887
1888         return res;
1889 }
1890
1891 ari_validator ast_ari_validate_channel_created_fn(void)
1892 {
1893         return ast_ari_validate_channel_created;
1894 }
1895
1896 int ast_ari_validate_channel_destroyed(struct ast_json *json)
1897 {
1898         int res = 1;
1899         struct ast_json_iter *iter;
1900         int has_type = 0;
1901         int has_application = 0;
1902         int has_cause = 0;
1903         int has_cause_txt = 0;
1904         int has_channel = 0;
1905
1906         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1907                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1908                         int prop_is_valid;
1909                         has_type = 1;
1910                         prop_is_valid = ast_ari_validate_string(
1911                                 ast_json_object_iter_value(iter));
1912                         if (!prop_is_valid) {
1913                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field type failed validation\n");
1914                                 res = 0;
1915                         }
1916                 } else
1917                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1918                         int prop_is_valid;
1919                         has_application = 1;
1920                         prop_is_valid = ast_ari_validate_string(
1921                                 ast_json_object_iter_value(iter));
1922                         if (!prop_is_valid) {
1923                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field application failed validation\n");
1924                                 res = 0;
1925                         }
1926                 } else
1927                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1928                         int prop_is_valid;
1929                         prop_is_valid = ast_ari_validate_date(
1930                                 ast_json_object_iter_value(iter));
1931                         if (!prop_is_valid) {
1932                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field timestamp failed validation\n");
1933                                 res = 0;
1934                         }
1935                 } else
1936                 if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
1937                         int prop_is_valid;
1938                         has_cause = 1;
1939                         prop_is_valid = ast_ari_validate_int(
1940                                 ast_json_object_iter_value(iter));
1941                         if (!prop_is_valid) {
1942                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field cause failed validation\n");
1943                                 res = 0;
1944                         }
1945                 } else
1946                 if (strcmp("cause_txt", ast_json_object_iter_key(iter)) == 0) {
1947                         int prop_is_valid;
1948                         has_cause_txt = 1;
1949                         prop_is_valid = ast_ari_validate_string(
1950                                 ast_json_object_iter_value(iter));
1951                         if (!prop_is_valid) {
1952                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field cause_txt failed validation\n");
1953                                 res = 0;
1954                         }
1955                 } else
1956                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
1957                         int prop_is_valid;
1958                         has_channel = 1;
1959                         prop_is_valid = ast_ari_validate_channel(
1960                                 ast_json_object_iter_value(iter));
1961                         if (!prop_is_valid) {
1962                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field channel failed validation\n");
1963                                 res = 0;
1964                         }
1965                 } else
1966                 {
1967                         ast_log(LOG_ERROR,
1968                                 "ARI ChannelDestroyed has undocumented field %s\n",
1969                                 ast_json_object_iter_key(iter));
1970                         res = 0;
1971                 }
1972         }
1973
1974         if (!has_type) {
1975                 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field type\n");
1976                 res = 0;
1977         }
1978
1979         if (!has_application) {
1980                 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field application\n");
1981                 res = 0;
1982         }
1983
1984         if (!has_cause) {
1985                 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field cause\n");
1986                 res = 0;
1987         }
1988
1989         if (!has_cause_txt) {
1990                 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field cause_txt\n");
1991                 res = 0;
1992         }
1993
1994         if (!has_channel) {
1995                 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field channel\n");
1996                 res = 0;
1997         }
1998
1999         return res;
2000 }
2001
2002 ari_validator ast_ari_validate_channel_destroyed_fn(void)
2003 {
2004         return ast_ari_validate_channel_destroyed;
2005 }
2006
2007 int ast_ari_validate_channel_dialplan(struct ast_json *json)
2008 {
2009         int res = 1;
2010         struct ast_json_iter *iter;
2011         int has_type = 0;
2012         int has_application = 0;
2013         int has_channel = 0;
2014         int has_dialplan_app = 0;
2015         int has_dialplan_app_data = 0;
2016
2017         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2018                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2019                         int prop_is_valid;
2020                         has_type = 1;
2021                         prop_is_valid = ast_ari_validate_string(
2022                                 ast_json_object_iter_value(iter));
2023                         if (!prop_is_valid) {
2024                                 ast_log(LOG_ERROR, "ARI ChannelDialplan field type failed validation\n");
2025                                 res = 0;
2026                         }
2027                 } else
2028                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2029                         int prop_is_valid;
2030                         has_application = 1;
2031                         prop_is_valid = ast_ari_validate_string(
2032                                 ast_json_object_iter_value(iter));
2033                         if (!prop_is_valid) {
2034                                 ast_log(LOG_ERROR, "ARI ChannelDialplan field application failed validation\n");
2035                                 res = 0;
2036                         }
2037                 } else
2038                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2039                         int prop_is_valid;
2040                         prop_is_valid = ast_ari_validate_date(
2041                                 ast_json_object_iter_value(iter));
2042                         if (!prop_is_valid) {
2043                                 ast_log(LOG_ERROR, "ARI ChannelDialplan field timestamp failed validation\n");
2044                                 res = 0;
2045                         }
2046                 } else
2047                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2048                         int prop_is_valid;
2049                         has_channel = 1;
2050                         prop_is_valid = ast_ari_validate_channel(
2051                                 ast_json_object_iter_value(iter));
2052                         if (!prop_is_valid) {
2053                                 ast_log(LOG_ERROR, "ARI ChannelDialplan field channel failed validation\n");
2054                                 res = 0;
2055                         }
2056                 } else
2057                 if (strcmp("dialplan_app", ast_json_object_iter_key(iter)) == 0) {
2058                         int prop_is_valid;
2059                         has_dialplan_app = 1;
2060                         prop_is_valid = ast_ari_validate_string(
2061                                 ast_json_object_iter_value(iter));
2062                         if (!prop_is_valid) {
2063                                 ast_log(LOG_ERROR, "ARI ChannelDialplan field dialplan_app failed validation\n");
2064                                 res = 0;
2065                         }
2066                 } else
2067                 if (strcmp("dialplan_app_data", ast_json_object_iter_key(iter)) == 0) {
2068                         int prop_is_valid;
2069                         has_dialplan_app_data = 1;
2070                         prop_is_valid = ast_ari_validate_string(
2071                                 ast_json_object_iter_value(iter));
2072                         if (!prop_is_valid) {
2073                                 ast_log(LOG_ERROR, "ARI ChannelDialplan field dialplan_app_data failed validation\n");
2074                                 res = 0;
2075                         }
2076                 } else
2077                 {
2078                         ast_log(LOG_ERROR,
2079                                 "ARI ChannelDialplan has undocumented field %s\n",
2080                                 ast_json_object_iter_key(iter));
2081                         res = 0;
2082                 }
2083         }
2084
2085         if (!has_type) {
2086                 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field type\n");
2087                 res = 0;
2088         }
2089
2090         if (!has_application) {
2091                 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field application\n");
2092                 res = 0;
2093         }
2094
2095         if (!has_channel) {
2096                 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field channel\n");
2097                 res = 0;
2098         }
2099
2100         if (!has_dialplan_app) {
2101                 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field dialplan_app\n");
2102                 res = 0;
2103         }
2104
2105         if (!has_dialplan_app_data) {
2106                 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field dialplan_app_data\n");
2107                 res = 0;
2108         }
2109
2110         return res;
2111 }
2112
2113 ari_validator ast_ari_validate_channel_dialplan_fn(void)
2114 {
2115         return ast_ari_validate_channel_dialplan;
2116 }
2117
2118 int ast_ari_validate_channel_dtmf_received(struct ast_json *json)
2119 {
2120         int res = 1;
2121         struct ast_json_iter *iter;
2122         int has_type = 0;
2123         int has_application = 0;
2124         int has_channel = 0;
2125         int has_digit = 0;
2126         int has_duration_ms = 0;
2127
2128         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2129                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2130                         int prop_is_valid;
2131                         has_type = 1;
2132                         prop_is_valid = ast_ari_validate_string(
2133                                 ast_json_object_iter_value(iter));
2134                         if (!prop_is_valid) {
2135                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field type failed validation\n");
2136                                 res = 0;
2137                         }
2138                 } else
2139                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2140                         int prop_is_valid;
2141                         has_application = 1;
2142                         prop_is_valid = ast_ari_validate_string(
2143                                 ast_json_object_iter_value(iter));
2144                         if (!prop_is_valid) {
2145                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field application failed validation\n");
2146                                 res = 0;
2147                         }
2148                 } else
2149                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2150                         int prop_is_valid;
2151                         prop_is_valid = ast_ari_validate_date(
2152                                 ast_json_object_iter_value(iter));
2153                         if (!prop_is_valid) {
2154                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field timestamp failed validation\n");
2155                                 res = 0;
2156                         }
2157                 } else
2158                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2159                         int prop_is_valid;
2160                         has_channel = 1;
2161                         prop_is_valid = ast_ari_validate_channel(
2162                                 ast_json_object_iter_value(iter));
2163                         if (!prop_is_valid) {
2164                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field channel failed validation\n");
2165                                 res = 0;
2166                         }
2167                 } else
2168                 if (strcmp("digit", ast_json_object_iter_key(iter)) == 0) {
2169                         int prop_is_valid;
2170                         has_digit = 1;
2171                         prop_is_valid = ast_ari_validate_string(
2172                                 ast_json_object_iter_value(iter));
2173                         if (!prop_is_valid) {
2174                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field digit failed validation\n");
2175                                 res = 0;
2176                         }
2177                 } else
2178                 if (strcmp("duration_ms", ast_json_object_iter_key(iter)) == 0) {
2179                         int prop_is_valid;
2180                         has_duration_ms = 1;
2181                         prop_is_valid = ast_ari_validate_int(
2182                                 ast_json_object_iter_value(iter));
2183                         if (!prop_is_valid) {
2184                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field duration_ms failed validation\n");
2185                                 res = 0;
2186                         }
2187                 } else
2188                 {
2189                         ast_log(LOG_ERROR,
2190                                 "ARI ChannelDtmfReceived has undocumented field %s\n",
2191                                 ast_json_object_iter_key(iter));
2192                         res = 0;
2193                 }
2194         }
2195
2196         if (!has_type) {
2197                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field type\n");
2198                 res = 0;
2199         }
2200
2201         if (!has_application) {
2202                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field application\n");
2203                 res = 0;
2204         }
2205
2206         if (!has_channel) {
2207                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field channel\n");
2208                 res = 0;
2209         }
2210
2211         if (!has_digit) {
2212                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field digit\n");
2213                 res = 0;
2214         }
2215
2216         if (!has_duration_ms) {
2217                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field duration_ms\n");
2218                 res = 0;
2219         }
2220
2221         return res;
2222 }
2223
2224 ari_validator ast_ari_validate_channel_dtmf_received_fn(void)
2225 {
2226         return ast_ari_validate_channel_dtmf_received;
2227 }
2228
2229 int ast_ari_validate_channel_entered_bridge(struct ast_json *json)
2230 {
2231         int res = 1;
2232         struct ast_json_iter *iter;
2233         int has_type = 0;
2234         int has_application = 0;
2235         int has_bridge = 0;
2236
2237         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2238                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2239                         int prop_is_valid;
2240                         has_type = 1;
2241                         prop_is_valid = ast_ari_validate_string(
2242                                 ast_json_object_iter_value(iter));
2243                         if (!prop_is_valid) {
2244                                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field type failed validation\n");
2245                                 res = 0;
2246                         }
2247                 } else
2248                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2249                         int prop_is_valid;
2250                         has_application = 1;
2251                         prop_is_valid = ast_ari_validate_string(
2252                                 ast_json_object_iter_value(iter));
2253                         if (!prop_is_valid) {
2254                                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field application failed validation\n");
2255                                 res = 0;
2256                         }
2257                 } else
2258                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2259                         int prop_is_valid;
2260                         prop_is_valid = ast_ari_validate_date(
2261                                 ast_json_object_iter_value(iter));
2262                         if (!prop_is_valid) {
2263                                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field timestamp failed validation\n");
2264                                 res = 0;
2265                         }
2266                 } else
2267                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2268                         int prop_is_valid;
2269                         has_bridge = 1;
2270                         prop_is_valid = ast_ari_validate_bridge(
2271                                 ast_json_object_iter_value(iter));
2272                         if (!prop_is_valid) {
2273                                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field bridge failed validation\n");
2274                                 res = 0;
2275                         }
2276                 } else
2277                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2278                         int prop_is_valid;
2279                         prop_is_valid = ast_ari_validate_channel(
2280                                 ast_json_object_iter_value(iter));
2281                         if (!prop_is_valid) {
2282                                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field channel failed validation\n");
2283                                 res = 0;
2284                         }
2285                 } else
2286                 {
2287                         ast_log(LOG_ERROR,
2288                                 "ARI ChannelEnteredBridge has undocumented field %s\n",
2289                                 ast_json_object_iter_key(iter));
2290                         res = 0;
2291                 }
2292         }
2293
2294         if (!has_type) {
2295                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field type\n");
2296                 res = 0;
2297         }
2298
2299         if (!has_application) {
2300                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field application\n");
2301                 res = 0;
2302         }
2303
2304         if (!has_bridge) {
2305                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field bridge\n");
2306                 res = 0;
2307         }
2308
2309         return res;
2310 }
2311
2312 ari_validator ast_ari_validate_channel_entered_bridge_fn(void)
2313 {
2314         return ast_ari_validate_channel_entered_bridge;
2315 }
2316
2317 int ast_ari_validate_channel_hangup_request(struct ast_json *json)
2318 {
2319         int res = 1;
2320         struct ast_json_iter *iter;
2321         int has_type = 0;
2322         int has_application = 0;
2323         int has_channel = 0;
2324
2325         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2326                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2327                         int prop_is_valid;
2328                         has_type = 1;
2329                         prop_is_valid = ast_ari_validate_string(
2330                                 ast_json_object_iter_value(iter));
2331                         if (!prop_is_valid) {
2332                                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field type failed validation\n");
2333                                 res = 0;
2334                         }
2335                 } else
2336                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2337                         int prop_is_valid;
2338                         has_application = 1;
2339                         prop_is_valid = ast_ari_validate_string(
2340                                 ast_json_object_iter_value(iter));
2341                         if (!prop_is_valid) {
2342                                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field application failed validation\n");
2343                                 res = 0;
2344                         }
2345                 } else
2346                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2347                         int prop_is_valid;
2348                         prop_is_valid = ast_ari_validate_date(
2349                                 ast_json_object_iter_value(iter));
2350                         if (!prop_is_valid) {
2351                                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field timestamp failed validation\n");
2352                                 res = 0;
2353                         }
2354                 } else
2355                 if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
2356                         int prop_is_valid;
2357                         prop_is_valid = ast_ari_validate_int(
2358                                 ast_json_object_iter_value(iter));
2359                         if (!prop_is_valid) {
2360                                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field cause failed validation\n");
2361                                 res = 0;
2362                         }
2363                 } else
2364                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2365                         int prop_is_valid;
2366                         has_channel = 1;
2367                         prop_is_valid = ast_ari_validate_channel(
2368                                 ast_json_object_iter_value(iter));
2369                         if (!prop_is_valid) {
2370                                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field channel failed validation\n");
2371                                 res = 0;
2372                         }
2373                 } else
2374                 if (strcmp("soft", ast_json_object_iter_key(iter)) == 0) {
2375                         int prop_is_valid;
2376                         prop_is_valid = ast_ari_validate_boolean(
2377                                 ast_json_object_iter_value(iter));
2378                         if (!prop_is_valid) {
2379                                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field soft failed validation\n");
2380                                 res = 0;
2381                         }
2382                 } else
2383                 {
2384                         ast_log(LOG_ERROR,
2385                                 "ARI ChannelHangupRequest has undocumented field %s\n",
2386                                 ast_json_object_iter_key(iter));
2387                         res = 0;
2388                 }
2389         }
2390
2391         if (!has_type) {
2392                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field type\n");
2393                 res = 0;
2394         }
2395
2396         if (!has_application) {
2397                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field application\n");
2398                 res = 0;
2399         }
2400
2401         if (!has_channel) {
2402                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field channel\n");
2403                 res = 0;
2404         }
2405
2406         return res;
2407 }
2408
2409 ari_validator ast_ari_validate_channel_hangup_request_fn(void)
2410 {
2411         return ast_ari_validate_channel_hangup_request;
2412 }
2413
2414 int ast_ari_validate_channel_left_bridge(struct ast_json *json)
2415 {
2416         int res = 1;
2417         struct ast_json_iter *iter;
2418         int has_type = 0;
2419         int has_application = 0;
2420         int has_bridge = 0;
2421         int has_channel = 0;
2422
2423         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2424                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2425                         int prop_is_valid;
2426                         has_type = 1;
2427                         prop_is_valid = ast_ari_validate_string(
2428                                 ast_json_object_iter_value(iter));
2429                         if (!prop_is_valid) {
2430                                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge field type failed validation\n");
2431                                 res = 0;
2432                         }
2433                 } else
2434                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2435                         int prop_is_valid;
2436                         has_application = 1;
2437                         prop_is_valid = ast_ari_validate_string(
2438                                 ast_json_object_iter_value(iter));
2439                         if (!prop_is_valid) {
2440                                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge field application failed validation\n");
2441                                 res = 0;
2442                         }
2443                 } else
2444                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2445                         int prop_is_valid;
2446                         prop_is_valid = ast_ari_validate_date(
2447                                 ast_json_object_iter_value(iter));
2448                         if (!prop_is_valid) {
2449                                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge field timestamp failed validation\n");
2450                                 res = 0;
2451                         }
2452                 } else
2453                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2454                         int prop_is_valid;
2455                         has_bridge = 1;
2456                         prop_is_valid = ast_ari_validate_bridge(
2457                                 ast_json_object_iter_value(iter));
2458                         if (!prop_is_valid) {
2459                                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge field bridge failed validation\n");
2460                                 res = 0;
2461                         }
2462                 } else
2463                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2464                         int prop_is_valid;
2465                         has_channel = 1;
2466                         prop_is_valid = ast_ari_validate_channel(
2467                                 ast_json_object_iter_value(iter));
2468                         if (!prop_is_valid) {
2469                                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge field channel failed validation\n");
2470                                 res = 0;
2471                         }
2472                 } else
2473                 {
2474                         ast_log(LOG_ERROR,
2475                                 "ARI ChannelLeftBridge has undocumented field %s\n",
2476                                 ast_json_object_iter_key(iter));
2477                         res = 0;
2478                 }
2479         }
2480
2481         if (!has_type) {
2482                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field type\n");
2483                 res = 0;
2484         }
2485
2486         if (!has_application) {
2487                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field application\n");
2488                 res = 0;
2489         }
2490
2491         if (!has_bridge) {
2492                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field bridge\n");
2493                 res = 0;
2494         }
2495
2496         if (!has_channel) {
2497                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field channel\n");
2498                 res = 0;
2499         }
2500
2501         return res;
2502 }
2503
2504 ari_validator ast_ari_validate_channel_left_bridge_fn(void)
2505 {
2506         return ast_ari_validate_channel_left_bridge;
2507 }
2508
2509 int ast_ari_validate_channel_state_change(struct ast_json *json)
2510 {
2511         int res = 1;
2512         struct ast_json_iter *iter;
2513         int has_type = 0;
2514         int has_application = 0;
2515         int has_channel = 0;
2516
2517         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2518                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2519                         int prop_is_valid;
2520                         has_type = 1;
2521                         prop_is_valid = ast_ari_validate_string(
2522                                 ast_json_object_iter_value(iter));
2523                         if (!prop_is_valid) {
2524                                 ast_log(LOG_ERROR, "ARI ChannelStateChange field type failed validation\n");
2525                                 res = 0;
2526                         }
2527                 } else
2528                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2529                         int prop_is_valid;
2530                         has_application = 1;
2531                         prop_is_valid = ast_ari_validate_string(
2532                                 ast_json_object_iter_value(iter));
2533                         if (!prop_is_valid) {
2534                                 ast_log(LOG_ERROR, "ARI ChannelStateChange field application failed validation\n");
2535                                 res = 0;
2536                         }
2537                 } else
2538                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2539                         int prop_is_valid;
2540                         prop_is_valid = ast_ari_validate_date(
2541                                 ast_json_object_iter_value(iter));
2542                         if (!prop_is_valid) {
2543                                 ast_log(LOG_ERROR, "ARI ChannelStateChange field timestamp failed validation\n");
2544                                 res = 0;
2545                         }
2546                 } else
2547                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2548                         int prop_is_valid;
2549                         has_channel = 1;
2550                         prop_is_valid = ast_ari_validate_channel(
2551                                 ast_json_object_iter_value(iter));
2552                         if (!prop_is_valid) {
2553                                 ast_log(LOG_ERROR, "ARI ChannelStateChange field channel failed validation\n");
2554                                 res = 0;
2555                         }
2556                 } else
2557                 {
2558                         ast_log(LOG_ERROR,
2559                                 "ARI ChannelStateChange has undocumented field %s\n",
2560                                 ast_json_object_iter_key(iter));
2561                         res = 0;
2562                 }
2563         }
2564
2565         if (!has_type) {
2566                 ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field type\n");
2567                 res = 0;
2568         }
2569
2570         if (!has_application) {
2571                 ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field application\n");
2572                 res = 0;
2573         }
2574
2575         if (!has_channel) {
2576                 ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field channel\n");
2577                 res = 0;
2578         }
2579
2580         return res;
2581 }
2582
2583 ari_validator ast_ari_validate_channel_state_change_fn(void)
2584 {
2585         return ast_ari_validate_channel_state_change;
2586 }
2587
2588 int ast_ari_validate_channel_userevent(struct ast_json *json)
2589 {
2590         int res = 1;
2591         struct ast_json_iter *iter;
2592         int has_type = 0;
2593         int has_application = 0;
2594         int has_channel = 0;
2595         int has_eventname = 0;
2596         int has_userevent = 0;
2597
2598         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2599                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2600                         int prop_is_valid;
2601                         has_type = 1;
2602                         prop_is_valid = ast_ari_validate_string(
2603                                 ast_json_object_iter_value(iter));
2604                         if (!prop_is_valid) {
2605                                 ast_log(LOG_ERROR, "ARI ChannelUserevent field type failed validation\n");
2606                                 res = 0;
2607                         }
2608                 } else
2609                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2610                         int prop_is_valid;
2611                         has_application = 1;
2612                         prop_is_valid = ast_ari_validate_string(
2613                                 ast_json_object_iter_value(iter));
2614                         if (!prop_is_valid) {
2615                                 ast_log(LOG_ERROR, "ARI ChannelUserevent field application failed validation\n");
2616                                 res = 0;
2617                         }
2618                 } else
2619                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2620                         int prop_is_valid;
2621                         prop_is_valid = ast_ari_validate_date(
2622                                 ast_json_object_iter_value(iter));
2623                         if (!prop_is_valid) {
2624                                 ast_log(LOG_ERROR, "ARI ChannelUserevent field timestamp failed validation\n");
2625                                 res = 0;
2626                         }
2627                 } else
2628                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2629                         int prop_is_valid;
2630                         has_channel = 1;
2631                         prop_is_valid = ast_ari_validate_channel(
2632                                 ast_json_object_iter_value(iter));
2633                         if (!prop_is_valid) {
2634                                 ast_log(LOG_ERROR, "ARI ChannelUserevent field channel failed validation\n");
2635                                 res = 0;
2636                         }
2637                 } else
2638                 if (strcmp("eventname", ast_json_object_iter_key(iter)) == 0) {
2639                         int prop_is_valid;
2640                         has_eventname = 1;
2641                         prop_is_valid = ast_ari_validate_string(
2642                                 ast_json_object_iter_value(iter));
2643                         if (!prop_is_valid) {
2644                                 ast_log(LOG_ERROR, "ARI ChannelUserevent field eventname failed validation\n");
2645                                 res = 0;
2646                         }
2647                 } else
2648                 if (strcmp("userevent", ast_json_object_iter_key(iter)) == 0) {
2649                         int prop_is_valid;
2650                         has_userevent = 1;
2651                         prop_is_valid = ast_ari_validate_object(
2652                                 ast_json_object_iter_value(iter));
2653                         if (!prop_is_valid) {
2654                                 ast_log(LOG_ERROR, "ARI ChannelUserevent field userevent failed validation\n");
2655                                 res = 0;
2656                         }
2657                 } else
2658                 {
2659                         ast_log(LOG_ERROR,
2660                                 "ARI ChannelUserevent has undocumented field %s\n",
2661                                 ast_json_object_iter_key(iter));
2662                         res = 0;
2663                 }
2664         }
2665
2666         if (!has_type) {
2667                 ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field type\n");
2668                 res = 0;
2669         }
2670
2671         if (!has_application) {
2672                 ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field application\n");
2673                 res = 0;
2674         }
2675
2676         if (!has_channel) {
2677                 ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field channel\n");
2678                 res = 0;
2679         }
2680
2681         if (!has_eventname) {
2682                 ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field eventname\n");
2683                 res = 0;
2684         }
2685
2686         if (!has_userevent) {
2687                 ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field userevent\n");
2688                 res = 0;
2689         }
2690
2691         return res;
2692 }
2693
2694 ari_validator ast_ari_validate_channel_userevent_fn(void)
2695 {
2696         return ast_ari_validate_channel_userevent;
2697 }
2698
2699 int ast_ari_validate_channel_varset(struct ast_json *json)
2700 {
2701         int res = 1;
2702         struct ast_json_iter *iter;
2703         int has_type = 0;
2704         int has_application = 0;
2705         int has_value = 0;
2706         int has_variable = 0;
2707
2708         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2709                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2710                         int prop_is_valid;
2711                         has_type = 1;
2712                         prop_is_valid = ast_ari_validate_string(
2713                                 ast_json_object_iter_value(iter));
2714                         if (!prop_is_valid) {
2715                                 ast_log(LOG_ERROR, "ARI ChannelVarset field type failed validation\n");
2716                                 res = 0;
2717                         }
2718                 } else
2719                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2720                         int prop_is_valid;
2721                         has_application = 1;
2722                         prop_is_valid = ast_ari_validate_string(
2723                                 ast_json_object_iter_value(iter));
2724                         if (!prop_is_valid) {
2725                                 ast_log(LOG_ERROR, "ARI ChannelVarset field application failed validation\n");
2726                                 res = 0;
2727                         }
2728                 } else
2729                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2730                         int prop_is_valid;
2731                         prop_is_valid = ast_ari_validate_date(
2732                                 ast_json_object_iter_value(iter));
2733                         if (!prop_is_valid) {
2734                                 ast_log(LOG_ERROR, "ARI ChannelVarset field timestamp failed validation\n");
2735                                 res = 0;
2736                         }
2737                 } else
2738                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2739                         int prop_is_valid;
2740                         prop_is_valid = ast_ari_validate_channel(
2741                                 ast_json_object_iter_value(iter));
2742                         if (!prop_is_valid) {
2743                                 ast_log(LOG_ERROR, "ARI ChannelVarset field channel failed validation\n");
2744                                 res = 0;
2745                         }
2746                 } else
2747                 if (strcmp("value", ast_json_object_iter_key(iter)) == 0) {
2748                         int prop_is_valid;
2749                         has_value = 1;
2750                         prop_is_valid = ast_ari_validate_string(
2751                                 ast_json_object_iter_value(iter));
2752                         if (!prop_is_valid) {
2753                                 ast_log(LOG_ERROR, "ARI ChannelVarset field value failed validation\n");
2754                                 res = 0;
2755                         }
2756                 } else
2757                 if (strcmp("variable", ast_json_object_iter_key(iter)) == 0) {
2758                         int prop_is_valid;
2759                         has_variable = 1;
2760                         prop_is_valid = ast_ari_validate_string(
2761                                 ast_json_object_iter_value(iter));
2762                         if (!prop_is_valid) {
2763                                 ast_log(LOG_ERROR, "ARI ChannelVarset field variable failed validation\n");
2764                                 res = 0;
2765                         }
2766                 } else
2767                 {
2768                         ast_log(LOG_ERROR,
2769                                 "ARI ChannelVarset has undocumented field %s\n",
2770                                 ast_json_object_iter_key(iter));
2771                         res = 0;
2772                 }
2773         }
2774
2775         if (!has_type) {
2776                 ast_log(LOG_ERROR, "ARI ChannelVarset missing required field type\n");
2777                 res = 0;
2778         }
2779
2780         if (!has_application) {
2781                 ast_log(LOG_ERROR, "ARI ChannelVarset missing required field application\n");
2782                 res = 0;
2783         }
2784
2785         if (!has_value) {
2786                 ast_log(LOG_ERROR, "ARI ChannelVarset missing required field value\n");
2787                 res = 0;
2788         }
2789
2790         if (!has_variable) {
2791                 ast_log(LOG_ERROR, "ARI ChannelVarset missing required field variable\n");
2792                 res = 0;
2793         }
2794
2795         return res;
2796 }
2797
2798 ari_validator ast_ari_validate_channel_varset_fn(void)
2799 {
2800         return ast_ari_validate_channel_varset;
2801 }
2802
2803 int ast_ari_validate_device_state_changed(struct ast_json *json)
2804 {
2805         int res = 1;
2806         struct ast_json_iter *iter;
2807         int has_type = 0;
2808         int has_application = 0;
2809         int has_device_state = 0;
2810
2811         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2812                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2813                         int prop_is_valid;
2814                         has_type = 1;
2815                         prop_is_valid = ast_ari_validate_string(
2816                                 ast_json_object_iter_value(iter));
2817                         if (!prop_is_valid) {
2818                                 ast_log(LOG_ERROR, "ARI DeviceStateChanged field type failed validation\n");
2819                                 res = 0;
2820                         }
2821                 } else
2822                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2823                         int prop_is_valid;
2824                         has_application = 1;
2825                         prop_is_valid = ast_ari_validate_string(
2826                                 ast_json_object_iter_value(iter));
2827                         if (!prop_is_valid) {
2828                                 ast_log(LOG_ERROR, "ARI DeviceStateChanged field application failed validation\n");
2829                                 res = 0;
2830                         }
2831                 } else
2832                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2833                         int prop_is_valid;
2834                         prop_is_valid = ast_ari_validate_date(
2835                                 ast_json_object_iter_value(iter));
2836                         if (!prop_is_valid) {
2837                                 ast_log(LOG_ERROR, "ARI DeviceStateChanged field timestamp failed validation\n");
2838                                 res = 0;
2839                         }
2840                 } else
2841                 if (strcmp("device_state", ast_json_object_iter_key(iter)) == 0) {
2842                         int prop_is_valid;
2843                         has_device_state = 1;
2844                         prop_is_valid = ast_ari_validate_device_state(
2845                                 ast_json_object_iter_value(iter));
2846                         if (!prop_is_valid) {
2847                                 ast_log(LOG_ERROR, "ARI DeviceStateChanged field device_state failed validation\n");
2848                                 res = 0;
2849                         }
2850                 } else
2851                 {
2852                         ast_log(LOG_ERROR,
2853                                 "ARI DeviceStateChanged has undocumented field %s\n",
2854                                 ast_json_object_iter_key(iter));
2855                         res = 0;
2856                 }
2857         }
2858
2859         if (!has_type) {
2860                 ast_log(LOG_ERROR, "ARI DeviceStateChanged missing required field type\n");
2861                 res = 0;
2862         }
2863
2864         if (!has_application) {
2865                 ast_log(LOG_ERROR, "ARI DeviceStateChanged missing required field application\n");
2866                 res = 0;
2867         }
2868
2869         if (!has_device_state) {
2870                 ast_log(LOG_ERROR, "ARI DeviceStateChanged missing required field device_state\n");
2871                 res = 0;
2872         }
2873
2874         return res;
2875 }
2876
2877 ari_validator ast_ari_validate_device_state_changed_fn(void)
2878 {
2879         return ast_ari_validate_device_state_changed;
2880 }
2881
2882 int ast_ari_validate_dial(struct ast_json *json)
2883 {
2884         int res = 1;
2885         struct ast_json_iter *iter;
2886         int has_type = 0;
2887         int has_application = 0;
2888         int has_dialstatus = 0;
2889         int has_peer = 0;
2890
2891         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2892                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2893                         int prop_is_valid;
2894                         has_type = 1;
2895                         prop_is_valid = ast_ari_validate_string(
2896                                 ast_json_object_iter_value(iter));
2897                         if (!prop_is_valid) {
2898                                 ast_log(LOG_ERROR, "ARI Dial field type failed validation\n");
2899                                 res = 0;
2900                         }
2901                 } else
2902                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2903                         int prop_is_valid;
2904                         has_application = 1;
2905                         prop_is_valid = ast_ari_validate_string(
2906                                 ast_json_object_iter_value(iter));
2907                         if (!prop_is_valid) {
2908                                 ast_log(LOG_ERROR, "ARI Dial field application failed validation\n");
2909                                 res = 0;
2910                         }
2911                 } else
2912                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2913                         int prop_is_valid;
2914                         prop_is_valid = ast_ari_validate_date(
2915                                 ast_json_object_iter_value(iter));
2916                         if (!prop_is_valid) {
2917                                 ast_log(LOG_ERROR, "ARI Dial field timestamp failed validation\n");
2918                                 res = 0;
2919                         }
2920                 } else
2921                 if (strcmp("caller", ast_json_object_iter_key(iter)) == 0) {
2922                         int prop_is_valid;
2923                         prop_is_valid = ast_ari_validate_channel(
2924                                 ast_json_object_iter_value(iter));
2925                         if (!prop_is_valid) {
2926                                 ast_log(LOG_ERROR, "ARI Dial field caller failed validation\n");
2927                                 res = 0;
2928                         }
2929                 } else
2930                 if (strcmp("dialstatus", ast_json_object_iter_key(iter)) == 0) {
2931                         int prop_is_valid;
2932                         has_dialstatus = 1;
2933                         prop_is_valid = ast_ari_validate_string(
2934                                 ast_json_object_iter_value(iter));
2935                         if (!prop_is_valid) {
2936                                 ast_log(LOG_ERROR, "ARI Dial field dialstatus failed validation\n");
2937                                 res = 0;
2938                         }
2939                 } else
2940                 if (strcmp("dialstring", ast_json_object_iter_key(iter)) == 0) {
2941                         int prop_is_valid;
2942                         prop_is_valid = ast_ari_validate_string(
2943                                 ast_json_object_iter_value(iter));
2944                         if (!prop_is_valid) {
2945                                 ast_log(LOG_ERROR, "ARI Dial field dialstring failed validation\n");
2946                                 res = 0;
2947                         }
2948                 } else
2949                 if (strcmp("forward", ast_json_object_iter_key(iter)) == 0) {
2950                         int prop_is_valid;
2951                         prop_is_valid = ast_ari_validate_string(
2952                                 ast_json_object_iter_value(iter));
2953                         if (!prop_is_valid) {
2954                                 ast_log(LOG_ERROR, "ARI Dial field forward failed validation\n");
2955                                 res = 0;
2956                         }
2957                 } else
2958                 if (strcmp("forwarded", ast_json_object_iter_key(iter)) == 0) {
2959                         int prop_is_valid;
2960                         prop_is_valid = ast_ari_validate_channel(
2961                                 ast_json_object_iter_value(iter));
2962                         if (!prop_is_valid) {
2963                                 ast_log(LOG_ERROR, "ARI Dial field forwarded failed validation\n");
2964                                 res = 0;
2965                         }
2966                 } else
2967                 if (strcmp("peer", ast_json_object_iter_key(iter)) == 0) {
2968                         int prop_is_valid;
2969                         has_peer = 1;
2970                         prop_is_valid = ast_ari_validate_channel(
2971                                 ast_json_object_iter_value(iter));
2972                         if (!prop_is_valid) {
2973                                 ast_log(LOG_ERROR, "ARI Dial field peer failed validation\n");
2974                                 res = 0;
2975                         }
2976                 } else
2977                 {
2978                         ast_log(LOG_ERROR,
2979                                 "ARI Dial has undocumented field %s\n",
2980                                 ast_json_object_iter_key(iter));
2981                         res = 0;
2982                 }
2983         }
2984
2985         if (!has_type) {
2986                 ast_log(LOG_ERROR, "ARI Dial missing required field type\n");
2987                 res = 0;
2988         }
2989
2990         if (!has_application) {
2991                 ast_log(LOG_ERROR, "ARI Dial missing required field application\n");
2992                 res = 0;
2993         }
2994
2995         if (!has_dialstatus) {
2996                 ast_log(LOG_ERROR, "ARI Dial missing required field dialstatus\n");
2997                 res = 0;
2998         }
2999
3000         if (!has_peer) {
3001                 ast_log(LOG_ERROR, "ARI Dial missing required field peer\n");
3002                 res = 0;
3003         }
3004
3005         return res;
3006 }
3007
3008 ari_validator ast_ari_validate_dial_fn(void)
3009 {
3010         return ast_ari_validate_dial;
3011 }
3012
3013 int ast_ari_validate_endpoint_state_change(struct ast_json *json)
3014 {
3015         int res = 1;
3016         struct ast_json_iter *iter;
3017         int has_type = 0;
3018         int has_application = 0;
3019         int has_endpoint = 0;
3020
3021         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3022                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3023                         int prop_is_valid;
3024                         has_type = 1;
3025                         prop_is_valid = ast_ari_validate_string(
3026                                 ast_json_object_iter_value(iter));
3027                         if (!prop_is_valid) {
3028                                 ast_log(LOG_ERROR, "ARI EndpointStateChange field type failed validation\n");
3029                                 res = 0;
3030                         }
3031                 } else
3032                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3033                         int prop_is_valid;
3034                         has_application = 1;
3035                         prop_is_valid = ast_ari_validate_string(
3036                                 ast_json_object_iter_value(iter));
3037                         if (!prop_is_valid) {
3038                                 ast_log(LOG_ERROR, "ARI EndpointStateChange field application failed validation\n");
3039                                 res = 0;
3040                         }
3041                 } else
3042                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3043                         int prop_is_valid;
3044                         prop_is_valid = ast_ari_validate_date(
3045                                 ast_json_object_iter_value(iter));
3046                         if (!prop_is_valid) {
3047                                 ast_log(LOG_ERROR, "ARI EndpointStateChange field timestamp failed validation\n");
3048                                 res = 0;
3049                         }
3050                 } else
3051                 if (strcmp("endpoint", ast_json_object_iter_key(iter)) == 0) {
3052                         int prop_is_valid;
3053                         has_endpoint = 1;
3054                         prop_is_valid = ast_ari_validate_endpoint(
3055                                 ast_json_object_iter_value(iter));
3056                         if (!prop_is_valid) {
3057                                 ast_log(LOG_ERROR, "ARI EndpointStateChange field endpoint failed validation\n");
3058                                 res = 0;
3059                         }
3060                 } else
3061                 {
3062                         ast_log(LOG_ERROR,
3063                                 "ARI EndpointStateChange has undocumented field %s\n",
3064                                 ast_json_object_iter_key(iter));
3065                         res = 0;
3066                 }
3067         }
3068
3069         if (!has_type) {
3070                 ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field type\n");
3071                 res = 0;
3072         }
3073
3074         if (!has_application) {
3075                 ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field application\n");
3076                 res = 0;
3077         }
3078
3079         if (!has_endpoint) {
3080                 ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field endpoint\n");
3081                 res = 0;
3082         }
3083
3084         return res;
3085 }
3086
3087 ari_validator ast_ari_validate_endpoint_state_change_fn(void)
3088 {
3089         return ast_ari_validate_endpoint_state_change;
3090 }
3091
3092 int ast_ari_validate_event(struct ast_json *json)
3093 {
3094         int res = 1;
3095         struct ast_json_iter *iter;
3096         int has_type = 0;
3097         int has_application = 0;
3098         const char *discriminator;
3099
3100         discriminator = ast_json_string_get(ast_json_object_get(json, "type"));
3101         if (!discriminator) {
3102                 ast_log(LOG_ERROR, "ARI Event missing required field type");
3103                 return 0;
3104         }
3105
3106         if (strcmp("Event", discriminator) == 0) {
3107                 /* Self type; fall through */
3108         } else
3109         if (strcmp("ApplicationReplaced", discriminator) == 0) {
3110                 return ast_ari_validate_application_replaced(json);
3111         } else
3112         if (strcmp("BridgeCreated", discriminator) == 0) {
3113                 return ast_ari_validate_bridge_created(json);
3114         } else
3115         if (strcmp("BridgeDestroyed", discriminator) == 0) {
3116                 return ast_ari_validate_bridge_destroyed(json);
3117         } else
3118         if (strcmp("BridgeMerged", discriminator) == 0) {
3119                 return ast_ari_validate_bridge_merged(json);
3120         } else
3121         if (strcmp("ChannelCallerId", discriminator) == 0) {
3122                 return ast_ari_validate_channel_caller_id(json);
3123         } else
3124         if (strcmp("ChannelCreated", discriminator) == 0) {
3125                 return ast_ari_validate_channel_created(json);
3126         } else
3127         if (strcmp("ChannelDestroyed", discriminator) == 0) {
3128                 return ast_ari_validate_channel_destroyed(json);
3129         } else
3130         if (strcmp("ChannelDialplan", discriminator) == 0) {
3131                 return ast_ari_validate_channel_dialplan(json);
3132         } else
3133         if (strcmp("ChannelDtmfReceived", discriminator) == 0) {
3134                 return ast_ari_validate_channel_dtmf_received(json);
3135         } else
3136         if (strcmp("ChannelEnteredBridge", discriminator) == 0) {
3137                 return ast_ari_validate_channel_entered_bridge(json);
3138         } else
3139         if (strcmp("ChannelHangupRequest", discriminator) == 0) {
3140                 return ast_ari_validate_channel_hangup_request(json);
3141         } else
3142         if (strcmp("ChannelLeftBridge", discriminator) == 0) {
3143                 return ast_ari_validate_channel_left_bridge(json);
3144         } else
3145         if (strcmp("ChannelStateChange", discriminator) == 0) {
3146                 return ast_ari_validate_channel_state_change(json);
3147         } else
3148         if (strcmp("ChannelUserevent", discriminator) == 0) {
3149                 return ast_ari_validate_channel_userevent(json);
3150         } else
3151         if (strcmp("ChannelVarset", discriminator) == 0) {
3152                 return ast_ari_validate_channel_varset(json);
3153         } else
3154         if (strcmp("DeviceStateChanged", discriminator) == 0) {
3155                 return ast_ari_validate_device_state_changed(json);
3156         } else
3157         if (strcmp("Dial", discriminator) == 0) {
3158                 return ast_ari_validate_dial(json);
3159         } else
3160         if (strcmp("EndpointStateChange", discriminator) == 0) {
3161                 return ast_ari_validate_endpoint_state_change(json);
3162         } else
3163         if (strcmp("PlaybackFinished", discriminator) == 0) {
3164                 return ast_ari_validate_playback_finished(json);
3165         } else
3166         if (strcmp("PlaybackStarted", discriminator) == 0) {
3167                 return ast_ari_validate_playback_started(json);
3168         } else
3169         if (strcmp("RecordingFailed", discriminator) == 0) {
3170                 return ast_ari_validate_recording_failed(json);
3171         } else
3172         if (strcmp("RecordingFinished", discriminator) == 0) {
3173                 return ast_ari_validate_recording_finished(json);
3174         } else
3175         if (strcmp("RecordingStarted", discriminator) == 0) {
3176                 return ast_ari_validate_recording_started(json);
3177         } else
3178         if (strcmp("StasisEnd", discriminator) == 0) {
3179                 return ast_ari_validate_stasis_end(json);
3180         } else
3181         if (strcmp("StasisStart", discriminator) == 0) {
3182                 return ast_ari_validate_stasis_start(json);
3183         } else
3184         {
3185                 ast_log(LOG_ERROR, "ARI Event has undocumented subtype %s\n",
3186                         discriminator);
3187                 res = 0;
3188         }
3189
3190         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3191                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3192                         int prop_is_valid;
3193                         has_type = 1;
3194                         prop_is_valid = ast_ari_validate_string(
3195                                 ast_json_object_iter_value(iter));
3196                         if (!prop_is_valid) {
3197                                 ast_log(LOG_ERROR, "ARI Event field type failed validation\n");
3198                                 res = 0;
3199                         }
3200                 } else
3201                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3202                         int prop_is_valid;
3203                         has_application = 1;
3204                         prop_is_valid = ast_ari_validate_string(
3205                                 ast_json_object_iter_value(iter));
3206                         if (!prop_is_valid) {
3207                                 ast_log(LOG_ERROR, "ARI Event field application failed validation\n");
3208                                 res = 0;
3209                         }
3210                 } else
3211                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3212                         int prop_is_valid;
3213                         prop_is_valid = ast_ari_validate_date(
3214                             &nbs