From 59e7cf4437d8144753497a45a8f8d21ae52fcfde Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Sat, 1 May 2021 02:31:01 +0000 Subject: [PATCH] add osmo_mgcpc_ep_ci_get_remote_rtp_info() So far an mgcp_client user can get the RTP address+port information that the MGW has returned upon a CRCX. Add this function to return the other RTP end, i.e. address+port that the MGW was told to send RTP to. This will be used to fix the MGCP in osmo-bsc, which so far mixes up the two RTP ends and compares the MSC's RTP address+port with the MGW's one and hence fails to skip unnecessary MDCX. Change-Id: Ibb488925827d9dc0ccb1f8d6d84728745d086793 --- .../osmocom/mgcp_client/mgcp_client_endpoint_fsm.h | 2 ++ src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/osmocom/mgcp_client/mgcp_client_endpoint_fsm.h b/include/osmocom/mgcp_client/mgcp_client_endpoint_fsm.h index 736da22a8..78e3a41e1 100644 --- a/include/osmocom/mgcp_client/mgcp_client_endpoint_fsm.h +++ b/include/osmocom/mgcp_client/mgcp_client_endpoint_fsm.h @@ -23,6 +23,8 @@ const struct mgcp_conn_peer *osmo_mgcpc_ep_ci_get_rtp_info(const struct osmo_mgc bool osmo_mgcpc_ep_ci_get_crcx_info_to_sockaddr(const struct osmo_mgcpc_ep_ci *ci, struct sockaddr_storage *dest); bool osmo_mgcpc_ep_ci_get_crcx_info_to_osmux_cid(const struct osmo_mgcpc_ep_ci *ci, uint8_t* cid); +const struct mgcp_conn_peer *osmo_mgcpc_ep_ci_get_remote_rtp_info(const struct osmo_mgcpc_ep_ci *ci); + void osmo_mgcpc_ep_ci_request(struct osmo_mgcpc_ep_ci *ci, enum mgcp_verb verb, const struct mgcp_conn_peer *verb_info, struct osmo_fsm_inst *notify, diff --git a/src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c b/src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c index 2b94840e0..a55281c6d 100644 --- a/src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c +++ b/src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c @@ -508,7 +508,8 @@ static void on_success(struct osmo_mgcpc_ep_ci *ci, void *data) osmo_mgcpc_ep_fsm_check_state_chg_after_response(ci->ep->fi); } -/*! Return the MGW's RTP port information for this connection, as returned by the last CRCX/MDCX OK message. */ +/*! Return the MGW's local RTP port information for this connection, i.e. the local port that MGW is receiving on, as + * returned by the last CRCX-OK / MDCX-OK message. */ const struct mgcp_conn_peer *osmo_mgcpc_ep_ci_get_rtp_info(const struct osmo_mgcpc_ep_ci *ci) { ci = osmo_mgcpc_ep_check_ci((struct osmo_mgcpc_ep_ci*)ci); @@ -519,6 +520,16 @@ const struct mgcp_conn_peer *osmo_mgcpc_ep_ci_get_rtp_info(const struct osmo_mgc return &ci->rtp_info; } +/*! Return the MGW's remote RTP port information for this connection, i.e. the remote RTP port that the MGW is sending + * to, as sent to the MGW by the last CRCX / MDCX message. */ +const struct mgcp_conn_peer *osmo_mgcpc_ep_ci_get_remote_rtp_info(const struct osmo_mgcpc_ep_ci *ci) +{ + ci = osmo_mgcpc_ep_check_ci((struct osmo_mgcpc_ep_ci*)ci); + if (!ci) + return NULL; + return &ci->verb_info; +} + /*! Return the MGW's RTP port information for this connection, as returned by the last CRCX/MDCX OK message. */ bool osmo_mgcpc_ep_ci_get_crcx_info_to_sockaddr(const struct osmo_mgcpc_ep_ci *ci, struct sockaddr_storage *dest) {