ari: Add events for playback and recording.
[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_application_replaced(struct ast_json *json)
1337 {
1338         int res = 1;
1339         struct ast_json_iter *iter;
1340         int has_type = 0;
1341         int has_application = 0;
1342
1343         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1344                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1345                         int prop_is_valid;
1346                         has_type = 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 ApplicationReplaced field type failed validation\n");
1351                                 res = 0;
1352                         }
1353                 } else
1354                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1355                         int prop_is_valid;
1356                         has_application = 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 ApplicationReplaced field application failed validation\n");
1361                                 res = 0;
1362                         }
1363                 } else
1364                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1365                         int prop_is_valid;
1366                         prop_is_valid = ast_ari_validate_date(
1367                                 ast_json_object_iter_value(iter));
1368                         if (!prop_is_valid) {
1369                                 ast_log(LOG_ERROR, "ARI ApplicationReplaced field timestamp failed validation\n");
1370                                 res = 0;
1371                         }
1372                 } else
1373                 {
1374                         ast_log(LOG_ERROR,
1375                                 "ARI ApplicationReplaced has undocumented field %s\n",
1376                                 ast_json_object_iter_key(iter));
1377                         res = 0;
1378                 }
1379         }
1380
1381         if (!has_type) {
1382                 ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field type\n");
1383                 res = 0;
1384         }
1385
1386         if (!has_application) {
1387                 ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field application\n");
1388                 res = 0;
1389         }
1390
1391         return res;
1392 }
1393
1394 ari_validator ast_ari_validate_application_replaced_fn(void)
1395 {
1396         return ast_ari_validate_application_replaced;
1397 }
1398
1399 int ast_ari_validate_bridge_created(struct ast_json *json)
1400 {
1401         int res = 1;
1402         struct ast_json_iter *iter;
1403         int has_type = 0;
1404         int has_application = 0;
1405         int has_bridge = 0;
1406
1407         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1408                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1409                         int prop_is_valid;
1410                         has_type = 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 BridgeCreated field type failed validation\n");
1415                                 res = 0;
1416                         }
1417                 } else
1418                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1419                         int prop_is_valid;
1420                         has_application = 1;
1421                         prop_is_valid = ast_ari_validate_string(
1422                                 ast_json_object_iter_value(iter));
1423                         if (!prop_is_valid) {
1424                                 ast_log(LOG_ERROR, "ARI BridgeCreated field application failed validation\n");
1425                                 res = 0;
1426                         }
1427                 } else
1428                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1429                         int prop_is_valid;
1430                         prop_is_valid = ast_ari_validate_date(
1431                                 ast_json_object_iter_value(iter));
1432                         if (!prop_is_valid) {
1433                                 ast_log(LOG_ERROR, "ARI BridgeCreated field timestamp failed validation\n");
1434                                 res = 0;
1435                         }
1436                 } else
1437                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
1438                         int prop_is_valid;
1439                         has_bridge = 1;
1440                         prop_is_valid = ast_ari_validate_bridge(
1441                                 ast_json_object_iter_value(iter));
1442                         if (!prop_is_valid) {
1443                                 ast_log(LOG_ERROR, "ARI BridgeCreated field bridge failed validation\n");
1444                                 res = 0;
1445                         }
1446                 } else
1447                 {
1448                         ast_log(LOG_ERROR,
1449                                 "ARI BridgeCreated has undocumented field %s\n",
1450                                 ast_json_object_iter_key(iter));
1451                         res = 0;
1452                 }
1453         }
1454
1455         if (!has_type) {
1456                 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field type\n");
1457                 res = 0;
1458         }
1459
1460         if (!has_application) {
1461                 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field application\n");
1462                 res = 0;
1463         }
1464
1465         if (!has_bridge) {
1466                 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field bridge\n");
1467                 res = 0;
1468         }
1469
1470         return res;
1471 }
1472
1473 ari_validator ast_ari_validate_bridge_created_fn(void)
1474 {
1475         return ast_ari_validate_bridge_created;
1476 }
1477
1478 int ast_ari_validate_bridge_destroyed(struct ast_json *json)
1479 {
1480         int res = 1;
1481         struct ast_json_iter *iter;
1482         int has_type = 0;
1483         int has_application = 0;
1484         int has_bridge = 0;
1485
1486         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1487                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1488                         int prop_is_valid;
1489                         has_type = 1;
1490                         prop_is_valid = ast_ari_validate_string(
1491                                 ast_json_object_iter_value(iter));
1492                         if (!prop_is_valid) {
1493                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field type failed validation\n");
1494                                 res = 0;
1495                         }
1496                 } else
1497                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1498                         int prop_is_valid;
1499                         has_application = 1;
1500                         prop_is_valid = ast_ari_validate_string(
1501                                 ast_json_object_iter_value(iter));
1502                         if (!prop_is_valid) {
1503                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field application failed validation\n");
1504                                 res = 0;
1505                         }
1506                 } else
1507                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1508                         int prop_is_valid;
1509                         prop_is_valid = ast_ari_validate_date(
1510                                 ast_json_object_iter_value(iter));
1511                         if (!prop_is_valid) {
1512                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field timestamp failed validation\n");
1513                                 res = 0;
1514                         }
1515                 } else
1516                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
1517                         int prop_is_valid;
1518                         has_bridge = 1;
1519                         prop_is_valid = ast_ari_validate_bridge(
1520                                 ast_json_object_iter_value(iter));
1521                         if (!prop_is_valid) {
1522                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field bridge failed validation\n");
1523                                 res = 0;
1524                         }
1525                 } else
1526                 {
1527                         ast_log(LOG_ERROR,
1528                                 "ARI BridgeDestroyed has undocumented field %s\n",
1529                                 ast_json_object_iter_key(iter));
1530                         res = 0;
1531                 }
1532         }
1533
1534         if (!has_type) {
1535                 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field type\n");
1536                 res = 0;
1537         }
1538
1539         if (!has_application) {
1540                 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field application\n");
1541                 res = 0;
1542         }
1543
1544         if (!has_bridge) {
1545                 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field bridge\n");
1546                 res = 0;
1547         }
1548
1549         return res;
1550 }
1551
1552 ari_validator ast_ari_validate_bridge_destroyed_fn(void)
1553 {
1554         return ast_ari_validate_bridge_destroyed;
1555 }
1556
1557 int ast_ari_validate_bridge_merged(struct ast_json *json)
1558 {
1559         int res = 1;
1560         struct ast_json_iter *iter;
1561         int has_type = 0;
1562         int has_application = 0;
1563         int has_bridge = 0;
1564         int has_bridge_from = 0;
1565
1566         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1567                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1568                         int prop_is_valid;
1569                         has_type = 1;
1570                         prop_is_valid = ast_ari_validate_string(
1571                                 ast_json_object_iter_value(iter));
1572                         if (!prop_is_valid) {
1573                                 ast_log(LOG_ERROR, "ARI BridgeMerged field type failed validation\n");
1574                                 res = 0;
1575                         }
1576                 } else
1577                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1578                         int prop_is_valid;
1579                         has_application = 1;
1580                         prop_is_valid = ast_ari_validate_string(
1581                                 ast_json_object_iter_value(iter));
1582                         if (!prop_is_valid) {
1583                                 ast_log(LOG_ERROR, "ARI BridgeMerged field application failed validation\n");
1584                                 res = 0;
1585                         }
1586                 } else
1587                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1588                         int prop_is_valid;
1589                         prop_is_valid = ast_ari_validate_date(
1590                                 ast_json_object_iter_value(iter));
1591                         if (!prop_is_valid) {
1592                                 ast_log(LOG_ERROR, "ARI BridgeMerged field timestamp failed validation\n");
1593                                 res = 0;
1594                         }
1595                 } else
1596                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
1597                         int prop_is_valid;
1598                         has_bridge = 1;
1599                         prop_is_valid = ast_ari_validate_bridge(
1600                                 ast_json_object_iter_value(iter));
1601                         if (!prop_is_valid) {
1602                                 ast_log(LOG_ERROR, "ARI BridgeMerged field bridge failed validation\n");
1603                                 res = 0;
1604                         }
1605                 } else
1606                 if (strcmp("bridge_from", ast_json_object_iter_key(iter)) == 0) {
1607                         int prop_is_valid;
1608                         has_bridge_from = 1;
1609                         prop_is_valid = ast_ari_validate_bridge(
1610                                 ast_json_object_iter_value(iter));
1611                         if (!prop_is_valid) {
1612                                 ast_log(LOG_ERROR, "ARI BridgeMerged field bridge_from failed validation\n");
1613                                 res = 0;
1614                         }
1615                 } else
1616                 {
1617                         ast_log(LOG_ERROR,
1618                                 "ARI BridgeMerged has undocumented field %s\n",
1619                                 ast_json_object_iter_key(iter));
1620                         res = 0;
1621                 }
1622         }
1623
1624         if (!has_type) {
1625                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field type\n");
1626                 res = 0;
1627         }
1628
1629         if (!has_application) {
1630                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field application\n");
1631                 res = 0;
1632         }
1633
1634         if (!has_bridge) {
1635                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge\n");
1636                 res = 0;
1637         }
1638
1639         if (!has_bridge_from) {
1640                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge_from\n");
1641                 res = 0;
1642         }
1643
1644         return res;
1645 }
1646
1647 ari_validator ast_ari_validate_bridge_merged_fn(void)
1648 {
1649         return ast_ari_validate_bridge_merged;
1650 }
1651
1652 int ast_ari_validate_channel_caller_id(struct ast_json *json)
1653 {
1654         int res = 1;
1655         struct ast_json_iter *iter;
1656         int has_type = 0;
1657         int has_application = 0;
1658         int has_caller_presentation = 0;
1659         int has_caller_presentation_txt = 0;
1660         int has_channel = 0;
1661
1662         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1663                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1664                         int prop_is_valid;
1665                         has_type = 1;
1666                         prop_is_valid = ast_ari_validate_string(
1667                                 ast_json_object_iter_value(iter));
1668                         if (!prop_is_valid) {
1669                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field type failed validation\n");
1670                                 res = 0;
1671                         }
1672                 } else
1673                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1674                         int prop_is_valid;
1675                         has_application = 1;
1676                         prop_is_valid = ast_ari_validate_string(
1677                                 ast_json_object_iter_value(iter));
1678                         if (!prop_is_valid) {
1679                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field application failed validation\n");
1680                                 res = 0;
1681                         }
1682                 } else
1683                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1684                         int prop_is_valid;
1685                         prop_is_valid = ast_ari_validate_date(
1686                                 ast_json_object_iter_value(iter));
1687                         if (!prop_is_valid) {
1688                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field timestamp failed validation\n");
1689                                 res = 0;
1690                         }
1691                 } else
1692                 if (strcmp("caller_presentation", ast_json_object_iter_key(iter)) == 0) {
1693                         int prop_is_valid;
1694                         has_caller_presentation = 1;
1695                         prop_is_valid = ast_ari_validate_int(
1696                                 ast_json_object_iter_value(iter));
1697                         if (!prop_is_valid) {
1698                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation failed validation\n");
1699                                 res = 0;
1700                         }
1701                 } else
1702                 if (strcmp("caller_presentation_txt", ast_json_object_iter_key(iter)) == 0) {
1703                         int prop_is_valid;
1704                         has_caller_presentation_txt = 1;
1705                         prop_is_valid = ast_ari_validate_string(
1706                                 ast_json_object_iter_value(iter));
1707                         if (!prop_is_valid) {
1708                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation_txt failed validation\n");
1709                                 res = 0;
1710                         }
1711                 } else
1712                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
1713                         int prop_is_valid;
1714                         has_channel = 1;
1715                         prop_is_valid = ast_ari_validate_channel(
1716                                 ast_json_object_iter_value(iter));
1717                         if (!prop_is_valid) {
1718                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field channel failed validation\n");
1719                                 res = 0;
1720                         }
1721                 } else
1722                 {
1723                         ast_log(LOG_ERROR,
1724                                 "ARI ChannelCallerId has undocumented field %s\n",
1725                                 ast_json_object_iter_key(iter));
1726                         res = 0;
1727                 }
1728         }
1729
1730         if (!has_type) {
1731                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field type\n");
1732                 res = 0;
1733         }
1734
1735         if (!has_application) {
1736                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field application\n");
1737                 res = 0;
1738         }
1739
1740         if (!has_caller_presentation) {
1741                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation\n");
1742                 res = 0;
1743         }
1744
1745         if (!has_caller_presentation_txt) {
1746                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation_txt\n");
1747                 res = 0;
1748         }
1749
1750         if (!has_channel) {
1751                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field channel\n");
1752                 res = 0;
1753         }
1754
1755         return res;
1756 }
1757
1758 ari_validator ast_ari_validate_channel_caller_id_fn(void)
1759 {
1760         return ast_ari_validate_channel_caller_id;
1761 }
1762
1763 int ast_ari_validate_channel_created(struct ast_json *json)
1764 {
1765         int res = 1;
1766         struct ast_json_iter *iter;
1767         int has_type = 0;
1768         int has_application = 0;
1769         int has_channel = 0;
1770
1771         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1772                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1773                         int prop_is_valid;
1774                         has_type = 1;
1775                         prop_is_valid = ast_ari_validate_string(
1776                                 ast_json_object_iter_value(iter));
1777                         if (!prop_is_valid) {
1778                                 ast_log(LOG_ERROR, "ARI ChannelCreated field type failed validation\n");
1779                                 res = 0;
1780                         }
1781                 } else
1782                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1783                         int prop_is_valid;
1784                         has_application = 1;
1785                         prop_is_valid = ast_ari_validate_string(
1786                                 ast_json_object_iter_value(iter));
1787                         if (!prop_is_valid) {
1788                                 ast_log(LOG_ERROR, "ARI ChannelCreated field application failed validation\n");
1789                                 res = 0;
1790                         }
1791                 } else
1792                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1793                         int prop_is_valid;
1794                         prop_is_valid = ast_ari_validate_date(
1795                                 ast_json_object_iter_value(iter));
1796                         if (!prop_is_valid) {
1797                                 ast_log(LOG_ERROR, "ARI ChannelCreated field timestamp failed validation\n");
1798                                 res = 0;
1799                         }
1800                 } else
1801                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
1802                         int prop_is_valid;
1803                         has_channel = 1;
1804                         prop_is_valid = ast_ari_validate_channel(
1805                                 ast_json_object_iter_value(iter));
1806                         if (!prop_is_valid) {
1807                                 ast_log(LOG_ERROR, "ARI ChannelCreated field channel failed validation\n");
1808                                 res = 0;
1809                         }
1810                 } else
1811                 {
1812                         ast_log(LOG_ERROR,
1813                                 "ARI ChannelCreated has undocumented field %s\n",
1814                                 ast_json_object_iter_key(iter));
1815                         res = 0;
1816                 }
1817         }
1818
1819         if (!has_type) {
1820                 ast_log(LOG_ERROR, "ARI ChannelCreated missing required field type\n");
1821                 res = 0;
1822         }
1823
1824         if (!has_application) {
1825                 ast_log(LOG_ERROR, "ARI ChannelCreated missing required field application\n");
1826                 res = 0;
1827         }
1828
1829         if (!has_channel) {
1830                 ast_log(LOG_ERROR, "ARI ChannelCreated missing required field channel\n");
1831                 res = 0;
1832         }
1833
1834         return res;
1835 }
1836
1837 ari_validator ast_ari_validate_channel_created_fn(void)
1838 {
1839         return ast_ari_validate_channel_created;
1840 }
1841
1842 int ast_ari_validate_channel_destroyed(struct ast_json *json)
1843 {
1844         int res = 1;
1845         struct ast_json_iter *iter;
1846         int has_type = 0;
1847         int has_application = 0;
1848         int has_cause = 0;
1849         int has_cause_txt = 0;
1850         int has_channel = 0;
1851
1852         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1853                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1854                         int prop_is_valid;
1855                         has_type = 1;
1856                         prop_is_valid = ast_ari_validate_string(
1857                                 ast_json_object_iter_value(iter));
1858                         if (!prop_is_valid) {
1859                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field type failed validation\n");
1860                                 res = 0;
1861                         }
1862                 } else
1863                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1864                         int prop_is_valid;
1865                         has_application = 1;
1866                         prop_is_valid = ast_ari_validate_string(
1867                                 ast_json_object_iter_value(iter));
1868                         if (!prop_is_valid) {
1869                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field application failed validation\n");
1870                                 res = 0;
1871                         }
1872                 } else
1873                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1874                         int prop_is_valid;
1875                         prop_is_valid = ast_ari_validate_date(
1876                                 ast_json_object_iter_value(iter));
1877                         if (!prop_is_valid) {
1878                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field timestamp failed validation\n");
1879                                 res = 0;
1880                         }
1881                 } else
1882                 if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
1883                         int prop_is_valid;
1884                         has_cause = 1;
1885                         prop_is_valid = ast_ari_validate_int(
1886                                 ast_json_object_iter_value(iter));
1887                         if (!prop_is_valid) {
1888                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field cause failed validation\n");
1889                                 res = 0;
1890                         }
1891                 } else
1892                 if (strcmp("cause_txt", ast_json_object_iter_key(iter)) == 0) {
1893                         int prop_is_valid;
1894                         has_cause_txt = 1;
1895                         prop_is_valid = ast_ari_validate_string(
1896                                 ast_json_object_iter_value(iter));
1897                         if (!prop_is_valid) {
1898                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field cause_txt failed validation\n");
1899                                 res = 0;
1900                         }
1901                 } else
1902                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
1903                         int prop_is_valid;
1904                         has_channel = 1;
1905                         prop_is_valid = ast_ari_validate_channel(
1906                                 ast_json_object_iter_value(iter));
1907                         if (!prop_is_valid) {
1908                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field channel failed validation\n");
1909                                 res = 0;
1910                         }
1911                 } else
1912                 {
1913                         ast_log(LOG_ERROR,
1914                                 "ARI ChannelDestroyed has undocumented field %s\n",
1915                                 ast_json_object_iter_key(iter));
1916                         res = 0;
1917                 }
1918         }
1919
1920         if (!has_type) {
1921                 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field type\n");
1922                 res = 0;
1923         }
1924
1925         if (!has_application) {
1926                 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field application\n");
1927                 res = 0;
1928         }
1929
1930         if (!has_cause) {
1931                 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field cause\n");
1932                 res = 0;
1933         }
1934
1935         if (!has_cause_txt) {
1936                 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field cause_txt\n");
1937                 res = 0;
1938         }
1939
1940         if (!has_channel) {
1941                 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field channel\n");
1942                 res = 0;
1943         }
1944
1945         return res;
1946 }
1947
1948 ari_validator ast_ari_validate_channel_destroyed_fn(void)
1949 {
1950         return ast_ari_validate_channel_destroyed;
1951 }
1952
1953 int ast_ari_validate_channel_dialplan(struct ast_json *json)
1954 {
1955         int res = 1;
1956         struct ast_json_iter *iter;
1957         int has_type = 0;
1958         int has_application = 0;
1959         int has_channel = 0;
1960         int has_dialplan_app = 0;
1961         int has_dialplan_app_data = 0;
1962
1963         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1964                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1965                         int prop_is_valid;
1966                         has_type = 1;
1967                         prop_is_valid = ast_ari_validate_string(
1968                                 ast_json_object_iter_value(iter));
1969                         if (!prop_is_valid) {
1970                                 ast_log(LOG_ERROR, "ARI ChannelDialplan field type failed validation\n");
1971                                 res = 0;
1972                         }
1973                 } else
1974                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1975                         int prop_is_valid;
1976                         has_application = 1;
1977                         prop_is_valid = ast_ari_validate_string(
1978                                 ast_json_object_iter_value(iter));
1979                         if (!prop_is_valid) {
1980                                 ast_log(LOG_ERROR, "ARI ChannelDialplan field application failed validation\n");
1981                                 res = 0;
1982                         }
1983                 } else
1984                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1985                         int prop_is_valid;
1986                         prop_is_valid = ast_ari_validate_date(
1987                                 ast_json_object_iter_value(iter));
1988                         if (!prop_is_valid) {
1989                                 ast_log(LOG_ERROR, "ARI ChannelDialplan field timestamp failed validation\n");
1990                                 res = 0;
1991                         }
1992                 } else
1993                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
1994                         int prop_is_valid;
1995                         has_channel = 1;
1996                         prop_is_valid = ast_ari_validate_channel(
1997                                 ast_json_object_iter_value(iter));
1998                         if (!prop_is_valid) {
1999                                 ast_log(LOG_ERROR, "ARI ChannelDialplan field channel failed validation\n");
2000                                 res = 0;
2001                         }
2002                 } else
2003                 if (strcmp("dialplan_app", ast_json_object_iter_key(iter)) == 0) {
2004                         int prop_is_valid;
2005                         has_dialplan_app = 1;
2006                         prop_is_valid = ast_ari_validate_string(
2007                                 ast_json_object_iter_value(iter));
2008                         if (!prop_is_valid) {
2009                                 ast_log(LOG_ERROR, "ARI ChannelDialplan field dialplan_app failed validation\n");
2010                                 res = 0;
2011                         }
2012                 } else
2013                 if (strcmp("dialplan_app_data", ast_json_object_iter_key(iter)) == 0) {
2014                         int prop_is_valid;
2015                         has_dialplan_app_data = 1;
2016                         prop_is_valid = ast_ari_validate_string(
2017                                 ast_json_object_iter_value(iter));
2018                         if (!prop_is_valid) {
2019                                 ast_log(LOG_ERROR, "ARI ChannelDialplan field dialplan_app_data failed validation\n");
2020                                 res = 0;
2021                         }
2022                 } else
2023                 {
2024                         ast_log(LOG_ERROR,
2025                                 "ARI ChannelDialplan has undocumented field %s\n",
2026                                 ast_json_object_iter_key(iter));
2027                         res = 0;
2028                 }
2029         }
2030
2031         if (!has_type) {
2032                 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field type\n");
2033                 res = 0;
2034         }
2035
2036         if (!has_application) {
2037                 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field application\n");
2038                 res = 0;
2039         }
2040
2041         if (!has_channel) {
2042                 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field channel\n");
2043                 res = 0;
2044         }
2045
2046         if (!has_dialplan_app) {
2047                 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field dialplan_app\n");
2048                 res = 0;
2049         }
2050
2051         if (!has_dialplan_app_data) {
2052                 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field dialplan_app_data\n");
2053                 res = 0;
2054         }
2055
2056         return res;
2057 }
2058
2059 ari_validator ast_ari_validate_channel_dialplan_fn(void)
2060 {
2061         return ast_ari_validate_channel_dialplan;
2062 }
2063
2064 int ast_ari_validate_channel_dtmf_received(struct ast_json *json)
2065 {
2066         int res = 1;
2067         struct ast_json_iter *iter;
2068         int has_type = 0;
2069         int has_application = 0;
2070         int has_channel = 0;
2071         int has_digit = 0;
2072         int has_duration_ms = 0;
2073
2074         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2075                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2076                         int prop_is_valid;
2077                         has_type = 1;
2078                         prop_is_valid = ast_ari_validate_string(
2079                                 ast_json_object_iter_value(iter));
2080                         if (!prop_is_valid) {
2081                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field type failed validation\n");
2082                                 res = 0;
2083                         }
2084                 } else
2085                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2086                         int prop_is_valid;
2087                         has_application = 1;
2088                         prop_is_valid = ast_ari_validate_string(
2089                                 ast_json_object_iter_value(iter));
2090                         if (!prop_is_valid) {
2091                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field application failed validation\n");
2092                                 res = 0;
2093                         }
2094                 } else
2095                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2096                         int prop_is_valid;
2097                         prop_is_valid = ast_ari_validate_date(
2098                                 ast_json_object_iter_value(iter));
2099                         if (!prop_is_valid) {
2100                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field timestamp failed validation\n");
2101                                 res = 0;
2102                         }
2103                 } else
2104                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2105                         int prop_is_valid;
2106                         has_channel = 1;
2107                         prop_is_valid = ast_ari_validate_channel(
2108                                 ast_json_object_iter_value(iter));
2109                         if (!prop_is_valid) {
2110                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field channel failed validation\n");
2111                                 res = 0;
2112                         }
2113                 } else
2114                 if (strcmp("digit", ast_json_object_iter_key(iter)) == 0) {
2115                         int prop_is_valid;
2116                         has_digit = 1;
2117                         prop_is_valid = ast_ari_validate_string(
2118                                 ast_json_object_iter_value(iter));
2119                         if (!prop_is_valid) {
2120                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field digit failed validation\n");
2121                                 res = 0;
2122                         }
2123                 } else
2124                 if (strcmp("duration_ms", ast_json_object_iter_key(iter)) == 0) {
2125                         int prop_is_valid;
2126                         has_duration_ms = 1;
2127                         prop_is_valid = ast_ari_validate_int(
2128                                 ast_json_object_iter_value(iter));
2129                         if (!prop_is_valid) {
2130                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field duration_ms failed validation\n");
2131                                 res = 0;
2132                         }
2133                 } else
2134                 {
2135                         ast_log(LOG_ERROR,
2136                                 "ARI ChannelDtmfReceived has undocumented field %s\n",
2137                                 ast_json_object_iter_key(iter));
2138                         res = 0;
2139                 }
2140         }
2141
2142         if (!has_type) {
2143                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field type\n");
2144                 res = 0;
2145         }
2146
2147         if (!has_application) {
2148                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field application\n");
2149                 res = 0;
2150         }
2151
2152         if (!has_channel) {
2153                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field channel\n");
2154                 res = 0;
2155         }
2156
2157         if (!has_digit) {
2158                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field digit\n");
2159                 res = 0;
2160         }
2161
2162         if (!has_duration_ms) {
2163                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field duration_ms\n");
2164                 res = 0;
2165         }
2166
2167         return res;
2168 }
2169
2170 ari_validator ast_ari_validate_channel_dtmf_received_fn(void)
2171 {
2172         return ast_ari_validate_channel_dtmf_received;
2173 }
2174
2175 int ast_ari_validate_channel_entered_bridge(struct ast_json *json)
2176 {
2177         int res = 1;
2178         struct ast_json_iter *iter;
2179         int has_type = 0;
2180         int has_application = 0;
2181         int has_bridge = 0;
2182
2183         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2184                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2185                         int prop_is_valid;
2186                         has_type = 1;
2187                         prop_is_valid = ast_ari_validate_string(
2188                                 ast_json_object_iter_value(iter));
2189                         if (!prop_is_valid) {
2190                                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field type failed validation\n");
2191                                 res = 0;
2192                         }
2193                 } else
2194                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2195                         int prop_is_valid;
2196                         has_application = 1;
2197                         prop_is_valid = ast_ari_validate_string(
2198                                 ast_json_object_iter_value(iter));
2199                         if (!prop_is_valid) {
2200                                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field application failed validation\n");
2201                                 res = 0;
2202                         }
2203                 } else
2204                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2205                         int prop_is_valid;
2206                         prop_is_valid = ast_ari_validate_date(
2207                                 ast_json_object_iter_value(iter));
2208                         if (!prop_is_valid) {
2209                                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field timestamp failed validation\n");
2210                                 res = 0;
2211                         }
2212                 } else
2213                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2214                         int prop_is_valid;
2215                         has_bridge = 1;
2216                         prop_is_valid = ast_ari_validate_bridge(
2217                                 ast_json_object_iter_value(iter));
2218                         if (!prop_is_valid) {
2219                                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field bridge failed validation\n");
2220                                 res = 0;
2221                         }
2222                 } else
2223                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2224                         int prop_is_valid;
2225                         prop_is_valid = ast_ari_validate_channel(
2226                                 ast_json_object_iter_value(iter));
2227                         if (!prop_is_valid) {
2228                                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field channel failed validation\n");
2229                                 res = 0;
2230                         }
2231                 } else
2232                 {
2233                         ast_log(LOG_ERROR,
2234                                 "ARI ChannelEnteredBridge has undocumented field %s\n",
2235                                 ast_json_object_iter_key(iter));
2236                         res = 0;
2237                 }
2238         }
2239
2240         if (!has_type) {
2241                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field type\n");
2242                 res = 0;
2243         }
2244
2245         if (!has_application) {
2246                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field application\n");
2247                 res = 0;
2248         }
2249
2250         if (!has_bridge) {
2251                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field bridge\n");
2252                 res = 0;
2253         }
2254
2255         return res;
2256 }
2257
2258 ari_validator ast_ari_validate_channel_entered_bridge_fn(void)
2259 {
2260         return ast_ari_validate_channel_entered_bridge;
2261 }
2262
2263 int ast_ari_validate_channel_hangup_request(struct ast_json *json)
2264 {
2265         int res = 1;
2266         struct ast_json_iter *iter;
2267         int has_type = 0;
2268         int has_application = 0;
2269         int has_channel = 0;
2270
2271         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2272                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2273                         int prop_is_valid;
2274                         has_type = 1;
2275                         prop_is_valid = ast_ari_validate_string(
2276                                 ast_json_object_iter_value(iter));
2277                         if (!prop_is_valid) {
2278                                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field type failed validation\n");
2279                                 res = 0;
2280                         }
2281                 } else
2282                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2283                         int prop_is_valid;
2284                         has_application = 1;
2285                         prop_is_valid = ast_ari_validate_string(
2286                                 ast_json_object_iter_value(iter));
2287                         if (!prop_is_valid) {
2288                                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field application failed validation\n");
2289                                 res = 0;
2290                         }
2291                 } else
2292                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2293                         int prop_is_valid;
2294                         prop_is_valid = ast_ari_validate_date(
2295                                 ast_json_object_iter_value(iter));
2296                         if (!prop_is_valid) {
2297                                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field timestamp failed validation\n");
2298                                 res = 0;
2299                         }
2300                 } else
2301                 if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
2302                         int prop_is_valid;
2303                         prop_is_valid = ast_ari_validate_int(
2304                                 ast_json_object_iter_value(iter));
2305                         if (!prop_is_valid) {
2306                                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field cause failed validation\n");
2307                                 res = 0;
2308                         }
2309                 } else
2310                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2311                         int prop_is_valid;
2312                         has_channel = 1;
2313                         prop_is_valid = ast_ari_validate_channel(
2314                                 ast_json_object_iter_value(iter));
2315                         if (!prop_is_valid) {
2316                                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field channel failed validation\n");
2317                                 res = 0;
2318                         }
2319                 } else
2320                 if (strcmp("soft", ast_json_object_iter_key(iter)) == 0) {
2321                         int prop_is_valid;
2322                         prop_is_valid = ast_ari_validate_boolean(
2323                                 ast_json_object_iter_value(iter));
2324                         if (!prop_is_valid) {
2325                                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field soft failed validation\n");
2326                                 res = 0;
2327                         }
2328                 } else
2329                 {
2330                         ast_log(LOG_ERROR,
2331                                 "ARI ChannelHangupRequest has undocumented field %s\n",
2332                                 ast_json_object_iter_key(iter));
2333                         res = 0;
2334                 }
2335         }
2336
2337         if (!has_type) {
2338                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field type\n");
2339                 res = 0;
2340         }
2341
2342         if (!has_application) {
2343                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field application\n");
2344                 res = 0;
2345         }
2346
2347         if (!has_channel) {
2348                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field channel\n");
2349                 res = 0;
2350         }
2351
2352         return res;
2353 }
2354
2355 ari_validator ast_ari_validate_channel_hangup_request_fn(void)
2356 {
2357         return ast_ari_validate_channel_hangup_request;
2358 }
2359
2360 int ast_ari_validate_channel_left_bridge(struct ast_json *json)
2361 {
2362         int res = 1;
2363         struct ast_json_iter *iter;
2364         int has_type = 0;
2365         int has_application = 0;
2366         int has_bridge = 0;
2367         int has_channel = 0;
2368
2369         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2370                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2371                         int prop_is_valid;
2372                         has_type = 1;
2373                         prop_is_valid = ast_ari_validate_string(
2374                                 ast_json_object_iter_value(iter));
2375                         if (!prop_is_valid) {
2376                                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge field type failed validation\n");
2377                                 res = 0;
2378                         }
2379                 } else
2380                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2381                         int prop_is_valid;
2382                         has_application = 1;
2383                         prop_is_valid = ast_ari_validate_string(
2384                                 ast_json_object_iter_value(iter));
2385                         if (!prop_is_valid) {
2386                                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge field application failed validation\n");
2387                                 res = 0;
2388                         }
2389                 } else
2390                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2391                         int prop_is_valid;
2392                         prop_is_valid = ast_ari_validate_date(
2393                                 ast_json_object_iter_value(iter));
2394                         if (!prop_is_valid) {
2395                                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge field timestamp failed validation\n");
2396                                 res = 0;
2397                         }
2398                 } else
2399                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2400                         int prop_is_valid;
2401                         has_bridge = 1;
2402                         prop_is_valid = ast_ari_validate_bridge(
2403                                 ast_json_object_iter_value(iter));
2404                         if (!prop_is_valid) {
2405                                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge field bridge failed validation\n");
2406                                 res = 0;
2407                         }
2408                 } else
2409                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2410                         int prop_is_valid;
2411                         has_channel = 1;
2412                         prop_is_valid = ast_ari_validate_channel(
2413                                 ast_json_object_iter_value(iter));
2414                         if (!prop_is_valid) {
2415                                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge field channel failed validation\n");
2416                                 res = 0;
2417                         }
2418                 } else
2419                 {
2420                         ast_log(LOG_ERROR,
2421                                 "ARI ChannelLeftBridge has undocumented field %s\n",
2422                                 ast_json_object_iter_key(iter));
2423                         res = 0;
2424                 }
2425         }
2426
2427         if (!has_type) {
2428                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field type\n");
2429                 res = 0;
2430         }
2431
2432         if (!has_application) {
2433                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field application\n");
2434                 res = 0;
2435         }
2436
2437         if (!has_bridge) {
2438                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field bridge\n");
2439                 res = 0;
2440         }
2441
2442         if (!has_channel) {
2443                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field channel\n");
2444                 res = 0;
2445         }
2446
2447         return res;
2448 }
2449
2450 ari_validator ast_ari_validate_channel_left_bridge_fn(void)
2451 {
2452         return ast_ari_validate_channel_left_bridge;
2453 }
2454
2455 int ast_ari_validate_channel_state_change(struct ast_json *json)
2456 {
2457         int res = 1;
2458         struct ast_json_iter *iter;
2459         int has_type = 0;
2460         int has_application = 0;
2461         int has_channel = 0;
2462
2463         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2464                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2465                         int prop_is_valid;
2466                         has_type = 1;
2467                         prop_is_valid = ast_ari_validate_string(
2468                                 ast_json_object_iter_value(iter));
2469                         if (!prop_is_valid) {
2470                                 ast_log(LOG_ERROR, "ARI ChannelStateChange field type failed validation\n");
2471                                 res = 0;
2472                         }
2473                 } else
2474                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2475                         int prop_is_valid;
2476                         has_application = 1;
2477                         prop_is_valid = ast_ari_validate_string(
2478                                 ast_json_object_iter_value(iter));
2479                         if (!prop_is_valid) {
2480                                 ast_log(LOG_ERROR, "ARI ChannelStateChange field application failed validation\n");
2481                                 res = 0;
2482                         }
2483                 } else
2484                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2485                         int prop_is_valid;
2486                         prop_is_valid = ast_ari_validate_date(
2487                                 ast_json_object_iter_value(iter));
2488                         if (!prop_is_valid) {
2489                                 ast_log(LOG_ERROR, "ARI ChannelStateChange field timestamp failed validation\n");
2490                                 res = 0;
2491                         }
2492                 } else
2493                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2494                         int prop_is_valid;
2495                         has_channel = 1;
2496                         prop_is_valid = ast_ari_validate_channel(
2497                                 ast_json_object_iter_value(iter));
2498                         if (!prop_is_valid) {
2499                                 ast_log(LOG_ERROR, "ARI ChannelStateChange field channel failed validation\n");
2500                                 res = 0;
2501                         }
2502                 } else
2503                 {
2504                         ast_log(LOG_ERROR,
2505                                 "ARI ChannelStateChange has undocumented field %s\n",
2506                                 ast_json_object_iter_key(iter));
2507                         res = 0;
2508                 }
2509         }
2510
2511         if (!has_type) {
2512                 ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field type\n");
2513                 res = 0;
2514         }
2515
2516         if (!has_application) {
2517                 ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field application\n");
2518                 res = 0;
2519         }
2520
2521         if (!has_channel) {
2522                 ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field channel\n");
2523                 res = 0;
2524         }
2525
2526         return res;
2527 }
2528
2529 ari_validator ast_ari_validate_channel_state_change_fn(void)
2530 {
2531         return ast_ari_validate_channel_state_change;
2532 }
2533
2534 int ast_ari_validate_channel_userevent(struct ast_json *json)
2535 {
2536         int res = 1;
2537         struct ast_json_iter *iter;
2538         int has_type = 0;
2539         int has_application = 0;
2540         int has_channel = 0;
2541         int has_eventname = 0;
2542         int has_userevent = 0;
2543
2544         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2545                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2546                         int prop_is_valid;
2547                         has_type = 1;
2548                         prop_is_valid = ast_ari_validate_string(
2549                                 ast_json_object_iter_value(iter));
2550                         if (!prop_is_valid) {
2551                                 ast_log(LOG_ERROR, "ARI ChannelUserevent field type failed validation\n");
2552                                 res = 0;
2553                         }
2554                 } else
2555                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2556                         int prop_is_valid;
2557                         has_application = 1;
2558                         prop_is_valid = ast_ari_validate_string(
2559                                 ast_json_object_iter_value(iter));
2560                         if (!prop_is_valid) {
2561                                 ast_log(LOG_ERROR, "ARI ChannelUserevent field application failed validation\n");
2562                                 res = 0;
2563                         }
2564                 } else
2565                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2566                         int prop_is_valid;
2567                         prop_is_valid = ast_ari_validate_date(
2568                                 ast_json_object_iter_value(iter));
2569                         if (!prop_is_valid) {
2570                                 ast_log(LOG_ERROR, "ARI ChannelUserevent field timestamp failed validation\n");
2571                                 res = 0;
2572                         }
2573                 } else
2574                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2575                         int prop_is_valid;
2576                         has_channel = 1;
2577                         prop_is_valid = ast_ari_validate_channel(
2578                                 ast_json_object_iter_value(iter));
2579                         if (!prop_is_valid) {
2580                                 ast_log(LOG_ERROR, "ARI ChannelUserevent field channel failed validation\n");
2581                                 res = 0;
2582                         }
2583                 } else
2584                 if (strcmp("eventname", ast_json_object_iter_key(iter)) == 0) {
2585                         int prop_is_valid;
2586                         has_eventname = 1;
2587                         prop_is_valid = ast_ari_validate_string(
2588                                 ast_json_object_iter_value(iter));
2589                         if (!prop_is_valid) {
2590                                 ast_log(LOG_ERROR, "ARI ChannelUserevent field eventname failed validation\n");
2591                                 res = 0;
2592                         }
2593                 } else
2594                 if (strcmp("userevent", ast_json_object_iter_key(iter)) == 0) {
2595                         int prop_is_valid;
2596                         has_userevent = 1;
2597                         prop_is_valid = ast_ari_validate_object(
2598                                 ast_json_object_iter_value(iter));
2599                         if (!prop_is_valid) {
2600                                 ast_log(LOG_ERROR, "ARI ChannelUserevent field userevent failed validation\n");
2601                                 res = 0;
2602                         }
2603                 } else
2604                 {
2605                         ast_log(LOG_ERROR,
2606                                 "ARI ChannelUserevent has undocumented field %s\n",
2607                                 ast_json_object_iter_key(iter));
2608                         res = 0;
2609                 }
2610         }
2611
2612         if (!has_type) {
2613                 ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field type\n");
2614                 res = 0;
2615         }
2616
2617         if (!has_application) {
2618                 ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field application\n");
2619                 res = 0;
2620         }
2621
2622         if (!has_channel) {
2623                 ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field channel\n");
2624                 res = 0;
2625         }
2626
2627         if (!has_eventname) {
2628                 ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field eventname\n");
2629                 res = 0;
2630         }
2631
2632         if (!has_userevent) {
2633                 ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field userevent\n");
2634                 res = 0;
2635         }
2636
2637         return res;
2638 }
2639
2640 ari_validator ast_ari_validate_channel_userevent_fn(void)
2641 {
2642         return ast_ari_validate_channel_userevent;
2643 }
2644
2645 int ast_ari_validate_channel_varset(struct ast_json *json)
2646 {
2647         int res = 1;
2648         struct ast_json_iter *iter;
2649         int has_type = 0;
2650         int has_application = 0;
2651         int has_value = 0;
2652         int has_variable = 0;
2653
2654         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2655                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2656                         int prop_is_valid;
2657                         has_type = 1;
2658                         prop_is_valid = ast_ari_validate_string(
2659                                 ast_json_object_iter_value(iter));
2660                         if (!prop_is_valid) {
2661                                 ast_log(LOG_ERROR, "ARI ChannelVarset field type failed validation\n");
2662                                 res = 0;
2663                         }
2664                 } else
2665                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2666                         int prop_is_valid;
2667                         has_application = 1;
2668                         prop_is_valid = ast_ari_validate_string(
2669                                 ast_json_object_iter_value(iter));
2670                         if (!prop_is_valid) {
2671                                 ast_log(LOG_ERROR, "ARI ChannelVarset field application failed validation\n");
2672                                 res = 0;
2673                         }
2674                 } else
2675                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2676                         int prop_is_valid;
2677                         prop_is_valid = ast_ari_validate_date(
2678                                 ast_json_object_iter_value(iter));
2679                         if (!prop_is_valid) {
2680                                 ast_log(LOG_ERROR, "ARI ChannelVarset field timestamp failed validation\n");
2681                                 res = 0;
2682                         }
2683                 } else
2684                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2685                         int prop_is_valid;
2686                         prop_is_valid = ast_ari_validate_channel(
2687                                 ast_json_object_iter_value(iter));
2688                         if (!prop_is_valid) {
2689                                 ast_log(LOG_ERROR, "ARI ChannelVarset field channel failed validation\n");
2690                                 res = 0;
2691                         }
2692                 } else
2693                 if (strcmp("value", ast_json_object_iter_key(iter)) == 0) {
2694                         int prop_is_valid;
2695                         has_value = 1;
2696                         prop_is_valid = ast_ari_validate_string(
2697                                 ast_json_object_iter_value(iter));
2698                         if (!prop_is_valid) {
2699                                 ast_log(LOG_ERROR, "ARI ChannelVarset field value failed validation\n");
2700                                 res = 0;
2701                         }
2702                 } else
2703                 if (strcmp("variable", ast_json_object_iter_key(iter)) == 0) {
2704                         int prop_is_valid;
2705                         has_variable = 1;
2706                         prop_is_valid = ast_ari_validate_string(
2707                                 ast_json_object_iter_value(iter));
2708                         if (!prop_is_valid) {
2709                                 ast_log(LOG_ERROR, "ARI ChannelVarset field variable failed validation\n");
2710                                 res = 0;
2711                         }
2712                 } else
2713                 {
2714                         ast_log(LOG_ERROR,
2715                                 "ARI ChannelVarset has undocumented field %s\n",
2716                                 ast_json_object_iter_key(iter));
2717                         res = 0;
2718                 }
2719         }
2720
2721         if (!has_type) {
2722                 ast_log(LOG_ERROR, "ARI ChannelVarset missing required field type\n");
2723                 res = 0;
2724         }
2725
2726         if (!has_application) {
2727                 ast_log(LOG_ERROR, "ARI ChannelVarset missing required field application\n");
2728                 res = 0;
2729         }
2730
2731         if (!has_value) {
2732                 ast_log(LOG_ERROR, "ARI ChannelVarset missing required field value\n");
2733                 res = 0;
2734         }
2735
2736         if (!has_variable) {
2737                 ast_log(LOG_ERROR, "ARI ChannelVarset missing required field variable\n");
2738                 res = 0;
2739         }
2740
2741         return res;
2742 }
2743
2744 ari_validator ast_ari_validate_channel_varset_fn(void)
2745 {
2746         return ast_ari_validate_channel_varset;
2747 }
2748
2749 int ast_ari_validate_endpoint_state_change(struct ast_json *json)
2750 {
2751         int res = 1;
2752         struct ast_json_iter *iter;
2753         int has_type = 0;
2754         int has_application = 0;
2755         int has_endpoint = 0;
2756
2757         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2758                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2759                         int prop_is_valid;
2760                         has_type = 1;
2761                         prop_is_valid = ast_ari_validate_string(
2762                                 ast_json_object_iter_value(iter));
2763                         if (!prop_is_valid) {
2764                                 ast_log(LOG_ERROR, "ARI EndpointStateChange field type failed validation\n");
2765                                 res = 0;
2766                         }
2767                 } else
2768                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2769                         int prop_is_valid;
2770                         has_application = 1;
2771                         prop_is_valid = ast_ari_validate_string(
2772                                 ast_json_object_iter_value(iter));
2773                         if (!prop_is_valid) {
2774                                 ast_log(LOG_ERROR, "ARI EndpointStateChange field application failed validation\n");
2775                                 res = 0;
2776                         }
2777                 } else
2778                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2779                         int prop_is_valid;
2780                         prop_is_valid = ast_ari_validate_date(
2781                                 ast_json_object_iter_value(iter));
2782                         if (!prop_is_valid) {
2783                                 ast_log(LOG_ERROR, "ARI EndpointStateChange field timestamp failed validation\n");
2784                                 res = 0;
2785                         }
2786                 } else
2787                 if (strcmp("endpoint", ast_json_object_iter_key(iter)) == 0) {
2788                         int prop_is_valid;
2789                         has_endpoint = 1;
2790                         prop_is_valid = ast_ari_validate_endpoint(
2791                                 ast_json_object_iter_value(iter));
2792                         if (!prop_is_valid) {
2793                                 ast_log(LOG_ERROR, "ARI EndpointStateChange field endpoint failed validation\n");
2794                                 res = 0;
2795                         }
2796                 } else
2797                 {
2798                         ast_log(LOG_ERROR,
2799                                 "ARI EndpointStateChange has undocumented field %s\n",
2800                                 ast_json_object_iter_key(iter));
2801                         res = 0;
2802                 }
2803         }
2804
2805         if (!has_type) {
2806                 ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field type\n");
2807                 res = 0;
2808         }
2809
2810         if (!has_application) {
2811                 ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field application\n");
2812                 res = 0;
2813         }
2814
2815         if (!has_endpoint) {
2816                 ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field endpoint\n");
2817                 res = 0;
2818         }
2819
2820         return res;
2821 }
2822
2823 ari_validator ast_ari_validate_endpoint_state_change_fn(void)
2824 {
2825         return ast_ari_validate_endpoint_state_change;
2826 }
2827
2828 int ast_ari_validate_event(struct ast_json *json)
2829 {
2830         int res = 1;
2831         struct ast_json_iter *iter;
2832         int has_type = 0;
2833         int has_application = 0;
2834         const char *discriminator;
2835
2836         discriminator = ast_json_string_get(ast_json_object_get(json, "type"));
2837         if (!discriminator) {
2838                 ast_log(LOG_ERROR, "ARI Event missing required field type");
2839                 return 0;
2840         }
2841
2842         if (strcmp("Event", discriminator) == 0) {
2843                 /* Self type; fall through */
2844         } else
2845         if (strcmp("ApplicationReplaced", discriminator) == 0) {
2846                 return ast_ari_validate_application_replaced(json);
2847         } else
2848         if (strcmp("BridgeCreated", discriminator) == 0) {
2849                 return ast_ari_validate_bridge_created(json);
2850         } else
2851         if (strcmp("BridgeDestroyed", discriminator) == 0) {
2852                 return ast_ari_validate_bridge_destroyed(json);
2853         } else
2854         if (strcmp("BridgeMerged", discriminator) == 0) {
2855                 return ast_ari_validate_bridge_merged(json);
2856         } else
2857         if (strcmp("ChannelCallerId", discriminator) == 0) {
2858                 return ast_ari_validate_channel_caller_id(json);
2859         } else
2860         if (strcmp("ChannelCreated", discriminator) == 0) {
2861                 return ast_ari_validate_channel_created(json);
2862         } else
2863         if (strcmp("ChannelDestroyed", discriminator) == 0) {
2864                 return ast_ari_validate_channel_destroyed(json);
2865         } else
2866         if (strcmp("ChannelDialplan", discriminator) == 0) {
2867                 return ast_ari_validate_channel_dialplan(json);
2868         } else
2869         if (strcmp("ChannelDtmfReceived", discriminator) == 0) {
2870                 return ast_ari_validate_channel_dtmf_received(json);
2871         } else
2872         if (strcmp("ChannelEnteredBridge", discriminator) == 0) {
2873                 return ast_ari_validate_channel_entered_bridge(json);
2874         } else
2875         if (strcmp("ChannelHangupRequest", discriminator) == 0) {
2876                 return ast_ari_validate_channel_hangup_request(json);
2877         } else
2878         if (strcmp("ChannelLeftBridge", discriminator) == 0) {
2879                 return ast_ari_validate_channel_left_bridge(json);
2880         } else
2881         if (strcmp("ChannelStateChange", discriminator) == 0) {
2882                 return ast_ari_validate_channel_state_change(json);
2883         } else
2884         if (strcmp("ChannelUserevent", discriminator) == 0) {
2885                 return ast_ari_validate_channel_userevent(json);
2886         } else
2887         if (strcmp("ChannelVarset", discriminator) == 0) {
2888                 return ast_ari_validate_channel_varset(json);
2889         } else
2890         if (strcmp("EndpointStateChange", discriminator) == 0) {
2891                 return ast_ari_validate_endpoint_state_change(json);
2892         } else
2893         if (strcmp("PlaybackFinished", discriminator) == 0) {
2894                 return ast_ari_validate_playback_finished(json);
2895         } else
2896         if (strcmp("PlaybackStarted", discriminator) == 0) {
2897                 return ast_ari_validate_playback_started(json);
2898         } else
2899         if (strcmp("StasisEnd", discriminator) == 0) {
2900                 return ast_ari_validate_stasis_end(json);
2901         } else
2902         if (strcmp("StasisStart", discriminator) == 0) {
2903                 return ast_ari_validate_stasis_start(json);
2904         } else
2905         {
2906                 ast_log(LOG_ERROR, "ARI Event has undocumented subtype %s\n",
2907                         discriminator);
2908                 res = 0;
2909         }
2910
2911         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2912                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2913                         int prop_is_valid;
2914                         has_type = 1;
2915                         prop_is_valid = ast_ari_validate_string(
2916                                 ast_json_object_iter_value(iter));
2917                         if (!prop_is_valid) {
2918                                 ast_log(LOG_ERROR, "ARI Event field type failed validation\n");
2919                                 res = 0;
2920                         }
2921                 } else
2922                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2923                         int prop_is_valid;
2924                         has_application = 1;
2925                         prop_is_valid = ast_ari_validate_string(
2926                                 ast_json_object_iter_value(iter));
2927                         if (!prop_is_valid) {
2928                                 ast_log(LOG_ERROR, "ARI Event field application failed validation\n");
2929                                 res = 0;
2930                         }
2931                 } else
2932                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2933                         int prop_is_valid;
2934                         prop_is_valid = ast_ari_validate_date(
2935                                 ast_json_object_iter_value(iter));
2936                         if (!prop_is_valid) {
2937                                 ast_log(LOG_ERROR, "ARI Event field timestamp failed validation\n");
2938                                 res = 0;
2939                         }
2940                 } else
2941                 {
2942                         ast_log(LOG_ERROR,
2943                                 "ARI Event has undocumented field %s\n",
2944                                 ast_json_object_iter_key(iter));
2945                         res = 0;
2946                 }
2947         }
2948
2949         if (!has_type) {
2950                 ast_log(LOG_ERROR, "ARI Event missing required field type\n");
2951                 res = 0;
2952         }
2953
2954         if (!has_application) {
2955                 ast_log(LOG_ERROR, "ARI Event missing required field application\n");
2956                 res = 0;
2957         }
2958
2959         return res;
2960 }
2961
2962 ari_validator ast_ari_validate_event_fn(void)
2963 {
2964         return ast_ari_validate_event;
2965 }
2966
2967 int ast_ari_validate_message(struct ast_json *json)
2968 {
2969         int res = 1;
2970         struct ast_json_iter *iter;
2971         int has_type = 0;
2972         const char *discriminator;
2973
2974         discriminator = ast_json_string_get(ast_json_object_get(json, "type"));
2975         if (!discriminator) {
2976                 ast_log(LOG_ERROR, "ARI Message missing required field type");
2977                 return 0;
2978         }
2979
2980         if (strcmp("Message", discriminator) == 0) {
2981                 /* Self type; fall through */
2982         } else
2983         if (strcmp("ApplicationReplaced", discriminator) == 0) {
2984                 return ast_ari_validate_application_replaced(json);
2985         } else
2986         if (strcmp("BridgeCreated", discriminator) == 0) {
2987                 return ast_ari_validate_bridge_created(json);
2988         } else
2989         if (strcmp("BridgeDestroyed", discriminator) == 0) {
2990                 return ast_ari_validate_bridge_destroyed(json);
2991         } else
2992         if (strcmp("BridgeMerged", discriminator) == 0) {
2993                 return ast_ari_validate_bridge_merged(json);
2994         } else
2995         if (strcmp("ChannelCallerId", discriminator) == 0) {
2996                 return ast_ari_validate_channel_caller_id(json);
2997         } else
2998         if (strcmp("ChannelCreated", discriminator) == 0) {
2999                 return ast_ari_validate_channel_created(json);
3000         } else
3001         if (strcmp("ChannelDestroyed", discriminator) == 0) {
3002                 return ast_ari_validate_channel_destroyed(json);
3003         } else
3004         if (strcmp("ChannelDialplan", discriminator) == 0) {
3005                 return ast_ari_validate_channel_dialplan(json);
3006         } else
3007         if (strcmp("ChannelDtmfReceived", discriminator) == 0) {
3008                 return ast_ari_validate_channel_dtmf_received(json);
3009         } else
3010         if (strcmp("ChannelEnteredBridge", discriminator) == 0) {
3011                 return ast_ari_validate_channel_entered_bridge(json);
3012         } else
3013         if (strcmp("ChannelHangupRequest", discriminator) == 0) {
3014                 return ast_ari_validate_channel_hangup_request(json);
3015         } else
3016         if (strcmp("ChannelLeftBridge", discriminator) == 0) {
3017                 return ast_ari_validate_channel_left_bridge(json);
3018         } else
3019         if (strcmp("ChannelStateChange", discriminator) == 0) {
3020                 return ast_ari_validate_channel_state_change(json);
3021         } else
3022         if (strcmp("ChannelUserevent", discriminator) == 0) {
3023                 return ast_ari_validate_channel_userevent(json);
3024         } else
3025         if (strcmp("ChannelVarset", discriminator) == 0) {
3026                 return ast_ari_validate_channel_varset(json);
3027         } else
3028         if (strcmp("EndpointStateChange", discriminator) == 0) {
3029                 return ast_ari_validate_endpoint_state_change(json);
3030         } else
3031         if (strcmp("Event", discriminator) == 0) {
3032                 return ast_ari_validate_event(json);
3033         } else
3034         if (strcmp("MissingParams", discriminator) == 0) {
3035                 return ast_ari_validate_missing_params(json);
3036         } else
3037         if (strcmp("PlaybackFinished", discriminator) == 0) {
3038                 return ast_ari_validate_playback_finished(json);
3039         } else
3040         if (strcmp("PlaybackStarted", discriminator) == 0) {
3041                 return ast_ari_validate_playback_started(json);
3042         } else
3043         if (strcmp("StasisEnd", discriminator) == 0) {
3044                 return ast_ari_validate_stasis_end(json);
3045         } else
3046         if (strcmp("StasisStart", discriminator) == 0) {
3047                 return ast_ari_validate_stasis_start(json);
3048         } else
3049         {
3050                 ast_log(LOG_ERROR, "ARI Message has undocumented subtype %s\n",
3051                         discriminator);
3052                 res = 0;
3053         }
3054
3055         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3056                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3057                         int prop_is_valid;
3058                         has_type = 1;
3059                         prop_is_valid = ast_ari_validate_string(
3060                                 ast_json_object_iter_value(iter));
3061                         if (!prop_is_valid) {
3062                                 ast_log(LOG_ERROR, "ARI Message field type failed validation\n");
3063                                 res = 0;
3064                         }
3065                 } else
3066                 {
3067                         ast_log(LOG_ERROR,
3068                                 "ARI Message has undocumented field %s\n",
3069                                 ast_json_object_iter_key(iter));
3070                         res = 0;
3071                 }
3072         }
3073
3074         if (!has_type) {
3075                 ast_log(LOG_ERROR, "ARI Message missing required field type\n");
3076                 res = 0;
3077         }
3078
3079         return res;
3080 }
3081
3082 ari_validator ast_ari_validate_message_fn(void)
3083 {
3084         return ast_ari_validate_message;
3085 }
3086
3087 int ast_ari_validate_missing_params(struct ast_json *json)
3088 {
3089         int res = 1;
3090         struct ast_json_iter *iter;
3091         int has_type = 0;
3092         int has_params = 0;
3093
3094         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3095                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3096                         int prop_is_valid;
3097                         has_type = 1;
3098                         prop_is_valid = ast_ari_validate_string(
3099                                 ast_json_object_iter_value(iter));
3100                         if (!prop_is_valid) {
3101                                 ast_log(LOG_ERROR, "ARI MissingParams field type failed validation\n");
3102                                 res = 0;
3103                         }
3104                 } else
3105                 if (strcmp("params", ast_json_object_iter_key(iter)) == 0) {
3106                         int prop_is_valid;
3107                         has_params = 1;
3108                         prop_is_valid = ast_ari_validate_list(
3109                                 ast_json_object_iter_value(iter),
3110                                 ast_ari_validate_string);
3111                         if (!prop_is_valid) {
3112                                 ast_log(LOG_ERROR, "ARI MissingParams field params failed validation\n");
3113                                 res = 0;
3114                         }
3115                 } else
3116                 {
3117                         ast_log(LOG_ERROR,
3118                                 "ARI MissingParams has undocumented field %s\n",
3119                                 ast_json_object_iter_key(iter));
3120                         res = 0;
3121                 }
3122         }
3123
3124         if (!has_type) {
3125                 ast_log(LOG_ERROR, "ARI MissingParams missing required field type\n");
3126                 res = 0;
3127         }
3128
3129         if (!has_params) {
3130                 ast_log(LOG_ERROR, "ARI MissingParams missing required field params\n");
3131                 res = 0;
3132         }
3133
3134         return res;
3135 }
3136
3137 ari_validator ast_ari_validate_missing_params_fn(void)
3138 {
3139         return ast_ari_validate_missing_params;
3140 }
3141
3142 int ast_ari_validate_playback_finished(struct ast_json *json)
3143 {
3144         int res = 1;
3145         struct ast_json_iter *iter;
3146         int has_type = 0;
3147         int has_application = 0;
3148         int has_playback = 0;
3149
3150         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3151                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3152                         int prop_is_valid;
3153                         has_type = 1;
3154                         prop_is_valid = ast_ari_validate_string(
3155                                 ast_json_object_iter_value(iter));
3156                         if (!prop_is_valid) {
3157                                 ast_log(LOG_ERROR, "ARI PlaybackFinished field type failed validation\n");
3158                                 res = 0;
3159                         }
3160                 } else
3161                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3162                         int prop_is_valid;
3163                         has_application = 1;
3164                         prop_is_valid = ast_ari_validate_string(
3165                                 ast_json_object_iter_value(iter));
3166                         if (!prop_is_valid) {
3167                                 ast_log(LOG_ERROR, "ARI PlaybackFinished field application failed validation\n");
3168                                 res = 0;
3169                         }
3170                 } else
3171                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3172                         int prop_is_valid;
3173                         prop_is_valid = ast_ari_validate_date(
3174                                 ast_json_object_iter_value(iter));
3175                         if (!prop_is_valid) {
3176                                 ast_log(LOG_ERROR, "ARI PlaybackFinished field timestamp failed validation\n");
3177                                 res = 0;
3178                         }
3179                 } else
3180                 if (strcmp("playback", ast_json_object_iter_key(iter)) == 0) {
3181                         int prop_is_valid;
3182                         has_playback = 1;
3183                         prop_is_valid = ast_ari_validate_playback(
3184                                 ast_json_object_iter_value(iter));
3185                         if (!prop_is_valid) {
3186                                 ast_log(LOG_ERROR, "ARI PlaybackFinished field playback failed validation\n");
3187                                 res = 0;
3188                         }
3189                 } else
3190                 {
3191                         ast_log(LOG_ERROR,
3192                                 "ARI PlaybackFinished has undocumented field %s\n",
3193                                 ast_json_object_iter_key(iter));
3194                         res = 0;
3195                 }
3196         }
3197
3198         if (!has_type) {
3199                 ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field type\n");
3200                 res = 0;
3201         }
3202
3203         if (!has_application) {
3204                 ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field application\n");
3205                 res = 0;
3206         }
3207
3208         if (!has_playback) {
3209                 ast_log(LOG_ERROR, "ARI PlaybackFinished missing required field playback\n");
3210                 res = 0;
3211         }
3212
3213         return res;
3214 }
3215
3216 ari_validator ast_ari_validate_playback_finished_fn(void)
3217 {