44d9d7727cc7daf4ff0d0c0c37a82adc4474999e
[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_replaced(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
2038         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2039                 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2040                         int prop_is_valid;
2041                         prop_is_valid = ast_ari_validate_string(
2042                                 ast_json_object_iter_value(iter));
2043                         if (!prop_is_valid) {
2044                                 ast_log(LOG_ERROR, "ARI ApplicationReplaced field asterisk_id failed validation\n");
2045                                 res = 0;
2046                         }
2047                 } else
2048                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2049                         int prop_is_valid;
2050                         has_type = 1;
2051                         prop_is_valid = ast_ari_validate_string(
2052                                 ast_json_object_iter_value(iter));
2053                         if (!prop_is_valid) {
2054                                 ast_log(LOG_ERROR, "ARI ApplicationReplaced field type failed validation\n");
2055                                 res = 0;
2056                         }
2057                 } else
2058                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2059                         int prop_is_valid;
2060                         has_application = 1;
2061                         prop_is_valid = ast_ari_validate_string(
2062                                 ast_json_object_iter_value(iter));
2063                         if (!prop_is_valid) {
2064                                 ast_log(LOG_ERROR, "ARI ApplicationReplaced field application failed validation\n");
2065                                 res = 0;
2066                         }
2067                 } else
2068                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2069                         int prop_is_valid;
2070                         prop_is_valid = ast_ari_validate_date(
2071                                 ast_json_object_iter_value(iter));
2072                         if (!prop_is_valid) {
2073                                 ast_log(LOG_ERROR, "ARI ApplicationReplaced field timestamp failed validation\n");
2074                                 res = 0;
2075                         }
2076                 } else
2077                 {
2078                         ast_log(LOG_ERROR,
2079                                 "ARI ApplicationReplaced has undocumented field %s\n",
2080                                 ast_json_object_iter_key(iter));
2081                         res = 0;
2082                 }
2083         }
2084
2085         if (!has_type) {
2086                 ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field type\n");
2087                 res = 0;
2088         }
2089
2090         if (!has_application) {
2091                 ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field application\n");
2092                 res = 0;
2093         }
2094
2095         return res;
2096 }
2097
2098 ari_validator ast_ari_validate_application_replaced_fn(void)
2099 {
2100         return ast_ari_validate_application_replaced;
2101 }
2102
2103 int ast_ari_validate_bridge_attended_transfer(struct ast_json *json)
2104 {
2105         int res = 1;
2106         struct ast_json_iter *iter;
2107         int has_type = 0;
2108         int has_application = 0;
2109         int has_destination_type = 0;
2110         int has_is_external = 0;
2111         int has_result = 0;
2112         int has_transferer_first_leg = 0;
2113         int has_transferer_second_leg = 0;
2114
2115         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2116                 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2117                         int prop_is_valid;
2118                         prop_is_valid = ast_ari_validate_string(
2119                                 ast_json_object_iter_value(iter));
2120                         if (!prop_is_valid) {
2121                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field asterisk_id failed validation\n");
2122                                 res = 0;
2123                         }
2124                 } else
2125                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2126                         int prop_is_valid;
2127                         has_type = 1;
2128                         prop_is_valid = ast_ari_validate_string(
2129                                 ast_json_object_iter_value(iter));
2130                         if (!prop_is_valid) {
2131                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field type failed validation\n");
2132                                 res = 0;
2133                         }
2134                 } else
2135                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2136                         int prop_is_valid;
2137                         has_application = 1;
2138                         prop_is_valid = ast_ari_validate_string(
2139                                 ast_json_object_iter_value(iter));
2140                         if (!prop_is_valid) {
2141                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field application failed validation\n");
2142                                 res = 0;
2143                         }
2144                 } else
2145                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2146                         int prop_is_valid;
2147                         prop_is_valid = ast_ari_validate_date(
2148                                 ast_json_object_iter_value(iter));
2149                         if (!prop_is_valid) {
2150                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field timestamp failed validation\n");
2151                                 res = 0;
2152                         }
2153                 } else
2154                 if (strcmp("destination_application", ast_json_object_iter_key(iter)) == 0) {
2155                         int prop_is_valid;
2156                         prop_is_valid = ast_ari_validate_string(
2157                                 ast_json_object_iter_value(iter));
2158                         if (!prop_is_valid) {
2159                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_application failed validation\n");
2160                                 res = 0;
2161                         }
2162                 } else
2163                 if (strcmp("destination_bridge", ast_json_object_iter_key(iter)) == 0) {
2164                         int prop_is_valid;
2165                         prop_is_valid = ast_ari_validate_string(
2166                                 ast_json_object_iter_value(iter));
2167                         if (!prop_is_valid) {
2168                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_bridge failed validation\n");
2169                                 res = 0;
2170                         }
2171                 } else
2172                 if (strcmp("destination_link_first_leg", ast_json_object_iter_key(iter)) == 0) {
2173                         int prop_is_valid;
2174                         prop_is_valid = ast_ari_validate_channel(
2175                                 ast_json_object_iter_value(iter));
2176                         if (!prop_is_valid) {
2177                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_link_first_leg failed validation\n");
2178                                 res = 0;
2179                         }
2180                 } else
2181                 if (strcmp("destination_link_second_leg", ast_json_object_iter_key(iter)) == 0) {
2182                         int prop_is_valid;
2183                         prop_is_valid = ast_ari_validate_channel(
2184                                 ast_json_object_iter_value(iter));
2185                         if (!prop_is_valid) {
2186                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_link_second_leg failed validation\n");
2187                                 res = 0;
2188                         }
2189                 } else
2190                 if (strcmp("destination_threeway_bridge", ast_json_object_iter_key(iter)) == 0) {
2191                         int prop_is_valid;
2192                         prop_is_valid = ast_ari_validate_bridge(
2193                                 ast_json_object_iter_value(iter));
2194                         if (!prop_is_valid) {
2195                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_threeway_bridge failed validation\n");
2196                                 res = 0;
2197                         }
2198                 } else
2199                 if (strcmp("destination_threeway_channel", ast_json_object_iter_key(iter)) == 0) {
2200                         int prop_is_valid;
2201                         prop_is_valid = ast_ari_validate_channel(
2202                                 ast_json_object_iter_value(iter));
2203                         if (!prop_is_valid) {
2204                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_threeway_channel failed validation\n");
2205                                 res = 0;
2206                         }
2207                 } else
2208                 if (strcmp("destination_type", ast_json_object_iter_key(iter)) == 0) {
2209                         int prop_is_valid;
2210                         has_destination_type = 1;
2211                         prop_is_valid = ast_ari_validate_string(
2212                                 ast_json_object_iter_value(iter));
2213                         if (!prop_is_valid) {
2214                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_type failed validation\n");
2215                                 res = 0;
2216                         }
2217                 } else
2218                 if (strcmp("is_external", ast_json_object_iter_key(iter)) == 0) {
2219                         int prop_is_valid;
2220                         has_is_external = 1;
2221                         prop_is_valid = ast_ari_validate_boolean(
2222                                 ast_json_object_iter_value(iter));
2223                         if (!prop_is_valid) {
2224                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field is_external failed validation\n");
2225                                 res = 0;
2226                         }
2227                 } else
2228                 if (strcmp("replace_channel", ast_json_object_iter_key(iter)) == 0) {
2229                         int prop_is_valid;
2230                         prop_is_valid = ast_ari_validate_channel(
2231                                 ast_json_object_iter_value(iter));
2232                         if (!prop_is_valid) {
2233                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field replace_channel failed validation\n");
2234                                 res = 0;
2235                         }
2236                 } else
2237                 if (strcmp("result", ast_json_object_iter_key(iter)) == 0) {
2238                         int prop_is_valid;
2239                         has_result = 1;
2240                         prop_is_valid = ast_ari_validate_string(
2241                                 ast_json_object_iter_value(iter));
2242                         if (!prop_is_valid) {
2243                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field result failed validation\n");
2244                                 res = 0;
2245                         }
2246                 } else
2247                 if (strcmp("transfer_target", ast_json_object_iter_key(iter)) == 0) {
2248                         int prop_is_valid;
2249                         prop_is_valid = ast_ari_validate_channel(
2250                                 ast_json_object_iter_value(iter));
2251                         if (!prop_is_valid) {
2252                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transfer_target failed validation\n");
2253                                 res = 0;
2254                         }
2255                 } else
2256                 if (strcmp("transferee", ast_json_object_iter_key(iter)) == 0) {
2257                         int prop_is_valid;
2258                         prop_is_valid = ast_ari_validate_channel(
2259                                 ast_json_object_iter_value(iter));
2260                         if (!prop_is_valid) {
2261                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferee failed validation\n");
2262                                 res = 0;
2263                         }
2264                 } else
2265                 if (strcmp("transferer_first_leg", ast_json_object_iter_key(iter)) == 0) {
2266                         int prop_is_valid;
2267                         has_transferer_first_leg = 1;
2268                         prop_is_valid = ast_ari_validate_channel(
2269                                 ast_json_object_iter_value(iter));
2270                         if (!prop_is_valid) {
2271                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_first_leg failed validation\n");
2272                                 res = 0;
2273                         }
2274                 } else
2275                 if (strcmp("transferer_first_leg_bridge", ast_json_object_iter_key(iter)) == 0) {
2276                         int prop_is_valid;
2277                         prop_is_valid = ast_ari_validate_bridge(
2278                                 ast_json_object_iter_value(iter));
2279                         if (!prop_is_valid) {
2280                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_first_leg_bridge failed validation\n");
2281                                 res = 0;
2282                         }
2283                 } else
2284                 if (strcmp("transferer_second_leg", ast_json_object_iter_key(iter)) == 0) {
2285                         int prop_is_valid;
2286                         has_transferer_second_leg = 1;
2287                         prop_is_valid = ast_ari_validate_channel(
2288                                 ast_json_object_iter_value(iter));
2289                         if (!prop_is_valid) {
2290                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_second_leg failed validation\n");
2291                                 res = 0;
2292                         }
2293                 } else
2294                 if (strcmp("transferer_second_leg_bridge", ast_json_object_iter_key(iter)) == 0) {
2295                         int prop_is_valid;
2296                         prop_is_valid = ast_ari_validate_bridge(
2297                                 ast_json_object_iter_value(iter));
2298                         if (!prop_is_valid) {
2299                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_second_leg_bridge failed validation\n");
2300                                 res = 0;
2301                         }
2302                 } else
2303                 {
2304                         ast_log(LOG_ERROR,
2305                                 "ARI BridgeAttendedTransfer has undocumented field %s\n",
2306                                 ast_json_object_iter_key(iter));
2307                         res = 0;
2308                 }
2309         }
2310
2311         if (!has_type) {
2312                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field type\n");
2313                 res = 0;
2314         }
2315
2316         if (!has_application) {
2317                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field application\n");
2318                 res = 0;
2319         }
2320
2321         if (!has_destination_type) {
2322                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field destination_type\n");
2323                 res = 0;
2324         }
2325
2326         if (!has_is_external) {
2327                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field is_external\n");
2328                 res = 0;
2329         }
2330
2331         if (!has_result) {
2332                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field result\n");
2333                 res = 0;
2334         }
2335
2336         if (!has_transferer_first_leg) {
2337                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field transferer_first_leg\n");
2338                 res = 0;
2339         }
2340
2341         if (!has_transferer_second_leg) {
2342                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field transferer_second_leg\n");
2343                 res = 0;
2344         }
2345
2346         return res;
2347 }
2348
2349 ari_validator ast_ari_validate_bridge_attended_transfer_fn(void)
2350 {
2351         return ast_ari_validate_bridge_attended_transfer;
2352 }
2353
2354 int ast_ari_validate_bridge_blind_transfer(struct ast_json *json)
2355 {
2356         int res = 1;
2357         struct ast_json_iter *iter;
2358         int has_type = 0;
2359         int has_application = 0;
2360         int has_channel = 0;
2361         int has_context = 0;
2362         int has_exten = 0;
2363         int has_is_external = 0;
2364         int has_result = 0;
2365
2366         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2367                 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2368                         int prop_is_valid;
2369                         prop_is_valid = ast_ari_validate_string(
2370                                 ast_json_object_iter_value(iter));
2371                         if (!prop_is_valid) {
2372                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field asterisk_id failed validation\n");
2373                                 res = 0;
2374                         }
2375                 } else
2376                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2377                         int prop_is_valid;
2378                         has_type = 1;
2379                         prop_is_valid = ast_ari_validate_string(
2380                                 ast_json_object_iter_value(iter));
2381                         if (!prop_is_valid) {
2382                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field type failed validation\n");
2383                                 res = 0;
2384                         }
2385                 } else
2386                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2387                         int prop_is_valid;
2388                         has_application = 1;
2389                         prop_is_valid = ast_ari_validate_string(
2390                                 ast_json_object_iter_value(iter));
2391                         if (!prop_is_valid) {
2392                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field application failed validation\n");
2393                                 res = 0;
2394                         }
2395                 } else
2396                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2397                         int prop_is_valid;
2398                         prop_is_valid = ast_ari_validate_date(
2399                                 ast_json_object_iter_value(iter));
2400                         if (!prop_is_valid) {
2401                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field timestamp failed validation\n");
2402                                 res = 0;
2403                         }
2404                 } else
2405                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2406                         int prop_is_valid;
2407                         prop_is_valid = ast_ari_validate_bridge(
2408                                 ast_json_object_iter_value(iter));
2409                         if (!prop_is_valid) {
2410                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field bridge failed validation\n");
2411                                 res = 0;
2412                         }
2413                 } else
2414                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2415                         int prop_is_valid;
2416                         has_channel = 1;
2417                         prop_is_valid = ast_ari_validate_channel(
2418                                 ast_json_object_iter_value(iter));
2419                         if (!prop_is_valid) {
2420                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field channel failed validation\n");
2421                                 res = 0;
2422                         }
2423                 } else
2424                 if (strcmp("context", ast_json_object_iter_key(iter)) == 0) {
2425                         int prop_is_valid;
2426                         has_context = 1;
2427                         prop_is_valid = ast_ari_validate_string(
2428                                 ast_json_object_iter_value(iter));
2429                         if (!prop_is_valid) {
2430                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field context failed validation\n");
2431                                 res = 0;
2432                         }
2433                 } else
2434                 if (strcmp("exten", ast_json_object_iter_key(iter)) == 0) {
2435                         int prop_is_valid;
2436                         has_exten = 1;
2437                         prop_is_valid = ast_ari_validate_string(
2438                                 ast_json_object_iter_value(iter));
2439                         if (!prop_is_valid) {
2440                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field exten failed validation\n");
2441                                 res = 0;
2442                         }
2443                 } else
2444                 if (strcmp("is_external", ast_json_object_iter_key(iter)) == 0) {
2445                         int prop_is_valid;
2446                         has_is_external = 1;
2447                         prop_is_valid = ast_ari_validate_boolean(
2448                                 ast_json_object_iter_value(iter));
2449                         if (!prop_is_valid) {
2450                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field is_external failed validation\n");
2451                                 res = 0;
2452                         }
2453                 } else
2454                 if (strcmp("replace_channel", ast_json_object_iter_key(iter)) == 0) {
2455                         int prop_is_valid;
2456                         prop_is_valid = ast_ari_validate_channel(
2457                                 ast_json_object_iter_value(iter));
2458                         if (!prop_is_valid) {
2459                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field replace_channel failed validation\n");
2460                                 res = 0;
2461                         }
2462                 } else
2463                 if (strcmp("result", ast_json_object_iter_key(iter)) == 0) {
2464                         int prop_is_valid;
2465                         has_result = 1;
2466                         prop_is_valid = ast_ari_validate_string(
2467                                 ast_json_object_iter_value(iter));
2468                         if (!prop_is_valid) {
2469                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field result failed validation\n");
2470                                 res = 0;
2471                         }
2472                 } else
2473                 if (strcmp("transferee", ast_json_object_iter_key(iter)) == 0) {
2474                         int prop_is_valid;
2475                         prop_is_valid = ast_ari_validate_channel(
2476                                 ast_json_object_iter_value(iter));
2477                         if (!prop_is_valid) {
2478                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field transferee failed validation\n");
2479                                 res = 0;
2480                         }
2481                 } else
2482                 {
2483                         ast_log(LOG_ERROR,
2484                                 "ARI BridgeBlindTransfer has undocumented field %s\n",
2485                                 ast_json_object_iter_key(iter));
2486                         res = 0;
2487                 }
2488         }
2489
2490         if (!has_type) {
2491                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field type\n");
2492                 res = 0;
2493         }
2494
2495         if (!has_application) {
2496                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field application\n");
2497                 res = 0;
2498         }
2499
2500         if (!has_channel) {
2501                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field channel\n");
2502                 res = 0;
2503         }
2504
2505         if (!has_context) {
2506                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field context\n");
2507                 res = 0;
2508         }
2509
2510         if (!has_exten) {
2511                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field exten\n");
2512                 res = 0;
2513         }
2514
2515         if (!has_is_external) {
2516                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field is_external\n");
2517                 res = 0;
2518         }
2519
2520         if (!has_result) {
2521                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field result\n");
2522                 res = 0;
2523         }
2524
2525         return res;
2526 }
2527
2528 ari_validator ast_ari_validate_bridge_blind_transfer_fn(void)
2529 {
2530         return ast_ari_validate_bridge_blind_transfer;
2531 }
2532
2533 int ast_ari_validate_bridge_created(struct ast_json *json)
2534 {
2535         int res = 1;
2536         struct ast_json_iter *iter;
2537         int has_type = 0;
2538         int has_application = 0;
2539         int has_bridge = 0;
2540
2541         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2542                 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2543                         int prop_is_valid;
2544                         prop_is_valid = ast_ari_validate_string(
2545                                 ast_json_object_iter_value(iter));
2546                         if (!prop_is_valid) {
2547                                 ast_log(LOG_ERROR, "ARI BridgeCreated field asterisk_id failed validation\n");
2548                                 res = 0;
2549                         }
2550                 } else
2551                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2552                         int prop_is_valid;
2553                         has_type = 1;
2554                         prop_is_valid = ast_ari_validate_string(
2555                                 ast_json_object_iter_value(iter));
2556                         if (!prop_is_valid) {
2557                                 ast_log(LOG_ERROR, "ARI BridgeCreated field type failed validation\n");
2558                                 res = 0;
2559                         }
2560                 } else
2561                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2562                         int prop_is_valid;
2563                         has_application = 1;
2564                         prop_is_valid = ast_ari_validate_string(
2565                                 ast_json_object_iter_value(iter));
2566                         if (!prop_is_valid) {
2567                                 ast_log(LOG_ERROR, "ARI BridgeCreated field application failed validation\n");
2568                                 res = 0;
2569                         }
2570                 } else
2571                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2572                         int prop_is_valid;
2573                         prop_is_valid = ast_ari_validate_date(
2574                                 ast_json_object_iter_value(iter));
2575                         if (!prop_is_valid) {
2576                                 ast_log(LOG_ERROR, "ARI BridgeCreated field timestamp failed validation\n");
2577                                 res = 0;
2578                         }
2579                 } else
2580                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2581                         int prop_is_valid;
2582                         has_bridge = 1;
2583                         prop_is_valid = ast_ari_validate_bridge(
2584                                 ast_json_object_iter_value(iter));
2585                         if (!prop_is_valid) {
2586                                 ast_log(LOG_ERROR, "ARI BridgeCreated field bridge failed validation\n");
2587                                 res = 0;
2588                         }
2589                 } else
2590                 {
2591                         ast_log(LOG_ERROR,
2592                                 "ARI BridgeCreated has undocumented field %s\n",
2593                                 ast_json_object_iter_key(iter));
2594                         res = 0;
2595                 }
2596         }
2597
2598         if (!has_type) {
2599                 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field type\n");
2600                 res = 0;
2601         }
2602
2603         if (!has_application) {
2604                 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field application\n");
2605                 res = 0;
2606         }
2607
2608         if (!has_bridge) {
2609                 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field bridge\n");
2610                 res = 0;
2611         }
2612
2613         return res;
2614 }
2615
2616 ari_validator ast_ari_validate_bridge_created_fn(void)
2617 {
2618         return ast_ari_validate_bridge_created;
2619 }
2620
2621 int ast_ari_validate_bridge_destroyed(struct ast_json *json)
2622 {
2623         int res = 1;
2624         struct ast_json_iter *iter;
2625         int has_type = 0;
2626         int has_application = 0;
2627         int has_bridge = 0;
2628
2629         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2630                 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2631                         int prop_is_valid;
2632                         prop_is_valid = ast_ari_validate_string(
2633                                 ast_json_object_iter_value(iter));
2634                         if (!prop_is_valid) {
2635                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field asterisk_id failed validation\n");
2636                                 res = 0;
2637                         }
2638                 } else
2639                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2640                         int prop_is_valid;
2641                         has_type = 1;
2642                         prop_is_valid = ast_ari_validate_string(
2643                                 ast_json_object_iter_value(iter));
2644                         if (!prop_is_valid) {
2645                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field type failed validation\n");
2646                                 res = 0;
2647                         }
2648                 } else
2649                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2650                         int prop_is_valid;
2651                         has_application = 1;
2652                         prop_is_valid = ast_ari_validate_string(
2653                                 ast_json_object_iter_value(iter));
2654                         if (!prop_is_valid) {
2655                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field application failed validation\n");
2656                                 res = 0;
2657                         }
2658                 } else
2659                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2660                         int prop_is_valid;
2661                         prop_is_valid = ast_ari_validate_date(
2662                                 ast_json_object_iter_value(iter));
2663                         if (!prop_is_valid) {
2664                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field timestamp failed validation\n");
2665                                 res = 0;
2666                         }
2667                 } else
2668                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2669                         int prop_is_valid;
2670                         has_bridge = 1;
2671                         prop_is_valid = ast_ari_validate_bridge(
2672                                 ast_json_object_iter_value(iter));
2673                         if (!prop_is_valid) {
2674                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field bridge failed validation\n");
2675                                 res = 0;
2676                         }
2677                 } else
2678                 {
2679                         ast_log(LOG_ERROR,
2680                                 "ARI BridgeDestroyed has undocumented field %s\n",
2681                                 ast_json_object_iter_key(iter));
2682                         res = 0;
2683                 }
2684         }
2685
2686         if (!has_type) {
2687                 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field type\n");
2688                 res = 0;
2689         }
2690
2691         if (!has_application) {
2692                 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field application\n");
2693                 res = 0;
2694         }
2695
2696         if (!has_bridge) {
2697                 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field bridge\n");
2698                 res = 0;
2699         }
2700
2701         return res;
2702 }
2703
2704 ari_validator ast_ari_validate_bridge_destroyed_fn(void)
2705 {
2706         return ast_ari_validate_bridge_destroyed;
2707 }
2708
2709 int ast_ari_validate_bridge_merged(struct ast_json *json)
2710 {
2711         int res = 1;
2712         struct ast_json_iter *iter;
2713         int has_type = 0;
2714         int has_application = 0;
2715         int has_bridge = 0;
2716         int has_bridge_from = 0;
2717
2718         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2719                 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2720                         int prop_is_valid;
2721                         prop_is_valid = ast_ari_validate_string(
2722                                 ast_json_object_iter_value(iter));
2723                         if (!prop_is_valid) {
2724                                 ast_log(LOG_ERROR, "ARI BridgeMerged field asterisk_id failed validation\n");
2725                                 res = 0;
2726                         }
2727                 } else
2728                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2729                         int prop_is_valid;
2730                         has_type = 1;
2731                         prop_is_valid = ast_ari_validate_string(
2732                                 ast_json_object_iter_value(iter));
2733                         if (!prop_is_valid) {
2734                                 ast_log(LOG_ERROR, "ARI BridgeMerged field type failed validation\n");
2735                                 res = 0;
2736                         }
2737                 } else
2738                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2739                         int prop_is_valid;
2740                         has_application = 1;
2741                         prop_is_valid = ast_ari_validate_string(
2742                                 ast_json_object_iter_value(iter));
2743                         if (!prop_is_valid) {
2744                                 ast_log(LOG_ERROR, "ARI BridgeMerged field application failed validation\n");
2745                                 res = 0;
2746                         }
2747                 } else
2748                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2749                         int prop_is_valid;
2750                         prop_is_valid = ast_ari_validate_date(
2751                                 ast_json_object_iter_value(iter));
2752                         if (!prop_is_valid) {
2753                                 ast_log(LOG_ERROR, "ARI BridgeMerged field timestamp failed validation\n");
2754                                 res = 0;
2755                         }
2756                 } else
2757                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2758                         int prop_is_valid;
2759                         has_bridge = 1;
2760                         prop_is_valid = ast_ari_validate_bridge(
2761                                 ast_json_object_iter_value(iter));
2762                         if (!prop_is_valid) {
2763                                 ast_log(LOG_ERROR, "ARI BridgeMerged field bridge failed validation\n");
2764                                 res = 0;
2765                         }
2766                 } else
2767                 if (strcmp("bridge_from", ast_json_object_iter_key(iter)) == 0) {
2768                         int prop_is_valid;
2769                         has_bridge_from = 1;
2770                         prop_is_valid = ast_ari_validate_bridge(
2771                                 ast_json_object_iter_value(iter));
2772                         if (!prop_is_valid) {
2773                                 ast_log(LOG_ERROR, "ARI BridgeMerged field bridge_from failed validation\n");
2774                                 res = 0;
2775                         }
2776                 } else
2777                 {
2778                         ast_log(LOG_ERROR,
2779                                 "ARI BridgeMerged has undocumented field %s\n",
2780                                 ast_json_object_iter_key(iter));
2781                         res = 0;
2782                 }
2783         }
2784
2785         if (!has_type) {
2786                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field type\n");
2787                 res = 0;
2788         }
2789
2790         if (!has_application) {
2791                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field application\n");
2792                 res = 0;
2793         }
2794
2795         if (!has_bridge) {
2796                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge\n");
2797                 res = 0;
2798         }
2799
2800         if (!has_bridge_from) {
2801                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge_from\n");
2802                 res = 0;
2803         }
2804
2805         return res;
2806 }
2807
2808 ari_validator ast_ari_validate_bridge_merged_fn(void)
2809 {
2810         return ast_ari_validate_bridge_merged;
2811 }
2812
2813 int ast_ari_validate_bridge_video_source_changed(struct ast_json *json)
2814 {
2815         int res = 1;
2816         struct ast_json_iter *iter;
2817         int has_type = 0;
2818         int has_application = 0;
2819         int has_bridge = 0;
2820
2821         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2822                 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2823                         int prop_is_valid;
2824                         prop_is_valid = ast_ari_validate_string(
2825                                 ast_json_object_iter_value(iter));
2826                         if (!prop_is_valid) {
2827                                 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field asterisk_id failed validation\n");
2828                                 res = 0;
2829                         }
2830                 } else
2831                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2832                         int prop_is_valid;
2833                         has_type = 1;
2834                         prop_is_valid = ast_ari_validate_string(
2835                                 ast_json_object_iter_value(iter));
2836                         if (!prop_is_valid) {
2837                                 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field type failed validation\n");
2838                                 res = 0;
2839                         }
2840                 } else
2841                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2842                         int prop_is_valid;
2843                         has_application = 1;
2844                         prop_is_valid = ast_ari_validate_string(
2845                                 ast_json_object_iter_value(iter));
2846                         if (!prop_is_valid) {
2847                                 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field application failed validation\n");
2848                                 res = 0;
2849                         }
2850                 } else
2851                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2852                         int prop_is_valid;
2853                         prop_is_valid = ast_ari_validate_date(
2854                                 ast_json_object_iter_value(iter));
2855                         if (!prop_is_valid) {
2856                                 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field timestamp failed validation\n");
2857                                 res = 0;
2858                         }
2859                 } else
2860                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2861                         int prop_is_valid;
2862                         has_bridge = 1;
2863                         prop_is_valid = ast_ari_validate_bridge(
2864                                 ast_json_object_iter_value(iter));
2865                         if (!prop_is_valid) {
2866                                 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field bridge failed validation\n");
2867                                 res = 0;
2868                         }
2869                 } else
2870                 if (strcmp("old_video_source_id", ast_json_object_iter_key(iter)) == 0) {
2871                         int prop_is_valid;
2872                         prop_is_valid = ast_ari_validate_string(
2873                                 ast_json_object_iter_value(iter));
2874                         if (!prop_is_valid) {
2875                                 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field old_video_source_id failed validation\n");
2876                                 res = 0;
2877                         }
2878                 } else
2879                 {
2880                         ast_log(LOG_ERROR,
2881                                 "ARI BridgeVideoSourceChanged has undocumented field %s\n",
2882                                 ast_json_object_iter_key(iter));
2883                         res = 0;
2884                 }
2885         }
2886
2887         if (!has_type) {
2888                 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged missing required field type\n");
2889                 res = 0;
2890         }
2891
2892         if (!has_application) {
2893                 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged missing required field application\n");
2894                 res = 0;
2895         }
2896
2897         if (!has_bridge) {
2898                 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged missing required field bridge\n");
2899                 res = 0;
2900         }
2901
2902         return res;
2903 }
2904
2905 ari_validator ast_ari_validate_bridge_video_source_changed_fn(void)
2906 {
2907         return ast_ari_validate_bridge_video_source_changed;
2908 }
2909
2910 int ast_ari_validate_channel_caller_id(struct ast_json *json)
2911 {
2912         int res = 1;
2913         struct ast_json_iter *iter;
2914         int has_type = 0;
2915         int has_application = 0;
2916         int has_caller_presentation = 0;
2917         int has_caller_presentation_txt = 0;
2918         int has_channel = 0;
2919
2920         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2921                 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2922                         int prop_is_valid;
2923                         prop_is_valid = ast_ari_validate_string(
2924                                 ast_json_object_iter_value(iter));
2925                         if (!prop_is_valid) {
2926                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field asterisk_id failed validation\n");
2927                                 res = 0;
2928                         }
2929                 } else
2930                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2931                         int prop_is_valid;
2932                         has_type = 1;
2933                         prop_is_valid = ast_ari_validate_string(
2934                                 ast_json_object_iter_value(iter));
2935                         if (!prop_is_valid) {
2936                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field type failed validation\n");
2937                                 res = 0;
2938                         }
2939                 } else
2940                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2941                         int prop_is_valid;
2942                         has_application = 1;
2943                         prop_is_valid = ast_ari_validate_string(
2944                                 ast_json_object_iter_value(iter));
2945                         if (!prop_is_valid) {
2946                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field application failed validation\n");
2947                                 res = 0;
2948                         }
2949                 } else
2950                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2951                         int prop_is_valid;
2952                         prop_is_valid = ast_ari_validate_date(
2953                                 ast_json_object_iter_value(iter));
2954                         if (!prop_is_valid) {
2955                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field timestamp failed validation\n");
2956                                 res = 0;
2957                         }
2958                 } else
2959                 if (strcmp("caller_presentation", ast_json_object_iter_key(iter)) == 0) {
2960                         int prop_is_valid;
2961                         has_caller_presentation = 1;
2962                         prop_is_valid = ast_ari_validate_int(
2963                                 ast_json_object_iter_value(iter));
2964                         if (!prop_is_valid) {
2965                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation failed validation\n");
2966                                 res = 0;
2967                         }
2968                 } else
2969                 if (strcmp("caller_presentation_txt", ast_json_object_iter_key(iter)) == 0) {
2970                         int prop_is_valid;
2971                         has_caller_presentation_txt = 1;
2972                         prop_is_valid = ast_ari_validate_string(
2973                                 ast_json_object_iter_value(iter));
2974                         if (!prop_is_valid) {
2975                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation_txt failed validation\n");
2976                                 res = 0;
2977                         }
2978                 } else
2979                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2980                         int prop_is_valid;
2981                         has_channel = 1;
2982                         prop_is_valid = ast_ari_validate_channel(
2983                                 ast_json_object_iter_value(iter));
2984                         if (!prop_is_valid) {
2985                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field channel failed validation\n");
2986                                 res = 0;
2987                         }
2988                 } else
2989                 {
2990                         ast_log(LOG_ERROR,
2991                                 "ARI ChannelCallerId has undocumented field %s\n",
2992                                 ast_json_object_iter_key(iter));
2993                         res = 0;
2994                 }
2995         }
2996
2997         if (!has_type) {
2998                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field type\n");
2999                 res = 0;
3000         }
3001
3002         if (!has_application) {
3003                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field application\n");
3004                 res = 0;
3005         }
3006
3007         if (!has_caller_presentation) {
3008                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation\n");
3009                 res = 0;
3010         }
3011
3012         if (!has_caller_presentation_txt) {
3013                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation_txt\n");
3014                 res = 0;
3015         }
3016
3017         if (!has_channel) {
3018                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field channel\n");
3019                 res = 0;
3020         }
3021
3022         return res;
3023 }
3024
3025 ari_validator ast_ari_validate_channel_caller_id_fn(void)
3026 {
3027         return ast_ari_validate_channel_caller_id;
3028 }
3029
3030 int ast_ari_validate_channel_connected_line(struct ast_json *json)
3031 {
3032         int res = 1;
3033         struct ast_json_iter *iter;
3034         int has_type = 0;
3035         int has_application = 0;
3036         int has_channel = 0;
3037
3038         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3039                 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3040                         int prop_is_valid;
3041                         prop_is_valid = ast_ari_validate_string(
3042                                 ast_json_object_iter_value(iter));
3043                         if (!prop_is_valid) {
3044                                 ast_log(LOG_ERROR, "ARI ChannelConnectedLine field asterisk_id failed validation\n");
3045                                 res = 0;
3046                         }
3047                 } else
3048                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3049                         int prop_is_valid;
3050                         has_type = 1;
3051                         prop_is_valid = ast_ari_validate_string(
3052                                 ast_json_object_iter_value(iter));
3053                         if (!prop_is_valid) {
3054                                 ast_log(LOG_ERROR, "ARI ChannelConnectedLine field type failed validation\n");
3055                                 res = 0;
3056                         }
3057                 } else
3058                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3059                         int prop_is_valid;
3060                         has_application = 1;
3061                         prop_is_valid = ast_ari_validate_string(
3062                                 ast_json_object_iter_value(iter));
3063                         if (!prop_is_valid) {
3064                                 ast_log(LOG_ERROR, "ARI ChannelConnectedLine field application failed validation\n");
3065                                 res = 0;
3066                         }
3067                 } else
3068                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3069                         int prop_is_valid;
3070                         prop_is_valid = ast_ari_validate_date(
3071                                 ast_json_object_iter_value(iter));
3072                         if (!prop_is_valid) {
3073                                 ast_log(LOG_ERROR, "ARI ChannelConnectedLine field timestamp failed validation\n");
3074                                 res = 0;
3075                         }
3076                 } else
3077                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
3078                         int prop_is_valid;
3079                         has_channel = 1;
3080                         prop_is_valid = ast_ari_validate_channel(
3081                                 ast_json_object_iter_value(iter));
3082                         if (!prop_is_valid) {
3083                                 ast_log(LOG_ERROR, "ARI ChannelConnectedLine field channel failed validation\n");
3084                                 res = 0;
3085                         }
3086                 } else
3087                 {
3088                         ast_log(LOG_ERROR,
3089                                 "ARI ChannelConnectedLine has undocumented field %s\n",
3090                                 ast_json_object_iter_key(iter));
3091                         res = 0;
3092                 }
3093         }
3094
3095         if (!has_type) {
3096                 ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field type\n");
3097                 res = 0;
3098         }
3099
3100         if (!has_application) {
3101                 ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field application\n");
3102                 res = 0;
3103         }
3104
3105         if (!has_channel) {
3106                 ast_log(LOG_ERROR, "ARI ChannelConnectedLine missing required field channel\n");
3107                 res = 0;
3108         }
3109
3110         return res;
3111 }
3112
3113 ari_validator ast_ari_validate_channel_connected_line_fn(void)
3114 {
3115         return ast_ari_validate_channel_connected_line;
3116 }
3117
3118 int ast_ari_validate_channel_created(struct ast_json *json)
3119 {
3120         int res = 1;
3121         struct ast_json_iter *iter;
3122         int has_type = 0;
3123         int has_application = 0;
3124         int has_channel = 0;
3125
3126         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3127                 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3128                         int prop_is_valid;
3129                         prop_is_valid = ast_ari_validate_string(
3130                                 ast_json_object_iter_value(iter));
3131                         if (!prop_is_valid) {
3132                                 ast_log(LOG_ERROR, "ARI ChannelCreated field asterisk_id failed validation\n");
3133                                 res = 0;
3134                         }
3135                 } else
3136                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3137                         int prop_is_valid;
3138                         has_type = 1;
3139                         prop_is_valid = ast_ari_validate_string(
3140                                 ast_json_object_iter_value(iter));
3141                         if (!prop_is_valid) {
3142                                 ast_log(LOG_ERROR, "ARI ChannelCreated field type failed validation\n");
3143                                 res = 0;
3144                         }
3145                 } else
3146                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3147                         int prop_is_valid;
3148                         has_application = 1;
3149                         prop_is_valid = ast_ari_validate_string(
3150                                 ast_json_object_iter_value(iter));
3151                         if (!prop_is_valid) {
3152                                 ast_log(LOG_ERROR, "ARI ChannelCreated field application failed validation\n");
3153                                 res = 0;
3154                         }
3155                 } else
3156                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3157                         int prop_is_valid;
3158                         prop_is_valid = ast_ari_validate_date(
3159                                 ast_json_object_iter_value(iter));
3160                         if (!prop_is_valid) {
3161                                 ast_log(LOG_ERROR, "ARI ChannelCreated field timestamp failed validation\n");
3162                                 res = 0;
3163                         }
3164                 } else
3165                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
3166                         int prop_is_valid;
3167                         has_channel = 1;
3168                         prop_is_valid = ast_ari_validate_channel(
3169                                 ast_json_object_iter_value(iter));
3170                         if (!prop_is_valid) {
3171                                 ast_log(LOG_ERROR, "ARI ChannelCreated field channel failed validation\n");
3172                                 res = 0;
3173