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
This commit is contained in:
Holger Hans Peter Freyther 2015-10-02 17:38:27 +02:00
parent 15a40db606
commit 6598ded5cd
3 changed files with 40 additions and 13 deletions

View File

@ -30,4 +30,10 @@ enum osmux_state {
OSMUX_STATE_ENABLED,
};
enum osmux_usage {
OSMUX_USAGE_OFF = 0,
OSMUX_USAGE_ON = 1,
OSMUX_USAGE_ONLY = 2,
};
#endif

View File

@ -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;

View File

@ -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")
"osmux (on|off|only)",
OSMUX_STR "Enable OSMUX\n" "Disable OSMUX\n" "Only use 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;
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;
}