mncc_mt_loadgen.py: add codec arg

Add codec parameter to start_call() and convenience functions mt_call()
and calls() with FR as default. While at it, update the help text.

Related: SYS#4924
Change-Id: I5879b8b9ccc63908b9f6629487e66eff1e4a1ab4
This commit is contained in:
Oliver Smith 2020-04-29 15:54:52 +02:00
parent 2d24cd48c9
commit aaf4e884ec
1 changed files with 10 additions and 7 deletions

View File

@ -109,12 +109,11 @@ class MTCallRtpsource(pykka.ThreadingActor):
self.state = 'NULL'
self.rtp_msc = None
def start_call(self, msisdn_called, msisdn_calling):
def start_call(self, msisdn_called, msisdn_calling, codec):
'''Start a MT call from given [external] calling party to given mobile party MSISDN'''
self.msisdn_called = msisdn_called
self.msisdn_calling = msisdn_calling
# allocate a RTP connection @ rtpsource
codec = "GSM_FR" # FIXME: make configurable
r = self.ctrl_act.ask({'type':'rtp_create', 'cname':self.callref, 'codec':codec})
self.ext_rtp_host = r['remote_host']
self.ext_rtp_port = r['remote_port']
@ -173,23 +172,27 @@ start_new_thread(mncc_rx_thread, (mncc_sock,))
rtpctrl_act = RtpSourceCtrlActor.start(RTPSOURCE_CTRL_IP, RTPSOURCE_CTRL_PORT)
# convenience wrapper
def mt_call(msisdn_called, msisdn_calling = '123456789', codecs = GSM48.AllCodecs):
def mt_call(msisdn_called, msisdn_calling='123456789', codecs=GSM48.AllCodecs, codec='GSM_FR'):
call_conn = MTCallRtpsource.start(mncc_act, rtpctrl_act, codecs).proxy()
call_conn.start_call(msisdn_called, msisdn_calling)
call_conn.start_call(msisdn_called, msisdn_calling, codec)
return call_conn
def calls(nr, ramp=1.0):
def calls(nr, ramp=1.0, codec='GSM_FR'):
for i in range(nr):
a = 90001 + i
a = str(a)
print("%d: mt_call(%r)" % (i, a))
mt_call(a)
mt_call(a, codec=codec)
time.sleep(ramp)
log.info("")
log.info("")
log.info("Start calls by typing:")
log.info("Start a single call by typing:")
log.info(" mt_call('90001')")
log.info("With a specific codec (default is 'GSM_FR'):")
log.info(" mt_call('90001', codec='GSM_EFR')")
log.info("Start multiple calls with (e.g. 4 calls with EFR):")
log.info(" calls(4, codec='GSM_EFR')")
log.info("")
log.info("")