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/tests/mgcp/mgcp_test.c b/tests/mgcp/mgcp_test.c
index 99491e6..f35dc93 100644
--- a/tests/mgcp/mgcp_test.c
+++ b/tests/mgcp/mgcp_test.c
@@ -563,9 +563,8 @@
 
 	cfg = mgcp_config_alloc();
 
-	cfg->trunk.number_endpoints = 64;
+	cfg->trunk.vty_number_endpoints = 64;
 	mgcp_endpoints_allocate(&cfg->trunk);
-
 	cfg->policy_cb = mgcp_test_policy_cb;
 
 	mgcp_endpoints_allocate(mgcp_trunk_alloc(cfg, 1));
@@ -685,7 +684,7 @@
 
 	cfg = mgcp_config_alloc();
 
-	cfg->trunk.number_endpoints = 64;
+	cfg->trunk.vty_number_endpoints = 64;
 	mgcp_endpoints_allocate(&cfg->trunk);
 
 	mgcp_endpoints_allocate(mgcp_trunk_alloc(cfg, 1));
@@ -737,7 +736,7 @@
 	cfg = mgcp_config_alloc();
 	cfg->rqnt_cb = rqnt_cb;
 
-	cfg->trunk.number_endpoints = 64;
+	cfg->trunk.vty_number_endpoints = 64;
 	mgcp_endpoints_allocate(&cfg->trunk);
 
 	mgcp_endpoints_allocate(mgcp_trunk_alloc(cfg, 1));
@@ -1025,7 +1024,7 @@
 
 	endp.type = &ep_typeset.rtp;
 
-	trunk.number_endpoints = 1;
+	trunk.vty_number_endpoints = 1;
 	trunk.endpoints = &endp;
 	trunk.force_constant_ssrc = patch_ssrc;
 	trunk.force_aligned_timing = patch_ts;
@@ -1097,7 +1096,7 @@
 	printf("Testing multiple payload types\n");
 
 	cfg = mgcp_config_alloc();
-	cfg->trunk.number_endpoints = 64;
+	cfg->trunk.vty_number_endpoints = 64;
 	mgcp_endpoints_allocate(&cfg->trunk);
 	cfg->policy_cb = mgcp_test_policy_cb;
 	mgcp_endpoints_allocate(mgcp_trunk_alloc(cfg, 1));
@@ -1228,7 +1227,7 @@
 	printf("Testing no sequence flow on initial packet\n");
 
 	cfg = mgcp_config_alloc();
-	cfg->trunk.number_endpoints = 64;
+	cfg->trunk.vty_number_endpoints = 64;
 	mgcp_endpoints_allocate(&cfg->trunk);
 
 	endp = &cfg->trunk.endpoints[1];
@@ -1274,7 +1273,7 @@
 	printf("Testing no rtpmap name\n");
 	cfg = mgcp_config_alloc();
 
-	cfg->trunk.number_endpoints = 64;
+	cfg->trunk.vty_number_endpoints = 64;
 	cfg->trunk.audio_send_name = 0;
 	mgcp_endpoints_allocate(&cfg->trunk);