mgw: Rename osmux RtpFlowData fields to clarify them
Change-Id: I64b4060706a321bc1f5e46d791035e6d85fa8e1e
diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn
index cbc22a6..5665981 100644
--- a/mgw/MGCP_Test.ttcn
+++ b/mgw/MGCP_Test.ttcn
@@ -333,6 +333,12 @@
charstring hostname,
integer portnr optional
}
+ type record RtpOsmuxFlowData {
+ boolean local_cid_sent, /* whther non wildcarded CID was already sent to MGW */
+ MgcpOsmuxCID local_cid optional,
+ MgcpOsmuxCID remote_cid optional,
+ OsmuxemConfig cfg optional
+ }
type record RtpFlowData {
HostPort em, /* emulation side */
HostPort mgw, /* mgw side */
@@ -340,10 +346,7 @@
charstring codec,
MgcpConnectionId mgcp_conn_id optional,
RtpemConfig rtp_cfg optional,
- boolean osmux_cid_sent, /* whther non wildcarded CID was already sent to MGW */
- MgcpOsmuxCID osmux_cid optional,
- MgcpOsmuxCID osmux_cid_response optional,
- OsmuxemConfig osmux_cfg optional,
+ RtpOsmuxFlowData osmux,
charstring fmtp optional
}
@@ -426,12 +429,12 @@
f_osmuxem_bind(pt, flow.em.hostname, flow.em.portnr);
/* configure osmux-emulation */
- if (ispresent(flow.osmux_cfg)) {
- f_osmuxem_configure(pt, flow.osmux_cfg);
+ if (ispresent(flow.osmux.cfg)) {
+ f_osmuxem_configure(pt, flow.osmux.cfg);
} else {
var OsmuxemConfig osmux_cfg := c_OsmuxemDefaultCfg;
f_osmuxem_configure(pt, osmux_cfg);
- flow.osmux_cfg := osmux_cfg
+ flow.osmux.cfg := osmux_cfg
}
if (one_phase) {
@@ -439,14 +442,14 @@
* part that tells the MGW where we are listening for Osmux streams
* that come from the MGW. We get a fully working connection in
* one go. */
- if (flow.osmux_cid != -1) {
+ if (flow.osmux.local_cid != -1) {
/* We may still want to negotiate osmux CID later at MDCX */
rx_hdl := c_OsmuxemDefaultRxHandle;
- rx_hdl.cid := flow.osmux_cid;
+ rx_hdl.cid := flow.osmux.local_cid;
f_osmuxem_register_rxhandle(pt, rx_hdl);
- flow.osmux_cid_sent := true;
+ flow.osmux.local_cid_sent := true;
}
- cmd := ts_CRCX_osmux(get_next_trans_id(), ep, mode, call_id, flow.osmux_cid);
+ cmd := ts_CRCX_osmux(get_next_trans_id(), ep, mode, call_id, flow.osmux.local_cid);
cmd.sdp := ts_SDP(flow.em.hostname, flow.em.hostname, "23", "42",
flow.em.portnr, { int2str(flow.pt) }, attributes);
resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK_osmux);
@@ -461,7 +464,7 @@
* data back to us. In order to turn the connection in a fully
* bi-directional one, a separate MDCX is needed. */
- cmd := ts_CRCX_osmux(get_next_trans_id(), ep, mode, call_id, flow.osmux_cid);
+ cmd := ts_CRCX_osmux(get_next_trans_id(), ep, mode, call_id, flow.osmux.local_cid);
resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK_osmux);
flow.mgcp_conn_id := extract_conn_id(resp);
@@ -481,12 +484,12 @@
}
/* Make sure response is no wildcard */
- flow.osmux_cid_response := f_mgcp_osmux_cid_decode(cid_response);
- if (flow.osmux_cid_response == -1) {
+ flow.osmux.remote_cid := f_mgcp_osmux_cid_decode(cid_response);
+ if (flow.osmux.remote_cid == -1) {
setverdict(fail, "Osmux CID in MGCP response contains unexpected wildcard");
mtc.stop;
}
- tx_hdl := valueof(t_TxHandleAMR590(flow.osmux_cid_response));
+ tx_hdl := valueof(t_TxHandleAMR590(flow.osmux.remote_cid));
f_osmuxem_register_txhandle(pt, tx_hdl);
/* finally, connect the emulation-side RTP socket to the MGW */
@@ -551,23 +554,23 @@
f_osmuxem_bind(pt, flow.em.hostname, flow.em.portnr);
/* configure osmux-emulation */
- if (ispresent(flow.osmux_cfg)) {
- f_osmuxem_configure(pt, flow.osmux_cfg);
+ if (ispresent(flow.osmux.cfg)) {
+ f_osmuxem_configure(pt, flow.osmux.cfg);
} else {
var OsmuxemConfig osmux_cfg := c_OsmuxemDefaultCfg;
f_osmuxem_configure(pt, osmux_cfg);
}
/* We didn't send a non-wildcarded Osmux CID yet. If caller wants to submit it, register handler */
- if (flow.osmux_cid_sent == false and flow.osmux_cid != -1) {
+ if (flow.osmux.local_cid_sent == false and flow.osmux.local_cid != -1) {
rx_hdl := c_OsmuxemDefaultRxHandle;
- rx_hdl.cid := flow.osmux_cid;
+ rx_hdl.cid := flow.osmux.local_cid;
f_osmuxem_register_rxhandle(pt, rx_hdl);
- flow.osmux_cid_sent := true;
+ flow.osmux.local_cid_sent := true;
}
/* connect MGW side Osmux socket to the emulation-side Osmux socket using SDP */
- cmd := ts_MDCX_osmux(get_next_trans_id(), ep, mode, call_id, flow.mgcp_conn_id, flow.osmux_cid);
+ cmd := ts_MDCX_osmux(get_next_trans_id(), ep, mode, call_id, flow.mgcp_conn_id, flow.osmux.local_cid);
cmd.sdp := ts_SDP(flow.em.hostname, flow.em.hostname, "23", "42",
flow.em.portnr, { int2str(flow.pt) }, attributes);
resp := mgcp_transceive_mgw(cmd, tr_MDCX_ACK);
@@ -593,7 +596,7 @@
setverdict(fail, "Osmux CID in MGCP response contains unexpected wildcard");
mtc.stop;
}
- if (cid_resp_parsed != flow.osmux_cid_response) {
+ if (cid_resp_parsed != flow.osmux.remote_cid) {
setverdict(fail, "Osmux CID in MGCP MDCX response changed from prev value");
mtc.stop;
}
@@ -1183,7 +1186,7 @@
f_init(ep, true);
flow := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 112, "AMR/8000/1"));
flow.em.portnr := mp_local_osmux_port;
- flow.osmux_cid := -1;
+ flow.osmux.local_cid := -1;
f_flow_create_osmux(OsmuxEM, ep, call_id, "recvonly", flow, false);
/* create a transmitter not yet known by MGW */
@@ -1196,10 +1199,10 @@
stats := f_osmuxem_stats_get(OsmuxEM);
- if (stats.num_pkts_tx < 40 / flow.osmux_cfg.batch_size) {
+ if (stats.num_pkts_tx < 40 / flow.osmux.cfg.batch_size) {
setverdict(fail);
}
- if (stats.bytes_payload_tx < stats.num_pkts_tx * f_amrft_payload_len(tx_hdl.amr_ft) * flow.osmux_cfg.batch_size) {
+ if (stats.bytes_payload_tx < stats.num_pkts_tx * f_amrft_payload_len(tx_hdl.amr_ft) * flow.osmux.cfg.batch_size) {
setverdict(fail);
}
@@ -1220,7 +1223,7 @@
f_init(ep, true);
flow := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 111, "GSM-HR-08/8000/1"));
flow.em.portnr := mp_local_osmux_port;
- flow.osmux_cid := 2;
+ flow.osmux.local_cid := 2;
f_flow_create_osmux(OsmuxEM, ep, call_id, "loopback", flow);
f_osmuxem_mode(OsmuxEM, OSMUXEM_MODE_BIDIR);
@@ -1314,8 +1317,8 @@
/* from MGW back to us */
flow[1] := valueof(t_RtpFlow(local_ip_osmux, remote_ip_osmux, 110, "AMR/8000"));
flow[1].em.portnr := mp_local_osmux_port;
- flow[1].osmux_cid := 2;
- flow[1].osmux_cfg := c_OsmuxemDefaultCfg;
+ flow[1].osmux.local_cid := 2;
+ flow[1].osmux.cfg := c_OsmuxemDefaultCfg;
f_flow_create_osmux(OsmuxEM, ep, call_id, "sendrecv", flow[1]);
if (bidir) {
@@ -1344,7 +1347,7 @@
stats_rtp := f_rtpem_stats_get(RTPEM[0]);
stats_osmux := f_osmuxem_stats_get(OsmuxEM);
- if (not f_rtp_osmux_stats_compare(stats_rtp, stats_osmux, flow[1].osmux_cfg.batch_size, tolerance)) {
+ if (not f_rtp_osmux_stats_compare(stats_rtp, stats_osmux, flow[1].osmux.cfg.batch_size, tolerance)) {
setverdict(fail, "RTP and Osmux endpoint statistics don't match");
mtc.stop;
}
@@ -1416,11 +1419,11 @@
flow[1] := valueof(t_RtpFlow(local_ip_osmux, remote_ip_osmux, 110, "AMR/8000"));
flow[1].em.portnr := mp_local_osmux_port;
if (crcx_osmux_wildcard) {
- flow[1].osmux_cid := -1;
+ flow[1].osmux.local_cid := -1;
} else {
- flow[1].osmux_cid := 2;
+ flow[1].osmux.local_cid := 2;
}
- flow[1].osmux_cfg := c_OsmuxemDefaultCfg;
+ flow[1].osmux.cfg := c_OsmuxemDefaultCfg;
f_flow_create_osmux(OsmuxEM, ep, call_id, "recvonly", flow[1], true);
@@ -1480,7 +1483,7 @@
if (crcx_osmux_wildcard) {
/* For now we must set same CID as the MGW recvCID,
* having sendCID!=recvCID is not yet supported. */
- flow[1].osmux_cid := flow[1].osmux_cid_response;
+ flow[1].osmux.local_cid := flow[1].osmux.remote_cid;
}
f_flow_modify_osmux(OsmuxEM, ep, call_id, "sendrecv", flow[1]);
f_sleep(2.0);
@@ -1488,8 +1491,8 @@
stats_rtp := f_rtpem_stats_get(RTPEM[0]);
stats_osmux := f_osmuxem_stats_get(OsmuxEM);
- temp := stats_rtp.num_pkts_tx - num_pkts_tx[0] - stats_osmux.num_pkts_rx * flow[1].osmux_cfg.batch_size;
- if (temp > 3 * flow[1].osmux_cfg.batch_size or temp < -3 * flow[1].osmux_cfg.batch_size) {
+ temp := stats_rtp.num_pkts_tx - num_pkts_tx[0] - stats_osmux.num_pkts_rx * flow[1].osmux.cfg.batch_size;
+ if (temp > 3 * flow[1].osmux.cfg.batch_size or temp < -3 * flow[1].osmux.cfg.batch_size) {
log("stats_rtp: ", stats_rtp);
log("stats_osmux: ", stats_osmux);
log("old_rtp_tx: ", num_pkts_tx[0]);
@@ -1497,7 +1500,7 @@
mtc.stop;
}
- temp := stats_osmux.num_pkts_tx - num_pkts_tx[1] - stats_rtp.num_pkts_rx / flow[1].osmux_cfg.batch_size;
+ temp := stats_osmux.num_pkts_tx - num_pkts_tx[1] - stats_rtp.num_pkts_rx / flow[1].osmux.cfg.batch_size;
if (temp > 3 or temp < -3) {
setverdict(fail, "number of packets not within normal parameters (" & int2str(temp) & ")");
mtc.stop;
@@ -1684,7 +1687,12 @@
},
pt := pt,
codec := codec,
- osmux_cid_sent := false
+ osmux:= {
+ local_cid_sent := false,
+ local_cid := omit,
+ remote_cid := omit,
+ cfg := omit
+ }
}
/* transmit RTP streams between two RTP Emulations back-to-back; expect no loss */