[PATCH] osmo-gsm-tester[master]: debug: Add voicecall related methods to interactive shell

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Fri Oct 13 15:50:21 UTC 2017


Hello Neels Hofmeyr, Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/4151

to look at the new patch set (#2).

debug: Add voicecall related methods to interactive shell

Change-Id: Id2df68bf4fba0fb542eebdeb515a3dac6d5e575e
---
M suites/aoip_debug/interactive.py
M suites/debug/interactive.py
2 files changed, 120 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/51/4151/2

diff --git a/suites/aoip_debug/interactive.py b/suites/aoip_debug/interactive.py
index d596b68..819f207 100755
--- a/suites/aoip_debug/interactive.py
+++ b/suites/aoip_debug/interactive.py
@@ -23,13 +23,17 @@
   m.connect(msc.mcc_mnc())
 
 while True:
-  cmd = prompt('Enter command: (q)uit (s)ms (g)et-registered (w)ait-registered')
+  cmd = prompt('Enter command: (q)uit (s)ms (g)et-registered (w)ait-registered, call-list [<ms_msisdn>], call-dial <src_msisdn> <dst_msisdn>, call-wait-incoming <src_msisdn> <dst_msisdn>, call-answer <mt_msisdn> <call_id>, call-hangup <ms_msisdn> <call_id>')
   cmd = cmd.strip().lower()
 
   if not cmd:
     continue
+
+  params = cmd.split()
+
   if 'quit'.startswith(cmd):
     break
+
   elif 'wait-registered'.startswith(cmd):
     try:
       for m in modems:
@@ -37,12 +41,67 @@
       wait(msc.subscriber_attached, *modems)
     except Timeout:
       print('Timeout while waiting for registration.')
+
   elif 'get-registered'.startswith(cmd):
     print(msc.imsi_list_attached())
     print('RESULT: %s' %
        ('All modems are registered.' if msc.subscriber_attached(*modems)
         else 'Some modem(s) not registered yet.'))
+
   elif 'sms'.startswith(cmd):
     for mo in modems:
       for mt in modems:
         mo.sms_send(mt.msisdn, 'to ' + mt.name())
+
+  elif cmd.startswith('call-list'):
+      if len(params) != 1 and len(params) != 2:
+        print('wrong format')
+        continue
+      for ms in modems:
+        if len(params) == 1 or str(ms.msisdn) == params[1]:
+          print('call-list: %r %r' % (ms.name(), ms.call_id_list()))
+
+  elif cmd.startswith('call-dial'):
+    if len(params) != 3:
+      print('wrong format')
+      continue
+    src_msisdn, dst_msisdn = params[1:]
+    for mo in modems:
+      if str(mo.msisdn) == src_msisdn:
+        print('dialing %s->%s' % (src_msisdn, dst_msisdn))
+        call_id = mo.call_dial(dst_msisdn)
+        print('dial success: call_id=%r' % call_id)
+
+  elif cmd.startswith('call-wait-incoming'):
+    if len(params) != 3:
+      print('wrong format')
+      continue
+    src_msisdn, dst_msisdn = params[1:]
+    for mt in modems:
+      if str(mt.msisdn) == dst_msisdn:
+        print('waiting for incoming %s->%s' % (src_msisdn, dst_msisdn))
+        call_id = mt.call_wait_incoming(src_msisdn)
+        print('incoming call success: call_id=%r' % call_id)
+
+  elif cmd.startswith('call-answer'):
+    if len(params) != 3:
+      print('wrong format')
+      continue
+    mt_msisdn, call_id = params[1:]
+    for mt in modems:
+      if str(mt.msisdn) == mt_msisdn:
+        print('answering %s %r' % (mt.name(), call_id))
+        mt.call_answer(call_id)
+
+  elif cmd.startswith('call-hangup'):
+    if len(params) != 3:
+      print('wrong format')
+      continue
+    ms_msisdn, call_id = params[1:]
+    for ms in modems:
+      if str(ms.msisdn) == ms_msisdn:
+        print('hanging up %s %r' % (ms.name(), call_id))
+        ms.call_hangup(call_id)
+
+  else:
+      print('Unknown command: %s' % cmd)
diff --git a/suites/debug/interactive.py b/suites/debug/interactive.py
index 37076dc..1b89a7d 100755
--- a/suites/debug/interactive.py
+++ b/suites/debug/interactive.py
@@ -16,13 +16,17 @@
   m.connect(nitb.mcc_mnc())
 
 while True:
-  cmd = prompt('Enter command: (q)uit (s)ms (g)et-registered (w)ait-registered')
+  cmd = prompt('Enter command: (q)uit (s)ms (g)et-registered (w)ait-registered, call-list [<ms_msisdn>], call-dial <src_msisdn> <dst_msisdn>, call-wait-incoming <src_msisdn> <dst_msisdn>, call-answer <mt_msisdn> <call_id>, call-hangup <ms_msisdn> <call_id>')
   cmd = cmd.strip().lower()
 
   if not cmd:
     continue
+
+  params = cmd.split()
+
   if 'quit'.startswith(cmd):
     break
+
   elif 'wait-registered'.startswith(cmd):
     try:
       for m in modems:
@@ -30,12 +34,67 @@
       wait(nitb.subscriber_attached, *modems)
     except Timeout:
       print('Timeout while waiting for registration.')
+
   elif 'get-registered'.startswith(cmd):
     print(nitb.imsi_list_attached())
     print('RESULT: %s' %
        ('All modems are registered.' if nitb.subscriber_attached(*modems)
         else 'Some modem(s) not registered yet.'))
+
   elif 'sms'.startswith(cmd):
     for mo in modems:
       for mt in modems:
         mo.sms_send(mt.msisdn, 'to ' + mt.name())
+
+  elif cmd.startswith('call-list'):
+      if len(params) != 1 and len(params) != 2:
+        print('wrong format')
+        continue
+      for ms in modems:
+        if len(params) == 1 or str(ms.msisdn) == params[1]:
+          print('call-list: %r %r' % (ms.name(), ms.call_id_list()))
+
+  elif cmd.startswith('call-dial'):
+    if len(params) != 3:
+      print('wrong format')
+      continue
+    src_msisdn, dst_msisdn = params[1:]
+    for mo in modems:
+      if str(mo.msisdn) == src_msisdn:
+        print('dialing %s->%s' % (src_msisdn, dst_msisdn))
+        call_id = mo.call_dial(dst_msisdn)
+        print('dial success: call_id=%r' % call_id)
+
+  elif cmd.startswith('call-wait-incoming'):
+    if len(params) != 3:
+      print('wrong format')
+      continue
+    src_msisdn, dst_msisdn = params[1:]
+    for mt in modems:
+      if str(mt.msisdn) == dst_msisdn:
+        print('waiting for incoming %s->%s' % (src_msisdn, dst_msisdn))
+        call_id = mt.call_wait_incoming(src_msisdn)
+        print('incoming call success: call_id=%r' % call_id)
+
+  elif cmd.startswith('call-answer'):
+    if len(params) != 3:
+      print('wrong format')
+      continue
+    mt_msisdn, call_id = params[1:]
+    for mt in modems:
+      if str(mt.msisdn) == mt_msisdn:
+        print('answering %s %r' % (mt.name(), call_id))
+        mt.call_answer(call_id)
+
+  elif cmd.startswith('call-hangup'):
+    if len(params) != 3:
+      print('wrong format')
+      continue
+    ms_msisdn, call_id = params[1:]
+    for ms in modems:
+      if str(ms.msisdn) == ms_msisdn:
+        print('hanging up %s %r' % (ms.name(), call_id))
+        ms.call_hangup(call_id)
+
+  else:
+      print('Unknown command: %s' % cmd)

-- 
To view, visit https://gerrit.osmocom.org/4151
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Id2df68bf4fba0fb542eebdeb515a3dac6d5e575e
Gerrit-PatchSet: 2
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>


More information about the gerrit-log mailing list