diff --git a/jasmin/protocols/http/endpoints/send.py b/jasmin/protocols/http/endpoints/send.py index 804a2d5b..d3f9a562 100644 --- a/jasmin/protocols/http/endpoints/send.py +++ b/jasmin/protocols/http/endpoints/send.py @@ -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: @@ -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: