Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup SMPP Message ID correlation for messages waiting for DLR #2965

Merged
merged 16 commits into from Jun 12, 2018

Conversation

hrosa
Copy link
Contributor

@hrosa hrosa commented Jun 7, 2018

What this PR does / why we need it:

Enforces uniqueness in such way that no more than one SMS Message becomes correlated to the same SMPP Message ID.

Which issue(s) this PR fixes:
Fixes BS-232

Special notes for your reviewer:
none

Copy link

@maria-farooq maria-farooq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we lack coverage in this PR. we can add a unit test to verify that on reception of dlr query is working as expected similar to what we did for submit_sm_response case

private List<String> accountSidSet; // if not-null we need the cdrs that belong to several accounts
private String recipient;
private String sender;
private String startTime; // to initialize it pass string arguments with yyyy-MM-dd format

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what was the reason to change the type from Date to String

Copy link
Contributor Author

@hrosa hrosa Jun 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as the filter is concerned, the date is a String with some date-like pattern.
If you check the new builder, it accepts a Date which is internally parsed to the desired format. IMO much cleaner and avoids parsing exception when building these objects.

AND "date_created" &lt;= DATE_ADD(#{endTime},INTERVAL 1 DAY)
AND "date_created" &lt;= DATE_ADD(#{endTime},INTERVAL 1 DAY)
</if>
<if test="smppMessageId != null">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to make this change for sms-messages.xml files in restcomm.application module as they are the ones that are packaged and used on production

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, agree

@hrosa hrosa changed the title WIP: Cleanup SMPP Message ID correlation for messages older than three days Cleanup SMPP Message ID correlation for messages older than three days Jun 11, 2018
@@ -53,4 +54,6 @@
// Support for filtering of message list result, Issue 1395
Integer getTotalSmsMessage(SmsMessageFilter filter);
List<SmsMessage> getSmsMessages(SmsMessageFilter filter);

List<SmsMessage> findBySmppMessageIdAndDateCreatedGreaterOrEqualThanOrderedByDateCreatedDesc(String smppMessageId, DateTime startDate);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

// Find all messages correlated with SMPP Message ID in last three days
final List<SmsMessage> smsMessages = this.storage.getSmsMessagesDao().findBySmppMessageIdAndDateCreatedGreaterOrEqualThanOrderedByDateCreatedDesc(smppMessageId, DateTime.now().minusDays(3));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i thought we agreed this query was actually for SubmitResponse part, not DLR

} else {
// Clean correlation to SMPP Message ID because SMPP identifiers are may repeat after a given time frame
smsMessagesDao.updateSmsMessage(smsMessage.setSmppMessageId(null).setStatus(dLRPayload.getStat()));
for (int index = 0; index < smsCount; index++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for this consistency check, i thought it was for submit Resp

@hrosa hrosa changed the title Cleanup SMPP Message ID correlation for messages older than three days Cleanup SMPP Message ID correlation for messages waiting for DLR Jun 12, 2018
@hrosa hrosa dismissed maria-farooq’s stale review June 12, 2018 08:58

changes have been taken care of

@hrosa hrosa merged commit a970aa5 into fix/bs-180 Jun 12, 2018
@hrosa hrosa deleted the bs-232 branch June 12, 2018 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants