diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-03-22 18:23:16 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-22 18:23:16 +1300 |
commit | d3c4ba390b7cd3358c24605ee774e00ed64fa96b (patch) | |
tree | 93e075a7caf383a5d35d606106959c3633dd8715 /src | |
parent | d2a130b71e9d8064515b16dff865f476a1aadf15 (diff) | |
parent | 265b1c14a995905da2e216d6002c62bd0d586752 (diff) | |
download | traccar-server-d3c4ba390b7cd3358c24605ee774e00ed64fa96b.tar.gz traccar-server-d3c4ba390b7cd3358c24605ee774e00ed64fa96b.tar.bz2 traccar-server-d3c4ba390b7cd3358c24605ee774e00ed64fa96b.zip |
Merge pull request #3819 from Abyss777/long_sms
Add support for long SMS sending
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/smpp/SmppClient.java | 13 |
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)); |