fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-msc/+/36863?usp=email )
Change subject: [WIP] libvlr: proper handling of the MNRF and sending of readyForSM ......................................................................
[WIP] libvlr: proper handling of the MNRF and sending of readyForSM
This is an early, non-working attempt to implement proper handing of the MNRF (MS Not Reachable Flag) and sending of the readyForSM primitive (reason=MS_PRESENT) to the SMSC.
Change-Id: Idbb3c6e9a33ca0ff3e157dd6250bee600631b4bb --- M src/libmsc/gsm_04_11.c M src/libmsc/gsm_04_11_gsup.c M src/libvlr/vlr_lu_fsm.c 3 files changed, 44 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/63/36863/1
diff --git a/src/libmsc/gsm_04_11.c b/src/libmsc/gsm_04_11.c index 11b3a02..3cd4a60 100644 --- a/src/libmsc/gsm_04_11.c +++ b/src/libmsc/gsm_04_11.c @@ -182,6 +182,10 @@ sms_free(sms); }
+ /* Set the MNRF to trigger sending readyForSM */ + if (trans->vsub != NULL) + trans->vsub->ms_not_reachable_flag = true; + /* Destroy this transaction */ trans_free(trans); } diff --git a/src/libmsc/gsm_04_11_gsup.c b/src/libmsc/gsm_04_11_gsup.c index 328d047..39dd784 100644 --- a/src/libmsc/gsm_04_11_gsup.c +++ b/src/libmsc/gsm_04_11_gsup.c @@ -155,6 +155,18 @@ if (msg_is_err && !gsup_msg->sm_rp_cause) goto msg_error;
+#if 0 + /* XXX: maybe include tthe .sm_alert_rsn == OSMO_GSUP_SMS_SM_ALERT_RSN_MS_PRESENT? */ + if (*(gsup_msg->sm_rp_mr) == 0xff) { + if (vsub->sub_pres_vlr_fsm != NULL) { /* XXX: no such field */ + osmo_fsm_inst_dispatch(vsub->sub_pres_vlr_fsm, + msg_is_err ? SUB_PRES_VLR_E_READY_SM_ERR + : SUB_PRES_VLR_E_READY_SM_CNF, NULL); + } + return 0; + } +#endif + /* Attempt to find DTAP-transaction */ trans = trans_find_by_sm_rp_mr(net, vsub, *(gsup_msg->sm_rp_mr)); if (!trans) { diff --git a/src/libvlr/vlr_lu_fsm.c b/src/libvlr/vlr_lu_fsm.c index 5d8f78b..475fdcd 100644 --- a/src/libvlr/vlr_lu_fsm.c +++ b/src/libvlr/vlr_lu_fsm.c @@ -215,7 +215,19 @@ osmo_fsm_inst_term(fi, OSMO_FSM_TERM_REGULAR, NULL); return; } - /* FIXME: Send READY_FOR_SM via GSUP */ + +#if 0 + /* XXX: assuming SMS-over-GSUP and no built-in SMSC */ + struct osmo_gsup_message gsup_msg = { + .message_class = OSMO_GSUP_MESSAGE_CLASS_SMS, + .message_type = OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST, + .sm_alert_rsn = OSMO_GSUP_SMS_SM_ALERT_RSN_MS_PRESENT, + .sm_rp_mr = 0xff, + }; + OSMO_STRLCPY_ARRAY(gsup_msg->imsi, vsub->imsi); + gsup_client_mux_tx(vsub->vlr->gcm, &gsup_msg); +#endif + osmo_fsm_inst_state_chg(fi, SUB_PRES_VLR_S_WAIT_FOR_HLR, LU_TIMEOUT_LONG, 0); } @@ -272,9 +284,8 @@ return (struct vlr_subscr*)fi->priv; }
-/* THIS IS CURRENTLY DEAD CODE, SINCE WE NEVER SET vsub->ms_not_reachable_flag = true. - * - * Note that the start event is dispatched right away, so in case the FSM immediately concludes from that + +/* Note that the start event is dispatched right away, so in case the FSM immediately concludes from that * event, the created FSM struct may no longer be valid as it already deallocated again, and it may * furthermore already have invoked the parent FSM instance's deallocation as well. Hence, instead of * returning, store the created FSM instance address in *fi_p before dispatching the event. It is thus