Asterisk - The Open Source Telephony Project GIT-master-f36a736
res_format_attr_g729.c
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2016, Digium, Inc.
5 *
6 * Jason Parker <jparker@sangoma.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/*** 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 */
29static void g729_destroy(struct ast_format *format)
30{
31}
32
33/* Clone is a required callback and must exist */
34static int g729_clone(const struct ast_format *src, struct ast_format *dst)
35{
36 return 0;
37}
38
39static 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
51 .format_clone = g729_clone,
52 .format_generate_sdp_fmtp = g729_generate_sdp_fmtp,
53};
54
55static int load_module(void)
56{
59 }
60
62}
63
64static int unload_module(void)
65{
66 return 0;
67}
68
69AST_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);
const char * str
Definition: app_jack.c:147
Asterisk main include file. File version handling, generic pbx functions.
Media Format API.
#define ast_format_interface_register(codec, interface)
Register a format interface for use with the provided codec.
Definition: format.h:273
Asterisk module definitions.
@ AST_MODFLAG_LOAD_ORDER
Definition: module.h:331
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
Definition: module.h:557
@ AST_MODPRI_CHANNEL_DEPEND
Definition: module.h:340
@ AST_MODULE_SUPPORT_CORE
Definition: module.h:121
#define ASTERISK_GPL_KEY
The text the key() function should return.
Definition: module.h:46
@ AST_MODULE_LOAD_SUCCESS
Definition: module.h:70
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Definition: module.h:78
static int g729_clone(const struct ast_format *src, struct ast_format *dst)
static int load_module(void)
static struct ast_format_interface g729_interface
static void g729_destroy(struct ast_format *format)
static int unload_module(void)
static void g729_generate_sdp_fmtp(const struct ast_format *format, unsigned int payload, struct ast_str **str)
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
Definition: strings.h:1139
Optional format interface to extend format operations.
Definition: format.h:44
void(*const format_destroy)(struct ast_format *format)
Callback for when the format is destroyed, used to release attribute resources.
Definition: format.h:50
Definition of a media format.
Definition: format.c:43
Support for dynamic strings.
Definition: strings.h:623