[Asterisk-code-review] res format attr g729: Add annexb=no format parameter to SDPs (asterisk[14])

Kevin Harwell asteriskteam at digium.com
Tue Aug 16 16:07:58 CDT 2016


Kevin Harwell has uploaded a new change for review.

  https://gerrit.asterisk.org/3575

Change subject: res_format_attr_g729: Add annexb=no format parameter to SDPs
......................................................................

res_format_attr_g729: Add annexb=no format parameter to SDPs

Historically, Asterisk has always specified annexb=no for the g729 format.
However, when using res_pjsip no format attribute was specified. This patch
makes it so the SDP now contains a format attribute line with annexb=no.

Note, that this means only g729a is negotiated. Even for pass through support.
According to rfc7261 the type of annex used (a or b) is dependent upon the
answerer. However, Asterisk being a back to back user agent makes this tricky
to support at this time, thus we only allow annex 'a' for now.

ASTERISK 26228 #close
patches:
  res_format_attr_g729.c submitted by Jason Parker (license 4993)

Change-Id: I76bc20cc0a01af01536e9915afef319c269c22d0
---
A res/res_format_attr_g729.c
1 file changed, 76 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/75/3575/1

diff --git a/res/res_format_attr_g729.c b/res/res_format_attr_g729.c
new file mode 100644
index 0000000..5ba4920
--- /dev/null
+++ b/res/res_format_attr_g729.c
@@ -0,0 +1,76 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2016, Digium, Inc.
+ *
+ * Jason Parker <jparker at sangoma.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*** MODULEINFO
+	<support_level>core</support_level>
+ ***/
+
+#include "asterisk.h"
+
+ASTERISK_REGISTER_FILE()
+
+#include "asterisk/module.h"
+#include "asterisk/format.h"
+
+/* Destroy is a required callback and must exist */
+static void g729_destroy(struct ast_format *format)
+{
+}
+
+/* Clone is a required callback and must exist */
+static int g729_clone(const struct ast_format *src, struct ast_format *dst)
+{
+	return 0;
+}
+
+static void g729_generate_sdp_fmtp(const struct ast_format *format, unsigned int payload, struct ast_str **str)
+{
+	/*
+	 * According to the rfc the joint annexb format parameter should be set to 'yes'
+	 * or 'no' based on the answerer (rfc7261 - 3.3). However, Asterisk being a B2BUA
+	 * makes things tricky. So for now Asterisk will set annexb=no.
+	 */
+	ast_str_append(str, 0, "a=fmtp:%u annexb=no\r\n", payload);
+}
+
+static struct ast_format_interface g729_interface = {
+	.format_destroy = g729_destroy,
+	.format_clone = g729_clone,
+	.format_generate_sdp_fmtp = g729_generate_sdp_fmtp,
+};
+
+static int load_module(void)
+{
+	if (ast_format_interface_register("g729", &g729_interface)) {
+		return AST_MODULE_LOAD_DECLINE;
+	}
+
+	return AST_MODULE_LOAD_SUCCESS;
+}
+
+static int unload_module(void)
+{
+	return 0;
+}
+
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "G.729 Format Attribute Module",
+	.support_level = AST_MODULE_SUPPORT_CORE,
+	.load = load_module,
+	.unload = unload_module,
+	.load_pri = AST_MODPRI_CHANNEL_DEPEND,
+);

-- 
To view, visit https://gerrit.asterisk.org/3575
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I76bc20cc0a01af01536e9915afef319c269c22d0
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>



More information about the asterisk-code-review mailing list