Open WEBudoGT opened 1 year ago
Hi,
not sure if your problem is actual so far. Based of information from @farirat at in https://github.com/jookies/jasmin/issues/1122, I believe correct way to enforce DLR using interceptor should be:
"This script will enforce sending message while asking for DLR"
from smpp.pdu.pdu_types import RegisteredDeliveryReceipt, RegisteredDelivery
pdu = routable.pdu
pdu.params['registered_delivery'] = RegisteredDelivery(RegisteredDeliveryReceipt.SMSC_DELIVERY_RECEIPT_REQUESTED)
while hasattr(pdu, 'nextPdu'):
pdu = pdu.nextPdu
pdu.params['registered_delivery'] = RegisteredDelivery(RegisteredDeliveryReceipt.SMSC_DELIVERY_RECEIPT_REQUESTED)
OR
"This script will enforce sending message while asking for DLR - on last PDU only"
from smpp.pdu.pdu_types import RegisteredDeliveryReceipt, RegisteredDelivery
pdu = routable.pdu
while hasattr(pdu, 'nextPdu'):
pdu = pdu.nextPdu
pdu.params['registered_delivery'] = RegisteredDelivery(RegisteredDeliveryReceipt.SMSC_DELIVERY_RECEIPT_REQUESTED)
The way it is mentioned in documentation will only work for messages which are not "multipart" (shorter than ~150 characters, without non-ASCII characters). BUT be avare that unpatched version of jasmin is logging DLR information (in messages.log) in a bad way. See https://github.com/jookies/jasmin/issues/1136
Anyway if you managed to solve it somehow, please close the issue.
Just tested it in real world, and it really does not work.
When I update registered_delivery
using interceptor script, it is not passed into real PDUs for some reason. Not sure why this happens. Maybe @farirat can have some explanation?
EDIT: Oh, this seems to be the problem. Jasmin is setting DLR based on http request dlr
param.
I believe intercept section should be moved AFTER jasmind decides about those params. But I am not sure exactly how to do that safely now.
I configured interception as per docs: https://docs.jasminsms.com/en/latest/interception/index.html Added the script for the mtinterceptor as per instructions, and it seems it's using it correctly because on interceptor.log shows:
`2023-04-19 16:08:22 INFO 254017 Running with a CommandId.submit_sm (from:XXXXXX, to:b'YYYYYYYY'). 2023-04-19 16:08:22 DEBUG 254017 Running [from smpp.pdu.pdu_types import RegisteredDeliveryReceipt, RegisteredDelivery
routable.pdu.params['registered_delivery'] = RegisteredDelivery( RegisteredDeliveryReceipt.SMSC_DELIVERY_RECEIPT_REQUESTED) ] 2023-04-19 16:08:22 DEBUG 254017 ... having routable with pdu: PDU [command: CommandId.submit_sm, sequence_number: None, command_status: CommandStatus.ESME_ROK service_type: None source_addr_ton: <AddrTon.NATIONAL: 3> source_addr_npi: <AddrNpi.ISDN: 2> source_addr: 'XXXXXXXX' dest_addr_ton: <AddrTon.INTERNATIONAL: 2> dest_addr_npi: <AddrNpi.ISDN: 2> destination_addr: b'YYYYYYYY' esm_class: EsmClass[mode: EsmClassMode.STORE_AND_FORWARD, type: EsmClassType.DEFAULT, gsmFeatures: set()] protocol_id: None priority_flag: <PriorityFlag.LEVEL_0: 1> schedule_delivery_time: None validity_period: None registered_delivery: RegisteredDelivery[receipt: RegisteredDeliveryReceipt.NO_SMSC_DELIVERY_RECEIPT_REQUESTED, smeOriginatedAcks: set(), intermediateNotification: False] replace_if_present_flag: <ReplaceIfPresentFlag.DO_NOT_REPLACE: 1> data_coding: 0 sm_default_msg_id: 0 short_message: b'Prueba2' ] 2023-04-19 16:08:22 DEBUG 254017 ... took 0 seconds.`
Since I don't know how to interpret the rest of the log, only the part that shows that the enforcing-dlr script is running when sending the message, I don't know if the script is doing or not what's supposed to.
Thanks in advance