This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged.
Change subject: silent call: clarify rc and error messages logged on vty
......................................................................
silent call: clarify rc and error messages logged on vty
In gsm_silent_call_{start,stop}(), return meaningful error codes and interpret
them on the VTY to clearly indicate the result.
Change-Id: Id5abb8f2ba901689e03040af8e51483b6c618e7f
---
M src/libmsc/silent_call.c
M src/libmsc/vty_interface_layer3.c
2 files changed, 40 insertions(+), 17 deletions(-)
Approvals:
Harald Welte: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/libmsc/silent_call.c b/src/libmsc/silent_call.c
index f3291d7..1ea2305 100644
--- a/src/libmsc/silent_call.c
+++ b/src/libmsc/silent_call.c
@@ -30,6 +30,7 @@
#include <osmocom/msc/gsm_data.h>
#include <osmocom/msc/gsm_subscriber.h>
#include <osmocom/msc/osmo_msc.h>
+#include <osmocom/msc/vlr.h>
/* paging of the requested subscriber has completed */
static int paging_cb_silent(unsigned int hooknum, unsigned int event,
@@ -130,7 +131,9 @@
* A-interface. */
req = subscr_request_conn(vsub, paging_cb_silent, data,
"establish silent call");
- return req != NULL;
+ if (!req)
+ return -ENODEV;
+ return 0;
}
/* end a silent call with a given subscriber */
@@ -139,12 +142,18 @@
struct gsm_subscriber_connection *conn;
conn = connection_for_subscr(vsub);
- if (!conn)
- return -EINVAL;
+ if (!conn) {
+ LOGP(DMM, LOGL_ERROR, "%s: Cannot stop silent call, no connection for subscriber\n",
+ vlr_subscr_name(vsub));
+ return -ENODEV;
+ }
/* did we actually establish a silent call for this guy? */
- if (!conn->silent_call)
- return -EINVAL;
+ if (!conn->silent_call) {
+ LOGP(DMM, LOGL_ERROR, "%s: Cannot stop silent call, subscriber has no active silent call\n",
+ vlr_subscr_name(vsub));
+ return -ENOENT;
+ }
#if BEFORE_MSCSPLIT
/* Re-enable this log output once we can obtain this information via
diff --git a/src/libmsc/vty_interface_layer3.c b/src/libmsc/vty_interface_layer3.c
index 06a4267..05f5b63 100644
--- a/src/libmsc/vty_interface_layer3.c
+++ b/src/libmsc/vty_interface_layer3.c
@@ -524,16 +524,20 @@
type = RSL_CHANNEED_ANY; /* Defaults to ANY */
rc = gsm_silent_call_start(vsub, vty, type);
- if (rc <= 0) {
- vty_out(vty, "%% Subscriber not attached%s",
- VTY_NEWLINE);
- vlr_subscr_put(vsub);
- return CMD_WARNING;
+ switch (rc) {
+ case -ENODEV:
+ vty_out(vty, "%% Subscriber not attached%s", VTY_NEWLINE);
+ break;
+ default:
+ if (rc)
+ vty_out(vty, "%% Cannot start silent call (rc=%d)%s", rc, VTY_NEWLINE);
+ else
+ vty_out(vty, "%% Silent call initiated%s", VTY_NEWLINE);
+ break;
}
vlr_subscr_put(vsub);
-
- return CMD_SUCCESS;
+ return rc ? CMD_WARNING : CMD_SUCCESS;
}
DEFUN(subscriber_silent_call_stop,
@@ -553,14 +557,24 @@
}
rc = gsm_silent_call_stop(vsub);
- if (rc < 0) {
- vlr_subscr_put(vsub);
- return CMD_WARNING;
+ switch (rc) {
+ case -ENODEV:
+ vty_out(vty, "%% No active connection for subscriber%s", VTY_NEWLINE);
+ break;
+ case -ENOENT:
+ vty_out(vty, "%% Subscriber has no silent call active%s",
+ VTY_NEWLINE);
+ break;
+ default:
+ if (rc)
+ vty_out(vty, "%% Cannot stop silent call (rc=%d)%s", rc, VTY_NEWLINE);
+ else
+ vty_out(vty, "%% Silent call stopped%s", VTY_NEWLINE);
+ break;
}
vlr_subscr_put(vsub);
-
- return CMD_SUCCESS;
+ return rc ? CMD_WARNING : CMD_SUCCESS;
}
DEFUN(subscriber_ussd_notify,
--
To view, visit https://gerrit.osmocom.org/7181
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id5abb8f2ba901689e03040af8e51483b6c618e7f
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder