fixeria has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-msc/+/39952?usp=email )
Change subject: SMS-over-GSUP: send network-originated MT-forwardSM-Err
......................................................................
SMS-over-GSUP: send network-originated MT-forwardSM-Err
When SMS-over-GSUP is enabled, there's currently no indication of
failed MT SMS delivery due to paging timeout or connection issues.
In such cases, the SMSC that initiated the MT-forwardSM-Req receives
no response at all. This leaves the SMSC with no clear criterion
for retrying delivery other than a generic timeout.
So far, MT-forwardSM-Err was only sent when the MS/UE explicitly
indicated an error (via RP-ERROR). This patch extends its use to
also cover situations where no RP-ACK or RP-ERROR is received,
allowing the network to notify the SMSC of delivery failure
due to lower-layer issues.
The key difference between the MS/UE-originated and network-originated
MT-forwardSM-Err messages is presence/absence of the following IEs:
* SM-RP-Cause IE -- indicated by the MS/UE,
* Cause IE -- indicated by the network.
Either of these IEs shall always be present.
Change-Id: I51d92752471147e6d21a5059bebb0702b32642a5
Related: osmo-ttcn3-hacks.git Ief16753783e044911f1e3cef8d7012810d709e61
Related: osmo-ttcn3-hacks.git Ic27d943645fdff8d34f958e3bf16c8ee6e8368d2
Related: SYS#7323
---
M include/osmocom/msc/gsm_04_11_gsup.h
M include/osmocom/msc/transaction.h
M src/libmsc/gsm_04_11.c
M src/libmsc/gsm_04_11_gsup.c
4 files changed, 43 insertions(+), 8 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/52/39952/1
diff --git a/include/osmocom/msc/gsm_04_11_gsup.h b/include/osmocom/msc/gsm_04_11_gsup.h
index 9c8c7cf..602f9dc 100644
--- a/include/osmocom/msc/gsm_04_11_gsup.h
+++ b/include/osmocom/msc/gsm_04_11_gsup.h
@@ -14,6 +14,9 @@
int gsm411_gsup_mt_fwd_sm_res(struct gsm_trans *trans, uint8_t sm_rp_mr, const uint8_t
*ui_buf, uint8_t ui_len);
int gsm411_gsup_mt_fwd_sm_err(struct gsm_trans *trans,
- uint8_t sm_rp_mr, uint8_t cause, const uint8_t *ui_buf, uint8_t ui_len);
+ uint8_t sm_rp_mr,
+ const int *net_cause,
+ const uint8_t *sm_rp_cause,
+ const uint8_t *ui_buf, uint8_t ui_len);
int gsm411_gsup_rx(struct gsup_client_mux *gcm, void *data, const struct
osmo_gsup_message *gsup_msg);
diff --git a/include/osmocom/msc/transaction.h b/include/osmocom/msc/transaction.h
index aa529e4..f891d2c 100644
--- a/include/osmocom/msc/transaction.h
+++ b/include/osmocom/msc/transaction.h
@@ -152,6 +152,7 @@
uint8_t *gsup_source_name;
size_t gsup_source_name_len;
+ bool gsup_rsp_pending;
} sms;
struct {
/**
diff --git a/src/libmsc/gsm_04_11.c b/src/libmsc/gsm_04_11.c
index 209ca28..d45f1ea 100644
--- a/src/libmsc/gsm_04_11.c
+++ b/src/libmsc/gsm_04_11.c
@@ -43,6 +43,7 @@
#include <osmocom/gsm/gsm0411_utils.h>
#include <osmocom/gsm/protocol/gsm_04_11.h>
#include <osmocom/gsm/protocol/gsm_03_40.h>
+#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
#include <osmocom/msc/debug.h>
#include <osmocom/msc/gsm_data.h>
@@ -935,7 +936,11 @@
ui_buf = &(rph->data[ui_buf_idx]);
}
- return gsm411_gsup_mt_fwd_sm_err(trans, rph->msg_ref, cause, ui_buf, ui_len);
+ return gsm411_gsup_mt_fwd_sm_err(trans,
+ rph->msg_ref,
+ NULL, /* Cause (not indicated by network) */
+ &cause, /* SM-RP-Cause (indicated by MS/UE) */
+ ui_buf, ui_len);
}
if (!sms) {
@@ -1284,6 +1289,7 @@
{
struct gsm_trans *trans;
struct msgb *msg;
+ int rc;
/* Allocate a new transaction for MT SMS */
trans = gsm411_alloc_mt_trans(net, vsub);
@@ -1325,9 +1331,13 @@
/* FIXME: MT SMS is not guaranteed to be delivered (e.g. the MS may be detached) */
rate_ctr_inc(rate_ctr_group_get_ctr(net->msc_ctrs, MSC_CTR_SMS_DELIVERED));
- return gsm411_rp_sendmsg(&trans->sms.smr_inst, msg,
- GSM411_MT_RP_DATA_MT, trans->sms.sm_rp_mr,
- GSM411_SM_RL_DATA_REQ);
+ rc = gsm411_rp_sendmsg(&trans->sms.smr_inst, msg,
+ GSM411_MT_RP_DATA_MT,
+ trans->sms.sm_rp_mr,
+ GSM411_SM_RL_DATA_REQ);
+ if (rc == 0)
+ trans->sms.gsup_rsp_pending = true;
+ return rc;
}
/* Entry point for incoming GSM48_PDISC_SMS from abis_rsl.c */
@@ -1435,6 +1445,17 @@
sms_free(trans->sms.sms);
trans->sms.sms = NULL;
}
+
+ if (trans->net->sms_over_gsup) {
+ if (trans->sms.gsup_rsp_pending) {
+ const int net_cause = GMM_CAUSE_NET_FAIL;
+ gsm411_gsup_mt_fwd_sm_err(trans,
+ trans->sms.sm_rp_mr,
+ &net_cause, /* Cause IE (indicated by network) */
+ NULL, /* SM-RP-Cause (not indicated by MS/UE) */
+ NULL, 0 /* SM-RP-UI */);
+ }
+ }
}
/* Process incoming SAPI N-REJECT from BSC */
diff --git a/src/libmsc/gsm_04_11_gsup.c b/src/libmsc/gsm_04_11_gsup.c
index 4dcc302..0acd688 100644
--- a/src/libmsc/gsm_04_11_gsup.c
+++ b/src/libmsc/gsm_04_11_gsup.c
@@ -208,11 +208,16 @@
gsup_msg.sm_rp_ui = ui_buf;
}
+ trans->sms.gsup_rsp_pending = false;
+
return gsup_client_mux_tx(trans->net->gcm, &gsup_msg);
}
int gsm411_gsup_mt_fwd_sm_err(struct gsm_trans *trans,
- uint8_t sm_rp_mr, uint8_t cause, const uint8_t *ui_buf, uint8_t ui_len)
+ uint8_t sm_rp_mr,
+ const int *net_cause, /* indicated by network, may be NULL */
+ const uint8_t *sm_rp_cause, /* indicated by MS/UE, may be NULL */
+ const uint8_t *ui_buf, uint8_t ui_len)
{
struct osmo_gsup_message gsup_msg;
@@ -230,8 +235,11 @@
gsup_msg.destination_name_len = trans->sms.gsup_source_name_len;
gsup_client_mux_tx_set_source(trans->net->gcm, &gsup_msg);
- /* SM-RP-Cause value */
- gsup_msg.sm_rp_cause = &cause;
+ /* SM-RP-Cause IE value (indicated by MS/UE) */
+ gsup_msg.sm_rp_cause = sm_rp_cause;
+ /* Cause IE value (indicated by network) */
+ if (net_cause != NULL)
+ gsup_msg.cause = (enum gsm48_gmm_cause)(*net_cause);
/* include optional SM-RP-UI field if present */
if (ui_len) {
@@ -239,6 +247,8 @@
gsup_msg.sm_rp_ui = ui_buf;
}
+ trans->sms.gsup_rsp_pending = false;
+
return gsup_client_mux_tx(trans->net->gcm, &gsup_msg);
}
--
To view, visit
https://gerrit.osmocom.org/c/osmo-msc/+/39952?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I51d92752471147e6d21a5059bebb0702b32642a5
Gerrit-Change-Number: 39952
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>