Change in ...osmo-msc[master]: Implements a global switch on the network to disable call waiting.

keith gerrit-no-reply at lists.osmocom.org
Thu Aug 8 13:55:41 UTC 2019


keith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-msc/+/15120


Change subject: Implements a global switch on the network to disable call waiting.
......................................................................

Implements a global switch on the network to disable call waiting.

Add a network -> callwaiting VTY command as boolean.

When this is enabled (default) there is no change to
operation previous to this commit.

When this switch is disabled with "no callwaiting" in vty
then when a call arrives, we will check if we have an active
call transaction for this subscriber, no matter if it is
establishing, established, or alerting, in any of these cases we
will return USER BUSY to the calling party.

The intention of this patch is for a production network
to remove some of the slightly unpredictable behaviour
of call waiting.

Change-Id: I3eb6f23f7103e3002874fb5d3a30c9de952202ae
---
M include/osmocom/msc/gsm_data.h
M include/osmocom/msc/transaction.h
M src/libmsc/gsm_04_08_cc.c
M src/libmsc/msc_vty.c
M src/libmsc/transaction.c
M src/osmo-msc/msc_main.c
6 files changed, 69 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/20/15120/1

diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index e926b3f..e0d6a6c 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -253,6 +253,9 @@
 
 	/* Whether we want to use Osmux against BSCs. Controlled via VTY */
 	enum osmux_usage use_osmux;
+
+	/* Whether to use call waiting on the network */
+	uint8_t callwaiting;
 };
 
 struct osmo_esme;
diff --git a/include/osmocom/msc/transaction.h b/include/osmocom/msc/transaction.h
index 69cd652..b173f31 100644
--- a/include/osmocom/msc/transaction.h
+++ b/include/osmocom/msc/transaction.h
@@ -138,7 +138,8 @@
 };
 
 
-
+struct gsm_trans *trans_find_cc_by_vsub(const struct gsm_network *net,
+					struct vlr_subscr *vsub);
 struct gsm_trans *trans_find_by_type(const struct msc_a *msc_a, enum trans_type type);
 struct gsm_trans *trans_find_by_id(const struct msc_a *msc_a,
 				   enum trans_type type, uint8_t trans_id);
diff --git a/src/libmsc/gsm_04_08_cc.c b/src/libmsc/gsm_04_08_cc.c
index 03830de..37d0a07 100644
--- a/src/libmsc/gsm_04_08_cc.c
+++ b/src/libmsc/gsm_04_08_cc.c
@@ -1803,6 +1803,7 @@
 	int i, rc = 0;
 	struct msc_a *msc_a = NULL;
 	struct gsm_trans *trans = NULL;
+	struct gsm_trans *_trans = NULL;
 	const struct gsm_mncc *data;
 
 	/* handle special messages */
@@ -1874,6 +1875,21 @@
 		/* update the subscriber we deal with */
 		log_set_context(LOG_CTX_VLR_SUBSCR, vsub);
 
