vty: do not change number_endpoints at runtime

The variable number_endpoints is used as a length indicator
for the array that contains the trunk endpoints at all times.
When osmo-mgw is startet up, the variable is set and osmo-mgw
will allocate the memory for the endpoints. However, it is
still possible to manipulate the variable via the telnet
interface. When the value is increased osmo-mgw might start
using unallocated memory at some point.

Store subsequent changes of number_enspoints in a separate
variable in order to write them to the config file. The
changes will then take effect after a restart.

Closes: OS#2632
Change-Id: I3994af016fb96427263edbba05f560743f85fdd4
diff --git a/src/libosmo-mgcp/mgcp_vty.c b/src/libosmo-mgcp/mgcp_vty.c
index 9420d96..80396e0 100644
--- a/src/libosmo-mgcp/mgcp_vty.c
+++ b/src/libosmo-mgcp/mgcp_vty.c
@@ -115,7 +115,7 @@
 		g_cfg->trunk.audio_send_name ? "" : "no ", VTY_NEWLINE);
 	vty_out(vty, "  loop %u%s", ! !g_cfg->trunk.audio_loop, VTY_NEWLINE);
 	vty_out(vty, "  number endpoints %u%s",
-		g_cfg->trunk.number_endpoints - 1, VTY_NEWLINE);
+		g_cfg->trunk.vty_number_endpoints - 1, VTY_NEWLINE);
 	vty_out(vty, "  %sallow-transcoding%s",
 		g_cfg->trunk.no_audio_transcoding ? "no " : "", VTY_NEWLINE);
 	if (g_cfg->call_agent_addr)
@@ -524,7 +524,7 @@
       "Number options\n" "Endpoints available\n" "Number endpoints\n")
 {
 	/* + 1 as we start counting at one */
-	g_cfg->trunk.number_endpoints = atoi(argv[0]) + 1;
+	g_cfg->trunk.vty_number_endpoints = atoi(argv[0]) + 1;
 	return CMD_SUCCESS;
 }