MGCP: add 'X-Osmo-IGN: C' for SCCPlite by default
Use libosmo-mgcp-client's new X-Osmo-IGN header to indicate that CallIDs are
allowed to mismatch.
Add VTY commands 'msc' / 'mgw x-osmo-ign call-id' and 'no mgw x-osmo-ign' to
switch this behavior explicitly.
For SCCPlite MSCs, unless a specific config was issued, always send
'X-Osmo-IGN: C' by default, to ignore CallID mismatches.
Depends: Id7ae275ffde8ea9389270cfe3db087ee8db00b51 (osmo-mgw)
Change-Id: I257ad574d8060fef19afce9798bd8a5a7f8c99fe
diff --git a/include/osmocom/bsc/bsc_msc_data.h b/include/osmocom/bsc/bsc_msc_data.h
index 7ec3442..6ca0330 100644
--- a/include/osmocom/bsc/bsc_msc_data.h
+++ b/include/osmocom/bsc/bsc_msc_data.h
@@ -130,6 +130,9 @@
* BSSMAP RESET procedure */
struct osmo_fsm_inst *reset_fsm;
} a;
+
+ uint32_t x_osmo_ign;
+ bool x_osmo_ign_configured;
};
/*
diff --git a/src/osmo-bsc/lchan_rtp_fsm.c b/src/osmo-bsc/lchan_rtp_fsm.c
index 091af5e..93883af 100644
--- a/src/osmo-bsc/lchan_rtp_fsm.c
+++ b/src/osmo-bsc/lchan_rtp_fsm.c
@@ -29,6 +29,7 @@
#include <osmocom/bsc/mgw_endpoint_fsm.h>
#include <osmocom/bsc/bsc_subscr_conn_fsm.h>
#include <osmocom/bsc/abis_rsl.h>
+#include <osmocom/bsc/bsc_msc_data.h>
static struct osmo_fsm lchan_rtp_fsm;
@@ -154,8 +155,11 @@
lchan->mgw_endpoint_ci_bts = mgw_endpoint_ci_add(mgwep, "to-BTS");
- if (lchan->conn)
+ if (lchan->conn) {
crcx_info.call_id = lchan->conn->sccp.conn_id;
+ if (lchan->conn->sccp.msc)
+ crcx_info.x_osmo_ign = lchan->conn->sccp.msc->x_osmo_ign;
+ }
crcx_info.ptime = 20;
mgcp_pick_codec(&crcx_info, lchan, true);
diff --git a/src/osmo-bsc/osmo_bsc_sigtran.c b/src/osmo-bsc/osmo_bsc_sigtran.c
index 7e5f5f6..96f0687 100644
--- a/src/osmo-bsc/osmo_bsc_sigtran.c
+++ b/src/osmo-bsc/osmo_bsc_sigtran.c
@@ -35,6 +35,7 @@
#include <osmocom/bsc/gsm_04_80.h>
#include <osmocom/bsc/bsc_subscr_conn_fsm.h>
#include <osmocom/bsc/gsm_data.h>
+#include <osmocom/mgcp/mgcp_common.h>
/* A pointer to a list with all involved MSCs
* (a copy of the pointer location submitted with osmo_bsc_sigtran_init() */
@@ -496,6 +497,15 @@
if (!msc->a.sccp)
return -EINVAL;
+ /* In SCCPlite, the MSC side of the MGW endpoint is configured by the MSC. Since we have
+ * no way to figure out which CallID ('C:') the MSC will issue in its CRCX command, set
+ * an X-Osmo-IGN flag telling osmo-mgw to ignore CallID mismatches for this endpoint.
+ * If an explicit VTY command has already indicated whether or not to send X-Osmo-IGN, do
+ * not overwrite that setting. */
+ if (msc->a.asp_proto == OSMO_SS7_ASP_PROT_IPA
+ && !msc->x_osmo_ign_configured)
+ msc->x_osmo_ign |= MGCP_X_OSMO_IGN_CALLID;
+
/* If unset, use default local SCCP address */
if (!msc->a.bsc_addr.presence)
osmo_sccp_local_addr_by_instance(&msc->a.bsc_addr, msc->a.sccp,
diff --git a/src/osmo-bsc/osmo_bsc_vty.c b/src/osmo-bsc/osmo_bsc_vty.c
index efa12e0..f90ad6f 100644
--- a/src/osmo-bsc/osmo_bsc_vty.c
+++ b/src/osmo-bsc/osmo_bsc_vty.c
@@ -191,6 +191,13 @@
/* write MGW configuration */
mgcp_client_config_write(vty, " ");
+
+ if (msc->x_osmo_ign_configured) {
+ if (!msc->x_osmo_ign)
+ vty_out(vty, " no mgw x-osmo-ign%s", VTY_NEWLINE);
+ else
+ vty_out(vty, " mgw x-osmo-ign call-id%s", VTY_NEWLINE);
+ }
}
static int config_write_msc(struct vty *vty)
@@ -672,6 +679,35 @@
return CMD_SUCCESS;
}
+DEFUN(cfg_msc_mgw_x_osmo_ign,
+ cfg_msc_mgw_x_osmo_ign_cmd,
+ "mgw x-osmo-ign call-id",
+ MGCP_CLIENT_MGW_STR
+ "Set a (non-standard) X-Osmo-IGN header in all CRCX messages for RTP streams"
+ " associated with this MSC, useful for A/SCCPlite MSCs, since osmo-bsc cannot know"
+ " the MSC's chosen CallID. This is enabled by default for A/SCCPlite connections,"
+ " disabled by default for all others.\n"
+ "Send 'X-Osmo-IGN: C' to ignore CallID mismatches. See OsmoMGW.\n")
+{
+ struct bsc_msc_data *msc = bsc_msc_data(vty);
+ msc->x_osmo_ign |= MGCP_X_OSMO_IGN_CALLID;
+ msc->x_osmo_ign_configured = true;
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_msc_no_mgw_x_osmo_ign,
+ cfg_msc_no_mgw_x_osmo_ign_cmd,
+ "no mgw x-osmo-ign",
+ NO_STR
+ MGCP_CLIENT_MGW_STR
+ "Do not send X-Osmo-IGN MGCP header to this MSC\n")
+{
+ struct bsc_msc_data *msc = bsc_msc_data(vty);
+ msc->x_osmo_ign = 0;
+ msc->x_osmo_ign_configured = true;
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_net_bsc_mid_call_text,
cfg_net_bsc_mid_call_text_cmd,
"mid-call-text .TEXT",
@@ -983,6 +1019,8 @@
install_element(CFG_LOG_NODE, &logging_fltr_imsi_cmd);
mgcp_client_vty_init(net, MSC_NODE, net->mgw.conf);
+ install_element(MSC_NODE, &cfg_msc_mgw_x_osmo_ign_cmd);
+ install_element(MSC_NODE, &cfg_msc_no_mgw_x_osmo_ign_cmd);
return 0;
}