falconia has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/43969?usp=email )
Change subject: mgcp_client: add support for driving ThemWi transcoder MGW ......................................................................
mgcp_client: add support for driving ThemWi transcoder MGW
Hera TC MGW is an alternative MGW implementation intended for use with OsmoMSC. Unlike standard OsmoMGW, the new MGW incorporates speech transcoder functionality, acting as a software equivalent of a traditional GSM TRAU. Just like original TDM-based TRAUs, Hera TC MGW is highly asymmetric: one side is meant to connect to Ater-IP (AoIP compressed speech interface modified with ThemWi RTP payload formats, providing functionality of classic TDM Ater over IP), while the other side connects to further CN components and carries uncompressed PCM speech (G.711) in normal operation.
The dialect of MGCP spoken by Hera TC MGW requires two additions to libosmo-mgcp-client:
1) The endpoints are named transcoder/* instead of rtpbridge/*;
2) Each transcoder/* endpoint requires two CRCX commands for full connection just like rtpbridge/*, but each of these CRCX commands needs to indicate which side is being connected, RAN or CN, via non-standard "X-Side:" parameter line.
Change-Id: I713147d6567fb30de09b2272478d717093d6170e --- M TODO-RELEASE M include/osmocom/mgcp/mgcp_common.h M include/osmocom/mgcp_client/mgcp_client.h M include/osmocom/mgcp_client/mgcp_client_fsm.h M include/osmocom/mgcp_client/mgcp_client_internal.h M src/libosmo-mgcp-client/mgcp_client.c M src/libosmo-mgcp-client/mgcp_client_fsm.c 7 files changed, 48 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/69/43969/1
diff --git a/TODO-RELEASE b/TODO-RELEASE index 0ed7189..ba7c676 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -7,3 +7,5 @@ # If any interfaces have been added since the last public release: c:r:a + 1. # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line +libosmo-mgcp-client API addition mgcp_client_transcoder_wildcard() +libosmo-mgcp-client ABI break struct mgcp_conn_peer extended diff --git a/include/osmocom/mgcp/mgcp_common.h b/include/osmocom/mgcp/mgcp_common.h index 14b226f..0014eb5 100644 --- a/include/osmocom/mgcp/mgcp_common.h +++ b/include/osmocom/mgcp/mgcp_common.h @@ -113,4 +113,14 @@ * at once. */ #define MGCP_MAX_CODECS 10
+/* Themyscira Wireless MGW implementations are asymmetric: in the case of + * Hera TC MGW intended for use with OsmoMSC, one side is RAN while the other + * side is CN, and the MGW needs to know which side is which. There may be + * a future ThemWi MGW for use with OsmoBSC that will likewise need to know + * which side is AoIP and which side is Abis-IP. These MGWs require a + * non-standard X-Side parameter line to be included in CRCX command, e.g., + * "X-Side: RAN" or "X-Side: CN". Define the maximum allowed length of + * side ID string, including the terminating NUL. */ +#define MGCP_SIDE_ID_MAXLEN 16 + #endif diff --git a/include/osmocom/mgcp_client/mgcp_client.h b/include/osmocom/mgcp_client/mgcp_client.h index 2cddf00..16b9c6f 100644 --- a/include/osmocom/mgcp_client/mgcp_client.h +++ b/include/osmocom/mgcp_client/mgcp_client.h @@ -111,6 +111,7 @@
const char *mgcp_client_endpoint_domain(const struct mgcp_client *mgcp); const char *mgcp_client_rtpbridge_wildcard(const struct mgcp_client *mgcp); +const char *mgcp_client_transcoder_wildcard(const struct mgcp_client *mgcp); const char *mgcp_client_e1_epname(void *ctx, const struct mgcp_client *mgcp, uint8_t trunk_id, uint8_t ts, uint8_t rate, uint8_t offset);
diff --git a/include/osmocom/mgcp_client/mgcp_client_fsm.h b/include/osmocom/mgcp_client/mgcp_client_fsm.h index 3e31e9c..d51f77a 100644 --- a/include/osmocom/mgcp_client/mgcp_client_fsm.h +++ b/include/osmocom/mgcp_client/mgcp_client_fsm.h @@ -62,6 +62,16 @@ * here, see also mgcp_common.h. The format parameters will be applied on all codecs where applicable. */ bool param_present OSMO_DEPRECATED_OUTSIDE_LIBOSMOMGCPCLIENT("use ptmap[].fmtp instead"); struct mgcp_codec_param param OSMO_DEPRECATED_OUTSIDE_LIBOSMOMGCPCLIENT("use ptmap[].fmtp instead"); + + /*! osmo-msc is being extended with an option to operate with a ThemWi + * asymmetric MGW that requires non-standard X-Side parameter line + * to be included in CRCX command, as in "X-Side: RAN" for RAN side + * or "X-Side: CN" for CN side. If an application such as osmo-msc or + * osmo-bsc needs to drive such MGW, put the side ID string to be + * emitted with CRCX into this char buffer. No X-Side parameter line + * will be emitted if this char buffer is empty. + */ + char x_side[MGCP_SIDE_ID_MAXLEN]; };
struct osmo_fsm_inst *mgcp_conn_create(struct mgcp_client *mgcp, struct osmo_fsm_inst *parent_fi, uint32_t parent_term_evt, diff --git a/include/osmocom/mgcp_client/mgcp_client_internal.h b/include/osmocom/mgcp_client/mgcp_client_internal.h index ac55dfc..5251bd0 100644 --- a/include/osmocom/mgcp_client/mgcp_client_internal.h +++ b/include/osmocom/mgcp_client/mgcp_client_internal.h @@ -70,6 +70,7 @@ #define MGCP_MSG_PRESENCE_AUDIO_IP 0x0008 #define MGCP_MSG_PRESENCE_AUDIO_PORT 0x0010 #define MGCP_MSG_PRESENCE_CONN_MODE 0x0020 +#define MGCP_MSG_PRESENCE_X_SIDE 0x2000 #define MGCP_MSG_PRESENCE_X_OSMO_OSMUX_CID 0x4000 #define MGCP_MSG_PRESENCE_X_OSMO_IGN 0x8000
@@ -89,6 +90,7 @@ uint32_t x_osmo_ign; bool x_osmo_osmux_use; int x_osmo_osmux_cid; /* -1 is wildcard */ + char x_side[MGCP_SIDE_ID_MAXLEN]; bool param_present; struct mgcp_codec_param param; }; diff --git a/src/libosmo-mgcp-client/mgcp_client.c b/src/libosmo-mgcp-client/mgcp_client.c index 09c273c..162bebd 100644 --- a/src/libosmo-mgcp-client/mgcp_client.c +++ b/src/libosmo-mgcp-client/mgcp_client.c @@ -1103,6 +1103,15 @@ return _mgcp_client_name_append_domain(mgcp, "rtpbridge/*"); }
+/*! Compose endpoint name for a wildcarded request to ThemWi Ater-to-PCM + * transcoding MGW. + * \param[in] mgcp MGCP client descriptor. + * \returns string containing the endpoint name (e.g. transcoder*@mgw) */ +const char *mgcp_client_transcoder_wildcard(const struct mgcp_client *mgcp) +{ + return _mgcp_client_name_append_domain(mgcp, "transcoder/*"); +} + /*! Compose endpoint name for an E1 endpoint. * \param[in] ctx talloc context. * \param[in] mgcp MGCP client descriptor. @@ -1619,6 +1628,15 @@ mgcp_msg->x_osmo_osmux_cid == -1 ? " *" : buf); }
+ /* Add X-Side for asymmetric MGWs */ + if (mgcp_msg->presence & MGCP_MSG_PRESENCE_X_SIDE) { + if (strlen(mgcp_msg->x_side) <= 0) { + LOGPMGW(mgcp, LOGL_ERROR, "Empty side id, can not generate MGCP message\n"); + goto exit_error; + } + MSGB_PRINTF_OR_RET("X-Side: %s\r\n", mgcp_msg->x_side); + } +
/* Add session description protocol (SDP) */ if (use_sdp diff --git a/src/libosmo-mgcp-client/mgcp_client_fsm.c b/src/libosmo-mgcp-client/mgcp_client_fsm.c index 7a6fed8..156db05 100644 --- a/src/libosmo-mgcp-client/mgcp_client_fsm.c +++ b/src/libosmo-mgcp-client/mgcp_client_fsm.c @@ -131,6 +131,11 @@ mgcp_msg->x_osmo_osmux_cid = info->x_osmo_osmux_cid; mgcp_msg->presence |= MGCP_MSG_PRESENCE_X_OSMO_OSMUX_CID; } + + if (info->x_side[0]) { + osmo_strlcpy(mgcp_msg->x_side, info->x_side, MGCP_SIDE_ID_MAXLEN); + mgcp_msg->presence |= MGCP_MSG_PRESENCE_X_SIDE; + } }
static void add_audio(struct mgcp_msg *mgcp_msg, struct mgcp_conn_peer *info)