+		/* If subscriber is BUSY and we do not DO call in call or "call-waiting" */
+		if (!net->callwaiting) {
+			_trans = trans_find_cc_by_vsub(net, vsub);
+			if (_trans && _trans->cc.state != GSM_CSTATE_NULL) {
+				LOG_TRANS_CAT(_trans, DCC, LOGL_NOTICE,
+					      "rx '%s' for subscriber %s with trans state %d (%s)"
+					      " rejecting with USER_BUSY\n",
+					get_mncc_name(msg->msg_type), data->called.number,
+					_trans->cc.state,
+					gsm48_cc_state_name(_trans->cc.state));
+				return mncc_release_ind(net, NULL, data->callref,
+							GSM48_CAUSE_LOC_PRN_S_LU,
+							GSM48_CC_CAUSE_USER_BUSY);
+			}
+		}
 		/* If subscriber is not "attached" */
 		if (!vsub->lu_complete) {
 			LOG_TRANS_CAT(trans, DCC, LOGL_ERROR, "rx %s for subscriber that is not attached: %s\n",
diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c
index 5bf9701..13b9687 100644
--- a/src/libmsc/msc_vty.c
+++ b/src/libmsc/msc_vty.c
@@ -292,6 +292,29 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(cfg_net_call_wait, cfg_net_call_wait_cmd,
+      "callwaiting",
+      "Enable Call Waiting on the Network\n")
+{
+	struct gsm_network *net = vty->index;
+
+	net->callwaiting = true;
+
+	return CMD_SUCCESS;
+}
+
+DEFUN(cfg_net_no_call_wait, cfg_net_no_call_wait_cmd,
+      "no callwaiting",
+      NO_STR
+      "Disable Call Waiting on the Network\n")
+{
+	struct gsm_network *net = vty->index;
+
+	net->callwaiting = false;
+
+	return CMD_SUCCESS;
+}
+
 static int config_write_net(struct vty *vty)
 {
 	int i;
@@ -333,6 +356,11 @@
 			gsmnet->emergency.route_to_msisdn, VTY_NEWLINE);
 	}
 
+	if (gsmnet->callwaiting)
+		vty_out(vty, " callwaiting%s", VTY_NEWLINE);
+	else
+		vty_out(vty, " no callwaiting%s", VTY_NEWLINE);
+
 	return CMD_SUCCESS;
 }
 
@@ -1902,6 +1930,8 @@
 	install_element(GSMNET_NODE, &cfg_net_no_timezone_cmd);
 	install_element(GSMNET_NODE, &cfg_net_per_loc_upd_cmd);
 	install_element(GSMNET_NODE, &cfg_net_no_per_loc_upd_cmd);
+	install_element(GSMNET_NODE, &cfg_net_call_wait_cmd);
+	install_element(GSMNET_NODE, &cfg_net_no_call_wait_cmd);
 
 	install_element(CONFIG_NODE, &cfg_msc_cmd);
 	install_node(&msc_node, config_write_msc);
diff --git a/src/libmsc/transaction.c b/src/libmsc/transaction.c
index ebdaced..8ffb0d7 100644
--- a/src/libmsc/transaction.c
+++ b/src/libmsc/transaction.c
@@ -36,6 +36,23 @@
 void _gsm411_sms_trans_free(struct gsm_trans *trans);
 void _gsm911_nc_ss_trans_free(struct gsm_trans *trans);
 
+/*! Find a Call Control transaction by Subscriber
+ * \param[in] net Network in which we should search
+ * \param[in] vsub subscriber to match
+ * \returns Matching transaction, if any
+ */
+struct gsm_trans *trans_find_cc_by_vsub(const struct gsm_network *net,
+					struct vlr_subscr *vsub)
+{
+	struct gsm_trans *trans;
+
+	llist_for_each_entry(trans, &net->trans_list, entry) {
+		if (trans->vsub == vsub && trans->cc.state > 0)
+			return trans;
+	}
+	return NULL;
+}
+
 struct gsm_trans *trans_find_by_type(const struct msc_a *msc_a, enum trans_type type)
 {
 	struct gsm_trans *trans;
diff --git a/src/osmo-msc/msc_main.c b/src/osmo-msc/msc_main.c
index 1083271..1a1b05b 100644
--- a/src/osmo-msc/msc_main.c
+++ b/src/osmo-msc/msc_main.c
@@ -216,6 +216,7 @@
 
 	mgcp_client_conf_init(&net->mgw.conf);
 	net->mgw.tdefs = g_mgw_tdefs;
+	net->callwaiting = true;
 
 	return net;
 }

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/15120
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I3eb6f23f7103e3002874fb5d3a30c9de952202ae
Gerrit-Change-Number: 15120
Gerrit-PatchSet: 1
Gerrit-Owner: keith <keith at rhizomatica.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190808/3783be51/attachment.html>


More information about the gerrit-log mailing list