aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/osmo-bsc_nat
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@soleta.eu>2014-08-27 14:58:43 +0200
committerPablo Neira Ayuso <pablo@soleta.eu>2014-08-27 16:56:08 +0200
commit8be171e88f2a64c29f93cf325945a7b5156b87ec (patch)
tree0418418eff27bb54cef4f4dcae4fe8f8eb50cb75 /openbsc/src/osmo-bsc_nat
parentfd1d961af507f2913b1d23a31c45e4f3f7ce497b (diff)
osmux: move osmux socket initialization out of osmux_enable_endpoint()
In the bsc-nat side, the osmux socket initialization can be done from the vty. This ensure that the osmux socket is available by the time the bsc-nt receives the dummy load that confirms that the osmux flow has been set up. This change is required by the follow up patch. This change ensures that the Osmux socket in the bsc-nat is already in place by the time this receives the dummy load.
Diffstat (limited to 'openbsc/src/osmo-bsc_nat')
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat_vty.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c b/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c
index ab89db838..5229976af 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c
@@ -33,6 +33,7 @@
#include <osmocom/core/utils.h>
#include <osmocom/vty/logging.h>
#include <osmocom/vty/misc.h>
+#include <openbsc/osmux.h>
#include <osmocom/sccp/sccp.h>
@@ -1184,12 +1185,27 @@ DEFUN(cfg_bsc_osmux,
OSMUX_STR "Enable OSMUX\n" "Disable OSMUX\n")
{
struct bsc_config *conf = vty->index;
+ int old = conf->osmux;
if (strcmp(argv[0], "on") == 0)
conf->osmux = 1;
else if (strcmp(argv[0], "off") == 0)
conf->osmux = 0;
+ if (old == 0 && conf->osmux == 1) {
+ if (osmux_init(OSMUX_ROLE_BSC_NAT, conf->nat->mgcp_cfg) < 0) {
+ LOGP(DMGCP, LOGL_ERROR, "Cannot init OSMUX\n");
+ return -1;
+ }
+ LOGP(DMGCP, LOGL_NOTICE, "Setting up OSMUX socket\n");
+ } else if (old == 1 && conf->osmux == 0) {
+ LOGP(DMGCP, LOGL_NOTICE, "Disabling OSMUX socket\n");
+ /* Don't stop the socket, we may already have ongoing voice
+ * flows already using Osmux. This just switch indicates that
+ * new upcoming flows should use RTP.
+ */
+ }
+
return CMD_SUCCESS;
}