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