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