SMS over GSUP: correctly route GSUP responses to MT SMS
When OsmoMSC is used with OsmoHLR rather than a GSUP-to-MAP gateway, MT-forwardSM.req GSUP messages delivering MT SMS will be coming from a separate SMSC relayed via OsmoHLR, rather than from OsmoHLR itself. When we reply to these messages, in order for these replies to reach the MT-sending SMSC via OsmoHLR, we need to save source_name from the request and regurgitate it into destination_name in our response messages. Implement this logic. Related: OS#6135 Change-Id: I436e333035b8f6e27f86a49fe293ea48ea07a013
This commit is contained in:
parent
8de4ea6567
commit
02c49373f3
|
@ -28,7 +28,8 @@ int gsm411_send_sms(struct gsm_network *net,
|
|||
int gsm411_send_rp_data(struct gsm_network *net, struct vlr_subscr *vsub,
|
||||
size_t sm_rp_oa_len, const uint8_t *sm_rp_oa,
|
||||
size_t sm_rp_ud_len, const uint8_t *sm_rp_ud,
|
||||
bool sm_rp_mmts_ind);
|
||||
bool sm_rp_mmts_ind, const uint8_t *gsup_source_name,
|
||||
size_t gsup_source_name_len);
|
||||
|
||||
void gsm411_sapi_n_reject(struct msc_a *msc_a);
|
||||
|
||||
|
|
|
@ -149,6 +149,9 @@ struct gsm_trans {
|
|||
bool sm_rp_mmts_ind;
|
||||
|
||||
struct gsm_sms *sms;
|
||||
|
||||
uint8_t *gsup_source_name;
|
||||
size_t gsup_source_name_len;
|
||||
} sms;
|
||||
struct {
|
||||
/**
|
||||
|
|
|
@ -1230,7 +1230,8 @@ int gsm411_send_sms(struct gsm_network *net,
|
|||
int gsm411_send_rp_data(struct gsm_network *net, struct vlr_subscr *vsub,
|
||||
size_t sm_rp_oa_len, const uint8_t *sm_rp_oa,
|
||||
size_t sm_rp_ud_len, const uint8_t *sm_rp_ud,
|
||||
bool sm_rp_mmts_ind)
|
||||
bool sm_rp_mmts_ind, const uint8_t *gsup_source_name,
|
||||
size_t gsup_source_name_len)
|
||||
{
|
||||
struct gsm_trans *trans;
|
||||
struct msgb *msg;
|
||||
|
@ -1245,6 +1246,17 @@ int gsm411_send_rp_data(struct gsm_network *net, struct vlr_subscr *vsub,
|
|||
if (trans->msc_a != NULL)
|
||||
gsm411_handle_mmts_ind(trans);
|
||||
|
||||
/* Save GSUP source_name for subsequent response messages */
|
||||
if (gsup_source_name && gsup_source_name_len) {
|
||||
trans->sms.gsup_source_name = talloc_memdup(trans, gsup_source_name,
|
||||
gsup_source_name_len);
|
||||
if (!trans->sms.gsup_source_name) {
|
||||
trans_free(trans);
|
||||
return -ENOMEM;
|
||||
}
|
||||
trans->sms.gsup_source_name_len = gsup_source_name_len;
|
||||
}
|
||||
|
||||
/* Allocate a message buffer for to be encoded SMS */
|
||||
msg = gsm411_msgb_alloc();
|
||||
if (!msg) {
|
||||
|
|
|
@ -198,6 +198,10 @@ int gsm411_gsup_mt_fwd_sm_res(struct gsm_trans *trans, uint8_t sm_rp_mr)
|
|||
gsup_sm_msg_init(&gsup_msg, OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT,
|
||||
trans->vsub->imsi, &sm_rp_mr);
|
||||
|
||||
/* Ensure routing through OsmoHLR to the MT-sending SMSC */
|
||||
gsup_msg.destination_name = trans->sms.gsup_source_name;
|
||||
gsup_msg.destination_name_len = trans->sms.gsup_source_name_len;
|
||||
|
||||
return gsup_client_mux_tx(trans->net->gcm, &gsup_msg);
|
||||
}
|
||||
|
||||
|
@ -215,6 +219,10 @@ int gsm411_gsup_mt_fwd_sm_err(struct gsm_trans *trans,
|
|||
gsup_sm_msg_init(&gsup_msg, OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR,
|
||||
trans->vsub->imsi, &sm_rp_mr);
|
||||
|
||||
/* Ensure routing through OsmoHLR to the MT-sending SMSC */
|
||||
gsup_msg.destination_name = trans->sms.gsup_source_name;
|
||||
gsup_msg.destination_name_len = trans->sms.gsup_source_name_len;
|
||||
|
||||
/* SM-RP-Cause value */
|
||||
gsup_msg.sm_rp_cause = &cause;
|
||||
|
||||
|
@ -259,7 +267,8 @@ static int gsm411_gsup_mt_handler(struct gsm_network *net, struct vlr_subscr *vs
|
|||
rc = gsm411_send_rp_data(net, vsub,
|
||||
gsup_msg->sm_rp_oa_len, gsup_msg->sm_rp_oa,
|
||||
gsup_msg->sm_rp_ui_len, gsup_msg->sm_rp_ui,
|
||||
sm_rp_mmts_ind);
|
||||
sm_rp_mmts_ind, gsup_msg->source_name,
|
||||
gsup_msg->source_name_len);
|
||||
if (rc) {
|
||||
LOGP(DLSMS, LOGL_NOTICE, "Failed to send MT SMS, "
|
||||
"ignoring MT-forwardSM-Req message...\n");
|
||||
|
|
Loading…
Reference in New Issue