aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-09-13 20:08:57 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-09-18 12:36:59 +0000
commit2cea100a7afd986dd699aea4afcf66632eb42d5a (patch)
treeb6a7257c0aab1024e0082881e597aa9e293267c5
parentca76652280275139cfda25c97a9a17fc79025c04 (diff)
vty: Add a config to enable MGCP command rewriting
-rw-r--r--include/ss7_application.h6
-rw-r--r--src/ss7_application.c10
-rw-r--r--src/vty_interface.c45
3 files changed, 60 insertions, 1 deletions
diff --git a/include/ss7_application.h b/include/ss7_application.h
index 1b4d412..59e2b01 100644
--- a/include/ss7_application.h
+++ b/include/ss7_application.h
@@ -77,6 +77,9 @@ struct ss7_application {
struct mtp_link_set *target_link;
int forward_only;
int reset_count;
+
+ /* mgcp handling for the cellmgr */
+ char *mgcp_domain_name;
};
@@ -91,4 +94,7 @@ int ss7_application_start(struct ss7_application *);
/* config changes */
void ss7_application_pass_isup(struct ss7_application *, int pass);
+int ss7_application_mgcp_domain_name(struct ss7_application *,
+ const char *domain_name);
+
#endif
diff --git a/src/ss7_application.c b/src/ss7_application.c
index ef74f3e..54c6f55 100644
--- a/src/ss7_application.c
+++ b/src/ss7_application.c
@@ -329,7 +329,6 @@ int ss7_application_setup(struct ss7_application *ss7, int type,
}
}
-
static void start_mtp(struct mtp_link_set *set)
{
struct mtp_link *link;
@@ -413,3 +412,12 @@ int mtp_link_set_data(struct mtp_link *link, struct msgb *msg)
return mtp_link_handle_data(link, msg);
}
+
+int ss7_application_mgcp_domain_name(struct ss7_application *app,
+ const char *name)
+{
+ talloc_free(app->mgcp_domain_name);
+ app->mgcp_domain_name = talloc_strdup(app, name);
+
+ return app->mgcp_domain_name == NULL;
+}
diff --git a/src/vty_interface.c b/src/vty_interface.c
index 255dd44..2104055 100644
--- a/src/vty_interface.c
+++ b/src/vty_interface.c
@@ -291,6 +291,11 @@ static void write_application(struct vty *vty, struct ss7_application *app)
if (app->type == APP_STP)
vty_out(vty, " isup-pass-through %d%s", app->isup_pass, VTY_NEWLINE);
+ if (app->type == APP_CELLMGR && app->mgcp_domain_name) {
+ vty_out(vty, " domain-name %s%s",
+ app->mgcp_domain_name, VTY_NEWLINE);
+ }
+
if (app->route_is_set) {
vty_out(vty, " route %s %d %s %d%s",
link_type(app->route_src.type), app->route_src.nr,
@@ -866,6 +871,44 @@ DEFUN(cfg_app_route_ls, cfg_app_route_ls_cmd,
return CMD_SUCCESS;
}
+#define MGCP_DOMAIN_STR "MGCP domain name to use\n"
+
+DEFUN(cfg_app_domain_name, cfg_app_domain_name_cmd,
+ "domain-name NAME",
+ MGCP_DOMAIN_STR "Domain Name\n")
+{
+ struct ss7_application *app = vty->index;
+
+ if (app->type != APP_CELLMGR) {
+ vty_out(vty, "The app type needs to be 'msc'.%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ if (ss7_application_mgcp_domain_name(app, argv[0]) != 0) {
+ vty_out(vty, "Failed to set the domain name.%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_app_no_domain_name, cfg_app_no_domain_name_cmd,
+ "no domain-name",
+ NO_STR MGCP_DOMAIN_STR)
+{
+ struct ss7_application *app = vty->index;
+
+ if (app->type != APP_CELLMGR) {
+ vty_out(vty, "The app type needs to be 'msc'.%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ talloc_free(app->mgcp_domain_name);
+ app->mgcp_domain_name = NULL;
+ return CMD_SUCCESS;
+}
+
+
static void install_defaults(int node)
{
install_default(node);
@@ -929,6 +972,8 @@ void cell_vty_init(void)
install_element(APP_NODE, &cfg_app_isup_pass_cmd);
install_element(APP_NODE, &cfg_app_route_cmd);
install_element(APP_NODE, &cfg_app_route_ls_cmd);
+ install_element(APP_NODE, &cfg_app_domain_name_cmd);
+ install_element(APP_NODE, &cfg_app_no_domain_name_cmd);
cell_vty_init_cmds();
}