Pau Espin Pedrol | b5f37ff | 2019-06-19 17:24:52 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
| 2 | from osmo_gsm_tester.testenv import * |
| 3 | |
| 4 | def test_mo_mt_call(use_osmux=False, force_osmux=False): |
| 5 | hlr = suite.hlr() |
| 6 | bts = suite.bts() |
| 7 | mgw_msc = suite.mgw() |
| 8 | mgw_bsc = suite.mgw() |
| 9 | stp = suite.stp() |
| 10 | msc = suite.msc(hlr, mgw_msc, stp) |
| 11 | bsc = suite.bsc(msc, mgw_bsc, stp) |
| 12 | ms_mo = suite.modem() |
| 13 | ms_mt = suite.modem() |
| 14 | |
| 15 | hlr.start() |
| 16 | stp.start() |
| 17 | |
| 18 | msc.set_use_osmux(use_osmux, force_osmux) |
| 19 | msc.start() |
| 20 | |
| 21 | # osmo-msc still doesn't support linking 2 internal leg calls through Osmux |
| 22 | # if both calls are using Osmux. Currently, RTP is always used between the 2 |
| 23 | # endpoints of the MGW. See OS#4065. |
| 24 | mgw_msc.set_use_osmux(use_osmux, False) |
| 25 | mgw_msc.start() |
| 26 | |
| 27 | # We don't want to force Osmux in BSC_MGW since in MGW BTS-side is still RTP. |
| 28 | mgw_bsc.set_use_osmux(use_osmux, False) |
| 29 | mgw_bsc.start() |
| 30 | |
| 31 | bsc.set_use_osmux(use_osmux, force_osmux) |
| 32 | bsc.bts_add(bts) |
| 33 | bsc.start() |
| 34 | |
| 35 | bts.start() |
| 36 | wait(bsc.bts_is_connected, bts) |
| 37 | |
| 38 | hlr.subscriber_add(ms_mo) |
| 39 | hlr.subscriber_add(ms_mt) |
| 40 | |
| 41 | ms_mo.connect(msc.mcc_mnc()) |
| 42 | ms_mt.connect(msc.mcc_mnc()) |
| 43 | |
| 44 | ms_mo.log_info() |
| 45 | ms_mt.log_info() |
| 46 | |
| 47 | print('waiting for modems to attach...') |
| 48 | wait(ms_mo.is_connected, msc.mcc_mnc()) |
| 49 | wait(ms_mt.is_connected, msc.mcc_mnc()) |
| 50 | wait(msc.subscriber_attached, ms_mo, ms_mt) |
| 51 | |
| 52 | assert len(ms_mo.call_id_list()) == 0 and len(ms_mt.call_id_list()) == 0 |
| 53 | mo_cid = ms_mo.call_dial(ms_mt) |
| 54 | mt_cid = ms_mt.call_wait_incoming(ms_mo) |
| 55 | print('dial success') |
| 56 | |
| 57 | assert not ms_mo.call_is_active(mo_cid) and not ms_mt.call_is_active(mt_cid) |
| 58 | ms_mt.call_answer(mt_cid) |
| 59 | wait(ms_mo.call_is_active, mo_cid) |
| 60 | wait(ms_mt.call_is_active, mt_cid) |
| 61 | print('answer success, call established and ongoing') |
| 62 | |
| 63 | sleep(5) # maintain the call active for 5 seconds |
| 64 | |
| 65 | assert ms_mo.call_is_active(mo_cid) and ms_mt.call_is_active(mt_cid) |
| 66 | ms_mt.call_hangup(mt_cid) |
| 67 | wait(lambda: len(ms_mo.call_id_list()) == 0 and len(ms_mt.call_id_list()) == 0) |
| 68 | print('hangup success') |