diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-03-09 18:43:12 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-09 18:43:12 +1300 |
commit | 8fc557730791d238c7f838c2b11c99fbcf95637d (patch) | |
tree | 9dee4d19fc4c5707db0f47315df32833441b1c6f /src/org/traccar/smpp/SmppClient.java | |
parent | 1cf3134cd4212462aec79419a7eac9fe053ac966 (diff) | |
parent | 218975d8ccfd4f35a2c8ff8e0073fedeeafd3314 (diff) | |
download | trackermap-server-8fc557730791d238c7f838c2b11c99fbcf95637d.tar.gz trackermap-server-8fc557730791d238c7f838c2b11c99fbcf95637d.tar.bz2 trackermap-server-8fc557730791d238c7f838c2b11c99fbcf95637d.zip |
Merge pull request #2986 from Abyss777/command_sourceaddress
SMPP: Allow set different source address for commands
Diffstat (limited to 'src/org/traccar/smpp/SmppClient.java')
-rw-r--r-- | src/org/traccar/smpp/SmppClient.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/org/traccar/smpp/SmppClient.java b/src/org/traccar/smpp/SmppClient.java index 317d6debf..122bbaea1 100644 --- a/src/org/traccar/smpp/SmppClient.java +++ b/src/org/traccar/smpp/SmppClient.java @@ -59,6 +59,7 @@ public class SmppClient { private Integer reconnectionDelay; private String sourceAddress; + private String commandSourceAddress; private int submitTimeout; private String notificationsCharsetName; private byte notificationsDataCoding; @@ -67,6 +68,8 @@ public class SmppClient { private byte sourceTon; private byte sourceNpi; + private byte commandSourceTon; + private byte commandSourceNpi; private byte destTon; private byte destNpi; @@ -84,6 +87,7 @@ public class SmppClient { sessionConfig.getLoggingOptions().setLogPdu(Context.getConfig().getBoolean("sms.smpp.logPdu")); sourceAddress = Context.getConfig().getString("sms.smpp.sourceAddress", ""); + commandSourceAddress = Context.getConfig().getString("sms.smpp.commandSourceAddress", sourceAddress); submitTimeout = Context.getConfig().getInteger("sms.smpp.submitTimeout", 10000); notificationsCharsetName = Context.getConfig().getString("sms.smpp.notificationsCharset", @@ -97,7 +101,9 @@ public class SmppClient { sourceTon = (byte) Context.getConfig().getInteger("sms.smpp.sourceTon", SmppConstants.TON_ALPHANUMERIC); + commandSourceTon = (byte) Context.getConfig().getInteger("sms.smpp.commandSourceTon", sourceTon); sourceNpi = (byte) Context.getConfig().getInteger("sms.smpp.sourceNpi", SmppConstants.NPI_UNKNOWN); + commandSourceNpi = (byte) Context.getConfig().getInteger("sms.smpp.commandSourceNpi", sourceNpi); destTon = (byte) Context.getConfig().getInteger("sms.smpp.destTon", SmppConstants.TON_INTERNATIONAL); destNpi = (byte) Context.getConfig().getInteger("sms.smpp.destNpi", SmppConstants.NPI_E164); @@ -204,7 +210,8 @@ public class SmppClient { textBytes = CharsetUtil.encode(message, command ? commandsCharsetName : notificationsCharsetName); submit.setDataCoding(command ? commandsDataCoding : notificationsDataCoding); submit.setShortMessage(textBytes); - submit.setSourceAddress(new Address(sourceTon, sourceNpi, sourceAddress)); + submit.setSourceAddress(command ? new Address(commandSourceTon, commandSourceNpi, commandSourceAddress) + : new Address(sourceTon, sourceNpi, sourceAddress)); submit.setDestAddress(new Address(destTon, destNpi, destAddress)); SubmitSmResp submitResponce = getSession().submit(submit, submitTimeout); if (submitResponce.getCommandStatus() == SmppConstants.STATUS_OK) { |