ussd: Send USSD on call setup on MSC errors

Send an USSD message to the mobile station requesting a connection
for a call or a SMS when the link to the MSC is down or in the
grace period.

The messages can be set (and this feature activated) by setting
bsc/missing-msc-text resp. msc/bsc-grace-text via the vty.

The generation of both messages has been tested manually.

Ticket: OW#957
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_sccp.c b/openbsc/src/osmo-bsc/osmo_bsc_sccp.c
index 87f415e..aa8c79c 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_sccp.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_sccp.c
@@ -188,35 +188,35 @@
 	return 0;
 }
 
-int bsc_create_new_connection(struct gsm_subscriber_connection *conn,
+enum bsc_con bsc_create_new_connection(struct gsm_subscriber_connection *conn,
 			      struct osmo_msc_data *msc)
 {
 	struct osmo_bsc_sccp_con *bsc_con;
 	struct sccp_connection *sccp;
 
 	/* This should not trigger */
-	if (!msc->msc_con->is_authenticated) {
+	if (!msc || !msc->msc_con->is_authenticated) {
 		LOGP(DMSC, LOGL_ERROR,
 		     "How did this happen? MSC is not connected. Dropping.\n");
-		return -1;
+		return BSC_CON_REJECT_NO_LINK;
 	}
 
 	if (!bsc_grace_allow_new_connection(conn->bts->network, conn->bts)) {
 		LOGP(DMSC, LOGL_NOTICE, "BSC in grace period. No new connections.\n");
-		return -1;
+		return BSC_CON_REJECT_RF_GRACE;
 	}
 
 	sccp = sccp_connection_socket();
 	if (!sccp) {
 		LOGP(DMSC, LOGL_ERROR, "Failed to allocate memory.\n");
-		return -ENOMEM;
+		return BSC_CON_NO_MEM;
 	}
 
 	bsc_con = talloc_zero(conn->bts, struct osmo_bsc_sccp_con);
 	if (!bsc_con) {
 		LOGP(DMSC, LOGL_ERROR, "Failed to allocate.\n");
 		sccp_connection_free(sccp);
-		return -1;
+		return BSC_CON_NO_MEM;
 	}
 
 	/* callbacks */
@@ -237,7 +237,7 @@
 	bsc_con->conn = conn;
 	llist_add_tail(&bsc_con->entry, &active_connections);
 	conn->sccp_con = bsc_con;
-	return 0;
+	return BSC_CON_SUCCESS;
 }
 
 int bsc_open_connection(struct osmo_bsc_sccp_con *conn, struct msgb *msg)