From 67f9fd5526a208f05561d7d0196a853aa13fbdf0 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 14 Mar 2019 04:36:40 +0100 Subject: fix inter-BSC-HO-incoming for AoIP (2/2) For AoIP, the AoIP Transport Layer Address IE must be included in the Handover Request Acknowledge message, so the MSC can send RTP to the right place. Add this IE for AoIP. Depends: Ia71542ea37d4fd2c9fb9b40357db7aeb111ec576 (libosmocore) Depends: Id617265337f09dfb6ddfe111ef5e578cd3dc9f63 (libosmocore) Change-Id: Ia05e37da125eb6e7b7be9b974b73261bd72de1f4 --- src/osmo-bsc/osmo_bsc_bssap.c | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c index 470ae4248..e79a34469 100644 --- a/src/osmo-bsc/osmo_bsc_bssap.c +++ b/src/osmo-bsc/osmo_bsc_bssap.c @@ -43,6 +43,7 @@ #include #include #include +#include #define IP_V4_ADDR_LEN 4 @@ -1214,14 +1215,38 @@ int bsc_tx_bssmap_ho_request_ack(struct gsm_subscriber_connection *conn, struct { struct msgb *msg; struct gsm_lchan *new_lchan = conn->ho.new_lchan; + struct sockaddr_storage ss; + struct gsm0808_handover_request_ack params = { + .l3_info = rr_ho_command->data, + .l3_info_len = rr_ho_command->len, + .chosen_channel_present = true, + .chosen_channel = gsm0808_chosen_channel(new_lchan->type, new_lchan->tch_mode), + .chosen_encr_alg = new_lchan->encr.alg_id, + .chosen_speech_version = gsm0808_permitted_speech(new_lchan->type, new_lchan->tch_mode), + }; + + if (gscon_is_aoip(conn)) { + struct osmo_sockaddr_str to_msc_rtp; + const struct mgcp_conn_peer *rtp_info = osmo_mgcpc_ep_ci_get_rtp_info(conn->user_plane.mgw_endpoint_ci_msc); + if (!rtp_info) { + LOG_HO(conn, LOGL_ERROR, + "Handover Request Acknowledge: no RTP address known to send as" + " AoIP Transport Layer Address\n"); + return -EINVAL; + } + if (osmo_sockaddr_str_from_str(&to_msc_rtp, rtp_info->addr, rtp_info->port)) { + LOG_HO(conn, LOGL_ERROR, "Handover Request Acknowledge: cannot encode AoIP Transport Layer\n"); + return -EINVAL; + } + if (osmo_sockaddr_str_to_sockaddr(&to_msc_rtp, &ss)) { + LOG_HO(conn, LOGL_ERROR, "Handover Request Acknowledge: cannot encode AoIP Transport Layer\n"); + return -EINVAL; + } + params.aoip_transport_layer = &ss; + } LOG_HO(conn, LOGL_DEBUG, "Sending BSSMAP Handover Request Acknowledge\n"); - msg = gsm0808_create_handover_request_ack(rr_ho_command->data, rr_ho_command->len, - gsm0808_chosen_channel(new_lchan->type, - new_lchan->tch_mode), - new_lchan->encr.alg_id, - gsm0808_permitted_speech(new_lchan->type, - new_lchan->tch_mode)); + msg = gsm0808_create_handover_request_ack2(¶ms); msgb_free(rr_ho_command); if (!msg) return -ENOMEM; -- cgit v1.2.3