Change in osmo-mgw[master]: mgcp_sdp: restructure mgcp_write_response_sdp() (rtpmap)

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Aug 5 07:17:17 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/10310 )

Change subject: mgcp_sdp: restructure mgcp_write_response_sdp() (rtpmap)
......................................................................

mgcp_sdp: restructure mgcp_write_response_sdp() (rtpmap)

The function mgcp_write_response_sdp() generates the rtpmap lines in the
sdp response. Since we will likely support multiple codecs we will need
to generate several rtpmap lines. Therefore it makes sense to split up
that part in a separate function without altering the overall
functionality (yet)

- add static function add_rtpmap() to generate the rtpmap.

Change-Id: I520e2d40fe6294c88bae63dfcbc5238ef98101e2
Related: OS#3442
---
M src/libosmo-mgcp/mgcp_sdp.c
1 file changed, 20 insertions(+), 6 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/libosmo-mgcp/mgcp_sdp.c b/src/libosmo-mgcp/mgcp_sdp.c
index 102c8c3..a6def41 100644
--- a/src/libosmo-mgcp/mgcp_sdp.c
+++ b/src/libosmo-mgcp/mgcp_sdp.c
@@ -286,6 +286,24 @@
 	return 0;
 }
 
+
+/* Add rtpmap string to the sdp payload, but only when the payload type falls
+ * into the dynamic payload type range */
+static int add_rtpmap(struct msgb *sdp, int payload_type, const char *audio_name)
+{
+	int rc;
+
+	if (payload_type >= 96 && payload_type <= 127) {
+		if (!audio_name)
+			return -EINVAL;
+		rc = msgb_printf(sdp, "a=rtpmap:%d %s\r\n", payload_type, audio_name);
+		if (rc < 0)
+			return -EINVAL;
+	}
+
+	return 0;
+}
+
 /*! Generate SDP response string.
  *  \param[in] endp trunk endpoint.
  *  \param[in] conn associated rtp connection.
@@ -328,12 +346,8 @@
 		if (rc < 0)
 			goto buffer_too_small;
 
-		/* FIXME: Check if the payload type is from the static range,
-		 * if yes, omitthe a=rtpmap since it is unnecessary */
-		if (audio_name && endp->tcfg->audio_send_name && (payload_type >= 96 && payload_type <= 127)) {
-			rc = msgb_printf(sdp, "a=rtpmap:%d %s\r\n",
-					 payload_type, audio_name);
-
+		if (endp->tcfg->audio_send_name) {
+			rc = add_rtpmap(sdp, payload_type, audio_name);
 			if (rc < 0)
 				goto buffer_too_small;
 		}

-- 
To view, visit https://gerrit.osmocom.org/10310
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I520e2d40fe6294c88bae63dfcbc5238ef98101e2
Gerrit-Change-Number: 10310
Gerrit-PatchSet: 4
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180805/270349a4/attachment.htm>


More information about the gerrit-log mailing list