d5f1885ad7f373606a5842f618a05fbcce9fa2cc
[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_creationtime = 0;
1364         int has_creator = 0;
1365         int has_id = 0;
1366         int has_name = 0;
1367         int has_technology = 0;
1368
1369         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1370                 if (strcmp("bridge_class", ast_json_object_iter_key(iter)) == 0) {
1371                         int prop_is_valid;
1372                         has_bridge_class = 1;
1373                         prop_is_valid = ast_ari_validate_string(
1374                                 ast_json_object_iter_value(iter));
1375                         if (!prop_is_valid) {
1376                                 ast_log(LOG_ERROR, "ARI Bridge field bridge_class failed validation\n");
1377                                 res = 0;
1378                         }
1379                 } else
1380                 if (strcmp("bridge_type", ast_json_object_iter_key(iter)) == 0) {
1381                         int prop_is_valid;
1382                         has_bridge_type = 1;
1383                         prop_is_valid = ast_ari_validate_string(
1384                                 ast_json_object_iter_value(iter));
1385                         if (!prop_is_valid) {
1386                                 ast_log(LOG_ERROR, "ARI Bridge field bridge_type failed validation\n");
1387                                 res = 0;
1388                         }
1389                 } else
1390                 if (strcmp("channels", ast_json_object_iter_key(iter)) == 0) {
1391                         int prop_is_valid;
1392                         has_channels = 1;
1393                         prop_is_valid = ast_ari_validate_list(
1394                                 ast_json_object_iter_value(iter),
1395                                 ast_ari_validate_string);
1396                         if (!prop_is_valid) {
1397                                 ast_log(LOG_ERROR, "ARI Bridge field channels failed validation\n");
1398                                 res = 0;
1399                         }
1400                 } else
1401                 if (strcmp("creationtime", ast_json_object_iter_key(iter)) == 0) {
1402                         int prop_is_valid;
1403                         has_creationtime = 1;
1404                         prop_is_valid = ast_ari_validate_date(
1405                                 ast_json_object_iter_value(iter));
1406                         if (!prop_is_valid) {
1407                                 ast_log(LOG_ERROR, "ARI Bridge field creationtime failed validation\n");
1408                                 res = 0;
1409                         }
1410                 } else
1411                 if (strcmp("creator", ast_json_object_iter_key(iter)) == 0) {
1412                         int prop_is_valid;
1413                         has_creator = 1;
1414                         prop_is_valid = ast_ari_validate_string(
1415                                 ast_json_object_iter_value(iter));
1416                         if (!prop_is_valid) {
1417                                 ast_log(LOG_ERROR, "ARI Bridge field creator failed validation\n");
1418                                 res = 0;
1419                         }
1420                 } else
1421                 if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
1422                         int prop_is_valid;
1423                         has_id = 1;
1424                         prop_is_valid = ast_ari_validate_string(
1425                                 ast_json_object_iter_value(iter));
1426                         if (!prop_is_valid) {
1427                                 ast_log(LOG_ERROR, "ARI Bridge field id failed validation\n");
1428                                 res = 0;
1429                         }
1430                 } else
1431                 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1432                         int prop_is_valid;
1433                         has_name = 1;
1434                         prop_is_valid = ast_ari_validate_string(
1435                                 ast_json_object_iter_value(iter));
1436                         if (!prop_is_valid) {
1437                                 ast_log(LOG_ERROR, "ARI Bridge field name failed validation\n");
1438                                 res = 0;
1439                         }
1440                 } else
1441                 if (strcmp("technology", ast_json_object_iter_key(iter)) == 0) {
1442                         int prop_is_valid;
1443                         has_technology = 1;
1444                         prop_is_valid = ast_ari_validate_string(
1445                                 ast_json_object_iter_value(iter));
1446                         if (!prop_is_valid) {
1447                                 ast_log(LOG_ERROR, "ARI Bridge field technology failed validation\n");
1448                                 res = 0;
1449                         }
1450                 } else
1451                 if (strcmp("video_mode", ast_json_object_iter_key(iter)) == 0) {
1452                         int prop_is_valid;
1453                         prop_is_valid = ast_ari_validate_string(
1454                                 ast_json_object_iter_value(iter));
1455                         if (!prop_is_valid) {
1456                                 ast_log(LOG_ERROR, "ARI Bridge field video_mode failed validation\n");
1457                                 res = 0;
1458                         }
1459                 } else
1460                 if (strcmp("video_source_id", ast_json_object_iter_key(iter)) == 0) {
1461                         int prop_is_valid;
1462                         prop_is_valid = ast_ari_validate_string(
1463                                 ast_json_object_iter_value(iter));
1464                         if (!prop_is_valid) {
1465                                 ast_log(LOG_ERROR, "ARI Bridge field video_source_id failed validation\n");
1466                                 res = 0;
1467                         }
1468                 } else
1469                 {
1470                         ast_log(LOG_ERROR,
1471                                 "ARI Bridge has undocumented field %s\n",
1472                                 ast_json_object_iter_key(iter));
1473                         res = 0;
1474                 }
1475         }
1476
1477         if (!has_bridge_class) {
1478                 ast_log(LOG_ERROR, "ARI Bridge missing required field bridge_class\n");
1479                 res = 0;
1480         }
1481
1482         if (!has_bridge_type) {
1483                 ast_log(LOG_ERROR, "ARI Bridge missing required field bridge_type\n");
1484                 res = 0;
1485         }
1486
1487         if (!has_channels) {
1488                 ast_log(LOG_ERROR, "ARI Bridge missing required field channels\n");
1489                 res = 0;
1490         }
1491
1492         if (!has_creationtime) {
1493                 ast_log(LOG_ERROR, "ARI Bridge missing required field creationtime\n");
1494                 res = 0;
1495         }
1496
1497         if (!has_creator) {
1498                 ast_log(LOG_ERROR, "ARI Bridge missing required field creator\n");
1499                 res = 0;
1500         }
1501
1502         if (!has_id) {
1503                 ast_log(LOG_ERROR, "ARI Bridge missing required field id\n");
1504                 res = 0;
1505         }
1506
1507         if (!has_name) {
1508                 ast_log(LOG_ERROR, "ARI Bridge missing required field name\n");
1509                 res = 0;
1510         }
1511
1512         if (!has_technology) {
1513                 ast_log(LOG_ERROR, "ARI Bridge missing required field technology\n");
1514                 res = 0;
1515         }
1516
1517         return res;
1518 }
1519
1520 ari_validator ast_ari_validate_bridge_fn(void)
1521 {
1522         return ast_ari_validate_bridge;
1523 }
1524
1525 int ast_ari_validate_live_recording(struct ast_json *json)
1526 {
1527         int res = 1;
1528         struct ast_json_iter *iter;
1529         int has_format = 0;
1530         int has_name = 0;
1531         int has_state = 0;
1532         int has_target_uri = 0;
1533
1534         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1535                 if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
1536                         int prop_is_valid;
1537                         prop_is_valid = ast_ari_validate_string(
1538                                 ast_json_object_iter_value(iter));
1539                         if (!prop_is_valid) {
1540                                 ast_log(LOG_ERROR, "ARI LiveRecording field cause failed validation\n");
1541                                 res = 0;
1542                         }
1543                 } else
1544                 if (strcmp("duration", ast_json_object_iter_key(iter)) == 0) {
1545                         int prop_is_valid;
1546                         prop_is_valid = ast_ari_validate_int(
1547                                 ast_json_object_iter_value(iter));
1548                         if (!prop_is_valid) {
1549                                 ast_log(LOG_ERROR, "ARI LiveRecording field duration failed validation\n");
1550                                 res = 0;
1551                         }
1552                 } else
1553                 if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
1554                         int prop_is_valid;
1555                         has_format = 1;
1556                         prop_is_valid = ast_ari_validate_string(
1557                                 ast_json_object_iter_value(iter));
1558                         if (!prop_is_valid) {
1559                                 ast_log(LOG_ERROR, "ARI LiveRecording field format failed validation\n");
1560                                 res = 0;
1561                         }
1562                 } else
1563                 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1564                         int prop_is_valid;
1565                         has_name = 1;
1566                         prop_is_valid = ast_ari_validate_string(
1567                                 ast_json_object_iter_value(iter));
1568                         if (!prop_is_valid) {
1569                                 ast_log(LOG_ERROR, "ARI LiveRecording field name failed validation\n");
1570                                 res = 0;
1571                         }
1572                 } else
1573                 if (strcmp("silence_duration", ast_json_object_iter_key(iter)) == 0) {
1574                         int prop_is_valid;
1575                         prop_is_valid = ast_ari_validate_int(
1576                                 ast_json_object_iter_value(iter));
1577                         if (!prop_is_valid) {
1578                                 ast_log(LOG_ERROR, "ARI LiveRecording field silence_duration failed validation\n");
1579                                 res = 0;
1580                         }
1581                 } else
1582                 if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
1583                         int prop_is_valid;
1584                         has_state = 1;
1585                         prop_is_valid = ast_ari_validate_string(
1586                                 ast_json_object_iter_value(iter));
1587                         if (!prop_is_valid) {
1588                                 ast_log(LOG_ERROR, "ARI LiveRecording field state failed validation\n");
1589                                 res = 0;
1590                         }
1591                 } else
1592                 if (strcmp("talking_duration", ast_json_object_iter_key(iter)) == 0) {
1593                         int prop_is_valid;
1594                         prop_is_valid = ast_ari_validate_int(
1595                                 ast_json_object_iter_value(iter));
1596                         if (!prop_is_valid) {
1597                                 ast_log(LOG_ERROR, "ARI LiveRecording field talking_duration failed validation\n");
1598                                 res = 0;
1599                         }
1600                 } else
1601                 if (strcmp("target_uri", ast_json_object_iter_key(iter)) == 0) {
1602                         int prop_is_valid;
1603                         has_target_uri = 1;
1604                         prop_is_valid = ast_ari_validate_string(
1605                                 ast_json_object_iter_value(iter));
1606                         if (!prop_is_valid) {
1607                                 ast_log(LOG_ERROR, "ARI LiveRecording field target_uri failed validation\n");
1608                                 res = 0;
1609                         }
1610                 } else
1611                 {
1612                         ast_log(LOG_ERROR,
1613                                 "ARI LiveRecording has undocumented field %s\n",
1614                                 ast_json_object_iter_key(iter));
1615                         res = 0;
1616                 }
1617         }
1618
1619         if (!has_format) {
1620                 ast_log(LOG_ERROR, "ARI LiveRecording missing required field format\n");
1621                 res = 0;
1622         }
1623
1624         if (!has_name) {
1625                 ast_log(LOG_ERROR, "ARI LiveRecording missing required field name\n");
1626                 res = 0;
1627         }
1628
1629         if (!has_state) {
1630                 ast_log(LOG_ERROR, "ARI LiveRecording missing required field state\n");
1631                 res = 0;
1632         }
1633
1634         if (!has_target_uri) {
1635                 ast_log(LOG_ERROR, "ARI LiveRecording missing required field target_uri\n");
1636                 res = 0;
1637         }
1638
1639         return res;
1640 }
1641
1642 ari_validator ast_ari_validate_live_recording_fn(void)
1643 {
1644         return ast_ari_validate_live_recording;
1645 }
1646
1647 int ast_ari_validate_stored_recording(struct ast_json *json)
1648 {
1649         int res = 1;
1650         struct ast_json_iter *iter;
1651         int has_format = 0;
1652         int has_name = 0;
1653
1654         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1655                 if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
1656                         int prop_is_valid;
1657                         has_format = 1;
1658                         prop_is_valid = ast_ari_validate_string(
1659                                 ast_json_object_iter_value(iter));
1660                         if (!prop_is_valid) {
1661                                 ast_log(LOG_ERROR, "ARI StoredRecording field format failed validation\n");
1662                                 res = 0;
1663                         }
1664                 } else
1665                 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1666                         int prop_is_valid;
1667                         has_name = 1;
1668                         prop_is_valid = ast_ari_validate_string(
1669                                 ast_json_object_iter_value(iter));
1670                         if (!prop_is_valid) {
1671                                 ast_log(LOG_ERROR, "ARI StoredRecording field name failed validation\n");
1672                                 res = 0;
1673                         }
1674                 } else
1675                 {
1676                         ast_log(LOG_ERROR,
1677                                 "ARI StoredRecording has undocumented field %s\n",
1678                                 ast_json_object_iter_key(iter));
1679                         res = 0;
1680                 }
1681         }
1682
1683         if (!has_format) {
1684                 ast_log(LOG_ERROR, "ARI StoredRecording missing required field format\n");
1685                 res = 0;
1686         }
1687
1688         if (!has_name) {
1689                 ast_log(LOG_ERROR, "ARI StoredRecording missing required field name\n");
1690                 res = 0;
1691         }
1692
1693         return res;
1694 }
1695
1696 ari_validator ast_ari_validate_stored_recording_fn(void)
1697 {
1698         return ast_ari_validate_stored_recording;
1699 }
1700
1701 int ast_ari_validate_format_lang_pair(struct ast_json *json)
1702 {
1703         int res = 1;
1704         struct ast_json_iter *iter;
1705         int has_format = 0;
1706         int has_language = 0;
1707
1708         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1709                 if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
1710                         int prop_is_valid;
1711                         has_format = 1;
1712                         prop_is_valid = ast_ari_validate_string(
1713                                 ast_json_object_iter_value(iter));
1714                         if (!prop_is_valid) {
1715                                 ast_log(LOG_ERROR, "ARI FormatLangPair field format failed validation\n");
1716                                 res = 0;
1717                         }
1718                 } else
1719                 if (strcmp("language", ast_json_object_iter_key(iter)) == 0) {
1720                         int prop_is_valid;
1721                         has_language = 1;
1722                         prop_is_valid = ast_ari_validate_string(
1723                                 ast_json_object_iter_value(iter));
1724                         if (!prop_is_valid) {
1725                                 ast_log(LOG_ERROR, "ARI FormatLangPair field language failed validation\n");
1726                                 res = 0;
1727                         }
1728                 } else
1729                 {
1730                         ast_log(LOG_ERROR,
1731                                 "ARI FormatLangPair has undocumented field %s\n",
1732                                 ast_json_object_iter_key(iter));
1733                         res = 0;
1734                 }
1735         }
1736
1737         if (!has_format) {
1738                 ast_log(LOG_ERROR, "ARI FormatLangPair missing required field format\n");
1739                 res = 0;
1740         }
1741
1742         if (!has_language) {
1743                 ast_log(LOG_ERROR, "ARI FormatLangPair missing required field language\n");
1744                 res = 0;
1745         }
1746
1747         return res;
1748 }
1749
1750 ari_validator ast_ari_validate_format_lang_pair_fn(void)
1751 {
1752         return ast_ari_validate_format_lang_pair;
1753 }
1754
1755 int ast_ari_validate_sound(struct ast_json *json)
1756 {
1757         int res = 1;
1758         struct ast_json_iter *iter;
1759         int has_formats = 0;
1760         int has_id = 0;
1761
1762         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1763                 if (strcmp("formats", ast_json_object_iter_key(iter)) == 0) {
1764                         int prop_is_valid;
1765                         has_formats = 1;
1766                         prop_is_valid = ast_ari_validate_list(
1767                                 ast_json_object_iter_value(iter),
1768                                 ast_ari_validate_format_lang_pair);
1769                         if (!prop_is_valid) {
1770                                 ast_log(LOG_ERROR, "ARI Sound field formats failed validation\n");
1771                                 res = 0;
1772                         }
1773                 } else
1774                 if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
1775                         int prop_is_valid;
1776                         has_id = 1;
1777                         prop_is_valid = ast_ari_validate_string(
1778                                 ast_json_object_iter_value(iter));
1779                         if (!prop_is_valid) {
1780                                 ast_log(LOG_ERROR, "ARI Sound field id failed validation\n");
1781                                 res = 0;
1782                         }
1783                 } else
1784                 if (strcmp("text", ast_json_object_iter_key(iter)) == 0) {
1785                         int prop_is_valid;
1786                         prop_is_valid = ast_ari_validate_string(
1787                                 ast_json_object_iter_value(iter));
1788                         if (!prop_is_valid) {
1789                                 ast_log(LOG_ERROR, "ARI Sound field text failed validation\n");
1790                                 res = 0;
1791                         }
1792                 } else
1793                 {
1794                         ast_log(LOG_ERROR,
1795                                 "ARI Sound has undocumented field %s\n",
1796                                 ast_json_object_iter_key(iter));
1797                         res = 0;
1798                 }
1799         }
1800
1801         if (!has_formats) {
1802                 ast_log(LOG_ERROR, "ARI Sound missing required field formats\n");
1803                 res = 0;
1804         }
1805
1806         if (!has_id) {
1807                 ast_log(LOG_ERROR, "ARI Sound missing required field id\n");
1808                 res = 0;
1809         }
1810
1811         return res;
1812 }
1813
1814 ari_validator ast_ari_validate_sound_fn(void)
1815 {
1816         return ast_ari_validate_sound;
1817 }
1818
1819 int ast_ari_validate_playback(struct ast_json *json)
1820 {
1821         int res = 1;
1822         struct ast_json_iter *iter;
1823         int has_id = 0;
1824         int has_media_uri = 0;
1825         int has_state = 0;
1826         int has_target_uri = 0;
1827
1828         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1829                 if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
1830                         int prop_is_valid;
1831                         has_id = 1;
1832                         prop_is_valid = ast_ari_validate_string(
1833                                 ast_json_object_iter_value(iter));
1834                         if (!prop_is_valid) {
1835                                 ast_log(LOG_ERROR, "ARI Playback field id failed validation\n");
1836                                 res = 0;
1837                         }
1838                 } else
1839                 if (strcmp("language", ast_json_object_iter_key(iter)) == 0) {
1840                         int prop_is_valid;
1841                         prop_is_valid = ast_ari_validate_string(
1842                                 ast_json_object_iter_value(iter));
1843                         if (!prop_is_valid) {
1844                                 ast_log(LOG_ERROR, "ARI Playback field language failed validation\n");
1845                                 res = 0;
1846                         }
1847                 } else
1848                 if (strcmp("media_uri", ast_json_object_iter_key(iter)) == 0) {
1849                         int prop_is_valid;
1850                         has_media_uri = 1;
1851                         prop_is_valid = ast_ari_validate_string(
1852                                 ast_json_object_iter_value(iter));
1853                         if (!prop_is_valid) {
1854                                 ast_log(LOG_ERROR, "ARI Playback field media_uri failed validation\n");
1855                                 res = 0;
1856                         }
1857                 } else
1858                 if (strcmp("next_media_uri", ast_json_object_iter_key(iter)) == 0) {
1859                         int prop_is_valid;
1860                         prop_is_valid = ast_ari_validate_string(
1861                                 ast_json_object_iter_value(iter));
1862                         if (!prop_is_valid) {
1863                                 ast_log(LOG_ERROR, "ARI Playback field next_media_uri failed validation\n");
1864                                 res = 0;
1865                         }
1866                 } else
1867                 if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
1868                         int prop_is_valid;
1869                         has_state = 1;
1870                         prop_is_valid = ast_ari_validate_string(
1871                                 ast_json_object_iter_value(iter));
1872                         if (!prop_is_valid) {
1873                                 ast_log(LOG_ERROR, "ARI Playback field state failed validation\n");
1874                                 res = 0;
1875                         }
1876                 } else
1877                 if (strcmp("target_uri", ast_json_object_iter_key(iter)) == 0) {
1878                         int prop_is_valid;
1879                         has_target_uri = 1;
1880                         prop_is_valid = ast_ari_validate_string(
1881                                 ast_json_object_iter_value(iter));
1882                         if (!prop_is_valid) {
1883                                 ast_log(LOG_ERROR, "ARI Playback field target_uri failed validation\n");
1884                                 res = 0;
1885                         }
1886                 } else
1887                 {
1888                         ast_log(LOG_ERROR,
1889                                 "ARI Playback has undocumented field %s\n",
1890                                 ast_json_object_iter_key(iter));
1891                         res = 0;
1892                 }
1893         }
1894
1895         if (!has_id) {
1896                 ast_log(LOG_ERROR, "ARI Playback missing required field id\n");
1897                 res = 0;
1898         }
1899
1900         if (!has_media_uri) {
1901                 ast_log(LOG_ERROR, "ARI Playback missing required field media_uri\n");
1902                 res = 0;
1903         }
1904
1905         if (!has_state) {
1906                 ast_log(LOG_ERROR, "ARI Playback missing required field state\n");
1907                 res = 0;
1908         }
1909
1910         if (!has_target_uri) {
1911                 ast_log(LOG_ERROR, "ARI Playback missing required field target_uri\n");
1912                 res = 0;
1913         }
1914
1915         return res;
1916 }
1917
1918 ari_validator ast_ari_validate_playback_fn(void)
1919 {
1920         return ast_ari_validate_playback;
1921 }
1922
1923 int ast_ari_validate_device_state(struct ast_json *json)
1924 {
1925         int res = 1;
1926         struct ast_json_iter *iter;
1927         int has_name = 0;
1928         int has_state = 0;
1929
1930         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1931                 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1932                         int prop_is_valid;
1933                         has_name = 1;
1934                         prop_is_valid = ast_ari_validate_string(
1935                                 ast_json_object_iter_value(iter));
1936                         if (!prop_is_valid) {
1937                                 ast_log(LOG_ERROR, "ARI DeviceState field name failed validation\n");
1938                                 res = 0;
1939                         }
1940                 } else
1941                 if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
1942                         int prop_is_valid;
1943                         has_state = 1;
1944                         prop_is_valid = ast_ari_validate_string(
1945                                 ast_json_object_iter_value(iter));
1946                         if (!prop_is_valid) {
1947                                 ast_log(LOG_ERROR, "ARI DeviceState field state failed validation\n");
1948                                 res = 0;
1949                         }
1950                 } else
1951                 {
1952                         ast_log(LOG_ERROR,
1953                                 "ARI DeviceState has undocumented field %s\n",
1954                                 ast_json_object_iter_key(iter));
1955                         res = 0;
1956                 }
1957         }
1958
1959         if (!has_name) {
1960                 ast_log(LOG_ERROR, "ARI DeviceState missing required field name\n");
1961                 res = 0;
1962         }
1963
1964         if (!has_state) {
1965                 ast_log(LOG_ERROR, "ARI DeviceState missing required field state\n");
1966                 res = 0;
1967         }
1968
1969         return res;
1970 }
1971
1972 ari_validator ast_ari_validate_device_state_fn(void)
1973 {
1974         return ast_ari_validate_device_state;
1975 }
1976
1977 int ast_ari_validate_mailbox(struct ast_json *json)
1978 {
1979         int res = 1;
1980         struct ast_json_iter *iter;
1981         int has_name = 0;
1982         int has_new_messages = 0;
1983         int has_old_messages = 0;
1984
1985         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
1986                 if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
1987                         int prop_is_valid;
1988                         has_name = 1;
1989                         prop_is_valid = ast_ari_validate_string(
1990                                 ast_json_object_iter_value(iter));
1991                         if (!prop_is_valid) {
1992                                 ast_log(LOG_ERROR, "ARI Mailbox field name failed validation\n");
1993                                 res = 0;
1994                         }
1995                 } else
1996                 if (strcmp("new_messages", ast_json_object_iter_key(iter)) == 0) {
1997                         int prop_is_valid;
1998                         has_new_messages = 1;
1999                         prop_is_valid = ast_ari_validate_int(
2000                                 ast_json_object_iter_value(iter));
2001                         if (!prop_is_valid) {
2002                                 ast_log(LOG_ERROR, "ARI Mailbox field new_messages failed validation\n");
2003                                 res = 0;
2004                         }
2005                 } else
2006                 if (strcmp("old_messages", ast_json_object_iter_key(iter)) == 0) {
2007                         int prop_is_valid;
2008                         has_old_messages = 1;
2009                         prop_is_valid = ast_ari_validate_int(
2010                                 ast_json_object_iter_value(iter));
2011                         if (!prop_is_valid) {
2012                                 ast_log(LOG_ERROR, "ARI Mailbox field old_messages failed validation\n");
2013                                 res = 0;
2014                         }
2015                 } else
2016                 {
2017                         ast_log(LOG_ERROR,
2018                                 "ARI Mailbox has undocumented field %s\n",
2019                                 ast_json_object_iter_key(iter));
2020                         res = 0;
2021                 }
2022         }
2023
2024         if (!has_name) {
2025                 ast_log(LOG_ERROR, "ARI Mailbox missing required field name\n");
2026                 res = 0;
2027         }
2028
2029         if (!has_new_messages) {
2030                 ast_log(LOG_ERROR, "ARI Mailbox missing required field new_messages\n");
2031                 res = 0;
2032         }
2033
2034         if (!has_old_messages) {
2035                 ast_log(LOG_ERROR, "ARI Mailbox missing required field old_messages\n");
2036                 res = 0;
2037         }
2038
2039         return res;
2040 }
2041
2042 ari_validator ast_ari_validate_mailbox_fn(void)
2043 {
2044         return ast_ari_validate_mailbox;
2045 }
2046
2047 int ast_ari_validate_application_move_failed(struct ast_json *json)
2048 {
2049         int res = 1;
2050         struct ast_json_iter *iter;
2051         int has_type = 0;
2052         int has_application = 0;
2053         int has_args = 0;
2054         int has_channel = 0;
2055         int has_destination = 0;
2056
2057         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2058                 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2059                         int prop_is_valid;
2060                         prop_is_valid = ast_ari_validate_string(
2061                                 ast_json_object_iter_value(iter));
2062                         if (!prop_is_valid) {
2063                                 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field asterisk_id failed validation\n");
2064                                 res = 0;
2065                         }
2066                 } else
2067                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2068                         int prop_is_valid;
2069                         has_type = 1;
2070                         prop_is_valid = ast_ari_validate_string(
2071                                 ast_json_object_iter_value(iter));
2072                         if (!prop_is_valid) {
2073                                 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field type failed validation\n");
2074                                 res = 0;
2075                         }
2076                 } else
2077                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2078                         int prop_is_valid;
2079                         has_application = 1;
2080                         prop_is_valid = ast_ari_validate_string(
2081                                 ast_json_object_iter_value(iter));
2082                         if (!prop_is_valid) {
2083                                 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field application failed validation\n");
2084                                 res = 0;
2085                         }
2086                 } else
2087                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2088                         int prop_is_valid;
2089                         prop_is_valid = ast_ari_validate_date(
2090                                 ast_json_object_iter_value(iter));
2091                         if (!prop_is_valid) {
2092                                 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field timestamp failed validation\n");
2093                                 res = 0;
2094                         }
2095                 } else
2096                 if (strcmp("args", ast_json_object_iter_key(iter)) == 0) {
2097                         int prop_is_valid;
2098                         has_args = 1;
2099                         prop_is_valid = ast_ari_validate_list(
2100                                 ast_json_object_iter_value(iter),
2101                                 ast_ari_validate_string);
2102                         if (!prop_is_valid) {
2103                                 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field args failed validation\n");
2104                                 res = 0;
2105                         }
2106                 } else
2107                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2108                         int prop_is_valid;
2109                         has_channel = 1;
2110                         prop_is_valid = ast_ari_validate_channel(
2111                                 ast_json_object_iter_value(iter));
2112                         if (!prop_is_valid) {
2113                                 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field channel failed validation\n");
2114                                 res = 0;
2115                         }
2116                 } else
2117                 if (strcmp("destination", ast_json_object_iter_key(iter)) == 0) {
2118                         int prop_is_valid;
2119                         has_destination = 1;
2120                         prop_is_valid = ast_ari_validate_string(
2121                                 ast_json_object_iter_value(iter));
2122                         if (!prop_is_valid) {
2123                                 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed field destination failed validation\n");
2124                                 res = 0;
2125                         }
2126                 } else
2127                 {
2128                         ast_log(LOG_ERROR,
2129                                 "ARI ApplicationMoveFailed has undocumented field %s\n",
2130                                 ast_json_object_iter_key(iter));
2131                         res = 0;
2132                 }
2133         }
2134
2135         if (!has_type) {
2136                 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed missing required field type\n");
2137                 res = 0;
2138         }
2139
2140         if (!has_application) {
2141                 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed missing required field application\n");
2142                 res = 0;
2143         }
2144
2145         if (!has_args) {
2146                 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed missing required field args\n");
2147                 res = 0;
2148         }
2149
2150         if (!has_channel) {
2151                 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed missing required field channel\n");
2152                 res = 0;
2153         }
2154
2155         if (!has_destination) {
2156                 ast_log(LOG_ERROR, "ARI ApplicationMoveFailed missing required field destination\n");
2157                 res = 0;
2158         }
2159
2160         return res;
2161 }
2162
2163 ari_validator ast_ari_validate_application_move_failed_fn(void)
2164 {
2165         return ast_ari_validate_application_move_failed;
2166 }
2167
2168 int ast_ari_validate_application_replaced(struct ast_json *json)
2169 {
2170         int res = 1;
2171         struct ast_json_iter *iter;
2172         int has_type = 0;
2173         int has_application = 0;
2174
2175         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2176                 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2177                         int prop_is_valid;
2178                         prop_is_valid = ast_ari_validate_string(
2179                                 ast_json_object_iter_value(iter));
2180                         if (!prop_is_valid) {
2181                                 ast_log(LOG_ERROR, "ARI ApplicationReplaced field asterisk_id failed validation\n");
2182                                 res = 0;
2183                         }
2184                 } else
2185                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2186                         int prop_is_valid;
2187                         has_type = 1;
2188                         prop_is_valid = ast_ari_validate_string(
2189                                 ast_json_object_iter_value(iter));
2190                         if (!prop_is_valid) {
2191                                 ast_log(LOG_ERROR, "ARI ApplicationReplaced field type failed validation\n");
2192                                 res = 0;
2193                         }
2194                 } else
2195                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2196                         int prop_is_valid;
2197                         has_application = 1;
2198                         prop_is_valid = ast_ari_validate_string(
2199                                 ast_json_object_iter_value(iter));
2200                         if (!prop_is_valid) {
2201                                 ast_log(LOG_ERROR, "ARI ApplicationReplaced field application failed validation\n");
2202                                 res = 0;
2203                         }
2204                 } else
2205                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2206                         int prop_is_valid;
2207                         prop_is_valid = ast_ari_validate_date(
2208                                 ast_json_object_iter_value(iter));
2209                         if (!prop_is_valid) {
2210                                 ast_log(LOG_ERROR, "ARI ApplicationReplaced field timestamp failed validation\n");
2211                                 res = 0;
2212                         }
2213                 } else
2214                 {
2215                         ast_log(LOG_ERROR,
2216                                 "ARI ApplicationReplaced has undocumented field %s\n",
2217                                 ast_json_object_iter_key(iter));
2218                         res = 0;
2219                 }
2220         }
2221
2222         if (!has_type) {
2223                 ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field type\n");
2224                 res = 0;
2225         }
2226
2227         if (!has_application) {
2228                 ast_log(LOG_ERROR, "ARI ApplicationReplaced missing required field application\n");
2229                 res = 0;
2230         }
2231
2232         return res;
2233 }
2234
2235 ari_validator ast_ari_validate_application_replaced_fn(void)
2236 {
2237         return ast_ari_validate_application_replaced;
2238 }
2239
2240 int ast_ari_validate_bridge_attended_transfer(struct ast_json *json)
2241 {
2242         int res = 1;
2243         struct ast_json_iter *iter;
2244         int has_type = 0;
2245         int has_application = 0;
2246         int has_destination_type = 0;
2247         int has_is_external = 0;
2248         int has_result = 0;
2249         int has_transferer_first_leg = 0;
2250         int has_transferer_second_leg = 0;
2251
2252         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2253                 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2254                         int prop_is_valid;
2255                         prop_is_valid = ast_ari_validate_string(
2256                                 ast_json_object_iter_value(iter));
2257                         if (!prop_is_valid) {
2258                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field asterisk_id failed validation\n");
2259                                 res = 0;
2260                         }
2261                 } else
2262                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2263                         int prop_is_valid;
2264                         has_type = 1;
2265                         prop_is_valid = ast_ari_validate_string(
2266                                 ast_json_object_iter_value(iter));
2267                         if (!prop_is_valid) {
2268                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field type failed validation\n");
2269                                 res = 0;
2270                         }
2271                 } else
2272                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2273                         int prop_is_valid;
2274                         has_application = 1;
2275                         prop_is_valid = ast_ari_validate_string(
2276                                 ast_json_object_iter_value(iter));
2277                         if (!prop_is_valid) {
2278                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field application failed validation\n");
2279                                 res = 0;
2280                         }
2281                 } else
2282                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2283                         int prop_is_valid;
2284                         prop_is_valid = ast_ari_validate_date(
2285                                 ast_json_object_iter_value(iter));
2286                         if (!prop_is_valid) {
2287                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field timestamp failed validation\n");
2288                                 res = 0;
2289                         }
2290                 } else
2291                 if (strcmp("destination_application", ast_json_object_iter_key(iter)) == 0) {
2292                         int prop_is_valid;
2293                         prop_is_valid = ast_ari_validate_string(
2294                                 ast_json_object_iter_value(iter));
2295                         if (!prop_is_valid) {
2296                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_application failed validation\n");
2297                                 res = 0;
2298                         }
2299                 } else
2300                 if (strcmp("destination_bridge", ast_json_object_iter_key(iter)) == 0) {
2301                         int prop_is_valid;
2302                         prop_is_valid = ast_ari_validate_string(
2303                                 ast_json_object_iter_value(iter));
2304                         if (!prop_is_valid) {
2305                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_bridge failed validation\n");
2306                                 res = 0;
2307                         }
2308                 } else
2309                 if (strcmp("destination_link_first_leg", ast_json_object_iter_key(iter)) == 0) {
2310                         int prop_is_valid;
2311                         prop_is_valid = ast_ari_validate_channel(
2312                                 ast_json_object_iter_value(iter));
2313                         if (!prop_is_valid) {
2314                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_link_first_leg failed validation\n");
2315                                 res = 0;
2316                         }
2317                 } else
2318                 if (strcmp("destination_link_second_leg", ast_json_object_iter_key(iter)) == 0) {
2319                         int prop_is_valid;
2320                         prop_is_valid = ast_ari_validate_channel(
2321                                 ast_json_object_iter_value(iter));
2322                         if (!prop_is_valid) {
2323                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_link_second_leg failed validation\n");
2324                                 res = 0;
2325                         }
2326                 } else
2327                 if (strcmp("destination_threeway_bridge", ast_json_object_iter_key(iter)) == 0) {
2328                         int prop_is_valid;
2329                         prop_is_valid = ast_ari_validate_bridge(
2330                                 ast_json_object_iter_value(iter));
2331                         if (!prop_is_valid) {
2332                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_threeway_bridge failed validation\n");
2333                                 res = 0;
2334                         }
2335                 } else
2336                 if (strcmp("destination_threeway_channel", ast_json_object_iter_key(iter)) == 0) {
2337                         int prop_is_valid;
2338                         prop_is_valid = ast_ari_validate_channel(
2339                                 ast_json_object_iter_value(iter));
2340                         if (!prop_is_valid) {
2341                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_threeway_channel failed validation\n");
2342                                 res = 0;
2343                         }
2344                 } else
2345                 if (strcmp("destination_type", ast_json_object_iter_key(iter)) == 0) {
2346                         int prop_is_valid;
2347                         has_destination_type = 1;
2348                         prop_is_valid = ast_ari_validate_string(
2349                                 ast_json_object_iter_value(iter));
2350                         if (!prop_is_valid) {
2351                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field destination_type failed validation\n");
2352                                 res = 0;
2353                         }
2354                 } else
2355                 if (strcmp("is_external", ast_json_object_iter_key(iter)) == 0) {
2356                         int prop_is_valid;
2357                         has_is_external = 1;
2358                         prop_is_valid = ast_ari_validate_boolean(
2359                                 ast_json_object_iter_value(iter));
2360                         if (!prop_is_valid) {
2361                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field is_external failed validation\n");
2362                                 res = 0;
2363                         }
2364                 } else
2365                 if (strcmp("replace_channel", ast_json_object_iter_key(iter)) == 0) {
2366                         int prop_is_valid;
2367                         prop_is_valid = ast_ari_validate_channel(
2368                                 ast_json_object_iter_value(iter));
2369                         if (!prop_is_valid) {
2370                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field replace_channel failed validation\n");
2371                                 res = 0;
2372                         }
2373                 } else
2374                 if (strcmp("result", ast_json_object_iter_key(iter)) == 0) {
2375                         int prop_is_valid;
2376                         has_result = 1;
2377                         prop_is_valid = ast_ari_validate_string(
2378                                 ast_json_object_iter_value(iter));
2379                         if (!prop_is_valid) {
2380                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field result failed validation\n");
2381                                 res = 0;
2382                         }
2383                 } else
2384                 if (strcmp("transfer_target", ast_json_object_iter_key(iter)) == 0) {
2385                         int prop_is_valid;
2386                         prop_is_valid = ast_ari_validate_channel(
2387                                 ast_json_object_iter_value(iter));
2388                         if (!prop_is_valid) {
2389                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transfer_target failed validation\n");
2390                                 res = 0;
2391                         }
2392                 } else
2393                 if (strcmp("transferee", ast_json_object_iter_key(iter)) == 0) {
2394                         int prop_is_valid;
2395                         prop_is_valid = ast_ari_validate_channel(
2396                                 ast_json_object_iter_value(iter));
2397                         if (!prop_is_valid) {
2398                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferee failed validation\n");
2399                                 res = 0;
2400                         }
2401                 } else
2402                 if (strcmp("transferer_first_leg", ast_json_object_iter_key(iter)) == 0) {
2403                         int prop_is_valid;
2404                         has_transferer_first_leg = 1;
2405                         prop_is_valid = ast_ari_validate_channel(
2406                                 ast_json_object_iter_value(iter));
2407                         if (!prop_is_valid) {
2408                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_first_leg failed validation\n");
2409                                 res = 0;
2410                         }
2411                 } else
2412                 if (strcmp("transferer_first_leg_bridge", ast_json_object_iter_key(iter)) == 0) {
2413                         int prop_is_valid;
2414                         prop_is_valid = ast_ari_validate_bridge(
2415                                 ast_json_object_iter_value(iter));
2416                         if (!prop_is_valid) {
2417                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_first_leg_bridge failed validation\n");
2418                                 res = 0;
2419                         }
2420                 } else
2421                 if (strcmp("transferer_second_leg", ast_json_object_iter_key(iter)) == 0) {
2422                         int prop_is_valid;
2423                         has_transferer_second_leg = 1;
2424                         prop_is_valid = ast_ari_validate_channel(
2425                                 ast_json_object_iter_value(iter));
2426                         if (!prop_is_valid) {
2427                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_second_leg failed validation\n");
2428                                 res = 0;
2429                         }
2430                 } else
2431                 if (strcmp("transferer_second_leg_bridge", ast_json_object_iter_key(iter)) == 0) {
2432                         int prop_is_valid;
2433                         prop_is_valid = ast_ari_validate_bridge(
2434                                 ast_json_object_iter_value(iter));
2435                         if (!prop_is_valid) {
2436                                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer field transferer_second_leg_bridge failed validation\n");
2437                                 res = 0;
2438                         }
2439                 } else
2440                 {
2441                         ast_log(LOG_ERROR,
2442                                 "ARI BridgeAttendedTransfer has undocumented field %s\n",
2443                                 ast_json_object_iter_key(iter));
2444                         res = 0;
2445                 }
2446         }
2447
2448         if (!has_type) {
2449                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field type\n");
2450                 res = 0;
2451         }
2452
2453         if (!has_application) {
2454                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field application\n");
2455                 res = 0;
2456         }
2457
2458         if (!has_destination_type) {
2459                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field destination_type\n");
2460                 res = 0;
2461         }
2462
2463         if (!has_is_external) {
2464                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field is_external\n");
2465                 res = 0;
2466         }
2467
2468         if (!has_result) {
2469                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field result\n");
2470                 res = 0;
2471         }
2472
2473         if (!has_transferer_first_leg) {
2474                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field transferer_first_leg\n");
2475                 res = 0;
2476         }
2477
2478         if (!has_transferer_second_leg) {
2479                 ast_log(LOG_ERROR, "ARI BridgeAttendedTransfer missing required field transferer_second_leg\n");
2480                 res = 0;
2481         }
2482
2483         return res;
2484 }
2485
2486 ari_validator ast_ari_validate_bridge_attended_transfer_fn(void)
2487 {
2488         return ast_ari_validate_bridge_attended_transfer;
2489 }
2490
2491 int ast_ari_validate_bridge_blind_transfer(struct ast_json *json)
2492 {
2493         int res = 1;
2494         struct ast_json_iter *iter;
2495         int has_type = 0;
2496         int has_application = 0;
2497         int has_channel = 0;
2498         int has_context = 0;
2499         int has_exten = 0;
2500         int has_is_external = 0;
2501         int has_result = 0;
2502
2503         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2504                 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2505                         int prop_is_valid;
2506                         prop_is_valid = ast_ari_validate_string(
2507                                 ast_json_object_iter_value(iter));
2508                         if (!prop_is_valid) {
2509                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field asterisk_id failed validation\n");
2510                                 res = 0;
2511                         }
2512                 } else
2513                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2514                         int prop_is_valid;
2515                         has_type = 1;
2516                         prop_is_valid = ast_ari_validate_string(
2517                                 ast_json_object_iter_value(iter));
2518                         if (!prop_is_valid) {
2519                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field type failed validation\n");
2520                                 res = 0;
2521                         }
2522                 } else
2523                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2524                         int prop_is_valid;
2525                         has_application = 1;
2526                         prop_is_valid = ast_ari_validate_string(
2527                                 ast_json_object_iter_value(iter));
2528                         if (!prop_is_valid) {
2529                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field application failed validation\n");
2530                                 res = 0;
2531                         }
2532                 } else
2533                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2534                         int prop_is_valid;
2535                         prop_is_valid = ast_ari_validate_date(
2536                                 ast_json_object_iter_value(iter));
2537                         if (!prop_is_valid) {
2538                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field timestamp failed validation\n");
2539                                 res = 0;
2540                         }
2541                 } else
2542                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2543                         int prop_is_valid;
2544                         prop_is_valid = ast_ari_validate_bridge(
2545                                 ast_json_object_iter_value(iter));
2546                         if (!prop_is_valid) {
2547                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field bridge failed validation\n");
2548                                 res = 0;
2549                         }
2550                 } else
2551                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
2552                         int prop_is_valid;
2553                         has_channel = 1;
2554                         prop_is_valid = ast_ari_validate_channel(
2555                                 ast_json_object_iter_value(iter));
2556                         if (!prop_is_valid) {
2557                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field channel failed validation\n");
2558                                 res = 0;
2559                         }
2560                 } else
2561                 if (strcmp("context", ast_json_object_iter_key(iter)) == 0) {
2562                         int prop_is_valid;
2563                         has_context = 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 BridgeBlindTransfer field context failed validation\n");
2568                                 res = 0;
2569                         }
2570                 } else
2571                 if (strcmp("exten", ast_json_object_iter_key(iter)) == 0) {
2572                         int prop_is_valid;
2573                         has_exten = 1;
2574                         prop_is_valid = ast_ari_validate_string(
2575                                 ast_json_object_iter_value(iter));
2576                         if (!prop_is_valid) {
2577                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field exten failed validation\n");
2578                                 res = 0;
2579                         }
2580                 } else
2581                 if (strcmp("is_external", ast_json_object_iter_key(iter)) == 0) {
2582                         int prop_is_valid;
2583                         has_is_external = 1;
2584                         prop_is_valid = ast_ari_validate_boolean(
2585                                 ast_json_object_iter_value(iter));
2586                         if (!prop_is_valid) {
2587                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field is_external failed validation\n");
2588                                 res = 0;
2589                         }
2590                 } else
2591                 if (strcmp("replace_channel", ast_json_object_iter_key(iter)) == 0) {
2592                         int prop_is_valid;
2593                         prop_is_valid = ast_ari_validate_channel(
2594                                 ast_json_object_iter_value(iter));
2595                         if (!prop_is_valid) {
2596                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field replace_channel failed validation\n");
2597                                 res = 0;
2598                         }
2599                 } else
2600                 if (strcmp("result", ast_json_object_iter_key(iter)) == 0) {
2601                         int prop_is_valid;
2602                         has_result = 1;
2603                         prop_is_valid = ast_ari_validate_string(
2604                                 ast_json_object_iter_value(iter));
2605                         if (!prop_is_valid) {
2606                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field result failed validation\n");
2607                                 res = 0;
2608                         }
2609                 } else
2610                 if (strcmp("transferee", ast_json_object_iter_key(iter)) == 0) {
2611                         int prop_is_valid;
2612                         prop_is_valid = ast_ari_validate_channel(
2613                                 ast_json_object_iter_value(iter));
2614                         if (!prop_is_valid) {
2615                                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field transferee failed validation\n");
2616                                 res = 0;
2617                         }
2618                 } else
2619                 {
2620                         ast_log(LOG_ERROR,
2621                                 "ARI BridgeBlindTransfer has undocumented field %s\n",
2622                                 ast_json_object_iter_key(iter));
2623                         res = 0;
2624                 }
2625         }
2626
2627         if (!has_type) {
2628                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field type\n");
2629                 res = 0;
2630         }
2631
2632         if (!has_application) {
2633                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field application\n");
2634                 res = 0;
2635         }
2636
2637         if (!has_channel) {
2638                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field channel\n");
2639                 res = 0;
2640         }
2641
2642         if (!has_context) {
2643                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field context\n");
2644                 res = 0;
2645         }
2646
2647         if (!has_exten) {
2648                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field exten\n");
2649                 res = 0;
2650         }
2651
2652         if (!has_is_external) {
2653                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field is_external\n");
2654                 res = 0;
2655         }
2656
2657         if (!has_result) {
2658                 ast_log(LOG_ERROR, "ARI BridgeBlindTransfer missing required field result\n");
2659                 res = 0;
2660         }
2661
2662         return res;
2663 }
2664
2665 ari_validator ast_ari_validate_bridge_blind_transfer_fn(void)
2666 {
2667         return ast_ari_validate_bridge_blind_transfer;
2668 }
2669
2670 int ast_ari_validate_bridge_created(struct ast_json *json)
2671 {
2672         int res = 1;
2673         struct ast_json_iter *iter;
2674         int has_type = 0;
2675         int has_application = 0;
2676         int has_bridge = 0;
2677
2678         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2679                 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2680                         int prop_is_valid;
2681                         prop_is_valid = ast_ari_validate_string(
2682                                 ast_json_object_iter_value(iter));
2683                         if (!prop_is_valid) {
2684                                 ast_log(LOG_ERROR, "ARI BridgeCreated field asterisk_id failed validation\n");
2685                                 res = 0;
2686                         }
2687                 } else
2688                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2689                         int prop_is_valid;
2690                         has_type = 1;
2691                         prop_is_valid = ast_ari_validate_string(
2692                                 ast_json_object_iter_value(iter));
2693                         if (!prop_is_valid) {
2694                                 ast_log(LOG_ERROR, "ARI BridgeCreated field type failed validation\n");
2695                                 res = 0;
2696                         }
2697                 } else
2698                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2699                         int prop_is_valid;
2700                         has_application = 1;
2701                         prop_is_valid = ast_ari_validate_string(
2702                                 ast_json_object_iter_value(iter));
2703                         if (!prop_is_valid) {
2704                                 ast_log(LOG_ERROR, "ARI BridgeCreated field application failed validation\n");
2705                                 res = 0;
2706                         }
2707                 } else
2708                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2709                         int prop_is_valid;
2710                         prop_is_valid = ast_ari_validate_date(
2711                                 ast_json_object_iter_value(iter));
2712                         if (!prop_is_valid) {
2713                                 ast_log(LOG_ERROR, "ARI BridgeCreated field timestamp failed validation\n");
2714                                 res = 0;
2715                         }
2716                 } else
2717                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2718                         int prop_is_valid;
2719                         has_bridge = 1;
2720                         prop_is_valid = ast_ari_validate_bridge(
2721                                 ast_json_object_iter_value(iter));
2722                         if (!prop_is_valid) {
2723                                 ast_log(LOG_ERROR, "ARI BridgeCreated field bridge failed validation\n");
2724                                 res = 0;
2725                         }
2726                 } else
2727                 {
2728                         ast_log(LOG_ERROR,
2729                                 "ARI BridgeCreated has undocumented field %s\n",
2730                                 ast_json_object_iter_key(iter));
2731                         res = 0;
2732                 }
2733         }
2734
2735         if (!has_type) {
2736                 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field type\n");
2737                 res = 0;
2738         }
2739
2740         if (!has_application) {
2741                 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field application\n");
2742                 res = 0;
2743         }
2744
2745         if (!has_bridge) {
2746                 ast_log(LOG_ERROR, "ARI BridgeCreated missing required field bridge\n");
2747                 res = 0;
2748         }
2749
2750         return res;
2751 }
2752
2753 ari_validator ast_ari_validate_bridge_created_fn(void)
2754 {
2755         return ast_ari_validate_bridge_created;
2756 }
2757
2758 int ast_ari_validate_bridge_destroyed(struct ast_json *json)
2759 {
2760         int res = 1;
2761         struct ast_json_iter *iter;
2762         int has_type = 0;
2763         int has_application = 0;
2764         int has_bridge = 0;
2765
2766         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2767                 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2768                         int prop_is_valid;
2769                         prop_is_valid = ast_ari_validate_string(
2770                                 ast_json_object_iter_value(iter));
2771                         if (!prop_is_valid) {
2772                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field asterisk_id failed validation\n");
2773                                 res = 0;
2774                         }
2775                 } else
2776                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2777                         int prop_is_valid;
2778                         has_type = 1;
2779                         prop_is_valid = ast_ari_validate_string(
2780                                 ast_json_object_iter_value(iter));
2781                         if (!prop_is_valid) {
2782                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field type failed validation\n");
2783                                 res = 0;
2784                         }
2785                 } else
2786                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2787                         int prop_is_valid;
2788                         has_application = 1;
2789                         prop_is_valid = ast_ari_validate_string(
2790                                 ast_json_object_iter_value(iter));
2791                         if (!prop_is_valid) {
2792                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field application failed validation\n");
2793                                 res = 0;
2794                         }
2795                 } else
2796                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2797                         int prop_is_valid;
2798                         prop_is_valid = ast_ari_validate_date(
2799                                 ast_json_object_iter_value(iter));
2800                         if (!prop_is_valid) {
2801                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field timestamp failed validation\n");
2802                                 res = 0;
2803                         }
2804                 } else
2805                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2806                         int prop_is_valid;
2807                         has_bridge = 1;
2808                         prop_is_valid = ast_ari_validate_bridge(
2809                                 ast_json_object_iter_value(iter));
2810                         if (!prop_is_valid) {
2811                                 ast_log(LOG_ERROR, "ARI BridgeDestroyed field bridge failed validation\n");
2812                                 res = 0;
2813                         }
2814                 } else
2815                 {
2816                         ast_log(LOG_ERROR,
2817                                 "ARI BridgeDestroyed has undocumented field %s\n",
2818                                 ast_json_object_iter_key(iter));
2819                         res = 0;
2820                 }
2821         }
2822
2823         if (!has_type) {
2824                 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field type\n");
2825                 res = 0;
2826         }
2827
2828         if (!has_application) {
2829                 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field application\n");
2830                 res = 0;
2831         }
2832
2833         if (!has_bridge) {
2834                 ast_log(LOG_ERROR, "ARI BridgeDestroyed missing required field bridge\n");
2835                 res = 0;
2836         }
2837
2838         return res;
2839 }
2840
2841 ari_validator ast_ari_validate_bridge_destroyed_fn(void)
2842 {
2843         return ast_ari_validate_bridge_destroyed;
2844 }
2845
2846 int ast_ari_validate_bridge_merged(struct ast_json *json)
2847 {
2848         int res = 1;
2849         struct ast_json_iter *iter;
2850         int has_type = 0;
2851         int has_application = 0;
2852         int has_bridge = 0;
2853         int has_bridge_from = 0;
2854
2855         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2856                 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2857                         int prop_is_valid;
2858                         prop_is_valid = ast_ari_validate_string(
2859                                 ast_json_object_iter_value(iter));
2860                         if (!prop_is_valid) {
2861                                 ast_log(LOG_ERROR, "ARI BridgeMerged field asterisk_id failed validation\n");
2862                                 res = 0;
2863                         }
2864                 } else
2865                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2866                         int prop_is_valid;
2867                         has_type = 1;
2868                         prop_is_valid = ast_ari_validate_string(
2869                                 ast_json_object_iter_value(iter));
2870                         if (!prop_is_valid) {
2871                                 ast_log(LOG_ERROR, "ARI BridgeMerged field type failed validation\n");
2872                                 res = 0;
2873                         }
2874                 } else
2875                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2876                         int prop_is_valid;
2877                         has_application = 1;
2878                         prop_is_valid = ast_ari_validate_string(
2879                                 ast_json_object_iter_value(iter));
2880                         if (!prop_is_valid) {
2881                                 ast_log(LOG_ERROR, "ARI BridgeMerged field application failed validation\n");
2882                                 res = 0;
2883                         }
2884                 } else
2885                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2886                         int prop_is_valid;
2887                         prop_is_valid = ast_ari_validate_date(
2888                                 ast_json_object_iter_value(iter));
2889                         if (!prop_is_valid) {
2890                                 ast_log(LOG_ERROR, "ARI BridgeMerged field timestamp failed validation\n");
2891                                 res = 0;
2892                         }
2893                 } else
2894                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2895                         int prop_is_valid;
2896                         has_bridge = 1;
2897                         prop_is_valid = ast_ari_validate_bridge(
2898                                 ast_json_object_iter_value(iter));
2899                         if (!prop_is_valid) {
2900                                 ast_log(LOG_ERROR, "ARI BridgeMerged field bridge failed validation\n");
2901                                 res = 0;
2902                         }
2903                 } else
2904                 if (strcmp("bridge_from", ast_json_object_iter_key(iter)) == 0) {
2905                         int prop_is_valid;
2906                         has_bridge_from = 1;
2907                         prop_is_valid = ast_ari_validate_bridge(
2908                                 ast_json_object_iter_value(iter));
2909                         if (!prop_is_valid) {
2910                                 ast_log(LOG_ERROR, "ARI BridgeMerged field bridge_from failed validation\n");
2911                                 res = 0;
2912                         }
2913                 } else
2914                 {
2915                         ast_log(LOG_ERROR,
2916                                 "ARI BridgeMerged has undocumented field %s\n",
2917                                 ast_json_object_iter_key(iter));
2918                         res = 0;
2919                 }
2920         }
2921
2922         if (!has_type) {
2923                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field type\n");
2924                 res = 0;
2925         }
2926
2927         if (!has_application) {
2928                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field application\n");
2929                 res = 0;
2930         }
2931
2932         if (!has_bridge) {
2933                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge\n");
2934                 res = 0;
2935         }
2936
2937         if (!has_bridge_from) {
2938                 ast_log(LOG_ERROR, "ARI BridgeMerged missing required field bridge_from\n");
2939                 res = 0;
2940         }
2941
2942         return res;
2943 }
2944
2945 ari_validator ast_ari_validate_bridge_merged_fn(void)
2946 {
2947         return ast_ari_validate_bridge_merged;
2948 }
2949
2950 int ast_ari_validate_bridge_video_source_changed(struct ast_json *json)
2951 {
2952         int res = 1;
2953         struct ast_json_iter *iter;
2954         int has_type = 0;
2955         int has_application = 0;
2956         int has_bridge = 0;
2957
2958         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
2959                 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
2960                         int prop_is_valid;
2961                         prop_is_valid = ast_ari_validate_string(
2962                                 ast_json_object_iter_value(iter));
2963                         if (!prop_is_valid) {
2964                                 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field asterisk_id failed validation\n");
2965                                 res = 0;
2966                         }
2967                 } else
2968                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
2969                         int prop_is_valid;
2970                         has_type = 1;
2971                         prop_is_valid = ast_ari_validate_string(
2972                                 ast_json_object_iter_value(iter));
2973                         if (!prop_is_valid) {
2974                                 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field type failed validation\n");
2975                                 res = 0;
2976                         }
2977                 } else
2978                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
2979                         int prop_is_valid;
2980                         has_application = 1;
2981                         prop_is_valid = ast_ari_validate_string(
2982                                 ast_json_object_iter_value(iter));
2983                         if (!prop_is_valid) {
2984                                 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field application failed validation\n");
2985                                 res = 0;
2986                         }
2987                 } else
2988                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
2989                         int prop_is_valid;
2990                         prop_is_valid = ast_ari_validate_date(
2991                                 ast_json_object_iter_value(iter));
2992                         if (!prop_is_valid) {
2993                                 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field timestamp failed validation\n");
2994                                 res = 0;
2995                         }
2996                 } else
2997                 if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
2998                         int prop_is_valid;
2999                         has_bridge = 1;
3000                         prop_is_valid = ast_ari_validate_bridge(
3001                                 ast_json_object_iter_value(iter));
3002                         if (!prop_is_valid) {
3003                                 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field bridge failed validation\n");
3004                                 res = 0;
3005                         }
3006                 } else
3007                 if (strcmp("old_video_source_id", ast_json_object_iter_key(iter)) == 0) {
3008                         int prop_is_valid;
3009                         prop_is_valid = ast_ari_validate_string(
3010                                 ast_json_object_iter_value(iter));
3011                         if (!prop_is_valid) {
3012                                 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged field old_video_source_id failed validation\n");
3013                                 res = 0;
3014                         }
3015                 } else
3016                 {
3017                         ast_log(LOG_ERROR,
3018                                 "ARI BridgeVideoSourceChanged has undocumented field %s\n",
3019                                 ast_json_object_iter_key(iter));
3020                         res = 0;
3021                 }
3022         }
3023
3024         if (!has_type) {
3025                 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged missing required field type\n");
3026                 res = 0;
3027         }
3028
3029         if (!has_application) {
3030                 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged missing required field application\n");
3031                 res = 0;
3032         }
3033
3034         if (!has_bridge) {
3035                 ast_log(LOG_ERROR, "ARI BridgeVideoSourceChanged missing required field bridge\n");
3036                 res = 0;
3037         }
3038
3039         return res;
3040 }
3041
3042 ari_validator ast_ari_validate_bridge_video_source_changed_fn(void)
3043 {
3044         return ast_ari_validate_bridge_video_source_changed;
3045 }
3046
3047 int ast_ari_validate_channel_caller_id(struct ast_json *json)
3048 {
3049         int res = 1;
3050         struct ast_json_iter *iter;
3051         int has_type = 0;
3052         int has_application = 0;
3053         int has_caller_presentation = 0;
3054         int has_caller_presentation_txt = 0;
3055         int has_channel = 0;
3056
3057         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3058                 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3059                         int prop_is_valid;
3060                         prop_is_valid = ast_ari_validate_string(
3061                                 ast_json_object_iter_value(iter));
3062                         if (!prop_is_valid) {
3063                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field asterisk_id failed validation\n");
3064                                 res = 0;
3065                         }
3066                 } else
3067                 if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
3068                         int prop_is_valid;
3069                         has_type = 1;
3070                         prop_is_valid = ast_ari_validate_string(
3071                                 ast_json_object_iter_value(iter));
3072                         if (!prop_is_valid) {
3073                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field type failed validation\n");
3074                                 res = 0;
3075                         }
3076                 } else
3077                 if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
3078                         int prop_is_valid;
3079                         has_application = 1;
3080                         prop_is_valid = ast_ari_validate_string(
3081                                 ast_json_object_iter_value(iter));
3082                         if (!prop_is_valid) {
3083                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field application failed validation\n");
3084                                 res = 0;
3085                         }
3086                 } else
3087                 if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
3088                         int prop_is_valid;
3089                         prop_is_valid = ast_ari_validate_date(
3090                                 ast_json_object_iter_value(iter));
3091                         if (!prop_is_valid) {
3092                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field timestamp failed validation\n");
3093                                 res = 0;
3094                         }
3095                 } else
3096                 if (strcmp("caller_presentation", ast_json_object_iter_key(iter)) == 0) {
3097                         int prop_is_valid;
3098                         has_caller_presentation = 1;
3099                         prop_is_valid = ast_ari_validate_int(
3100                                 ast_json_object_iter_value(iter));
3101                         if (!prop_is_valid) {
3102                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation failed validation\n");
3103                                 res = 0;
3104                         }
3105                 } else
3106                 if (strcmp("caller_presentation_txt", ast_json_object_iter_key(iter)) == 0) {
3107                         int prop_is_valid;
3108                         has_caller_presentation_txt = 1;
3109                         prop_is_valid = ast_ari_validate_string(
3110                                 ast_json_object_iter_value(iter));
3111                         if (!prop_is_valid) {
3112                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation_txt failed validation\n");
3113                                 res = 0;
3114                         }
3115                 } else
3116                 if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
3117                         int prop_is_valid;
3118                         has_channel = 1;
3119                         prop_is_valid = ast_ari_validate_channel(
3120                                 ast_json_object_iter_value(iter));
3121                         if (!prop_is_valid) {
3122                                 ast_log(LOG_ERROR, "ARI ChannelCallerId field channel failed validation\n");
3123                                 res = 0;
3124                         }
3125                 } else
3126                 {
3127                         ast_log(LOG_ERROR,
3128                                 "ARI ChannelCallerId has undocumented field %s\n",
3129                                 ast_json_object_iter_key(iter));
3130                         res = 0;
3131                 }
3132         }
3133
3134         if (!has_type) {
3135                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field type\n");
3136                 res = 0;
3137         }
3138
3139         if (!has_application) {
3140                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field application\n");
3141                 res = 0;
3142         }
3143
3144         if (!has_caller_presentation) {
3145                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation\n");
3146                 res = 0;
3147         }
3148
3149         if (!has_caller_presentation_txt) {
3150                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field caller_presentation_txt\n");
3151                 res = 0;
3152         }
3153
3154         if (!has_channel) {
3155                 ast_log(LOG_ERROR, "ARI ChannelCallerId missing required field channel\n");
3156                 res = 0;
3157         }
3158
3159         return res;
3160 }
3161
3162 ari_validator ast_ari_validate_channel_caller_id_fn(void)
3163 {
3164         return ast_ari_validate_channel_caller_id;
3165 }
3166
3167 int ast_ari_validate_channel_connected_line(struct ast_json *json)
3168 {
3169         int res = 1;
3170         struct ast_json_iter *iter;
3171         int has_type = 0;
3172         int has_application = 0;
3173         int has_channel = 0;
3174
3175         for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
3176                 if (strcmp("asterisk_id", ast_json_object_iter_key(iter)) == 0) {
3177                         int prop_is_valid;
3178