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