mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
synced 2025-11-02 21:13:44 +00:00
osmux: Allocate CID during CRCX
Change-Id: Ie0e1835ff7e99421de9a5741a5eb57a11c004f7e
This commit is contained in:
@@ -354,21 +354,27 @@ int mgcp_parse_header(struct mgcp_parse_data *pdata, char *data)
|
||||
|
||||
/*! Extract OSMUX CID from an MGCP parameter line (string).
|
||||
* \param[in] line single parameter line from the MGCP message
|
||||
* \returns OSMUX CID, -1 on error */
|
||||
* \returns OSMUX CID, -1 wildcard, -2 on error */
|
||||
int mgcp_parse_osmux_cid(const char *line)
|
||||
{
|
||||
int osmux_cid;
|
||||
|
||||
|
||||
if (strstr(line + 2, "Osmux: *")) {
|
||||
LOGP(DLMGCP, LOGL_DEBUG, "Parsed wilcard Osmux CID\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (sscanf(line + 2, "Osmux: %u", &osmux_cid) != 1) {
|
||||
LOGP(DLMGCP, LOGL_ERROR, "Failed parsing Osmux in MGCP msg line: %s\n",
|
||||
line);
|
||||
return -1;
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (osmux_cid > OSMUX_CID_MAX) {
|
||||
LOGP(DLMGCP, LOGL_ERROR, "Osmux ID too large: %u > %u\n",
|
||||
osmux_cid, OSMUX_CID_MAX);
|
||||
return -1;
|
||||
return -2;
|
||||
}
|
||||
LOGP(DLMGCP, LOGL_DEBUG, "bsc-nat offered Osmux CID %u\n", osmux_cid);
|
||||
|
||||
|
||||
@@ -783,7 +783,7 @@ static struct msgb *handle_create_con(struct mgcp_parse_data *p)
|
||||
const char *callid = NULL;
|
||||
const char *mode = NULL;
|
||||
char *line;
|
||||
int have_sdp = 0, osmux_cid = -1;
|
||||
int have_sdp = 0, osmux_cid = -2;
|
||||
struct mgcp_conn_rtp *conn = NULL;
|
||||
struct mgcp_conn *_conn = NULL;
|
||||
char conn_name[512];
|
||||
@@ -917,9 +917,12 @@ mgcp_header_done:
|
||||
/* Annotate Osmux circuit ID and set it to negotiating state until this
|
||||
* is fully set up from the dummy load. */
|
||||
conn->osmux.state = OSMUX_STATE_DISABLED;
|
||||
if (osmux_cid >= 0) {
|
||||
conn->osmux.cid = osmux_cid;
|
||||
if (osmux_cid >= -1) { /* -1 is wilcard, alloc next avail CID */
|
||||
conn->osmux.state = OSMUX_STATE_NEGOTIATING;
|
||||
if (conn_osmux_allocate_cid(conn, osmux_cid) == -1) {
|
||||
rate_ctr_inc(&rate_ctrs->ctr[MGCP_CRCX_FAIL_NO_OSMUX]);
|
||||
goto error2;
|
||||
}
|
||||
} else if (endp->cfg->osmux == OSMUX_USAGE_ONLY) {
|
||||
LOGPCONN(_conn, DLMGCP, LOGL_ERROR,
|
||||
"CRCX: osmux only and no osmux offered\n");
|
||||
|
||||
Reference in New Issue
Block a user