Debian Codegraph @

res/res_format_attr_g729.c

raw symbols SCIP
1 /*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2016, Digium, Inc.
5 *
6 * Jason Parker <[email protected]>
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 /*** MODULEINFO
20 <support_level>core</support_level>
21 ***/
22
23 #include "asterisk.h"
24
25 #include "asterisk/module.h"
26 #include "asterisk/format.h"
27
28 /* Destroy is a required callback and must exist */
29 static void g729_destroy(struct ast_format *format)
30 {
31 }
32
33 /* Clone is a required callback and must exist */
34 static int g729_clone(const struct ast_format *src, struct ast_format *dst)
35 {
36 return 0;
37 }
38
39 static void g729_generate_sdp_fmtp(const struct ast_format *format, unsigned int payload, struct ast_str **str)
40 {
41 /*
42 * According to the rfc the joint annexb format parameter should be set to 'yes'
43 * or 'no' based on the answerer (rfc7261 - 3.3). However, Asterisk being a B2BUA
44 * makes things tricky. So for now Asterisk will set annexb=no.
45 */
46 ast_str_append(str, 0, "a=fmtp:%u annexb=no\r\n", payload);
47 }
48
49 static struct ast_format_interface g729_interface = {
50 .format_destroy = g729_destroy,
51 .format_clone = g729_clone,
52 .format_generate_sdp_fmtp = g729_generate_sdp_fmtp,
53 };
54
55 static int load_module(void)
56 {
57 if (ast_format_interface_register("g729", &g729_interface)) {
58 return AST_MODULE_LOAD_DECLINE;
59 }
60
61 return AST_MODULE_LOAD_SUCCESS;
62 }
63
64 static int unload_module(void)
65 {
66 return 0;
67 }
68
69 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "G.729 Format Attribute Module",
70 .support_level = AST_MODULE_SUPPORT_CORE,
71 .load = load_module,
72 .unload = unload_module,
73 .load_pri = AST_MODPRI_CHANNEL_DEPEND,
74 );