summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2017-09-19 16:33:52 +0200
committerMax <msuraev@sysmocom.de>2017-09-19 18:27:25 +0200
commitd6b757f0be6b4d1894380ab82a338b87c443922a (patch)
treedd7721f30c0035260b121b0cee0d4718d2722d9b
parent5fda266812f801a884224b59a3f3b9923ded6535 (diff)
osmo-bsc_mgcp: support multiple MGCP
osmo-bsc_mgcp will still only use the first mgcp instance, but this copes with the API changes in mgcp_parse_config. Adjusted by Max <msuraev@sysmocom.de> Change-Id: I52ea74103acef374212e276dfa8122b00ca4562a
-rw-r--r--openbsc/src/osmo-bsc_mgcp/mgcp_main.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
index 4ea070079..8af7eb944 100644
--- a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
+++ b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
@@ -43,6 +43,7 @@
#include <osmocom/core/select.h>
#include <osmocom/core/stats.h>
#include <osmocom/core/rate_ctr.h>
+#include <osmocom/core/linuxlist.h>
#include <osmocom/vty/telnet_interface.h>
#include <osmocom/vty/logging.h>
@@ -198,6 +199,7 @@ static struct vty_app_info vty_info = {
int main(int argc, char **argv)
{
+ struct llist_head mgcp_cfgs;
struct gsm_network dummy_network;
struct sockaddr_in addr;
int on = 1, rc;
@@ -208,16 +210,6 @@ int main(int argc, char **argv)
osmo_init_ignore_signals();
osmo_init_logging(&log_info);
- cfg = mgcp_config_alloc();
- if (!cfg)
- return -1;
-
-#ifdef BUILD_MGCP_TRANSCODING
- cfg->setup_rtp_processing_cb = &mgcp_transcoding_setup;
- cfg->rtp_processing_cb = &mgcp_transcoding_process_rtp;
- cfg->get_net_downlink_format_cb = &mgcp_transcoding_net_downlink_format;
-#endif
-
vty_info.copyright = openbsc_copyright;
vty_init(&vty_info);
logging_vty_add_cmds(NULL);
@@ -229,10 +221,21 @@ int main(int argc, char **argv)
rate_ctr_init(tall_bsc_ctx);
osmo_stats_init(tall_bsc_ctx);
- rc = mgcp_parse_config(config_file, cfg, MGCP_BSC);
+ rc = mgcp_parse_config(config_file, &mgcp_cfgs, MGCP_BSC);
if (rc < 0)
return rc;
+ if (llist_empty(&mgcp_cfgs))
+ return -1;
+
+ cfg = llist_entry(mgcp_cfgs.next, struct mgcp_config, entry);
+
+#ifdef BUILD_MGCP_TRANSCODING
+ cfg->setup_rtp_processing_cb = &mgcp_transcoding_setup;
+ cfg->rtp_processing_cb = &mgcp_transcoding_process_rtp;
+ cfg->get_net_downlink_format_cb = &mgcp_transcoding_net_downlink_format;
+#endif
+
/* start telnet after reading config for vty_get_bind_addr() */
rc = telnet_init_dynif(tall_bsc_ctx, &dummy_network,
vty_get_bind_addr(), OSMO_VTY_PORT_BSC_MGCP);