Max has uploaded this change for review. ( https://gerrit.osmocom.org/11818


Change subject: mobile: add function to show active calls
......................................................................

mobile: add function to show active calls

Change-Id: I108b9518517433c87df1f6569d032ad411622d45
---
M src/host/layer23/include/osmocom/bb/mobile/mncc_ms.h
M src/host/layer23/src/mobile/mnccms.c
M src/host/layer23/src/mobile/vty_interface.c
3 files changed, 40 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/18/11818/1

diff --git a/src/host/layer23/include/osmocom/bb/mobile/mncc_ms.h 
b/src/host/layer23/include/osmocom/bb/mobile/mncc_ms.h
index 49ce1a4..d7772ca 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/mncc_ms.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/mncc_ms.h
@@ -6,4 +6,5 @@
 int mncc_hold(struct osmocom_ms *ms);
 int mncc_retrieve(struct osmocom_ms *ms, int number);
 int mncc_dtmf(struct osmocom_ms *ms, char *dtmf);
-
+void dump_calls(const struct osmocom_ms *ms,
+               void (*print)(void *, const char *, ...), void *v);
diff --git a/src/host/layer23/src/mobile/mnccms.c 
b/src/host/layer23/src/mobile/mnccms.c
index 2243291..df3c062 100644
--- a/src/host/layer23/src/mobile/mnccms.c
+++ b/src/host/layer23/src/mobile/mnccms.c
@@ -596,6 +596,23 @@
        return mncc_tx_to_cc(ms, MNCC_SETUP_REQ, &setup);
 }

+void dump_calls(const struct osmocom_ms *ms,
+               void (*print)(void *, const char *, ...), void *v)
+{
+       struct gsm_call *call;
+
+       llist_for_each_entry(call, &call_list, entry) {
+               print(v, "MS %s, CallRef %X ", ms->name, call->callref);
+               if (call->init)
+                       print(v, "initiating");
+               if (call->hold)
+                       print(v, "on hold");
+               if (call->ring)
+                       print(v, "ringing");
+               print(v, "\n");
+       }
+}
+
 int mncc_hangup(struct osmocom_ms *ms)
 {
        struct gsm_call *call, *found = NULL;
diff --git a/src/host/layer23/src/mobile/vty_interface.c 
b/src/host/layer23/src/mobile/vty_interface.c
index a0ad993..635874e 100644
--- a/src/host/layer23/src/mobile/vty_interface.c
+++ b/src/host/layer23/src/mobile/vty_interface.c
@@ -263,6 +263,27 @@
        return CMD_SUCCESS;
 }

+DEFUN(show_calls, show_calls_cmd, "show calls [MS_NAME]",
+       SHOW_STR "Display information about calls\n"
+       "Name of MS (see \"show ms\")")
+{
+       struct osmocom_ms *ms;
+
+       if (argc) {
+               ms = get_ms(argv[0], vty);
+               if (!ms)
+                       return CMD_WARNING;
+               dump_calls(ms, print_vty, vty);
+       } else {
+               llist_for_each_entry(ms, &ms_list, entity) {
+                       dump_calls(ms, print_vty, vty);
+                       vty_out(vty, "%s", VTY_NEWLINE);
+               }
+       }
+
+       return CMD_SUCCESS;
+}
+
 DEFUN(show_support, show_support_cmd, "show support [MS_NAME]",
        SHOW_STR "Display information about MS support\n"
        "Name of MS (see \"show ms\")")

--
To view, visit https://gerrit.osmocom.org/11818
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I108b9518517433c87df1f6569d032ad411622d45
Gerrit-Change-Number: 11818
Gerrit-PatchSet: 1
Gerrit-Owner: Max <[email protected]>

Reply via email to