aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmgcp
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-10-02 17:38:27 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-10-12 09:11:25 +0200
commit6598ded5cdbdaee8ee2aa9b8da283582b90840ed (patch)
treea07e1129f0d0fc5f711dc256f0c9e45afac49306 /openbsc/src/libmgcp
parent15a40db606e317e9304651b5f644eeae151efd8d (diff)
osmux: Allow to enforce using Osmux for the client
Some systems only want to use Osmux. In case only Osmux should be used fail if it has not be offered/acked. Client: Verified On, Off and Only with X-Osmux: 3 and without this field. <000b> mgcp_protocol.c:823 Osmux only and no osmux offered on 0x14 <000b> mgcp_protocol.c:884 Resource error on 0x14 NAT: Not tested and implemented Fixes: OW#1492
Diffstat (limited to 'openbsc/src/libmgcp')
-rw-r--r--openbsc/src/libmgcp/mgcp_protocol.c4
-rw-r--r--openbsc/src/libmgcp/mgcp_vty.c45
2 files changed, 35 insertions, 14 deletions
diff --git a/openbsc/src/libmgcp/mgcp_protocol.c b/openbsc/src/libmgcp/mgcp_protocol.c
index ab98be1d..e2bda3af 100644
--- a/openbsc/src/libmgcp/mgcp_protocol.c
+++ b/openbsc/src/libmgcp/mgcp_protocol.c
@@ -818,6 +818,10 @@ mgcp_header_done:
if (osmux_cid >= 0) {
endp->osmux.cid = osmux_cid;
endp->osmux.state = OSMUX_STATE_ACTIVATING;
+ } else if(endp->cfg->osmux == OSMUX_USAGE_ONLY) {
+ LOGP(DMGCP, LOGL_ERROR,
+ "Osmux only and no osmux offered on 0x%x\n", ENDPOINT_NUMBER(endp));
+ goto error2;
}
endp->allocated = 1;
diff --git a/openbsc/src/libmgcp/mgcp_vty.c b/openbsc/src/libmgcp/mgcp_vty.c
index 2b764364..c478b0a7 100644
--- a/openbsc/src/libmgcp/mgcp_vty.c
+++ b/openbsc/src/libmgcp/mgcp_vty.c
@@ -139,8 +139,19 @@ static int config_write_mgcp(struct vty *vty)
if (g_cfg->bts_force_ptime > 0)
vty_out(vty, " rtp force-ptime %d%s", g_cfg->bts_force_ptime, 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);
+
+ switch (g_cfg->osmux) {
+ case OSMUX_USAGE_ON:
+ vty_out(vty, " osmux on%s", VTY_NEWLINE);
+ break;
+ case OSMUX_USAGE_ONLY:
+ vty_out(vty, " osmux only%s", VTY_NEWLINE);
+ break;
+ case OSMUX_USAGE_OFF:
+ default:
+ vty_out(vty, " osmux off%s", VTY_NEWLINE);
+ break;
+ }
if (g_cfg->osmux) {
vty_out(vty, " osmux batch-factor %d%s",
g_cfg->osmux_batch, VTY_NEWLINE);
@@ -1249,18 +1260,24 @@ DEFUN(reset_all_endp, reset_all_endp_cmd,
#define OSMUX_STR "RTP multiplexing\n"
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;
+ "osmux (on|off|only)",
+ OSMUX_STR "Enable OSMUX\n" "Disable OSMUX\n" "Only use OSMUX\n")
+{
+ if (strcmp(argv[0], "off") == 0) {
+ g_cfg->osmux = OSMUX_USAGE_OFF;
+ return CMD_SUCCESS;
+ }
+
+ if (strcmp(argv[0], "on") == 0)
+ g_cfg->osmux = OSMUX_USAGE_ON;
+ else if (strcmp(argv[0], "only") == 0)
+ g_cfg->osmux = OSMUX_USAGE_ONLY;
+
+ if (g_cfg->trunk.audio_loop) {
+ vty_out(vty, "Cannot use `loop' with `osmux'.%s",
+ VTY_NEWLINE);
+ return CMD_WARNING;
+ }
return CMD_SUCCESS;
}