Google Analytics
Tuesday, September 16, 2014
Send Long SMS using SMPP
smsMessageText: Dear MISS DE MMMAA SSS, your mobile or xxxxx number 111111111 has been selected for festival offer.smsMessageText: Dear MISS DE MMMAA SSS, your mobile or xxxxx number 111111111 has been selected for festival offer. avail 50% discounton 11-SEP-12 @AAApurchase of 1000Rs.testtesttesttesttesttesttestesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttes
connectionReferenceNumber: 111111
org.jsmpp.PDUStringException: Octet String value 'Dear MISS DE MMMAA SSS, your mobile or xxxxx number 111111111 has been selected for festival offer. avail 50% discounton 11-SEP-12 @KFC purchase of 1000Rs.testtesttesttesttesttesttestesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttes' cannot more than 254. Actual length of string is 320
at org.jsmpp.util.StringValidator.validateString(StringValidator.java:73)
at org.jsmpp.util.DefaultComposer.submitSm(DefaultComposer.java:215)
at org.jsmpp.DefaultPDUSender.sendSubmitSm(DefaultPDUSender.java:196)
at org.jsmpp.SynchronizedPDUSender.sendSubmitSm(SynchronizedPDUSender.java:192)
at org.jsmpp.session.SubmitSmCommandTask.executeTask(SubmitSmCommandTask.java:86)
at org.jsmpp.session.AbstractSession.executeSendCommand(AbstractSession.java:248)
at org.jsmpp.session.SMPPSession.submitShortMessage(SMPPSession.java:321)
at abc.ddd.util.sms.SMSClient.submitMessage(SMSClient.java:130)
at abc.ddd.util.sms.AsyncSubmitter.run(AsyncSubmitter.java:21)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
testtesttesttestesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttes
connectionReferenceNumber: 111111
org.jsmpp.PDUStringException: Octet String value 'Dear MISS DE MMMAA SSS, your mobile or xxxxx number 111111111 has been selected for festival offer. avail 50% discounton 11-SEP-12 @KFC purchase of 1000Rs.testtesttesttesttesttesttestesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttes' cannot more than 254. Actual length of string is 320
Error codes:
http://www.activexperts.com/xmstoolkit/sms/smpperrorcodes/
SMSRequestConsumerJob [INFO] Status updated successfully for pendingNo: 34239593
org.jsmpp.extra.NegativeResponseException: Negative response 00000001 found
at org.jsmpp.session.AbstractSession.validateResponse(AbstractSession.java:215)
at org.jsmpp.session.AbstractSession.executeSendCommand(AbstractSession.java:271)
at org.jsmpp.session.SMPPSession.submitShortMessage(SMPPSession.java:321)
-------------------------------------------------------------------------------------------------------------
Follow below links:
http://www.ashishpaliwal.com/blog/2009/01/smpp-sending-long-sms-through-smpp/
SMPP 3.4 spec --> optional parameters for concatenation
http://sourceforge.net/p/smppapi/discussion/84650/thread/73ceac01/
http://www.activexperts.com/sms-component/smpp-specifications/smpp-parameter-definition/
Lib method definitions:
https://github.com/uudashr/jsmpp/blob/master/jsmpp/src/main/java/org/jsmpp/bean/OptionalParameter.java
------------------------------------------------------------------------------------------------------------
http://jsmpp.googlecode.com/svn-history/r163/trunk/src/java/examples/org/jsmpp/examples/SubmitLongMessageExample.java
Sample:
public void run() {
//super.run();
messageId = SMSClient.getInstance().submitMessage(source, "94" + destination, message);
handleDeliveryId(messageId);
}
public String submitMessage(String source, String destination, String message){
String messageId = null;
log.info("Inside submitMessage");
int msgTotalSegCount = splitStringSMS(message,157).length;
int msgSeqNo = 1;
int msgSegRefNo = 0;
for (String msg: splitStringSMS(message,157))
{
System.out.println(msg);
System.out.println("----------------------");
try {
/*messageId = session.submitShortMessage("",
TypeOfNumber.valueOf(props.getProperty(SOURCE_TON)), NumberingPlanIndicator.valueOf(props.getProperty(SOURCE_NPI)),
source, TypeOfNumber.valueOf(props.getProperty(DESTINATION_TON)),
NumberingPlanIndicator.valueOf(props.getProperty(DESTINATION_NPI)), destination, new ESMClass(),
(byte) 0, (byte) 1, timeFormatter.format(new Date()), null,
registeredDelivery, (byte) 0, new GeneralDataCoding(false,
true, MessageClass.CLASS1, Alphabet.ALPHA_DEFAULT),
(byte) 0, message.getBytes());*/
OptionalParameter sarMsgRefNumParameter = new OptionalParameter.Int(Tag.SAR_MSG_REF_NUM, msgSegRefNo);
OptionalParameter sarTotalSegmentsParameter = new OptionalParameter.Int(Tag.SAR_TOTAL_SEGMENTS, msgTotalSegCount);
OptionalParameter sarSegmentSeqnumParameter = new OptionalParameter.Int(Tag.SAR_SEGMENT_SEQNUM, msgSeqNo);
//Optional parameters added
messageId = session.submitShortMessage("",
TypeOfNumber.valueOf(props.getProperty(SOURCE_TON)), NumberingPlanIndicator.valueOf(props.getProperty(SOURCE_NPI)),
source, TypeOfNumber.valueOf(props.getProperty(DESTINATION_TON)),
NumberingPlanIndicator.valueOf(props.getProperty(DESTINATION_NPI)), destination, new ESMClass(),
(byte) 0, (byte) 1, timeFormatter.format(new Date()), null,
registeredDelivery, (byte) 0, new GeneralDataCoding(Alphabet.ALPHA_DEFAULT, MessageClass.CLASS1, false),
(byte) 0, msg.getBytes(),sarMsgRefNumParameter,sarTotalSegmentsParameter,sarSegmentSeqnumParameter);
msgSeqNo++;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("Submission failure .....",e);
}
}
long id = Long.parseLong(messageId) & 0xffffffff;
messageId = Long.toString(id,16).toUpperCase();
System.out.println("Message seq>> " + msgSeqNo);
System.out.println("Message total segment count>> " + msgTotalSegCount);
System.out.println("Message referanceNo>> " + msgSegRefNo);
log.info("Message submitted, source:" + source + " ,destination:" + destination + " ,messageId:" + messageId);
return messageId;
}
Labels:
JAVA SMPP
Subscribe to:
Post Comments (Atom)
Yeah!! Before you plan of setting up your own SMPP Server, it is highly recommended to workout your expected daily traffic projection keeping future plans in mind. SMPP Server Provider
ReplyDeleteHi I have this error:
ReplyDeleteorg.jsmpp.extra.NegativeResponseException: Negative response 00000001 (Message Length is invalid) found