aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/smpp
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2018-03-22 09:24:25 +0500
committerAbyss777 <abyss@fox5.ru>2018-03-22 09:32:50 +0500
commit265b1c14a995905da2e216d6002c62bd0d586752 (patch)
tree93e075a7caf383a5d35d606106959c3633dd8715 /src/org/traccar/smpp
parentd2a130b71e9d8064515b16dff865f476a1aadf15 (diff)
downloadtraccar-server-265b1c14a995905da2e216d6002c62bd0d586752.tar.gz
traccar-server-265b1c14a995905da2e216d6002c62bd0d586752.tar.bz2
traccar-server-265b1c14a995905da2e216d6002c62bd0d586752.zip
Add support for long SMS sending
Diffstat (limited to 'src/org/traccar/smpp')
-rw-r--r--src/org/traccar/smpp/SmppClient.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/org/traccar/smpp/SmppClient.java b/src/org/traccar/smpp/SmppClient.java
index 0f7d2cf6d..bf395f90e 100644
--- a/src/org/traccar/smpp/SmppClient.java
+++ b/src/org/traccar/smpp/SmppClient.java
@@ -1,6 +1,6 @@
/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
- * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
+ * Copyright 2017 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,6 +35,7 @@ import com.cloudhopper.smpp.impl.DefaultSmppClient;
import com.cloudhopper.smpp.impl.DefaultSmppSessionHandler;
import com.cloudhopper.smpp.pdu.SubmitSm;
import com.cloudhopper.smpp.pdu.SubmitSmResp;
+import com.cloudhopper.smpp.tlv.Tlv;
import com.cloudhopper.smpp.type.Address;
import com.cloudhopper.smpp.type.RecoverablePduException;
import com.cloudhopper.smpp.type.SmppChannelException;
@@ -222,7 +223,13 @@ public class SmppClient {
if (requestDlr) {
submit.setRegisteredDelivery(SmppConstants.REGISTERED_DELIVERY_SMSC_RECEIPT_REQUESTED);
}
- submit.setShortMessage(textBytes);
+
+ if (textBytes != null && textBytes.length > 255) {
+ submit.addOptionalParameter(new Tlv(SmppConstants.TAG_MESSAGE_PAYLOAD, textBytes, "message_payload"));
+ } else {
+ submit.setShortMessage(textBytes);
+ }
+
submit.setSourceAddress(command ? new Address(commandSourceTon, commandSourceNpi, commandSourceAddress)
: new Address(sourceTon, sourceNpi, sourceAddress));
submit.setDestAddress(new Address(destTon, destNpi, destAddress));