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.
changes/26/126/1
Holger Hans Peter Freyther 7 years ago
parent 02b19354e4
commit d1c11b1e97
  1. 7
      src/mncc.c
  2. 3
      src/mncc.h
  3. 13
      src/vty.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 },
};

@ -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[];

@ -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);
}

Loading…
Cancel
Save