diff options
author | Stefan Sperling <ssperling@sysmocom.de> | 2018-01-30 12:15:40 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-01-31 19:49:48 +0000 |
commit | 6d28981912d90cb37b43f850710bc7674106542e (patch) | |
tree | be6d255822b00ca108a83bc2a833f8ae0801dd5b | |
parent | cd31f7a34f196bf7dd36915c8cf86f1b1e6d2641 (diff) |
Make sending an SMS to an unknown subscriber B work over SMPP.
Make the submit_to_sms() funcion aware of the message mode. If the
message does not require real-time "transactional/forward mode" we
can store it in the SMS database even if subscriber B cannot be
found in the VLR at this point in time.
This should should make the esme_ms_sms_storeforward test in
osmo-gsm-tester pass (a tweak to this test's expectations will
be needed as well, because the test currently assumes that an
invalid phone number for subscriber B will fail immediately,
rather than cause the message to eventually expire).
Change-Id: Ic3d78919568ad9252b4d19c3ddab5068d1c52db2
Related: OS#2354
-rw-r--r-- | src/libmsc/smpp_openbsc.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/libmsc/smpp_openbsc.c b/src/libmsc/smpp_openbsc.c index 4e2fb556a..b0469f929 100644 --- a/src/libmsc/smpp_openbsc.c +++ b/src/libmsc/smpp_openbsc.c @@ -99,11 +99,12 @@ static int submit_to_sms(struct gsm_sms **psms, struct gsm_network *net, struct gsm_sms *sms; struct tlv_t *t; int mode; + int can_store_sms = ((submit->esm_class & SMPP34_MSG_MODE_MASK) != 2); /* != forward mode */ dest = subscr_by_dst(net, submit->dest_addr_npi, submit->dest_addr_ton, (const char *)submit->destination_addr); - if (!dest) { + if (!dest && !can_store_sms) { LOGP(DLSMS, LOGL_NOTICE, "SMPP SUBMIT-SM for unknown subscriber: " "%s (NPI=%u)\n", submit->destination_addr, submit->dest_addr_npi); @@ -115,7 +116,8 @@ static int submit_to_sms(struct gsm_sms **psms, struct gsm_network *net, case TLVID_message_payload: if (smpp34_submit_tlv_msg_payload(t, submit, &sms_msg, &sms_msg_len) < 0) { - vlr_subscr_put(dest); + if (dest) + vlr_subscr_put(dest); return ESME_ROPTPARNOTALLWD; } break; @@ -149,7 +151,11 @@ static int submit_to_sms(struct gsm_sms **psms, struct gsm_network *net, sms->receiver = dest; sms->dst.ton = submit->dest_addr_ton; sms->dst.npi = submit->dest_addr_npi; - osmo_strlcpy(sms->dst.addr, dest->msisdn, sizeof(sms->dst.addr)); + if (dest) + osmo_strlcpy(sms->dst.addr, dest->msisdn, sizeof(sms->dst.addr)); + else + osmo_strlcpy(sms->dst.addr, (const char *)submit->destination_addr, + sizeof(sms->dst.addr)); /* fill in the source address */ sms->src.ton = submit->source_addr_ton; |