summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-04-04 20:17:29 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-04-04 20:17:29 +0200
commitd1c11b1e976532b23321a44a48606e7a78685a38 (patch)
tree29f274ed70d5e4ff3a3bc56f6cf010dc2043c0cc /src
parent02b19354e4b3f577d65019065002b53262b4518b (diff)
vty: Add VTY command about the state of the mncc connection
Add VTY command with the state of the MNCC connection. It gives a simple state and is connected in case of the READY state.
Diffstat (limited to 'src')
-rw-r--r--src/mncc.c7
-rw-r--r--src/mncc.h3
-rw-r--r--src/vty.c13
3 files changed, 23 insertions, 0 deletions
diff --git a/src/mncc.c b/src/mncc.c
index b13c5df..7926f5e 100644
--- a/src/mncc.c
+++ b/src/mncc.c
@@ -805,3 +805,10 @@ void mncc_connection_start(struct mncc_connection *conn)
LOGP(DMNCC, LOGL_NOTICE, "Scheduling MNCC connect\n");
osmo_timer_schedule(&conn->reconnect, 0, 0);
}
+
+const struct value_string mncc_conn_state_vals[] = {
+ { MNCC_DISCONNECTED, "DISCONNECTED" },
+ { MNCC_WAIT_VERSION, "WAITING" },
+ { MNCC_READY, "READY" },
+ { 0, NULL },
+};
diff --git a/src/mncc.h b/src/mncc.h
index b1ad5ca..ab271b0 100644
--- a/src/mncc.h
+++ b/src/mncc.h
@@ -2,6 +2,7 @@
#include <osmocom/core/select.h>
#include <osmocom/core/timer.h>
+#include <osmocom/core/utils.h>
#include <stdint.h>
@@ -31,3 +32,5 @@ void mncc_connection_init(struct mncc_connection *conn, struct app_config *cfg);
void mncc_connection_start(struct mncc_connection *conn);
int mncc_create_remote_leg(struct mncc_connection *conn, struct call *call);
+
+extern const struct value_string mncc_conn_state_vals[];
diff --git a/src/vty.c b/src/vty.c
index 4b37422..f3d9467 100644
--- a/src/vty.c
+++ b/src/vty.c
@@ -21,6 +21,7 @@
#include "vty.h"
#include "app.h"
#include "call.h"
+#include "mncc.h"
#include <talloc.h>
@@ -274,6 +275,17 @@ DEFUN(show_calls_sum, show_calls_sum_cmd,
return CMD_SUCCESS;
}
+DEFUN(show_mncc_conn, show_mncc_conn_cmd,
+ "show mncc-connection",
+ SHOW_STR "MNCC Connection state\n")
+{
+ vty_out(vty, "MNCC connection to path '%s' is in state %s%s",
+ g_app.mncc.path,
+ get_value_string(mncc_conn_state_vals, g_app.mncc.conn.state),
+ VTY_NEWLINE);
+ return CMD_SUCCESS;
+}
+
void mncc_sip_vty_init(void)
{
/* default values */
@@ -302,4 +314,5 @@ void mncc_sip_vty_init(void)
install_element_ve(&show_calls_cmd);
install_element_ve(&show_calls_sum_cmd);
+ install_element_ve(&show_mncc_conn_cmd);
}