aboutsummaryrefslogtreecommitdiffstats
path: root/mgw/MGCP_Test.ttcn
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-11-18 17:16:24 +0100
committerHarald Welte <laforge@gnumonks.org>2017-11-18 17:19:21 +0100
commitf07c286a5524d5abbaae2dca9a9a3421119c574b (patch)
tree68b58662065f846c19ebc79a015707da09af4aee /mgw/MGCP_Test.ttcn
parent5501536e812a5999f82bd3ba677e355bdaf1d616 (diff)
mgw: Add sockets for RTP packets + code for bind/connect/send RTP
Diffstat (limited to 'mgw/MGCP_Test.ttcn')
-rw-r--r--mgw/MGCP_Test.ttcn16
1 files changed, 16 insertions, 0 deletions
diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn
index dc443041..07086c97 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 @@ module MGCP_Test {
* 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 @@ module MGCP_Test {
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 @@ module MGCP_Test {
* 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 @@ module MGCP_Test {
* */
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,