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

The SMPP transport should look for PDU params to detect delivery reports #637

Merged
merged 6 commits into from
Oct 31, 2013

Conversation

jerith
Copy link
Member

@jerith jerith commented Oct 28, 2013

The SMPP spec mentions receipted_message_id and message_state optional params in a deliver_sm PDU. Not all the SMSCs we talk to use these, but they're more likely to be authoritative and correct if they're present and we should use the content regex as a (possibly optional) fallback.

@@ -317,6 +317,25 @@ def handle_deliver_sm(self, pdu):
pdu_params = pdu['body']['mandatory_parameters']
pdu_opts = unpacked_pdu_opts(pdu)

# This might be a delivery report with PDU parameters.
receipted_message_id = pdu_opts.get('receipted_message_id', None)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we get a note here about the regex fallback lower down?

@hodgestar
Copy link
Contributor

Reviewed.

@hodgestar
Copy link
Contributor

👍

@jerith jerith merged commit 524f804 into develop Oct 31, 2013
@jerith jerith deleted the feature/issue-637-smpp-delivery-receipt-params branch October 31, 2013 11:08
komuw added a commit to komuw/naz that referenced this pull request Feb 9, 2019
What:
- Fix a bug of correlation between `submit_sm_resp` and `deliver_sm`

Why:
- The way `naz` was handling correlations was:
    - when sending `submit_sm` we save the `sequence_number`
    - when we get `submit_sm_resp` we use its `sequence_number` and look it up from Correlater  
    - when we get a `deliver_sm` request, we use its `sequence_number` and look it up from Correlater

    The way `naz` now does it after the fix is;
    - when sending `submit_sm` we save the `sequence_number`
    - when we get `submit_sm_resp` we lookup `sequence_number` and use it for correlation
    - Additionally, `submit_sm_resp` has a `message_id` in the body. This is the SMSC message ID of the submitted message.
    - We take this `message_id` and save it.
    - when we get a `deliver_sm` request, it includes a `receipted_message_id` in the optional body parameters.
    - we get that `receipted_message_id` and use it to lookup from where we had saved the one from `submit_sm_resp`

- This implementation is not without fault; as before Correlation is still on a best effort.
   We are using `receipted_message_id` to correlate `submit_sm_resp` and `deliver_sm`; 
   However, `receipted_message_id` is an optional tag that SMSC can omit; and they do omit[1][2][3]

- fixes: #97

References:
1. opentelecoms-org/jsmpp#62
2. praekeltfoundation/vumi#298
3. praekeltfoundation/vumi#637
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants