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