i'm trying to receive messages from SMSC using the OPENSMPP. this is my code:
try{
PDU pdu = session.receive(30000);
if(pdu instanceof DeliverSM){
DeliverSM received = (DeliverSM) pdu;
if (received.getEsmClass() == 0) { // new message
logger.debug("RECEIVE NEW MESSAGE:" + received.debugString());
String MSG_SENDER = received.getSourceAddr().getAddress();
String SHORT_MSG = received.getShortMessage();
} else { // delivry Repport
logger.debug("RECEIVE NEW DELIVERED REPORT:" + received.debugString());
String MSG_ID = (new BigInteger(received.getReceiptedMessageId(), 16)) + "";
int MSG_STATUS = received.getMessageState();
}
}else{
logger.debug("----------------- FF pdu: " +pdu.debugString());
}
} catch (TimeoutException e) {
logger.error("------------------------- ["+SMSC_NAME+"] SMPP RECEIVED TimeoutException "+e.getMessage()+" ---------------- ", e );
} catch (ValueNotSetException e){
logger.error("-------------------------["+SMSC_NAME+"] SMPP RECEIVED ValueNotSetException "+e.getMessage()+" ---------------- ", e );
} catch (WrongLengthOfStringException e) {
logger.error("-------------------------["+SMSC_NAME+"] SMPP RECEIVED WrongLengthOfStringException "+e.getMessage()+" ---------------- ", e );
} catch (PDUException e) {
logger.error("-------------------------["+SMSC_NAME+"] SMPP RECEIVED PDUException "+e.getMessage()+" ---------------- ", e );
} catch (IOException e) {
logger.error("-------------------------["+SMSC_NAME+"] SMPP RECEIVED IOException "+e.getMessage()+" ---------------- ", e );
}catch (NotSynchronousException e) {
logger.error("-------------------------["+SMSC_NAME+"] SMPP RECEIVED NotSynchronousException "+e.getMessage()+" ---------------- ", e );
}catch (Exception e) {
logger.error("-------------------------["+SMSC_NAME+"] SMPP RECEIVED Exception "+e.getMessage()+" ---------------- ", e );
}
that's code working normaly when i connected to SMSC but when i change the SMSC to an other center SMSC i got this error:
SMPP.org.pdu.ValueNotSetException
when i trace that i got that the message id is null but this is my pdu debug:
(deliver: (pdu: 150 5 0 14) (addr: 1 1 22544803532) (addr: 2 1 98131) (sm: msg: id:256092548 sub:000 dlvrd:000 submit date:1708171009 done date:1708171009 stat:DELIVRD err:000 text:) (opt: ) )
can someone help me please.
The pdu debug String indicates that the message id and every other parameters is sent by the SMSC. Make sure that you are tracing the correct pdu .