MGW_Tests: Add test for "confecho" connection.

The test uses two connections: "confecho" and "sendonly". It is expected
that "confecho" connection receives as many RTP packets as it sends,
because it echoes back its packets. It is also expected that "sendonly"
connection receives the same amount of RTP packets.

Change-Id: I7df4a58ad9287a564b2daf7548b882c03787f7f2
diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn
index 7d01b97..73591b2 100644
--- a/mgw/MGCP_Test.ttcn
+++ b/mgw/MGCP_Test.ttcn
@@ -2283,6 +2283,58 @@
 		setverdict(pass);
 	}
 
+	testcase TC_two_crcx_confecho_sendonly_rtp() runs on dummy_CT {
+		var RtpFlowData flow[2];
+		var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain;
+		var MgcpCallId call_id := '1225'H;
+		var RtpemStats stats[2];
+
+		f_init(ep);
+
+		/* "Talker" is sending to MGW and receives echo. */
+		flow[0] := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 112, "GSM-HR-08/8000/1"));
+		flow[0].em.portnr := 10000;
+		f_flow_create(RTPEM[0], ep, call_id, "confecho", flow[0]);
+
+		/* "Listener" receives from MGW. */
+		flow[1] := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 112, "GSM-HR-08/8000/1"));
+		flow[1].em.portnr := 20000;
+		f_flow_create(RTPEM[1], ep, call_id, "sendonly", flow[1]);
+
+
+		f_rtpem_mode(RTPEM[0], RTPEM_MODE_BIDIR);
+		f_rtpem_mode(RTPEM[1], RTPEM_MODE_BIDIR);
+		f_sleep(1.0);
+		f_flow_delete(RTPEM[0]);
+		f_flow_delete(RTPEM[1], ep, call_id);
+
+		stats[0] := f_rtpem_stats_get(RTPEM[0]);
+		stats[1] := f_rtpem_stats_get(RTPEM[1]);
+
+		/* The "Talker" will receive his RTP, so TX must match RX.
+		 * As RTP from "Listener" is ignored, no extra packets shall be received. */
+		if (stats[0].num_pkts_tx != stats[0].num_pkts_rx) {
+			setverdict(fail, "Talker does not receive as many packets as it transmits!");
+		}
+		if (stats[0].bytes_payload_tx != stats[0].bytes_payload_rx) {
+			setverdict(fail, "Talker does not receive as many payload as it transmits!");
+		}
+
+		/* The "Listener" will also receive RTP of the "Talker",
+		 * so TX of "Talker" must match RX of "Listener". */
+		if (stats[0].num_pkts_tx != stats[1].num_pkts_rx) {
+			setverdict(fail, "Listener does not receive as many packets as talker transmits!");
+		}
+		if (stats[0].bytes_payload_tx != stats[1].bytes_payload_rx) {
+			setverdict(fail, "Listener does not receive as many payload as talker transmits!");
+		}
+
+		f_rtpem_stats_err_check(stats[0]);
+		f_rtpem_stats_err_check(stats[1]);
+
+		setverdict(pass);
+	}
+
 
 	/* create two local RTP emulations; create two connections on MGW EP, see if
 	 * exchanged data is converted between ts101318 and rfc5993 */
@@ -3081,6 +3133,7 @@
 		execute(TC_two_crcx_mdcx_and_rtp());
 		execute(TC_two_crcx_and_unsolicited_rtp());
 		execute(TC_two_crcx_and_one_mdcx_rtp_ho());
+		execute(TC_two_crcx_confecho_sendonly_rtp());
 		execute(TC_ts101318_rfc5993_rtp_conversion());
 		execute(TC_ts101318_rfc5993_rtp_conversion_fmtp());
 		execute(TC_amr_oa_bwe_rtp_conversion());