diff options
author | Pablo Neira Ayuso <pablo@soleta.eu> | 2014-08-27 14:58:43 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@soleta.eu> | 2014-08-27 16:56:08 +0200 |
commit | 8be171e88f2a64c29f93cf325945a7b5156b87ec (patch) | |
tree | 0418418eff27bb54cef4f4dcae4fe8f8eb50cb75 /openbsc/src/libmgcp/mgcp_protocol.c | |
parent | fd1d961af507f2913b1d23a31c45e4f3f7ce497b (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/libmgcp/mgcp_protocol.c')
-rw-r--r-- | openbsc/src/libmgcp/mgcp_protocol.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/openbsc/src/libmgcp/mgcp_protocol.c b/openbsc/src/libmgcp/mgcp_protocol.c index 0989cc6eb..0681c1038 100644 --- a/openbsc/src/libmgcp/mgcp_protocol.c +++ b/openbsc/src/libmgcp/mgcp_protocol.c @@ -879,6 +879,24 @@ uint32_t mgcp_rtp_packet_duration(struct mgcp_endpoint *endp, return rtp->rate * f * rtp->frame_duration_num / rtp->frame_duration_den; } +static int mgcp_osmux_setup(struct mgcp_endpoint *endp) +{ + if (!endp->cfg->osmux_init) { + if (osmux_init(OSMUX_ROLE_BSC, endp->cfg) < 0) { + LOGP(DMGCP, LOGL_ERROR, "Cannot init OSMUX\n"); + return -1; + } + LOGP(DMGCP, LOGL_NOTICE, "OSMUX socket has been set up\n"); + } + + if (osmux_enable_endpoint(endp, OSMUX_ROLE_BSC) < 0) { + LOGP(DMGCP, LOGL_ERROR, + "Could not activate Osmux in endpoint %d\n", + ENDPOINT_NUMBER(endp)); + } + return 0; +} + static struct msgb *handle_create_con(struct mgcp_parse_data *p) { struct mgcp_trunk_config *tcfg; @@ -910,12 +928,8 @@ static struct msgb *handle_create_con(struct mgcp_parse_data *p) mode = (const char *) line + 3; break; case 'X': - if (strcmp("Osmux: on", line + 2) == 0 && - osmux_enable_endpoint(endp, OSMUX_ROLE_BSC) < 0) { - LOGP(DMGCP, LOGL_ERROR, - "Could not activate osmux in endpoint %d\n", - ENDPOINT_NUMBER(endp)); - } + if (strcmp("Osmux: on", line + 2) == 0) + mgcp_osmux_setup(endp); break; case '\0': have_sdp = 1; |