aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmgcp/mgcp_vty.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2014-02-05 18:56:17 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-05-22 14:39:16 +0200
commitcab6e7528c475d6aee687001a6146e5f20d8f53d (patch)
tree5d172538444f1b503ff3d2a7a09da5c139ad815f /openbsc/src/libmgcp/mgcp_vty.c
parent038f97a69fe58d2bcb6cabcb82b3485f7d622ed2 (diff)
mgcp: add voice muxer support
This patch adds the voice muxer. You can use this to batch RTP traffic to reduce bandwidth comsuption. Basically, osmux transforms RTP flows to a compact batch format, that is later on decompacted to its original form. Port UDP/1984 is used for the muxer traffic between osmo-bsc_nat and osmo-bsc_mgcp (in the BSC side). This feature depends on libosmo-netif, which contains the osmux core support. Osmux is requested on-demand via the MGCP CRCX/MDCX messages (using the vendor-specific extension X-Osmux: on) coming from the BSC-NAT, so you can selectively enable osmux per BSC from one the bsc-nat.cfg file, so we have a centralized point to enable/disable osmux. First thing you need to do is to accept requests to use Osmux, this can be done from VTY interface of osmo-bsc_nat and osmo-bsc_mgcp by adding the following line: mgcp ... osmux on osmux batch-factor 4 This just initializes the osmux engine. You still have to specify what BSC uses osmux from osmo-bsc_nat configuration file: ... bsc 1 osmux on bsc 2 ... bsc 3 osmux on In this case, bsc 1 and 3 should use osmux if possible, bsc 2 does not have osmux enabled. Thus, you can selectively enable osmux depending on the BSC, and we have a centralized point for configuration from the bsc-nat to enable osmux on demand, as suggested by Holger. At this moment, this patch contains heavy debug logging for each RTP packet that can be removed later to save cycles. The RTP ssrc/seqnum/timestamp is randomly allocated for each MDCX that is received to configure an endpoint.
Diffstat (limited to 'openbsc/src/libmgcp/mgcp_vty.c')
-rw-r--r--openbsc/src/libmgcp/mgcp_vty.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/openbsc/src/libmgcp/mgcp_vty.c b/openbsc/src/libmgcp/mgcp_vty.c
index 953d34b67..e9b7d1227 100644
--- a/openbsc/src/libmgcp/mgcp_vty.c
+++ b/openbsc/src/libmgcp/mgcp_vty.c
@@ -129,6 +129,10 @@ static int config_write_mgcp(struct vty *vty)
vty_out(vty, " rtp transcoder-range %u %u%s",
g_cfg->transcoder_ports.range_start, g_cfg->transcoder_ports.range_end, VTY_NEWLINE);
vty_out(vty, " transcoder-remote-base %u%s", g_cfg->transcoder_remote_base, VTY_NEWLINE);
+ vty_out(vty, " osmux %s%s",
+ g_cfg->osmux == 1 ? "on" : "off", VTY_NEWLINE);
+ vty_out(vty, " osmux batch-factor %d%s",
+ g_cfg->osmux_batch, VTY_NEWLINE);
return CMD_SUCCESS;
}
@@ -434,6 +438,10 @@ DEFUN(cfg_mgcp_loop,
"Loop audio for all endpoints on main trunk\n"
"Don't Loop\n" "Loop\n")
{
+ if (g_cfg->osmux) {
+ vty_out(vty, "Cannot use `loop' with `osmux'.%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
g_cfg->trunk.audio_loop = atoi(argv[0]);
return CMD_SUCCESS;
}
@@ -726,6 +734,10 @@ DEFUN(cfg_trunk_loop,
{
struct mgcp_trunk_config *trunk = vty->index;
+ if (g_cfg->osmux) {
+ vty_out(vty, "Cannot use `loop' with `osmux'.%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
trunk->audio_loop = atoi(argv[0]);
return CMD_SUCCESS;
}
@@ -1056,6 +1068,33 @@ DEFUN(reset_all_endp, reset_all_endp_cmd,
return CMD_SUCCESS;
}
+#define OSMUX_STR "RTP multiplexing"
+DEFUN(cfg_mgcp_osmux,
+ cfg_mgcp_osmux_cmd,
+ "osmux (on|off)",
+ OSMUX_STR "Enable OSMUX\n" "Disable OSMUX\n")
+{
+ if (strcmp(argv[0], "on") == 0) {
+ g_cfg->osmux = 1;
+ if (g_cfg->trunk.audio_loop) {
+ vty_out(vty, "Cannot use `loop' with `osmux'.%s",
+ VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ } else if (strcmp(argv[0], "off") == 0)
+ g_cfg->osmux = 0;
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_mgcp_osmux_batch_factor,
+ cfg_mgcp_osmux_batch_factor_cmd,
+ "osmux batch-factor <1-4>",
+ OSMUX_STR "Batching factor\n" "Number of messages in the batch\n")
+{
+ g_cfg->osmux_batch = atoi(argv[0]);
+ return CMD_SUCCESS;
+}
int mgcp_vty_init(void)
{
@@ -1108,6 +1147,8 @@ int mgcp_vty_init(void)
install_element(MGCP_NODE, &cfg_mgcp_sdp_fmtp_extra_cmd);
install_element(MGCP_NODE, &cfg_mgcp_sdp_payload_send_ptime_cmd);
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_trunk_cmd);
install_node(&trunk_node, config_write_trunk);
@@ -1203,6 +1244,9 @@ int mgcp_parse_config(const char *config_file, struct mgcp_config *cfg,
int rc;
struct mgcp_trunk_config *trunk;
+ /* Default to 4 messages */
+ cfg->osmux_batch = 4;
+
g_cfg = cfg;
rc = vty_read_config_file(config_file, NULL);
if (rc < 0) {