ARI recordings: Issue HTTP failures for recording requests with file conflicts
[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("format", ast_json_object_iter_key(iter)) == 0) {
1000                         int prop_is_valid;
1001                         has_format = 1;
1002                         prop_is_valid = ast_ari_validate_string(
1003                                 ast_json_object_iter_value(iter));
1004                         if (!prop_is_valid) {
1005                                 ast_log(LOG_ERROR, "ARI LiveRecording field format failed validation\n");
1006                                 res = 0;
1007                         }
1008                 } else
1009                 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1010                         int prop_is_valid;
1011                         has_name = 1;
1012                         prop_is_valid = ast_ari_validate_string(
1013                                 ast_json_object_iter_value(iter));
1014                         if (!prop_is_valid) {
1015                                 ast_log(LOG_ERROR, "ARI LiveRecording field name failed validation\n");
1016                                 res = 0;
1017                         }
1018                 } else
1019                 if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
1020                         int prop_is_valid;
1021                         has_state = 1;
1022                         prop_is_valid = ast_ari_validate_string(
1023                                 ast_json_object_iter_value(iter));
1024                         if (!prop_is_valid) {
1025                                 ast_log(LOG_ERROR, "ARI LiveRecording field state failed validation\n");
1026                                 res = 0;
1027                         }
1028                 } else
1029                 {
1030                         ast_log(LOG_ERROR,
1031                                 "ARI LiveRecording has undocumented field %s\n",
1032                                 ast_json_object_iter_key(iter));
1033                         res = 0;
1034                 }
1035         }
1036
1037         if (!has_format) {
1038                 ast_log(LOG_ERROR, "ARI LiveRecording missing required field format\n");
1039                 res = 0;
1040         }
1041
1042         if (!has_name) {
1043                 ast_log(LOG_ERROR, "ARI LiveRecording missing required field name\n");
1044                 res = 0;
1045         }
1046
1047         if (!has_state) {
1048                 ast_log(LOG_ERROR, "ARI LiveRecording missing required field state\n");
1049                 res = 0;
1050         }
1051
1052         return res;
1053 }
1054
1055 ari_validator ast_ari_validate_live_recording_fn(void)
1056 {
1057         return ast_ari_validate_live_recording;
1058 }
1059
1060 int ast_ari_validate_stored_recording(struct ast_json *json)
1061 {
1062         int res = 1;
1063         struct ast_json_iter *iter;
1064         int has_format = 0;
1065         int has_name = 0;
1066
1067         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1068                 if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
1069                         int prop_is_valid;
1070                         has_format = 1;
1071                         prop_is_valid = ast_ari_validate_string(
1072                                 ast_json_object_iter_value(iter));
1073                         if (!prop_is_valid) {
1074                                 ast_log(LOG_ERROR, "ARI StoredRecording field format failed validation\n");
1075                                 res = 0;
1076                         }
1077                 } else
1078                 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1079                         int prop_is_valid;
1080                         has_name = 1;
1081                         prop_is_valid = ast_ari_validate_string(
1082                                 ast_json_object_iter_value(iter));
1083                         if (!prop_is_valid) {
1084                                 ast_log(LOG_ERROR, "ARI StoredRecording field name failed validation\n");
1085                                 res = 0;
1086                         }
1087                 } else
1088                 {
1089                         ast_log(LOG_ERROR,
1090                                 "ARI StoredRecording has undocumented field %s\n",
1091                                 ast_json_object_iter_key(iter));
1092                         res = 0;
1093                 }
1094         }
1095
1096         if (!has_format) {
1097                 ast_log(LOG_ERROR, "ARI StoredRecording missing required field format\n");
1098                 res = 0;
1099         }
1100
1101         if (!has_name) {
1102                 ast_log(LOG_ERROR, "ARI StoredRecording missing required field name\n");
1103                 res = 0;
1104         }
1105
1106         return res;
1107 }
1108
1109 ari_validator ast_ari_validate_stored_recording_fn(void)
1110 {
1111         return ast_ari_validate_stored_recording;
1112 }
1113
1114 int ast_ari_validate_format_lang_pair(struct ast_json *json)
1115 {
1116         int res = 1;
1117         struct ast_json_iter *iter;
1118         int has_format = 0;
1119         int has_language = 0;
1120
1121         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1122                 if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
1123                         int prop_is_valid;
1124                         has_format = 1;
1125                         prop_is_valid = ast_ari_validate_string(
1126                                 ast_json_object_iter_value(iter));
1127                         if (!prop_is_valid) {
1128                                 ast_log(LOG_ERROR, "ARI FormatLangPair field format failed validation\n");
1129                                 res = 0;
1130                         }
1131                 } else
1132                 if (strcmp("language", ast_json_object_iter_key(iter)) == 0) {
1133                         int prop_is_valid;
1134                         has_language = 1;
1135                         prop_is_valid = ast_ari_validate_string(
1136                                 ast_json_object_iter_value(iter));
1137                         if (!prop_is_valid) {
1138                                 ast_log(LOG_ERROR, "ARI FormatLangPair field language failed validation\n");
1139                                 res = 0;
1140                         }
1141                 } else
1142                 {
1143                         ast_log(LOG_ERROR,
1144                                 "ARI FormatLangPair has undocumented field %s\n",
1145                                 ast_json_object_iter_key(iter));
1146                         res = 0;
1147                 }
1148         }
1149
1150         if (!has_format) {
1151                 ast_log(LOG_ERROR, "ARI FormatLangPair missing required field format\n");
1152                 res = 0;
1153         }
1154
1155         if (!has_language) {
1156                 ast_log(LOG_ERROR, "ARI FormatLangPair missing required field language\n");
1157                 res = 0;
1158         }
1159
1160         return res;
1161 }
1162
1163 ari_validator ast_ari_validate_format_lang_pair_fn(void)
1164 {
1165         return ast_ari_validate_format_lang_pair;
1166 }
1167
1168 int ast_ari_validate_sound(struct ast_json *json)
1169 {
1170         int res = 1;
1171         struct ast_json_iter *iter;
1172         int has_formats = 0;
1173         int has_id = 0;
1174
1175         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1176                 if (strcmp("formats", ast_json_object_iter_key(iter)) == 0) {
1177                         int prop_is_valid;
1178                         has_formats = 1;
1179                         prop_is_valid = ast_ari_validate_list(
1180                                 ast_json_object_iter_value(iter),
1181                                 ast_ari_validate_format_lang_pair);
1182                         if (!prop_is_valid) {
1183                                 ast_log(LOG_ERROR, "ARI Sound field formats failed validation\n");
1184                                 res = 0;
1185                         }
1186                 } else
1187                 if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
1188                         int prop_is_valid;
1189                         has_id = 1;
1190                         prop_is_valid = ast_ari_validate_string(
1191                                 ast_json_object_iter_value(iter));
1192                         if (!prop_is_valid) {
1193                                 ast_log(LOG_ERROR, "ARI Sound field id failed validation\n");
1194                                 res = 0;
1195                         }
1196                 } else
1197                 if (strcmp("text", ast_json_object_iter_key(iter)) == 0) {
1198                         int prop_is_valid;
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 text failed validation\n");
1203                                 res = 0;
1204                         }
1205                 } else
1206                 {
1207                         ast_log(LOG_ERROR,
1208                                 "ARI Sound has undocumented field %s\n",
1209                                 ast_json_object_iter_key(iter));
1210                         res = 0;
1211                 }
1212         }
1213
1214         if (!has_formats) {
1215                 ast_log(LOG_ERROR, "ARI Sound missing required field formats\n");
1216                 res = 0;
1217         }
1218
1219         if (!has_id) {
1220                 ast_log(LOG_ERROR, "ARI Sound missing required field id\n");
1221                 res = 0;
1222         }
1223
1224         return res;
1225 }
1226
1227 ari_validator ast_ari_validate_sound_fn(void)
1228 {
1229         return ast_ari_validate_sound;
1230 }
1231
1232 int ast_ari_validate_playback(struct ast_json *json)
1233 {
1234         int res = 1;
1235         struct ast_json_iter *iter;
1236         int has_id = 0;
1237         int has_media_uri = 0;
1238         int has_state = 0;
1239         int has_target_uri = 0;
1240
1241         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1242                 if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
1243                         int prop_is_valid;
1244                         has_id = 1;
1245                         prop_is_valid = ast_ari_validate_string(
1246                                 ast_json_object_iter_value(iter));
1247                         if (!prop_is_valid) {
1248                                 ast_log(LOG_ERROR, "ARI Playback field id failed validation\n");
1249                                 res = 0;
1250                         }
1251                 } else
1252                 if (strcmp("language", ast_json_object_iter_key(iter)) == 0) {
1253                         int prop_is_valid;
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 language failed validation\n");
1258                                 res = 0;
1259                         }
1260                 } else
1261                 if (strcmp("media_uri", ast_json_object_iter_key(iter)) == 0) {
1262                         int prop_is_valid;
1263                         has_media_uri = 1;
1264                         prop_is_valid = ast_ari_validate_string(
1265                                 ast_json_object_iter_value(iter));
1266                         if (!prop_is_valid) {
1267                                 ast_log(LOG_ERROR, "ARI Playback field media_uri failed validation\n");
1268                                 res = 0;
1269                         }
1270                 } else
1271                 if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
1272                         int prop_is_valid;
1273                         has_state = 1;
1274                         prop_is_valid = ast_ari_validate_string(
1275                                 ast_json_object_iter_value(iter));
1276                         if (!prop_is_valid) {
1277                                 ast_log(LOG_ERROR, "ARI Playback field state failed validation\n");
1278                                 res = 0;
1279                         }
1280                 } else
1281                 if (strcmp("target_uri", ast_json_object_iter_key(iter)) == 0) {
1282                         int prop_is_valid;
1283                         has_target_uri = 1;
1284                         prop_is_valid = ast_ari_validate_string(
1285                                 ast_json_object_iter_value(iter));
1286                         if (!prop_is_valid) {
1287                                 ast_log(LOG_ERROR, "ARI Playback field target_uri failed validation\n");
1288                                 res = 0;
1289                         }
1290                 } else
1291                 {
1292                         ast_log(LOG_ERROR,
1293                                 "ARI Playback has undocumented field %s\n",
1294                                 ast_json_object_iter_key(iter));
1295                         res = 0;
1296                 }
1297         }
1298
1299         if (!has_id) {
1300                 ast_log(LOG_ERROR, "ARI Playback missing required field id\n");
1301                 res = 0;
1302         }
1303
1304         if (!has_media_uri) {
1305                 ast_log(LOG_ERROR, "ARI Playback missing required field media_uri\n");
1306                 res = 0;
1307         }
1308
1309         if (!has_state) {
1310                 ast_log(LOG_ERROR, "ARI Playback missing required field state\n");
1311                 res = 0;
1312         }
1313
1314         if (!has_target_uri) {
1315                 ast_log(LOG_ERROR, "ARI Playback missing required field target_uri\n");
1316                 res = 0;
1317         }
1318
1319         return res;
1320 }
1321
1322 ari_validator ast_ari_validate_playback_fn(void)
1323 {
1324         return ast_ari_validate_playback;
1325 }
1326
1327 int ast_ari_validate_application_replaced(struct ast_json *json)
1328 {
1329         int res = 1;
1330         struct ast_json_iter *iter;
1331         int has_type = 0;
1332         int has_application = 0;
1333
1334         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1335                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1336                         int prop_is_valid;
1337                         has_type = 1;
1338                         prop_is_valid = ast_ari_validate_string(
1339                                 ast_json_object_iter_value(iter));
1340                         if (!prop_is_valid) {
1341                                 ast_log(LOG_ERROR, "ARI ApplicationReplaced field type failed validation\n");
1342                                 res = 0;
1343                         }
1344                 } else
1345                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1346                         int prop_is_valid;
1347                         has_application = 1;
1348                         prop_is_valid = ast_ari_validate_string(
1349                                 ast_json_object_iter_value(iter));
1350                         if (!prop_is_valid) {
1351                                 ast_log(LOG_ERROR, "ARI ApplicationReplaced field application failed validation\n");
1352                                 res = 0;
1353                         }
1354                 } else
1355                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1356                         int prop_is_valid;
1357                         prop_is_valid = ast_ari_validate_date(
1358                                 ast_json_object_iter_value(iter));
1359                         if (!prop_is_valid) {
1360                                 ast_log(LOG_ERROR, "ARI ApplicationReplaced field timestamp failed validation\n");
1361                                 res = 0;
1362                         }
1363                 } else
1364                 {
1365                         ast_log(LOG_ERROR,
1366                                 "ARI ApplicationReplaced has undocumented field %s\n",
1367                                 ast_json_object_iter_key(iter));
1368                         res = 0;
1369                 }
1370         }
1371
1372         if (!has_type) {
1373                 ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field type\n");
1374                 res = 0;
1375         }
1376
1377         if (!has_application) {
1378                 ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field application\n");
1379                 res = 0;
1380         }
1381
1382         return res;
1383 }
1384
1385 ari_validator ast_ari_validate_application_replaced_fn(void)
1386 {
1387         return ast_ari_validate_application_replaced;
1388 }
1389
1390 int ast_ari_validate_bridge_created(struct ast_json *json)
1391 {
1392         int res = 1;
1393         struct ast_json_iter *iter;
1394         int has_type = 0;
1395         int has_application = 0;
1396         int has_bridge = 0;
1397
1398         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1399                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1400                         int prop_is_valid;
1401                         has_type = 1;
1402                         prop_is_valid = ast_ari_validate_string(
1403                                 ast_json_object_iter_value(iter));
1404                         if (!prop_is_valid) {
1405                                 ast_log(LOG_ERROR, "ARI BridgeCreated field type failed validation\n");
1406                                 res = 0;
1407                         }
1408                 } else
1409                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1410                         int prop_is_valid;
1411                         has_application = 1;
1412                         prop_is_valid = ast_ari_validate_string(
1413                                 ast_json_object_iter_value(iter));
1414                         if (!prop_is_valid) {
1415                                 ast_log(LOG_ERROR, "ARI BridgeCreated field application failed validation\n");
1416                                 res = 0;
1417                         }
1418                 } else
1419                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1420                         int prop_is_valid;
1421                         prop_is_valid = ast_ari_validate_date(
1422                                 ast_json_object_iter_value(iter));
1423                         if (!prop_is_valid) {
1424                                 ast_log(LOG_ERROR, "ARI BridgeCreated field timestamp failed validation\n");
1425                                 res = 0;
1426                         }
1427                 } else
1428                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
1429                         int prop_is_valid;
1430                         has_bridge = 1;
1431                         prop_is_valid = ast_ari_validate_bridge(
1432                                 ast_json_object_iter_value(iter));
1433                         if (!prop_is_valid) {
1434                                 ast_log(LOG_ERROR, "ARI BridgeCreated field bridge failed validation\n");
1435                                 res = 0;
1436                         }
1437                 } else
1438                 {
1439                         ast_log(LOG_ERROR,
1440                                 "ARI BridgeCreated has undocumented field %s\n",
1441                                 ast_json_object_iter_key(iter));
1442                         res = 0;
1443                 }
1444         }
1445
1446         if (!has_type) {
1447                 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field type\n");
1448                 res = 0;
1449         }
1450
1451         if (!has_application) {
1452                 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field application\n");
1453                 res = 0;
1454         }
1455
1456         if (!has_bridge) {
1457                 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field bridge\n");
1458                 res = 0;
1459         }
1460
1461         return res;
1462 }
1463
1464 ari_validator ast_ari_validate_bridge_created_fn(void)
1465 {
1466         return ast_ari_validate_bridge_created;
1467 }
1468
1469 int ast_ari_validate_bridge_destroyed(struct ast_json *json)
1470 {
1471         int res = 1;
1472         struct ast_json_iter *iter;
1473         int has_type = 0;
1474         int has_application = 0;
1475         int has_bridge = 0;
1476
1477         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1478                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1479                         int prop_is_valid;
1480                         has_type = 1;
1481                         prop_is_valid = ast_ari_validate_string(
1482                                 ast_json_object_iter_value(iter));
1483                         if (!prop_is_valid) {
1484                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field type failed validation\n");
1485                                 res = 0;
1486                         }
1487                 } else
1488                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1489                         int prop_is_valid;
1490                         has_application = 1;
1491                         prop_is_valid = ast_ari_validate_string(
1492                                 ast_json_object_iter_value(iter));
1493                         if (!prop_is_valid) {
1494                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field application failed validation\n");
1495                                 res = 0;
1496                         }
1497                 } else
1498                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1499                         int prop_is_valid;
1500                         prop_is_valid = ast_ari_validate_date(
1501                                 ast_json_object_iter_value(iter));
1502                         if (!prop_is_valid) {
1503                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field timestamp failed validation\n");
1504                                 res = 0;
1505                         }
1506                 } else
1507                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
1508                         int prop_is_valid;
1509                         has_bridge = 1;
1510                         prop_is_valid = ast_ari_validate_bridge(
1511                                 ast_json_object_iter_value(iter));
1512                         if (!prop_is_valid) {
1513                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field bridge failed validation\n");
1514                                 res = 0;
1515                         }
1516                 } else
1517                 {
1518                         ast_log(LOG_ERROR,
1519                                 "ARI BridgeDestroyed has undocumented field %s\n",
1520                                 ast_json_object_iter_key(iter));
1521                         res = 0;
1522                 }
1523         }
1524
1525         if (!has_type) {
1526                 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field type\n");
1527                 res = 0;
1528         }
1529
1530         if (!has_application) {
1531                 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field application\n");
1532                 res = 0;
1533         }
1534
1535         if (!has_bridge) {
1536                 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field bridge\n");
1537                 res = 0;
1538         }
1539
1540         return res;
1541 }
1542
1543 ari_validator ast_ari_validate_bridge_destroyed_fn(void)
1544 {
1545         return ast_ari_validate_bridge_destroyed;
1546 }
1547
1548 int ast_ari_validate_bridge_merged(struct ast_json *json)
1549 {
1550         int res = 1;
1551         struct ast_json_iter *iter;
1552         int has_type = 0;
1553         int has_application = 0;
1554         int has_bridge = 0;
1555         int has_bridge_from = 0;
1556
1557         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1558                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1559                         int prop_is_valid;
1560                         has_type = 1;
1561                         prop_is_valid = ast_ari_validate_string(
1562                                 ast_json_object_iter_value(iter));
1563                         if (!prop_is_valid) {
1564                                 ast_log(LOG_ERROR, "ARI BridgeMerged field type failed validation\n");
1565                                 res = 0;
1566                         }
1567                 } else
1568                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1569                         int prop_is_valid;
1570                         has_application = 1;
1571                         prop_is_valid = ast_ari_validate_string(
1572                                 ast_json_object_iter_value(iter));
1573                         if (!prop_is_valid) {
1574                                 ast_log(LOG_ERROR, "ARI BridgeMerged field application failed validation\n");
1575                                 res = 0;
1576                         }
1577                 } else
1578                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1579                         int prop_is_valid;
1580                         prop_is_valid = ast_ari_validate_date(
1581                                 ast_json_object_iter_value(iter));
1582                         if (!prop_is_valid) {
1583                                 ast_log(LOG_ERROR, "ARI BridgeMerged field timestamp failed validation\n");
1584                                 res = 0;
1585                         }
1586                 } else
1587                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
1588                         int prop_is_valid;
1589                         has_bridge = 1;
1590                         prop_is_valid = ast_ari_validate_bridge(
1591                                 ast_json_object_iter_value(iter));
1592                         if (!prop_is_valid) {
1593                                 ast_log(LOG_ERROR, "ARI BridgeMerged field bridge failed validation\n");
1594                                 res = 0;
1595                         }
1596                 } else
1597                 if (strcmp("bridge_from", ast_json_object_iter_key(iter)) == 0) {
1598                         int prop_is_valid;
1599                         has_bridge_from = 1;
1600                         prop_is_valid = ast_ari_validate_bridge(
1601                                 ast_json_object_iter_value(iter));
1602                         if (!prop_is_valid) {
1603                                 ast_log(LOG_ERROR, "ARI BridgeMerged field bridge_from failed validation\n");
1604                                 res = 0;
1605                         }
1606                 } else
1607                 {
1608                         ast_log(LOG_ERROR,
1609                                 "ARI BridgeMerged has undocumented field %s\n",
1610                                 ast_json_object_iter_key(iter));
1611                         res = 0;
1612                 }
1613         }
1614
1615         if (!has_type) {
1616                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field type\n");
1617                 res = 0;
1618         }
1619
1620         if (!has_application) {
1621                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field application\n");
1622                 res = 0;
1623         }
1624
1625         if (!has_bridge) {
1626                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge\n");
1627                 res = 0;
1628         }
1629
1630         if (!has_bridge_from) {
1631                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge_from\n");
1632                 res = 0;
1633         }
1634
1635         return res;
1636 }
1637
1638 ari_validator ast_ari_validate_bridge_merged_fn(void)
1639 {
1640         return ast_ari_validate_bridge_merged;
1641 }
1642
1643 int ast_ari_validate_channel_caller_id(struct ast_json *json)
1644 {
1645         int res = 1;
1646         struct ast_json_iter *iter;
1647         int has_type = 0;
1648         int has_application = 0;
1649         int has_caller_presentation = 0;
1650         int has_caller_presentation_txt = 0;
1651         int has_channel = 0;
1652
1653         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1654                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1655                         int prop_is_valid;
1656                         has_type = 1;
1657                         prop_is_valid = ast_ari_validate_string(
1658                                 ast_json_object_iter_value(iter));
1659                         if (!prop_is_valid) {
1660                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field type failed validation\n");
1661                                 res = 0;
1662                         }
1663                 } else
1664                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1665                         int prop_is_valid;
1666                         has_application = 1;
1667                         prop_is_valid = ast_ari_validate_string(
1668                                 ast_json_object_iter_value(iter));
1669                         if (!prop_is_valid) {
1670                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field application failed validation\n");
1671                                 res = 0;
1672                         }
1673                 } else
1674                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1675                         int prop_is_valid;
1676                         prop_is_valid = ast_ari_validate_date(
1677                                 ast_json_object_iter_value(iter));
1678                         if (!prop_is_valid) {
1679                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field timestamp failed validation\n");
1680                                 res = 0;
1681                         }
1682                 } else
1683                 if (strcmp("caller_presentation", ast_json_object_iter_key(iter)) == 0) {
1684                         int prop_is_valid;
1685                         has_caller_presentation = 1;
1686                         prop_is_valid = ast_ari_validate_int(
1687                                 ast_json_object_iter_value(iter));
1688                         if (!prop_is_valid) {
1689                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation failed validation\n");
1690                                 res = 0;
1691                         }
1692                 } else
1693                 if (strcmp("caller_presentation_txt", ast_json_object_iter_key(iter)) == 0) {
1694                         int prop_is_valid;
1695                         has_caller_presentation_txt = 1;
1696                         prop_is_valid = ast_ari_validate_string(
1697                                 ast_json_object_iter_value(iter));
1698                         if (!prop_is_valid) {
1699                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation_txt failed validation\n");
1700                                 res = 0;
1701                         }
1702                 } else
1703                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
1704                         int prop_is_valid;
1705                         has_channel = 1;
1706                         prop_is_valid = ast_ari_validate_channel(
1707                                 ast_json_object_iter_value(iter));
1708                         if (!prop_is_valid) {
1709                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field channel failed validation\n");
1710                                 res = 0;
1711                         }
1712                 } else
1713                 {
1714                         ast_log(LOG_ERROR,
1715                                 "ARI ChannelCallerId has undocumented field %s\n",
1716                                 ast_json_object_iter_key(iter));
1717                         res = 0;
1718                 }
1719         }
1720
1721         if (!has_type) {
1722                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field type\n");
1723                 res = 0;
1724         }
1725
1726         if (!has_application) {
1727                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field application\n");
1728                 res = 0;
1729         }
1730
1731         if (!has_caller_presentation) {
1732                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation\n");
1733                 res = 0;
1734         }
1735
1736         if (!has_caller_presentation_txt) {
1737                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation_txt\n");
1738                 res = 0;
1739         }
1740
1741         if (!has_channel) {
1742                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field channel\n");
1743                 res = 0;
1744         }
1745
1746         return res;
1747 }
1748
1749 ari_validator ast_ari_validate_channel_caller_id_fn(void)
1750 {
1751         return ast_ari_validate_channel_caller_id;
1752 }
1753
1754 int ast_ari_validate_channel_created(struct ast_json *json)
1755 {
1756         int res = 1;
1757         struct ast_json_iter *iter;
1758         int has_type = 0;
1759         int has_application = 0;
1760         int has_channel = 0;
1761
1762         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1763                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1764                         int prop_is_valid;
1765                         has_type = 1;
1766                         prop_is_valid = ast_ari_validate_string(
1767                                 ast_json_object_iter_value(iter));
1768                         if (!prop_is_valid) {
1769                                 ast_log(LOG_ERROR, "ARI ChannelCreated field type failed validation\n");
1770                                 res = 0;
1771                         }
1772                 } else
1773                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1774                         int prop_is_valid;
1775                         has_application = 1;
1776                         prop_is_valid = ast_ari_validate_string(
1777                                 ast_json_object_iter_value(iter));
1778                         if (!prop_is_valid) {
1779                                 ast_log(LOG_ERROR, "ARI ChannelCreated field application failed validation\n");
1780                                 res = 0;
1781                         }
1782                 } else
1783                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1784                         int prop_is_valid;
1785                         prop_is_valid = ast_ari_validate_date(
1786                                 ast_json_object_iter_value(iter));
1787                         if (!prop_is_valid) {
1788                                 ast_log(LOG_ERROR, "ARI ChannelCreated field timestamp failed validation\n");
1789                                 res = 0;
1790                         }
1791                 } else
1792                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
1793                         int prop_is_valid;
1794                         has_channel = 1;
1795                         prop_is_valid = ast_ari_validate_channel(
1796                                 ast_json_object_iter_value(iter));
1797                         if (!prop_is_valid) {
1798                                 ast_log(LOG_ERROR, "ARI ChannelCreated field channel failed validation\n");
1799                                 res = 0;
1800                         }
1801                 } else
1802                 {
1803                         ast_log(LOG_ERROR,
1804                                 "ARI ChannelCreated has undocumented field %s\n",
1805                                 ast_json_object_iter_key(iter));
1806                         res = 0;
1807                 }
1808         }
1809
1810         if (!has_type) {
1811                 ast_log(LOG_ERROR, "ARI ChannelCreated missing required field type\n");
1812                 res = 0;
1813         }
1814
1815         if (!has_application) {
1816                 ast_log(LOG_ERROR, "ARI ChannelCreated missing required field application\n");
1817                 res = 0;
1818         }
1819
1820         if (!has_channel) {
1821                 ast_log(LOG_ERROR, "ARI ChannelCreated missing required field channel\n");
1822                 res = 0;
1823         }
1824
1825         return res;
1826 }
1827
1828 ari_validator ast_ari_validate_channel_created_fn(void)
1829 {
1830         return ast_ari_validate_channel_created;
1831 }
1832
1833 int ast_ari_validate_channel_destroyed(struct ast_json *json)
1834 {
1835         int res = 1;
1836         struct ast_json_iter *iter;
1837         int has_type = 0;
1838         int has_application = 0;
1839         int has_cause = 0;
1840         int has_cause_txt = 0;
1841         int has_channel = 0;
1842
1843         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1844                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1845                         int prop_is_valid;
1846                         has_type = 1;
1847                         prop_is_valid = ast_ari_validate_string(
1848                                 ast_json_object_iter_value(iter));
1849                         if (!prop_is_valid) {
1850                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field type failed validation\n");
1851                                 res = 0;
1852                         }
1853                 } else
1854                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1855                         int prop_is_valid;
1856                         has_application = 1;
1857                         prop_is_valid = ast_ari_validate_string(
1858                                 ast_json_object_iter_value(iter));
1859                         if (!prop_is_valid) {
1860                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field application failed validation\n");
1861                                 res = 0;
1862                         }
1863                 } else
1864                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1865                         int prop_is_valid;
1866                         prop_is_valid = ast_ari_validate_date(
1867                                 ast_json_object_iter_value(iter));
1868                         if (!prop_is_valid) {
1869                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field timestamp failed validation\n");
1870                                 res = 0;
1871                         }
1872                 } else
1873                 if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
1874                         int prop_is_valid;
1875                         has_cause = 1;
1876                         prop_is_valid = ast_ari_validate_int(
1877                                 ast_json_object_iter_value(iter));
1878                         if (!prop_is_valid) {
1879                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field cause failed validation\n");
1880                                 res = 0;
1881                         }
1882                 } else
1883                 if (strcmp("cause_txt", ast_json_object_iter_key(iter)) == 0) {
1884                         int prop_is_valid;
1885                         has_cause_txt = 1;
1886                         prop_is_valid = ast_ari_validate_string(
1887                                 ast_json_object_iter_value(iter));
1888                         if (!prop_is_valid) {
1889                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field cause_txt failed validation\n");
1890                                 res = 0;
1891                         }
1892                 } else
1893                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
1894                         int prop_is_valid;
1895                         has_channel = 1;
1896                         prop_is_valid = ast_ari_validate_channel(
1897                                 ast_json_object_iter_value(iter));
1898                         if (!prop_is_valid) {
1899                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field channel failed validation\n");
1900                                 res = 0;
1901                         }
1902                 } else
1903                 {
1904                         ast_log(LOG_ERROR,
1905                                 "ARI ChannelDestroyed has undocumented field %s\n",
1906                                 ast_json_object_iter_key(iter));
1907                         res = 0;
1908                 }
1909         }
1910
1911         if (!has_type) {
1912                 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field type\n");
1913                 res = 0;
1914         }
1915
1916         if (!has_application) {
1917                 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field application\n");
1918                 res = 0;
1919         }
1920
1921         if (!has_cause) {
1922                 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field cause\n");
1923                 res = 0;
1924         }
1925
1926         if (!has_cause_txt) {
1927                 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field cause_txt\n");
1928                 res = 0;
1929         }
1930
1931         if (!has_channel) {
1932                 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field channel\n");
1933                 res = 0;
1934         }
1935
1936         return res;
1937 }
1938
1939 ari_validator ast_ari_validate_channel_destroyed_fn(void)
1940 {
1941         return ast_ari_validate_channel_destroyed;
1942 }
1943
1944 int ast_ari_validate_channel_dialplan(struct ast_json *json)
1945 {
1946         int res = 1;
1947         struct ast_json_iter *iter;
1948         int has_type = 0;
1949         int has_application = 0;
1950         int has_channel = 0;
1951         int has_dialplan_app = 0;
1952         int has_dialplan_app_data = 0;
1953
1954         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1955                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1956                         int prop_is_valid;
1957                         has_type = 1;
1958                         prop_is_valid = ast_ari_validate_string(
1959                                 ast_json_object_iter_value(iter));
1960                         if (!prop_is_valid) {
1961                                 ast_log(LOG_ERROR, "ARI ChannelDialplan field type failed validation\n");
1962                                 res = 0;
1963                         }
1964                 } else
1965                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1966                         int prop_is_valid;
1967                         has_application = 1;
1968                         prop_is_valid = ast_ari_validate_string(
1969                                 ast_json_object_iter_value(iter));
1970                         if (!prop_is_valid) {
1971                                 ast_log(LOG_ERROR, "ARI ChannelDialplan field application failed validation\n");
1972                                 res = 0;
1973                         }
1974                 } else
1975                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1976                         int prop_is_valid;
1977                         prop_is_valid = ast_ari_validate_date(
1978                                 ast_json_object_iter_value(iter));
1979                         if (!prop_is_valid) {
1980                                 ast_log(LOG_ERROR, "ARI ChannelDialplan field timestamp failed validation\n");
1981                                 res = 0;
1982                         }
1983                 } else
1984                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
1985                         int prop_is_valid;
1986                         has_channel = 1;
1987                         prop_is_valid = ast_ari_validate_channel(
1988                                 ast_json_object_iter_value(iter));
1989                         if (!prop_is_valid) {
1990                                 ast_log(LOG_ERROR, "ARI ChannelDialplan field channel failed validation\n");
1991                                 res = 0;
1992                         }
1993                 } else
1994                 if (strcmp("dialplan_app", ast_json_object_iter_key(iter)) == 0) {
1995                         int prop_is_valid;
1996                         has_dialplan_app = 1;
1997                         prop_is_valid = ast_ari_validate_string(
1998                                 ast_json_object_iter_value(iter));
1999                         if (!prop_is_valid) {
2000                                 ast_log(LOG_ERROR, "ARI ChannelDialplan field dialplan_app failed validation\n");
2001                                 res = 0;
2002                         }
2003                 } else
2004                 if (strcmp("dialplan_app_data", ast_json_object_iter_key(iter)) == 0) {
2005                         int prop_is_valid;
2006                         has_dialplan_app_data = 1;
2007                         prop_is_valid = ast_ari_validate_string(
2008                                 ast_json_object_iter_value(iter));
2009                         if (!prop_is_valid) {
2010                                 ast_log(LOG_ERROR, "ARI ChannelDialplan field dialplan_app_data failed validation\n");
2011                                 res = 0;
2012                         }
2013                 } else
2014                 {
2015                         ast_log(LOG_ERROR,
2016                                 "ARI ChannelDialplan has undocumented field %s\n",
2017                                 ast_json_object_iter_key(iter));
2018                         res = 0;
2019                 }
2020         }
2021
2022         if (!has_type) {
2023                 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field type\n");
2024                 res = 0;
2025         }
2026
2027         if (!has_application) {
2028                 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field application\n");
2029                 res = 0;
2030         }
2031
2032         if (!has_channel) {
2033                 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field channel\n");
2034                 res = 0;
2035         }
2036
2037         if (!has_dialplan_app) {
2038                 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field dialplan_app\n");
2039                 res = 0;
2040         }
2041
2042         if (!has_dialplan_app_data) {
2043                 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field dialplan_app_data\n");
2044                 res = 0;
2045         }
2046
2047         return res;
2048 }
2049
2050 ari_validator ast_ari_validate_channel_dialplan_fn(void)
2051 {
2052         return ast_ari_validate_channel_dialplan;
2053 }
2054
2055 int ast_ari_validate_channel_dtmf_received(struct ast_json *json)
2056 {
2057         int res = 1;
2058         struct ast_json_iter *iter;
2059         int has_type = 0;
2060         int has_application = 0;
2061         int has_channel = 0;
2062         int has_digit = 0;
2063         int has_duration_ms = 0;
2064
2065         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2066                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2067                         int prop_is_valid;
2068                         has_type = 1;
2069                         prop_is_valid = ast_ari_validate_string(
2070                                 ast_json_object_iter_value(iter));
2071                         if (!prop_is_valid) {
2072                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field type failed validation\n");
2073                                 res = 0;
2074                         }
2075                 } else
2076                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2077                         int prop_is_valid;
2078                         has_application = 1;
2079                         prop_is_valid = ast_ari_validate_string(
2080                                 ast_json_object_iter_value(iter));
2081                         if (!prop_is_valid) {
2082                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field application failed validation\n");
2083                                 res = 0;
2084                         }
2085                 } else
2086                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2087                         int prop_is_valid;
2088                         prop_is_valid = ast_ari_validate_date(
2089                                 ast_json_object_iter_value(iter));
2090                         if (!prop_is_valid) {
2091                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field timestamp failed validation\n");
2092                                 res = 0;
2093                         }
2094                 } else
2095                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2096                         int prop_is_valid;
2097                         has_channel = 1;
2098                         prop_is_valid = ast_ari_validate_channel(
2099                                 ast_json_object_iter_value(iter));
2100                         if (!prop_is_valid) {
2101                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field channel failed validation\n");
2102                                 res = 0;
2103                         }
2104                 } else
2105                 if (strcmp("digit", ast_json_object_iter_key(iter)) == 0) {
2106                         int prop_is_valid;
2107                         has_digit = 1;
2108                         prop_is_valid = ast_ari_validate_string(
2109                                 ast_json_object_iter_value(iter));
2110                         if (!prop_is_valid) {
2111                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field digit failed validation\n");
2112                                 res = 0;
2113                         }
2114                 } else
2115                 if (strcmp("duration_ms", ast_json_object_iter_key(iter)) == 0) {
2116                         int prop_is_valid;
2117                         has_duration_ms = 1;
2118                         prop_is_valid = ast_ari_validate_int(
2119                                 ast_json_object_iter_value(iter));
2120                         if (!prop_is_valid) {
2121                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field duration_ms failed validation\n");
2122                                 res = 0;
2123                         }
2124                 } else
2125                 {
2126                         ast_log(LOG_ERROR,
2127                                 "ARI ChannelDtmfReceived has undocumented field %s\n",
2128                                 ast_json_object_iter_key(iter));
2129                         res = 0;
2130                 }
2131         }
2132
2133         if (!has_type) {
2134                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field type\n");
2135                 res = 0;
2136         }
2137
2138         if (!has_application) {
2139                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field application\n");
2140                 res = 0;
2141         }
2142
2143         if (!has_channel) {
2144                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field channel\n");
2145                 res = 0;
2146         }
2147
2148         if (!has_digit) {
2149                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field digit\n");
2150                 res = 0;
2151         }
2152
2153         if (!has_duration_ms) {
2154                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field duration_ms\n");
2155                 res = 0;
2156         }
2157
2158         return res;
2159 }
2160
2161 ari_validator ast_ari_validate_channel_dtmf_received_fn(void)
2162 {
2163         return ast_ari_validate_channel_dtmf_received;
2164 }
2165
2166 int ast_ari_validate_channel_entered_bridge(struct ast_json *json)
2167 {
2168         int res = 1;
2169         struct ast_json_iter *iter;
2170         int has_type = 0;
2171         int has_application = 0;
2172         int has_bridge = 0;
2173
2174         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2175                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2176                         int prop_is_valid;
2177                         has_type = 1;
2178                         prop_is_valid = ast_ari_validate_string(
2179                                 ast_json_object_iter_value(iter));
2180                         if (!prop_is_valid) {
2181                                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field type failed validation\n");
2182                                 res = 0;
2183                         }
2184                 } else
2185                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2186                         int prop_is_valid;
2187                         has_application = 1;
2188                         prop_is_valid = ast_ari_validate_string(
2189                                 ast_json_object_iter_value(iter));
2190                         if (!prop_is_valid) {
2191                                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field application failed validation\n");
2192                                 res = 0;
2193                         }
2194                 } else
2195                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2196                         int prop_is_valid;
2197                         prop_is_valid = ast_ari_validate_date(
2198                                 ast_json_object_iter_value(iter));
2199                         if (!prop_is_valid) {
2200                                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field timestamp failed validation\n");
2201                                 res = 0;
2202                         }
2203                 } else
2204                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2205                         int prop_is_valid;
2206                         has_bridge = 1;
2207                         prop_is_valid = ast_ari_validate_bridge(
2208                                 ast_json_object_iter_value(iter));
2209                         if (!prop_is_valid) {
2210                                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field bridge failed validation\n");
2211                                 res = 0;
2212                         }
2213                 } else
2214                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2215                         int prop_is_valid;
2216                         prop_is_valid = ast_ari_validate_channel(
2217                                 ast_json_object_iter_value(iter));
2218                         if (!prop_is_valid) {
2219                                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field channel failed validation\n");
2220                                 res = 0;
2221                         }
2222                 } else
2223                 {
2224                         ast_log(LOG_ERROR,
2225                                 "ARI ChannelEnteredBridge has undocumented field %s\n",
2226                                 ast_json_object_iter_key(iter));
2227                         res = 0;
2228                 }
2229         }
2230
2231         if (!has_type) {
2232                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field type\n");
2233                 res = 0;
2234         }
2235
2236         if (!has_application) {
2237                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field application\n");
2238                 res = 0;
2239         }
2240
2241         if (!has_bridge) {
2242                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field bridge\n");
2243                 res = 0;
2244         }
2245
2246         return res;
2247 }
2248
2249 ari_validator ast_ari_validate_channel_entered_bridge_fn(void)
2250 {
2251         return ast_ari_validate_channel_entered_bridge;
2252 }
2253
2254 int ast_ari_validate_channel_hangup_request(struct ast_json *json)
2255 {
2256         int res = 1;
2257         struct ast_json_iter *iter;
2258         int has_type = 0;
2259         int has_application = 0;
2260         int has_channel = 0;
2261
2262         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2263                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2264                         int prop_is_valid;
2265                         has_type = 1;
2266                         prop_is_valid = ast_ari_validate_string(
2267                                 ast_json_object_iter_value(iter));
2268                         if (!prop_is_valid) {
2269                                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field type failed validation\n");
2270                                 res = 0;
2271                         }
2272                 } else
2273                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2274                         int prop_is_valid;
2275                         has_application = 1;
2276                         prop_is_valid = ast_ari_validate_string(
2277                                 ast_json_object_iter_value(iter));
2278                         if (!prop_is_valid) {
2279                                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field application failed validation\n");
2280                                 res = 0;
2281                         }
2282                 } else
2283                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2284                         int prop_is_valid;
2285                         prop_is_valid = ast_ari_validate_date(
2286                                 ast_json_object_iter_value(iter));
2287                         if (!prop_is_valid) {
2288                                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field timestamp failed validation\n");
2289                                 res = 0;
2290                         }
2291                 } else
2292                 if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
2293                         int prop_is_valid;
2294                         prop_is_valid = ast_ari_validate_int(
2295                                 ast_json_object_iter_value(iter));
2296                         if (!prop_is_valid) {
2297                                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field cause failed validation\n");
2298                                 res = 0;
2299                         }
2300                 } else
2301                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2302                         int prop_is_valid;
2303                         has_channel = 1;
2304                         prop_is_valid = ast_ari_validate_channel(
2305                                 ast_json_object_iter_value(iter));
2306                         if (!prop_is_valid) {
2307                                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field channel failed validation\n");
2308                                 res = 0;
2309                         }
2310                 } else
2311                 if (strcmp("soft", ast_json_object_iter_key(iter)) == 0) {
2312                         int prop_is_valid;
2313                         prop_is_valid = ast_ari_validate_boolean(
2314                                 ast_json_object_iter_value(iter));
2315                         if (!prop_is_valid) {
2316                                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field soft failed validation\n");
2317                                 res = 0;
2318                         }
2319                 } else
2320                 {
2321                         ast_log(LOG_ERROR,
2322                                 "ARI ChannelHangupRequest has undocumented field %s\n",
2323                                 ast_json_object_iter_key(iter));
2324                         res = 0;
2325                 }
2326         }
2327
2328         if (!has_type) {
2329                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field type\n");
2330                 res = 0;
2331         }
2332
2333         if (!has_application) {
2334                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field application\n");
2335                 res = 0;
2336         }
2337
2338         if (!has_channel) {
2339                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest missing required field channel\n");
2340                 res = 0;
2341         }
2342
2343         return res;
2344 }
2345
2346 ari_validator ast_ari_validate_channel_hangup_request_fn(void)
2347 {
2348         return ast_ari_validate_channel_hangup_request;
2349 }
2350
2351 int ast_ari_validate_channel_left_bridge(struct ast_json *json)
2352 {
2353         int res = 1;
2354         struct ast_json_iter *iter;
2355         int has_type = 0;
2356         int has_application = 0;
2357         int has_bridge = 0;
2358         int has_channel = 0;
2359
2360         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2361                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2362                         int prop_is_valid;
2363                         has_type = 1;
2364                         prop_is_valid = ast_ari_validate_string(
2365                                 ast_json_object_iter_value(iter));
2366                         if (!prop_is_valid) {
2367                                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge field type failed validation\n");
2368                                 res = 0;
2369                         }
2370                 } else
2371                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2372                         int prop_is_valid;
2373                         has_application = 1;
2374                         prop_is_valid = ast_ari_validate_string(
2375                                 ast_json_object_iter_value(iter));
2376                         if (!prop_is_valid) {
2377                                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge field application failed validation\n");
2378                                 res = 0;
2379                         }
2380                 } else
2381                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2382                         int prop_is_valid;
2383                         prop_is_valid = ast_ari_validate_date(
2384                                 ast_json_object_iter_value(iter));
2385                         if (!prop_is_valid) {
2386                                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge field timestamp failed validation\n");
2387                                 res = 0;
2388                         }
2389                 } else
2390                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2391                         int prop_is_valid;
2392                         has_bridge = 1;
2393                         prop_is_valid = ast_ari_validate_bridge(
2394                                 ast_json_object_iter_value(iter));
2395                         if (!prop_is_valid) {
2396                                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge field bridge failed validation\n");
2397                                 res = 0;
2398                         }
2399                 } else
2400                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2401                         int prop_is_valid;
2402                         has_channel = 1;
2403                         prop_is_valid = ast_ari_validate_channel(
2404                                 ast_json_object_iter_value(iter));
2405                         if (!prop_is_valid) {
2406                                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge field channel failed validation\n");
2407                                 res = 0;
2408                         }
2409                 } else
2410                 {
2411                         ast_log(LOG_ERROR,
2412                                 "ARI ChannelLeftBridge has undocumented field %s\n",
2413                                 ast_json_object_iter_key(iter));
2414                         res = 0;
2415                 }
2416         }
2417
2418         if (!has_type) {
2419                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field type\n");
2420                 res = 0;
2421         }
2422
2423         if (!has_application) {
2424                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field application\n");
2425                 res = 0;
2426         }
2427
2428         if (!has_bridge) {
2429                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field bridge\n");
2430                 res = 0;
2431         }
2432
2433         if (!has_channel) {
2434                 ast_log(LOG_ERROR, "ARI ChannelLeftBridge missing required field channel\n");
2435                 res = 0;
2436         }
2437
2438         return res;
2439 }
2440
2441 ari_validator ast_ari_validate_channel_left_bridge_fn(void)
2442 {
2443         return ast_ari_validate_channel_left_bridge;
2444 }
2445
2446 int ast_ari_validate_channel_state_change(struct ast_json *json)
2447 {
2448         int res = 1;
2449         struct ast_json_iter *iter;
2450         int has_type = 0;
2451         int has_application = 0;
2452         int has_channel = 0;
2453
2454         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2455                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2456                         int prop_is_valid;
2457                         has_type = 1;
2458                         prop_is_valid = ast_ari_validate_string(
2459                                 ast_json_object_iter_value(iter));
2460                         if (!prop_is_valid) {
2461                                 ast_log(LOG_ERROR, "ARI ChannelStateChange field type failed validation\n");
2462                                 res = 0;
2463                         }
2464                 } else
2465                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2466                         int prop_is_valid;
2467                         has_application = 1;
2468                         prop_is_valid = ast_ari_validate_string(
2469                                 ast_json_object_iter_value(iter));
2470                         if (!prop_is_valid) {
2471                                 ast_log(LOG_ERROR, "ARI ChannelStateChange field application failed validation\n");
2472                                 res = 0;
2473                         }
2474                 } else
2475                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2476                         int prop_is_valid;
2477                         prop_is_valid = ast_ari_validate_date(
2478                                 ast_json_object_iter_value(iter));
2479                         if (!prop_is_valid) {
2480                                 ast_log(LOG_ERROR, "ARI ChannelStateChange field timestamp failed validation\n");
2481                                 res = 0;
2482                         }
2483                 } else
2484                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2485                         int prop_is_valid;
2486                         has_channel = 1;
2487                         prop_is_valid = ast_ari_validate_channel(
2488                                 ast_json_object_iter_value(iter));
2489                         if (!prop_is_valid) {
2490                                 ast_log(LOG_ERROR, "ARI ChannelStateChange field channel failed validation\n");
2491                                 res = 0;
2492                         }
2493                 } else
2494                 {
2495                         ast_log(LOG_ERROR,
2496                                 "ARI ChannelStateChange has undocumented field %s\n",
2497                                 ast_json_object_iter_key(iter));
2498                         res = 0;
2499                 }
2500         }
2501
2502         if (!has_type) {
2503                 ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field type\n");
2504                 res = 0;
2505         }
2506
2507         if (!has_application) {
2508                 ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field application\n");
2509                 res = 0;
2510         }
2511
2512         if (!has_channel) {
2513                 ast_log(LOG_ERROR, "ARI ChannelStateChange missing required field channel\n");
2514                 res = 0;
2515         }
2516
2517         return res;
2518 }
2519
2520 ari_validator ast_ari_validate_channel_state_change_fn(void)
2521 {
2522         return ast_ari_validate_channel_state_change;
2523 }
2524
2525 int ast_ari_validate_channel_userevent(struct ast_json *json)
2526 {
2527         int res = 1;
2528         struct ast_json_iter *iter;
2529         int has_type = 0;
2530         int has_application = 0;
2531         int has_channel = 0;
2532         int has_eventname = 0;
2533         int has_userevent = 0;
2534
2535         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2536                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2537                         int prop_is_valid;
2538                         has_type = 1;
2539                         prop_is_valid = ast_ari_validate_string(
2540                                 ast_json_object_iter_value(iter));
2541                         if (!prop_is_valid) {
2542                                 ast_log(LOG_ERROR, "ARI ChannelUserevent field type failed validation\n");
2543                                 res = 0;
2544                         }
2545                 } else
2546                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2547                         int prop_is_valid;
2548                         has_application = 1;
2549                         prop_is_valid = ast_ari_validate_string(
2550                                 ast_json_object_iter_value(iter));
2551                         if (!prop_is_valid) {
2552                                 ast_log(LOG_ERROR, "ARI ChannelUserevent field application failed validation\n");
2553                                 res = 0;
2554                         }
2555                 } else
2556                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2557                         int prop_is_valid;
2558                         prop_is_valid = ast_ari_validate_date(
2559                                 ast_json_object_iter_value(iter));
2560                         if (!prop_is_valid) {
2561                                 ast_log(LOG_ERROR, "ARI ChannelUserevent field timestamp failed validation\n");
2562                                 res = 0;
2563                         }
2564                 } else
2565                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2566                         int prop_is_valid;
2567                         has_channel = 1;
2568                         prop_is_valid = ast_ari_validate_channel(
2569                                 ast_json_object_iter_value(iter));
2570                         if (!prop_is_valid) {
2571                                 ast_log(LOG_ERROR, "ARI ChannelUserevent field channel failed validation\n");
2572                                 res = 0;
2573                         }
2574                 } else
2575                 if (strcmp("eventname", ast_json_object_iter_key(iter)) == 0) {
2576                         int prop_is_valid;
2577                         has_eventname = 1;
2578                         prop_is_valid = ast_ari_validate_string(
2579                                 ast_json_object_iter_value(iter));
2580                         if (!prop_is_valid) {
2581                                 ast_log(LOG_ERROR, "ARI ChannelUserevent field eventname failed validation\n");
2582                                 res = 0;
2583                         }
2584                 } else
2585                 if (strcmp("userevent", ast_json_object_iter_key(iter)) == 0) {
2586                         int prop_is_valid;
2587                         has_userevent = 1;
2588                         prop_is_valid = ast_ari_validate_object(
2589                                 ast_json_object_iter_value(iter));
2590                         if (!prop_is_valid) {
2591                                 ast_log(LOG_ERROR, "ARI ChannelUserevent field userevent failed validation\n");
2592                                 res = 0;
2593                         }
2594                 } else
2595                 {
2596                         ast_log(LOG_ERROR,
2597                                 "ARI ChannelUserevent has undocumented field %s\n",
2598                                 ast_json_object_iter_key(iter));
2599                         res = 0;
2600                 }
2601         }
2602
2603         if (!has_type) {
2604                 ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field type\n");
2605                 res = 0;
2606         }
2607
2608         if (!has_application) {
2609                 ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field application\n");
2610                 res = 0;
2611         }
2612
2613         if (!has_channel) {
2614                 ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field channel\n");
2615                 res = 0;
2616         }
2617
2618         if (!has_eventname) {
2619                 ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field eventname\n");
2620                 res = 0;
2621         }
2622
2623         if (!has_userevent) {
2624                 ast_log(LOG_ERROR, "ARI ChannelUserevent missing required field userevent\n");
2625                 res = 0;
2626         }
2627
2628         return res;
2629 }
2630
2631 ari_validator ast_ari_validate_channel_userevent_fn(void)
2632 {
2633         return ast_ari_validate_channel_userevent;
2634 }
2635
2636 int ast_ari_validate_channel_varset(struct ast_json *json)
2637 {
2638         int res = 1;
2639         struct ast_json_iter *iter;
2640         int has_type = 0;
2641         int has_application = 0;
2642         int has_value = 0;
2643         int has_variable = 0;
2644
2645         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2646                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2647                         int prop_is_valid;
2648                         has_type = 1;
2649                         prop_is_valid = ast_ari_validate_string(
2650                                 ast_json_object_iter_value(iter));
2651                         if (!prop_is_valid) {
2652                                 ast_log(LOG_ERROR, "ARI ChannelVarset field type failed validation\n");
2653                                 res = 0;
2654                         }
2655                 } else
2656                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2657                         int prop_is_valid;
2658                         has_application = 1;
2659                         prop_is_valid = ast_ari_validate_string(
2660                                 ast_json_object_iter_value(iter));
2661                         if (!prop_is_valid) {
2662                                 ast_log(LOG_ERROR, "ARI ChannelVarset field application failed validation\n");
2663                                 res = 0;
2664                         }
2665                 } else
2666                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2667                         int prop_is_valid;
2668                         prop_is_valid = ast_ari_validate_date(
2669                                 ast_json_object_iter_value(iter));
2670                         if (!prop_is_valid) {
2671                                 ast_log(LOG_ERROR, "ARI ChannelVarset field timestamp failed validation\n");
2672                                 res = 0;
2673                         }
2674                 } else
2675                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2676                         int prop_is_valid;
2677                         prop_is_valid = ast_ari_validate_channel(
2678                                 ast_json_object_iter_value(iter));
2679                         if (!prop_is_valid) {
2680                                 ast_log(LOG_ERROR, "ARI ChannelVarset field channel failed validation\n");
2681                                 res = 0;
2682                         }
2683                 } else
2684                 if (strcmp("value", ast_json_object_iter_key(iter)) == 0) {
2685                         int prop_is_valid;
2686                         has_value = 1;
2687                         prop_is_valid = ast_ari_validate_string(
2688                                 ast_json_object_iter_value(iter));
2689                         if (!prop_is_valid) {
2690                                 ast_log(LOG_ERROR, "ARI ChannelVarset field value failed validation\n");
2691                                 res = 0;
2692                         }
2693                 } else
2694                 if (strcmp("variable", ast_json_object_iter_key(iter)) == 0) {
2695                         int prop_is_valid;
2696                         has_variable = 1;
2697                         prop_is_valid = ast_ari_validate_string(
2698                                 ast_json_object_iter_value(iter));
2699                         if (!prop_is_valid) {
2700                                 ast_log(LOG_ERROR, "ARI ChannelVarset field variable failed validation\n");
2701                                 res = 0;
2702                         }
2703                 } else
2704                 {
2705                         ast_log(LOG_ERROR,
2706                                 "ARI ChannelVarset has undocumented field %s\n",
2707                                 ast_json_object_iter_key(iter));
2708                         res = 0;
2709                 }
2710         }
2711
2712         if (!has_type) {
2713                 ast_log(LOG_ERROR, "ARI ChannelVarset missing required field type\n");
2714                 res = 0;
2715         }
2716
2717         if (!has_application) {
2718                 ast_log(LOG_ERROR, "ARI ChannelVarset missing required field application\n");
2719                 res = 0;
2720         }
2721
2722         if (!has_value) {
2723                 ast_log(LOG_ERROR, "ARI ChannelVarset missing required field value\n");
2724                 res = 0;
2725         }
2726
2727         if (!has_variable) {
2728                 ast_log(LOG_ERROR, "ARI ChannelVarset missing required field variable\n");
2729                 res = 0;
2730         }
2731
2732         return res;
2733 }
2734
2735 ari_validator ast_ari_validate_channel_varset_fn(void)
2736 {
2737         return ast_ari_validate_channel_varset;
2738 }
2739
2740 int ast_ari_validate_endpoint_state_change(struct ast_json *json)
2741 {
2742         int res = 1;
2743         struct ast_json_iter *iter;
2744         int has_type = 0;
2745         int has_application = 0;
2746         int has_endpoint = 0;
2747
2748         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2749                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2750                         int prop_is_valid;
2751                         has_type = 1;
2752                         prop_is_valid = ast_ari_validate_string(
2753                                 ast_json_object_iter_value(iter));
2754                         if (!prop_is_valid) {
2755                                 ast_log(LOG_ERROR, "ARI EndpointStateChange field type failed validation\n");
2756                                 res = 0;
2757                         }
2758                 } else
2759                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2760                         int prop_is_valid;
2761                         has_application = 1;
2762                         prop_is_valid = ast_ari_validate_string(
2763                                 ast_json_object_iter_value(iter));
2764                         if (!prop_is_valid) {
2765                                 ast_log(LOG_ERROR, "ARI EndpointStateChange field application failed validation\n");
2766                                 res = 0;
2767                         }
2768                 } else
2769                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2770                         int prop_is_valid;
2771                         prop_is_valid = ast_ari_validate_date(
2772                                 ast_json_object_iter_value(iter));
2773                         if (!prop_is_valid) {
2774                                 ast_log(LOG_ERROR, "ARI EndpointStateChange field timestamp failed validation\n");
2775                                 res = 0;
2776                         }
2777                 } else
2778                 if (strcmp("endpoint", ast_json_object_iter_key(iter)) == 0) {
2779                         int prop_is_valid;
2780                         has_endpoint = 1;
2781                         prop_is_valid = ast_ari_validate_endpoint(
2782                                 ast_json_object_iter_value(iter));
2783                         if (!prop_is_valid) {
2784                                 ast_log(LOG_ERROR, "ARI EndpointStateChange field endpoint failed validation\n");
2785                                 res = 0;
2786                         }
2787                 } else
2788                 {
2789                         ast_log(LOG_ERROR,
2790                                 "ARI EndpointStateChange has undocumented field %s\n",
2791                                 ast_json_object_iter_key(iter));
2792                         res = 0;
2793                 }
2794         }
2795
2796         if (!has_type) {
2797                 ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field type\n");
2798                 res = 0;
2799         }
2800
2801         if (!has_application) {
2802                 ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field application\n");
2803                 res = 0;
2804         }
2805
2806         if (!has_endpoint) {
2807                 ast_log(LOG_ERROR, "ARI EndpointStateChange missing required field endpoint\n");
2808                 res = 0;
2809         }
2810
2811         return res;
2812 }
2813
2814 ari_validator ast_ari_validate_endpoint_state_change_fn(void)
2815 {
2816         return ast_ari_validate_endpoint_state_change;
2817 }
2818
2819 int ast_ari_validate_event(struct ast_json *json)
2820 {
2821         int res = 1;
2822         struct ast_json_iter *iter;
2823         int has_type = 0;
2824         int has_application = 0;
2825         const char *discriminator;
2826
2827         discriminator = ast_json_string_get(ast_json_object_get(json, "type"));
2828         if (!discriminator) {
2829                 ast_log(LOG_ERROR, "ARI Event missing required field type");
2830                 return 0;
2831         }
2832