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