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
This commit is contained in:
parent
cd31f7a34f
commit
6d28981912
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue