aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-01-27 00:38:59 +0100
committerHarald Welte <laforge@gnumonks.org>2012-01-27 00:38:59 +0100
commit50f93a4acde733ab03b85cde9c525bad1a3aec8b (patch)
treea3ffdcc88b65c5609aee97cc7581e871e235766d /openbsc
parent27fa7901bb97823add780eb75df14bde8a02bd82 (diff)
bsc_mgcp: optionally connect the MGCP socket to the MGW
This allows the use of the existing "call-agent ip A.B.C.D" command in libmgcp in order to set a default destination address of the call agent. This is required as a pre-condition for certain call agents (like the zynetix MSC) that require a RSIP from the BSC to the MSC as the initial MGCP message.
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/osmo-bsc_mgcp/mgcp_main.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
index b334b06b7..3bacbe6cd 100644
--- a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
+++ b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
@@ -256,6 +256,17 @@ int main(int argc, char **argv)
return -1;
}
+ if (cfg->call_agent_addr) {
+ addr.sin_port = htons(2727);
+ inet_aton(cfg->call_agent_addr, &addr.sin_addr);
+ if (connect(cfg->gw_fd.bfd.fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
+ LOGP(DMGCP, LOGL_ERROR, "Failed to connect to: '%s'. errno: %d\n",
+ cfg->call_agent_addr, errno);
+ close(cfg->gw_fd.bfd.fd);
+ cfg->gw_fd.bfd.fd = -1;
+ return -1;
+ }
+ }
if (osmo_fd_register(&cfg->gw_fd.bfd) != 0) {
LOGP(DMGCP, LOGL_FATAL, "Failed to register the fd\n");