Pau Espin Pedrol | d71edd1 | 2017-10-06 13:53:54 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
| 2 | from osmo_gsm_tester.test import * |
| 3 | |
| 4 | hlr = suite.hlr() |
| 5 | bts = suite.bts() |
| 6 | mgcpgw = suite.mgcpgw(bts_ip=bts.remote_addr()) |
| 7 | msc = suite.msc(hlr, mgcpgw) |
| 8 | bsc = suite.bsc(msc) |
| 9 | stp = suite.stp() |
| 10 | ms_mo = suite.modem() |
| 11 | ms_mt = suite.modem() |
| 12 | |
| 13 | hlr.start() |
| 14 | stp.start() |
| 15 | msc.start() |
| 16 | mgcpgw.start() |
| 17 | |
| 18 | bsc.bts_add(bts) |
| 19 | bsc.start() |
| 20 | |
| 21 | bts.start() |
| 22 | |
| 23 | hlr.subscriber_add(ms_mo) |
| 24 | hlr.subscriber_add(ms_mt) |
| 25 | |
| 26 | ms_mo.connect(msc.mcc_mnc()) |
| 27 | ms_mt.connect(msc.mcc_mnc()) |
| 28 | |
| 29 | ms_mo.log_info() |
| 30 | ms_mt.log_info() |
| 31 | |
| 32 | print('waiting for modems to attach...') |
| 33 | wait(ms_mo.is_connected, msc.mcc_mnc()) |
| 34 | wait(ms_mt.is_connected, msc.mcc_mnc()) |
| 35 | wait(msc.subscriber_attached, ms_mo, ms_mt) |
| 36 | |
| 37 | assert len(ms_mo.call_id_list()) == 0 and len(ms_mt.call_id_list()) == 0 |
| 38 | mo_cid = ms_mo.call_dial(ms_mt) |
| 39 | mt_cid = ms_mt.call_wait_incoming(ms_mo) |
| 40 | print('dial success') |
| 41 | |
| 42 | assert not ms_mo.call_is_active(mo_cid) and not ms_mt.call_is_active(mt_cid) |
| 43 | ms_mt.call_answer(mt_cid) |
| 44 | wait(ms_mo.call_is_active, mo_cid) |
| 45 | wait(ms_mt.call_is_active, mt_cid) |
| 46 | print('answer success, call established and ongoing') |
| 47 | |
| 48 | sleep(5) # maintain the call active for 5 seconds |
| 49 | |
| 50 | assert ms_mo.call_is_active(mo_cid) and ms_mt.call_is_active(mt_cid) |
| 51 | ms_mt.call_hangup(mt_cid) |
| 52 | wait(lambda: len(ms_mo.call_id_list()) == 0 and len(ms_mt.call_id_list()) == 0) |
| 53 | print('hangup success') |