Search in sources :

Example 1 with ServerEndpoint

use of com.zx.sms.connect.manager.ServerEndpoint in project SMSGate by Lihuanghe.

the class SGIPSessionConnectedHandler method createTestReq.

@Override
protected BaseMessage createTestReq(String content) {
    final SgipEndpointEntity finalentity = (SgipEndpointEntity) getEndpointEntity();
    String sms = "【费用提醒】尊敬的客户,截止2018年2月1日17时";
    if (finalentity instanceof ServerEndpoint) {
        SgipDeliverRequestMessage sgipmsg = new SgipDeliverRequestMessage();
        sgipmsg.setUsernumber("13800138000");
        sgipmsg.setSpnumber("10086");
        sgipmsg.setMsgContent(sms);
        return sgipmsg;
    } else {
        SgipSubmitRequestMessage requestMessage = new SgipSubmitRequestMessage();
        requestMessage.setSpnumber("10086");
        requestMessage.setUsernumber("13800138000");
        requestMessage.setMsgContent(sms);
        requestMessage.setReportflag((short) 0);
        return requestMessage;
    }
}
Also used : SgipDeliverRequestMessage(com.zx.sms.codec.sgip12.msg.SgipDeliverRequestMessage) SgipSubmitRequestMessage(com.zx.sms.codec.sgip12.msg.SgipSubmitRequestMessage) ServerEndpoint(com.zx.sms.connect.manager.ServerEndpoint)

Example 2 with ServerEndpoint

use of com.zx.sms.connect.manager.ServerEndpoint in project SMSGate by Lihuanghe.

the class SMGPSessionConnectedHandler method createTestReq.

@Override
protected BaseMessage createTestReq(String content) {
    final EndpointEntity finalentity = getEndpointEntity();
    if (finalentity instanceof ServerEndpoint) {
        SMGPDeliverMessage pdu = new SMGPDeliverMessage();
        pdu.setDestTermId("10086");
        pdu.setMsgContent(content);
        pdu.setSrcTermId("13800138000");
        return pdu;
    } else {
        SMGPSubmitMessage pdu = new SMGPSubmitMessage();
        pdu.setSrcTermId("10086");
        pdu.setDestTermIdArray("13800138000");
        pdu.setMsgContent(content);
        return pdu;
    }
}
Also used : SMGPDeliverMessage(com.zx.sms.codec.smgp.msg.SMGPDeliverMessage) SMGPSubmitMessage(com.zx.sms.codec.smgp.msg.SMGPSubmitMessage) ServerEndpoint(com.zx.sms.connect.manager.ServerEndpoint) EndpointEntity(com.zx.sms.connect.manager.EndpointEntity)

Example 3 with ServerEndpoint

use of com.zx.sms.connect.manager.ServerEndpoint in project SMSGate by Lihuanghe.

the class SMPPSessionConnectedHandler method createTestReq.

@Override
protected BaseMessage createTestReq(String str) {
    final EndpointEntity finalentity = getEndpointEntity();
    // String content = "£$¥èéùì@";
    if (finalentity instanceof ServerEndpoint) {
        DeliverSm pdu = new DeliverSm();
        pdu.setSourceAddress(new Address((byte) 0, (byte) 0, "13800138000"));
        pdu.setDestAddress(new Address((byte) 0, (byte) 0, "10086"));
        // pdu.setSmsMsg(new SmsTextMessage(content,SmsDcs.getGeneralDataCodingDcs(SmsAlphabet.GSM,SmsMsgClass.CLASS_UNKNOWN)));
        pdu.setSmsMsg(str);
        return pdu;
    } else {
        SubmitSm pdu = new SubmitSm();
        pdu.setRegisteredDelivery((byte) 0);
        pdu.setSourceAddress(new Address((byte) 0, (byte) 0, "10086"));
        pdu.setDestAddress(new Address((byte) 0, (byte) 0, "13800138000"));
        // pdu.setSmsMsg(new SmsTextMessage(content,SmsDcs.getGeneralDataCodingDcs(SmsAlphabet.GSM,SmsMsgClass.CLASS_UNKNOWN)));
        pdu.setSmsMsg(str);
        return pdu;
    }
}
Also used : Address(com.zx.sms.codec.smpp.Address) SubmitSm(com.zx.sms.codec.smpp.msg.SubmitSm) ServerEndpoint(com.zx.sms.connect.manager.ServerEndpoint) EndpointEntity(com.zx.sms.connect.manager.EndpointEntity) DeliverSm(com.zx.sms.codec.smpp.msg.DeliverSm)

Example 4 with ServerEndpoint

use of com.zx.sms.connect.manager.ServerEndpoint in project SMSGate by Lihuanghe.

