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

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Fri Oct 6 17:28:48 UTC 2017


Review at  https://gerrit.osmocom.org/4151

debug: Add voicecall related method to interactive shell

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


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

diff --git a/suites/aoip_debug/interactive.py b/suites/aoip_debug/interactive.py
index d596b68..4db82e6 100755
--- a/suites/aoip_debug/interactive.py
+++ b/suites/aoip_debug/interactive.py
@@ -23,11 +23,14 @@
   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-answer <ms_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):
@@ -46,3 +49,35 @@
     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' % ms.call_id_list())
+  elif cmd.startswith('call-dial'):
+    if len(params) != 3:
+      print('wrong format')
+      continue
+    for mo in modems:
+      if str(mo.msisdn) == params[1]:
+        print('dial %s->%s, %s' % (params[1],params[2],str(mo.call_dial(params[2]))))
+  elif cmd.startswith('call-answer'):
+    if len(params) != 3:
+      print('wrong format')
+      continue
+    for ms in modems:
+      if str(ms.msisdn) == params[1]:
+        print('answer %s' % params[2])
+        ms.call_answer(params[2])
+  elif cmd.startswith('call-hangup'):
+    if len(params) != 3:
+      print('wrong format')
+      continue
+    for ms in modems:
+      if str(ms.msisdn) == params[1]:
+        print('hang up %s' % params[2])
+        ms.call_hangup(params[2])
+  else:
+      print('Unknown command: %s' % cmd)
diff --git a/suites/debug/interactive.py b/suites/debug/interactive.py
index 37076dc..70188d7 100755
--- a/suites/debug/interactive.py
+++ b/suites/debug/interactive.py
@@ -16,11 +16,14 @@
   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-answer <ms_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):
@@ -39,3 +42,35 @@
     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' % ms.call_id_list())
+  elif cmd.startswith('call-dial'):
+    if len(params) != 3:
+      print('wrong format')
+      continue
+    for mo in modems:
+      if str(mo.msisdn) == params[1]:
+        print('dial %s->%s, %s' % (params[1],params[2],str(mo.call_dial(params[2]))))
+  elif cmd.startswith('call-answer'):
+    if len(params) != 3:
+      print('wrong format')
+      continue
+    for ms in modems:
+      if str(ms.msisdn) == params[1]:
+        print('answer %s' % params[2])
+        ms.call_answer(params[2])
+  elif cmd.startswith('call-hangup'):
+    if len(params) != 3:
+      print('wrong format')
+      continue
+    for ms in modems:
+      if str(ms.msisdn) == params[1]:
+        print('hang up %s' % params[2])
+        ms.call_hangup(params[2])
+  else:
+      print('Unknown command: %s' % cmd)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id2df68bf4fba0fb542eebdeb515a3dac6d5e575e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>


More information about the gerrit-log mailing list