aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmsc/iucs.c
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2017-11-07 17:19:25 +0100
committerHarald Welte <laforge@gnumonks.org>2018-02-05 22:28:43 +0000
commit621ba032bdf60383f5431ca936040c620551a3d5 (patch)
tree0fd222b08503b64e6d4109a7f3c0b678b16bf1ec /src/libmsc/iucs.c
parent64dbc5464c7ef8f0ba2acbb1c924d4eef3e6e72e (diff)
mgcp: use osmo-mgw to switch rtp streams
in the current implementation we still use osmo-bsc_mgcp, which has many problems and is also obsoleted by osmo-mgw. integrate osmo-mgw and re-implement the current switching using an osmo fsm. Depends: osmo-mgw Iab6a6038e7610c62f34e642cd49c93d11151252c Depends: osmo-iuh I3c1a0455c5f25cae41ee19229d6daf299e023062 Closes: OS#2605 Change-Id: Ieea9630358b3963261fa1993cf1f3b563ff23538
Diffstat (limited to 'src/libmsc/iucs.c')
-rw-r--r--src/libmsc/iucs.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/libmsc/iucs.c b/src/libmsc/iucs.c
index c89e41266..7bb45b2a2 100644
--- a/src/libmsc/iucs.c
+++ b/src/libmsc/iucs.c
@@ -30,8 +30,22 @@
#include <osmocom/msc/gsm_data.h>
#include <osmocom/msc/gsm_subscriber.h>
+#include <osmocom/msc/transaction.h>
#include <osmocom/msc/osmo_msc.h>
#include <osmocom/msc/vlr.h>
+#include <osmocom/core/byteswap.h>
+
+#include "../../bscconfig.h"
+
+#ifdef BUILD_IU
+#include <osmocom/ranap/iu_client.h>
+extern struct msgb *ranap_new_msg_rab_assign_voice(uint8_t rab_id,
+ uint32_t rtp_ip,
+ uint16_t rtp_port,
+ bool use_x213_nsap);
+#else
+#include <osmocom/msc/iu_dummy.h>
+#endif /* BUILD_IU */
/* For A-interface see libbsc/bsc_api.c subscr_con_allocate() */
static struct gsm_subscriber_connection *subscr_conn_allocate_iu(struct gsm_network *network,
@@ -187,3 +201,53 @@ int gsm0408_rcvmsg_iucs(struct gsm_network *network, struct msgb *msg,
return rc;
}
+
+int iu_rab_act_cs(struct gsm_trans *trans)
+{
+ struct gsm_subscriber_connection *conn;
+ struct msgb *msg;
+ bool use_x213_nsap;
+ uint32_t conn_id;
+ struct ranap_ue_conn_ctx *uectx;
+ uint8_t rab_id;
+ uint32_t rtp_ip;
+ uint16_t rtp_port;
+
+ conn = trans->conn;
+ uectx = conn->iu.ue_ctx;
+ rab_id = conn->iu.rab_id;
+ rtp_ip = osmo_htonl(inet_addr(conn->rtp.local_addr_ran));
+ rtp_port = conn->rtp.local_port_ran;
+ conn_id = uectx->conn_id;
+
+ if (rtp_ip == INADDR_NONE) {
+ LOGP(DIUCS, LOGL_DEBUG,
+ "Assigning RAB: conn_id=%u, rab_id=%d, invalid RTP IP-Address\n",
+ conn_id, rab_id);
+ return -EINVAL;
+ }
+ if (rtp_port == 0) {
+ LOGP(DIUCS, LOGL_DEBUG,
+ "Assigning RAB: conn_id=%u, rab_id=%d, invalid RTP Port\n",
+ conn_id, rab_id);
+ return -EINVAL;
+ }
+
+ use_x213_nsap =
+ (uectx->rab_assign_addr_enc == RANAP_NSAP_ADDR_ENC_X213);
+
+ LOGP(DIUCS, LOGL_DEBUG,
+ "Assigning RAB: conn_id=%u, rab_id=%d, rtp=%x:%u, use_x213_nsap=%d\n",
+ conn_id, rab_id, rtp_ip, rtp_port, use_x213_nsap);
+
+ msg = ranap_new_msg_rab_assign_voice(rab_id, rtp_ip, rtp_port,
+ use_x213_nsap);
+ msg->l2h = msg->data;
+
+ if (ranap_iu_rab_act(uectx, msg))
+ LOGP(DIUCS, LOGL_ERROR,
+ "Failed to send RAB Assignment: conn_id=%d rab_id=%d rtp=%x:%u\n",
+ conn_id, rab_id, rtp_ip, rtp_port);
+ return 0;
+}
+