Move RTP socket handling out of signal handlers into abis_rsl
This is not really nice, but we will soon have multiple users of the CRCX / MDCX / DLCX signals, and we cannot guarantee the ordering of them. So as a workaround, we move the RTP socket creation and deletion into the core abis_rsl codebase.
This commit is contained in:
parent
fe03f0d002
commit
17f5bf64f1
|
@ -39,6 +39,7 @@
|
||||||
#include <openbsc/paging.h>
|
#include <openbsc/paging.h>
|
||||||
#include <openbsc/signal.h>
|
#include <openbsc/signal.h>
|
||||||
#include <openbsc/meas_rep.h>
|
#include <openbsc/meas_rep.h>
|
||||||
|
#include <openbsc/rtp_proxy.h>
|
||||||
|
|
||||||
#define RSL_ALLOC_SIZE 1024
|
#define RSL_ALLOC_SIZE 1024
|
||||||
#define RSL_ALLOC_HEADROOM 128
|
#define RSL_ALLOC_HEADROOM 128
|
||||||
|
@ -1649,10 +1650,35 @@ static int abis_rsl_rx_ipacc_crcx_ack(struct msgb *msg)
|
||||||
LOGP(DRSL, LOGL_NOTICE, "mandatory IE missing");
|
LOGP(DRSL, LOGL_NOTICE, "mandatory IE missing");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ipac_parse_rtp(lchan, &tv);
|
ipac_parse_rtp(lchan, &tv);
|
||||||
|
|
||||||
|
/* in case we don't use direct BTS-to-BTS RTP */
|
||||||
|
if (!ipacc_rtp_direct) {
|
||||||
|
int rc;
|
||||||
|
/* the BTS has successfully bound a TCH to a local ip/port,
|
||||||
|
* which means we can connect our UDP socket to it */
|
||||||
|
if (lchan->abis_ip.rtp_socket) {
|
||||||
|
rtp_socket_free(lchan->abis_ip.rtp_socket);
|
||||||
|
lchan->abis_ip.rtp_socket = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
lchan->abis_ip.rtp_socket = rtp_socket_create();
|
||||||
|
if (!lchan->abis_ip.rtp_socket)
|
||||||
|
goto out_err;
|
||||||
|
|
||||||
|
rc = rtp_socket_connect(lchan->abis_ip.rtp_socket,
|
||||||
|
lchan->abis_ip.bound_ip,
|
||||||
|
lchan->abis_ip.bound_port);
|
||||||
|
if (rc < 0)
|
||||||
|
goto out_err;
|
||||||
|
}
|
||||||
|
|
||||||
dispatch_signal(SS_ABISIP, S_ABISIP_CRCX_ACK, msg->lchan);
|
dispatch_signal(SS_ABISIP, S_ABISIP_CRCX_ACK, msg->lchan);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
out_err:
|
||||||
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int abis_rsl_rx_ipacc_mdcx_ack(struct msgb *msg)
|
static int abis_rsl_rx_ipacc_mdcx_ack(struct msgb *msg)
|
||||||
|
@ -1676,6 +1702,7 @@ static int abis_rsl_rx_ipacc_dlcx_ind(struct msgb *msg)
|
||||||
{
|
{
|
||||||
struct abis_rsl_dchan_hdr *dh = msgb_l2(msg);
|
struct abis_rsl_dchan_hdr *dh = msgb_l2(msg);
|
||||||
struct tlv_parsed tv;
|
struct tlv_parsed tv;
|
||||||
|
struct gsm_lchan *lchan = msg->lchan;
|
||||||
|
|
||||||
rsl_tlv_parse(&tv, dh->data, msgb_l2len(msg)-sizeof(*dh));
|
rsl_tlv_parse(&tv, dh->data, msgb_l2len(msg)-sizeof(*dh));
|
||||||
|
|
||||||
|
@ -1683,6 +1710,12 @@ static int abis_rsl_rx_ipacc_dlcx_ind(struct msgb *msg)
|
||||||
print_rsl_cause(TLVP_VAL(&tv, RSL_IE_CAUSE),
|
print_rsl_cause(TLVP_VAL(&tv, RSL_IE_CAUSE),
|
||||||
TLVP_LEN(&tv, RSL_IE_CAUSE));
|
TLVP_LEN(&tv, RSL_IE_CAUSE));
|
||||||
|
|
||||||
|
/* the BTS tells us a RTP stream has been disconnected */
|
||||||
|
if (lchan->abis_ip.rtp_socket) {
|
||||||
|
rtp_socket_free(lchan->abis_ip.rtp_socket);
|
||||||
|
lchan->abis_ip.rtp_socket = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
dispatch_signal(SS_ABISIP, S_ABISIP_DLCX_IND, msg->lchan);
|
dispatch_signal(SS_ABISIP, S_ABISIP_DLCX_IND, msg->lchan);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1885,22 +1885,6 @@ static int handle_abisip_signal(unsigned int subsys, unsigned int signal,
|
||||||
|
|
||||||
switch (signal) {
|
switch (signal) {
|
||||||
case S_ABISIP_CRCX_ACK:
|
case S_ABISIP_CRCX_ACK:
|
||||||
/* the BTS has successfully bound a TCH to a local ip/port,
|
|
||||||
* which means we can connect our UDP socket to it */
|
|
||||||
if (lchan->abis_ip.rtp_socket) {
|
|
||||||
rtp_socket_free(lchan->abis_ip.rtp_socket);
|
|
||||||
lchan->abis_ip.rtp_socket = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
lchan->abis_ip.rtp_socket = rtp_socket_create();
|
|
||||||
if (!lchan->abis_ip.rtp_socket)
|
|
||||||
goto out_err;
|
|
||||||
|
|
||||||
rc = rtp_socket_connect(lchan->abis_ip.rtp_socket,
|
|
||||||
lchan->abis_ip.bound_ip,
|
|
||||||
lchan->abis_ip.bound_port);
|
|
||||||
if (rc < 0)
|
|
||||||
goto out_err;
|
|
||||||
/* check if any transactions on this lchan still have
|
/* check if any transactions on this lchan still have
|
||||||
* a tch_recv_mncc request pending */
|
* a tch_recv_mncc request pending */
|
||||||
net = lchan->ts->trx->bts->network;
|
net = lchan->ts->trx->bts->network;
|
||||||
|
@ -1911,18 +1895,8 @@ static int handle_abisip_signal(unsigned int subsys, unsigned int signal,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case S_ABISIP_DLCX_IND:
|
|
||||||
/* the BTS tells us a RTP stream has been disconnected */
|
|
||||||
if (lchan->abis_ip.rtp_socket) {
|
|
||||||
rtp_socket_free(lchan->abis_ip.rtp_socket);
|
|
||||||
lchan->abis_ip.rtp_socket = NULL;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
out_err:
|
|
||||||
/* FIXME: do something */
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue