Add support for LCLS to the MSC

This commit is largely based on work by
Max <msuraev@sysmocom.de>

Adds LCLS parameters for A-interface transactions
This commit also adds a vty option to facilitate globally
disabling LCLS for all calls on this MSC.

Add a global call reference (GCR) to MNCC and therefore
bump the MNCC version to version 8. (This commit has to be
merged at the same time as the corresponing commit in the
osmo-sip-connector for mncc-external use.)

Depends: osmo-sip-connector Id40d7e0fed9356f801b3627c118150055e7232b1
Change-Id: I705c860e51637b4537cad65a330ecbaaca96dd5b
diff --git a/src/libmsc/gsm_04_08_cc.c b/src/libmsc/gsm_04_08_cc.c
index a8b4665..d6a2864 100644
--- a/src/libmsc/gsm_04_08_cc.c
+++ b/src/libmsc/gsm_04_08_cc.c
@@ -318,6 +318,16 @@
 		msc_a_get(msc_a, MSC_A_USE_CC);
 		trans->msc_a = msc_a;
 		trans->paging_request = NULL;
+
+		/* Get the GCR from the MO call leg (if any). */
+		if (!trans->cc.lcls) {
+			trans->cc.lcls = trans_lcls_compose(trans, true);
+			if (trans->cc.lcls) {
+				trans->cc.lcls->gcr = trans->cc.msg.gcr;
+				trans->cc.lcls->gcr_available = true;
+			}
+		}
+
 		osmo_fsm_inst_dispatch(msc_a->c.fi, MSC_A_EV_TRANSACTION_ACCEPTED, trans);
 		/* send SETUP request to called party */
 		gsm48_cc_tx_setup(trans, &trans->cc.msg);
@@ -502,6 +512,14 @@
 	memset(&setup, 0, sizeof(struct gsm_mncc));
 	setup.callref = trans->callref;
 
+	/* New Global Call Reference */
+	if (!trans->cc.lcls)
+		trans->cc.lcls = trans_lcls_compose(trans, true);
+
+	/* Pass the LCLS GCR on to the MT call leg via MNCC */
+	if (trans->cc.lcls)
+		setup.gcr = trans->cc.lcls->gcr;
+
 	tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0);
 	/* emergency setup is identified by msg_type */
 	if (msg_type == GSM48_MT_CC_EMERG_SETUP) {