bsc: Add a "IPA PING" to the SCCP CR messages

We want to reduce the background traffic and might set the ping
interval to be in the range of minutes. But this means that if
the TCP connection is frozen several "SCCP CR CM Service Requests"
will be stuck in the send queue without ever being answered. I
could have used the logic of not receiving the "SCCP CC" to close
the connection but instead I am introducing an overload to schedule
the ping as part of the normal SCCP connection establishment.

The VTY write case has been manually verified, I have also looked
at a single trace to see that the SCCP CR and the IPA PING is
transfered in the same ethernet frame.
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_vty.c b/openbsc/src/osmo-bsc/osmo_bsc_vty.c
index eb12287..b1d09f3 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_vty.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_vty.c
@@ -112,6 +112,10 @@
 	vty_out(vty, " ip.access rtp-base %d%s", msc->rtp_base, VTY_NEWLINE);
 	vty_out(vty, " timeout-ping %d%s", msc->ping_timeout, VTY_NEWLINE);
 	vty_out(vty, " timeout-pong %d%s", msc->pong_timeout, VTY_NEWLINE);
+	if (msc->advanced_ping)
+		vty_out(vty, " timeout-ping advanced%s", VTY_NEWLINE);
+	else
+		vty_out(vty, " no timeout-ping advanced%s", VTY_NEWLINE);
 
 	if (msc->ussd_welcome_txt)
 		vty_out(vty, " bsc-welcome-text %s%s", msc->ussd_welcome_txt, VTY_NEWLINE);
@@ -372,6 +376,26 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(cfg_net_msc_advanced_ping,
+      cfg_net_msc_advanced_ping_cmd,
+      "timeout-ping advanced",
+      "Ping timeout handling\nEnable advanced mode during SCCP\n")
+{
+	struct osmo_msc_data *data = osmo_msc_data(vty);
+	data->advanced_ping = 1;
+	return CMD_SUCCESS;
+}
+
+DEFUN(cfg_no_net_msc_advanced_ping,
+      cfg_no_net_msc_advanced_ping_cmd,
+      "no timeout-ping advanced",
+      NO_STR "Ping timeout handling\nEnable advanced mode during SCCP\n")
+{
+	struct osmo_msc_data *data = osmo_msc_data(vty);
+	data->advanced_ping = 0;
+	return CMD_SUCCESS;
+}
+
 DEFUN(cfg_net_msc_welcome_ussd,
       cfg_net_msc_welcome_ussd_cmd,
       "bsc-welcome-text .TEXT",
@@ -719,6 +743,8 @@
 	install_element(MSC_NODE, &cfg_net_msc_no_dest_cmd);
 	install_element(MSC_NODE, &cfg_net_msc_ping_time_cmd);
 	install_element(MSC_NODE, &cfg_net_msc_pong_time_cmd);
+	install_element(MSC_NODE, &cfg_net_msc_advanced_ping_cmd);
+	install_element(MSC_NODE, &cfg_no_net_msc_advanced_ping_cmd);
 	install_element(MSC_NODE, &cfg_net_msc_welcome_ussd_cmd);
 	install_element(MSC_NODE, &cfg_net_msc_no_welcome_ussd_cmd);
 	install_element(MSC_NODE, &cfg_net_msc_lost_ussd_cmd);