Stasis-HTTP: Flesh out bridge-related capabilities
[asterisk/asterisk.git] / res / res_stasis_json_events.c
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2012 - 2013, Digium, Inc.
5  *
6  * David M. Lee, II <dlee@digium.com>
7  *
8  * See http://www.asterisk.org for more information about
9  * the Asterisk project. Please do not directly contact
10  * any of the maintainers of this project for assistance;
11  * the project provides a web site, mailing lists and IRC
12  * channels for your use.
13  *
14  * This program is free software, distributed under the terms of
15  * the GNU General Public License Version 2. See the LICENSE file
16  * at the top of the source tree.
17  */
18
19 /*
20  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
21  * !!!!!                               DO NOT EDIT                        !!!!!
22  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
23  * This file is generated by a mustache template. Please see the original
24  * template in rest-api-templates/res_stasis_http_resource.c.mustache
25  */
26
27 /*! \file
28  *
29  * \brief WebSocket resource
30  *
31  * \author David M. Lee, II <dlee@digium.com>
32  */
33
34 /*** MODULEINFO
35         <support_level>core</support_level>
36  ***/
37
38 #include "asterisk.h"
39
40 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
41
42 #include "asterisk/module.h"
43 #include "asterisk/json.h"
44 #include "stasis_json/resource_events.h"
45 #include "asterisk/stasis_channels.h"
46 #include "asterisk/stasis_bridging.h"
47
48 struct ast_json *stasis_json_event_channel_userevent_create(
49         struct ast_channel_snapshot *channel_snapshot,
50         struct ast_json *blob
51         )
52 {
53         RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
54         RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
55         struct ast_json *validator;
56         int ret;
57
58         ast_assert(channel_snapshot != NULL);
59         ast_assert(blob != NULL);
60         ast_assert(ast_json_object_get(blob, "channel") == NULL);
61         ast_assert(ast_json_object_get(blob, "type") == NULL);
62
63         validator = ast_json_object_get(blob, "eventname");
64         if (validator) {
65                 /* do validation? XXX */
66         } else {
67                 /* fail message generation if the required parameter doesn't exist */
68                 return NULL;
69         }
70
71         event = ast_json_deep_copy(blob);
72         if (!event) {
73                 return NULL;
74         }
75
76         ret = ast_json_object_set(event,
77                 "channel", ast_channel_snapshot_to_json(channel_snapshot));
78         if (ret) {
79                 return NULL;
80         }
81
82         message = ast_json_pack("{s: o}", "channel_userevent", ast_json_ref(event));
83         if (!message) {
84                 return NULL;
85         }
86
87         return ast_json_ref(message);
88 }
89
90 struct ast_json *stasis_json_event_bridge_created_create(
91         struct ast_bridge_snapshot *bridge_snapshot
92         )
93 {
94         RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
95         RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
96         int ret;
97
98         ast_assert(bridge_snapshot != NULL);
99
100         event = ast_json_object_create();
101         if (!event) {
102                 return NULL;
103         }
104
105         ret = ast_json_object_set(event,
106                 "bridge", ast_bridge_snapshot_to_json(bridge_snapshot));
107         if (ret) {
108                 return NULL;
109         }
110
111         message = ast_json_pack("{s: o}", "bridge_created", ast_json_ref(event));
112         if (!message) {
113                 return NULL;
114         }
115
116         return ast_json_ref(message);
117 }
118
119 struct ast_json *stasis_json_event_playback_finished_create(
120         struct ast_json *blob
121         )
122 {
123         RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
124         RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
125         struct ast_json *validator;
126
127         ast_assert(blob != NULL);
128         ast_assert(ast_json_object_get(blob, "type") == NULL);
129
130         validator = ast_json_object_get(blob, "playback");
131         if (validator) {
132                 /* do validation? XXX */
133         } else {
134                 /* fail message generation if the required parameter doesn't exist */
135                 return NULL;
136         }
137
138         event = ast_json_deep_copy(blob);
139         if (!event) {
140                 return NULL;
141         }
142
143         message = ast_json_pack("{s: o}", "playback_finished", ast_json_ref(event));
144         if (!message) {
145                 return NULL;
146         }
147
148         return ast_json_ref(message);
149 }
150
151 struct ast_json *stasis_json_event_channel_snapshot_create(
152         struct ast_channel_snapshot *channel_snapshot
153         )
154 {
155         RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
156         RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
157         int ret;
158
159         ast_assert(channel_snapshot != NULL);
160
161         event = ast_json_object_create();
162         if (!event) {
163                 return NULL;
164         }
165
166         ret = ast_json_object_set(event,
167                 "channel", ast_channel_snapshot_to_json(channel_snapshot));
168         if (ret) {
169                 return NULL;
170         }
171
172         message = ast_json_pack("{s: o}", "channel_snapshot", ast_json_ref(event));
173         if (!message) {
174                 return NULL;
175         }
176
177         return ast_json_ref(message);
178 }
179
180 struct ast_json *stasis_json_event_channel_caller_id_create(
181         struct ast_channel_snapshot *channel_snapshot,
182         struct ast_json *blob
183         )
184 {
185         RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
186         RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
187         struct ast_json *validator;
188         int ret;
189
190         ast_assert(channel_snapshot != NULL);
191         ast_assert(blob != NULL);
192         ast_assert(ast_json_object_get(blob, "channel") == NULL);
193         ast_assert(ast_json_object_get(blob, "type") == NULL);
194
195         validator = ast_json_object_get(blob, "caller_presentation_txt");
196         if (validator) {
197                 /* do validation? XXX */
198         } else {
199                 /* fail message generation if the required parameter doesn't exist */
200                 return NULL;
201         }
202
203         validator = ast_json_object_get(blob, "caller_presentation");
204         if (validator) {
205                 /* do validation? XXX */
206         } else {
207                 /* fail message generation if the required parameter doesn't exist */
208                 return NULL;
209         }
210
211         event = ast_json_deep_copy(blob);
212         if (!event) {
213                 return NULL;
214         }
215
216         ret = ast_json_object_set(event,
217                 "channel", ast_channel_snapshot_to_json(channel_snapshot));
218         if (ret) {
219                 return NULL;
220         }
221
222         message = ast_json_pack("{s: o}", "channel_caller_id", ast_json_ref(event));
223         if (!message) {
224                 return NULL;
225         }
226
227         return ast_json_ref(message);
228 }
229
230 struct ast_json *stasis_json_event_playback_started_create(
231         struct ast_json *blob
232         )
233 {
234         RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
235         RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
236         struct ast_json *validator;
237
238         ast_assert(blob != NULL);
239         ast_assert(ast_json_object_get(blob, "type") == NULL);
240
241         validator = ast_json_object_get(blob, "playback");
242         if (validator) {
243                 /* do validation? XXX */
244         } else {
245                 /* fail message generation if the required parameter doesn't exist */
246                 return NULL;
247         }
248
249         event = ast_json_deep_copy(blob);
250         if (!event) {
251                 return NULL;
252         }
253
254         message = ast_json_pack("{s: o}", "playback_started", ast_json_ref(event));
255         if (!message) {
256                 return NULL;
257         }
258
259         return ast_json_ref(message);
260 }
261
262 struct ast_json *stasis_json_event_channel_varset_create(
263         struct ast_channel_snapshot *channel_snapshot,
264         struct ast_json *blob
265         )
266 {
267         RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
268         RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
269         struct ast_json *validator;
270         int ret;
271
272         ast_assert(channel_snapshot != NULL);
273         ast_assert(blob != NULL);
274         ast_assert(ast_json_object_get(blob, "channel") == NULL);
275         ast_assert(ast_json_object_get(blob, "type") == NULL);
276
277         validator = ast_json_object_get(blob, "variable");
278         if (validator) {
279                 /* do validation? XXX */
280         } else {
281                 /* fail message generation if the required parameter doesn't exist */
282                 return NULL;
283         }
284
285         validator = ast_json_object_get(blob, "value");
286         if (validator) {
287                 /* do validation? XXX */
288         } else {
289                 /* fail message generation if the required parameter doesn't exist */
290                 return NULL;
291         }
292
293         event = ast_json_deep_copy(blob);
294         if (!event) {
295                 return NULL;
296         }
297
298         ret = ast_json_object_set(event,
299                 "channel", ast_channel_snapshot_to_json(channel_snapshot));
300         if (ret) {
301                 return NULL;
302         }
303
304         message = ast_json_pack("{s: o}", "channel_varset", ast_json_ref(event));
305         if (!message) {
306                 return NULL;
307         }
308
309         return ast_json_ref(message);
310 }
311
312 struct ast_json *stasis_json_event_bridge_destroyed_create(
313         struct ast_bridge_snapshot *bridge_snapshot
314         )
315 {
316         RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
317         RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
318         int ret;
319
320         ast_assert(bridge_snapshot != NULL);
321
322         event = ast_json_object_create();
323         if (!event) {
324                 return NULL;
325         }
326
327         ret = ast_json_object_set(event,
328                 "bridge", ast_bridge_snapshot_to_json(bridge_snapshot));
329         if (ret) {
330                 return NULL;
331         }
332
333         message = ast_json_pack("{s: o}", "bridge_destroyed", ast_json_ref(event));
334         if (!message) {
335                 return NULL;
336         }
337
338         return ast_json_ref(message);
339 }
340
341 struct ast_json *stasis_json_event_application_replaced_create(
342         struct ast_json *blob
343         )
344 {
345         RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
346         RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
347         struct ast_json *validator;
348
349         ast_assert(blob != NULL);
350         ast_assert(ast_json_object_get(blob, "type") == NULL);
351
352         validator = ast_json_object_get(blob, "application");
353         if (validator) {
354                 /* do validation? XXX */
355         } else {
356                 /* fail message generation if the required parameter doesn't exist */
357                 return NULL;
358         }
359
360         event = ast_json_deep_copy(blob);
361         if (!event) {
362                 return NULL;
363         }
364
365         message = ast_json_pack("{s: o}", "application_replaced", ast_json_ref(event));
366         if (!message) {
367                 return NULL;
368         }
369
370         return ast_json_ref(message);
371 }
372
373 struct ast_json *stasis_json_event_channel_destroyed_create(
374         struct ast_channel_snapshot *channel_snapshot,
375         struct ast_json *blob
376         )
377 {
378         RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
379         RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
380         struct ast_json *validator;
381         int ret;
382
383         ast_assert(channel_snapshot != NULL);
384         ast_assert(blob != NULL);
385         ast_assert(ast_json_object_get(blob, "channel") == NULL);
386         ast_assert(ast_json_object_get(blob, "type") == NULL);
387
388         validator = ast_json_object_get(blob, "cause");
389         if (validator) {
390                 /* do validation? XXX */
391         } else {
392                 /* fail message generation if the required parameter doesn't exist */
393                 return NULL;
394         }
395
396         validator = ast_json_object_get(blob, "cause_txt");
397         if (validator) {
398                 /* do validation? XXX */
399         } else {
400                 /* fail message generation if the required parameter doesn't exist */
401                 return NULL;
402         }
403
404         event = ast_json_deep_copy(blob);
405         if (!event) {
406                 return NULL;
407         }
408
409         ret = ast_json_object_set(event,
410                 "channel", ast_channel_snapshot_to_json(channel_snapshot));
411         if (ret) {
412                 return NULL;
413         }
414
415         message = ast_json_pack("{s: o}", "channel_destroyed", ast_json_ref(event));
416         if (!message) {
417                 return NULL;
418         }
419
420         return ast_json_ref(message);
421 }
422
423 struct ast_json *stasis_json_event_bridge_merged_create(
424         struct ast_bridge_snapshot *bridge_snapshot,
425         struct ast_json *blob
426         )
427 {
428         RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
429         RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
430         struct ast_json *validator;
431         int ret;
432
433         ast_assert(bridge_snapshot != NULL);
434         ast_assert(blob != NULL);
435         ast_assert(ast_json_object_get(blob, "bridge") == NULL);
436         ast_assert(ast_json_object_get(blob, "type") == NULL);
437
438         validator = ast_json_object_get(blob, "bridge_from");
439         if (validator) {
440                 /* do validation? XXX */
441         } else {
442                 /* fail message generation if the required parameter doesn't exist */
443                 return NULL;
444         }
445
446         event = ast_json_deep_copy(blob);
447         if (!event) {
448                 return NULL;
449         }
450
451         ret = ast_json_object_set(event,
452                 "bridge", ast_bridge_snapshot_to_json(bridge_snapshot));
453         if (ret) {
454                 return NULL;
455         }
456
457         message = ast_json_pack("{s: o}", "bridge_merged", ast_json_ref(event));
458         if (!message) {
459                 return NULL;
460         }
461
462         return ast_json_ref(message);
463 }
464
465 struct ast_json *stasis_json_event_channel_left_bridge_create(
466         struct ast_bridge_snapshot *bridge_snapshot,
467         struct ast_channel_snapshot *channel_snapshot
468         )
469 {
470         RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
471         RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
472         int ret;
473
474         ast_assert(channel_snapshot != NULL);
475         ast_assert(bridge_snapshot != NULL);
476
477         event = ast_json_object_create();
478         if (!event) {
479                 return NULL;
480         }
481
482         ret = ast_json_object_set(event,
483                 "channel", ast_channel_snapshot_to_json(channel_snapshot));
484         if (ret) {
485                 return NULL;
486         }
487
488         ret = ast_json_object_set(event,
489                 "bridge", ast_bridge_snapshot_to_json(bridge_snapshot));
490         if (ret) {
491                 return NULL;
492         }
493
494         message = ast_json_pack("{s: o}", "channel_left_bridge", ast_json_ref(event));
495         if (!message) {
496                 return NULL;
497         }
498
499         return ast_json_ref(message);
500 }
501
502 struct ast_json *stasis_json_event_channel_created_create(
503         struct ast_channel_snapshot *channel_snapshot
504         )
505 {
506         RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
507         RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
508         int ret;
509
510         ast_assert(channel_snapshot != NULL);
511
512         event = ast_json_object_create();
513         if (!event) {
514                 return NULL;
515         }
516
517         ret = ast_json_object_set(event,
518                 "channel", ast_channel_snapshot_to_json(channel_snapshot));
519         if (ret) {
520                 return NULL;
521         }
522
523         message = ast_json_pack("{s: o}", "channel_created", ast_json_ref(event));
524         if (!message) {
525                 return NULL;
526         }
527
528         return ast_json_ref(message);
529 }
530
531 struct ast_json *stasis_json_event_stasis_start_create(
532         struct ast_channel_snapshot *channel_snapshot,
533         struct ast_json *blob
534         )
535 {
536         RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
537         RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
538         struct ast_json *validator;
539         int ret;
540
541         ast_assert(channel_snapshot != NULL);
542         ast_assert(blob != NULL);
543         ast_assert(ast_json_object_get(blob, "channel") == NULL);
544         ast_assert(ast_json_object_get(blob, "type") == NULL);
545
546         validator = ast_json_object_get(blob, "args");
547         if (validator) {
548                 /* do validation? XXX */
549         } else {
550                 /* fail message generation if the required parameter doesn't exist */
551                 return NULL;
552         }
553
554         event = ast_json_deep_copy(blob);
555         if (!event) {
556                 return NULL;
557         }
558
559         ret = ast_json_object_set(event,
560                 "channel", ast_channel_snapshot_to_json(channel_snapshot));
561         if (ret) {
562                 return NULL;
563         }
564
565         message = ast_json_pack("{s: o}", "stasis_start", ast_json_ref(event));
566         if (!message) {
567                 return NULL;
568         }
569
570         return ast_json_ref(message);
571 }
572
573 struct ast_json *stasis_json_event_channel_dialplan_create(
574         struct ast_channel_snapshot *channel_snapshot,
575         struct ast_json *blob
576         )
577 {
578         RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
579         RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
580         struct ast_json *validator;
581         int ret;
582
583         ast_assert(channel_snapshot != NULL);
584         ast_assert(blob != NULL);
585         ast_assert(ast_json_object_get(blob, "channel") == NULL);
586         ast_assert(ast_json_object_get(blob, "type") == NULL);
587
588         validator = ast_json_object_get(blob, "application");
589         if (validator) {
590                 /* do validation? XXX */
591         } else {
592                 /* fail message generation if the required parameter doesn't exist */
593                 return NULL;
594         }
595
596         validator = ast_json_object_get(blob, "application_data");
597         if (validator) {
598                 /* do validation? XXX */
599         } else {
600                 /* fail message generation if the required parameter doesn't exist */
601                 return NULL;
602         }
603
604         event = ast_json_deep_copy(blob);
605         if (!event) {
606                 return NULL;
607         }
608
609         ret = ast_json_object_set(event,
610                 "channel", ast_channel_snapshot_to_json(channel_snapshot));
611         if (ret) {
612                 return NULL;
613         }
614
615         message = ast_json_pack("{s: o}", "channel_dialplan", ast_json_ref(event));
616         if (!message) {
617                 return NULL;
618         }
619
620         return ast_json_ref(message);
621 }
622
623 struct ast_json *stasis_json_event_channel_state_change_create(
624         struct ast_channel_snapshot *channel_snapshot
625         )
626 {
627         RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
628         RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
629         int ret;
630
631         ast_assert(channel_snapshot != NULL);
632
633         event = ast_json_object_create();
634         if (!event) {
635                 return NULL;
636         }
637
638         ret = ast_json_object_set(event,
639                 "channel", ast_channel_snapshot_to_json(channel_snapshot));
640         if (ret) {
641                 return NULL;
642         }
643
644         message = ast_json_pack("{s: o}", "channel_state_change", ast_json_ref(event));
645         if (!message) {
646                 return NULL;
647         }
648
649         return ast_json_ref(message);
650 }
651
652 struct ast_json *stasis_json_event_channel_hangup_request_create(
653         struct ast_channel_snapshot *channel_snapshot,
654         struct ast_json *blob
655         )
656 {
657         RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
658         RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
659         struct ast_json *validator;
660         int ret;
661
662         ast_assert(channel_snapshot != NULL);
663         ast_assert(blob != NULL);
664         ast_assert(ast_json_object_get(blob, "channel") == NULL);
665         ast_assert(ast_json_object_get(blob, "type") == NULL);
666
667         validator = ast_json_object_get(blob, "soft");
668         if (validator) {
669                 /* do validation? XXX */
670         }
671
672         validator = ast_json_object_get(blob, "cause");
673         if (validator) {
674                 /* do validation? XXX */
675         }
676
677         event = ast_json_deep_copy(blob);
678         if (!event) {
679                 return NULL;
680         }
681
682         ret = ast_json_object_set(event,
683                 "channel", ast_channel_snapshot_to_json(channel_snapshot));
684         if (ret) {
685                 return NULL;
686         }
687
688         message = ast_json_pack("{s: o}", "channel_hangup_request", ast_json_ref(event));
689         if (!message) {
690                 return NULL;
691         }
692
693         return ast_json_ref(message);
694 }
695
696 struct ast_json *stasis_json_event_channel_entered_bridge_create(
697         struct ast_bridge_snapshot *bridge_snapshot,
698         struct ast_channel_snapshot *channel_snapshot
699         )
700 {
701         RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
702         RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
703         int ret;
704
705         ast_assert(channel_snapshot != NULL);
706         ast_assert(bridge_snapshot != NULL);
707
708         event = ast_json_object_create();
709         if (!event) {
710                 return NULL;
711         }
712
713         ret = ast_json_object_set(event,
714                 "channel", ast_channel_snapshot_to_json(channel_snapshot));
715         if (ret) {
716                 return NULL;
717         }
718
719         ret = ast_json_object_set(event,
720                 "bridge", ast_bridge_snapshot_to_json(bridge_snapshot));
721         if (ret) {
722                 return NULL;
723         }
724
725         message = ast_json_pack("{s: o}", "channel_entered_bridge", ast_json_ref(event));
726         if (!message) {
727                 return NULL;
728         }
729
730         return ast_json_ref(message);
731 }
732
733 struct ast_json *stasis_json_event_channel_dtmf_received_create(
734         struct ast_channel_snapshot *channel_snapshot,
735         struct ast_json *blob
736         )
737 {
738         RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
739         RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
740         struct ast_json *validator;
741         int ret;
742
743         ast_assert(channel_snapshot != NULL);
744         ast_assert(blob != NULL);
745         ast_assert(ast_json_object_get(blob, "channel") == NULL);
746         ast_assert(ast_json_object_get(blob, "type") == NULL);
747
748         validator = ast_json_object_get(blob, "digit");
749         if (validator) {
750                 /* do validation? XXX */
751         } else {
752                 /* fail message generation if the required parameter doesn't exist */
753                 return NULL;
754         }
755
756         event = ast_json_deep_copy(blob);
757         if (!event) {
758                 return NULL;
759         }
760
761         ret = ast_json_object_set(event,
762                 "channel", ast_channel_snapshot_to_json(channel_snapshot));
763         if (ret) {
764                 return NULL;
765         }
766
767         message = ast_json_pack("{s: o}", "channel_dtmf_received", ast_json_ref(event));
768         if (!message) {
769                 return NULL;
770         }
771
772         return ast_json_ref(message);
773 }
774
775 struct ast_json *stasis_json_event_stasis_end_create(
776         struct ast_channel_snapshot *channel_snapshot
777         )
778 {
779         RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
780         RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
781         int ret;
782
783         ast_assert(channel_snapshot != NULL);
784
785         event = ast_json_object_create();
786         if (!event) {
787                 return NULL;
788         }
789
790         ret = ast_json_object_set(event,
791                 "channel", ast_channel_snapshot_to_json(channel_snapshot));
792         if (ret) {
793                 return NULL;
794         }
795
796         message = ast_json_pack("{s: o}", "stasis_end", ast_json_ref(event));
797         if (!message) {
798                 return NULL;
799         }
800
801         return ast_json_ref(message);
802 }
803
804 static int load_module(void)
805 {
806         return 0;
807 }
808
809 static int unload_module(void)
810 {
811         return 0;
812 }
813
814 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER,
815         "Stasis JSON Generators and Validators - WebSocket resource",
816         .load = load_module,
817         .unload = unload_module,
818         .load_pri = AST_MODPRI_DEFAULT,
819         );