From 122b6331927dd65d716d71cdf8fcb728cc2475f9 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 27 Jan 2012 13:07:13 +0100 Subject: bsc_mgcp: Send RSIP for all endpoints when SIGHUP is received this will be used as quick work-around so osmo-bsc kan trigger RSIP after a re-connect to a MSC requiring RSIP from the MGW. In the ideal world, the MSC (call agent) would comply with the MGCP spec and send AUEP, but well... --- openbsc/src/osmo-bsc/osmo_bsc_bssap.c | 6 ++++++ openbsc/src/osmo-bsc_mgcp/mgcp_main.c | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/openbsc/src/osmo-bsc/osmo_bsc_bssap.c b/openbsc/src/osmo-bsc/osmo_bsc_bssap.c index a59e2f674..0742b0b26 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_bssap.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_bssap.c @@ -29,6 +29,7 @@ #include #include +#include #include static uint16_t read_data16(const uint8_t *data) @@ -102,6 +103,11 @@ static int bssmap_handle_reset_ack(struct gsm_network *net, struct msgb *msg, unsigned int length) { LOGP(DMSC, LOGL_NOTICE, "Reset ACK from MSC\n"); + + /* notify bsc_mgcp to reset all end-points */ + if (net->msc_data->bsc_mgcp.pid) + kill(net->msc_data->bsc_mgcp.pid, SIGHUP); + return 0; } diff --git a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c index f73e73d11..94d2d7f3b 100644 --- a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c +++ b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -196,6 +197,15 @@ static struct vty_app_info vty_info = { .is_config_node = bsc_vty_is_config_node, }; +static void sig_handler(int sig) +{ + if (sig != SIGHUP) + return; + + LOGP(DMGCP, LOGL_NOTICE, "SIGHUP received, resetting all endpoints\n"); + mgcp_send_reset_all(cfg); +} + int main(int argc, char **argv) { struct gsm_network dummy_network; @@ -205,6 +215,7 @@ int main(int argc, char **argv) tall_bsc_ctx = talloc_named_const(NULL, 1, "mgcp-callagent"); osmo_init_ignore_signals(); + signal(SIGHUP, &sig_handler); osmo_init_logging(&log_info); cfg = mgcp_config_alloc(); -- cgit v1.2.3