mirror of
https://gerrit.osmocom.org/osmo-gbproxy
synced 2024-08-21 18:36:25 +00:00
mgcp: Set output_enabled flags based on the MGCP mode
This patch enhances parse_conn_mode() to set the output_enabled flags of each end based on the MGCP mode. Ticket: OW#1044 Sponsored-by: On-Waves ehf
This commit is contained in:
parent
acd8d52809
commit
ecd157ac76
2 changed files with 37 additions and 14 deletions
|
@ -488,22 +488,45 @@ static struct msgb *handle_audit_endpoint(struct mgcp_parse_data *p)
|
|||
return create_ok_response(p->endp, 200, "AUEP", p->trans);
|
||||
}
|
||||
|
||||
static int parse_conn_mode(const char *msg, int *conn_mode)
|
||||
static int parse_conn_mode(const char *msg, struct mgcp_endpoint *endp)
|
||||
{
|
||||
int ret = 0;
|
||||
if (strcmp(msg, "recvonly") == 0)
|
||||
*conn_mode = MGCP_CONN_RECV_ONLY;
|
||||
endp->conn_mode = MGCP_CONN_RECV_ONLY;
|
||||
else if (strcmp(msg, "sendrecv") == 0)
|
||||
*conn_mode = MGCP_CONN_RECV_SEND;
|
||||
endp->conn_mode = MGCP_CONN_RECV_SEND;
|
||||
else if (strcmp(msg, "sendonly") == 0)
|
||||
*conn_mode = MGCP_CONN_SEND_ONLY;
|
||||
endp->conn_mode = MGCP_CONN_SEND_ONLY;
|
||||
else if (strcmp(msg, "loopback") == 0)
|
||||
*conn_mode = MGCP_CONN_LOOPBACK;
|
||||
endp->conn_mode = MGCP_CONN_LOOPBACK;
|
||||
else {
|
||||
LOGP(DMGCP, LOGL_ERROR, "Unknown connection mode: '%s'\n", msg);
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
switch (endp->conn_mode) {
|
||||
case MGCP_CONN_NONE:
|
||||
endp->net_end.output_enabled = 0;
|
||||
endp->bts_end.output_enabled = 0;
|
||||
break;
|
||||
|
||||
case MGCP_CONN_RECV_ONLY:
|
||||
endp->net_end.output_enabled = 0;
|
||||
endp->bts_end.output_enabled = 1;
|
||||
break;
|
||||
|
||||
case MGCP_CONN_SEND_ONLY:
|
||||
endp->net_end.output_enabled = 1;
|
||||
endp->bts_end.output_enabled = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
endp->net_end.output_enabled = 1;
|
||||
endp->bts_end.output_enabled = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -794,7 +817,7 @@ mgcp_header_done:
|
|||
set_local_cx_options(endp->tcfg->endpoints, &endp->local_options,
|
||||
local_options);
|
||||
|
||||
if (parse_conn_mode(mode, &endp->conn_mode) != 0) {
|
||||
if (parse_conn_mode(mode, endp) != 0) {
|
||||
error_code = 517;
|
||||
goto error2;
|
||||
}
|
||||
|
@ -895,7 +918,7 @@ static struct msgb *handle_modify_con(struct mgcp_parse_data *p)
|
|||
local_options = (const char *) line + 3;
|
||||
break;
|
||||
case 'M':
|
||||
if (parse_conn_mode(line + 3, &endp->conn_mode) != 0) {
|
||||
if (parse_conn_mode(line + 3, endp) != 0) {
|
||||
error_code = 517;
|
||||
goto error3;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ Testing MDCX2
|
|||
Testing CRCX
|
||||
Detected packet duration: 40
|
||||
Requested packetetization period: 20-20
|
||||
Connection mode: 1, BTS output disabled, NET output disabled
|
||||
Connection mode: 1, BTS output enabled, NET output disabled
|
||||
Testing MDCX3
|
||||
Packet duration not set
|
||||
Requested packetization period not set
|
||||
|
@ -26,23 +26,23 @@ Connection mode not set
|
|||
Testing MDCX4
|
||||
Detected packet duration: 40
|
||||
Requested packetetization period: 20-20
|
||||
Connection mode: 3, BTS output disabled, NET output disabled
|
||||
Connection mode: 3, BTS output enabled, NET output enabled
|
||||
Testing MDCX4_PT1
|
||||
Detected packet duration: 40
|
||||
Requested packetetization period: 20-40
|
||||
Connection mode: 3, BTS output disabled, NET output disabled
|
||||
Connection mode: 3, BTS output enabled, NET output enabled
|
||||
Testing MDCX4_PT2
|
||||
Detected packet duration: 40
|
||||
Requested packetetization period: 20-20
|
||||
Connection mode: 3, BTS output disabled, NET output disabled
|
||||
Connection mode: 3, BTS output enabled, NET output enabled
|
||||
Testing MDCX4_PT3
|
||||
Detected packet duration: 40
|
||||
Requested packetization period not set
|
||||
Connection mode: 3, BTS output disabled, NET output disabled
|
||||
Connection mode: 3, BTS output enabled, NET output enabled
|
||||
Testing MDCX4_SO
|
||||
Detected packet duration: 40
|
||||
Requested packetetization period: 20-20
|
||||
Connection mode: 2, BTS output disabled, NET output disabled
|
||||
Connection mode: 2, BTS output disabled, NET output enabled
|
||||
Testing DLCX
|
||||
Detected packet duration: 20
|
||||
Requested packetization period not set
|
||||
|
@ -50,7 +50,7 @@ Connection mode: 0, BTS output enabled, NET output enabled
|
|||
Testing CRCX_ZYN
|
||||
Packet duration not set
|
||||
Requested packetization period not set
|
||||
Connection mode: 1, BTS output disabled, NET output disabled
|
||||
Connection mode: 1, BTS output enabled, NET output disabled
|
||||
Testing EMPTY
|
||||
Testing SHORT1
|
||||
Testing SHORT2
|
||||
|
|
Loading…
Reference in a new issue