Change in osmo-bsc[master]: handover_fsm: send HANDOVER PERFORMED msg on internal ho

dexter gerrit-no-reply at lists.osmocom.org
Mon Nov 12 12:06:42 UTC 2018


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/11734


Change subject: handover_fsm: send HANDOVER PERFORMED msg on internal ho
......................................................................

handover_fsm: send HANDOVER PERFORMED msg on internal ho

When an internal handover is done the specification demands to inform
the MSC about the event.

- Add sending of BSSMAP HANDOVER PERFORMED msg.

Change-Id: If26e5807280e0f75a423b3b04f8e3c698c82a351
Depends: libosmocore I825106858bd89afc9837811b8fed2e8accc82441
Related: OS#3645
---
M src/osmo-bsc/handover_fsm.c
M tests/handover/handover_test.c
2 files changed, 55 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/34/11734/1

diff --git a/src/osmo-bsc/handover_fsm.c b/src/osmo-bsc/handover_fsm.c
index 0107ef0..e2b0f06 100644
--- a/src/osmo-bsc/handover_fsm.c
+++ b/src/osmo-bsc/handover_fsm.c
@@ -670,6 +670,55 @@
 	}
 }
 
+static void send_handover_performed(struct gsm_subscriber_connection *conn)
+{
+	struct gsm_lchan *lchan = conn->lchan;
+	struct handover *ho = &conn->ho;
+	struct osmo_cell_global_id *cell;
+	struct gsm0808_handover_performed ho_perf_params;
+	struct msgb *msg;
+	struct gsm0808_speech_codec sc;
+
+	memset(&ho_perf_params, 0, sizeof(ho_perf_params));
+
+	/* Cause 3.2.2.5 */
+	ho_perf_params.cause = GSM0808_CAUSE_HANDOVER_SUCCESSFUL;
+
+	/* Cell Identifier 3.2.2.17 */
+	cell = cgi_for_msc(conn->sccp.msc, conn_get_bts(conn));
+	if (!cell)
+		return;
+	memcpy(&ho_perf_params.cell, cell, sizeof(ho_perf_params.cell));
+
+	/* Chosen Channel 3.2.2.33 */
+	ho_perf_params.chosen_channel = gsm0808_chosen_channel(lchan->type, lchan->tch_mode);
+	if (!ho_perf_params.chosen_channel)
+		return;
+	ho_perf_params.chosen_channel_present = true;
+
+	/* Chosen Encryption Algorithm 3.2.2.44 */
+	ho_perf_params.chosen_encr_alg = lchan->encr.alg_id;
+	ho_perf_params.chosen_encr_alg_present = true;
+
+	if (ho->new_lchan->activate.requires_voice_stream) {
+		/* Speech Version (chosen) 3.2.2.51 */
+		ho_perf_params.speech_version_chosen = gsm0808_permitted_speech(lchan->type, lchan->tch_mode);
+		ho_perf_params.speech_version_chosen_present = true;
+
+		/* Speech Codec (chosen) 3.2.2.104 */
+		if (gscon_is_aoip(conn)) {
+			/* Extrapolate speech codec from speech mode */
+			gsm0808_speech_codec_from_chan_type(&sc, ho_perf_params.speech_version_chosen);
+			sc.cfg = conn->assignment.req.s15_s0;
+			memcpy(&ho_perf_params.speech_codec_chosen, &sc, sizeof(sc));
+			ho_perf_params.speech_codec_chosen_present = true;
+		}
+	}
+
+	msg = gsm0808_create_handover_performed(&ho_perf_params);
+	gscon_sigtran_send(conn, msg);
+}
+
 /* Notify the handover decision algorithm of failure and clear out any handover state. */
 void handover_end(struct gsm_subscriber_connection *conn, enum handover_result result)
 {
@@ -738,6 +787,10 @@
 	if (result == HO_RESULT_OK)
 		conn->ho.created_ci_for_msc = NULL;
 
+	/* If the performed handover was an INTRA BSC HANDOVER, inform the MSC that a handover has happend */
+	if (result == HO_RESULT_OK && (ho->scope & HO_INTRA_CELL || ho->scope & HO_INTRA_BSC))
+		send_handover_performed(conn);
+
 	hdc = handover_decision_callbacks_get(ho->from_hodec_id);
 	if (hdc && hdc->on_handover_end)
 		hdc->on_handover_end(conn, result);
diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index 7cb4086..c0a2833 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -219,6 +219,8 @@
 void create_conn(struct gsm_lchan *lchan)
 {
 	static struct bsc_msc_data fake_msc_data = {};
+	struct gsm_network fake_bsc_gsmnet = {};
+	fake_msc_data.network = &fake_bsc_gsmnet;
 	static unsigned int next_imsi = 0;
 	char imsi[sizeof(lchan->conn->bsub->imsi)];
 	struct gsm_network *net = lchan->ts->trx->bts->network;

-- 
To view, visit https://gerrit.osmocom.org/11734
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: If26e5807280e0f75a423b3b04f8e3c698c82a351
Gerrit-Change-Number: 11734
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181112/aafa4eae/attachment.html>


More information about the gerrit-log mailing list