aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/osmo-bsc/osmo_bsc_vty.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-01-27 14:20:24 +0100
committerHarald Welte <laforge@gnumonks.org>2012-01-27 18:12:03 +0100
commit1dde661dd6653f21ddb003f203f8a23f201d68c9 (patch)
tree268560908c700e5cd20ab6dc589b7dbbbea3c337 /openbsc/src/osmo-bsc/osmo_bsc_vty.c
parent122b6331927dd65d716d71cdf8fcb728cc2475f9 (diff)
osmo-bsc: Add configurable option to spawn + respawn osmo-bsc_mgcplaforge/mgcp-rework
If it is configured in the config file or on the VTY, osmo-bsc will fork+exec osmo-bsc_mgcp. Furthermore, if osmo-bsc_mgcp dies, osmo-bsc will re-spawn it. This also means that we can now send a SIGHUP to osmo-bsc_mgcp in the event of a Msc (re)connect, causing it to send RSIP, which in turn is required by certain call agents that forget to send a AUEP on startup to determine the endpoint state of the media gateway[s].
Diffstat (limited to 'openbsc/src/osmo-bsc/osmo_bsc_vty.c')
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_vty.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_vty.c b/openbsc/src/osmo-bsc/osmo_bsc_vty.c
index 0b1698e41..912d44646 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_vty.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_vty.c
@@ -18,6 +18,8 @@
*
*/
+#include <sys/signal.h>
+
#include <openbsc/gsm_data.h>
#include <openbsc/osmo_msc_data.h>
#include <openbsc/vty.h>
@@ -325,6 +327,61 @@ DEFUN(cfg_net_rf_socket,
return CMD_SUCCESS;
}
+#define MGCP_STR "Configuration of the osmo-bsc_mgcp\n"
+
+DEFUN(cfg_net_msc_mgcp, cfg_net_msc_mgcp_cmd,
+ "bsc-mgcp executable PATH", MGCP_STR
+ "Set the filename / path of the osmo-bsc_mgcp executable.\n"
+ "filename / path of the osmo-bsc_mgcp executable\n")
+{
+ struct osmo_msc_data *data = osmo_msc_data(vty);
+ int equal = 0;
+
+ if (data->bsc_mgcp.path && !strcmp(data->bsc_mgcp.path, argv[0]))
+ equal = 1;
+
+ bsc_replace_string(data, &data->bsc_mgcp.path, argv[0]);
+
+ if (equal)
+ return CMD_SUCCESS;
+
+ if (data->bsc_mgcp.pid) {
+ kill(data->bsc_mgcp.pid, SIGTERM);
+ data->bsc_mgcp.pid = 0;
+ /* we will get SIGCHLD and re-spawn new path */
+ }
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_net_msc_no_mgcp, cfg_net_msc_no_mgcp_cmd,
+ "no bsc-mgcp executable", NO_STR MGCP_STR
+ "Do not start osmo-bsc_mgcp from osmo-bsc\n")
+{
+ struct osmo_msc_data *data = osmo_msc_data(vty);
+
+ talloc_free(data->bsc_mgcp.path);
+ data->bsc_mgcp.path = NULL;
+
+ if (data->bsc_mgcp.pid) {
+ kill(data->bsc_mgcp.pid, SIGTERM);
+ data->bsc_mgcp.pid = 0;
+ /* SIGCHLD handler will not try to respawn, as path == NULL */
+ }
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_net_msc_cfg_mgcp, cfg_net_msc_mgcp_cfg_cmd,
+ "bsc-mgcp config-file PATH", MGCP_STR
+ "Set the filename / path of the osmo-bsc_mgcp config file\n"
+ "filename / path of the osmo-bsc_mgcp config file\n")
+{
+ struct osmo_msc_data *data = osmo_msc_data(vty);
+
+ bsc_replace_string(data, &data->bsc_mgcp.config_path, argv[0]);
+ return CMD_SUCCESS;
+}
+
DEFUN(show_statistics,
show_statistics_cmd,
"show statistics",
@@ -353,6 +410,11 @@ int bsc_vty_init_extra(void)
install_element(MSC_NODE, &cfg_net_msc_welcome_ussd_cmd);
install_element(MSC_NODE, &cfg_net_rf_socket_cmd);
+ /* FIXME: this should probably be a global MGCP node? */
+ install_element(MSC_NODE, &cfg_net_msc_mgcp_cmd);
+ install_element(MSC_NODE, &cfg_net_msc_no_mgcp_cmd);
+ install_element(MSC_NODE, &cfg_net_msc_mgcp_cfg_cmd);
+
install_element_ve(&show_statistics_cmd);
return 0;