diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-09-13 20:08:57 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-09-13 20:08:57 +0200 |
commit | fc98ce252e7111c06e8051e0121b31913db9ff39 (patch) | |
tree | 94c03cc5b6599dd5f7610a657c5011ff16b92468 /src | |
parent | a79aff3f9624eae7cfdf415d00d0f215f2945823 (diff) |
vty: Add a config to enable MGCP command rewriting
Diffstat (limited to 'src')
-rw-r--r-- | src/ss7_application.c | 10 | ||||
-rw-r--r-- | src/vty_interface.c | 45 |
2 files changed, 54 insertions, 1 deletions
diff --git a/src/ss7_application.c b/src/ss7_application.c index 12e97df..9d34752 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 5d67d75..9fe780e 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(); } |