diff options
authorStefan Sperling <ssperling@sysmocom.de>2018-01-30 12:15:40 +0100
committerStefan Sperling <ssperling@sysmocom.de>2018-01-30 12:15:40 +0100
commit979cde0338367a9ae17b68a85d5c19ec19db7bf7 (patch)
parent327c2f5beb90c4642b979fb6117856fd2a2d0d8d (diff)
Make sending an SMS to an unknown subscriber B work over SMPP.stsp/smpp_store_sms
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
1 files changed, 9 insertions, 3 deletions
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 @@ 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,
(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,
@@ -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);
@@ -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;