the class CMPPSessionConnectedHandler method createTestReq.

@Override
protected BaseMessage createTestReq(String content) {
    final EndpointEntity finalentity = getEndpointEntity();
    if (finalentity instanceof ServerEndpoint) {
        CmppDeliverRequestMessage msg = new CmppDeliverRequestMessage();
        msg.setDestId(String.valueOf(System.nanoTime()));
        msg.setLinkid("0000");
        msg.setMsgContent(content);
        msg.setMsgId(new MsgId());
        msg.setServiceid("10086");
        msg.setSrcterminalId(String.valueOf(System.nanoTime()));
        msg.setSrcterminalType((short) 1);
        return msg;
    } else {
        CmppSubmitRequestMessage msg = new CmppSubmitRequestMessage();
        msg.setDestterminalId(String.valueOf(System.nanoTime()));
        msg.setSrcId(String.valueOf(System.nanoTime()));
        msg.setLinkID("0000");
        msg.setMsgContent(content);
        msg.setRegisteredDelivery((short) 0);
        msg.setServiceId("10086");
        return msg;
    }
}
Also used : CmppDeliverRequestMessage(com.zx.sms.codec.cmpp.msg.CmppDeliverRequestMessage) ServerEndpoint(com.zx.sms.connect.manager.ServerEndpoint) CmppSubmitRequestMessage(com.zx.sms.codec.cmpp.msg.CmppSubmitRequestMessage) MsgId(com.zx.sms.common.util.MsgId) EndpointEntity(com.zx.sms.connect.manager.EndpointEntity)

Example 5 with ServerEndpoint

use of com.zx.sms.connect.manager.ServerEndpoint in project SMSGate by Lihuanghe.

the class ConnState method printOne.

private String printOne(EndpointEntity e) {
    StringBuilder sb = new StringBuilder();
    EndpointConnector econn = e.getSingletonConnector();
    if (econn == null)
        return "";
    Channel[] carr = econn.getallChannel();
    if (carr != null && carr.length > 0) {
        for (int i = 0; i < carr.length; i++) {
            Channel ch = carr[i];
            SessionStateManager ssm = (SessionStateManager) ch.pipeline().get("sessionStateManager");
            sb.append("\tch[");
            sb.append(ch.localAddress().toString());
            if (e instanceof ServerEndpoint) {
                sb.append("<-");
            } else {
                sb.append("->");
            }
            sb.append(ch.remoteAddress().toString() + "]");
            sb.append("\tWaitting-resp=").append(ssm.getWaittingResp());
            sb.append("\tWriteCount=").append(ssm.getWriteCount());
            sb.append("\tReadCount=").append(ssm.getReadCount());
            sb.append("\n");
        }
    }
    return sb.toString();
}
Also used : EndpointConnector(com.zx.sms.connect.manager.EndpointConnector) Channel(io.netty.channel.Channel) ServerEndpoint(com.zx.sms.connect.manager.ServerEndpoint) SessionStateManager(com.zx.sms.session.cmpp.SessionStateManager) ServerEndpoint(com.zx.sms.connect.manager.ServerEndpoint)

Aggregations

ServerEndpoint (com.zx.sms.connect.manager.ServerEndpoint)6 EndpointEntity (com.zx.sms.connect.manager.EndpointEntity)3 CmppConnectRequestMessage (com.zx.sms.codec.cmpp.msg.CmppConnectRequestMessage)1 CmppDeliverRequestMessage (com.zx.sms.codec.cmpp.msg.CmppDeliverRequestMessage)1 CmppSubmitRequestMessage (com.zx.sms.codec.cmpp.msg.CmppSubmitRequestMessage)1 SgipDeliverRequestMessage (com.zx.sms.codec.sgip12.msg.SgipDeliverRequestMessage)1 SgipSubmitRequestMessage (com.zx.sms.codec.sgip12.msg.SgipSubmitRequestMessage)1 SMGPDeliverMessage (com.zx.sms.codec.smgp.msg.SMGPDeliverMessage)1 SMGPSubmitMessage (com.zx.sms.codec.smgp.msg.SMGPSubmitMessage)1 Address (com.zx.sms.codec.smpp.Address)1 DeliverSm (com.zx.sms.codec.smpp.msg.DeliverSm)1 SubmitSm (com.zx.sms.codec.smpp.msg.SubmitSm)1 MsgId (com.zx.sms.common.util.MsgId)1 EndpointConnector (com.zx.sms.connect.manager.EndpointConnector)1 SessionStateManager (com.zx.sms.session.cmpp.SessionStateManager)1 Channel (io.netty.channel.Channel)1