我正在尝试使用OPENSMPP从SMSC接收消息。这是我的密码:
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 );
}当我连接到SMSC时,这是正常工作的代码,但是当我将SMSC更改为另一个中心SMSC时,我得到了以下错误:
SMPP.org.pdu.ValueNotSetException
当我跟踪得到消息id为null时,但这是我的pdu调试:
(交付:(pdu: 150 5 0 14) (地址:1 1 22544803532) (地址:2 1 98131) (sm: msg: id:256092548 sub:000 dlvrd:000提交日期:1708171009完成日期:1708171009 stat:DELIVRD err:000文本:)
有人能帮帮我吗。
发布于 2017-08-17 14:25:38
pdu调试字符串指示消息id和所有其他参数由SMSC发送。确保您正在跟踪正确的pdu。
https://stackoverflow.com/questions/45732729
复制相似问题