summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-09-22 20:28:35 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-11-12 16:06:46 +0100
commit5903193d88e72834fb121f88f17385c91a1dbf2b (patch)
treeb3d39a9181d3f8da648da6da49c59bebb4a45dcb
parent2548cd15aad47df310ac79bfc9388a59b683a29b (diff)
bridge calls via mgcpgw
-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 09d2487..3f6754e 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 7059cb3..4b42c99 100644
--- a/openbsc/src/libmsc/gsm_04_08.c
+++ b/openbsc/src/libmsc/gsm_04_08.c
@@ -1766,8 +1766,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 2937b54..585927c 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 372806e..ee579bc 100644
--- a/openbsc/tests/db/db_test.c
+++ b/openbsc/tests/db/db_test.c
@@ -261,6 +261,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)