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