use of com.zx.sms.codec.cmpp.msg.CmppReportRequestMessage in project SMSGate by Lihuanghe.
the class TestSMPP2CMPPDeliverCodec method testReportCodec.
@Test
public void testReportCodec() {
CmppDeliverRequestMessage msg = createTestReq("k k k ");
msg.setMsgContent((SmsMessage) null);
CmppReportRequestMessage reportRequestMessage = new CmppReportRequestMessage();
reportRequestMessage.setSmscSequence(0x1234L);
reportRequestMessage.setMsgId(new MsgId());
reportRequestMessage.setDestterminalId("13800138000");
reportRequestMessage.setStat("9876");
msg.setReportRequestMessage(reportRequestMessage);
test0(msg);
}
use of com.zx.sms.codec.cmpp.msg.CmppReportRequestMessage in project SMSGate by Lihuanghe.
the class CMPPResponseSenderHandler method channelRead.
@Override
public void channelRead(final ChannelHandlerContext ctx, Object msg) throws Exception {
// 此时未经过长短信合并
if (msg instanceof CmppDeliverRequestMessage) {
CmppDeliverRequestMessage e = (CmppDeliverRequestMessage) msg;
CmppDeliverResponseMessage responseMessage = new CmppDeliverResponseMessage(e.getHeader().getSequenceId());
responseMessage.setResult(0);
responseMessage.setMsgId(e.getMsgId());
ctx.channel().writeAndFlush(responseMessage);
} else if (msg instanceof CmppSubmitRequestMessage) {
CmppSubmitRequestMessage e = (CmppSubmitRequestMessage) msg;
CmppSubmitResponseMessage resp = new CmppSubmitResponseMessage(e.getHeader().getSequenceId());
resp.setResult(0);
ctx.channel().writeAndFlush(resp);
if (e.getRegisteredDelivery() == 1) {
final CmppDeliverRequestMessage deliver = new CmppDeliverRequestMessage();
deliver.setDestId(e.getSrcId());
deliver.setSrcterminalId(e.getDestterminalId()[0]);
CmppReportRequestMessage report = new CmppReportRequestMessage();
report.setDestterminalId(deliver.getSrcterminalId());
report.setMsgId(resp.getMsgId());
String t = DateFormatUtils.format(CachedMillisecondClock.INS.now(), "yyMMddHHmm");
report.setSubmitTime(t);
report.setDoneTime(t);
report.setStat("DELIVRD");
report.setSmscSequence(0);
deliver.setReportRequestMessage(report);
ctx.executor().submit(new Runnable() {
public void run() {
ctx.channel().writeAndFlush(deliver);
}
});
}
} else if (msg instanceof CmppQueryRequestMessage) {
CmppQueryRequestMessage e = (CmppQueryRequestMessage) msg;
CmppQueryResponseMessage res = new CmppQueryResponseMessage(e.getHeader().getSequenceId());
ctx.channel().writeAndFlush(res);
}
ctx.fireChannelRead(msg);
}
use of com.zx.sms.codec.cmpp.msg.CmppReportRequestMessage in project SMSGate by Lihuanghe.
the class TestCmpp20DeliverRequestMessageCodec method testReportCodec.
@Test
public void testReportCodec() {
CmppDeliverRequestMessage msg = createTestReq("k k k ");
CmppReportRequestMessage reportRequestMessage = new CmppReportRequestMessage();
reportRequestMessage.setSmscSequence(0x1234L);
reportRequestMessage.setMsgId(new MsgId());
reportRequestMessage.setDestterminalId("13800138000");
reportRequestMessage.setStat("9876");
msg.setReportRequestMessage(reportRequestMessage);
test0(msg);
}
Aggregations