blob: 83a6de4459c702820f2a6c5bbe86eb3c3a03d3e3 [file] [log] [blame]
Pau Espin Pedrolb5f37ff2019-06-19 17:24:52 +02001#!/usr/bin/env python3
2from osmo_gsm_tester.testenv import *
3
4def test_mo_mt_call(use_osmux=False, force_osmux=False):
Pau Espin Pedrol40c7bc72020-05-05 13:41:42 +02005 hlr = tenv.hlr()
6 bts = tenv.bts()
7 mgw_msc = tenv.mgw()
8 mgw_bsc = tenv.mgw()
9 stp = tenv.stp()
10 msc = tenv.msc(hlr, mgw_msc, stp)
11 bsc = tenv.bsc(msc, mgw_bsc, stp)
12 ms_mo = tenv.modem()
13 ms_mt = tenv.modem()
Pau Espin Pedrolb5f37ff2019-06-19 17:24:52 +020014
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...')
Pau Espin Pedrol3a81a7e2020-06-10 16:52:53 +020048 wait(ms_mo.is_registered, msc.mcc_mnc())
49 wait(ms_mt.is_registered, msc.mcc_mnc())
Pau Espin Pedrolb5f37ff2019-06-19 17:24:52 +020050 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')