neels has uploaded this change for review.
mgw: do not fail MGCP on codec mismatch
Before this patch, when an CRCX+MDCX wants to set a codec list that has
no match with the codecs for the other conn of that same endpoint,
osmo-mgw returns an MGCP "FAIL" response.
When a client wants to change the codec, it has to do that one RTP port
at a time. So osmo-mgw *must* allow to configure an MGCP conn with a
codec choice that mismatches the other conn.
This is crucial to allow codec negotiation in osmo-msc: if MO has
already assigned a specific codec, and later wants to re-assign to the
codec that MT has chosen, the codec needs to be changed at osmo-mgw.
Still fail if one side has no codecs -- the only reason is that changing
this makes mgcp_test.c fail. (When the first CRCX arrives, how can the
other side have a codec; so this behavior may change in the future.)
Related: OS#6293
Related: osmo-msc I8760feaa8598047369ef8c3ab2673013bac8ac8a
Change-Id: I3d1163fe622bdd7dc42a485f796072524ab39db9
---
M src/libosmo-mgcp/mgcp_codec.c
1 file changed, 39 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/02/35302/1
diff --git a/src/libosmo-mgcp/mgcp_codec.c b/src/libosmo-mgcp/mgcp_codec.c
index 0fd1f61..47aba1e 100644
--- a/src/libosmo-mgcp/mgcp_codec.c
+++ b/src/libosmo-mgcp/mgcp_codec.c
@@ -475,7 +475,18 @@
}
}
- return -EINVAL;
+ LOGP(DLMGCP, LOGL_ERROR, "no matching codec found\n");
+ if (conn_dst->end.codecs_assigned)
+ conn_dst->end.codec = &conn_dst->end.codecs[0];
+ else
+ return -EINVAL;
+
+ if (conn_src->end.codecs_assigned)
+ conn_src->end.codec = &conn_src->end.codecs[0];
+ else
+ return -EINVAL;
+
+ return 0;
}
/* Check if the codec has a specific AMR mode (octet-aligned or bandwith-efficient) set. */
To view, visit change 35302. To unsubscribe, or for help writing mail filters, visit settings.