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) {
@Override public DeliverSm createMessage() throws Exception { Address sourceAddress = new Address((byte) sourceAddressTon, (byte) sourceAddressNpi, sourceAddressDigits); Address destinationAddress = new Address((byte) destAddressTon, (byte) destAddressNpi, destAddressDigits); DeliverSm pdu = SmppPduUtils.createDeliverSm(sourceAddress, destinationAddress, sessionManager.getNextSequenceNumber()); return pdu; }
@ManagedOperation public void sendSegmentedDeliverMsgUdh00(int numberOfSegments) throws Exception { Address sourceAddress = new Address((byte) 0, (byte) 0, "123456789"); Address destinationAddress = new Address((byte) 0, (byte) 0, "987654321"); int msgRefNum = nextMsgRefNum.incrementAndGet(); for (int i = 1; i <= numberOfSegments; i++) { String shortMessage = "Segment content " + i + ". "; DeliverSm pdu = SmppPduUtils.createDeliverSm(sourceAddress, destinationAddress, getSessionManager().getNextSequenceNumber()); SmppPduUtils.setSegmentUdh00AndMessage(pdu, msgRefNum, i, numberOfSegments, shortMessage); send(pdu); } }
@ManagedOperation public void sendSegmentedDeliverMsgUdh08(int numberOfSegments) throws Exception { Address sourceAddress = new Address((byte) 0, (byte) 0, "123456789"); Address destinationAddress = new Address((byte) 0, (byte) 0, "987654321"); int msgRefNum = nextMsgRefNum.incrementAndGet(); for (int i = 1; i <= numberOfSegments; i++) { String shortMessage = "Segment content " + i + ". "; DeliverSm pdu = SmppPduUtils.createDeliverSm(sourceAddress, destinationAddress, getSessionManager().getNextSequenceNumber()); SmppPduUtils.setSegmentUdh08AndMessage(pdu, msgRefNum, i, numberOfSegments, shortMessage); send(pdu); } }
@ManagedOperation public void sendSegmentedDeliverLongMsg(int numberOfSegments, int minMsgSize) throws Exception { Address sourceAddress = new Address((byte) 0, (byte) 0, "123456789"); Address destinationAddress = new Address((byte) 0, (byte) 0, "987654321"); int msgRefNum = nextMsgRefNum.incrementAndGet(); for (int i = 1; i <= numberOfSegments; i++) { StringBuilder sb = new StringBuilder(255); sb.append("Segment content "); sb.append(i); sb.append(". "); while (sb.length() < minMsgSize) { sb.append("."); } String shortMessage = sb.toString(); DeliverSm pdu = SmppPduUtils.createDeliverSm(sourceAddress, destinationAddress, getSessionManager().getNextSequenceNumber()); SmppPduUtils.setSegmentOptionalParams(pdu, msgRefNum, i, numberOfSegments); byte[] body = CharsetUtil.encode(shortMessage, CharsetUtil.CHARSET_GSM); if (body.length < 256) { pdu.setShortMessage(body); } else { SmppPduUtils.setMessagePayloadOptionalParams(pdu, body); } pdu.setDataCoding(SmppConstants.DATA_CODING_8BITA); send(pdu); } }
@ManagedOperation public void sendSegmentedDeliverMsg(int numberOfSegments) throws Exception { Address sourceAddress = new Address((byte) 0, (byte) 0, "123456789"); Address destinationAddress = new Address((byte) 0, (byte) 0, "987654321"); int msgRefNum = nextMsgRefNum.incrementAndGet(); for (int i = 1; i <= numberOfSegments; i++) { String shortMessage = "Segment content " + i + ". "; DeliverSm pdu = SmppPduUtils.createDeliverSm(sourceAddress, destinationAddress, getSessionManager().getNextSequenceNumber()); SmppPduUtils.setSegmentOptionalParams(pdu, msgRefNum, i, numberOfSegments); pdu.setShortMessage(CharsetUtil.encode(shortMessage, CharsetUtil.CHARSET_GSM)); send(pdu); } }
@ManagedOperation public void sendSegmentedBinaryDeliverMsg(int numberOfSegments) throws Exception { Address sourceAddress = new Address((byte) 0, (byte) 0, "123456789"); Address destinationAddress = new Address((byte) 0, (byte) 0, "987654321"); int msgRefNum = nextMsgRefNum.incrementAndGet(); for (int i = 1; i <= numberOfSegments; i++) { String shortMessage = "Segment content " + i + ". "; DeliverSm pdu = SmppPduUtils.createDeliverSm(sourceAddress, destinationAddress, getSessionManager().getNextSequenceNumber()); SmppPduUtils.setSegmentOptionalParams(pdu, msgRefNum, i, numberOfSegments); pdu.setShortMessage(CharsetUtil.encode(shortMessage, CharsetUtil.NAME_GSM)); pdu.setDataCoding((byte) 0x02); // 8 bit binary encoding send(pdu); } }
/** * Read and create a new Address from a buffer. Checks if there is * a minimum number of bytes readable from the buffer. * @param buffer * @return * @throws UnrecoverablePduEncodingException * @throws RecoverablePduEncodingException */ static public Address readAddress(ChannelBuffer buffer) throws UnrecoverablePduException, RecoverablePduException { // an address is at least 3 bytes long (ton, npi, and null byte) if (buffer.readableBytes() < 3) { throw new NotEnoughDataInBufferException("Parsing address", buffer.readableBytes(), 3); } Address address = new Address(); address.read(buffer); return address; }
/** * Read and create a new Address from a buffer. Checks if there is * a minimum number of bytes readable from the buffer. * @param buffer * @return * @throws UnrecoverablePduEncodingException * @throws RecoverablePduEncodingException */ static public Address readAddress(ChannelBuffer buffer) throws UnrecoverablePduException, RecoverablePduException { // an address is at least 3 bytes long (ton, npi, and null byte) if (buffer.readableBytes() < 3) { throw new NotEnoughDataInBufferException("Parsing address", buffer.readableBytes(), 3); } Address address = new Address(); address.read(buffer); return address; }
/** * Read and create a new Address from a buffer. Checks if there is * a minimum number of bytes readable from the buffer. * @param buffer * @return * @throws UnrecoverablePduEncodingException * @throws RecoverablePduEncodingException */ static public Address readAddress(ChannelBuffer buffer) throws UnrecoverablePduException, RecoverablePduException { // an address is at least 3 bytes long (ton, npi, and null byte) if (buffer.readableBytes() < 3) { throw new NotEnoughDataInBufferException("Parsing address", buffer.readableBytes(), 3); } Address address = new Address(); address.read(buffer); return address; }
@ManagedOperation public void sendSegmentedDeliverMsgRandomized(int numberOfMessages, int numberOfSegments) throws Exception { for (int msgNum = 0; msgNum < numberOfMessages; msgNum++) { Address sourceAddress = new Address((byte) 0, (byte) 0, "123456789"); Address destinationAddress = new Address((byte) 0, (byte) 0, "987654321"); int msgRefNum = nextMsgRefNum.incrementAndGet(); for (int i = 1; i <= numberOfSegments; i++) { String shortMessage = "Msg " + msgNum + ". Segment content " + i + ". "; DeliverSm pdu = SmppPduUtils.createDeliverSm(sourceAddress, destinationAddress, getSessionManager().getNextSequenceNumber()); SmppPduUtils.setSegmentOptionalParams(pdu, msgRefNum, i, numberOfSegments); pdu.setShortMessage(CharsetUtil.encode(shortMessage, CharsetUtil.CHARSET_GSM)); getDeliverSender().scheduleDelivery(new PduRequestRecord(pdu, 1000, 5000)); } } }
/** * Read and create a new Address from a buffer. Checks if there is * a minimum number of bytes readable from the buffer. * @param buffer * @return * @throws UnrecoverablePduEncodingException * @throws RecoverablePduEncodingException */ static public Address readAddress(ChannelBuffer buffer) throws UnrecoverablePduException, RecoverablePduException { // an address is at least 3 bytes long (ton, npi, and null byte) if (buffer.readableBytes() < 3) { throw new NotEnoughDataInBufferException("Parsing address", buffer.readableBytes(), 3); } Address address = new Address(); address.read(buffer); return address; }
submitRequest.setSourceAddress(new Address(getTON(message.getOriginatorAddress()), getNPI(message.getOriginatorAddress()), message.getOriginatorAddress().getAddress())); submitRequest.setDestAddress(new Address(getTON(message.getRecipientAddress()), getNPI(message.getRecipientAddress()), message.getRecipientAddress().getAddress())); switch (message.getEncoding())
config0.setSystemId(this.param.getSystemId()); config0.setPassword(this.param.getPassword()); config0.setAddressRange(new Address((byte) 1, (byte) 1, this.param.getAddressRange())); config0.getLoggingOptions().setLogBytes(true);
pdu.setSourceAddress(new Address((byte)this.param.getSourceTON().getCode(), (byte)this.param.getSourceNPI().getCode(), this.param.getSourceAddress())); ((SubmitMulti) pdu).addDestAddresses(new Address((byte) this.param.getDestTON().getCode(), (byte) this.param.getDestNPI().getCode(), String .valueOf(daOrig + i2))); pdu.setDestAddress(new Address((byte) this.param.getDestTON().getCode(), (byte) this.param.getDestNPI().getCode(), destAddr));
String addressRange = esme.getEsmeAddressRange(); Address addressRangeObj = new Address(); if(addressTon!=-1){ addressRangeObj.setTon((byte)addressTon);
String addressRange = esme.getEsmeAddressRange(); Address addressRangeObj = new Address(); if(addressTon!=-1){ addressRangeObj.setTon((byte)addressTon);