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

Moved setting DLR mas from HTTP request before interception is done. #1159

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 32 additions & 35 deletions jasmin/protocols/http/endpoints/send.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,38 @@ def route_routable(self, updated_request):
routable.addTag(tag)
self.log.debug('Tagged routable %s: +%s', routable, tag)

# Set DLR bit mask on the last pdu
_last_pdu = routable.pdu
while hasattr(_last_pdu, 'nextPdu'):
_last_pdu = _last_pdu.nextPdu
# DLR setting is clearly described in #107
_last_pdu.params['registered_delivery'] = RegisteredDelivery(
RegisteredDeliveryReceipt.NO_SMSC_DELIVERY_RECEIPT_REQUESTED)
if updated_request.args[b'dlr'][0] == b'yes':
_last_pdu.params['registered_delivery'] = RegisteredDelivery(
RegisteredDeliveryReceipt.SMSC_DELIVERY_RECEIPT_REQUESTED)
self.log.debug(
"SubmitSmPDU registered_delivery is set to %s",
str(_last_pdu.params['registered_delivery']))

dlr_level = int(updated_request.args[b'dlr-level'][0])
if b'dlr-url' in updated_request.args:
dlr_url = updated_request.args[b'dlr-url'][0]
else:
dlr_url = None
if updated_request.args[b'dlr-level'][0] == b'1':
dlr_level_text = 'SMS-C'
elif updated_request.args[b'dlr-level'][0] == b'2':
dlr_level_text = 'Terminal'
else:
dlr_level_text = 'All'
dlr_method = updated_request.args[b'dlr-method'][0]
else:
dlr_url = None
dlr_level = 0
dlr_level_text = 'No'
dlr_method = None

# Intercept
interceptor = self.RouterPB.getMTInterceptionTable().getInterceptorFor(routable)
if interceptor is not None:
Expand Down Expand Up @@ -257,41 +289,6 @@ def route_routable(self, updated_request):
routable = update_submit_sm_pdu(routable=routable, config=param_updates,
config_update_params=list(param_updates))

# Set DLR bit mask on the last pdu
_last_pdu = routable.pdu
while True:
if hasattr(_last_pdu, 'nextPdu'):
_last_pdu = _last_pdu.nextPdu
else:
break
# DLR setting is clearly described in #107
_last_pdu.params['registered_delivery'] = RegisteredDelivery(
RegisteredDeliveryReceipt.NO_SMSC_DELIVERY_RECEIPT_REQUESTED)
if updated_request.args[b'dlr'][0] == b'yes':
_last_pdu.params['registered_delivery'] = RegisteredDelivery(
RegisteredDeliveryReceipt.SMSC_DELIVERY_RECEIPT_REQUESTED)
self.log.debug(
"SubmitSmPDU registered_delivery is set to %s",
str(_last_pdu.params['registered_delivery']))

dlr_level = int(updated_request.args[b'dlr-level'][0])
if b'dlr-url' in updated_request.args:
dlr_url = updated_request.args[b'dlr-url'][0]
else:
dlr_url = None
if updated_request.args[b'dlr-level'][0] == b'1':
dlr_level_text = 'SMS-C'
elif updated_request.args[b'dlr-level'][0] == b'2':
dlr_level_text = 'Terminal'
else:
dlr_level_text = 'All'
dlr_method = updated_request.args[b'dlr-method'][0]
else:
dlr_url = None
dlr_level = 0
dlr_level_text = 'No'
dlr_method = None

# QoS throttling
if (user.mt_credential.getQuota('http_throughput') and user.mt_credential.getQuota('http_throughput') >= 0) and user.getCnxStatus().httpapi[
'qos_last_submit_sm_at'] != 0:
Expand Down
Loading