mgcp-client: add mgcp_conn_get_ci()

Return the CI string allocated by the MGW and sent back during CRCX ACK.

So far the CI that identifies one connection of an MGW endpoint is "hidden"
behind mgcp_conn_* API. This CI string is however very interesting, for
logging, to be able to correlate with MGCP messages in network traces.

For osmo-bsc, there is an upcoming mgw_endpoint_fsm that will log the CI string
using this function.

Change-Id: I0c802c0cc3fa0aae9558bd7f15aad1cb9a8b12b2
diff --git a/include/osmocom/mgcp_client/mgcp_client_fsm.h b/include/osmocom/mgcp_client/mgcp_client_fsm.h
index 7d06178..93fe582 100644
--- a/include/osmocom/mgcp_client/mgcp_client_fsm.h
+++ b/include/osmocom/mgcp_client/mgcp_client_fsm.h
@@ -31,3 +31,5 @@
 				       uint32_t parent_evt, struct mgcp_conn_peer *conn_peer);
 int mgcp_conn_modify(struct osmo_fsm_inst *fi, uint32_t parent_evt, struct mgcp_conn_peer *conn_peer);
 void mgcp_conn_delete(struct osmo_fsm_inst *fi);
+
+const char *mgcp_conn_get_ci(struct osmo_fsm_inst *fi);
diff --git a/src/libosmo-mgcp-client/mgcp_client_fsm.c b/src/libosmo-mgcp-client/mgcp_client_fsm.c
index 6f84ffa..10a5b6d 100644
--- a/src/libosmo-mgcp-client/mgcp_client_fsm.c
+++ b/src/libosmo-mgcp-client/mgcp_client_fsm.c
@@ -215,6 +215,14 @@
 	}
 }
 
+/* Return the CI that the MGW allocated during CRCX response. This is purely informational for logging
+ * and identity tracking; the mgcp_conn_*() functions take care of using the right CI internally. */
+const char *mgcp_conn_get_ci(struct osmo_fsm_inst *fi)
+{
+	struct mgcp_ctx *mgcp_ctx = fi->priv;
+	return mgcp_ctx->conn_id;
+}
+
 static void mgw_crcx_resp_cb(struct mgcp_response *r, void *priv)
 {
 	struct osmo_fsm_inst *fi = priv;