osmux: add 'osmux batch-size NUM' option to mgcp vty

This allows you to specify the osmux batch frame size. If zero, the
library uses the default value.
diff --git a/openbsc/include/openbsc/mgcp.h b/openbsc/include/openbsc/mgcp.h
index bf240a3..9015f69 100644
--- a/openbsc/include/openbsc/mgcp.h
+++ b/openbsc/include/openbsc/mgcp.h
@@ -217,6 +217,8 @@
 	int osmux_init;
 	/* osmux batch factor: from 1 to 4 maximum */
 	int osmux_batch;
+	/* osmux batch size (in bytes) */
+	int osmux_batch_size;
 	/* osmux port */
 	uint16_t osmux_port;
 };
diff --git a/openbsc/src/libmgcp/mgcp_osmux.c b/openbsc/src/libmgcp/mgcp_osmux.c
index 7c0b41c..c285de4 100644
--- a/openbsc/src/libmgcp/mgcp_osmux.c
+++ b/openbsc/src/libmgcp/mgcp_osmux.c
@@ -121,6 +121,8 @@
 
 	h->in->osmux_seq = 0; /* sequence number to start OSmux message from */
 	h->in->batch_factor = cfg->osmux_batch;
+	/* If batch size is zero, the library defaults to 1470 bytes. */
+	h->in->batch_size = cfg->osmux_batch_size;
 	h->in->deliver = osmux_deliver;
 	osmux_xfrm_input_init(h->in);
 	h->in->data = h;
diff --git a/openbsc/src/libmgcp/mgcp_vty.c b/openbsc/src/libmgcp/mgcp_vty.c
index d40a3ce..4dd89b7 100644
--- a/openbsc/src/libmgcp/mgcp_vty.c
+++ b/openbsc/src/libmgcp/mgcp_vty.c
@@ -135,6 +135,8 @@
 		g_cfg->osmux == 1 ? "on" : "off", VTY_NEWLINE);
 	vty_out(vty, "  osmux batch-factor %d%s",
 		g_cfg->osmux_batch, VTY_NEWLINE);
+	vty_out(vty, "  osmux batch-size %u%s",
+		g_cfg->osmux_batch_size, VTY_NEWLINE);
 	vty_out(vty, "  osmux port %u%s",
 		g_cfg->osmux_port, VTY_NEWLINE);
 
@@ -1134,6 +1136,15 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(cfg_mgcp_osmux_batch_size,
+      cfg_mgcp_osmux_batch_size_cmd,
+      "osmux batch-size <1-65535>",
+      OSMUX_STR "batch size\n" "Batch size in bytes\n")
+{
+	g_cfg->osmux_batch_size = atoi(argv[0]);
+	return CMD_SUCCESS;
+}
+
 DEFUN(cfg_mgcp_osmux_port,
       cfg_mgcp_osmux_port_cmd,
       "osmux port <1-65535>",
@@ -1198,6 +1209,7 @@
 	install_element(MGCP_NODE, &cfg_mgcp_no_sdp_payload_send_ptime_cmd);
 	install_element(MGCP_NODE, &cfg_mgcp_osmux_cmd);
 	install_element(MGCP_NODE, &cfg_mgcp_osmux_batch_factor_cmd);
+	install_element(MGCP_NODE, &cfg_mgcp_osmux_batch_size_cmd);
 	install_element(MGCP_NODE, &cfg_mgcp_osmux_port_cmd);
 
 	install_element(MGCP_NODE, &cfg_mgcp_trunk_cmd);