Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 1 | /* MGW (Media Gateway) test suite in TTCN-3 |
| 2 | * (C) 2017-2018 Harald Welte <laforge@gnumonks.org> |
| 3 | * (C) 2018-2019 sysmocom - s.f.m.c. GmbH |
| 4 | * All rights reserved. |
| 5 | * |
| 6 | * Released under the terms of GNU General Public License, Version 2 or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 10 | */ |
| 11 | |
Harald Welte | 00a067f | 2017-09-13 23:27:17 +0200 | [diff] [blame] | 12 | module MGCP_Test { |
Harald Welte | f07c286 | 2017-11-18 17:16:24 +0100 | [diff] [blame] | 13 | import from Osmocom_Types all; |
Harald Welte | 00a067f | 2017-09-13 23:27:17 +0200 | [diff] [blame] | 14 | import from MGCP_Types all; |
Harald Welte | 4029e8c | 2017-11-23 22:00:42 +0100 | [diff] [blame] | 15 | import from MGCP_Templates all; |
Harald Welte | 3c6ebb9 | 2017-09-16 00:56:57 +0800 | [diff] [blame] | 16 | import from SDP_Types all; |
| 17 | import from MGCP_CodecPort all; |
| 18 | import from MGCP_CodecPort_CtrlFunct all; |
Harald Welte | f07c286 | 2017-11-18 17:16:24 +0100 | [diff] [blame] | 19 | import from RTP_CodecPort all; |
| 20 | import from RTP_CodecPort_CtrlFunct all; |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 21 | import from RTP_Emulation all; |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 22 | import from OSMUX_Types all; |
| 23 | import from OSMUX_CodecPort all; |
| 24 | import from OSMUX_CodecPort_CtrlFunct all; |
| 25 | import from OSMUX_Emulation all; |
Harald Welte | 3c6ebb9 | 2017-09-16 00:56:57 +0800 | [diff] [blame] | 26 | import from IPL4asp_Types all; |
Philipp Maier | 6137c32 | 2019-02-20 16:13:41 +0100 | [diff] [blame] | 27 | import from General_Types all; |
| 28 | import from Native_Functions all; |
| 29 | import from IPCP_Types all; |
| 30 | import from IP_Types all; |
| 31 | import from Osmocom_VTY_Functions all; |
| 32 | import from TELNETasp_PortType all; |
Harald Welte | 00a067f | 2017-09-13 23:27:17 +0200 | [diff] [blame] | 33 | |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 34 | const charstring c_mgw_domain := "mgw"; |
| 35 | const charstring c_mgw_ep_rtpbridge := "rtpbridge/"; |
| 36 | |
Harald Welte | 21ba557 | 2017-09-19 17:55:05 +0800 | [diff] [blame] | 37 | /* any variables declared in the component will be available to |
| 38 | * all functions that 'run on' the named component, similar to |
| 39 | * class members in C++ */ |
Harald Welte | 00a067f | 2017-09-13 23:27:17 +0200 | [diff] [blame] | 40 | type component dummy_CT { |
Harald Welte | 3c6ebb9 | 2017-09-16 00:56:57 +0800 | [diff] [blame] | 41 | port MGCP_CODEC_PT MGCP; |
| 42 | var boolean initialized := false; |
Harald Welte | 5501536 | 2017-11-18 16:02:42 +0100 | [diff] [blame] | 43 | var ConnectionId g_mgcp_conn_id := -1; |
Harald Welte | e1e18c5 | 2017-09-17 16:23:07 +0800 | [diff] [blame] | 44 | var integer g_trans_id; |
Harald Welte | f07c286 | 2017-11-18 17:16:24 +0100 | [diff] [blame] | 45 | |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 46 | var RTP_Emulation_CT vc_RTPEM[3]; |
| 47 | port RTPEM_CTRL_PT RTPEM[3]; |
Philipp Maier | 6137c32 | 2019-02-20 16:13:41 +0100 | [diff] [blame] | 48 | |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 49 | var OSMUX_Emulation_CT vc_OsmuxEM; |
| 50 | port OsmuxEM_CTRL_PT OsmuxEM; |
| 51 | |
Philipp Maier | 6137c32 | 2019-02-20 16:13:41 +0100 | [diff] [blame] | 52 | port TELNETasp_PT MGWVTY; |
Harald Welte | 00a067f | 2017-09-13 23:27:17 +0200 | [diff] [blame] | 53 | }; |
| 54 | |
Harald Welte | e1e18c5 | 2017-09-17 16:23:07 +0800 | [diff] [blame] | 55 | function get_next_trans_id() runs on dummy_CT return MgcpTransId { |
| 56 | var MgcpTransId tid := int2str(g_trans_id); |
| 57 | g_trans_id := g_trans_id + 1; |
| 58 | return tid; |
| 59 | } |
| 60 | |
Harald Welte | 21ba557 | 2017-09-19 17:55:05 +0800 | [diff] [blame] | 61 | /* all parameters declared here can be modified / overridden by |
| 62 | * the config file in the [MODULE_PARAMETERS] section. If no |
| 63 | * config file is used or the file doesn't specify them, the |
| 64 | * default values assigned below are used */ |
Harald Welte | 3c6ebb9 | 2017-09-16 00:56:57 +0800 | [diff] [blame] | 65 | modulepar { |
| 66 | PortNumber mp_local_udp_port := 2727; |
Pau Espin Pedrol | b604af0 | 2020-09-07 17:12:39 +0200 | [diff] [blame] | 67 | charstring mp_local_ipv4 := "127.0.0.1"; |
Pau Espin Pedrol | 9e0141a | 2020-09-07 17:25:56 +0200 | [diff] [blame] | 68 | charstring mp_local_ipv6 := "::1"; |
Harald Welte | 3c6ebb9 | 2017-09-16 00:56:57 +0800 | [diff] [blame] | 69 | PortNumber mp_remote_udp_port := 2427; |
Pau Espin Pedrol | b604af0 | 2020-09-07 17:12:39 +0200 | [diff] [blame] | 70 | charstring mp_remote_ipv4 := "127.0.0.1"; |
Pau Espin Pedrol | 9e0141a | 2020-09-07 17:25:56 +0200 | [diff] [blame] | 71 | charstring mp_remote_ipv6 := "::1"; |
Harald Welte | f07c286 | 2017-11-18 17:16:24 +0100 | [diff] [blame] | 72 | PortNumber mp_local_rtp_port_base := 10000; |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 73 | PortNumber mp_local_osmux_port := 1985; |
Harald Welte | 3c6ebb9 | 2017-09-16 00:56:57 +0800 | [diff] [blame] | 74 | } |
| 75 | |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 76 | private function f_vty_enable_osmux(boolean osmux_on) runs on dummy_CT { |
| 77 | /* Turn on conversion mode */ |
| 78 | f_vty_enter_config(MGWVTY); |
| 79 | f_vty_transceive(MGWVTY, "mgcp"); |
| 80 | if (osmux_on) { |
| 81 | f_vty_transceive(MGWVTY, "osmux on"); |
| 82 | } else { |
| 83 | f_vty_transceive(MGWVTY, "osmux off"); |
| 84 | } |
| 85 | f_vty_transceive(MGWVTY, "exit"); |
| 86 | f_vty_transceive(MGWVTY, "exit"); |
| 87 | |
| 88 | } |
| 89 | |
| 90 | private function f_init_vty(boolean osmux_on) runs on dummy_CT { |
Philipp Maier | 6137c32 | 2019-02-20 16:13:41 +0100 | [diff] [blame] | 91 | map(self:MGWVTY, system:MGWVTY); |
| 92 | f_vty_set_prompts(MGWVTY); |
| 93 | f_vty_transceive(MGWVTY, "enable"); |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 94 | |
| 95 | f_vty_enable_osmux(osmux_on); |
Philipp Maier | 6137c32 | 2019-02-20 16:13:41 +0100 | [diff] [blame] | 96 | } |
| 97 | |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 98 | private function f_rtpem_init(inout RTP_Emulation_CT comp_ref, integer i) |
| 99 | runs on dummy_CT { |
| 100 | comp_ref := RTP_Emulation_CT.create("RTPEM" & int2str(i)); |
| 101 | map(comp_ref:RTP, system:RTP); |
| 102 | map(comp_ref:RTCP, system:RTCP); |
| 103 | comp_ref.start(RTP_Emulation.f_main()); |
| 104 | } |
| 105 | |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 106 | private function f_osmuxem_init(inout OSMUX_Emulation_CT comp_ref) |
| 107 | runs on dummy_CT { |
| 108 | comp_ref := OSMUX_Emulation_CT.create("OsmuxEM"); |
| 109 | map(comp_ref:OSMUX, system:OSMUX); |
| 110 | comp_ref.start(OSMUX_Emulation.f_main()); |
| 111 | } |
| 112 | |
Harald Welte | 21ba557 | 2017-09-19 17:55:05 +0800 | [diff] [blame] | 113 | /* initialization function, called by each test case at the |
| 114 | * beginning, but 'initialized' variable ensures its body is |
| 115 | * only executed once */ |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 116 | private function f_init(template MgcpEndpoint ep := omit, boolean osmux_on := false) runs on dummy_CT { |
Harald Welte | 3c6ebb9 | 2017-09-16 00:56:57 +0800 | [diff] [blame] | 117 | var Result res; |
Harald Welte | f07c286 | 2017-11-18 17:16:24 +0100 | [diff] [blame] | 118 | var uint32_t ssrc; |
Philipp Maier | 28bb829 | 2018-07-20 17:09:17 +0200 | [diff] [blame] | 119 | |
Harald Welte | edc45c1 | 2017-11-18 19:15:05 +0100 | [diff] [blame] | 120 | if (initialized == false) { |
| 121 | initialized := true; |
| 122 | |
| 123 | /* some random number for the initial transaction id */ |
| 124 | g_trans_id := float2int(rnd()*65535.0); |
| 125 | map(self:MGCP, system:MGCP_CODEC_PT); |
| 126 | /* connect the MGCP test port using the given |
| 127 | * source/destionation ip/port and store the connection id in g_mgcp_conn_id |
| 128 | * */ |
Pau Espin Pedrol | b604af0 | 2020-09-07 17:12:39 +0200 | [diff] [blame] | 129 | res := MGCP_CodecPort_CtrlFunct.f_IPL4_connect(MGCP, mp_remote_ipv4, mp_remote_udp_port, mp_local_ipv4, mp_local_udp_port, 0, { udp := {} }); |
Harald Welte | 9220f63 | 2018-05-23 20:27:02 +0200 | [diff] [blame] | 130 | if (not ispresent(res.connId)) { |
| 131 | setverdict(fail, "Could not connect MGCP, check your configuration"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 132 | mtc.stop; |
Harald Welte | 9220f63 | 2018-05-23 20:27:02 +0200 | [diff] [blame] | 133 | } |
Harald Welte | edc45c1 | 2017-11-18 19:15:05 +0100 | [diff] [blame] | 134 | g_mgcp_conn_id := res.connId; |
| 135 | |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 136 | for (var integer i := 0; i < sizeof(vc_RTPEM); i := i+1) { |
| 137 | f_rtpem_init(vc_RTPEM[i], i); |
| 138 | connect(vc_RTPEM[i]:CTRL, self:RTPEM[i]); |
| 139 | } |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 140 | if (osmux_on) { |
| 141 | f_osmuxem_init(vc_OsmuxEM); |
| 142 | connect(vc_OsmuxEM:CTRL, self:OsmuxEM); |
| 143 | } |
Harald Welte | 3c6ebb9 | 2017-09-16 00:56:57 +0800 | [diff] [blame] | 144 | } |
Harald Welte | 3c6ebb9 | 2017-09-16 00:56:57 +0800 | [diff] [blame] | 145 | |
Harald Welte | edc45c1 | 2017-11-18 19:15:05 +0100 | [diff] [blame] | 146 | if (isvalue(ep)) { |
| 147 | /* do a DLCX on all connections of the EP */ |
| 148 | f_dlcx_ignore(valueof(ep)); |
| 149 | } |
Philipp Maier | 6137c32 | 2019-02-20 16:13:41 +0100 | [diff] [blame] | 150 | |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 151 | f_init_vty(osmux_on); |
Harald Welte | 3c6ebb9 | 2017-09-16 00:56:57 +0800 | [diff] [blame] | 152 | } |
| 153 | |
Harald Welte | 00a067f | 2017-09-13 23:27:17 +0200 | [diff] [blame] | 154 | testcase TC_selftest() runs on dummy_CT { |
| 155 | const charstring c_auep := "AUEP 158663169 ds/e1-1/2@172.16.6.66 MGCP 1.0\r\n"; |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 156 | const charstring c_mdcx3 := "MDCX 18983215 " & c_mgw_ep_rtpbridge & "1@" & c_mgw_domain & " MGCP 1.0\r\n"; |
Harald Welte | 00a067f | 2017-09-13 23:27:17 +0200 | [diff] [blame] | 157 | const charstring c_mdcx3_ret := "200 18983215 OK\r\n" & |
| 158 | "I: 1\n" & |
| 159 | "\n" & |
| 160 | "v=0\r\n" & |
| 161 | "o=- 1 23 IN IP4 0.0.0.0\r\n" & |
| 162 | "s=-\r\n" & |
| 163 | "c=IN IP4 0.0.0.0\r\n" & |
| 164 | "t=0 0\r\n" & |
| 165 | "m=audio 0 RTP/AVP 126\r\n" & |
| 166 | "a=rtpmap:126 AMR/8000\r\n" & |
| 167 | "a=ptime:20\r\n"; |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 168 | const charstring c_mdcx4 := "MDCX 18983216 " & c_mgw_ep_rtpbridge & "1@" & c_mgw_domain & " MGCP 1.0\r\n" & |
Harald Welte | 00a067f | 2017-09-13 23:27:17 +0200 | [diff] [blame] | 169 | "M: sendrecv\r" & |
| 170 | "C: 2\r\n" & |
| 171 | "I: 1\r\n" & |
| 172 | "L: p:20, a:AMR, nt:IN\r\n" & |
| 173 | "\n" & |
| 174 | "v=0\r\n" & |
| 175 | "o=- 1 23 IN IP4 0.0.0.0\r\n" & |
Harald Welte | 2871d0b | 2017-09-14 22:42:12 +0800 | [diff] [blame] | 176 | "s=-\r\n" & |
Harald Welte | 00a067f | 2017-09-13 23:27:17 +0200 | [diff] [blame] | 177 | "c=IN IP4 0.0.0.0\r\n" & |
| 178 | "t=0 0\r\n" & |
| 179 | "m=audio 4441 RTP/AVP 99\r\n" & |
| 180 | "a=rtpmap:99 AMR/8000\r\n" & |
| 181 | "a=ptime:40\r\n"; |
Harald Welte | 3c6ebb9 | 2017-09-16 00:56:57 +0800 | [diff] [blame] | 182 | const charstring c_crcx510_ret := "510 23 FAIL\r\n" |
Harald Welte | 00a067f | 2017-09-13 23:27:17 +0200 | [diff] [blame] | 183 | |
| 184 | log(c_auep); |
| 185 | log(dec_MgcpCommand(c_auep)); |
| 186 | |
| 187 | log(c_mdcx3); |
| 188 | log(dec_MgcpCommand(c_mdcx3)); |
| 189 | |
| 190 | log(c_mdcx3_ret); |
| 191 | log(dec_MgcpResponse(c_mdcx3_ret)); |
| 192 | |
| 193 | log(c_mdcx4); |
| 194 | log(dec_MgcpCommand(c_mdcx4)); |
Harald Welte | 3c6ebb9 | 2017-09-16 00:56:57 +0800 | [diff] [blame] | 195 | |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 196 | log(ts_CRCX("23", c_mgw_ep_rtpbridge & "42@" & c_mgw_domain, "sendrecv", '1234'H)); |
| 197 | log(enc_MgcpCommand(valueof(ts_CRCX("23", c_mgw_ep_rtpbridge & "42@" & c_mgw_domain, "sendrecv", '1234'H)))); |
Harald Welte | 3c6ebb9 | 2017-09-16 00:56:57 +0800 | [diff] [blame] | 198 | |
| 199 | log(c_crcx510_ret); |
| 200 | log(dec_MgcpResponse(c_crcx510_ret)); |
| 201 | log(dec_MgcpMessage(c_crcx510_ret)); |
Daniel Willmann | 94e4e80 | 2018-12-13 16:56:26 +0100 | [diff] [blame] | 202 | |
| 203 | /* We didn't encounter any DTE, so pass the test */ |
| 204 | setverdict(pass); |
Harald Welte | 3c6ebb9 | 2017-09-16 00:56:57 +0800 | [diff] [blame] | 205 | } |
| 206 | |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 207 | /* CRCX test ideas: |
Harald Welte | e0b331f | 2017-11-18 20:34:33 +0100 | [diff] [blame] | 208 | * x without mandatory CallId |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 209 | * - with forbidden parameters (e.g. Capabilities, PackageList, ... |
| 210 | * - CRCX with remote session description and without |
| 211 | * |
| 212 | * general ideas: |
Harald Welte | e0b331f | 2017-11-18 20:34:33 +0100 | [diff] [blame] | 213 | * x packetization != 20ms |
| 214 | * x invalid mode |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 215 | * x unsupported mode (517) |
| 216 | * x bidirectional mode before RemoteConnDesc: 527 |
| 217 | * - invalid codec |
Harald Welte | e0b331f | 2017-11-18 20:34:33 +0100 | [diff] [blame] | 218 | * x retransmission of same transaction |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 219 | * - unsupported LocalConnectionOptions ("b", "a", "e", "gc", "s", "r", "k", ..) |
| 220 | */ |
| 221 | |
Harald Welte | 21ba557 | 2017-09-19 17:55:05 +0800 | [diff] [blame] | 222 | /* build a receive template for receiving a MGCP message. You |
| 223 | * pass the MGCP response template in, and it will generate an |
| 224 | * MGCP_RecvFrom template that can match the primitives arriving on the |
| 225 | * MGCP_CodecPort */ |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 226 | function tr_MGCP_RecvFrom_R(template MgcpResponse resp) runs on dummy_CT return template MGCP_RecvFrom { |
| 227 | var template MGCP_RecvFrom mrf := { |
Harald Welte | 5501536 | 2017-11-18 16:02:42 +0100 | [diff] [blame] | 228 | connId := g_mgcp_conn_id, |
Pau Espin Pedrol | b604af0 | 2020-09-07 17:12:39 +0200 | [diff] [blame] | 229 | remName := mp_remote_ipv4, |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 230 | remPort := mp_remote_udp_port, |
Pau Espin Pedrol | b604af0 | 2020-09-07 17:12:39 +0200 | [diff] [blame] | 231 | locName := mp_local_ipv4, |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 232 | locPort := mp_local_udp_port, |
| 233 | msg := { response := resp } |
| 234 | } |
| 235 | return mrf; |
| 236 | } |
| 237 | |
| 238 | /* Send a MGCP request + receive a (matching!) response */ |
| 239 | function mgcp_transceive_mgw(template MgcpCommand cmd, template MgcpResponse resp := ?) runs on dummy_CT return MgcpResponse { |
| 240 | var MgcpMessage msg := { command := valueof(cmd) }; |
| 241 | resp.line.trans_id := cmd.line.trans_id; |
| 242 | var template MGCP_RecvFrom mrt := tr_MGCP_RecvFrom_R(resp); |
Harald Welte | 3c6ebb9 | 2017-09-16 00:56:57 +0800 | [diff] [blame] | 243 | var MGCP_RecvFrom mrf; |
| 244 | timer T := 5.0; |
| 245 | |
Harald Welte | 5501536 | 2017-11-18 16:02:42 +0100 | [diff] [blame] | 246 | MGCP.send(t_MGCP_Send(g_mgcp_conn_id, msg)); |
Harald Welte | 3c6ebb9 | 2017-09-16 00:56:57 +0800 | [diff] [blame] | 247 | T.start; |
| 248 | alt { |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 249 | [] MGCP.receive(mrt) -> value mrf { } |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 250 | [] MGCP.receive(tr_MGCP_RecvFrom_R(?)) { |
| 251 | setverdict(fail, "Response didn't match template"); |
| 252 | mtc.stop; |
| 253 | } |
Harald Welte | 3c6ebb9 | 2017-09-16 00:56:57 +0800 | [diff] [blame] | 254 | [] MGCP.receive { repeat; } |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 255 | [] T.timeout { |
| 256 | setverdict(fail, "Timeout waiting for response to ", cmd); |
| 257 | mtc.stop; |
| 258 | } |
Harald Welte | 3c6ebb9 | 2017-09-16 00:56:57 +0800 | [diff] [blame] | 259 | } |
| 260 | T.stop; |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 261 | |
| 262 | if (isbound(mrf) and isbound(mrf.msg) and ischosen(mrf.msg.response)) { |
| 263 | return mrf.msg.response; |
| 264 | } else { |
| 265 | var MgcpResponse r := { line := { code := "999", trans_id := valueof(cmd.line.trans_id) } }; |
| 266 | return r; |
| 267 | } |
Harald Welte | 00a067f | 2017-09-13 23:27:17 +0200 | [diff] [blame] | 268 | } |
| 269 | |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 270 | function extract_conn_id(MgcpResponse resp) return MgcpConnectionId { |
| 271 | var integer i; |
| 272 | for (i := 0; i < lengthof(resp.params); i := i + 1) { |
| 273 | var MgcpParameter par := resp.params[i]; |
| 274 | if (par.code == "I") { |
| 275 | return str2hex(par.val); |
| 276 | } |
| 277 | } |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 278 | setverdict(fail, "Could not find conn id for MgcpReponse"); |
| 279 | mtc.stop; |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 280 | return '00000000'H; |
| 281 | } |
| 282 | |
Harald Welte | 10889c1 | 2017-11-18 19:40:31 +0100 | [diff] [blame] | 283 | function f_dlcx(MgcpEndpoint ep, template MgcpResponseCode ret_code, template charstring ret_val, |
| 284 | template MgcpCallId call_id := omit, |
| 285 | template MgcpConnectionId conn_id := omit) runs on dummy_CT { |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 286 | var template MgcpCommand cmd; |
| 287 | var MgcpResponse resp; |
| 288 | var template MgcpResponse rtmpl := { |
| 289 | line := { |
Harald Welte | 10889c1 | 2017-11-18 19:40:31 +0100 | [diff] [blame] | 290 | code := ret_code, |
| 291 | string := ret_val |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 292 | }, |
| 293 | params := *, |
| 294 | sdp := * |
| 295 | }; |
Harald Welte | c40e0c3 | 2017-11-18 19:08:22 +0100 | [diff] [blame] | 296 | cmd := ts_DLCX(get_next_trans_id(), ep, call_id, conn_id); |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 297 | resp := mgcp_transceive_mgw(cmd, rtmpl); |
| 298 | } |
| 299 | |
Harald Welte | 10889c1 | 2017-11-18 19:40:31 +0100 | [diff] [blame] | 300 | /* Send DLCX and expect OK response */ |
| 301 | function f_dlcx_ok(MgcpEndpoint ep, template MgcpCallId call_id := omit, |
| 302 | template MgcpConnectionId conn_id := omit) runs on dummy_CT { |
Harald Welte | f91edf3 | 2017-12-28 14:16:21 +0100 | [diff] [blame] | 303 | f_dlcx(ep, ("200","250"), "OK", call_id, conn_id); |
Harald Welte | 10889c1 | 2017-11-18 19:40:31 +0100 | [diff] [blame] | 304 | } |
| 305 | |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 306 | /* Send DLCX and accept any response */ |
Harald Welte | c40e0c3 | 2017-11-18 19:08:22 +0100 | [diff] [blame] | 307 | function f_dlcx_ignore(MgcpEndpoint ep, template MgcpCallId call_id := omit, |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 308 | template MgcpConnectionId conn_id := omit) runs on dummy_CT { |
Harald Welte | 10889c1 | 2017-11-18 19:40:31 +0100 | [diff] [blame] | 309 | f_dlcx(ep, ?, *, call_id, conn_id); |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 310 | } |
| 311 | |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 312 | type record HostPort { |
| 313 | charstring hostname, |
| 314 | integer portnr optional |
| 315 | } |
| 316 | type record RtpFlowData { |
| 317 | HostPort em, /* emulation side */ |
| 318 | HostPort mgw, /* mgw side */ |
| 319 | uint7_t pt, |
| 320 | charstring codec, |
Philipp Maier | 28bb829 | 2018-07-20 17:09:17 +0200 | [diff] [blame] | 321 | MgcpConnectionId mgcp_conn_id optional, |
Philipp Maier | c8c0b40 | 2019-03-07 10:48:45 +0100 | [diff] [blame] | 322 | RtpemConfig rtp_cfg optional, |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 323 | boolean osmux_cid_sent, /* whther non wildcarded CID was already sent to MGW */ |
| 324 | MgcpOsmuxCID osmux_cid optional, |
| 325 | MgcpOsmuxCID osmux_cid_response optional, |
| 326 | OsmuxemConfig osmux_cfg optional, |
Philipp Maier | c8c0b40 | 2019-03-07 10:48:45 +0100 | [diff] [blame] | 327 | charstring fmtp optional |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 328 | } |
| 329 | |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 330 | /* Create an RTP flow (bidirectional, or receive-only) */ |
| 331 | function f_flow_create(RTPEM_CTRL_PT pt, MgcpEndpoint ep, MgcpCallId call_id, charstring mode, inout RtpFlowData flow, |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 332 | boolean one_phase := true) |
| 333 | runs on dummy_CT { |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 334 | var template MgcpCommand cmd; |
| 335 | var MgcpResponse resp; |
Philipp Maier | c8c0b40 | 2019-03-07 10:48:45 +0100 | [diff] [blame] | 336 | var SDP_attribute_list attributes; |
| 337 | |
| 338 | attributes := { valueof(ts_SDP_rtpmap(flow.pt, flow.codec)), valueof(ts_SDP_ptime(20)) }; |
| 339 | if (isvalue(flow.fmtp)) { |
| 340 | attributes := attributes & { valueof(ts_SDP_fmtp(flow.pt, flow.fmtp)) }; |
| 341 | } |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 342 | |
| 343 | /* bind local RTP emulation socket */ |
| 344 | f_rtpem_bind(pt, flow.em.hostname, flow.em.portnr); |
| 345 | |
Philipp Maier | 28bb829 | 2018-07-20 17:09:17 +0200 | [diff] [blame] | 346 | /* configure rtp-emulation */ |
| 347 | if (ispresent(flow.rtp_cfg)) { |
| 348 | f_rtpem_configure(pt, flow.rtp_cfg); |
| 349 | } else { |
| 350 | var RtpemConfig rtp_cfg := c_RtpemDefaultCfg; |
| 351 | rtp_cfg.tx_payload_type := flow.pt |
| 352 | f_rtpem_configure(pt, rtp_cfg); |
| 353 | } |
| 354 | |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 355 | if (one_phase) { |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 356 | /* Connect flow to MGW using a CRCX that also contains an SDP |
| 357 | * part that tells the MGW where we are listening for RTP streams |
| 358 | * that come from the MGW. We get a fully working connection in |
| 359 | * one go. */ |
| 360 | |
| 361 | cmd := ts_CRCX(get_next_trans_id(), ep, mode, call_id); |
Harald Welte | edc8874 | 2018-03-29 18:01:16 +0200 | [diff] [blame] | 362 | cmd.sdp := ts_SDP(flow.em.hostname, flow.em.hostname, "23", "42", |
Philipp Maier | c8c0b40 | 2019-03-07 10:48:45 +0100 | [diff] [blame] | 363 | flow.em.portnr, { int2str(flow.pt) }, attributes); |
| 364 | |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 365 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); |
| 366 | flow.mgcp_conn_id := extract_conn_id(resp); |
| 367 | /* extract port number from response */ |
| 368 | flow.mgw.portnr := |
| 369 | resp.sdp.media_list[0].media_field.ports.port_number; |
| 370 | } else { |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 371 | /* Create a half-open connection only. We do not tell the MGW |
| 372 | * where it can send RTP streams to us. This means this |
| 373 | * connection will only be able to receive but can not send |
| 374 | * data back to us. In order to turn the connection in a fully |
| 375 | * bi-directional one, a separate MDCX is needed. */ |
| 376 | |
| 377 | cmd := ts_CRCX(get_next_trans_id(), ep, mode, call_id); |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 378 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); |
| 379 | flow.mgcp_conn_id := extract_conn_id(resp); |
| 380 | /* extract MGW-side port number from response */ |
| 381 | flow.mgw.portnr := |
| 382 | resp.sdp.media_list[0].media_field.ports.port_number; |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 383 | } |
| 384 | /* finally, connect the emulation-side RTP socket to the MGW */ |
| 385 | f_rtpem_connect(pt, flow.mgw.hostname, flow.mgw.portnr); |
| 386 | } |
| 387 | |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 388 | /* Create an Osmux flow (bidirectional, or receive-only) */ |
| 389 | function f_flow_create_osmux(OsmuxEM_CTRL_PT pt, MgcpEndpoint ep, MgcpCallId call_id, charstring mode, inout RtpFlowData flow, |
| 390 | boolean one_phase := true) |
| 391 | runs on dummy_CT { |
| 392 | var template MgcpCommand cmd; |
| 393 | var MgcpResponse resp; |
| 394 | var SDP_attribute_list attributes; |
| 395 | var OsmuxTxHandle tx_hdl; |
| 396 | var OsmuxRxHandle rx_hdl; |
| 397 | var charstring cid_response; |
| 398 | var OsmuxCID cid_resp_parsed |
| 399 | |
| 400 | attributes := { valueof(ts_SDP_rtpmap(flow.pt, flow.codec)), valueof(ts_SDP_ptime(20)) }; |
| 401 | if (isvalue(flow.fmtp)) { |
| 402 | attributes := attributes & { valueof(ts_SDP_fmtp(flow.pt, flow.fmtp)) }; |
| 403 | } |
| 404 | |
| 405 | /* bind local Osmux emulation socket */ |
| 406 | f_osmuxem_bind(pt, flow.em.hostname, flow.em.portnr); |
| 407 | |
| 408 | /* configure osmux-emulation */ |
| 409 | if (ispresent(flow.osmux_cfg)) { |
| 410 | f_osmuxem_configure(pt, flow.osmux_cfg); |
| 411 | } else { |
| 412 | var OsmuxemConfig osmux_cfg := c_OsmuxemDefaultCfg; |
| 413 | f_osmuxem_configure(pt, osmux_cfg); |
| 414 | flow.osmux_cfg := osmux_cfg |
| 415 | } |
| 416 | |
| 417 | if (one_phase) { |
| 418 | /* Connect flow to MGW using a CRCX that also contains an SDP |
| 419 | * part that tells the MGW where we are listening for Osmux streams |
| 420 | * that come from the MGW. We get a fully working connection in |
| 421 | * one go. */ |
Pau Espin Pedrol | 71387aa | 2020-09-08 14:27:43 +0200 | [diff] [blame] | 422 | if (flow.osmux_cid != -1) { |
| 423 | /* We may still want to negotiate osmux CID later at MDCX */ |
| 424 | rx_hdl := c_OsmuxemDefaultRxHandle; |
| 425 | rx_hdl.cid := flow.osmux_cid; |
| 426 | f_osmuxem_register_rxhandle(pt, rx_hdl); |
| 427 | flow.osmux_cid_sent := true; |
| 428 | } |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 429 | cmd := ts_CRCX_osmux(get_next_trans_id(), ep, mode, call_id, flow.osmux_cid); |
| 430 | cmd.sdp := ts_SDP(flow.em.hostname, flow.em.hostname, "23", "42", |
| 431 | flow.em.portnr, { int2str(flow.pt) }, attributes); |
| 432 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK_osmux); |
| 433 | flow.mgcp_conn_id := extract_conn_id(resp); |
| 434 | /* extract port number from response */ |
| 435 | flow.mgw.portnr := |
| 436 | resp.sdp.media_list[0].media_field.ports.port_number; |
| 437 | } else { |
| 438 | /* Create a half-open connection only. We do not tell the MGW |
| 439 | * where it can send Osmux streams to us. This means this |
| 440 | * connection will only be able to receive but can not send |
| 441 | * data back to us. In order to turn the connection in a fully |
| 442 | * bi-directional one, a separate MDCX is needed. */ |
| 443 | |
| 444 | cmd := ts_CRCX_osmux(get_next_trans_id(), ep, mode, call_id, flow.osmux_cid); |
| 445 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK_osmux); |
| 446 | |
| 447 | flow.mgcp_conn_id := extract_conn_id(resp); |
| 448 | /* extract MGW-side port number from response */ |
| 449 | flow.mgw.portnr := |
| 450 | resp.sdp.media_list[0].media_field.ports.port_number; |
| 451 | } |
| 452 | |
| 453 | /* extract Osmux CID we got assigned by the MGW */ |
| 454 | var MgcpMessage resp_msg := { |
| 455 | response := resp |
| 456 | } |
| 457 | |
| 458 | if (f_mgcp_find_param(resp_msg, "X-OSMUX", cid_response) == false) { |
| 459 | setverdict(fail, "No Osmux CID in MGCP response", resp); |
| 460 | mtc.stop; |
| 461 | } |
| 462 | |
| 463 | /* Make sure response is no wildcard */ |
| 464 | flow.osmux_cid_response := f_mgcp_osmux_cid_decode(cid_response); |
| 465 | if (flow.osmux_cid_response == -1) { |
| 466 | setverdict(fail, "Osmux CID in MGCP response contains unexpected wildcard"); |
| 467 | mtc.stop; |
| 468 | } |
| 469 | tx_hdl := valueof(t_TxHandleAMR590(flow.osmux_cid_response)); |
| 470 | f_osmuxem_register_txhandle(pt, tx_hdl); |
| 471 | |
| 472 | /* finally, connect the emulation-side RTP socket to the MGW */ |
| 473 | f_osmuxem_connect(pt, flow.mgw.hostname, flow.mgw.portnr); |
| 474 | } |
| 475 | |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 476 | /* Modify an existing RTP flow */ |
| 477 | function f_flow_modify(RTPEM_CTRL_PT pt, MgcpEndpoint ep, MgcpCallId call_id, charstring mode, inout RtpFlowData flow) |
| 478 | runs on dummy_CT { |
| 479 | var template MgcpCommand cmd; |
| 480 | var MgcpResponse resp; |
Philipp Maier | c8c0b40 | 2019-03-07 10:48:45 +0100 | [diff] [blame] | 481 | var SDP_attribute_list attributes; |
| 482 | |
| 483 | attributes := { valueof(ts_SDP_rtpmap(flow.pt, flow.codec)), valueof(ts_SDP_ptime(20)) }; |
| 484 | if (isvalue(flow.fmtp)) { |
| 485 | attributes := attributes & { valueof(ts_SDP_fmtp(flow.pt, flow.fmtp)) }; |
| 486 | } |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 487 | |
| 488 | /* rebind local RTP emulation socket to the new address */ |
| 489 | f_rtpem_bind(pt, flow.em.hostname, flow.em.portnr); |
| 490 | |
Philipp Maier | 28bb829 | 2018-07-20 17:09:17 +0200 | [diff] [blame] | 491 | /* reconfigure rtp-emulation */ |
| 492 | if (ispresent(flow.rtp_cfg)) { |
| 493 | f_rtpem_configure(pt, flow.rtp_cfg); |
| 494 | } else { |
| 495 | var RtpemConfig rtp_cfg := c_RtpemDefaultCfg; |
| 496 | rtp_cfg.tx_payload_type := flow.pt |
| 497 | f_rtpem_configure(pt, rtp_cfg); |
| 498 | } |
| 499 | |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 500 | /* connect MGW side RTP socket to the emulation-side RTP socket using SDP */ |
| 501 | cmd := ts_MDCX(get_next_trans_id(), ep, mode, call_id, flow.mgcp_conn_id); |
| 502 | cmd.sdp := ts_SDP(flow.em.hostname, flow.em.hostname, "23", "42", |
Philipp Maier | c8c0b40 | 2019-03-07 10:48:45 +0100 | [diff] [blame] | 503 | flow.em.portnr, { int2str(flow.pt) }, attributes); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 504 | resp := mgcp_transceive_mgw(cmd, tr_MDCX_ACK); |
| 505 | |
| 506 | /* extract MGW-side port number from response. (usually this |
| 507 | * will not change, but thats is up to the MGW) */ |
| 508 | flow.mgw.portnr := |
| 509 | resp.sdp.media_list[0].media_field.ports.port_number; |
| 510 | |
| 511 | /* reconnect the emulation-side RTP socket to the MGW */ |
| 512 | f_rtpem_connect(pt, flow.mgw.hostname, flow.mgw.portnr); |
| 513 | } |
| 514 | |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 515 | /* Modify an existing Osmux flow */ |
| 516 | function f_flow_modify_osmux(OsmuxEM_CTRL_PT pt, MgcpEndpoint ep, MgcpCallId call_id, charstring mode, inout RtpFlowData flow) |
| 517 | runs on dummy_CT { |
| 518 | var template MgcpCommand cmd; |
| 519 | var MgcpResponse resp; |
| 520 | var SDP_attribute_list attributes; |
| 521 | var OsmuxRxHandle rx_hdl; |
| 522 | var charstring cid_response; |
| 523 | var OsmuxCID cid_resp_parsed |
| 524 | |
| 525 | attributes := { valueof(ts_SDP_rtpmap(flow.pt, flow.codec)), valueof(ts_SDP_ptime(20)) }; |
| 526 | if (isvalue(flow.fmtp)) { |
| 527 | attributes := attributes & { valueof(ts_SDP_fmtp(flow.pt, flow.fmtp)) }; |
| 528 | } |
| 529 | |
| 530 | /* rebind local Osmux emulation socket to the new address */ |
| 531 | f_osmuxem_bind(pt, flow.em.hostname, flow.em.portnr); |
| 532 | |
| 533 | /* configure osmux-emulation */ |
| 534 | if (ispresent(flow.osmux_cfg)) { |
| 535 | f_osmuxem_configure(pt, flow.osmux_cfg); |
| 536 | } else { |
| 537 | var OsmuxemConfig osmux_cfg := c_OsmuxemDefaultCfg; |
| 538 | f_osmuxem_configure(pt, osmux_cfg); |
| 539 | } |
| 540 | |
| 541 | /* We didn't send a non-wildcarded Osmux CID yet. If caller wants to submit it, register handler */ |
| 542 | if (flow.osmux_cid_sent == false and flow.osmux_cid != -1) { |
| 543 | rx_hdl := c_OsmuxemDefaultRxHandle; |
| 544 | rx_hdl.cid := flow.osmux_cid; |
| 545 | f_osmuxem_register_rxhandle(pt, rx_hdl); |
| 546 | flow.osmux_cid_sent := true; |
| 547 | } |
| 548 | |
| 549 | /* connect MGW side Osmux socket to the emulation-side Osmux socket using SDP */ |
| 550 | cmd := ts_MDCX_osmux(get_next_trans_id(), ep, mode, call_id, flow.mgcp_conn_id, flow.osmux_cid); |
| 551 | cmd.sdp := ts_SDP(flow.em.hostname, flow.em.hostname, "23", "42", |
| 552 | flow.em.portnr, { int2str(flow.pt) }, attributes); |
| 553 | resp := mgcp_transceive_mgw(cmd, tr_MDCX_ACK); |
| 554 | |
| 555 | /* extract MGW-side port number from response. (usually this |
| 556 | * will not change, but thats is up to the MGW) */ |
| 557 | flow.mgw.portnr := |
| 558 | resp.sdp.media_list[0].media_field.ports.port_number; |
| 559 | |
| 560 | /* extract Osmux CID we got assigned by the MGW */ |
| 561 | var MgcpMessage resp_msg := { |
| 562 | response := resp |
| 563 | } |
| 564 | |
| 565 | if (f_mgcp_find_param(resp_msg, "X-OSMUX", cid_response) == false) { |
| 566 | setverdict(fail, "No Osmux CID in MGCP response", resp); |
| 567 | mtc.stop; |
| 568 | } |
| 569 | |
| 570 | /* Make sure response is no wildcard */ |
| 571 | cid_resp_parsed := f_mgcp_osmux_cid_decode(cid_response); |
| 572 | if (cid_resp_parsed == -1) { |
| 573 | setverdict(fail, "Osmux CID in MGCP response contains unexpected wildcard"); |
| 574 | mtc.stop; |
| 575 | } |
| 576 | if (cid_resp_parsed != flow.osmux_cid_response) { |
| 577 | setverdict(fail, "Osmux CID in MGCP MDCX response changed from prev value"); |
| 578 | mtc.stop; |
| 579 | } |
| 580 | |
| 581 | /* reconnect the emulation-side Osmux socket to the MGW */ |
| 582 | f_osmuxem_connect(pt, flow.mgw.hostname, flow.mgw.portnr); |
| 583 | } |
| 584 | |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 585 | /* Delete an existing RTP flow */ |
| 586 | function f_flow_delete(RTPEM_CTRL_PT pt, template MgcpEndpoint ep := omit, template MgcpCallId call_id := omit) |
| 587 | runs on dummy_CT { |
| 588 | var template MgcpCommand cmd; |
| 589 | var MgcpResponse resp; |
| 590 | |
| 591 | /* Switch off RTP flow */ |
| 592 | f_rtpem_mode(pt, RTPEM_MODE_NONE); |
| 593 | |
| 594 | /* Delete connection on MGW (if needed) */ |
| 595 | if (isvalue(call_id) and isvalue(ep)) { |
| 596 | f_sleep(0.1); |
| 597 | f_dlcx_ok(valueof(ep), call_id); |
| 598 | } |
| 599 | } |
| 600 | |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 601 | /* Delete an existing Osmux flow */ |
| 602 | function f_flow_delete_osmux(OsmuxEM_CTRL_PT pt, template MgcpEndpoint ep := omit, template MgcpCallId call_id := omit) |
| 603 | runs on dummy_CT { |
| 604 | var template MgcpCommand cmd; |
| 605 | var MgcpResponse resp; |
| 606 | |
| 607 | /* Switch off Osmux flow */ |
| 608 | f_osmuxem_mode(pt, OSMUXEM_MODE_NONE); |
| 609 | |
| 610 | /* Delete connection on MGW (if needed) */ |
| 611 | if (isvalue(call_id) and isvalue(ep)) { |
| 612 | f_sleep(0.1); |
| 613 | f_dlcx_ok(valueof(ep), call_id); |
| 614 | } |
| 615 | } |
| 616 | |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 617 | function f_crcx(charstring ep_prefix) runs on dummy_CT { |
| 618 | var MgcpEndpoint ep := ep_prefix & "2@" & c_mgw_domain; |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 619 | var template MgcpCommand cmd; |
| 620 | var MgcpResponse resp; |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 621 | var MgcpCallId call_id := '1234'H; |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 622 | |
Harald Welte | edc45c1 | 2017-11-18 19:15:05 +0100 | [diff] [blame] | 623 | f_init(ep); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 624 | |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 625 | /* create the connection on the MGW */ |
| 626 | cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id); |
Harald Welte | 9988d28 | 2017-11-18 19:22:00 +0100 | [diff] [blame] | 627 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 628 | extract_conn_id(resp); |
| 629 | |
| 630 | /* clean-up */ |
| 631 | f_dlcx_ok(ep, call_id); |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 632 | } |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 633 | |
Philipp Maier | 45635f4 | 2018-06-05 17:28:02 +0200 | [diff] [blame] | 634 | function f_crcx_no_lco(charstring ep_prefix) runs on dummy_CT { |
| 635 | var MgcpEndpoint ep := ep_prefix & "2@" & c_mgw_domain; |
| 636 | var template MgcpCommand cmd; |
| 637 | var MgcpResponse resp; |
| 638 | var MgcpCallId call_id := '1234'H; |
| 639 | |
| 640 | f_init(ep); |
| 641 | |
| 642 | /* create the connection on the MGW */ |
| 643 | cmd := ts_CRCX_no_lco(get_next_trans_id(), ep, "recvonly", call_id); |
| 644 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); |
| 645 | extract_conn_id(resp); |
| 646 | |
| 647 | /* clean-up */ |
| 648 | f_dlcx_ok(ep, call_id); |
| 649 | |
| 650 | /* See also OS#2658: Even when we omit the LCO information, we |
| 651 | expect the MGW to pick a sane payload type for us. This |
| 652 | payload type should be visible in the SDP of the response. */ |
Philipp Maier | 76a8d01 | 2018-06-21 10:03:13 +0200 | [diff] [blame] | 653 | if (resp.sdp.media_list[0].media_field.fmts[0] != "0") { |
Philipp Maier | 45635f4 | 2018-06-05 17:28:02 +0200 | [diff] [blame] | 654 | setverdict(fail, "SDP contains unexpected codec"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 655 | mtc.stop; |
Philipp Maier | 45635f4 | 2018-06-05 17:28:02 +0200 | [diff] [blame] | 656 | } |
| 657 | |
| 658 | /* See also OS#2658: We also expect the MGW to assign a port |
| 659 | number to us. */ |
| 660 | if (isbound(resp.sdp.media_list[0].media_field.ports.port_number) == false) { |
| 661 | setverdict(fail, "SDP does not contain a port number"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 662 | mtc.stop; |
Philipp Maier | 45635f4 | 2018-06-05 17:28:02 +0200 | [diff] [blame] | 663 | } |
| 664 | } |
| 665 | |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 666 | function f_crcx_osmux(charstring ep_prefix, MgcpOsmuxCID osmux_cid, boolean run_init := true) runs on dummy_CT { |
| 667 | var MgcpEndpoint ep := ep_prefix & "2@" & c_mgw_domain; |
| 668 | var template MgcpCommand cmd; |
| 669 | var MgcpResponse resp; |
| 670 | var MgcpCallId call_id := '1234'H; |
| 671 | var charstring cid_response; |
| 672 | |
| 673 | if (run_init) { |
| 674 | f_init(ep, true); |
| 675 | } |
| 676 | |
| 677 | /* create the connection on the MGW */ |
| 678 | cmd := ts_CRCX_osmux(get_next_trans_id(), ep, "recvonly", call_id, osmux_cid); |
| 679 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK_osmux); |
| 680 | extract_conn_id(resp); |
| 681 | |
| 682 | /* extract Osmux CID we got assigned by the MGW */ |
| 683 | var MgcpMessage resp_msg := { |
| 684 | response := resp |
| 685 | } |
| 686 | |
| 687 | if (f_mgcp_find_param(resp_msg, "X-OSMUX", cid_response) == false) { |
| 688 | setverdict(fail, "No Osmux CID in MGCP response", resp); |
| 689 | mtc.stop; |
| 690 | } |
| 691 | |
| 692 | /* Make sure response is no wildcard */ |
| 693 | if (f_mgcp_osmux_cid_decode(cid_response) == -1) { |
| 694 | setverdict(fail, "Osmux CID in MGCP response contains unexpected wildcard"); |
| 695 | mtc.stop; |
| 696 | } |
| 697 | |
| 698 | /* clean-up */ |
| 699 | f_dlcx_ok(ep, call_id); |
| 700 | } |
| 701 | |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 702 | /* test valid CRCX without SDP */ |
| 703 | testcase TC_crcx() runs on dummy_CT { |
| 704 | f_crcx(c_mgw_ep_rtpbridge); |
| 705 | setverdict(pass); |
| 706 | } |
| 707 | |
Philipp Maier | 45635f4 | 2018-06-05 17:28:02 +0200 | [diff] [blame] | 708 | /* test valid CRCX without SDP and LCO */ |
| 709 | testcase TC_crcx_no_lco() runs on dummy_CT { |
| 710 | f_crcx_no_lco(c_mgw_ep_rtpbridge); |
| 711 | setverdict(pass); |
| 712 | } |
| 713 | |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 714 | /* test valid CRCX without SDP (older method without endpoint prefix) */ |
| 715 | testcase TC_crcx_noprefix() runs on dummy_CT { |
| 716 | f_crcx(""); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 717 | setverdict(pass); |
| 718 | } |
| 719 | |
| 720 | /* test CRCX with unsupported mode, expect 517 */ |
| 721 | testcase TC_crcx_unsupp_mode() runs on dummy_CT { |
| 722 | var template MgcpCommand cmd; |
| 723 | var MgcpResponse resp; |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 724 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain; |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 725 | var MgcpCallId call_id := '1233'H; |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 726 | var template MgcpResponse rtmpl := tr_MgcpResp_Err("517"); |
| 727 | |
Harald Welte | edc45c1 | 2017-11-18 19:15:05 +0100 | [diff] [blame] | 728 | f_init(ep); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 729 | |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 730 | cmd := ts_CRCX(get_next_trans_id(), ep, "netwtest", call_id); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 731 | resp := mgcp_transceive_mgw(cmd, rtmpl); |
| 732 | setverdict(pass); |
| 733 | } |
| 734 | |
Pau Espin Pedrol | befd3aa | 2020-09-21 10:54:42 +0200 | [diff] [blame] | 735 | /* Test CRCX with X-Osmo-IGN, using same message as SYS#5063 to make sure it doesn't cause a crash. */ |
| 736 | testcase TC_crcx_osmo_ign() runs on dummy_CT { |
| 737 | var template MgcpCommand cmd; |
| 738 | var MgcpResponse resp; |
| 739 | var MgcpEndpoint ep := "7@" & c_mgw_domain; |
| 740 | var MgcpCallId call_id := '3'H; |
| 741 | |
| 742 | f_init(ep); |
| 743 | |
| 744 | /* CRCX 1 7@mgw MGCP 1.0 |
| 745 | C: 3 |
| 746 | L: p:20, a:GSM-EFR, nt:IN |
| 747 | M: recvonly |
| 748 | X-Osmo-IGN: C |
| 749 | */ |
| 750 | |
| 751 | cmd := ts_CRCX(get_next_trans_id(), ep, "netwtest", call_id); |
| 752 | cmd.params := {ts_MgcpParCallId(call_id), |
| 753 | t_MgcpParLocConnOpt("p:20, a:GSM-EFR, nt:IN"), |
| 754 | t_MgcpParConnMode("recvonly"), |
| 755 | t_MgcpParOsmoIGN("C")}; |
| 756 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); |
| 757 | extract_conn_id(resp); |
| 758 | |
| 759 | /* clean-up */ |
| 760 | f_dlcx_ok(ep, call_id); |
| 761 | setverdict(pass); |
| 762 | } |
| 763 | |
Harald Welte | 21ba557 | 2017-09-19 17:55:05 +0800 | [diff] [blame] | 764 | /* test CRCX with early bi-directional mode, expect 527 as |
| 765 | * bi-diretional media can only be established once both local and |
| 766 | * remote side are specified, see MGCP RFC */ |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 767 | testcase TC_crcx_early_bidir_mode() runs on dummy_CT { |
| 768 | var template MgcpCommand cmd; |
| 769 | var MgcpResponse resp; |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 770 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain; |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 771 | var MgcpCallId call_id := '1232'H; |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 772 | var template MgcpResponse rtmpl := tr_MgcpResp_Err("527"); |
| 773 | |
Harald Welte | edc45c1 | 2017-11-18 19:15:05 +0100 | [diff] [blame] | 774 | f_init(ep); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 775 | |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 776 | cmd := ts_CRCX(get_next_trans_id(), ep, "sendrecv", call_id); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 777 | resp := mgcp_transceive_mgw(cmd, rtmpl); |
| 778 | setverdict(pass); |
| 779 | } |
| 780 | |
| 781 | /* test CRCX with unsupported Parameters */ |
| 782 | testcase TC_crcx_unsupp_param() runs on dummy_CT { |
| 783 | var template MgcpCommand cmd; |
| 784 | var MgcpResponse resp; |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 785 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain; |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 786 | var MgcpCallId call_id := '1231'H; |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 787 | var template MgcpResponse rtmpl := tr_MgcpResp_Err("539"); |
| 788 | |
Harald Welte | edc45c1 | 2017-11-18 19:15:05 +0100 | [diff] [blame] | 789 | f_init(ep); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 790 | |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 791 | cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id); |
Harald Welte | a01e38d | 2017-11-18 18:40:01 +0100 | [diff] [blame] | 792 | /* osmo-bsc_mgcp/mgw doesn't implement notifications */ |
| 793 | f_mgcp_par_append(cmd.params, MgcpParameter:{ "N", "foobar" }); |
| 794 | |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 795 | resp := mgcp_transceive_mgw(cmd, rtmpl); |
| 796 | setverdict(pass); |
| 797 | } |
| 798 | |
| 799 | /* test CRCX with missing CallId */ |
| 800 | testcase TC_crcx_missing_callid() runs on dummy_CT { |
| 801 | var template MgcpCommand cmd; |
| 802 | var MgcpResponse resp; |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 803 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain; |
Harald Welte | f91edf3 | 2017-12-28 14:16:21 +0100 | [diff] [blame] | 804 | var template MgcpResponse rtmpl := tr_MgcpResp_Err(("400","516")); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 805 | |
Harald Welte | edc45c1 | 2017-11-18 19:15:05 +0100 | [diff] [blame] | 806 | f_init(ep); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 807 | |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 808 | cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", '1230'H); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 809 | cmd.params := { |
| 810 | t_MgcpParConnMode("recvonly"), |
| 811 | t_MgcpParLocConnOpt("p:20") |
| 812 | } |
| 813 | resp := mgcp_transceive_mgw(cmd, rtmpl); |
| 814 | setverdict(pass); |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 815 | |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 816 | } |
| 817 | |
| 818 | /* test CRCX with missing Mode */ |
| 819 | testcase TC_crcx_missing_mode() runs on dummy_CT { |
| 820 | var template MgcpCommand cmd; |
| 821 | var MgcpResponse resp; |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 822 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain; |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 823 | var MgcpCallId call_id := '1229'H; |
Harald Welte | f91edf3 | 2017-12-28 14:16:21 +0100 | [diff] [blame] | 824 | var template MgcpResponse rtmpl := tr_MgcpResp_Err(("400","517")); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 825 | |
Harald Welte | edc45c1 | 2017-11-18 19:15:05 +0100 | [diff] [blame] | 826 | f_init(ep); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 827 | |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 828 | cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 829 | cmd.params := { |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 830 | ts_MgcpParCallId(call_id), |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 831 | t_MgcpParLocConnOpt("p:20") |
| 832 | } |
| 833 | resp := mgcp_transceive_mgw(cmd, rtmpl); |
| 834 | setverdict(pass); |
| 835 | } |
| 836 | |
| 837 | /* test CRCX with unsupported packetization interval */ |
| 838 | testcase TC_crcx_unsupp_packet_intv() runs on dummy_CT { |
| 839 | var template MgcpCommand cmd; |
| 840 | var MgcpResponse resp; |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 841 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain; |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 842 | var MgcpCallId call_id := '1228'H; |
Harald Welte | 0d19861 | 2017-11-18 19:58:31 +0100 | [diff] [blame] | 843 | var template MgcpResponse rtmpl := tr_MgcpResp_Err("535"); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 844 | |
Harald Welte | edc45c1 | 2017-11-18 19:15:05 +0100 | [diff] [blame] | 845 | f_init(ep); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 846 | |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 847 | cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id); |
Harald Welte | a01e38d | 2017-11-18 18:40:01 +0100 | [diff] [blame] | 848 | cmd.params[2] := t_MgcpParLocConnOpt("p:111"); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 849 | resp := mgcp_transceive_mgw(cmd, rtmpl); |
| 850 | setverdict(pass); |
| 851 | } |
| 852 | |
| 853 | /* test CRCX with illegal double presence of local connection option */ |
| 854 | testcase TC_crcx_illegal_double_lco() runs on dummy_CT { |
| 855 | var template MgcpCommand cmd; |
| 856 | var MgcpResponse resp; |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 857 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain; |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 858 | var MgcpCallId call_id := '1227'H; |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 859 | var template MgcpResponse rtmpl := tr_MgcpResp_Err("524"); |
| 860 | |
Harald Welte | edc45c1 | 2017-11-18 19:15:05 +0100 | [diff] [blame] | 861 | f_init(ep); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 862 | |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 863 | cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id); |
Harald Welte | a01e38d | 2017-11-18 18:40:01 +0100 | [diff] [blame] | 864 | /* p:20 is permitted only once and not twice! */ |
| 865 | cmd.params[2] := t_MgcpParLocConnOpt("p:20, a:AMR, p:20"); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 866 | resp := mgcp_transceive_mgw(cmd, rtmpl); |
| 867 | setverdict(pass); |
| 868 | } |
| 869 | |
| 870 | /* test valid CRCX with valid SDP */ |
| 871 | testcase TC_crcx_sdp() runs on dummy_CT { |
| 872 | var template MgcpCommand cmd; |
| 873 | var MgcpResponse resp; |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 874 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain; |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 875 | var MgcpCallId call_id := '1226'H; |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 876 | |
Harald Welte | edc45c1 | 2017-11-18 19:15:05 +0100 | [diff] [blame] | 877 | f_init(ep); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 878 | |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 879 | cmd := ts_CRCX(get_next_trans_id(), ep, "sendrecv", call_id); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 880 | cmd.sdp := ts_SDP("127.0.0.1", "127.0.0.2", "23", "42", 2344, { "98" }, |
| 881 | { valueof(ts_SDP_rtpmap(98, "AMR/8000")), |
| 882 | valueof(ts_SDP_ptime(20)) }); |
Harald Welte | 9988d28 | 2017-11-18 19:22:00 +0100 | [diff] [blame] | 883 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); |
Philipp Maier | dffa6a4 | 2018-02-02 11:55:44 +0100 | [diff] [blame] | 884 | |
| 885 | /* clean-up */ |
| 886 | f_dlcx_ok(ep, call_id); |
| 887 | |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 888 | setverdict(pass); |
| 889 | } |
| 890 | |
Philipp Maier | 5e06cee | 2018-02-01 18:28:08 +0100 | [diff] [blame] | 891 | /* test valid wildcarded CRCX */ |
| 892 | testcase TC_crcx_wildcarded() runs on dummy_CT { |
| 893 | var template MgcpCommand cmd; |
| 894 | var MgcpResponse resp; |
| 895 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "*@" & c_mgw_domain; |
| 896 | var MgcpCallId call_id := '1234'H; |
| 897 | var MgcpEndpoint ep_assigned; |
| 898 | f_init(); |
| 899 | |
| 900 | /* create the connection on the MGW */ |
| 901 | cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id); |
| 902 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); |
| 903 | extract_conn_id(resp); |
| 904 | |
| 905 | /* extract endpoint name we got assigned by the MGW */ |
| 906 | var MgcpMessage resp_msg := { |
| 907 | response := resp |
| 908 | } |
| 909 | if (f_mgcp_find_param(resp_msg, "Z", ep_assigned) == false) { |
| 910 | setverdict(fail, "No SpecificEndpointName in MGCP response", resp); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 911 | mtc.stop; |
Philipp Maier | 5e06cee | 2018-02-01 18:28:08 +0100 | [diff] [blame] | 912 | } |
| 913 | |
| 914 | /* clean-up */ |
| 915 | f_dlcx_ok(ep_assigned, call_id); |
| 916 | |
| 917 | setverdict(pass); |
| 918 | } |
| 919 | |
| 920 | /* test valid wildcarded CRCX */ |
| 921 | testcase TC_crcx_wildcarded_exhaust() runs on dummy_CT { |
Philipp Maier | c60e847 | 2020-07-08 12:57:13 +0200 | [diff] [blame] | 922 | const integer n_endpoints := 31; |
Philipp Maier | 5e06cee | 2018-02-01 18:28:08 +0100 | [diff] [blame] | 923 | var integer i; |
| 924 | var template MgcpCommand cmd; |
| 925 | var MgcpResponse resp; |
| 926 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "*@" & c_mgw_domain; |
| 927 | var MgcpCallId call_id := '1234'H; |
| 928 | var MgcpEndpoint ep_assigned[n_endpoints]; |
| 929 | f_init(); |
| 930 | |
| 931 | /* Exhaust all endpoint resources on the virtual trunk */ |
| 932 | for (i := 0; i < n_endpoints; i := i+1) { |
| 933 | cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id); |
| 934 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); |
| 935 | |
| 936 | /* Make sure we got a connection id */ |
| 937 | extract_conn_id(resp); |
| 938 | |
| 939 | var MgcpMessage resp_msg := { |
| 940 | response := resp |
| 941 | } |
| 942 | if (f_mgcp_find_param(resp_msg, "Z", ep_assigned[i]) == false) { |
| 943 | setverdict(fail, "No SpecificEndpointName in MGCP response", resp); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 944 | mtc.stop; |
Philipp Maier | 5e06cee | 2018-02-01 18:28:08 +0100 | [diff] [blame] | 945 | } |
| 946 | } |
| 947 | |
| 948 | /* Try to allocate one more endpoint, which should fail */ |
| 949 | cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id); |
| 950 | var template MgcpResponse rtmpl := tr_MgcpResp_Err("403"); |
| 951 | resp := mgcp_transceive_mgw(cmd, rtmpl); |
| 952 | setverdict(pass); |
| 953 | |
| 954 | /* clean-up */ |
| 955 | for (i := 0; i < n_endpoints; i := i+1) { |
| 956 | f_dlcx_ok(ep_assigned[i], call_id); |
| 957 | } |
| 958 | setverdict(pass); |
| 959 | } |
| 960 | |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 961 | /* TODO: various SDP related bits */ |
| 962 | |
| 963 | |
| 964 | /* TODO: CRCX with X-Osmux */ |
| 965 | /* TODO: double CRCX without force_realloc */ |
| 966 | |
| 967 | /* TODO: MDCX (various) */ |
| 968 | |
| 969 | /* TODO: MDCX without CRCX first */ |
| 970 | testcase TC_mdcx_without_crcx() runs on dummy_CT { |
| 971 | var template MgcpCommand cmd; |
| 972 | var MgcpResponse resp; |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 973 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "3@" & c_mgw_domain; |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 974 | var MgcpCallId call_id := '1225'H; |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 975 | var template MgcpResponse rtmpl := { |
| 976 | line := { |
| 977 | /* TODO: accept/enforce better error? */ |
| 978 | code := "400", |
| 979 | string := ? |
| 980 | }, |
| 981 | params:= { }, |
| 982 | sdp := omit |
| 983 | }; |
| 984 | |
Harald Welte | edc45c1 | 2017-11-18 19:15:05 +0100 | [diff] [blame] | 985 | f_init(ep); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 986 | |
Harald Welte | 2bcfd3a | 2017-11-18 22:14:35 +0100 | [diff] [blame] | 987 | cmd := ts_MDCX(get_next_trans_id(), ep, "sendrecv", call_id, call_id); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 988 | cmd.sdp := ts_SDP("127.0.0.1", "127.0.0.2", "23", "42", 2344, { "98" }, |
| 989 | { valueof(ts_SDP_rtpmap(98, "AMR/8000")), |
| 990 | valueof(ts_SDP_ptime(20)) }); |
| 991 | resp := mgcp_transceive_mgw(cmd, rtmpl); |
| 992 | setverdict(pass); |
| 993 | } |
| 994 | |
| 995 | /* DLCX without CRCX first */ |
| 996 | testcase TC_dlcx_without_crcx() runs on dummy_CT { |
| 997 | var template MgcpCommand cmd; |
| 998 | var MgcpResponse resp; |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 999 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "4@" & c_mgw_domain; |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 1000 | var template MgcpResponse rtmpl := { |
| 1001 | line := { |
Harald Welte | f91edf3 | 2017-12-28 14:16:21 +0100 | [diff] [blame] | 1002 | code := ("400", "515"), |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 1003 | string := ? |
| 1004 | }, |
| 1005 | params:= { }, |
| 1006 | sdp := omit |
| 1007 | }; |
| 1008 | |
Harald Welte | edc45c1 | 2017-11-18 19:15:05 +0100 | [diff] [blame] | 1009 | f_init(ep); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 1010 | |
Harald Welte | edc45c1 | 2017-11-18 19:15:05 +0100 | [diff] [blame] | 1011 | cmd := ts_DLCX(get_next_trans_id(), ep, '41234'H); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 1012 | resp := mgcp_transceive_mgw(cmd, rtmpl); |
| 1013 | setverdict(pass); |
| 1014 | } |
| 1015 | |
Philipp Maier | 8a3dc92 | 2018-02-02 14:55:12 +0100 | [diff] [blame] | 1016 | /* test valid wildcarded MDCX */ |
| 1017 | testcase TC_mdcx_wildcarded() runs on dummy_CT { |
| 1018 | /* Note: A wildcarded MDCX is not allowed, so we expect the |
| 1019 | * MGW to reject this request */ |
| 1020 | var template MgcpCommand cmd; |
| 1021 | var MgcpResponse resp; |
| 1022 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "*@" & c_mgw_domain; |
| 1023 | var MgcpCallId call_id := '1225'H; |
| 1024 | var template MgcpResponse rtmpl := { |
| 1025 | line := { |
| 1026 | /* TODO: accept/enforce better error? */ |
| 1027 | code := "507", |
| 1028 | string := ? |
| 1029 | }, |
| 1030 | params:= { }, |
| 1031 | sdp := omit |
| 1032 | }; |
| 1033 | |
| 1034 | f_init(ep); |
| 1035 | |
| 1036 | cmd := ts_MDCX(get_next_trans_id(), ep, "sendrecv", call_id, call_id); |
| 1037 | cmd.sdp := ts_SDP("127.0.0.1", "127.0.0.2", "23", "42", 2344, { "98" }, |
| 1038 | { valueof(ts_SDP_rtpmap(98, "AMR/8000")), |
| 1039 | valueof(ts_SDP_ptime(20)) }); |
| 1040 | resp := mgcp_transceive_mgw(cmd, rtmpl); |
| 1041 | setverdict(pass); |
| 1042 | } |
| 1043 | |
| 1044 | /* test valid wildcarded DLCX */ |
| 1045 | testcase TC_dlcx_wildcarded() runs on dummy_CT { |
| 1046 | /* Note: A wildcarded DLCX is specified, but our MGW does not |
| 1047 | * support this feature so we expect the MGW to reject the |
| 1048 | * request */ |
| 1049 | var template MgcpCommand cmd; |
| 1050 | var MgcpResponse resp; |
| 1051 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "*@" & c_mgw_domain; |
| 1052 | var template MgcpResponse rtmpl := { |
| 1053 | line := { |
| 1054 | code := "507", |
| 1055 | string := ? |
| 1056 | }, |
| 1057 | params:= { }, |
| 1058 | sdp := omit |
| 1059 | }; |
| 1060 | |
| 1061 | f_init(ep); |
| 1062 | |
| 1063 | cmd := ts_DLCX(get_next_trans_id(), ep, '41234'H); |
| 1064 | resp := mgcp_transceive_mgw(cmd, rtmpl); |
| 1065 | setverdict(pass); |
| 1066 | } |
| 1067 | |
Harald Welte | 79181ff | 2017-11-18 19:26:11 +0100 | [diff] [blame] | 1068 | /* Test (valid) CRCX followed by (valid) DLCX containig EP+CallId+ConnId */ |
| 1069 | testcase TC_crcx_and_dlcx_ep_callid_connid() runs on dummy_CT { |
| 1070 | var template MgcpCommand cmd; |
| 1071 | var MgcpResponse resp; |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 1072 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "5@" & c_mgw_domain; |
Harald Welte | 79181ff | 2017-11-18 19:26:11 +0100 | [diff] [blame] | 1073 | var MgcpCallId call_id := '51234'H; |
| 1074 | |
| 1075 | f_init(ep); |
| 1076 | |
| 1077 | cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id); |
| 1078 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); |
| 1079 | |
| 1080 | f_dlcx_ok(ep, call_id, extract_conn_id(resp)); |
| 1081 | |
| 1082 | setverdict(pass); |
| 1083 | } |
| 1084 | |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 1085 | /* test valid CRCX without SDP */ |
| 1086 | testcase TC_crcx_osmux_wildcard() runs on dummy_CT { |
| 1087 | f_crcx_osmux(c_mgw_ep_rtpbridge, -1); |
| 1088 | setverdict(pass); |
| 1089 | } |
| 1090 | |
| 1091 | /* test valid CRCX without SDP */ |
| 1092 | testcase TC_crcx_osmux_fixed() runs on dummy_CT { |
| 1093 | f_crcx_osmux(c_mgw_ep_rtpbridge, 2); |
| 1094 | setverdict(pass); |
| 1095 | } |
| 1096 | |
| 1097 | /* test valid CRCX without SDP, twice, to make sure CID is freed fine during first step. */ |
| 1098 | testcase TC_crcx_osmux_fixed_twice() runs on dummy_CT { |
| 1099 | f_crcx_osmux(c_mgw_ep_rtpbridge, 3, true); |
| 1100 | f_crcx_osmux(c_mgw_ep_rtpbridge, 3, false); |
| 1101 | setverdict(pass); |
| 1102 | } |
| 1103 | |
| 1104 | /* Create one half open connection in receive-only mode. The MGW must accept |
| 1105 | * the packets but must not send any. */ |
| 1106 | testcase TC_one_crcx_receive_only_osmux() runs on dummy_CT { |
| 1107 | var RtpFlowData flow; |
| 1108 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "1@" & c_mgw_domain; |
| 1109 | var MgcpCallId call_id := '1225'H; |
| 1110 | var OsmuxemStats stats; |
| 1111 | var OsmuxTxHandle tx_hdl; |
| 1112 | |
| 1113 | f_init(ep, true); |
Pau Espin Pedrol | b604af0 | 2020-09-07 17:12:39 +0200 | [diff] [blame] | 1114 | flow := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 112, "AMR/8000/1")); |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 1115 | flow.em.portnr := mp_local_osmux_port; |
| 1116 | flow.osmux_cid := -1; |
| 1117 | f_flow_create_osmux(OsmuxEM, ep, call_id, "recvonly", flow, false); |
| 1118 | |
| 1119 | /* create a transmitter not yet known by MGW */ |
| 1120 | tx_hdl := valueof(t_TxHandleAMR590(2)); |
| 1121 | f_osmuxem_register_txhandle(OsmuxEM, tx_hdl); |
| 1122 | |
| 1123 | f_osmuxem_mode(OsmuxEM, OSMUXEM_MODE_TXONLY); |
| 1124 | f_sleep(1.0); |
| 1125 | f_flow_delete_osmux(OsmuxEM, ep, call_id); |
| 1126 | |
| 1127 | stats := f_osmuxem_stats_get(OsmuxEM); |
| 1128 | |
| 1129 | if (stats.num_pkts_tx < 40 / flow.osmux_cfg.batch_size) { |
| 1130 | setverdict(fail); |
| 1131 | } |
| 1132 | if (stats.bytes_payload_tx < stats.num_pkts_tx * f_amrft_payload_len(tx_hdl.amr_ft) * flow.osmux_cfg.batch_size) { |
| 1133 | setverdict(fail); |
| 1134 | } |
| 1135 | |
| 1136 | f_osmuxem_stats_err_check(stats); |
| 1137 | |
| 1138 | setverdict(pass); |
| 1139 | } |
| 1140 | |
| 1141 | /* Create one connection in loopback mode, test if the Osmux packets are |
| 1142 | * actually reflected */ |
| 1143 | testcase TC_one_crcx_loopback_osmux() runs on dummy_CT { |
| 1144 | var RtpFlowData flow; |
| 1145 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "1@" & c_mgw_domain; |
| 1146 | var MgcpCallId call_id := '1225'H; |
| 1147 | var OsmuxemStats stats; |
| 1148 | var OsmuxTxHandle tx_hdl; |
| 1149 | |
| 1150 | f_init(ep, true); |
Pau Espin Pedrol | b604af0 | 2020-09-07 17:12:39 +0200 | [diff] [blame] | 1151 | flow := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 111, "GSM-HR-08/8000/1")); |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 1152 | flow.em.portnr := mp_local_osmux_port; |
| 1153 | flow.osmux_cid := 2; |
| 1154 | f_flow_create_osmux(OsmuxEM, ep, call_id, "loopback", flow); |
| 1155 | |
| 1156 | f_osmuxem_mode(OsmuxEM, OSMUXEM_MODE_BIDIR); |
| 1157 | f_sleep(1.0); |
| 1158 | |
| 1159 | /* Switch off both Tx, wait to receive delayed frames from MGW */ |
| 1160 | f_osmuxem_mode(OsmuxEM, OSMUXEM_MODE_RXONLY); |
| 1161 | f_sleep(0.1); |
| 1162 | f_flow_delete_osmux(OsmuxEM, ep, call_id); |
| 1163 | |
| 1164 | stats := f_osmuxem_stats_get(OsmuxEM); |
| 1165 | |
| 1166 | if (stats.num_pkts_tx != stats.num_pkts_rx) { |
| 1167 | setverdict(fail); |
| 1168 | } |
| 1169 | if (stats.bytes_payload_tx != stats.bytes_payload_rx) { |
| 1170 | setverdict(fail); |
| 1171 | } |
| 1172 | |
| 1173 | f_osmuxem_stats_err_check(stats); |
| 1174 | |
| 1175 | setverdict(pass); |
| 1176 | } |
| 1177 | |
| 1178 | /* Cross-compare two osmuxem-statistics. The transmission statistics on the a side |
| 1179 | * must match the reception statistics on the other side and vice versa. The |
| 1180 | * user may also supply a tolerance value (number of packets) when deviations |
| 1181 | * are acceptable */ |
| 1182 | function f_rtp_osmux_stats_compare(RtpemStats a, OsmuxemStats b, integer batch_size, integer tolerance := 0) return boolean { |
| 1183 | var integer plen; |
| 1184 | |
| 1185 | log("stats A: ", a); |
| 1186 | log("stats B: ", b); |
| 1187 | log("tolerance: ", tolerance, " packets"); |
| 1188 | log("batch_size: ", batch_size, " packets"); |
| 1189 | |
| 1190 | var integer tolerance_batch := tolerance + (batch_size - tolerance mod batch_size); |
| 1191 | |
| 1192 | if (f_osmuxem_stats_compare_value(a.num_pkts_tx, b.num_pkts_rx * batch_size, tolerance_batch) == false) { |
| 1193 | return false; |
| 1194 | } |
| 1195 | |
| 1196 | if (f_osmuxem_stats_compare_value(a.num_pkts_rx / batch_size, b.num_pkts_tx, tolerance_batch) == false) { |
| 1197 | return false; |
| 1198 | } |
| 1199 | |
| 1200 | if(a.num_pkts_tx > 0) { |
| 1201 | plen := a.bytes_payload_tx / a.num_pkts_tx; |
| 1202 | } else { |
| 1203 | plen := 0; |
| 1204 | } |
| 1205 | |
| 1206 | /* Each RTP pcket payload contains 2 extra bytes due to AMR ToC at start */ |
| 1207 | if (f_osmuxem_stats_compare_value(a.bytes_payload_tx, b.bytes_payload_rx + a.num_pkts_tx * 2, tolerance_batch * plen) == false) { |
| 1208 | log("incorrect payload A->B: " , a.bytes_payload_tx, " vs ", b.bytes_payload_rx + a.num_pkts_rx * 2); |
| 1209 | return false; |
| 1210 | } |
| 1211 | |
| 1212 | if (f_osmuxem_stats_compare_value(a.bytes_payload_rx, b.bytes_payload_tx + b.num_pkts_tx * 2 * batch_size, tolerance_batch * plen) == false) { |
| 1213 | log("incorrect payload B->A: " , b.bytes_payload_tx + b.num_pkts_tx * 2 * batch_size, " vs ", a.bytes_payload_rx); |
| 1214 | return false; |
| 1215 | } |
| 1216 | |
| 1217 | return true; |
| 1218 | } |
| 1219 | |
Pau Espin Pedrol | 9e0141a | 2020-09-07 17:25:56 +0200 | [diff] [blame] | 1220 | function f_TC_two_crcx_and_rtp_osmux(boolean bidir, |
| 1221 | charstring local_ip_rtp, charstring remote_ip_rtp, |
| 1222 | charstring local_ip_osmux, charstring remote_ip_osmux) runs on dummy_CT { |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 1223 | var RtpFlowData flow[2]; |
| 1224 | var RtpemStats stats_rtp; |
| 1225 | var OsmuxemStats stats_osmux; |
| 1226 | var MgcpResponse resp; |
| 1227 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain; |
| 1228 | var MgcpCallId call_id := '1226'H; |
| 1229 | var integer tolerance := 0; |
| 1230 | |
| 1231 | f_init(ep, true); |
| 1232 | |
| 1233 | /* from us to MGW */ |
Pau Espin Pedrol | 9e0141a | 2020-09-07 17:25:56 +0200 | [diff] [blame] | 1234 | flow[0] := valueof(t_RtpFlow(local_ip_rtp, remote_ip_rtp, 112, "AMR/8000")); |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 1235 | flow[0].rtp_cfg := c_RtpemDefaultCfg |
| 1236 | flow[0].rtp_cfg.tx_payload_type := flow[0].pt; |
| 1237 | /* 0014 is the ToC (CMR=AMR4.75) in front of AMR Payload in RTP Payload */ |
| 1238 | flow[0].rtp_cfg.rx_fixed_payload := '0014'O & f_osmux_gen_expected_rx_rtp_payload(2 /* AMR_FT_2, 5.90 */, c_OsmuxemDefaultCfg.tx_fixed_payload); |
| 1239 | flow[0].rtp_cfg.tx_fixed_payload := flow[0].rtp_cfg.rx_fixed_payload; |
| 1240 | /* bind local RTP emulation sockets */ |
| 1241 | flow[0].em.portnr := 10000; |
| 1242 | f_flow_create(RTPEM[0], ep, call_id, "sendrecv", flow[0]); |
| 1243 | |
| 1244 | /* from MGW back to us */ |
Pau Espin Pedrol | 9e0141a | 2020-09-07 17:25:56 +0200 | [diff] [blame] | 1245 | flow[1] := valueof(t_RtpFlow(local_ip_osmux, remote_ip_osmux, 110, "AMR/8000")); |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 1246 | flow[1].em.portnr := mp_local_osmux_port; |
| 1247 | flow[1].osmux_cid := 2; |
| 1248 | flow[1].osmux_cfg := c_OsmuxemDefaultCfg; |
| 1249 | f_flow_create_osmux(OsmuxEM, ep, call_id, "sendrecv", flow[1]); |
| 1250 | |
| 1251 | if (bidir) { |
| 1252 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_BIDIR); |
| 1253 | f_osmuxem_mode(OsmuxEM, OSMUXEM_MODE_BIDIR); |
| 1254 | |
| 1255 | /* Note: When we test bidirectional we may |
| 1256 | * loose packets during switch off because |
| 1257 | * both ends are transmitting and we only |
| 1258 | * can switch them off one by one. */ |
| 1259 | tolerance := 3; |
| 1260 | } else { |
| 1261 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_RXONLY); |
| 1262 | f_osmuxem_mode(OsmuxEM, OSMUXEM_MODE_TXONLY); |
| 1263 | } |
| 1264 | |
| 1265 | f_sleep(1.0); |
| 1266 | |
| 1267 | /* Switch off both Tx, wait to receive delayed frames from MGW */ |
| 1268 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_RXONLY); |
| 1269 | f_osmuxem_mode(OsmuxEM, OSMUXEM_MODE_RXONLY); |
| 1270 | f_sleep(0.1); |
| 1271 | |
| 1272 | f_flow_delete_osmux(OsmuxEM, ep, call_id); |
| 1273 | f_flow_delete(RTPEM[1]); |
| 1274 | |
| 1275 | stats_rtp := f_rtpem_stats_get(RTPEM[0]); |
| 1276 | stats_osmux := f_osmuxem_stats_get(OsmuxEM); |
| 1277 | if (not f_rtp_osmux_stats_compare(stats_rtp, stats_osmux, flow[1].osmux_cfg.batch_size, tolerance)) { |
| 1278 | setverdict(fail, "RTP and Osmux endpoint statistics don't match"); |
| 1279 | mtc.stop; |
| 1280 | } |
| 1281 | |
| 1282 | f_rtpem_stats_err_check(stats_rtp); |
| 1283 | f_osmuxem_stats_err_check(stats_osmux); |
| 1284 | |
| 1285 | setverdict(pass); |
| 1286 | } |
| 1287 | |
| 1288 | /* create one RTP and one OSmux emulations; create two connections on MGW EP, exchange some data */ |
| 1289 | testcase TC_two_crcx_and_rtp_osmux() runs on dummy_CT { |
Pau Espin Pedrol | 9e0141a | 2020-09-07 17:25:56 +0200 | [diff] [blame] | 1290 | f_TC_two_crcx_and_rtp_osmux(false, mp_local_ipv4, mp_remote_ipv4, |
| 1291 | mp_local_ipv4, mp_remote_ipv4); |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 1292 | } |
| 1293 | |
| 1294 | /* create one RTP and one OSmux emulations; create two connections on MGW EP, |
| 1295 | * exchange some data in both directions */ |
| 1296 | testcase TC_two_crcx_and_rtp_osmux_bidir() runs on dummy_CT { |
Pau Espin Pedrol | 9e0141a | 2020-09-07 17:25:56 +0200 | [diff] [blame] | 1297 | f_TC_two_crcx_and_rtp_osmux(true, mp_local_ipv4, mp_remote_ipv4, |
| 1298 | mp_local_ipv4, mp_remote_ipv4); |
| 1299 | } |
| 1300 | |
| 1301 | /* Same as TC_two_crcx_and_rtp_osmux_bidir, but using IPv6 */ |
| 1302 | testcase TC_two_crcx_and_rtp_osmux_bidir_ipv6() runs on dummy_CT { |
| 1303 | f_TC_two_crcx_and_rtp_osmux(true, mp_local_ipv6, mp_remote_ipv6, |
| 1304 | mp_local_ipv6, mp_remote_ipv6); |
| 1305 | } |
| 1306 | /* Same as TC_two_crcx_and_rtp_osmux_bidir, but using IPv4 (RTP) and IPv6 (Osmux) */ |
| 1307 | testcase TC_two_crcx_and_rtp_osmux_bidir_ipv4_ipv6() runs on dummy_CT { |
| 1308 | f_TC_two_crcx_and_rtp_osmux(true, mp_local_ipv4, mp_remote_ipv4, |
| 1309 | mp_local_ipv6, mp_remote_ipv6); |
| 1310 | } |
| 1311 | /* Same as TC_two_crcx_and_rtp_osmux_bidir, but using IPv6 (RTP) and IPv4 (Osmux) */ |
| 1312 | testcase TC_two_crcx_and_rtp_osmux_bidir_ipv6_ipv4() runs on dummy_CT { |
| 1313 | f_TC_two_crcx_and_rtp_osmux(true, mp_local_ipv6, mp_remote_ipv6, |
| 1314 | mp_local_ipv4, mp_remote_ipv4); |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 1315 | } |
| 1316 | |
| 1317 | |
Pau Espin Pedrol | 9e0141a | 2020-09-07 17:25:56 +0200 | [diff] [blame] | 1318 | function f_two_crcx_mdcx_and_rtp_osmux(boolean crcx_osmux_wildcard, |
| 1319 | charstring local_ip_rtp, charstring remote_ip_rtp, |
| 1320 | charstring local_ip_osmux, charstring remote_ip_osmux) runs on dummy_CT { |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 1321 | var RtpFlowData flow[2]; |
| 1322 | var RtpemStats stats_rtp; |
| 1323 | var OsmuxemStats stats_osmux; |
| 1324 | var MgcpResponse resp; |
| 1325 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain; |
| 1326 | var MgcpCallId call_id := '1227'H; |
| 1327 | var integer num_pkts_tx[2]; |
| 1328 | var integer temp; |
| 1329 | |
| 1330 | f_init(ep, true); |
| 1331 | |
| 1332 | /* Create the first connection in receive only mode */ |
Pau Espin Pedrol | 9e0141a | 2020-09-07 17:25:56 +0200 | [diff] [blame] | 1333 | flow[0] := valueof(t_RtpFlow(local_ip_rtp, remote_ip_rtp, 112, "AMR/8000")); |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 1334 | flow[0].rtp_cfg := c_RtpemDefaultCfg |
| 1335 | flow[0].rtp_cfg.tx_payload_type := flow[0].pt; |
| 1336 | /* 0014 is the ToC (CMR=AMR4.75) in front of AMR Payload in RTP Payload */ |
| 1337 | flow[0].rtp_cfg.rx_fixed_payload := '0014'O & f_osmux_gen_expected_rx_rtp_payload(2 /* AMR_FT_2, 5.90 */, c_OsmuxemDefaultCfg.tx_fixed_payload); |
| 1338 | flow[0].rtp_cfg.tx_fixed_payload := flow[0].rtp_cfg.rx_fixed_payload; |
| 1339 | /* bind local RTP emulation sockets */ |
| 1340 | flow[0].em.portnr := 10000; |
Pau Espin Pedrol | 9e0141a | 2020-09-07 17:25:56 +0200 | [diff] [blame] | 1341 | f_flow_create(RTPEM[0], ep, call_id, "recvonly", flow[0], true); |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 1342 | |
| 1343 | |
| 1344 | /* Create the second connection. This connection will be also |
| 1345 | * in receive only mode */ |
Pau Espin Pedrol | 9e0141a | 2020-09-07 17:25:56 +0200 | [diff] [blame] | 1346 | flow[1] := valueof(t_RtpFlow(local_ip_osmux, remote_ip_osmux, 110, "AMR/8000")); |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 1347 | flow[1].em.portnr := mp_local_osmux_port; |
| 1348 | if (crcx_osmux_wildcard) { |
| 1349 | flow[1].osmux_cid := -1; |
| 1350 | } else { |
| 1351 | flow[1].osmux_cid := 2; |
| 1352 | } |
| 1353 | flow[1].osmux_cfg := c_OsmuxemDefaultCfg; |
Pau Espin Pedrol | 9e0141a | 2020-09-07 17:25:56 +0200 | [diff] [blame] | 1354 | f_flow_create_osmux(OsmuxEM, ep, call_id, "recvonly", flow[1], true); |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 1355 | |
| 1356 | |
| 1357 | /* The first leg starts transmitting */ |
| 1358 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_TXONLY); |
| 1359 | f_sleep(0.5); |
| 1360 | stats_rtp := f_rtpem_stats_get(RTPEM[0]); |
| 1361 | if (stats_rtp.num_pkts_rx_err_disabled != 0) { |
| 1362 | setverdict(fail, "received packets from RTP MGW on recvonly connection"); |
| 1363 | mtc.stop; |
| 1364 | } |
| 1365 | stats_osmux := f_osmuxem_stats_get(OsmuxEM); |
| 1366 | if (stats_osmux.num_pkts_rx_err_disabled != 0) { |
| 1367 | setverdict(fail, "received packets from Osmux MGW on recvonly connection"); |
| 1368 | mtc.stop; |
| 1369 | } |
| 1370 | |
| 1371 | /* The second leg starts transmitting a little later */ |
| 1372 | f_osmuxem_mode(OsmuxEM, OSMUXEM_MODE_TXONLY); |
| 1373 | f_sleep(1.0); |
| 1374 | stats_rtp := f_rtpem_stats_get(RTPEM[0]); |
| 1375 | if (stats_rtp.num_pkts_rx_err_disabled != 0) { |
| 1376 | setverdict(fail, "received packets from RTP MGW on recvonly connection"); |
| 1377 | mtc.stop; |
| 1378 | } |
| 1379 | stats_osmux := f_osmuxem_stats_get(OsmuxEM); |
| 1380 | if (stats_osmux.num_pkts_rx_err_disabled != 0) { |
| 1381 | setverdict(fail, "received packets from Osmux MGW on recvonly connection"); |
| 1382 | mtc.stop; |
| 1383 | } |
| 1384 | |
| 1385 | /* The first leg will now be switched into bidirectional |
| 1386 | * mode, but we do not expect any data comming back yet. */ |
Pau Espin Pedrol | e67b1c6 | 2020-09-08 12:16:17 +0200 | [diff] [blame] | 1387 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_BIDIR); |
| 1388 | stats_osmux := f_osmuxem_stats_get(OsmuxEM); |
| 1389 | num_pkts_tx[1] := stats_osmux.num_pkts_tx; |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 1390 | f_flow_modify(RTPEM[0], ep, call_id, "sendrecv", flow[0]); |
| 1391 | f_sleep(0.5); |
| 1392 | stats_rtp := f_rtpem_stats_get(RTPEM[0]); |
| 1393 | if (stats_rtp.num_pkts_rx_err_disabled != 0) { |
| 1394 | setverdict(fail, "received packets from RTP MGW on recvonly connection"); |
| 1395 | mtc.stop; |
| 1396 | } |
| 1397 | stats_osmux := f_osmuxem_stats_get(OsmuxEM); |
| 1398 | if (stats_osmux.num_pkts_rx_err_disabled != 0) { |
| 1399 | setverdict(fail, "received packets from Osmux MGW on recvonly connection"); |
| 1400 | mtc.stop; |
| 1401 | } |
| 1402 | |
| 1403 | /* When the second leg is switched into bidirectional mode |
| 1404 | * as well, then the MGW will connect the two together and |
| 1405 | * we should see RTP streams passing through from both ends. */ |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 1406 | f_osmuxem_mode(OsmuxEM, OSMUXEM_MODE_BIDIR); |
| 1407 | stats_rtp := f_rtpem_stats_get(RTPEM[0]); |
Pau Espin Pedrol | e67b1c6 | 2020-09-08 12:16:17 +0200 | [diff] [blame] | 1408 | num_pkts_tx[0] := stats_rtp.num_pkts_tx; |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 1409 | |
| 1410 | if (crcx_osmux_wildcard) { |
| 1411 | /* For now we must set same CID as the MGW recvCID, |
| 1412 | * having sendCID!=recvCID is not yet supported. */ |
| 1413 | flow[1].osmux_cid := flow[1].osmux_cid_response; |
| 1414 | } |
| 1415 | f_flow_modify_osmux(OsmuxEM, ep, call_id, "sendrecv", flow[1]); |
| 1416 | f_sleep(2.0); |
| 1417 | |
| 1418 | stats_rtp := f_rtpem_stats_get(RTPEM[0]); |
| 1419 | stats_osmux := f_osmuxem_stats_get(OsmuxEM); |
| 1420 | |
| 1421 | temp := stats_rtp.num_pkts_tx - num_pkts_tx[0] - stats_osmux.num_pkts_rx * flow[1].osmux_cfg.batch_size; |
| 1422 | if (temp > 3 * flow[1].osmux_cfg.batch_size or temp < -3 * flow[1].osmux_cfg.batch_size) { |
| 1423 | log("stats_rtp: ", stats_rtp); |
| 1424 | log("stats_osmux: ", stats_osmux); |
| 1425 | log("old_rtp_tx: ", num_pkts_tx[0]); |
| 1426 | setverdict(fail, "number of packets not within normal parameters (" & int2str(temp) & ")"); |
| 1427 | mtc.stop; |
| 1428 | } |
| 1429 | |
| 1430 | temp := stats_osmux.num_pkts_tx - num_pkts_tx[1] - stats_rtp.num_pkts_rx / flow[1].osmux_cfg.batch_size; |
| 1431 | if (temp > 3 or temp < -3) { |
| 1432 | setverdict(fail, "number of packets not within normal parameters (" & int2str(temp) & ")"); |
| 1433 | mtc.stop; |
| 1434 | } |
| 1435 | |
| 1436 | f_rtpem_stats_err_check(stats_rtp); |
| 1437 | f_osmuxem_stats_err_check(stats_osmux); |
| 1438 | |
| 1439 | /* Tear down */ |
| 1440 | f_flow_delete(RTPEM[0]); |
| 1441 | f_flow_delete_osmux(OsmuxEM, ep, call_id); |
| 1442 | setverdict(pass); |
| 1443 | } |
| 1444 | |
| 1445 | /* create one RTP and one OSmux emulations and pass data in both |
| 1446 | directions. Create CRCX with wildcard Osmux CID and set it later |
| 1447 | during MDCX. This is similar to how MSC sets up the call in AoIP. */ |
| 1448 | testcase TC_two_crcx_mdcx_and_rtp_osmux_wildcard() runs on dummy_CT { |
Pau Espin Pedrol | 9e0141a | 2020-09-07 17:25:56 +0200 | [diff] [blame] | 1449 | f_two_crcx_mdcx_and_rtp_osmux(true, mp_local_ipv4, mp_remote_ipv4, |
| 1450 | mp_local_ipv4, mp_remote_ipv4); |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 1451 | } |
| 1452 | |
| 1453 | /* create one RTP and one OSmux emulations and pass data in both |
| 1454 | directions. Create CRCX with fixed Osmux CID and keep it during |
| 1455 | MDCX. This is similar to how BSC sets up the call in AoIP. */ |
| 1456 | testcase TC_two_crcx_mdcx_and_rtp_osmux_fixed() runs on dummy_CT { |
Pau Espin Pedrol | 9e0141a | 2020-09-07 17:25:56 +0200 | [diff] [blame] | 1457 | f_two_crcx_mdcx_and_rtp_osmux(false, mp_local_ipv4, mp_remote_ipv4, |
| 1458 | mp_local_ipv4, mp_remote_ipv4); |
| 1459 | } |
| 1460 | |
| 1461 | /* Same as TC_two_crcx_mdcx_and_rtp_osmux_wildcard, but using IPv6. */ |
| 1462 | testcase TC_two_crcx_mdcx_and_rtp_osmux_ipv6() runs on dummy_CT { |
| 1463 | f_two_crcx_mdcx_and_rtp_osmux(false, mp_local_ipv6, mp_remote_ipv6, |
| 1464 | mp_local_ipv6, mp_remote_ipv6); |
| 1465 | } |
| 1466 | /* Same as TC_two_crcx_mdcx_and_rtp_osmux_wildcard, but using IPv4 (RTP) and IPv6 (Osmux). */ |
| 1467 | testcase TC_two_crcx_mdcx_and_rtp_osmux_ipv4_ipv6() runs on dummy_CT { |
| 1468 | f_two_crcx_mdcx_and_rtp_osmux(false, mp_local_ipv4, mp_remote_ipv4, |
| 1469 | mp_local_ipv6, mp_remote_ipv6); |
| 1470 | } |
| 1471 | /* Same as TC_two_crcx_mdcx_and_rtp_osmux_wildcard, but using IPv6 (RTP) and IPv4 (Osmux). */ |
| 1472 | testcase TC_two_crcx_mdcx_and_rtp_osmux_ipv6_ipv4() runs on dummy_CT { |
| 1473 | f_two_crcx_mdcx_and_rtp_osmux(false, mp_local_ipv6, mp_remote_ipv6, |
| 1474 | mp_local_ipv4, mp_remote_ipv4); |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 1475 | } |
| 1476 | |
Harald Welte | 646ecdb | 2017-12-28 03:21:57 +0100 | [diff] [blame] | 1477 | function f_crcx_and_dlcx_ep_callid_connid(MgcpEndpoint ep, MgcpCallId call_id) runs on dummy_CT { |
| 1478 | var template MgcpCommand cmd; |
| 1479 | var MgcpResponse resp; |
| 1480 | |
| 1481 | cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id); |
| 1482 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); |
| 1483 | |
| 1484 | f_dlcx_ok(ep, call_id, extract_conn_id(resp)); |
| 1485 | |
| 1486 | setverdict(pass); |
| 1487 | } |
| 1488 | |
| 1489 | testcase TC_crcx_dlcx_30ep() runs on dummy_CT { |
| 1490 | var MgcpEndpoint ep; |
| 1491 | var MgcpCallId call_id; |
| 1492 | var integer ep_nr; |
| 1493 | |
| 1494 | f_init(); |
| 1495 | |
| 1496 | for (ep_nr := 1; ep_nr < 30; ep_nr := ep_nr+1) { |
Philipp Maier | 4c2a1ea | 2020-05-15 18:37:05 +0200 | [diff] [blame] | 1497 | if(ep_nr > 15) { |
| 1498 | ep := c_mgw_ep_rtpbridge & hex2str(int2hex(ep_nr, 2)) & "@" & c_mgw_domain; |
| 1499 | } else { |
| 1500 | ep := c_mgw_ep_rtpbridge & hex2str(int2hex(ep_nr, 1)) & "@" & c_mgw_domain; |
| 1501 | } |
Harald Welte | 646ecdb | 2017-12-28 03:21:57 +0100 | [diff] [blame] | 1502 | call_id := int2hex(ep_nr, 2) & '1234'H; |
| 1503 | f_crcx_and_dlcx_ep_callid_connid(ep, call_id); |
| 1504 | } |
| 1505 | } |
| 1506 | |
Harald Welte | 79181ff | 2017-11-18 19:26:11 +0100 | [diff] [blame] | 1507 | /* Test (valid) CRCX followed by (valid) DLCX containing EP+CallId */ |
| 1508 | testcase TC_crcx_and_dlcx_ep_callid() runs on dummy_CT { |
Harald Welte | 5b4c44e | 2017-09-17 16:35:27 +0800 | [diff] [blame] | 1509 | var template MgcpCommand cmd; |
| 1510 | var MgcpResponse resp; |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 1511 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "5@" & c_mgw_domain; |
Harald Welte | 6d167f8 | 2017-11-18 19:41:35 +0100 | [diff] [blame] | 1512 | var MgcpCallId call_id := '51233'H; |
Harald Welte | 5b4c44e | 2017-09-17 16:35:27 +0800 | [diff] [blame] | 1513 | |
Harald Welte | edc45c1 | 2017-11-18 19:15:05 +0100 | [diff] [blame] | 1514 | f_init(ep); |
Harald Welte | 5b4c44e | 2017-09-17 16:35:27 +0800 | [diff] [blame] | 1515 | |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 1516 | cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id); |
Harald Welte | 9988d28 | 2017-11-18 19:22:00 +0100 | [diff] [blame] | 1517 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); |
Harald Welte | 5b4c44e | 2017-09-17 16:35:27 +0800 | [diff] [blame] | 1518 | |
Harald Welte | ba62c8c | 2017-11-18 18:26:49 +0100 | [diff] [blame] | 1519 | f_dlcx_ok(ep, call_id); |
Harald Welte | 5b4c44e | 2017-09-17 16:35:27 +0800 | [diff] [blame] | 1520 | |
| 1521 | setverdict(pass); |
| 1522 | } |
| 1523 | |
Harald Welte | 79181ff | 2017-11-18 19:26:11 +0100 | [diff] [blame] | 1524 | /* Test (valid) CRCX followed by (valid) DLCX containing EP */ |
| 1525 | testcase TC_crcx_and_dlcx_ep() runs on dummy_CT { |
| 1526 | var template MgcpCommand cmd; |
| 1527 | var MgcpResponse resp; |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 1528 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "5@" & c_mgw_domain; |
Harald Welte | 6d167f8 | 2017-11-18 19:41:35 +0100 | [diff] [blame] | 1529 | var MgcpCallId call_id := '51232'H; |
Harald Welte | 79181ff | 2017-11-18 19:26:11 +0100 | [diff] [blame] | 1530 | |
| 1531 | f_init(ep); |
| 1532 | |
| 1533 | cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id); |
| 1534 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); |
| 1535 | |
| 1536 | f_dlcx_ok(ep); |
| 1537 | |
| 1538 | setverdict(pass); |
| 1539 | } |
| 1540 | |
| 1541 | |
Harald Welte | 6d167f8 | 2017-11-18 19:41:35 +0100 | [diff] [blame] | 1542 | /* CRCX + DLCX of valid endpoint but invalid call-id */ |
| 1543 | testcase TC_crcx_and_dlcx_ep_callid_inval() runs on dummy_CT { |
| 1544 | var template MgcpCommand cmd; |
| 1545 | var MgcpResponse resp; |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 1546 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "5@" & c_mgw_domain; |
Harald Welte | 6d167f8 | 2017-11-18 19:41:35 +0100 | [diff] [blame] | 1547 | var MgcpCallId call_id := '51231'H; |
| 1548 | |
| 1549 | f_init(ep); |
| 1550 | |
| 1551 | cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id); |
| 1552 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); |
| 1553 | |
| 1554 | f_dlcx(ep, "516", *, 'ffff'H); |
| 1555 | |
| 1556 | setverdict(pass); |
| 1557 | } |
| 1558 | |
| 1559 | |
| 1560 | /* CRCX + DLCX of valid endpoint and call-id but invalid conn-id */ |
| 1561 | testcase TC_crcx_and_dlcx_ep_callid_connid_inval() runs on dummy_CT { |
| 1562 | var template MgcpCommand cmd; |
| 1563 | var MgcpResponse resp; |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 1564 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "5@" & c_mgw_domain; |
Harald Welte | 6d167f8 | 2017-11-18 19:41:35 +0100 | [diff] [blame] | 1565 | var MgcpCallId call_id := '51230'H; |
| 1566 | |
| 1567 | f_init(ep); |
| 1568 | |
| 1569 | cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id); |
| 1570 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); |
| 1571 | |
| 1572 | f_dlcx(ep, "515", *, call_id, 'ffff'H); |
| 1573 | |
| 1574 | setverdict(pass); |
| 1575 | } |
| 1576 | |
| 1577 | |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 1578 | /* TODO: Double-DLCX (retransmission) */ |
Harald Welte | f53f164 | 2017-11-18 19:57:11 +0100 | [diff] [blame] | 1579 | testcase TC_crcx_and_dlcx_retrans() runs on dummy_CT { |
| 1580 | var template MgcpCommand cmd; |
| 1581 | var MgcpResponse resp; |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 1582 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "5@" & c_mgw_domain; |
Harald Welte | f53f164 | 2017-11-18 19:57:11 +0100 | [diff] [blame] | 1583 | var MgcpCallId call_id := '51229'H; |
| 1584 | var template MgcpResponse rtmpl := { |
| 1585 | line := { |
| 1586 | code := "200", |
| 1587 | string := "OK" |
| 1588 | }, |
| 1589 | params:= { }, |
| 1590 | sdp := omit |
| 1591 | }; |
| 1592 | |
| 1593 | f_init(ep); |
| 1594 | |
| 1595 | cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id); |
| 1596 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); |
| 1597 | |
| 1598 | cmd := ts_DLCX(get_next_trans_id(), ep, call_id); |
| 1599 | resp := mgcp_transceive_mgw(cmd, rtmpl); |
| 1600 | resp := mgcp_transceive_mgw(cmd, rtmpl); |
| 1601 | |
| 1602 | setverdict(pass); |
| 1603 | } |
| 1604 | |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 1605 | template (value) RtpFlowData t_RtpFlow(charstring host_a, charstring host_b, uint7_t pt, |
| 1606 | charstring codec) := { |
| 1607 | em := { |
| 1608 | hostname := host_a, |
| 1609 | portnr := omit |
| 1610 | }, |
| 1611 | mgw := { |
| 1612 | hostname := host_b, |
| 1613 | portnr := omit |
| 1614 | }, |
| 1615 | pt := pt, |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 1616 | codec := codec, |
| 1617 | osmux_cid_sent := false |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 1618 | } |
Harald Welte | f53f164 | 2017-11-18 19:57:11 +0100 | [diff] [blame] | 1619 | |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 1620 | /* transmit RTP streams between two RTP Emulations back-to-back; expect no loss */ |
| 1621 | testcase TC_rtpem_selftest() runs on dummy_CT { |
| 1622 | var RtpemStats stats[2]; |
| 1623 | var integer local_port := 10000; |
| 1624 | var integer local_port2 := 20000; |
| 1625 | |
| 1626 | f_init(); |
| 1627 | |
| 1628 | f_rtpem_bind(RTPEM[0], "127.0.0.1", local_port); |
| 1629 | f_rtpem_bind(RTPEM[1], "127.0.0.2", local_port2); |
| 1630 | |
| 1631 | f_rtpem_connect(RTPEM[0], "127.0.0.2", local_port2); |
| 1632 | f_rtpem_connect(RTPEM[1], "127.0.0.1", local_port); |
| 1633 | |
| 1634 | log("=== starting"); |
| 1635 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_BIDIR); |
| 1636 | f_rtpem_mode(RTPEM[1], RTPEM_MODE_BIDIR); |
| 1637 | |
| 1638 | f_sleep(5.0); |
| 1639 | |
| 1640 | log("=== stopping"); |
| 1641 | f_rtpem_mode(RTPEM[1], RTPEM_MODE_RXONLY); |
| 1642 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_RXONLY); |
| 1643 | f_sleep(0.5); |
| 1644 | f_rtpem_mode(RTPEM[1], RTPEM_MODE_NONE); |
| 1645 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_NONE); |
| 1646 | |
| 1647 | stats[0] := f_rtpem_stats_get(RTPEM[0]); |
| 1648 | stats[1] := f_rtpem_stats_get(RTPEM[1]); |
| 1649 | if (not f_rtpem_stats_compare(stats[0], stats[1])) { |
| 1650 | setverdict(fail, "RTP endpoint statistics don't match"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1651 | mtc.stop; |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 1652 | } |
| 1653 | setverdict(pass); |
| 1654 | } |
| 1655 | |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1656 | /* Create one half open connection in receive-only mode. The MGW must accept |
| 1657 | * the packets but must not send any. */ |
| 1658 | testcase TC_one_crcx_receive_only_rtp() runs on dummy_CT { |
| 1659 | var RtpFlowData flow; |
| 1660 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "1@" & c_mgw_domain; |
| 1661 | var MgcpCallId call_id := '1225'H; |
| 1662 | var RtpemStats stats; |
| 1663 | |
| 1664 | f_init(ep); |
Pau Espin Pedrol | b604af0 | 2020-09-07 17:12:39 +0200 | [diff] [blame] | 1665 | flow := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 112, "AMR/8000/1")); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1666 | flow.em.portnr := 10000; |
Pau Espin Pedrol | 25f47a7 | 2020-09-08 18:10:54 +0200 | [diff] [blame] | 1667 | f_flow_create(RTPEM[0], ep, call_id, "recvonly", flow, true); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1668 | |
| 1669 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_TXONLY); |
| 1670 | f_sleep(1.0); |
| 1671 | f_flow_delete(RTPEM[0], ep, call_id); |
| 1672 | |
| 1673 | stats := f_rtpem_stats_get(RTPEM[0]); |
| 1674 | |
Philipp Maier | 42b17cc | 2019-10-01 13:53:17 +0200 | [diff] [blame] | 1675 | /* Make sure that at least some amount of RTP packets/bytes |
| 1676 | * have has been transmitted. The compare values for |
| 1677 | * stats.num_pkts_tx and stats.bytes_payload_tx are determined |
| 1678 | * using a testrun and the results were devided by 2, so even |
| 1679 | * in load situations we should reach the minimum amount of |
| 1680 | * required packets/bytes */ |
| 1681 | |
| 1682 | if (stats.num_pkts_tx < 24) { |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1683 | setverdict(fail); |
| 1684 | } |
Philipp Maier | 42b17cc | 2019-10-01 13:53:17 +0200 | [diff] [blame] | 1685 | if (stats.bytes_payload_tx < 96) { |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1686 | setverdict(fail); |
| 1687 | } |
Philipp Maier | 3629139 | 2018-07-25 09:40:44 +0200 | [diff] [blame] | 1688 | |
| 1689 | f_rtpem_stats_err_check(stats); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1690 | |
| 1691 | setverdict(pass); |
| 1692 | } |
| 1693 | |
| 1694 | /* Create one connection in loopback mode, test if the RTP packets are |
| 1695 | * actually reflected */ |
Philipp Maier | 1ac1398 | 2021-05-07 23:06:07 +0200 | [diff] [blame] | 1696 | function f_TC_one_crcx_loopback_rtp(boolean one_phase := true) runs on dummy_CT { |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1697 | var RtpFlowData flow; |
| 1698 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "1@" & c_mgw_domain; |
| 1699 | var MgcpCallId call_id := '1225'H; |
| 1700 | var RtpemStats stats; |
| 1701 | |
| 1702 | f_init(ep); |
Pau Espin Pedrol | b604af0 | 2020-09-07 17:12:39 +0200 | [diff] [blame] | 1703 | flow := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 111, "GSM-HR-08/8000/1")); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1704 | flow.em.portnr := 10000; |
Philipp Maier | 1ac1398 | 2021-05-07 23:06:07 +0200 | [diff] [blame] | 1705 | f_flow_create(RTPEM[0], ep, call_id, "loopback", flow, one_phase := one_phase); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1706 | |
| 1707 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_BIDIR); |
| 1708 | f_sleep(1.0); |
| 1709 | f_flow_delete(RTPEM[0], ep, call_id); |
| 1710 | |
| 1711 | stats := f_rtpem_stats_get(RTPEM[0]); |
| 1712 | |
| 1713 | if (stats.num_pkts_tx != stats.num_pkts_rx) { |
| 1714 | setverdict(fail); |
| 1715 | } |
| 1716 | if (stats.bytes_payload_tx != stats.bytes_payload_rx) { |
| 1717 | setverdict(fail); |
| 1718 | } |
Philipp Maier | 3629139 | 2018-07-25 09:40:44 +0200 | [diff] [blame] | 1719 | |
| 1720 | f_rtpem_stats_err_check(stats); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1721 | |
| 1722 | setverdict(pass); |
| 1723 | } |
| 1724 | |
Philipp Maier | 1ac1398 | 2021-05-07 23:06:07 +0200 | [diff] [blame] | 1725 | /* Create one connection in loopback mode, test if the RTP packets are |
| 1726 | * actually reflected */ |
| 1727 | testcase TC_one_crcx_loopback_rtp() runs on dummy_CT { |
| 1728 | f_TC_one_crcx_loopback_rtp(one_phase := true) |
| 1729 | } |
| 1730 | |
| 1731 | /* Same as above, but we will intenionally not tell the MGW where to |
| 1732 | * send the outgoing traffic. The connection is still created in |
| 1733 | * loopback mode, so the MGW should take the originating address from |
| 1734 | * the incoming RTP packet and send it back to the source */ |
| 1735 | testcase TC_one_crcx_loopback_rtp_implicit() runs on dummy_CT { |
| 1736 | f_TC_one_crcx_loopback_rtp(one_phase := false) |
| 1737 | } |
| 1738 | |
| 1739 | |
Philipp Maier | 7df85f6 | 2018-07-25 10:26:09 +0200 | [diff] [blame] | 1740 | function f_TC_two_crcx_and_rtp(boolean bidir, charstring codec_name_a, integer pt_a, |
| 1741 | charstring codec_name_b, integer pt_b) runs on dummy_CT { |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 1742 | var RtpFlowData flow[2]; |
| 1743 | var RtpemStats stats[2]; |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 1744 | var MgcpResponse resp; |
| 1745 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain; |
| 1746 | var MgcpCallId call_id := '1226'H; |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1747 | var integer tolerance := 0; |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 1748 | |
| 1749 | f_init(ep); |
| 1750 | |
| 1751 | /* from us to MGW */ |
Pau Espin Pedrol | b604af0 | 2020-09-07 17:12:39 +0200 | [diff] [blame] | 1752 | flow[0] := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, pt_a, codec_name_a)); |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 1753 | /* bind local RTP emulation sockets */ |
| 1754 | flow[0].em.portnr := 10000; |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1755 | f_flow_create(RTPEM[0], ep, call_id, "sendrecv", flow[0]); |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 1756 | |
| 1757 | /* from MGW back to us */ |
Pau Espin Pedrol | b604af0 | 2020-09-07 17:12:39 +0200 | [diff] [blame] | 1758 | flow[1] := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, pt_b, codec_name_b)); |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 1759 | flow[1].em.portnr := 20000; |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1760 | f_flow_create(RTPEM[1], ep, call_id, "sendrecv", flow[1]); |
| 1761 | |
| 1762 | if (bidir) { |
| 1763 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_BIDIR); |
| 1764 | f_rtpem_mode(RTPEM[1], RTPEM_MODE_BIDIR); |
| 1765 | |
| 1766 | /* Note: When we test bidirectional we may |
| 1767 | * loose packets during switch off because |
| 1768 | * both ends are transmitting and we only |
| 1769 | * can switch them off one by one. */ |
| 1770 | tolerance := 3; |
| 1771 | } else { |
| 1772 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_RXONLY); |
| 1773 | f_rtpem_mode(RTPEM[1], RTPEM_MODE_TXONLY); |
| 1774 | } |
| 1775 | |
| 1776 | f_sleep(1.0); |
| 1777 | |
| 1778 | f_flow_delete(RTPEM[1]); |
| 1779 | f_flow_delete(RTPEM[0], ep, call_id); |
| 1780 | |
| 1781 | stats[0] := f_rtpem_stats_get(RTPEM[0]); |
| 1782 | stats[1] := f_rtpem_stats_get(RTPEM[1]); |
| 1783 | if (not f_rtpem_stats_compare(stats[0], stats[1], tolerance)) { |
| 1784 | setverdict(fail, "RTP endpoint statistics don't match"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1785 | mtc.stop; |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1786 | } |
| 1787 | |
Philipp Maier | 3629139 | 2018-07-25 09:40:44 +0200 | [diff] [blame] | 1788 | f_rtpem_stats_err_check(stats[0]); |
| 1789 | f_rtpem_stats_err_check(stats[1]); |
Philipp Maier | c290d72 | 2018-07-24 18:51:36 +0200 | [diff] [blame] | 1790 | |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1791 | setverdict(pass); |
| 1792 | } |
| 1793 | |
| 1794 | /* create two local RTP emulations; create two connections on MGW EP, exchange some data */ |
| 1795 | testcase TC_two_crcx_and_rtp() runs on dummy_CT { |
Philipp Maier | 7df85f6 | 2018-07-25 10:26:09 +0200 | [diff] [blame] | 1796 | f_TC_two_crcx_and_rtp(false, "AMR/8000", 98, "AMR/8000", 98); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1797 | } |
| 1798 | |
| 1799 | /* create two local RTP emulations; create two connections on MGW EP, |
| 1800 | * exchange some data in both directions */ |
| 1801 | testcase TC_two_crcx_and_rtp_bidir() runs on dummy_CT { |
Philipp Maier | 7df85f6 | 2018-07-25 10:26:09 +0200 | [diff] [blame] | 1802 | f_TC_two_crcx_and_rtp(true, "AMR/8000", 98, "AMR/8000", 98); |
| 1803 | } |
| 1804 | |
| 1805 | /* same as TC_two_crcx_and_rtp, but with different PT number on both ends */ |
| 1806 | testcase TC_two_crcx_diff_pt_and_rtp() runs on dummy_CT { |
| 1807 | f_TC_two_crcx_and_rtp(false, "AMR/8000", 98, "AMR/8000", 112); |
| 1808 | } |
| 1809 | |
| 1810 | /* same as TC_two_crcx_and_rtp, but with different PT number on both ends */ |
| 1811 | testcase TC_two_crcx_diff_pt_and_rtp_bidir() runs on dummy_CT { |
| 1812 | f_TC_two_crcx_and_rtp(true, "AMR/8000", 98, "AMR/8000", 112); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1813 | } |
| 1814 | |
| 1815 | /* create two local RTP emulations and pass data in both directions */ |
Pau Espin Pedrol | 9e0141a | 2020-09-07 17:25:56 +0200 | [diff] [blame] | 1816 | function f_tc_two_crcx_mdcx_and_rtp(charstring local_ip_a, charstring remote_ip_a, |
| 1817 | charstring local_ip_b, charstring remote_ip_b) runs on dummy_CT { |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1818 | var RtpFlowData flow[2]; |
| 1819 | var RtpemStats stats[2]; |
| 1820 | var MgcpResponse resp; |
| 1821 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain; |
| 1822 | var MgcpCallId call_id := '1227'H; |
| 1823 | var integer num_pkts_tx[2]; |
| 1824 | var integer temp; |
| 1825 | |
| 1826 | f_init(ep); |
| 1827 | |
| 1828 | /* Create the first connection in receive only mode */ |
Pau Espin Pedrol | 9e0141a | 2020-09-07 17:25:56 +0200 | [diff] [blame] | 1829 | flow[0] := valueof(t_RtpFlow(local_ip_a, remote_ip_a, 3, "GSM/8000/1")); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1830 | flow[0].em.portnr := 10000; |
Pau Espin Pedrol | 9e0141a | 2020-09-07 17:25:56 +0200 | [diff] [blame] | 1831 | f_flow_create(RTPEM[0], ep, call_id, "recvonly", flow[0], true); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1832 | |
| 1833 | /* Create the second connection. This connection will be also |
| 1834 | * in receive only mode */ |
Pau Espin Pedrol | 9e0141a | 2020-09-07 17:25:56 +0200 | [diff] [blame] | 1835 | flow[1] := valueof(t_RtpFlow(local_ip_b, remote_ip_b, 3, "GSM/8000/1")); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1836 | flow[1].em.portnr := 20000; |
Pau Espin Pedrol | 9e0141a | 2020-09-07 17:25:56 +0200 | [diff] [blame] | 1837 | f_flow_create(RTPEM[1], ep, call_id, "recvonly", flow[1], true); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1838 | |
| 1839 | /* The first leg starts transmitting */ |
| 1840 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_TXONLY); |
| 1841 | f_sleep(0.5); |
| 1842 | stats[0] := f_rtpem_stats_get(RTPEM[0]); |
| 1843 | if (stats[0].num_pkts_rx_err_disabled != 0) { |
Pau Espin Pedrol | 89c76d2 | 2020-09-07 18:42:04 +0200 | [diff] [blame] | 1844 | setverdict(fail, "received packets from MGW on recvonly connection 0"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1845 | mtc.stop; |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1846 | } |
| 1847 | stats[1] := f_rtpem_stats_get(RTPEM[1]); |
| 1848 | if (stats[1].num_pkts_rx_err_disabled != 0) { |
Pau Espin Pedrol | 89c76d2 | 2020-09-07 18:42:04 +0200 | [diff] [blame] | 1849 | setverdict(fail, "received packets from MGW on recvonly connection 1"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1850 | mtc.stop; |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1851 | } |
| 1852 | |
| 1853 | /* The second leg starts transmitting a little later */ |
| 1854 | f_rtpem_mode(RTPEM[1], RTPEM_MODE_TXONLY); |
| 1855 | f_sleep(1.0); |
| 1856 | stats[0] := f_rtpem_stats_get(RTPEM[0]); |
| 1857 | if (stats[0].num_pkts_rx_err_disabled != 0) { |
Pau Espin Pedrol | 89c76d2 | 2020-09-07 18:42:04 +0200 | [diff] [blame] | 1858 | setverdict(fail, "received packets from MGW on recvonly connection 0"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1859 | mtc.stop; |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1860 | } |
| 1861 | stats[1] := f_rtpem_stats_get(RTPEM[1]); |
| 1862 | if (stats[1].num_pkts_rx_err_disabled != 0) { |
Pau Espin Pedrol | 89c76d2 | 2020-09-07 18:42:04 +0200 | [diff] [blame] | 1863 | setverdict(fail, "received packets from MGW on recvonly connection 1"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1864 | mtc.stop; |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1865 | } |
| 1866 | |
| 1867 | /* The first leg will now be switched into bidirectional |
| 1868 | * mode, but we do not expect any data comming back yet. */ |
Pau Espin Pedrol | 89c76d2 | 2020-09-07 18:42:04 +0200 | [diff] [blame] | 1869 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_BIDIR); |
| 1870 | stats[1] := f_rtpem_stats_get(RTPEM[1]); |
| 1871 | num_pkts_tx[1] := stats[1].num_pkts_tx; |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1872 | f_flow_modify(RTPEM[0], ep, call_id, "sendrecv", flow[0]); |
| 1873 | f_sleep(0.5); |
| 1874 | stats[0] := f_rtpem_stats_get(RTPEM[0]); |
Pau Espin Pedrol | 89c76d2 | 2020-09-07 18:42:04 +0200 | [diff] [blame] | 1875 | if (stats[0].num_pkts_rx_err_disabled != 0) { |
| 1876 | setverdict(fail, "received packets from MGW on recvonly connection 0"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1877 | mtc.stop; |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1878 | } |
| 1879 | stats[1] := f_rtpem_stats_get(RTPEM[1]); |
| 1880 | if (stats[1].num_pkts_rx_err_disabled != 0) { |
Pau Espin Pedrol | 89c76d2 | 2020-09-07 18:42:04 +0200 | [diff] [blame] | 1881 | setverdict(fail, "received packets from MGW on recvonly connection 1"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1882 | mtc.stop; |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1883 | } |
| 1884 | |
| 1885 | /* When the second leg is switched into bidirectional mode |
| 1886 | * as well, then the MGW will connect the two together and |
| 1887 | * we should see RTP streams passing through from both ends. */ |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1888 | f_rtpem_mode(RTPEM[1], RTPEM_MODE_BIDIR); |
| 1889 | stats[0] := f_rtpem_stats_get(RTPEM[0]); |
Pau Espin Pedrol | 89c76d2 | 2020-09-07 18:42:04 +0200 | [diff] [blame] | 1890 | num_pkts_tx[0] := stats[0].num_pkts_tx; |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1891 | f_flow_modify(RTPEM[1], ep, call_id, "sendrecv", flow[1]); |
| 1892 | f_sleep(2.0); |
| 1893 | |
| 1894 | stats[0] := f_rtpem_stats_get(RTPEM[0]); |
| 1895 | stats[1] := f_rtpem_stats_get(RTPEM[1]); |
| 1896 | |
| 1897 | temp := stats[0].num_pkts_tx - num_pkts_tx[0] - stats[1].num_pkts_rx; |
| 1898 | if (temp > 3 or temp < -3) { |
Pau Espin Pedrol | 89c76d2 | 2020-09-07 18:42:04 +0200 | [diff] [blame] | 1899 | setverdict(fail, "number of packets not within normal parameters:", temp); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1900 | mtc.stop; |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1901 | } |
| 1902 | |
| 1903 | temp := stats[1].num_pkts_tx - num_pkts_tx[1] - stats[0].num_pkts_rx; |
| 1904 | if (temp > 3 or temp < -3) { |
Pau Espin Pedrol | 89c76d2 | 2020-09-07 18:42:04 +0200 | [diff] [blame] | 1905 | setverdict(fail, "number of packets not within normal parameters:", temp); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1906 | mtc.stop; |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1907 | } |
Philipp Maier | 3629139 | 2018-07-25 09:40:44 +0200 | [diff] [blame] | 1908 | |
| 1909 | f_rtpem_stats_err_check(stats[0]); |
| 1910 | f_rtpem_stats_err_check(stats[1]); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1911 | |
| 1912 | /* Tear down */ |
| 1913 | f_flow_delete(RTPEM[0]); |
| 1914 | f_flow_delete(RTPEM[1], ep, call_id); |
| 1915 | setverdict(pass); |
| 1916 | } |
| 1917 | |
Pau Espin Pedrol | 9e0141a | 2020-09-07 17:25:56 +0200 | [diff] [blame] | 1918 | testcase TC_two_crcx_mdcx_and_rtp() runs on dummy_CT { |
| 1919 | f_tc_two_crcx_mdcx_and_rtp(mp_local_ipv4, mp_remote_ipv4, |
| 1920 | mp_local_ipv4, mp_remote_ipv4); |
| 1921 | } |
| 1922 | |
| 1923 | testcase TC_two_crcx_mdcx_and_rtp_ipv6() runs on dummy_CT { |
| 1924 | f_tc_two_crcx_mdcx_and_rtp(mp_local_ipv6, mp_remote_ipv6, |
| 1925 | mp_local_ipv6, mp_remote_ipv6); |
| 1926 | } |
| 1927 | |
| 1928 | testcase TC_two_crcx_mdcx_and_rtp_ipv4_ipv6() runs on dummy_CT { |
| 1929 | f_tc_two_crcx_mdcx_and_rtp(mp_local_ipv4, mp_remote_ipv4, |
| 1930 | mp_local_ipv6, mp_remote_ipv6); |
| 1931 | } |
| 1932 | |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1933 | /* Test what happens when two RTP streams from different sources target |
| 1934 | * a single connection. Is the unsolicited stream properly ignored? */ |
| 1935 | testcase TC_two_crcx_and_unsolicited_rtp() runs on dummy_CT { |
| 1936 | var RtpFlowData flow[2]; |
| 1937 | var RtpemStats stats[2]; |
| 1938 | var MgcpResponse resp; |
| 1939 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain; |
| 1940 | var MgcpCallId call_id := '1234321326'H; |
| 1941 | var integer unsolicited_port := 10002; |
| 1942 | |
| 1943 | f_init(ep); |
| 1944 | |
| 1945 | /* from us to MGW */ |
Pau Espin Pedrol | b604af0 | 2020-09-07 17:12:39 +0200 | [diff] [blame] | 1946 | flow[0] := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 98, "AMR/8000")); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1947 | /* bind local RTP emulation sockets */ |
| 1948 | flow[0].em.portnr := 10000; |
| 1949 | f_flow_create(RTPEM[0], ep, call_id, "sendrecv", flow[0]); |
| 1950 | |
| 1951 | /* from MGW back to us */ |
Pau Espin Pedrol | b604af0 | 2020-09-07 17:12:39 +0200 | [diff] [blame] | 1952 | flow[1] := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 98, "AMR/8000")); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1953 | flow[1].em.portnr := 20000; |
| 1954 | f_flow_create(RTPEM[1], ep, call_id, "sendrecv", flow[1]); |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 1955 | |
| 1956 | f_rtpem_mode(RTPEM[1], RTPEM_MODE_RXONLY); |
| 1957 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_TXONLY); |
| 1958 | |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1959 | f_sleep(0.5); |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 1960 | |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1961 | /* Start inserting unsolicited RTP packets */ |
Pau Espin Pedrol | b604af0 | 2020-09-07 17:12:39 +0200 | [diff] [blame] | 1962 | f_rtpem_bind(RTPEM[2], mp_local_ipv4, unsolicited_port); |
| 1963 | f_rtpem_connect(RTPEM[2], mp_remote_ipv4, flow[0].mgw.portnr); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1964 | f_rtpem_mode(RTPEM[2], RTPEM_MODE_TXONLY); |
| 1965 | |
| 1966 | f_sleep(0.5); |
| 1967 | |
Daniel Willmann | a069d38 | 2018-12-13 13:53:33 +0100 | [diff] [blame] | 1968 | /* Stop transmitting packets and tear down the flows */ |
| 1969 | f_rtpem_mode(RTPEM[2], RTPEM_MODE_NONE); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1970 | f_flow_delete(RTPEM[0]); |
| 1971 | f_flow_delete(RTPEM[1], ep, call_id); |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 1972 | |
| 1973 | stats[0] := f_rtpem_stats_get(RTPEM[0]); |
| 1974 | stats[1] := f_rtpem_stats_get(RTPEM[1]); |
| 1975 | if (not f_rtpem_stats_compare(stats[0], stats[1])) { |
| 1976 | setverdict(fail, "RTP endpoint statistics don't match"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1977 | mtc.stop; |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 1978 | } |
| 1979 | |
Philipp Maier | 3629139 | 2018-07-25 09:40:44 +0200 | [diff] [blame] | 1980 | f_rtpem_stats_err_check(stats[0]); |
| 1981 | f_rtpem_stats_err_check(stats[0]); |
Philipp Maier | c290d72 | 2018-07-24 18:51:36 +0200 | [diff] [blame] | 1982 | |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 1983 | setverdict(pass); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1984 | } |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 1985 | |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 1986 | /* Test a handover situation. We first create two connections transmit |
| 1987 | * some data bidirectionally. Then we will simulate a handover situation. */ |
| 1988 | testcase TC_two_crcx_and_one_mdcx_rtp_ho() runs on dummy_CT { |
| 1989 | var RtpFlowData flow[2]; |
| 1990 | var RtpemStats stats[3]; |
| 1991 | var MgcpResponse resp; |
| 1992 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "4@" & c_mgw_domain; |
| 1993 | var MgcpCallId call_id := '76338'H; |
| 1994 | var integer port_old; |
| 1995 | |
| 1996 | f_init(ep); |
| 1997 | |
| 1998 | /* First connection (BTS) */ |
Pau Espin Pedrol | b604af0 | 2020-09-07 17:12:39 +0200 | [diff] [blame] | 1999 | flow[0] := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 110, "GSM-EFR/8000")); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 2000 | /* bind local RTP emulation sockets */ |
| 2001 | flow[0].em.portnr := 10000; |
| 2002 | f_flow_create(RTPEM[0], ep, call_id, "sendrecv", flow[0]); |
| 2003 | |
| 2004 | /* Second connection (PBX) */ |
Pau Espin Pedrol | b604af0 | 2020-09-07 17:12:39 +0200 | [diff] [blame] | 2005 | flow[1] := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 110, "GSM-EFR/8000")); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 2006 | flow[1].em.portnr := 20000; |
| 2007 | f_flow_create(RTPEM[1], ep, call_id, "sendrecv", flow[1]); |
| 2008 | |
| 2009 | /* Normal rtp flow for one second */ |
| 2010 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_BIDIR); |
| 2011 | f_rtpem_mode(RTPEM[1], RTPEM_MODE_BIDIR); |
| 2012 | f_sleep(1.0); |
| 2013 | |
| 2014 | /* Now switch the flow over to a new port (BTS) */ |
| 2015 | port_old := flow[0].em.portnr; |
| 2016 | flow[0].em.portnr := 10002; |
Daniel Willmann | 43a1a0b | 2018-08-01 11:19:39 +0200 | [diff] [blame] | 2017 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_RXONLY); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 2018 | f_flow_modify(RTPEM[0], ep, call_id, "sendrecv", flow[0]); |
Daniel Willmann | 43a1a0b | 2018-08-01 11:19:39 +0200 | [diff] [blame] | 2019 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_BIDIR); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 2020 | |
| 2021 | /* When handing over a call, the old source may still keep |
| 2022 | * transmitting for a while. We simulate this by injecting |
| 2023 | * some unsolicited packets on the behalf of the old source, |
| 2024 | * (old remote port) */ |
Pau Espin Pedrol | b604af0 | 2020-09-07 17:12:39 +0200 | [diff] [blame] | 2025 | f_rtpem_bind(RTPEM[2], mp_local_ipv4, port_old); |
| 2026 | f_rtpem_connect(RTPEM[2], mp_remote_ipv4, flow[0].mgw.portnr); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 2027 | f_rtpem_mode(RTPEM[2], RTPEM_MODE_TXONLY); |
| 2028 | f_sleep(1.0); |
| 2029 | f_rtpem_mode(RTPEM[2], RTPEM_MODE_NONE); |
| 2030 | f_sleep(1.0); |
| 2031 | |
| 2032 | /* Terminate call */ |
| 2033 | f_flow_delete(RTPEM[0]); |
| 2034 | f_flow_delete(RTPEM[1], ep, call_id); |
| 2035 | |
| 2036 | stats[0] := f_rtpem_stats_get(RTPEM[0]); |
| 2037 | stats[1] := f_rtpem_stats_get(RTPEM[1]); |
| 2038 | if (not f_rtpem_stats_compare(stats[0], stats[1], 5)) { |
| 2039 | setverdict(fail, "RTP endpoint statistics don't match"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2040 | mtc.stop; |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 2041 | } |
| 2042 | stats[2] := f_rtpem_stats_get(RTPEM[2]); |
| 2043 | if (stats[2].num_pkts_rx_err_disabled != 0) { |
| 2044 | setverdict(fail, "received packets on old leg after handover"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2045 | mtc.stop; |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 2046 | } |
| 2047 | |
Philipp Maier | 3629139 | 2018-07-25 09:40:44 +0200 | [diff] [blame] | 2048 | f_rtpem_stats_err_check(stats[0]); |
| 2049 | f_rtpem_stats_err_check(stats[1]); |
| 2050 | f_rtpem_stats_err_check(stats[2]); |
Philipp Maier | c290d72 | 2018-07-24 18:51:36 +0200 | [diff] [blame] | 2051 | |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 2052 | setverdict(pass); |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 2053 | } |
Harald Welte | f53f164 | 2017-11-18 19:57:11 +0100 | [diff] [blame] | 2054 | |
Philipp Maier | 6d4e094 | 2019-02-21 17:35:01 +0100 | [diff] [blame] | 2055 | |
| 2056 | /* create two local RTP emulations; create two connections on MGW EP, see if |
| 2057 | * exchanged data is converted bwtween ts101318 and rfc5993 */ |
| 2058 | testcase TC_ts101318_rfc5993_rtp_conversion() runs on dummy_CT { |
| 2059 | var RtpFlowData flow[2]; |
| 2060 | var RtpemStats stats[2]; |
| 2061 | var MgcpResponse resp; |
| 2062 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain; |
| 2063 | var MgcpCallId call_id := '1226'H; |
| 2064 | |
| 2065 | f_init(ep); |
| 2066 | |
| 2067 | /* Turn on conversion mode */ |
| 2068 | f_vty_enter_config(MGWVTY); |
| 2069 | f_vty_transceive(MGWVTY, "mgcp"); |
| 2070 | f_vty_transceive(MGWVTY, "rtp-patch rfc5993hr"); |
| 2071 | |
Philipp Maier | faa1d2f | 2019-10-01 14:07:35 +0200 | [diff] [blame] | 2072 | /* Connection #0 (Bidirectional) */ |
Pau Espin Pedrol | b604af0 | 2020-09-07 17:12:39 +0200 | [diff] [blame] | 2073 | flow[0] := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 111, "GSM-HR-08/8000")); |
Philipp Maier | 6d4e094 | 2019-02-21 17:35:01 +0100 | [diff] [blame] | 2074 | /* bind local RTP emulation sockets */ |
| 2075 | flow[0].em.portnr := 10000; |
| 2076 | flow[0].rtp_cfg := c_RtpemDefaultCfg; |
| 2077 | flow[0].rtp_cfg.tx_payload_type := flow[0].pt; |
| 2078 | flow[0].rtp_cfg.rx_fixed_payload := '0b11b3eede60be4e3ec68838c7b5'O; |
| 2079 | flow[0].rtp_cfg.tx_fixed_payload := '0b11b3eede60be4e3ec68838c7b5'O; |
| 2080 | f_flow_create(RTPEM[0], ep, call_id, "sendrecv", flow[0]); |
| 2081 | |
Philipp Maier | faa1d2f | 2019-10-01 14:07:35 +0200 | [diff] [blame] | 2082 | /* Connection #1 (Bidirectional) */ |
Pau Espin Pedrol | b604af0 | 2020-09-07 17:12:39 +0200 | [diff] [blame] | 2083 | flow[1] := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 111, "GSM-HR-08/8000")); |
Philipp Maier | 6d4e094 | 2019-02-21 17:35:01 +0100 | [diff] [blame] | 2084 | flow[1].em.portnr := 20000; |
| 2085 | flow[1].rtp_cfg := c_RtpemDefaultCfg; |
| 2086 | flow[1].rtp_cfg.tx_payload_type := flow[1].pt; |
| 2087 | flow[1].rtp_cfg.rx_fixed_payload := '000b11b3eede60be4e3ec68838c7b5'O; |
| 2088 | flow[1].rtp_cfg.tx_fixed_payload := '000b11b3eede60be4e3ec68838c7b5'O; |
| 2089 | f_flow_create(RTPEM[1], ep, call_id, "sendrecv", flow[1]); |
| 2090 | |
Philipp Maier | faa1d2f | 2019-10-01 14:07:35 +0200 | [diff] [blame] | 2091 | /* Send RTP packets to connection #0, receive on connection #1 */ |
| 2092 | f_rtpem_mode(RTPEM[1], RTPEM_MODE_RXONLY); |
| 2093 | f_sleep(0.5); |
| 2094 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_TXONLY); |
Philipp Maier | 6d4e094 | 2019-02-21 17:35:01 +0100 | [diff] [blame] | 2095 | f_sleep(1.0); |
Philipp Maier | faa1d2f | 2019-10-01 14:07:35 +0200 | [diff] [blame] | 2096 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_NONE); |
| 2097 | f_sleep(0.5); |
| 2098 | f_rtpem_mode(RTPEM[1], RTPEM_MODE_NONE); |
Philipp Maier | 6d4e094 | 2019-02-21 17:35:01 +0100 | [diff] [blame] | 2099 | |
Philipp Maier | faa1d2f | 2019-10-01 14:07:35 +0200 | [diff] [blame] | 2100 | /* Send RTP packets to connection #1, receive on connection #0 */ |
| 2101 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_RXONLY); |
| 2102 | f_sleep(0.5); |
| 2103 | f_rtpem_mode(RTPEM[1], RTPEM_MODE_TXONLY); |
| 2104 | f_sleep(1.0); |
| 2105 | f_rtpem_mode(RTPEM[1], RTPEM_MODE_NONE); |
| 2106 | f_sleep(0.5); |
| 2107 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_NONE); |
| 2108 | |
| 2109 | /* Remove RTP flows and check statistics */ |
Philipp Maier | 6d4e094 | 2019-02-21 17:35:01 +0100 | [diff] [blame] | 2110 | f_flow_delete(RTPEM[0]); |
| 2111 | f_flow_delete(RTPEM[1], ep, call_id); |
| 2112 | |
Philipp Maier | faa1d2f | 2019-10-01 14:07:35 +0200 | [diff] [blame] | 2113 | /* Check for errors */ |
Philipp Maier | 6d4e094 | 2019-02-21 17:35:01 +0100 | [diff] [blame] | 2114 | stats[0] := f_rtpem_stats_get(RTPEM[0]); |
| 2115 | stats[1] := f_rtpem_stats_get(RTPEM[1]); |
Philipp Maier | 6d4e094 | 2019-02-21 17:35:01 +0100 | [diff] [blame] | 2116 | f_rtpem_stats_err_check(stats[0]); |
| 2117 | f_rtpem_stats_err_check(stats[1]); |
| 2118 | |
| 2119 | /* Turn off conversion mode */ |
| 2120 | f_vty_transceive(MGWVTY, "no rtp-patch rfc5993hr"); |
| 2121 | |
| 2122 | setverdict(pass); |
| 2123 | } |
| 2124 | |
Philipp Maier | 4f764ce | 2019-03-07 10:54:10 +0100 | [diff] [blame] | 2125 | /* create two local RTP emulations; create two connections on MGW EP, see if |
| 2126 | * exchanged data is converted between AMR octet-aligned and bandwith |
| 2127 | * efficient-mode */ |
| 2128 | function f_TC_amr_x_x_rtp_conversion(octetstring pl0, octetstring pl1, charstring fmtp0, charstring fmtp1) runs on dummy_CT { |
| 2129 | var RtpFlowData flow[2]; |
| 2130 | var RtpemStats stats[2]; |
| 2131 | var MgcpResponse resp; |
| 2132 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain; |
| 2133 | var MgcpCallId call_id := '1226'H; |
| 2134 | |
| 2135 | f_init(ep); |
| 2136 | |
Philipp Maier | 9ff0f8a | 2019-10-01 13:21:28 +0200 | [diff] [blame] | 2137 | /* Connection #0 (Bidirectional) */ |
Pau Espin Pedrol | b604af0 | 2020-09-07 17:12:39 +0200 | [diff] [blame] | 2138 | flow[0] := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 112, "AMR/8000")); |
Philipp Maier | 4f764ce | 2019-03-07 10:54:10 +0100 | [diff] [blame] | 2139 | /* bind local RTP emulation sockets */ |
| 2140 | flow[0].em.portnr := 10000; |
| 2141 | flow[0].rtp_cfg := c_RtpemDefaultCfg; |
| 2142 | flow[0].rtp_cfg.tx_payload_type := flow[0].pt; |
| 2143 | flow[0].rtp_cfg.rx_fixed_payload := pl0; |
| 2144 | flow[0].rtp_cfg.tx_fixed_payload := pl0; |
| 2145 | flow[0].fmtp := fmtp0; |
| 2146 | f_flow_create(RTPEM[0], ep, call_id, "sendrecv", flow[0]); |
| 2147 | |
Philipp Maier | 9ff0f8a | 2019-10-01 13:21:28 +0200 | [diff] [blame] | 2148 | /* Connection #1 (Bidirectional) */ |
Pau Espin Pedrol | b604af0 | 2020-09-07 17:12:39 +0200 | [diff] [blame] | 2149 | flow[1] := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 112, "AMR/8000")); |
Philipp Maier | 4f764ce | 2019-03-07 10:54:10 +0100 | [diff] [blame] | 2150 | flow[1].em.portnr := 20000; |
| 2151 | flow[1].rtp_cfg := c_RtpemDefaultCfg; |
| 2152 | flow[1].rtp_cfg.tx_payload_type := flow[1].pt; |
| 2153 | flow[1].rtp_cfg.rx_fixed_payload := pl1; |
| 2154 | flow[1].rtp_cfg.tx_fixed_payload := pl1; |
| 2155 | flow[1].fmtp := fmtp1; |
| 2156 | f_flow_create(RTPEM[1], ep, call_id, "sendrecv", flow[1]); |
| 2157 | |
Philipp Maier | 9ff0f8a | 2019-10-01 13:21:28 +0200 | [diff] [blame] | 2158 | /* Send RTP packets to connection #0, receive on connection #1 */ |
| 2159 | f_rtpem_mode(RTPEM[1], RTPEM_MODE_RXONLY); |
| 2160 | f_sleep(0.5); |
| 2161 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_TXONLY); |
Philipp Maier | 4f764ce | 2019-03-07 10:54:10 +0100 | [diff] [blame] | 2162 | f_sleep(1.0); |
Philipp Maier | 9ff0f8a | 2019-10-01 13:21:28 +0200 | [diff] [blame] | 2163 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_NONE); |
| 2164 | f_sleep(0.5); |
| 2165 | f_rtpem_mode(RTPEM[1], RTPEM_MODE_NONE); |
Philipp Maier | 4f764ce | 2019-03-07 10:54:10 +0100 | [diff] [blame] | 2166 | |
Philipp Maier | 9ff0f8a | 2019-10-01 13:21:28 +0200 | [diff] [blame] | 2167 | /* Send RTP packets to connection #1, receive on connection #0 */ |
| 2168 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_RXONLY); |
| 2169 | f_sleep(0.5); |
| 2170 | f_rtpem_mode(RTPEM[1], RTPEM_MODE_TXONLY); |
| 2171 | f_sleep(1.0); |
| 2172 | f_rtpem_mode(RTPEM[1], RTPEM_MODE_NONE); |
| 2173 | f_sleep(0.5); |
| 2174 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_NONE); |
| 2175 | |
| 2176 | /* Remove RTP flows and check statistics */ |
Philipp Maier | 4f764ce | 2019-03-07 10:54:10 +0100 | [diff] [blame] | 2177 | f_flow_delete(RTPEM[0]); |
| 2178 | f_flow_delete(RTPEM[1], ep, call_id); |
| 2179 | |
Philipp Maier | 9ff0f8a | 2019-10-01 13:21:28 +0200 | [diff] [blame] | 2180 | /* Check for errors */ |
Philipp Maier | 4f764ce | 2019-03-07 10:54:10 +0100 | [diff] [blame] | 2181 | stats[0] := f_rtpem_stats_get(RTPEM[0]); |
| 2182 | stats[1] := f_rtpem_stats_get(RTPEM[1]); |
Philipp Maier | 4f764ce | 2019-03-07 10:54:10 +0100 | [diff] [blame] | 2183 | f_rtpem_stats_err_check(stats[0]); |
| 2184 | f_rtpem_stats_err_check(stats[1]); |
| 2185 | |
| 2186 | setverdict(pass); |
| 2187 | } |
| 2188 | |
Philipp Maier | 882843d | 2020-05-25 15:33:13 +0200 | [diff] [blame] | 2189 | /* Note: The hexstrings used with the f_TC_amr_x_x_rtp_conversion test |
| 2190 | * functions are real world AMR RTP payloads including AMR header. The |
| 2191 | * payloads were extracted from a trace with known good payloads. */ |
| 2192 | |
Philipp Maier | 4f764ce | 2019-03-07 10:54:10 +0100 | [diff] [blame] | 2193 | testcase TC_amr_oa_bwe_rtp_conversion() runs on dummy_CT { |
Philipp Maier | 882843d | 2020-05-25 15:33:13 +0200 | [diff] [blame] | 2194 | f_TC_amr_x_x_rtp_conversion('2014e959f35fdfe5e9667ffbc088818088'O, '217a567cd7f7f97a599ffef022206022'O, "octet-align=1", "octet-align=0"); |
Philipp Maier | 4f764ce | 2019-03-07 10:54:10 +0100 | [diff] [blame] | 2195 | } |
| 2196 | |
| 2197 | testcase TC_amr_oa_oa_rtp_conversion() runs on dummy_CT { |
| 2198 | f_TC_amr_x_x_rtp_conversion('100c4e9ba850e30d5d53d04de41e7c'O, '100c4e9ba850e30d5d53d04de41e7c'O, "octet-align=1", "octet-align=1"); |
| 2199 | } |
| 2200 | |
| 2201 | testcase TC_amr_bwe_bwe_rtp_conversion() runs on dummy_CT { |
| 2202 | f_TC_amr_x_x_rtp_conversion('10d3a6ea1438c35754f41379079f'O, '10d3a6ea1438c35754f41379079f'O, "octet-align=0", "octet-align=0"); |
| 2203 | } |
Philipp Maier | 6d4e094 | 2019-02-21 17:35:01 +0100 | [diff] [blame] | 2204 | |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 2205 | /* TODO: Double-DLCX (no retransmission) */ |
| 2206 | |
| 2207 | |
| 2208 | |
| 2209 | /* TODO: AUEP (various) */ |
| 2210 | /* TODO: RSIP (various) */ |
| 2211 | /* TODO: RQNT (various) */ |
| 2212 | /* TODO: EPCF (various) */ |
| 2213 | /* TODO: AUCX (various) */ |
| 2214 | /* TODO: invalid verb (various) */ |
| 2215 | |
Oliver Smith | 021141e | 2019-06-25 12:09:01 +0200 | [diff] [blame] | 2216 | |
| 2217 | testcase TC_conn_timeout() runs on dummy_CT { |
| 2218 | var RtpFlowData flow; |
| 2219 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "1@" & c_mgw_domain; |
| 2220 | var MgcpCallId call_id := '1225'H; |
| 2221 | var MGCP_RecvFrom mrf; |
| 2222 | |
| 2223 | f_init(ep); |
| 2224 | log("Setting conn-timeout to 1s"); |
| 2225 | f_vty_config(MGWVTY, "mgcp", "conn-timeout 1"); /* reset in f_init_vty() */ |
| 2226 | |
| 2227 | log("Sending RTP data for 1.5s"); |
Pau Espin Pedrol | b604af0 | 2020-09-07 17:12:39 +0200 | [diff] [blame] | 2228 | flow := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 111, "GSM-HR-08/8000/1")); |
Oliver Smith | 021141e | 2019-06-25 12:09:01 +0200 | [diff] [blame] | 2229 | flow.em.portnr := 10000; |
| 2230 | f_flow_create(RTPEM[0], ep, call_id, "loopback", flow); |
| 2231 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_BIDIR); |
| 2232 | f_sleep(1.5); |
| 2233 | |
| 2234 | log("Stopping for 0.5s and resuming"); |
| 2235 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_NONE); |
| 2236 | f_sleep(0.5); |
| 2237 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_BIDIR); |
| 2238 | f_sleep(0.1); |
| 2239 | |
| 2240 | log("Stopping for 1.5s, expecting to run into timeout"); |
| 2241 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_NONE); |
| 2242 | f_sleep(1.5); |
| 2243 | |
| 2244 | log("Resuming should fail now"); |
| 2245 | f_rtpem_conn_refuse_expect(RTPEM[0]); |
| 2246 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_BIDIR); |
| 2247 | f_sleep(0.2); |
| 2248 | f_rtpem_conn_refuse_verify(RTPEM[0]); |
| 2249 | |
| 2250 | setverdict(pass); |
| 2251 | } |
| 2252 | |
Philipp Maier | 2609c75 | 2020-07-08 12:38:09 +0200 | [diff] [blame] | 2253 | /* Test (valid) CRCX followed by (valid) DLCX containing EP (E1) */ |
| 2254 | testcase TC_e1_crcx_and_dlcx_ep() runs on dummy_CT { |
| 2255 | var template MgcpCommand cmd; |
| 2256 | var MgcpResponse resp; |
| 2257 | var MgcpEndpoint ep := "ds/e1-1/s-1/su16-0@" & c_mgw_domain; |
| 2258 | var MgcpCallId call_id := '8376F297'H; |
| 2259 | |
| 2260 | f_init(ep); |
| 2261 | |
| 2262 | cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id); |
| 2263 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); |
| 2264 | |
| 2265 | f_dlcx_ok(ep); |
| 2266 | |
| 2267 | setverdict(pass); |
| 2268 | } |
| 2269 | |
| 2270 | /* Test what happens when overlapping endpoints are selected (E1) */ |
| 2271 | testcase TC_e1_crcx_with_overlap() runs on dummy_CT { |
| 2272 | var template MgcpCommand cmd; |
| 2273 | var MgcpResponse resp; |
| 2274 | var MgcpEndpoint ep_1 := "ds/e1-1/s-1/su8-0@" & c_mgw_domain; |
| 2275 | var MgcpEndpoint ep_2 := "ds/e1-1/s-1/su16-0@" & c_mgw_domain; |
| 2276 | var MgcpCallId call_id_1 := '8376F297'H; |
| 2277 | var MgcpCallId call_id_2 := '837AF2A7'H; |
| 2278 | |
| 2279 | f_init(); |
| 2280 | |
| 2281 | /* ep_1 and ep_2 are overlapping, selecting both one after |
| 2282 | * another should work fine: */ |
| 2283 | cmd := ts_CRCX(get_next_trans_id(), ep_1, "recvonly", call_id_1); |
| 2284 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); |
| 2285 | f_dlcx_ok(ep_1); |
| 2286 | cmd := ts_CRCX(get_next_trans_id(), ep_2, "recvonly", call_id_2); |
| 2287 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); |
| 2288 | f_dlcx_ok(ep_2); |
| 2289 | |
| 2290 | /* When ep_1 is serving a call we can not select ep_2 becaus |
| 2291 | * it is overlapping with ep_1 */ |
| 2292 | cmd := ts_CRCX(get_next_trans_id(), ep_1, "recvonly", call_id_1); |
| 2293 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); |
| 2294 | cmd := ts_CRCX(get_next_trans_id(), ep_2, "recvonly", call_id_2); |
| 2295 | resp := mgcp_transceive_mgw(cmd, ?); |
| 2296 | if (resp.line.code != "501") { |
| 2297 | setverdict(fail, "unexpected CRCX returncode, CRCX should fail!"); |
| 2298 | } |
| 2299 | f_dlcx_ok(ep_1); |
| 2300 | |
| 2301 | setverdict(pass); |
| 2302 | } |
| 2303 | |
| 2304 | /* Create one connection in loopback mode, test if the RTP packets are |
| 2305 | * actually reflected */ |
| 2306 | testcase TC_e1_crcx_loopback() runs on dummy_CT { |
| 2307 | var RtpFlowData flow; |
| 2308 | var MgcpEndpoint ep := "ds/e1-1/s-1/su16-0@" & c_mgw_domain; |
| 2309 | var MgcpCallId call_id := '12250989'H; |
| 2310 | var RtpemStats stats; |
| 2311 | |
| 2312 | f_init(ep); |
Pau Espin Pedrol | b604af0 | 2020-09-07 17:12:39 +0200 | [diff] [blame] | 2313 | flow := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 111, "GSM-HR-08/8000/1")); |
Philipp Maier | 2609c75 | 2020-07-08 12:38:09 +0200 | [diff] [blame] | 2314 | flow.em.portnr := 10000; |
| 2315 | f_flow_create(RTPEM[0], ep, call_id, "loopback", flow); |
| 2316 | |
| 2317 | f_rtpem_mode(RTPEM[0], RTPEM_MODE_BIDIR); |
| 2318 | f_sleep(1.0); |
| 2319 | f_flow_delete(RTPEM[0], ep, call_id); |
| 2320 | |
| 2321 | stats := f_rtpem_stats_get(RTPEM[0]); |
| 2322 | |
| 2323 | if (stats.num_pkts_tx != stats.num_pkts_rx) { |
| 2324 | setverdict(fail); |
| 2325 | } |
| 2326 | if (stats.bytes_payload_tx != stats.bytes_payload_rx) { |
| 2327 | setverdict(fail); |
| 2328 | } |
| 2329 | |
| 2330 | f_rtpem_stats_err_check(stats); |
| 2331 | |
| 2332 | setverdict(pass); |
| 2333 | } |
| 2334 | |
Pau Espin Pedrol | db2dc04 | 2020-09-07 16:30:29 +0200 | [diff] [blame] | 2335 | /* test valid CRCX then MDCX with IPv4 address, MGW provides a local IPv4 too */ |
| 2336 | testcase TC_crcx_mdcx_ip4() runs on dummy_CT { |
| 2337 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain; |
| 2338 | var template MgcpCommand cmd; |
| 2339 | var MgcpResponse resp; |
| 2340 | var MgcpCallId call_id := '1234'H; |
| 2341 | var MgcpConnectionId conn_id; |
| 2342 | |
| 2343 | f_init(ep); |
| 2344 | |
| 2345 | /* create the connection on the MGW */ |
| 2346 | cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id); |
| 2347 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); |
| 2348 | conn_id := extract_conn_id(resp); |
| 2349 | |
| 2350 | cmd := ts_MDCX(get_next_trans_id(), ep, "sendrecv", call_id, conn_id); |
| 2351 | cmd.sdp := ts_SDP("127.0.0.2", "127.0.0.1", "23", "42", 2344, { "98" }, |
| 2352 | { valueof(ts_SDP_rtpmap(98, "AMR/8000")), |
| 2353 | valueof(ts_SDP_ptime(20)) }); |
| 2354 | resp := mgcp_transceive_mgw(cmd, tr_MDCX_ACK); |
| 2355 | |
| 2356 | if (not ispresent(resp.sdp) or not ispresent(resp.sdp.connection)) { |
| 2357 | setverdict(fail, "No RemoteConnection info found in MDCX ACK!"); |
| 2358 | } |
| 2359 | if (not match(resp.sdp.connection, ts_SDP_connection_IP("127.0.0.1", "IP4"))) { |
| 2360 | setverdict(fail, "Wrong RemoteConnection in MDCX ACK!", resp.sdp.connection); |
| 2361 | } |
| 2362 | |
| 2363 | /* clean-up */ |
| 2364 | f_dlcx_ok(ep, call_id); |
| 2365 | setverdict(pass); |
| 2366 | } |
| 2367 | |
| 2368 | /* test valid CRCX then MDCX with IPv6 address, MGW provides a local IPv6 too */ |
| 2369 | testcase TC_crcx_mdcx_ip6() runs on dummy_CT { |
| 2370 | var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain; |
| 2371 | var template MgcpCommand cmd; |
| 2372 | var MgcpResponse resp; |
| 2373 | var MgcpCallId call_id := '1234'H; |
| 2374 | var MgcpConnectionId conn_id; |
| 2375 | |
| 2376 | f_init(ep); |
| 2377 | |
| 2378 | /* create the connection on the MGW */ |
| 2379 | cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id); |
| 2380 | resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); |
| 2381 | conn_id := extract_conn_id(resp); |
| 2382 | |
| 2383 | cmd := ts_MDCX(get_next_trans_id(), ep, "sendrecv", call_id, conn_id); |
| 2384 | cmd.sdp := ts_SDP("::2", "::1", "23", "42", 2344, { "98" }, |
| 2385 | { valueof(ts_SDP_rtpmap(98, "AMR/8000")), |
| 2386 | valueof(ts_SDP_ptime(20)) }); |
| 2387 | resp := mgcp_transceive_mgw(cmd, tr_MDCX_ACK); |
| 2388 | |
| 2389 | if (not ispresent(resp.sdp) or not ispresent(resp.sdp.connection)) { |
| 2390 | setverdict(fail, "No RemoteConnection info found in MDCX ACK!"); |
| 2391 | } |
| 2392 | if (not match(resp.sdp.connection, ts_SDP_connection_IP("::1", "IP6"))) { |
| 2393 | setverdict(fail, "Wrong RemoteConnection in MDCX ACK!", resp.sdp.connection); |
| 2394 | } |
| 2395 | |
| 2396 | /* clean-up */ |
| 2397 | f_dlcx_ok(ep, call_id); |
| 2398 | setverdict(pass); |
| 2399 | } |
| 2400 | |
Harald Welte | 00a067f | 2017-09-13 23:27:17 +0200 | [diff] [blame] | 2401 | control { |
| 2402 | execute(TC_selftest()); |
Harald Welte | 3c6ebb9 | 2017-09-16 00:56:57 +0800 | [diff] [blame] | 2403 | execute(TC_crcx()); |
Philipp Maier | 45635f4 | 2018-06-05 17:28:02 +0200 | [diff] [blame] | 2404 | execute(TC_crcx_no_lco()); |
Philipp Maier | bb7a01c | 2018-02-01 12:32:57 +0100 | [diff] [blame] | 2405 | execute(TC_crcx_noprefix()); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 2406 | execute(TC_crcx_unsupp_mode()); |
Pau Espin Pedrol | befd3aa | 2020-09-21 10:54:42 +0200 | [diff] [blame] | 2407 | execute(TC_crcx_osmo_ign()); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 2408 | execute(TC_crcx_early_bidir_mode()); |
| 2409 | execute(TC_crcx_unsupp_param()); |
| 2410 | execute(TC_crcx_missing_callid()); |
| 2411 | execute(TC_crcx_missing_mode()); |
| 2412 | execute(TC_crcx_unsupp_packet_intv()); |
| 2413 | execute(TC_crcx_illegal_double_lco()); |
| 2414 | execute(TC_crcx_sdp()); |
Philipp Maier | 5e06cee | 2018-02-01 18:28:08 +0100 | [diff] [blame] | 2415 | execute(TC_crcx_wildcarded()); |
| 2416 | execute(TC_crcx_wildcarded_exhaust()); |
Harald Welte | e636afd | 2017-09-17 16:24:09 +0800 | [diff] [blame] | 2417 | execute(TC_mdcx_without_crcx()); |
| 2418 | execute(TC_dlcx_without_crcx()); |
Philipp Maier | 8a3dc92 | 2018-02-02 14:55:12 +0100 | [diff] [blame] | 2419 | execute(TC_mdcx_wildcarded()); |
| 2420 | execute(TC_dlcx_wildcarded()); |
Harald Welte | 79181ff | 2017-11-18 19:26:11 +0100 | [diff] [blame] | 2421 | execute(TC_crcx_and_dlcx_ep_callid_connid()); |
| 2422 | execute(TC_crcx_and_dlcx_ep_callid()); |
| 2423 | execute(TC_crcx_and_dlcx_ep()); |
Harald Welte | 6d167f8 | 2017-11-18 19:41:35 +0100 | [diff] [blame] | 2424 | execute(TC_crcx_and_dlcx_ep_callid_inval()); |
| 2425 | execute(TC_crcx_and_dlcx_ep_callid_connid_inval()); |
Harald Welte | f53f164 | 2017-11-18 19:57:11 +0100 | [diff] [blame] | 2426 | execute(TC_crcx_and_dlcx_retrans()); |
Harald Welte | 33d8216 | 2017-12-28 03:21:57 +0100 | [diff] [blame] | 2427 | |
Pau Espin Pedrol | b2c6b38 | 2019-05-14 13:40:49 +0200 | [diff] [blame] | 2428 | execute(TC_crcx_osmux_wildcard()); |
| 2429 | execute(TC_crcx_osmux_fixed()); |
| 2430 | execute(TC_crcx_osmux_fixed_twice()); |
| 2431 | execute(TC_one_crcx_receive_only_osmux()); |
| 2432 | execute(TC_one_crcx_loopback_osmux()); |
| 2433 | execute(TC_two_crcx_and_rtp_osmux()); |
| 2434 | execute(TC_two_crcx_and_rtp_osmux_bidir()); |
| 2435 | execute(TC_two_crcx_mdcx_and_rtp_osmux_wildcard()); |
| 2436 | execute(TC_two_crcx_mdcx_and_rtp_osmux_fixed()); |
| 2437 | |
Harald Welte | 33d8216 | 2017-12-28 03:21:57 +0100 | [diff] [blame] | 2438 | execute(TC_crcx_dlcx_30ep()); |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 2439 | |
| 2440 | execute(TC_rtpem_selftest()); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 2441 | |
| 2442 | execute(TC_one_crcx_receive_only_rtp()); |
| 2443 | execute(TC_one_crcx_loopback_rtp()); |
Philipp Maier | 1ac1398 | 2021-05-07 23:06:07 +0200 | [diff] [blame] | 2444 | execute(TC_one_crcx_loopback_rtp_implicit()); |
Harald Welte | bb7523b | 2018-03-29 08:52:01 +0200 | [diff] [blame] | 2445 | execute(TC_two_crcx_and_rtp()); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 2446 | execute(TC_two_crcx_and_rtp_bidir()); |
Philipp Maier | 7df85f6 | 2018-07-25 10:26:09 +0200 | [diff] [blame] | 2447 | execute(TC_two_crcx_diff_pt_and_rtp()); |
| 2448 | execute(TC_two_crcx_diff_pt_and_rtp_bidir()); |
Philipp Maier | 2321ef9 | 2018-06-27 17:52:04 +0200 | [diff] [blame] | 2449 | execute(TC_two_crcx_mdcx_and_rtp()); |
| 2450 | execute(TC_two_crcx_and_unsolicited_rtp()); |
| 2451 | execute(TC_two_crcx_and_one_mdcx_rtp_ho()); |
Philipp Maier | 6d4e094 | 2019-02-21 17:35:01 +0100 | [diff] [blame] | 2452 | execute(TC_ts101318_rfc5993_rtp_conversion()); |
Philipp Maier | 4f764ce | 2019-03-07 10:54:10 +0100 | [diff] [blame] | 2453 | execute(TC_amr_oa_bwe_rtp_conversion()); |
| 2454 | execute(TC_amr_oa_oa_rtp_conversion()); |
| 2455 | execute(TC_amr_bwe_bwe_rtp_conversion()); |
Oliver Smith | 021141e | 2019-06-25 12:09:01 +0200 | [diff] [blame] | 2456 | |
Pau Espin Pedrol | d19ba6d | 2020-01-03 20:01:48 +0100 | [diff] [blame] | 2457 | execute(TC_conn_timeout()); |
Philipp Maier | 2609c75 | 2020-07-08 12:38:09 +0200 | [diff] [blame] | 2458 | |
| 2459 | execute(TC_e1_crcx_and_dlcx_ep()); |
| 2460 | execute(TC_e1_crcx_with_overlap()); |
| 2461 | execute(TC_e1_crcx_loopback()); |
| 2462 | |
Pau Espin Pedrol | db2dc04 | 2020-09-07 16:30:29 +0200 | [diff] [blame] | 2463 | execute(TC_crcx_mdcx_ip4()); |
| 2464 | execute(TC_crcx_mdcx_ip6()); |
Pau Espin Pedrol | 9e0141a | 2020-09-07 17:25:56 +0200 | [diff] [blame] | 2465 | execute(TC_two_crcx_mdcx_and_rtp_ipv4_ipv6()); |
| 2466 | execute(TC_two_crcx_mdcx_and_rtp_ipv6()); |
| 2467 | execute(TC_two_crcx_and_rtp_osmux_bidir_ipv6()); |
| 2468 | execute(TC_two_crcx_and_rtp_osmux_bidir_ipv4_ipv6()); |
| 2469 | execute(TC_two_crcx_and_rtp_osmux_bidir_ipv6_ipv4()); |
| 2470 | execute(TC_two_crcx_mdcx_and_rtp_osmux_ipv6()); |
| 2471 | execute(TC_two_crcx_mdcx_and_rtp_osmux_ipv4_ipv6()); |
| 2472 | execute(TC_two_crcx_mdcx_and_rtp_osmux_ipv6_ipv4()); |
Harald Welte | 00a067f | 2017-09-13 23:27:17 +0200 | [diff] [blame] | 2473 | } |
| 2474 | } |