Change in ...osmo-mgw[master]: SDP: store all ptmap entries

neels gerrit-no-reply at lists.osmocom.org
Thu Aug 29 03:56:24 UTC 2019


neels has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-mgw/+/15141 )

Change subject: SDP: store all ptmap entries
......................................................................

SDP: store all ptmap entries

If a ptmap appears in the SDP, always store it in the ptmap array. No longer
attempt to drop entries if they match the conventional payload type number.

- One reason is that the past code only matched full explicit "FOO/8000/1"
  strings, while the channel number "/1" can be omitted to imply 1; by simply
  storing everything received in the SDP, there is no need to add complexity
  to match both "FOO/8000" and "FOO/8000/1".

- The other reason is to rather parse exactly what was received, instead of
  filtering entries, to take away a degree of implied magic.

Change-Id: I2a69c21e68c602daf804744212d335ab1eafd81b
---
M src/libosmo-mgcp-client/mgcp_client.c
1 file changed, 8 insertions(+), 20 deletions(-)

Approvals:
  Jenkins Builder: Verified
  neels: Looks good to me, approved
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, but someone else must approve



diff --git a/src/libosmo-mgcp-client/mgcp_client.c b/src/libosmo-mgcp-client/mgcp_client.c
index 6275385..5823e2b 100644
--- a/src/libosmo-mgcp-client/mgcp_client.c
+++ b/src/libosmo-mgcp-client/mgcp_client.c
@@ -337,7 +337,7 @@
 {
 	unsigned int pt;
 	char codec_resp[64];
-	unsigned int codec;
+	enum mgcp_codecs codec;
 
 #define A_PTIME "a=ptime:"
 #define A_RTPMAP "a=rtpmap:"
@@ -354,26 +354,14 @@
 			     "Failed to parse SDP parameter, invalid rtpmap: %s\n", osmo_quote_str(line, -1));
 			return -EINVAL;
 		}
-		/* The MGW may assign an own payload type in the
-		 * response if the choosen codec falls into the IANA
-		 * assigned dynamic payload type range (96-127).
-		 * Normally the MGW should obey the 3gpp payload type
-		 * assignments, which are fixed, so we likely wont see
-		 * anything unexpected here. In order to be sure that
-		 * we will now check the codec string and if the result
-		 * does not match to what is IANA / 3gpp assigned, we
-		 * will create an entry in the ptmap table so we can
-		 * lookup later what has been assigned. */
-		codec = map_str_to_codec(codec_resp);
-		if (codec != pt) {
-			if (r->ptmap_len >= ARRAY_SIZE(r->ptmap)) {
-				LOGP(DLMGCP, LOGL_ERROR, "No more space in ptmap array (len=%u)\n", r->ptmap_len);
-				return -ENOSPC;
-			}
-			r->ptmap[r->ptmap_len].pt = pt;
-			r->ptmap[r->ptmap_len].codec = codec;
-			r->ptmap_len++;
+		if (r->ptmap_len >= ARRAY_SIZE(r->ptmap)) {
+			LOGP(DLMGCP, LOGL_ERROR, "No more space in ptmap array (len=%u)\n", r->ptmap_len);
+			return -ENOSPC;
 		}
+		codec = map_str_to_codec(codec_resp);
+		r->ptmap[r->ptmap_len].pt = pt;
+		r->ptmap[r->ptmap_len].codec = codec;
+		r->ptmap_len++;
 	}
 
 	return 0;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/15141
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I2a69c21e68c602daf804744212d335ab1eafd81b
Gerrit-Change-Number: 15141
Gerrit-PatchSet: 5
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190829/62d100d1/attachment.html>


More information about the gerrit-log mailing list