[PATCH 7/8] mgcp: Handle SDP in CRCX received by the MGW

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/OpenBSC@lists.osmocom.org/.

Jacob Erlbeck jerlbeck at sysmocom.de
Fri Nov 29 12:43:49 UTC 2013


So far the SDP part of the CRCX message has been ignored by the MGW.

This patch adds SDP parsing for this case, eventually updating the
net end's payload type and connection parameters.

Sponsored-by: On-Waves ehf
---
 openbsc/src/libmgcp/mgcp_protocol.c |    9 +++++++++
 openbsc/tests/mgcp/mgcp_test.c      |    4 ++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/openbsc/src/libmgcp/mgcp_protocol.c b/openbsc/src/libmgcp/mgcp_protocol.c
index 44c93f7..270f4bc 100644
--- a/openbsc/src/libmgcp/mgcp_protocol.c
+++ b/openbsc/src/libmgcp/mgcp_protocol.c
@@ -621,6 +621,7 @@ static struct msgb *handle_create_con(struct mgcp_parse_data *p)
 	const char *callid = NULL;
 	const char *mode = NULL;
 	char *line;
+	int have_sdp = 0;
 
 	if (p->found != 0)
 		return create_err_response(NULL, 510, "CRCX", p->trans);
@@ -637,6 +638,9 @@ static struct msgb *handle_create_con(struct mgcp_parse_data *p)
 		case 'M':
 			mode = (const char *) line + 3;
 			break;
+		case '\0':
+			have_sdp = 1;
+			goto mgcp_header_done;
 		default:
 			LOGP(DMGCP, LOGL_NOTICE, "Unhandled option: '%c'/%d on 0x%x\n",
 				*line, *line, ENDPOINT_NUMBER(endp));
@@ -644,6 +648,7 @@ static struct msgb *handle_create_con(struct mgcp_parse_data *p)
 		}
 	}
 
+mgcp_header_done:
 	tcfg = p->endp->tcfg;
 
 	/* Check required data */
@@ -694,9 +699,13 @@ static struct msgb *handle_create_con(struct mgcp_parse_data *p)
 		goto error2;
 
 	endp->allocated = 1;
+
+	/* set up RTP media parameters */
 	endp->bts_end.payload_type = tcfg->audio_payload;
 	endp->bts_end.fmtp_extra = talloc_strdup(tcfg->endpoints,
 						tcfg->audio_fmtp_extra);
+	if (have_sdp)
+		parse_sdp_data(&endp->net_end, p);
 
 	/* policy CB */
 	if (p->cfg->policy_cb) {
diff --git a/openbsc/tests/mgcp/mgcp_test.c b/openbsc/tests/mgcp/mgcp_test.c
index 0aebb4c..c58f52d 100644
--- a/openbsc/tests/mgcp/mgcp_test.c
+++ b/openbsc/tests/mgcp/mgcp_test.c
@@ -182,11 +182,11 @@ static const struct mgcp_test tests[] = {
 	{ "AUEP2", AUEP2, AUEP2_RET },
 	{ "MDCX1", MDCX_WRONG_EP, MDCX_ERR_RET },
 	{ "MDCX2", MDCX_UNALLOCATED, MDCX_RET },
-	{ "CRCX", CRCX, CRCX_RET, PTYPE_NYI, 126 },
+	{ "CRCX", CRCX, CRCX_RET, 97, 126 },
 	{ "MDCX3", MDCX3, MDCX3_RET, PTYPE_NONE, 126 },
 	{ "MDCX4", MDCX4, MDCX4_RET, 99, 126 },
 	{ "DLCX", DLCX, DLCX_RET, -1, -1 },
-	{ "CRCX_ZYN", CRCX_ZYN, CRCX_ZYN_RET, PTYPE_NYI, 126 },
+	{ "CRCX_ZYN", CRCX_ZYN, CRCX_ZYN_RET, 97, 126 },
 	{ "EMPTY", EMPTY, EMPTY_RET },
 	{ "SHORT1", SHORT, SHORT_RET },
 	{ "SHORT2", SHORT2, SHORT2_RET },
-- 
1.7.9.5





More information about the OpenBSC mailing list