res_stasis: Enable transfers and provide events when they occur.
[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_attended_transfer(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_destination_type = 0;
1562         int has_is_external = 0;
1563         int has_result = 0;
1564         int has_transferer_first_leg = 0;
1565         int has_transferer_second_leg = 0;
1566
1567         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1568                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1569                         int prop_is_valid;
1570                         has_type = 1;
1571                         prop_is_valid = ast_ari_validate_string(
1572                                 ast_json_object_iter_value(iter));
1573                         if (!prop_is_valid) {
1574                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field type failed validation\n");
1575                                 res = 0;
1576                         }
1577                 } else
1578                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1579                         int prop_is_valid;
1580                         has_application = 1;
1581                         prop_is_valid = ast_ari_validate_string(
1582                                 ast_json_object_iter_value(iter));
1583                         if (!prop_is_valid) {
1584                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field application failed validation\n");
1585                                 res = 0;
1586                         }
1587                 } else
1588                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1589                         int prop_is_valid;
1590                         prop_is_valid = ast_ari_validate_date(
1591                                 ast_json_object_iter_value(iter));
1592                         if (!prop_is_valid) {
1593                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field timestamp failed validation\n");
1594                                 res = 0;
1595                         }
1596                 } else
1597                 if (strcmp("destination_application", ast_json_object_iter_key(iter)) == 0) {
1598                         int prop_is_valid;
1599                         prop_is_valid = ast_ari_validate_string(
1600                                 ast_json_object_iter_value(iter));
1601                         if (!prop_is_valid) {
1602                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_application failed validation\n");
1603                                 res = 0;
1604                         }
1605                 } else
1606                 if (strcmp("destination_bridge", ast_json_object_iter_key(iter)) == 0) {
1607                         int prop_is_valid;
1608                         prop_is_valid = ast_ari_validate_string(
1609                                 ast_json_object_iter_value(iter));
1610                         if (!prop_is_valid) {
1611                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_bridge failed validation\n");
1612                                 res = 0;
1613                         }
1614                 } else
1615                 if (strcmp("destination_link_first_leg", ast_json_object_iter_key(iter)) == 0) {
1616                         int prop_is_valid;
1617                         prop_is_valid = ast_ari_validate_channel(
1618                                 ast_json_object_iter_value(iter));
1619                         if (!prop_is_valid) {
1620                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_link_first_leg failed validation\n");
1621                                 res = 0;
1622                         }
1623                 } else
1624                 if (strcmp("destination_link_second_leg", ast_json_object_iter_key(iter)) == 0) {
1625                         int prop_is_valid;
1626                         prop_is_valid = ast_ari_validate_channel(
1627                                 ast_json_object_iter_value(iter));
1628                         if (!prop_is_valid) {
1629                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_link_second_leg failed validation\n");
1630                                 res = 0;
1631                         }
1632                 } else
1633                 if (strcmp("destination_threeway_bridge", ast_json_object_iter_key(iter)) == 0) {
1634                         int prop_is_valid;
1635                         prop_is_valid = ast_ari_validate_bridge(
1636                                 ast_json_object_iter_value(iter));
1637                         if (!prop_is_valid) {
1638                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_threeway_bridge failed validation\n");
1639                                 res = 0;
1640                         }
1641                 } else
1642                 if (strcmp("destination_threeway_channel", ast_json_object_iter_key(iter)) == 0) {
1643                         int prop_is_valid;
1644                         prop_is_valid = ast_ari_validate_channel(
1645                                 ast_json_object_iter_value(iter));
1646                         if (!prop_is_valid) {
1647                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_threeway_channel failed validation\n");
1648                                 res = 0;
1649                         }
1650                 } else
1651                 if (strcmp("destination_type", ast_json_object_iter_key(iter)) == 0) {
1652                         int prop_is_valid;
1653                         has_destination_type = 1;
1654                         prop_is_valid = ast_ari_validate_string(
1655                                 ast_json_object_iter_value(iter));
1656                         if (!prop_is_valid) {
1657                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_type failed validation\n");
1658                                 res = 0;
1659                         }
1660                 } else
1661                 if (strcmp("is_external", ast_json_object_iter_key(iter)) == 0) {
1662                         int prop_is_valid;
1663                         has_is_external = 1;
1664                         prop_is_valid = ast_ari_validate_boolean(
1665                                 ast_json_object_iter_value(iter));
1666                         if (!prop_is_valid) {
1667                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field is_external failed validation\n");
1668                                 res = 0;
1669                         }
1670                 } else
1671                 if (strcmp("result", ast_json_object_iter_key(iter)) == 0) {
1672                         int prop_is_valid;
1673                         has_result = 1;
1674                         prop_is_valid = ast_ari_validate_string(
1675                                 ast_json_object_iter_value(iter));
1676                         if (!prop_is_valid) {
1677                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field result failed validation\n");
1678                                 res = 0;
1679                         }
1680                 } else
1681                 if (strcmp("transferer_first_leg", ast_json_object_iter_key(iter)) == 0) {
1682                         int prop_is_valid;
1683                         has_transferer_first_leg = 1;
1684                         prop_is_valid = ast_ari_validate_channel(
1685                                 ast_json_object_iter_value(iter));
1686                         if (!prop_is_valid) {
1687                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_first_leg failed validation\n");
1688                                 res = 0;
1689                         }
1690                 } else
1691                 if (strcmp("transferer_first_leg_bridge", ast_json_object_iter_key(iter)) == 0) {
1692                         int prop_is_valid;
1693                         prop_is_valid = ast_ari_validate_bridge(
1694                                 ast_json_object_iter_value(iter));
1695                         if (!prop_is_valid) {
1696                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_first_leg_bridge failed validation\n");
1697                                 res = 0;
1698                         }
1699                 } else
1700                 if (strcmp("transferer_second_leg", ast_json_object_iter_key(iter)) == 0) {
1701                         int prop_is_valid;
1702                         has_transferer_second_leg = 1;
1703                         prop_is_valid = ast_ari_validate_channel(
1704                                 ast_json_object_iter_value(iter));
1705                         if (!prop_is_valid) {
1706                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_second_leg failed validation\n");
1707                                 res = 0;
1708                         }
1709                 } else
1710                 if (strcmp("transferer_second_leg_bridge", ast_json_object_iter_key(iter)) == 0) {
1711                         int prop_is_valid;
1712                         prop_is_valid = ast_ari_validate_bridge(
1713                                 ast_json_object_iter_value(iter));
1714                         if (!prop_is_valid) {
1715                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_second_leg_bridge failed validation\n");
1716                                 res = 0;
1717                         }
1718                 } else
1719                 {
1720                         ast_log(LOG_ERROR,
1721                                 "ARI BridgeAttendedTransfer has undocumented field %s\n",
1722                                 ast_json_object_iter_key(iter));
1723                         res = 0;
1724                 }
1725         }
1726
1727         if (!has_type) {
1728                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field type\n");
1729                 res = 0;
1730         }
1731
1732         if (!has_application) {
1733                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field application\n");
1734                 res = 0;
1735         }
1736
1737         if (!has_destination_type) {
1738                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field destination_type\n");
1739                 res = 0;
1740         }
1741
1742         if (!has_is_external) {
1743                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field is_external\n");
1744                 res = 0;
1745         }
1746
1747         if (!has_result) {
1748                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field result\n");
1749                 res = 0;
1750         }
1751
1752         if (!has_transferer_first_leg) {
1753                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field transferer_first_leg\n");
1754                 res = 0;
1755         }
1756
1757         if (!has_transferer_second_leg) {
1758                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field transferer_second_leg\n");
1759                 res = 0;
1760         }
1761
1762         return res;
1763 }
1764
1765 ari_validator ast_ari_validate_bridge_attended_transfer_fn(void)
1766 {
1767         return ast_ari_validate_bridge_attended_transfer;
1768 }
1769
1770 int ast_ari_validate_bridge_blind_transfer(struct ast_json *json)
1771 {
1772         int res = 1;
1773         struct ast_json_iter *iter;
1774         int has_type = 0;
1775         int has_application = 0;
1776         int has_channel = 0;
1777         int has_context = 0;
1778         int has_exten = 0;
1779         int has_is_external = 0;
1780         int has_result = 0;
1781
1782         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1783                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1784                         int prop_is_valid;
1785                         has_type = 1;
1786                         prop_is_valid = ast_ari_validate_string(
1787                                 ast_json_object_iter_value(iter));
1788                         if (!prop_is_valid) {
1789                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field type failed validation\n");
1790                                 res = 0;
1791                         }
1792                 } else
1793                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1794                         int prop_is_valid;
1795                         has_application = 1;
1796                         prop_is_valid = ast_ari_validate_string(
1797                                 ast_json_object_iter_value(iter));
1798                         if (!prop_is_valid) {
1799                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field application failed validation\n");
1800                                 res = 0;
1801                         }
1802                 } else
1803                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1804                         int prop_is_valid;
1805                         prop_is_valid = ast_ari_validate_date(
1806                                 ast_json_object_iter_value(iter));
1807                         if (!prop_is_valid) {
1808                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field timestamp failed validation\n");
1809                                 res = 0;
1810                         }
1811                 } else
1812                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
1813                         int prop_is_valid;
1814                         prop_is_valid = ast_ari_validate_bridge(
1815                                 ast_json_object_iter_value(iter));
1816                         if (!prop_is_valid) {
1817                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field bridge failed validation\n");
1818                                 res = 0;
1819                         }
1820                 } else
1821                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
1822                         int prop_is_valid;
1823                         has_channel = 1;
1824                         prop_is_valid = ast_ari_validate_channel(
1825                                 ast_json_object_iter_value(iter));
1826                         if (!prop_is_valid) {
1827                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field channel failed validation\n");
1828                                 res = 0;
1829                         }
1830                 } else
1831                 if (strcmp("context", ast_json_object_iter_key(iter)) == 0) {
1832                         int prop_is_valid;
1833                         has_context = 1;
1834                         prop_is_valid = ast_ari_validate_string(
1835                                 ast_json_object_iter_value(iter));
1836                         if (!prop_is_valid) {
1837                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field context failed validation\n");
1838                                 res = 0;
1839                         }
1840                 } else
1841                 if (strcmp("exten", ast_json_object_iter_key(iter)) == 0) {
1842                         int prop_is_valid;
1843                         has_exten = 1;
1844                         prop_is_valid = ast_ari_validate_string(
1845                                 ast_json_object_iter_value(iter));
1846                         if (!prop_is_valid) {
1847                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field exten failed validation\n");
1848                                 res = 0;
1849                         }
1850                 } else
1851                 if (strcmp("is_external", ast_json_object_iter_key(iter)) == 0) {
1852                         int prop_is_valid;
1853                         has_is_external = 1;
1854                         prop_is_valid = ast_ari_validate_boolean(
1855                                 ast_json_object_iter_value(iter));
1856                         if (!prop_is_valid) {
1857                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field is_external failed validation\n");
1858                                 res = 0;
1859                         }
1860                 } else
1861                 if (strcmp("result", ast_json_object_iter_key(iter)) == 0) {
1862                         int prop_is_valid;
1863                         has_result = 1;
1864                         prop_is_valid = ast_ari_validate_string(
1865                                 ast_json_object_iter_value(iter));
1866                         if (!prop_is_valid) {
1867                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field result failed validation\n");
1868                                 res = 0;
1869                         }
1870                 } else
1871                 {
1872                         ast_log(LOG_ERROR,
1873                                 "ARI BridgeBlindTransfer has undocumented field %s\n",
1874                                 ast_json_object_iter_key(iter));
1875                         res = 0;
1876                 }
1877         }
1878
1879         if (!has_type) {
1880                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field type\n");
1881                 res = 0;
1882         }
1883
1884         if (!has_application) {
1885                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field application\n");
1886                 res = 0;
1887         }
1888
1889         if (!has_channel) {
1890                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field channel\n");
1891                 res = 0;
1892         }
1893
1894         if (!has_context) {
1895                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field context\n");
1896                 res = 0;
1897         }
1898
1899         if (!has_exten) {
1900                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field exten\n");
1901                 res = 0;
1902         }
1903
1904         if (!has_is_external) {
1905                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field is_external\n");
1906                 res = 0;
1907         }
1908
1909         if (!has_result) {
1910                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field result\n");
1911                 res = 0;
1912         }
1913
1914         return res;
1915 }
1916
1917 ari_validator ast_ari_validate_bridge_blind_transfer_fn(void)
1918 {
1919         return ast_ari_validate_bridge_blind_transfer;
1920 }
1921
1922 int ast_ari_validate_bridge_created(struct ast_json *json)
1923 {
1924         int res = 1;
1925         struct ast_json_iter *iter;
1926         int has_type = 0;
1927         int has_application = 0;
1928         int has_bridge = 0;
1929
1930         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1931                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
1932                         int prop_is_valid;
1933                         has_type = 1;
1934                         prop_is_valid = ast_ari_validate_string(
1935                                 ast_json_object_iter_value(iter));
1936                         if (!prop_is_valid) {
1937                                 ast_log(LOG_ERROR, "ARI BridgeCreated field type failed validation\n");
1938                                 res = 0;
1939                         }
1940                 } else
1941                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
1942                         int prop_is_valid;
1943                         has_application = 1;
1944                         prop_is_valid = ast_ari_validate_string(
1945                                 ast_json_object_iter_value(iter));
1946                         if (!prop_is_valid) {
1947                                 ast_log(LOG_ERROR, "ARI BridgeCreated field application failed validation\n");
1948                                 res = 0;
1949                         }
1950                 } else
1951                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
1952                         int prop_is_valid;
1953                         prop_is_valid = ast_ari_validate_date(
1954                                 ast_json_object_iter_value(iter));
1955                         if (!prop_is_valid) {
1956                                 ast_log(LOG_ERROR, "ARI BridgeCreated field timestamp failed validation\n");
1957                                 res = 0;
1958                         }
1959                 } else
1960                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
1961                         int prop_is_valid;
1962                         has_bridge = 1;
1963                         prop_is_valid = ast_ari_validate_bridge(
1964                                 ast_json_object_iter_value(iter));
1965                         if (!prop_is_valid) {
1966                                 ast_log(LOG_ERROR, "ARI BridgeCreated field bridge failed validation\n");
1967                                 res = 0;
1968                         }
1969                 } else
1970                 {
1971                         ast_log(LOG_ERROR,
1972                                 "ARI BridgeCreated has undocumented field %s\n",
1973                                 ast_json_object_iter_key(iter));
1974                         res = 0;
1975                 }
1976         }
1977
1978         if (!has_type) {
1979                 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field type\n");
1980                 res = 0;
1981         }
1982
1983         if (!has_application) {
1984                 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field application\n");
1985                 res = 0;
1986         }
1987
1988         if (!has_bridge) {
1989                 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field bridge\n");
1990                 res = 0;
1991         }
1992
1993         return res;
1994 }
1995
1996 ari_validator ast_ari_validate_bridge_created_fn(void)
1997 {
1998         return ast_ari_validate_bridge_created;
1999 }
2000
2001 int ast_ari_validate_bridge_destroyed(struct ast_json *json)
2002 {
2003         int res = 1;
2004         struct ast_json_iter *iter;
2005         int has_type = 0;
2006         int has_application = 0;
2007         int has_bridge = 0;
2008
2009         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2010                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2011                         int prop_is_valid;
2012                         has_type = 1;
2013                         prop_is_valid = ast_ari_validate_string(
2014                                 ast_json_object_iter_value(iter));
2015                         if (!prop_is_valid) {
2016                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field type failed validation\n");
2017                                 res = 0;
2018                         }
2019                 } else
2020                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2021                         int prop_is_valid;
2022                         has_application = 1;
2023                         prop_is_valid = ast_ari_validate_string(
2024                                 ast_json_object_iter_value(iter));
2025                         if (!prop_is_valid) {
2026                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field application failed validation\n");
2027                                 res = 0;
2028                         }
2029                 } else
2030                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2031                         int prop_is_valid;
2032                         prop_is_valid = ast_ari_validate_date(
2033                                 ast_json_object_iter_value(iter));
2034                         if (!prop_is_valid) {
2035                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field timestamp failed validation\n");
2036                                 res = 0;
2037                         }
2038                 } else
2039                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2040                         int prop_is_valid;
2041                         has_bridge = 1;
2042                         prop_is_valid = ast_ari_validate_bridge(
2043                                 ast_json_object_iter_value(iter));
2044                         if (!prop_is_valid) {
2045                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field bridge failed validation\n");
2046                                 res = 0;
2047                         }
2048                 } else
2049                 {
2050                         ast_log(LOG_ERROR,
2051                                 "ARI BridgeDestroyed has undocumented field %s\n",
2052                                 ast_json_object_iter_key(iter));
2053                         res = 0;
2054                 }
2055         }
2056
2057         if (!has_type) {
2058                 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field type\n");
2059                 res = 0;
2060         }
2061
2062         if (!has_application) {
2063                 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field application\n");
2064                 res = 0;
2065         }
2066
2067         if (!has_bridge) {
2068                 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field bridge\n");
2069                 res = 0;
2070         }
2071
2072         return res;
2073 }
2074
2075 ari_validator ast_ari_validate_bridge_destroyed_fn(void)
2076 {
2077         return ast_ari_validate_bridge_destroyed;
2078 }
2079
2080 int ast_ari_validate_bridge_merged(struct ast_json *json)
2081 {
2082         int res = 1;
2083         struct ast_json_iter *iter;
2084         int has_type = 0;
2085         int has_application = 0;
2086         int has_bridge = 0;
2087         int has_bridge_from = 0;
2088
2089         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2090                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2091                         int prop_is_valid;
2092                         has_type = 1;
2093                         prop_is_valid = ast_ari_validate_string(
2094                                 ast_json_object_iter_value(iter));
2095                         if (!prop_is_valid) {
2096                                 ast_log(LOG_ERROR, "ARI BridgeMerged field type failed validation\n");
2097                                 res = 0;
2098                         }
2099                 } else
2100                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2101                         int prop_is_valid;
2102                         has_application = 1;
2103                         prop_is_valid = ast_ari_validate_string(
2104                                 ast_json_object_iter_value(iter));
2105                         if (!prop_is_valid) {
2106                                 ast_log(LOG_ERROR, "ARI BridgeMerged field application failed validation\n");
2107                                 res = 0;
2108                         }
2109                 } else
2110                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2111                         int prop_is_valid;
2112                         prop_is_valid = ast_ari_validate_date(
2113                                 ast_json_object_iter_value(iter));
2114                         if (!prop_is_valid) {
2115                                 ast_log(LOG_ERROR, "ARI BridgeMerged field timestamp failed validation\n");
2116                                 res = 0;
2117                         }
2118                 } else
2119                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2120                         int prop_is_valid;
2121                         has_bridge = 1;
2122                         prop_is_valid = ast_ari_validate_bridge(
2123                                 ast_json_object_iter_value(iter));
2124                         if (!prop_is_valid) {
2125                                 ast_log(LOG_ERROR, "ARI BridgeMerged field bridge failed validation\n");
2126                                 res = 0;
2127                         }
2128                 } else
2129                 if (strcmp("bridge_from", ast_json_object_iter_key(iter)) == 0) {
2130                         int prop_is_valid;
2131                         has_bridge_from = 1;
2132                         prop_is_valid = ast_ari_validate_bridge(
2133                                 ast_json_object_iter_value(iter));
2134                         if (!prop_is_valid) {
2135                                 ast_log(LOG_ERROR, "ARI BridgeMerged field bridge_from failed validation\n");
2136                                 res = 0;
2137                         }
2138                 } else
2139                 {
2140                         ast_log(LOG_ERROR,
2141                                 "ARI BridgeMerged has undocumented field %s\n",
2142                                 ast_json_object_iter_key(iter));
2143                         res = 0;
2144                 }
2145         }
2146
2147         if (!has_type) {
2148                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field type\n");
2149                 res = 0;
2150         }
2151
2152         if (!has_application) {
2153                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field application\n");
2154                 res = 0;
2155         }
2156
2157         if (!has_bridge) {
2158                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge\n");
2159                 res = 0;
2160         }
2161
2162         if (!has_bridge_from) {
2163                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge_from\n");
2164                 res = 0;
2165         }
2166
2167         return res;
2168 }
2169
2170 ari_validator ast_ari_validate_bridge_merged_fn(void)
2171 {
2172         return ast_ari_validate_bridge_merged;
2173 }
2174
2175 int ast_ari_validate_channel_caller_id(struct ast_json *json)
2176 {
2177         int res = 1;
2178         struct ast_json_iter *iter;
2179         int has_type = 0;
2180         int has_application = 0;
2181         int has_caller_presentation = 0;
2182         int has_caller_presentation_txt = 0;
2183         int has_channel = 0;
2184
2185         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2186                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2187                         int prop_is_valid;
2188                         has_type = 1;
2189                         prop_is_valid = ast_ari_validate_string(
2190                                 ast_json_object_iter_value(iter));
2191                         if (!prop_is_valid) {
2192                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field type failed validation\n");
2193                                 res = 0;
2194                         }
2195                 } else
2196                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2197                         int prop_is_valid;
2198                         has_application = 1;
2199                         prop_is_valid = ast_ari_validate_string(
2200                                 ast_json_object_iter_value(iter));
2201                         if (!prop_is_valid) {
2202                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field application failed validation\n");
2203                                 res = 0;
2204                         }
2205                 } else
2206                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2207                         int prop_is_valid;
2208                         prop_is_valid = ast_ari_validate_date(
2209                                 ast_json_object_iter_value(iter));
2210                         if (!prop_is_valid) {
2211                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field timestamp failed validation\n");
2212                                 res = 0;
2213                         }
2214                 } else
2215                 if (strcmp("caller_presentation", ast_json_object_iter_key(iter)) == 0) {
2216                         int prop_is_valid;
2217                         has_caller_presentation = 1;
2218                         prop_is_valid = ast_ari_validate_int(
2219                                 ast_json_object_iter_value(iter));
2220                         if (!prop_is_valid) {
2221                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation failed validation\n");
2222                                 res = 0;
2223                         }
2224                 } else
2225                 if (strcmp("caller_presentation_txt", ast_json_object_iter_key(iter)) == 0) {
2226                         int prop_is_valid;
2227                         has_caller_presentation_txt = 1;
2228                         prop_is_valid = ast_ari_validate_string(
2229                                 ast_json_object_iter_value(iter));
2230                         if (!prop_is_valid) {
2231                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation_txt failed validation\n");
2232                                 res = 0;
2233                         }
2234                 } else
2235                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2236                         int prop_is_valid;
2237                         has_channel = 1;
2238                         prop_is_valid = ast_ari_validate_channel(
2239                                 ast_json_object_iter_value(iter));
2240                         if (!prop_is_valid) {
2241                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field channel failed validation\n");
2242                                 res = 0;
2243                         }
2244                 } else
2245                 {
2246                         ast_log(LOG_ERROR,
2247                                 "ARI ChannelCallerId has undocumented field %s\n",
2248                                 ast_json_object_iter_key(iter));
2249                         res = 0;
2250                 }
2251         }
2252
2253         if (!has_type) {
2254                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field type\n");
2255                 res = 0;
2256         }
2257
2258         if (!has_application) {
2259                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field application\n");
2260                 res = 0;
2261         }
2262
2263         if (!has_caller_presentation) {
2264                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation\n");
2265                 res = 0;
2266         }
2267
2268         if (!has_caller_presentation_txt) {
2269                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation_txt\n");
2270                 res = 0;
2271         }
2272
2273         if (!has_channel) {
2274                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field channel\n");
2275                 res = 0;
2276         }
2277
2278         return res;
2279 }
2280
2281 ari_validator ast_ari_validate_channel_caller_id_fn(void)
2282 {
2283         return ast_ari_validate_channel_caller_id;
2284 }
2285
2286 int ast_ari_validate_channel_created(struct ast_json *json)
2287 {
2288         int res = 1;
2289         struct ast_json_iter *iter;
2290         int has_type = 0;
2291         int has_application = 0;
2292         int has_channel = 0;
2293
2294         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2295                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2296                         int prop_is_valid;
2297                         has_type = 1;
2298                         prop_is_valid = ast_ari_validate_string(
2299                                 ast_json_object_iter_value(iter));
2300                         if (!prop_is_valid) {
2301                                 ast_log(LOG_ERROR, "ARI ChannelCreated field type failed validation\n");
2302                                 res = 0;
2303                         }
2304                 } else
2305                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2306                         int prop_is_valid;
2307                         has_application = 1;
2308                         prop_is_valid = ast_ari_validate_string(
2309                                 ast_json_object_iter_value(iter));
2310                         if (!prop_is_valid) {
2311                                 ast_log(LOG_ERROR, "ARI ChannelCreated field application failed validation\n");
2312                                 res = 0;
2313                         }
2314                 } else
2315                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2316                         int prop_is_valid;
2317                         prop_is_valid = ast_ari_validate_date(
2318                                 ast_json_object_iter_value(iter));
2319                         if (!prop_is_valid) {
2320                                 ast_log(LOG_ERROR, "ARI ChannelCreated field timestamp failed validation\n");
2321                                 res = 0;
2322                         }
2323                 } else
2324                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2325                         int prop_is_valid;
2326                         has_channel = 1;
2327                         prop_is_valid = ast_ari_validate_channel(
2328                                 ast_json_object_iter_value(iter));
2329                         if (!prop_is_valid) {
2330                                 ast_log(LOG_ERROR, "ARI ChannelCreated field channel failed validation\n");
2331                                 res = 0;
2332                         }
2333                 } else
2334                 {
2335                         ast_log(LOG_ERROR,
2336                                 "ARI ChannelCreated has undocumented field %s\n",
2337                                 ast_json_object_iter_key(iter));
2338                         res = 0;
2339                 }
2340         }
2341
2342         if (!has_type) {
2343                 ast_log(LOG_ERROR, "ARI ChannelCreated missing required field type\n");
2344                 res = 0;
2345         }
2346
2347         if (!has_application) {
2348                 ast_log(LOG_ERROR, "ARI ChannelCreated missing required field application\n");
2349                 res = 0;
2350         }
2351
2352         if (!has_channel) {
2353                 ast_log(LOG_ERROR, "ARI ChannelCreated missing required field channel\n");
2354                 res = 0;
2355         }
2356
2357         return res;
2358 }
2359
2360 ari_validator ast_ari_validate_channel_created_fn(void)
2361 {
2362         return ast_ari_validate_channel_created;
2363 }
2364
2365 int ast_ari_validate_channel_destroyed(struct ast_json *json)
2366 {
2367         int res = 1;
2368         struct ast_json_iter *iter;
2369         int has_type = 0;
2370         int has_application = 0;
2371         int has_cause = 0;
2372         int has_cause_txt = 0;
2373         int has_channel = 0;
2374
2375         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2376                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2377                         int prop_is_valid;
2378                         has_type = 1;
2379                         prop_is_valid = ast_ari_validate_string(
2380                                 ast_json_object_iter_value(iter));
2381                         if (!prop_is_valid) {
2382                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field type failed validation\n");
2383                                 res = 0;
2384                         }
2385                 } else
2386                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2387                         int prop_is_valid;
2388                         has_application = 1;
2389                         prop_is_valid = ast_ari_validate_string(
2390                                 ast_json_object_iter_value(iter));
2391                         if (!prop_is_valid) {
2392                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field application failed validation\n");
2393                                 res = 0;
2394                         }
2395                 } else
2396                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2397                         int prop_is_valid;
2398                         prop_is_valid = ast_ari_validate_date(
2399                                 ast_json_object_iter_value(iter));
2400                         if (!prop_is_valid) {
2401                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field timestamp failed validation\n");
2402                                 res = 0;
2403                         }
2404                 } else
2405                 if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
2406                         int prop_is_valid;
2407                         has_cause = 1;
2408                         prop_is_valid = ast_ari_validate_int(
2409                                 ast_json_object_iter_value(iter));
2410                         if (!prop_is_valid) {
2411                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field cause failed validation\n");
2412                                 res = 0;
2413                         }
2414                 } else
2415                 if (strcmp("cause_txt", ast_json_object_iter_key(iter)) == 0) {
2416                         int prop_is_valid;
2417                         has_cause_txt = 1;
2418                         prop_is_valid = ast_ari_validate_string(
2419                                 ast_json_object_iter_value(iter));
2420                         if (!prop_is_valid) {
2421                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field cause_txt failed validation\n");
2422                                 res = 0;
2423                         }
2424                 } else
2425                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2426                         int prop_is_valid;
2427                         has_channel = 1;
2428                         prop_is_valid = ast_ari_validate_channel(
2429                                 ast_json_object_iter_value(iter));
2430                         if (!prop_is_valid) {
2431                                 ast_log(LOG_ERROR, "ARI ChannelDestroyed field channel failed validation\n");
2432                                 res = 0;
2433                         }
2434                 } else
2435                 {
2436                         ast_log(LOG_ERROR,
2437                                 "ARI ChannelDestroyed has undocumented field %s\n",
2438                                 ast_json_object_iter_key(iter));
2439                         res = 0;
2440                 }
2441         }
2442
2443         if (!has_type) {
2444                 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field type\n");
2445                 res = 0;
2446         }
2447
2448         if (!has_application) {
2449                 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field application\n");
2450                 res = 0;
2451         }
2452
2453         if (!has_cause) {
2454                 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field cause\n");
2455                 res = 0;
2456         }
2457
2458         if (!has_cause_txt) {
2459                 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field cause_txt\n");
2460                 res = 0;
2461         }
2462
2463         if (!has_channel) {
2464                 ast_log(LOG_ERROR, "ARI ChannelDestroyed missing required field channel\n");
2465                 res = 0;
2466         }
2467
2468         return res;
2469 }
2470
2471 ari_validator ast_ari_validate_channel_destroyed_fn(void)
2472 {
2473         return ast_ari_validate_channel_destroyed;
2474 }
2475
2476 int ast_ari_validate_channel_dialplan(struct ast_json *json)
2477 {
2478         int res = 1;
2479         struct ast_json_iter *iter;
2480         int has_type = 0;
2481         int has_application = 0;
2482         int has_channel = 0;
2483         int has_dialplan_app = 0;
2484         int has_dialplan_app_data = 0;
2485
2486         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2487                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2488                         int prop_is_valid;
2489                         has_type = 1;
2490                         prop_is_valid = ast_ari_validate_string(
2491                                 ast_json_object_iter_value(iter));
2492                         if (!prop_is_valid) {
2493                                 ast_log(LOG_ERROR, "ARI ChannelDialplan field type failed validation\n");
2494                                 res = 0;
2495                         }
2496                 } else
2497                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2498                         int prop_is_valid;
2499                         has_application = 1;
2500                         prop_is_valid = ast_ari_validate_string(
2501                                 ast_json_object_iter_value(iter));
2502                         if (!prop_is_valid) {
2503                                 ast_log(LOG_ERROR, "ARI ChannelDialplan field application failed validation\n");
2504                                 res = 0;
2505                         }
2506                 } else
2507                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2508                         int prop_is_valid;
2509                         prop_is_valid = ast_ari_validate_date(
2510                                 ast_json_object_iter_value(iter));
2511                         if (!prop_is_valid) {
2512                                 ast_log(LOG_ERROR, "ARI ChannelDialplan field timestamp failed validation\n");
2513                                 res = 0;
2514                         }
2515                 } else
2516                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2517                         int prop_is_valid;
2518                         has_channel = 1;
2519                         prop_is_valid = ast_ari_validate_channel(
2520                                 ast_json_object_iter_value(iter));
2521                         if (!prop_is_valid) {
2522                                 ast_log(LOG_ERROR, "ARI ChannelDialplan field channel failed validation\n");
2523                                 res = 0;
2524                         }
2525                 } else
2526                 if (strcmp("dialplan_app", ast_json_object_iter_key(iter)) == 0) {
2527                         int prop_is_valid;
2528                         has_dialplan_app = 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 ChannelDialplan field dialplan_app failed validation\n");
2533                                 res = 0;
2534                         }
2535                 } else
2536                 if (strcmp("dialplan_app_data", ast_json_object_iter_key(iter)) == 0) {
2537                         int prop_is_valid;
2538                         has_dialplan_app_data = 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 ChannelDialplan field dialplan_app_data failed validation\n");
2543                                 res = 0;
2544                         }
2545                 } else
2546                 {
2547                         ast_log(LOG_ERROR,
2548                                 "ARI ChannelDialplan has undocumented field %s\n",
2549                                 ast_json_object_iter_key(iter));
2550                         res = 0;
2551                 }
2552         }
2553
2554         if (!has_type) {
2555                 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field type\n");
2556                 res = 0;
2557         }
2558
2559         if (!has_application) {
2560                 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field application\n");
2561                 res = 0;
2562         }
2563
2564         if (!has_channel) {
2565                 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field channel\n");
2566                 res = 0;
2567         }
2568
2569         if (!has_dialplan_app) {
2570                 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field dialplan_app\n");
2571                 res = 0;
2572         }
2573
2574         if (!has_dialplan_app_data) {
2575                 ast_log(LOG_ERROR, "ARI ChannelDialplan missing required field dialplan_app_data\n");
2576                 res = 0;
2577         }
2578
2579         return res;
2580 }
2581
2582 ari_validator ast_ari_validate_channel_dialplan_fn(void)
2583 {
2584         return ast_ari_validate_channel_dialplan;
2585 }
2586
2587 int ast_ari_validate_channel_dtmf_received(struct ast_json *json)
2588 {
2589         int res = 1;
2590         struct ast_json_iter *iter;
2591         int has_type = 0;
2592         int has_application = 0;
2593         int has_channel = 0;
2594         int has_digit = 0;
2595         int has_duration_ms = 0;
2596
2597         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2598                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2599                         int prop_is_valid;
2600                         has_type = 1;
2601                         prop_is_valid = ast_ari_validate_string(
2602                                 ast_json_object_iter_value(iter));
2603                         if (!prop_is_valid) {
2604                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field type failed validation\n");
2605                                 res = 0;
2606                         }
2607                 } else
2608                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2609                         int prop_is_valid;
2610                         has_application = 1;
2611                         prop_is_valid = ast_ari_validate_string(
2612                                 ast_json_object_iter_value(iter));
2613                         if (!prop_is_valid) {
2614                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field application failed validation\n");
2615                                 res = 0;
2616                         }
2617                 } else
2618                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2619                         int prop_is_valid;
2620                         prop_is_valid = ast_ari_validate_date(
2621                                 ast_json_object_iter_value(iter));
2622                         if (!prop_is_valid) {
2623                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field timestamp failed validation\n");
2624                                 res = 0;
2625                         }
2626                 } else
2627                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2628                         int prop_is_valid;
2629                         has_channel = 1;
2630                         prop_is_valid = ast_ari_validate_channel(
2631                                 ast_json_object_iter_value(iter));
2632                         if (!prop_is_valid) {
2633                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field channel failed validation\n");
2634                                 res = 0;
2635                         }
2636                 } else
2637                 if (strcmp("digit", ast_json_object_iter_key(iter)) == 0) {
2638                         int prop_is_valid;
2639                         has_digit = 1;
2640                         prop_is_valid = ast_ari_validate_string(
2641                                 ast_json_object_iter_value(iter));
2642                         if (!prop_is_valid) {
2643                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field digit failed validation\n");
2644                                 res = 0;
2645                         }
2646                 } else
2647                 if (strcmp("duration_ms", ast_json_object_iter_key(iter)) == 0) {
2648                         int prop_is_valid;
2649                         has_duration_ms = 1;
2650                         prop_is_valid = ast_ari_validate_int(
2651                                 ast_json_object_iter_value(iter));
2652                         if (!prop_is_valid) {
2653                                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field duration_ms failed validation\n");
2654                                 res = 0;
2655                         }
2656                 } else
2657                 {
2658                         ast_log(LOG_ERROR,
2659                                 "ARI ChannelDtmfReceived has undocumented field %s\n",
2660                                 ast_json_object_iter_key(iter));
2661                         res = 0;
2662                 }
2663         }
2664
2665         if (!has_type) {
2666                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field type\n");
2667                 res = 0;
2668         }
2669
2670         if (!has_application) {
2671                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field application\n");
2672                 res = 0;
2673         }
2674
2675         if (!has_channel) {
2676                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field channel\n");
2677                 res = 0;
2678         }
2679
2680         if (!has_digit) {
2681                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field digit\n");
2682                 res = 0;
2683         }
2684
2685         if (!has_duration_ms) {
2686                 ast_log(LOG_ERROR, "ARI ChannelDtmfReceived missing required field duration_ms\n");
2687                 res = 0;
2688         }
2689
2690         return res;
2691 }
2692
2693 ari_validator ast_ari_validate_channel_dtmf_received_fn(void)
2694 {
2695         return ast_ari_validate_channel_dtmf_received;
2696 }
2697
2698 int ast_ari_validate_channel_entered_bridge(struct ast_json *json)
2699 {
2700         int res = 1;
2701         struct ast_json_iter *iter;
2702         int has_type = 0;
2703         int has_application = 0;
2704         int has_bridge = 0;
2705
2706         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2707                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2708                         int prop_is_valid;
2709                         has_type = 1;
2710                         prop_is_valid = ast_ari_validate_string(
2711                                 ast_json_object_iter_value(iter));
2712                         if (!prop_is_valid) {
2713                                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field type failed validation\n");
2714                                 res = 0;
2715                         }
2716                 } else
2717                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2718                         int prop_is_valid;
2719                         has_application = 1;
2720                         prop_is_valid = ast_ari_validate_string(
2721                                 ast_json_object_iter_value(iter));
2722                         if (!prop_is_valid) {
2723                                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field application failed validation\n");
2724                                 res = 0;
2725                         }
2726                 } else
2727                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2728                         int prop_is_valid;
2729                         prop_is_valid = ast_ari_validate_date(
2730                                 ast_json_object_iter_value(iter));
2731                         if (!prop_is_valid) {
2732                                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field timestamp failed validation\n");
2733                                 res = 0;
2734                         }
2735                 } else
2736                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2737                         int prop_is_valid;
2738                         has_bridge = 1;
2739                         prop_is_valid = ast_ari_validate_bridge(
2740                                 ast_json_object_iter_value(iter));
2741                         if (!prop_is_valid) {
2742                                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field bridge failed validation\n");
2743                                 res = 0;
2744                         }
2745                 } else
2746                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2747                         int prop_is_valid;
2748                         prop_is_valid = ast_ari_validate_channel(
2749                                 ast_json_object_iter_value(iter));
2750                         if (!prop_is_valid) {
2751                                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field channel failed validation\n");
2752                                 res = 0;
2753                         }
2754                 } else
2755                 {
2756                         ast_log(LOG_ERROR,
2757                                 "ARI ChannelEnteredBridge has undocumented field %s\n",
2758                                 ast_json_object_iter_key(iter));
2759                         res = 0;
2760                 }
2761         }
2762
2763         if (!has_type) {
2764                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field type\n");
2765                 res = 0;
2766         }
2767
2768         if (!has_application) {
2769                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field application\n");
2770                 res = 0;
2771         }
2772
2773         if (!has_bridge) {
2774                 ast_log(LOG_ERROR, "ARI ChannelEnteredBridge missing required field bridge\n");
2775                 res = 0;
2776         }
2777
2778         return res;
2779 }
2780
2781 ari_validator ast_ari_validate_channel_entered_bridge_fn(void)
2782 {
2783         return ast_ari_validate_channel_entered_bridge;
2784 }
2785
2786 int ast_ari_validate_channel_hangup_request(struct ast_json *json)
2787 {
2788         int res = 1;
2789         struct ast_json_iter *iter;
2790         int has_type = 0;
2791         int has_application = 0;
2792         int has_channel = 0;
2793
2794         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2795                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2796                         int prop_is_valid;
2797                         has_type = 1;
2798                         prop_is_valid = ast_ari_validate_string(
2799                                 ast_json_object_iter_value(iter));
2800                         if (!prop_is_valid) {
2801                                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field type failed validation\n");
2802                                 res = 0;
2803                         }
2804                 } else
2805                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2806                         int prop_is_valid;
2807                         has_application = 1;
2808                         prop_is_valid = ast_ari_validate_string(
2809                                 ast_json_object_iter_value(iter));
2810                         if (!prop_is_valid) {
2811                                 ast_log(LOG_ERROR, "ARI ChannelHangupRequest field application failed validation\n");
2812                                 res = 0;
2813                         }
2814                 } else
2815                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2816                         int prop_is_valid;
2817