From 57e95a22f02b5b2ec781d9bc977c785a6e6f1166 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Fri, 17 Jul 2015 21:56:23 +0200 Subject: osmux: add option to pad the circuit with dummy messages Iridium is a satellite network which operates a GPRS-like that allows you to get speeds up to 128kbit/s. However, it takes from 5 to 6 secs to get the bandwidth allocated, so the conversation is garbled during the time. This patch uses the new dummy padding support in libosmo-netif that is controlled through the osmux osmux_xfrm_input_open_circuit(). This includes a new VTY option for osmux. --- openbsc/include/openbsc/mgcp.h | 4 ++++ openbsc/src/libmgcp/mgcp_osmux.c | 7 +++++++ openbsc/src/libmgcp/mgcp_vty.c | 16 ++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/openbsc/include/openbsc/mgcp.h b/openbsc/include/openbsc/mgcp.h index fb16cb40f..9befa7c7e 100644 --- a/openbsc/include/openbsc/mgcp.h +++ b/openbsc/include/openbsc/mgcp.h @@ -227,6 +227,10 @@ struct mgcp_config { int osmux_batch_size; /* osmux port */ uint16_t osmux_port; + /* Pad circuit with dummy messages until we see the first voice + * message. + */ + uint16_t osmux_dummy; }; /* config management */ diff --git a/openbsc/src/libmgcp/mgcp_osmux.c b/openbsc/src/libmgcp/mgcp_osmux.c index 7f61173a1..90b73680b 100644 --- a/openbsc/src/libmgcp/mgcp_osmux.c +++ b/openbsc/src/libmgcp/mgcp_osmux.c @@ -462,6 +462,12 @@ int osmux_enable_endpoint(struct mgcp_endpoint *endp, int role, LOGP(DMGCP, LOGL_ERROR, "Cannot allocate input osmux handle\n"); return -1; } + if (!osmux_xfrm_input_open_circuit(endp->osmux.in, endp->osmux.cid, + endp->cfg->osmux_dummy)) { + LOGP(DMGCP, LOGL_ERROR, "Cannot open osmux circuit %u\n", + endp->osmux.cid); + return -1; + } switch (endp->cfg->role) { case MGCP_BSC_NAT: @@ -480,6 +486,7 @@ void osmux_disable_endpoint(struct mgcp_endpoint *endp) { LOGP(DMGCP, LOGL_INFO, "Releasing endpoint %u using Osmux CID %u\n", ENDPOINT_NUMBER(endp), endp->osmux.cid); + osmux_xfrm_input_close_circuit(endp->osmux.in, endp->osmux.cid); endp->osmux.state = OSMUX_STATE_DISABLED; endp->osmux.cid = -1; osmux_handle_put(endp->osmux.in); diff --git a/openbsc/src/libmgcp/mgcp_vty.c b/openbsc/src/libmgcp/mgcp_vty.c index dd21a1537..8f6b10ab4 100644 --- a/openbsc/src/libmgcp/mgcp_vty.c +++ b/openbsc/src/libmgcp/mgcp_vty.c @@ -144,6 +144,8 @@ static int config_write_mgcp(struct vty *vty) g_cfg->osmux_batch_size, VTY_NEWLINE); vty_out(vty, " osmux port %u%s", g_cfg->osmux_port, VTY_NEWLINE); + vty_out(vty, " osmux dummy %s%s", + g_cfg->osmux_dummy ? "on" : "off", VTY_NEWLINE); } return CMD_SUCCESS; } @@ -1245,6 +1247,19 @@ DEFUN(cfg_mgcp_osmux_port, return CMD_SUCCESS; } +DEFUN(cfg_mgcp_osmux_dummy, + cfg_mgcp_osmux_dummy_cmd, + "osmux dummy (on|off)", + OSMUX_STR "Enable dummy padding\n" "Disable dummy padding\n") +{ + if (strcmp(argv[0], "on") == 0) + g_cfg->osmux_dummy = 1; + else if (strcmp(argv[0], "off") == 0) + g_cfg->osmux_dummy = 0; + + return CMD_SUCCESS; +} + int mgcp_vty_init(void) { install_element_ve(&show_mgcp_cmd); @@ -1304,6 +1319,7 @@ int mgcp_vty_init(void) 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_osmux_dummy_cmd); install_element(MGCP_NODE, &cfg_mgcp_allow_transcoding_cmd); install_element(MGCP_NODE, &cfg_mgcp_no_allow_transcoding_cmd); -- cgit v1.2.3