mgw: Add sockets for RTP packets + code for bind/connect/send RTP
diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn
index dc44304..07086c9 100644
--- a/mgw/MGCP_Test.ttcn
+++ b/mgw/MGCP_Test.ttcn
@@ -1,8 +1,12 @@
module MGCP_Test {
+ import from Osmocom_Types all;
import from MGCP_Types all;
import from SDP_Types all;
import from MGCP_CodecPort all;
import from MGCP_CodecPort_CtrlFunct all;
+ import from RTP_CodecPort all;
+ import from RTP_CodecPort_CtrlFunct all;
+ import from RTP_Endpoint all;
import from IPL4asp_Types all;
/* any variables declared in the component will be available to
@@ -10,9 +14,12 @@
* class members in C++ */
type component dummy_CT {
port MGCP_CODEC_PT MGCP;
+ port RTP_CODEC_PT RTP;
var boolean initialized := false;
var ConnectionId g_mgcp_conn_id := -1;
var integer g_trans_id;
+
+ var RtpEndpoint g_rtp_ep[2];
};
function get_next_trans_id() runs on dummy_CT return MgcpTransId {
@@ -30,6 +37,7 @@
charstring mp_local_ip := "127.0.0.1";
PortNumber mp_remote_udp_port := 2427;
charstring mp_remote_ip := "127.0.0.1";
+ PortNumber mp_local_rtp_port_base := 10000;
}
/* initialization function, called by each test case at the
@@ -37,6 +45,7 @@
* only executed once */
private function f_init()runs on dummy_CT {
var Result res;
+ var uint32_t ssrc;
if (initialized == true) {
return;
}
@@ -50,6 +59,13 @@
* */
res := MGCP_CodecPort_CtrlFunct.f_IPL4_connect(MGCP, mp_remote_ip, mp_remote_udp_port, mp_local_ip, mp_local_udp_port, 0, { udp := {} });
g_mgcp_conn_id := res.connId;
+
+ map(self:RTP, system:RTP_CODEC_PT);
+ ssrc := float2int(rnd()*4294967296.0);
+ rtp_endpoint_init(g_rtp_ep[0], mp_local_ip, mp_local_rtp_port_base, ssrc);
+ rtp_endpoint_bind(RTP, g_rtp_ep[0]);
+ rtp_endpoint_init(g_rtp_ep[1], mp_local_ip, mp_local_rtp_port_base+2, ssrc);
+ rtp_endpoint_bind(RTP, g_rtp_ep[1]);
}
/* 3.2.2.6 Connection Mode (sendonly, recvonly, sendrecv, confrnce, inactive, loopback,