aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-03-06 22:26:49 +1300
committerGitHub <noreply@github.com>2018-03-06 22:26:49 +1300
commit9145f9f823602c7da7a93a119b608c7a35d4ef60 (patch)
tree23e8c877e8dd0823e24823c9ca07cb3b3fa92ed9
parent88456dc2e2b3cc5a618b2a041c43230ed550f12f (diff)
parent5ac0f773023a9c1c70524f1b63d2afc7d837a31f (diff)
downloadtrackermap-server-9145f9f823602c7da7a93a119b608c7a35d4ef60.tar.gz
trackermap-server-9145f9f823602c7da7a93a119b608c7a35d4ef60.tar.bz2
trackermap-server-9145f9f823602c7da7a93a119b608c7a35d4ef60.zip
Merge pull request #3799 from Abyss777/smpp_delivery_detection
Implement additional way to detect SMPP delivery receipts
-rw-r--r--src/org/traccar/smpp/ClientSmppSessionHandler.java9
-rw-r--r--src/org/traccar/smpp/SmppClient.java12
2 files changed, 17 insertions, 4 deletions
diff --git a/src/org/traccar/smpp/ClientSmppSessionHandler.java b/src/org/traccar/smpp/ClientSmppSessionHandler.java
index 69ef9af41..3585f8376 100644
--- a/src/org/traccar/smpp/ClientSmppSessionHandler.java
+++ b/src/org/traccar/smpp/ClientSmppSessionHandler.java
@@ -50,7 +50,14 @@ public class ClientSmppSessionHandler extends DefaultSmppSessionHandler {
smppClient.mapDataCodingToCharset(((DeliverSm) request).getDataCoding()));
Log.debug("SMS Message Received: " + message.trim() + ", Source Address: " + sourceAddress);
- if (!SmppUtil.isMessageTypeAnyDeliveryReceipt(((DeliverSm) request).getEsmClass())) {
+ boolean isDeliveryReceipt = false;
+ if (smppClient.getDetectDlrByOpts()) {
+ isDeliveryReceipt = request.getOptionalParameters() != null;
+ } else {
+ isDeliveryReceipt = SmppUtil.isMessageTypeAnyDeliveryReceipt(((DeliverSm) request).getEsmClass());
+ }
+
+ if (!isDeliveryReceipt) {
TextMessageEventHandler.handleTextMessage(sourceAddress, message);
}
}
diff --git a/src/org/traccar/smpp/SmppClient.java b/src/org/traccar/smpp/SmppClient.java
index 602087a65..0f7d2cf6d 100644
--- a/src/org/traccar/smpp/SmppClient.java
+++ b/src/org/traccar/smpp/SmppClient.java
@@ -61,7 +61,8 @@ public class SmppClient {
private String sourceAddress;
private String commandSourceAddress;
private int submitTimeout;
- private boolean requestDrl;
+ private boolean requestDlr;
+ private boolean detectDlrByOpts;
private String notificationsCharsetName;
private byte notificationsDataCoding;
private String commandsCharsetName;
@@ -92,7 +93,8 @@ public class SmppClient {
commandSourceAddress = Context.getConfig().getString("sms.smpp.commandSourceAddress", sourceAddress);
submitTimeout = Context.getConfig().getInteger("sms.smpp.submitTimeout", 10000);
- requestDrl = Context.getConfig().getBoolean("sms.smpp.requestDrl");
+ requestDlr = Context.getConfig().getBoolean("sms.smpp.requestDlr");
+ detectDlrByOpts = Context.getConfig().getBoolean("sms.smpp.detectDlrByOpts");
notificationsCharsetName = Context.getConfig().getString("sms.smpp.notificationsCharset",
CharsetUtil.NAME_UCS_2);
@@ -153,6 +155,10 @@ public class SmppClient {
}
}
+ public boolean getDetectDlrByOpts() {
+ return detectDlrByOpts;
+ }
+
protected synchronized void reconnect() {
try {
disconnect();
@@ -213,7 +219,7 @@ public class SmppClient {
byte[] textBytes;
textBytes = CharsetUtil.encode(message, command ? commandsCharsetName : notificationsCharsetName);
submit.setDataCoding(command ? commandsDataCoding : notificationsDataCoding);
- if (requestDrl) {
+ if (requestDlr) {
submit.setRegisteredDelivery(SmppConstants.REGISTERED_DELIVERY_SMSC_RECEIPT_REQUESTED);
}
submit.setShortMessage(textBytes);