uudashr / jsmpp Goto Github PK
View Code? Open in Web Editor NEWJava SMPP (Short Message Peer-to-peer Protocol) API
License: Apache License 2.0
Java SMPP (Short Message Peer-to-peer Protocol) API
License: Apache License 2.0
On line 297, the optionalParameter was returning a null pointer error. I guess since it was not declared anywhere it just broke the connectAndBind method (which internally calls sendBind). I commented this out for now but I do not know if this has any negative effects. The system is working without it fine, but then again all I am doing is sending and receiving messages from the Simulator.
None of the pull requests here have been processed in the last 12 months and we have been unable to make contact with @uudashr
Development has now continued in a new repository:
https://github.com/opentelecoms-org/jsmpp
so please submit your issues and pull requests there.
The numeric values for NPI_(DATA|TELEX|LAND_MOBILE|ERMES|INTERNET|WAP) in SMPPConstant.java are incorrect, the correct ones would be:
public static final byte NPI_DATA = 0x03;
public static final byte NPI_TELEX = 0x04;
public static final byte NPI_LAND_MOBILE = 0x06;
public static final byte NPI_ERMES = 0x0a;
public static final byte NPI_INTERNET = 0x0e;
public static final byte NPI_WAP = 0x12;
Hello team... I have an issue with some characters being displayed wrongly on the handset.
Sent content: £$%^&*96733{}@#
Delivered content: B#$%^&*96733{}@#
It appears the character £ is being misrepresented.
Below is a sample code block:
String message = "£$%^&*96733{}@#";
String messageId = session.submitShortMessage(
null,
TypeOfNumber.ALPHANUMERIC,
NumberingPlanIndicator.UNKNOWN,
"Uwiano",
TypeOfNumber.INTERNATIONAL,
NumberingPlanIndicator.ISDN,
"254723624727",
new ESMClass(),
(byte) 0,
(byte) 0,
null,
null,
new RegisteredDelivery(SMSCDeliveryReceipt.DEFAULT),
(byte) 0,
new GeneralDataCoding(Alphabet.ALPHA_DEFAULT, MessageClass.CLASS1, false),
(byte) 0,
message.getBytes()
);
It is totally abnormal case, but when some invalid packet is received by receiver(PDUReaderWorker), it could just stop without closing session and even leaving any log, because 'IndexOutOfBoundsException' could occur in reading the invalid packet but it catches only three checked exceptions. (InvalidCommandLengthException, SocketTimeoutException and IOException).
For example, if 0x0000 is received by the receiver, DefautPDUReader will throw 'IndexOutOfBoundException' in 'readPDUHeader' because the packet has just incorrect message length value. And as a result, the receiver will just stop without handling or logging it.
In the case, no reconnect will be triggered and enquire link will remain locked until another error occurs for sending message and reconnect is triggered.
PDUReaderWorker will need to catch unchecked exceptions too, so that it can gracefully close the session for reconnect.
Hi!
When do you plan to create release version of 2.2.0 for using it as Maven dependency instead of SNAPSHOT? :)
Hi,
I having a exception error when trying to send a message....
error:C-Octet String value 'XXXXXX' length must be less than 6. Actual length is 6
XXXXXX is the serviceType (SYSTEM TYPE).
I have google, but I have seen some comments around this but for PASSWORD which cannot be bigger than 8/9 in SMPP v3.4.
May I ask some help on this?
Thanks.
Dear,
I need to know how to get the remaining credits (balance) after sending sms ? is there any optional parameter I can use to get that ?
Thanks,
Dear, uudashr can u help me again please.. I bind with TX, then i start to send messages, any messages sends good, but sometimes as u can see, I have "Response timeout" error. What does this error mean ? And how to solve my problem ?
60529 [pool-71309-thread-43] DEBUG org.jsmpp.session.AbstractSession - submit_sm response received
60529 [pool-71309-thread-39] DEBUG org.jsmpp.session.AbstractSession - submit_sm response received
60597 [pool-3-thread-1] DEBUG org.jsmpp.session.AbstractSessionContext - Activity notified
60598 [pool-71309-thread-41] DEBUG org.jsmpp.session.AbstractSession - submit_sm response received
60597 [pool-3-thread-2] DEBUG org.jsmpp.session.AbstractSessionContext - Activity notified
60598 [pool-71309-thread-40] DEBUG org.jsmpp.session.AbstractSession - submit_sm response received
Response timeout
Response timeout
Response timeout
Response timeout
Hi,I am new to jsmpp and getting the following exception
Message sending failed java.io.IOException: Cannot submitShortMessage while in state CLOSED.
My log onStateChange method :
State changed from CLOSED to BOUND_TRX on org.jsmpp.session.SMPPSession@3bfc9f89 and isBound of new sate is true,isBound of old sate is false.
Often facing this issue ,i tried reconnecting but the client says that "your connection is already active but you keep on reconnecting",also asking for the PDU logs.On restarting my application everything working fine.
So, please kindly help me to overcome this exception.
Hi all, I have a problem with reconnect. When I test code on local machine with smppSimulator - all OK (if I stop simulator and then start it, my esme will reconnect without problems)
BUT when esme work with operator and operator reset connection, esme cant reconnect...(( only some records from log and that's all....maybe thread is dying?
How can I reconnect correctly?
logs from connection with operator:
2013-04-19 14:10:25,471 [EnquireLinkSender: 572b4b6b] INFO 221 :client.gw.AutoReconnectGatewayTrx - Session state of 572b4b6b changed from BOUND_TX to CLOSED
2013-04-19 14:10:25,471 [EnquireLinkSender: 572b4b6b] INFO 252 :client.gw.AutoReconnectGatewayTrx - Session CLOSED, by OPERATOR, let's reconnect
2013-04-19 14:10:25,472 [PDUReaderWorker: org.jsmpp.session.SMPPSession@6d1dc02c] WARN 639 :jsmpp.session.SMPPSession - IOException while reading: Socket closed
2013-04-19 14:10:25,472 [PDUReaderWorker: org.jsmpp.session.SMPPSession@6d1dc02c] INFO 203 :jsmpp.session.AbstractSession - AbstractSession.close() called
2013-04-19 14:10:29,403 [CL AGW-TX] INFO 273 :client.gw.AutoReconnectGatewayTrx - closing TX session...
2013-04-19 14:10:29,403 [CL AGW-TX] INFO 203 :jsmpp.session.AbstractSession - AbstractSession.close() called
And if I restart esme, connectiong will establish without problems.
Can somebody help me?
Here part of my code:
class AutoReconnectGateway extends Thread implements Gateway
@Override
public void run(){
logger.info("GW " + connectionType + " started!");
String ipAddress = ssetting.getIpAddressMain();
int port = ssetting.getPortMain();
session = getSession(ipAddress, port);
while (isRunning()){
try{
if (!isConnected()){
reloadConnection();
logger.info("#Try to reconnect after to " + ipAddress + ":" + port);
session = getSession(ipAddress, port);
}
else{
Utilz.sleep(5000);
}
}
catch (Exception e){
logger.error("main thread", e);
}
}
}
public void reloadConnection(){
try{
if (session != null){
logger.info("closing " + connectionType + " session...");
session.unbindAndClose();
session = null;
}
else{
logger.info("session " + connectionType + " already closed!");
}
}
catch (Exception e){
logger.error("reloadConnection", e);
}
logger.info("sleep 10 sec...");
Utilz.sleep(10000);
}
public synchronized SMPPSession getSession(String ip, int port){
if (session == null || !session.getSessionState().isBound()){
try{
session = new SMPPSession(ip, port, bindParam);
session.addSessionStateListener(new SessionStateListenerImpl());
session.setMessageReceiverListener(new SMPPMessageReceiver(clientQueue, ssetting.getBindType()));
}
catch (Exception e){
logger.error("new " + connectionType + " Session: ", e);
session = null;
}
}
return session;
}
public boolean isConnected(){
if (session != null && session.getSessionState().isBound())
return true;
return false;
}
HI Team,
Thanks in advanced, Can anybody help, how we send multiple sms, while doing bulk request, its proccessing one by one, and while every request its taking more then 40sec ,
AbsoluteTimeFormatter uses TimeZone's raw UTC offset which doesn't take daylight saving time into account. Fix:
- int rawOffset = calendar.getTimeZone().getRawOffset();
+ int rawOffset = calendar.getTimeZone().getOffset(calendar.getTime().getTime());
Hi. I am using SMPSession.connectAndBind() to set up a receiver (using BindType.BIND_RX). I have also sender class which binds using BIND_TX. The sender class seems to work ok all the time but after a few hours with no active sending from my side it seems like the receiver stops. After adding the pull request #25 I get some additional logging. AbstractSession.close() called. Does anyone know if there is a timeout setting which takes down the connection actively? Or may this be a result of some error?
I can set up additional logging and start debugging but would be grateful if anyone have experienced anything similar and know why.
10:29:01.898 INFO [MyClass.java:403] - Last logging from my app
16:51:24.364 INFO [AbstractSession.java:203] - AbstractSession.close() called
16:51:24.864 INFO [AbstractSession.java:203] - AbstractSession.close() called
Thanks.
Tomas
I have made a JSMPP server to receive messages after binding is done with client. Now this same server is to be used to send messages to the aforementioned client(now server). How to do this over same bind session? Please provide sample code/class file name where this has already been done
I create Reconnect thread, that check connection, and if it lose, reconnect to SMSC
public static void ConnectToSMSCtx() throws NumberFormatException, IOException
{
BasicConfigurator.configure();
String dt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(java.util.Calendar.getInstance ().getTime());
session = new SMPPSession();
try {
session.connectAndBind(Constants.SMPP_HOST, Integer.parseInt(Constants.SMPP_PORT), new BindParameter(BindType.BIND_TX, Constants.SMPP_LOGIN, Constants.SMPP_PASSWORD, null,TypeOfNumber.ALPHANUMERIC,NumberingPlanIndicator.ISDN, null));
} catch (IOException e2) {
ta.append("Failed connect and bind to host -> "+dt+"\n");
e2.printStackTrace();
}
if (session.getSessionState().isBound()){
ta.append("Connected to SMSC with Transmitter itakazan3:str7 -> "+dt+ "\n");
dt=null;
}
}
Then my thread check connection:
public void run(){
while (isActive){
try {
sleep(1000);
while (MainForm.session == null || MainForm.session.getSessionState().equals(SessionState.CLOSED)){
MainForm.Thread1.MySuspend();
sleep(2000);
MainForm.ConnectToSMSCtx();
if (MainForm.session.getSessionState().isBound()){
MainForm.Thread1.MyResume();
}
}
while (MainForm.session2 == null || MainForm.session2.getSessionState().equals(SessionState.CLOSED)){
sleep(2000);
MainForm.ConnectToSMSCrx();
}
} catch (InterruptedException e) {}
catch (NumberFormatException e) {}
catch (IOException e) {}
}
}
but when it reconnect... I see this:
2944056 [AWT-EventQueue-0] DEBUG org.jsmpp.session.AbstractSession - unbind response received
2944056 [AWT-EventQueue-0] DEBUG org.jsmpp.session.AbstractSession - unbind response received
2944056 [AWT-EventQueue-0] DEBUG org.jsmpp.session.AbstractSession - unbind response received
2944056 [AWT-EventQueue-0] DEBUG org.jsmpp.session.AbstractSession - unbind response received
2944056 [AWT-EventQueue-0] DEBUG org.jsmpp.session.AbstractSession - unbind response received
2944056 [AWT-EventQueue-0] DEBUG org.jsmpp.session.AbstractSession - unbind response received
2944057 [Thread-10] INFO org.jsmpp.session.SMPPSession - PDUReaderWorker stop
2944057 [Thread-10] INFO org.jsmpp.session.SMPPSession - PDUReaderWorker stop
2944057 [Thread-10] INFO org.jsmpp.session.SMPPSession - PDUReaderWorker stop
2944057 [Thread-10] INFO org.jsmpp.session.SMPPSession - PDUReaderWorker stop
2944057 [Thread-10] INFO org.jsmpp.session.SMPPSession - PDUReaderWorker stop
2944057 [Thread-10] INFO org.jsmpp.session.SMPPSession - PDUReaderWorker stop
2944236 [Thread-11] INFO org.jsmpp.session.SMPPSession - EnquireLinkSender stop
2944236 [Thread-11] INFO org.jsmpp.session.SMPPSession - EnquireLinkSender stop
2944236 [Thread-11] INFO org.jsmpp.session.SMPPSession - EnquireLinkSender stop
2944236 [Thread-11] INFO org.jsmpp.session.SMPPSession - EnquireLinkSender stop
2944236 [Thread-11] INFO org.jsmpp.session.SMPPSession - EnquireLinkSender stop
2944236 [Thread-11] INFO org.jsmpp.session.SMPPSession - EnquireLinkSender stop
2944955 [Thread-13] INFO org.jsmpp.session.SMPPSession - EnquireLinkSender stop
2944955 [Thread-13] INFO org.jsmpp.session.SMPPSession - EnquireLinkSender stop
2944955 [Thread-13] INFO org.jsmpp.session.SMPPSession - EnquireLinkSender stop
2944955 [Thread-13] INFO org.jsmpp.session.SMPPSession - EnquireLinkSender stop
2944955 [Thread-13] INFO org.jsmpp.session.SMPPSession - EnquireLinkSender stop
2944955 [Thread-13] INFO org.jsmpp.session.SMPPSession - EnquireLinkSender stop
I think it's not good, can u say me please how to solve my problem ? Or it's good ?
I am trying use this jsmpp library to run smpp server as well as client.
The below code has been used as server with little bit modification to accept optional parameters.
The below code has been used as client with little bit modification to send optional parameters.
On centos 7.2, I am getting this exception while sending message. After around 2 mins of the server start, the requests are successful and it picks up the messages send even during the exception. This doesnt seems to occur on Ubuntu.
Response timeout
org.jsmpp.extra.ResponseTimeoutException: No response after waiting for 2000 millis when executing submit_sm with sessionId 5dc04292 and sequenceNumber 2
at org.jsmpp.session.AbstractSession.executeSendCommand(AbstractSession.java:261)
at org.jsmpp.session.SMPPSession.submitShortMessage(SMPPSession.java:321)
at Smpp.main(Smpp.java:83)
Caused by: org.jsmpp.extra.ResponseTimeoutException: No response after 2000 millis
at org.jsmpp.extra.PendingResponse.waitDone(PendingResponse.java:117)
at org.jsmpp.session.AbstractSession.executeSendCommand(AbstractSession.java:257)
... 2 more
Please help.
Thanks.
Hello all,
There is a typo on "SimpleSubmitExample" class on line 74. It won't print error log because the error object is in the error title not as an object :
LOGGER.error("Receive negative response, e");
It should be :
LOGGER.error("Receive negative response", e);
Excuse my grammar
Good luck
I am unable to send message even after successful connection with SMSC .
I m getting an error while sending message , getting negative response 'Negative response 00000094 found '
When the error occurs command ID is 148.
The failure occurs after validateResponse() method in AbstractSession.java.
Log:
/usr/bin/env c:\Users.vscode\extensions\vscjava.vscode-java-debug-0.35.0\scripts\launcher.bat
"C:\Program Files\Java\jdk-18.0.1.1\bin\java.exe" -agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:***** -XX:+ShowCodeDetailsInExceptionMessages -Dfile.encoding=UTF-8 @C:\Users\AppData\Local\Temp\cp_4 org.jsmpp.examples.SimpleSubmitExample
[main] INFO org.jsmpp.examples.SimpleSubmitExample - Connecting
[main] DEBUG org.jsmpp.session.SMPPSession - Connect and bind to ...* port *****
[main] INFO org.jsmpp.session.SMPPSession - Connected from port 62586 to /...:***
[PDUReaderWorker-03ee3da4] INFO org.jsmpp.session.SMPPSession - Starting PDUReaderWorker
[main] DEBUG org.jsmpp.DefaultPDUSender - Sending PDU *********************************************************************
[PDUReaderWorker-03ee3da4] DEBUG org.jsmpp.session.SMPPSession - Received PDU in session 03ee3da4 in state OPEN: **********************************************************
[pool-1-thread-1] DEBUG org.jsmpp.session.PDUProcessTask - Received PDU **********************************************************
[pool-1-thread-1] DEBUG org.jsmpp.session.SMPPSession - Changing processor degree to 3
[main] DEBUG org.jsmpp.session.AbstractSession - bind response with sequence_number 1 received for session 03ee3da4
[main] INFO org.jsmpp.examples.SimpleSubmitExample - Connected with SMSC with system id NEC-SMSC
[EnquireLinkSender-03ee3da4] DEBUG org.jsmpp.session.AbstractSession - Starting EnquireLinkSender for session 03ee3da4
[main] DEBUG org.jsmpp.DefaultPDUSender - Sending PDU **************************************************************************************************************************************************
[PDUReaderWorker-03ee3da4] DEBUG org.jsmpp.session.SMPPSession - Received PDU in session 03ee3da4 in state BOUND_TX: **************************************
[pool-1-thread-2] DEBUG org.jsmpp.session.PDUProcessTask - Received PDU ***********************************
[main] DEBUG org.jsmpp.session.AbstractSession - submit_sm response with sequence_number 2 received for session 03ee3da4
[main] ERROR org.jsmpp.examples.SimpleSubmitExample - Receive negative response
org.jsmpp.extra.NegativeResponseException: Negative response 00000094 found
at org.jsmpp.session.AbstractSession.validateResponse(AbstractSession.java:289)
at org.jsmpp.session.AbstractSession.executeSendCommand(AbstractSession.java:356)
at org.jsmpp.session.SMPPSession.submitShortMessage(SMPPSession.java:378)
at org.jsmpp.examples.SimpleSubmitExample.main(SimpleSubmitExample.java:57)
[main] DEBUG org.jsmpp.session.AbstractSession - Unbind and close session 03ee3da4
[main] DEBUG org.jsmpp.DefaultPDUSender - Sending PDU **************************************
[PDUReaderWorker-03ee3da4] DEBUG org.jsmpp.session.SMPPSession - Received PDU in session 03ee3da4 in state BOUND_TX: **************************************
[pool-1-thread-3] DEBUG org.jsmpp.session.PDUProcessTask - Received PDU **************************************
[main] DEBUG org.jsmpp.session.AbstractSession - unbind response with sequence_number 3 received for session 03ee3da4
[main] DEBUG org.jsmpp.session.AbstractSession - Close session 03ee3da4 in state BOUND_TX
[main] DEBUG org.jsmpp.session.AbstractSession - Stop enquireLinkSender for session 03ee3da4
[EnquireLinkSender-03ee3da4] DEBUG org.jsmpp.session.AbstractSession - EnquireLinkSender stopped for session 03ee3da4
[PDUReaderWorker-03ee3da4] INFO org.jsmpp.session.SMPPSession - Reading PDU session 03ee3da4 in state BOUND_TX: Socket closed
[PDUReaderWorker-03ee3da4] DEBUG org.jsmpp.session.AbstractSession - Close session 03ee3da4 in state BOUND_TX
[main] DEBUG org.jsmpp.session.AbstractSession - Close session context 03ee3da4 in state BOUND_TX
[PDUReaderWorker-03ee3da4] DEBUG org.jsmpp.session.AbstractSession - Close session context 03ee3da4 in state BOUND_TX
[PDUReaderWorker-03ee3da4] DEBUG org.jsmpp.session.SMPPSession - PDUReaderWorker-03ee3da4 stopped
00000049 - 73 (Command length)
00000004 - submit_sm (Command Id)
00000000 - ESME_ROK (Command status)
00000002 - 2 (Sequence number)
00 - '' (Service type)
05 - Alphanumeric (TON)
01 - ISDN (NPI)
'*******' (Octet string)
01 - International (TON)
01 - ISDN (NPI)
*********************** (Octet string)
00 - 0 (ESM class)
00 - Default_store_and_forward_short_message (PID)
01 - Normal (Priority flag)
00 - '' (Scheduled delivery time)
00 - '' (Validity period)
00 - None (Registered delivery)
00 - DontReplace (Replace if present)
11 - 17 (Data coding)
00 - Unused (Default msg id)
02 - 2 (Sm length)
4869 - 'Hi' (Short message)
Thank you
I get java.io.EOFException when no activity.
Also i post a questoin in stackoverflow
http://stackoverflow.com/questions/29713934/jsmpp-smppsession-ioexception-while-reading-null
78 [main] INFO org.jsmpp.session.SMPPSession - Connected
83 [PDUReaderWorker: org.jsmpp.session.SMPPSession@71f250e8] INFO org.jsmpp.session.SMPPSession - Starting PDUReaderWorker
java.lang.NullPointerException
at org.jsmpp.bean.OptionalParameters.get(OptionalParameters.java:238)
at org.jsmpp.bean.BindResp.getOptionalParameter(BindResp.java:61)
at org.jsmpp.session.SMPPSession.sendBind(SMPPSession.java:298)
at org.jsmpp.session.SMPPSession.connectAndBind(SMPPSession.java:234)
at org.jsmpp.session.SMPPSession.connectAndBind(SMPPSession.java:201)
at org.jsmpp.examples.SimpleSubmitExample.main(SimpleSubmitExample.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
848 [main] INFO org.jsmpp.session.SMPPSession - Changing processor degree to 3
858 [EnquireLinkSender: org.jsmpp.session.SMPPSession@71f250e8] INFO org.jsmpp.session.AbstractSession - Starting EnquireLinkSender
Message submitted, message_id is f46d05f3
3706 [PDUReaderWorker: org.jsmpp.session.SMPPSession@71f250e8] WARN org.jsmpp.session.SMPPSession - IOException while reading: null
java.io.EOFException
at java.io.DataInputStream.readInt(DataInputStream.java:392)
at org.jsmpp.DefaultPDUReader.readPDUHeader(DefaultPDUReader.java:40)
at org.jsmpp.session.SMPPSession$PDUReaderWorker.readPDU(SMPPSession.java:619)
at org.jsmpp.session.SMPPSession$PDUReaderWorker.run(SMPPSession.java:602)
3707 [PDUReaderWorker: org.jsmpp.session.SMPPSession@71f250e8] INFO org.jsmpp.session.AbstractSession - AbstractSession.close() called
3858 [EnquireLinkSender: org.jsmpp.session.SMPPSession@71f250e8] INFO org.jsmpp.session.AbstractSession - EnquireLinkSender stop
3858 [PDUReaderWorker: org.jsmpp.session.SMPPSession@71f250e8] INFO org.jsmpp.session.AbstractSession - AbstractSession.close() called
3858 [PDUReaderWorker: org.jsmpp.session.SMPPSession@71f250e8] INFO org.jsmpp.session.SMPPSession - PDUReaderWorker stop
diff --git a/jsmpp/src/main/java/org/jsmpp/bean/OptionalParameters.java b/jsmpp/src/main/java/org/jsmpp/bean/OptionalParameters.java
index b5f032f..d7d12bc 100644
--- a/jsmpp/src/main/java/org/jsmpp/bean/OptionalParameters.java
+++ b/jsmpp/src/main/java/org/jsmpp/bean/OptionalParameters.java
@@ -235,11 +235,12 @@
@SuppressWarnings("unchecked")
public static <U extends OptionalParameter> U get(Class<U> tagClass, OptionalParameter[] parameters)
{
- for(OptionalParameter i: parameters) {
- if(i.getClass() == tagClass) {
- return (U)i;
- }
- }
+ if (parameters!=null)
+ for(OptionalParameter i: parameters) {
+ if(i.getClass() == tagClass) {
+ return (U)i;
+ }
+ }
logger.info("optional tag " + tagClass + " not found");
return null;
}
I have developed an application using jsmpp library. I used the auto-reconnect class to make the application auto-connect
but when I try to use unbindAndClose() it sends null to #private SMPPSession session = null; ......so the system still do auto-reconnect how to forcefully unbind the system
JButton btnDisconnecct = new JButton("Disconnecct");
btnDisconnecct.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
session.unbindAndClose();
// execService.shutdown();
}
});
btnDisconnecct.setBounds(170, 26, 129, 25);
panel.add(btnDisconnecct);
I understand that the jsmpp hides away the dirty details of the SMPP implementation (and I admit, it's really dirty!)
However, my client keeps requesting that the heartbeat (enquire link) should be set to < 50 sec even though I keep insisting that there's no such setting in "the API we are using" (jsmpp). I want to know:
Hello, my question is: If i do two sessions with binding two TRX they work sync or async ?
Please I need help, If i connect to SMSC with Transmitter it's ok, but if connect with Tranceiver or Receiver. I have an error "Not sending enquire link notify", and reconnect to SMSC. By the TCP my server send RST,ACK or FIN,ACK.
Firewall disabled.
I have this code to send sms async:
synchronized(this){
// submit all messages
for (int j = 0; j < byteMessagesArray.length; j++) {
execService2.execute (new Runnable () {
public void run () {
try {
String dt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(java.util.Calendar.getInstance ().getTime());
Statement stmt2 = MainForm.connection.createStatement();
stmt2.executeUpdate("UPDATE smpp SET new='1', send_date_to_smsc='"+dt+"' WHERE id='"+id+"'");
stmt2.close();
} catch (SQLException e) {
e.printStackTrace();
}
String messageId = submitMessageLong(MainForm.session, byteMessagesArray[0], sourceMsisdn, destinationMsisdn, messageClass, alphabet, esmClass, z);
if(messageId==null){
MainForm.ta.append("NULL "+"\n");
}else {
hashtable.put(id,messageId);
MainForm.ta.append("Message submitted, message_id is " + messageId +" "+id+"----tthread1"+"\n");
}
}
});
}
}
From my MySQL base i take 20 sms, then i have
execService2 = Executors.newFixedThreadPool(20);
And always my program sends 16-30sms/s. But my SMSC limit is 20sms/s.... So my question is: How to adjust the number of outgoing SMS ?
Hi, first congratulations for this project its so usefull.
Recently i must send sms in spain with iso-8859-1 codificatión, in this country alphabet has uncommon letters like 'ñ', i downlowd your project and made twoice changes, exactly in Alphabet and SMPPSession, I attach my changes FYI:
In Alphabet.java add:
/**
ISO-8859-1, AKA Latin 1 */
ALPHA_LATIN_1((byte)0x03),
After this my SMSC don't back OptionalParameters i have a NullPointerException in smpp session, i fix it with this code (lines ~ 297):
try {
OptionalParameter.Sc_interface_version sc_version = resp.getOptionalParameter(Sc_interface_version.class);
if (sc_version != null) {
logger.info("Other side reports smpp interface version {}", sc_version);
}
} catch(Exception ignore) {}
Probably this was innecessary but i only can attach the DataCoding dc = new GeneralDataCoding((byte)0x03), (from Smpp v3.4, pag. 126 -> 00000011 Latin 1 (ISO-8859-1)), appending new ALPHA_XXXXX. Is there another system to do?
Thanks in advance. BR, Mal3kith
Hi,
im using jsmpp with .net application for sending bulk sms. when im sending 1000 -5000 sms everything is working like charm i get 100 delivery receipts but when i send above 10000 its starting loosing delivery receipts.
Could you please guide me on that?
Regards
Hi
Let me try to explain the problem we are facing right now.
Our SMSC is allowing only one bind when we we try to have more than one bind they are throwing negative response with code 05.
Now the problem is
We already established the connection with SMSC i.e. BOUND_TRX
now somehow we have got the momentary VPN issue and our state change listener received the closed state.
In our code whenever we receive the close state we try to re-connect and bind but as SMSC has not timeout the connection because there timeout is 2 minute. so our connection is in already bind state from there side and because of this they immediately throws negative response to our connect and bind state with code 05 i.e. only one bind is allowed.
Now to avoid this problem we should call the unbind and close method but the question is when should we call this. unbindAndClose method do not send unbind request when the session state is closed. So what should we do on receive of close state ?
Please help us as this is major issue we are struggling with.
diff --git a/jsmpp/src/main/java/org/jsmpp/util/StringParameter.java b/jsmpp/src/main/java/org/jsmpp/util/StringParameter.java
index 1d1eb37..aad74ce 100644
--- a/jsmpp/src/main/java/org/jsmpp/util/StringParameter.java
+++ b/jsmpp/src/main/java/org/jsmpp/util/StringParameter.java
@@ -31,7 +31,8 @@
/**
* password string parameter.
*/
- PASSWORD(StringType.C_OCTEC_STRING, 0, 9, true, SMPPConstant.STAT_ESME_RINVPASWD),
+ //SMPP providers may be use long passwords over SMPP 3.4 standard (like t-sms.ru)
+ PASSWORD(StringType.C_OCTEC_STRING, 0, 32, true, SMPPConstant.STAT_ESME_RINVPASWD),
/**
* system_type string parameter.
Hi , how I can test my SMPP aplication ? Or what server simulator did you use?
I'm sending SMS via JSMPP as described in SubmitMultipartMultilangualExample.java. Current SMS is with latin symbols only and does not overlap 160 chars limit - no multipart message is sent, single one only.
So on mobile phone I see only push notification with Cancel and Save buttons (Android) or simply open message on my old Sony Ericsson. Text is delivered correctly, but message does not appear in "incoming" folder!
How to send ordinary SMS with no "hacks"?
Theres also question on stackoverflow http://stackoverflow.com/questions/26340090/sms-sent-via-jsmpp-not-saved-on-a-phone-push-only
Using setEnquireLinkTimer on a
SMPPServerSessioninstance has no effect and the
enquire_link` PDU will still be sent every 5000 milliseconds (the default value).
FYI: It works fine for SMPPSession
.
AFAIK the BoundStateListener
of the SMPPServerSession
class could be updated just like it was done for the SMPPSession
to add the SO_TIMEOUT
.
Is there any code implementing concatenation of a list of single sms parts based on UDH into long messages (what that normally mobile phones do)?
P.S. may be considered as an off-topic issue but found it a good idea to ask in related repositories
logica has Destination Port to deliver the message to a specific port on the device. It has been used to send sms message but not show on the device. Another app will capture the message on that specific port. If there is way, can you provide me and example?
Thanks,
Update: I have made a fork with this uploaded.
I had originally asked this in Google Code, but there's no response from anyone there.
I don't want to make a pull request or fork as I want to leave it up to the developer to consider. However, the changed source file is available in Google Code.
Can we have a version of jsmpp JAR file without the Log4J or Slf4J dependencies. Just a clean JSMPP that only does what it's supposed to do without any logging support.
Attached here is a quick hack to replace all references of the Slf4J library with a pretentious set of classes that pretends to log but simply ignores all logging input.
pretentious-slf4j.rar
- The source code forLogger
andLoggerFactory
inorg.slf4j
package.
jsmpp-2.1.0-no-logging.jar
- Rebuild (Java 1.5) ofjsmpp-2.1.0.jar
with above pretentious logging classes added. This jar is completely independent of the Log4J and SLF4J libraries, so you don't need them in the classpath.But ideally, you should create a single dedicated logging class (
org.jsmpp.Logger
ororg.jsmpp.extra.Logger
) to interface with theSlf4J
logger API, and all other classes should use this dedicated logging class. The idea is, it will be very easy to replace this dedicated logging class with a dummy logging class to create a no-logging version of JSMPP.You don't even have to edit all the source code. Just create
org.jsmpp.Logger
andorg.jsmpp.LoggerFactory
, then change all the imports. Simple:)
I need to send messages asynchronous, but i need to know seq_number of messages what i send, then i must to compare this seq_numbers and get message_id for message
2.1.0 Fedora
If I run one session and retrieve an admissible 40sms of MYSQL, then the program will still send up to 20 SMS per second, that's the last time I look at the magazine where it SMSC 21sms/s then 14sms/s then 5sms/s
And I send sms ,as u told me, with ExecutorService like:
execService = Executors.newFixedThreadPool(20);
for (int j = 0; j < byteMessagesArray.length; j++) {
Future<?> future = execService.submit(new MyRunnable (j, byteMessagesArray, hashtable, id, sourceMsisdn, destinationMsisdn, messageClass, alphabet, esmClass, z) {});
list.add(future);
}
Please is it possible to set The unique message identifier, that will later be returned in the DLR for reference purpose.
Let me explain my current process below:
My approach is we send a message to the smsc gateway we get an id from smsc, we save this id and when DLR comes we match the id from the dlr to the id we previously save (because we push million of messages for a short period this approach isn't optimal for us, the back and forth to the database).
what I will like to acheive is if there is a way we can add a parameter to the submit message to smsc and retrieve this id when the dlr comes back.
Hi Guys,
I was having an issue, because a client that connect to us are receiving a lot of 000000058 Errors(ResponseTimeOutExceptions) when they issue submit_sm command.
We have analized how many time take our method "onAcceptSubmitSm" on executing, and it is taking something arround 1 second. The client has setup 60000 millis as a timeout, so 1 second should be fine.
We have setup 20 as progressor degrees to be able to process in parallel more request.
Now the issue is, that the time between the client issue the submit_sm command and the method onAcceptSubmitSm get called begin for first messages in just some milliseconds, but after some hundreds of submit_sm, this time increase to 1,2,3,4,5 or more MINUTES.
We really dont know where to look to be able to increase the speed of this methos call.
Is this a server issue?
Thank you,
Best Regards
I have an error when trying to handle message with deliverSm.getShortMessageAsDeliveryReceipt()
org.jsmpp.util.InvalidDeliveryReceiptException: There is an error found when parsing delivery receipt
at org.jsmpp.util.DefaultDecomposer.deliveryReceipt(DefaultDecomposer.java:420)
at org.jsmpp.util.DefaultDecomposer.deliveryReceipt(DefaultDecomposer.java:432)
at org.jsmpp.bean.DeliverSm.getShortMessageAsDeliveryReceipt(DeliverSm.java:42)
at routines.CamelSmpp_4$1.onAcceptDeliverSm(CamelSmpp_4.java:162)
at org.jsmpp.session.SMPPSession.fireAcceptDeliverSm(SMPPSession.java:445)
at org.jsmpp.session.SMPPSession.access$400(SMPPSession.java:92)
at org.jsmpp.session.SMPPSession$ResponseHandlerImpl.processDeliverSm(SMPPSession.java:462)
at org.jsmpp.session.state.SMPPSessionBoundRX.processDeliverSm0(SMPPSessionBoundRX.java:109)
at org.jsmpp.session.state.SMPPSessionBoundRX.processDeliverSm(SMPPSessionBoundRX.java:51)
at org.jsmpp.session.PDUProcessTask.run(PDUProcessTask.java:81)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
ton adress :5
message body 🆔0654354026 submit date:2302101454 done date:2302101454 stat:DELIVRD err:000
receive failed :org.jsmpp.util.InvalidDeliveryReceiptException: There is an error found when parsing delivery receipt
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:542)
at java.lang.Integer.parseInt(Integer.java:615)
at org.jsmpp.util.DefaultDecomposer.deliveryReceipt(DefaultDecomposer.java:404)
... 12 more
and the output of getShortMessage() is :
id:0654354026 submit date:2302101454 done date:2302101454 stat:DELIVRD err:000
I installed Maven on my Fedora, i downloaded your jsmpp-master.zip. How I can build your project to 2.2.0 build ?
In command line i go to directory with source files, then write: mvn archetype:create-from-project
but i have an error: [INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building jsmpp-pom 2.2.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.2:create-from-project (default-cli) @ jsmpp-pom >>>
[INFO]
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO] Forking jsmpp 2.2.0-SNAPSHOT
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO]
[INFO] --- git-commit-id-plugin:1.9:revision (default) @ jsmpp ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] jsmpp-pom ......................................... FAILURE [0.515s]
[INFO] jsmpp ............................................. SKIPPED
[INFO] jsmpp-examples .................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.868s
[INFO] Finished at: Mon Oct 07 15:51:41 MSK 2013
[INFO] Final Memory: 9M/87M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal pl.project13.maven:git-commit-id-plugin:1.9:revision (default) on project jsmpp: Could not find .git directory. Please specify a valid dotGitDirectory in your pom.xml -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :jsmpp
how to solve this problem ?
Hi. :) Hope you can help me with this.
Unable to decompose a Bind Response using DefaultDecomposer.header().
Experiencing the following error: "SYSTEM BUGS, the command_length (24) not equals with the byte array length (10000)"
I'm trying to retrieve the header so I can determine the type of command.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.