aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-09-22 20:28:35 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-03-16 15:32:32 +0100
commit390c9e19895b3fea98c455e468e897786d342aab (patch)
tree59f7d474645a5302b137fa9297c802639b51fdfc /openbsc
parentd6036fd38f437f9c346fd1c14fb9410026a5fcf8 (diff)
bridge calls via mgcpgw
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/include/openbsc/msc_ifaces.h1
-rw-r--r--openbsc/src/libmsc/gsm_04_08.c3
-rw-r--r--openbsc/src/libmsc/msc_ifaces.c29
-rw-r--r--openbsc/tests/db/db_test.c4
4 files changed, 35 insertions, 2 deletions
diff --git a/openbsc/include/openbsc/msc_ifaces.h b/openbsc/include/openbsc/msc_ifaces.h
index 09d2487d6..3f6754e03 100644
--- a/openbsc/include/openbsc/msc_ifaces.h
+++ b/openbsc/include/openbsc/msc_ifaces.h
@@ -48,3 +48,4 @@ int msc_gsm0808_tx_cipher_mode(struct gsm_subscriber_connection *conn, int ciphe
int msc_tx_common_id(struct gsm_subscriber_connection *conn);
int msc_call_assignment(struct gsm_trans *trans);
+int msc_call_bridge(struct gsm_trans *trans1, struct gsm_trans *trans2);
diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c
index 6e0618eb4..e948d7b8f 100644
--- a/openbsc/src/libmsc/gsm_04_08.c
+++ b/openbsc/src/libmsc/gsm_04_08.c
@@ -1590,8 +1590,7 @@ static int tch_bridge(struct gsm_network *net, struct gsm_mncc_bridge *bridge)
/* through-connect channel */
return tch_map(trans1->conn->lchan, trans2->conn->lchan);
#else
- /* not implemented yet! */
- return -1;
+ return msc_call_bridge(trans1, trans2);
#endif
}
diff --git a/openbsc/src/libmsc/msc_ifaces.c b/openbsc/src/libmsc/msc_ifaces.c
index fd6f43c8f..0245dce46 100644
--- a/openbsc/src/libmsc/msc_ifaces.c
+++ b/openbsc/src/libmsc/msc_ifaces.c
@@ -186,3 +186,32 @@ int msc_call_assignment(struct gsm_trans *trans)
return -EINVAL;
}
}
+
+int msc_call_bridge(struct gsm_trans *trans1, struct gsm_trans *trans2)
+{
+ struct gsm_subscriber_connection *conn1 = trans1->conn;
+ struct gsm_subscriber_connection *conn2 = trans2->conn;
+
+ struct mgcpgw_client *mgcp = conn1->network->mgcpgw.client;
+ OSMO_ASSERT(mgcp);
+
+ const char *ip = mgcpgw_client_remote_addr_str(mgcp);
+
+ /* First setup the counterparts' endpoints, so that when transmission
+ * starts the originating addresses are already known to be valid. */
+ mgcpgw_client_tx_mdcx(mgcp, conn1->iu.mgcp_rtp_endpoint,
+ ip, conn2->iu.mgcp_rtp_port_cn,
+ MGCP_CONN_LOOPBACK);
+ mgcpgw_client_tx_mdcx(mgcp, conn2->iu.mgcp_rtp_endpoint,
+ ip, conn1->iu.mgcp_rtp_port_cn,
+ MGCP_CONN_LOOPBACK);
+ /* Now enable sending to and receiving from the peer. */
+ mgcpgw_client_tx_mdcx(mgcp, conn1->iu.mgcp_rtp_endpoint,
+ ip, conn2->iu.mgcp_rtp_port_cn,
+ MGCP_CONN_RECV_SEND);
+ mgcpgw_client_tx_mdcx(mgcp, conn2->iu.mgcp_rtp_endpoint,
+ ip, conn1->iu.mgcp_rtp_port_cn,
+ MGCP_CONN_RECV_SEND);
+
+ return 0;
+}
diff --git a/openbsc/tests/db/db_test.c b/openbsc/tests/db/db_test.c
index f5787f102..bf2e74599 100644
--- a/openbsc/tests/db/db_test.c
+++ b/openbsc/tests/db/db_test.c
@@ -268,6 +268,10 @@ int mgcpgw_client_tx_crcx(struct mgcpgw_client *client,
uint16_t rtp_endpoint, unsigned int call_id,
enum mgcp_connection_mode mode)
{ return -ENOTSUP; }
+int mgcpgw_client_tx_mdcx(struct mgcpgw_client *client, uint16_t rtp_endpoint,
+ const char *rtp_conn_addr, uint16_t rtp_port,
+ enum mgcp_connection_mode mode)
+{ return -ENOTSUP; }
const char *mgcpgw_client_remote_addr_str(struct mgcpgw_client *mgcp)
{ return "0.0.0.0"; }
uint32_t mgcpgw_client_remote_addr_n(struct mgcpgw_client *mgcp)