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
diff --git a/src/libmsc/smpp_openbsc.c b/src/libmsc/smpp_openbsc.c
index 4e2fb55..b0469f9 100644
--- a/src/libmsc/smpp_openbsc.c
+++ b/src/libmsc/smpp_openbsc.c
@@ -99,11 +99,12 @@
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 @@
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 @@
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;