use of com.zx.sms.codec.smpp.msg.BaseBind in project SMSGate by Lihuanghe.
the class SMPPSessionLoginManager method doLogin.
@Override
protected void doLogin(Channel ch) {
// 发送bind请求
SMPPEndpointEntity smppentity = (SMPPEndpointEntity) entity;
BaseBind bind = createBindRequest(smppentity);
ch.writeAndFlush(bind);
}
use of com.zx.sms.codec.smpp.msg.BaseBind in project SMSGate by Lihuanghe.
the class SMPPSessionLoginManager method failedLogin.
@Override
protected void failedLogin(ChannelHandlerContext ctx, Object msg, long status) {
if (msg instanceof BaseBind) {
logger.error("Connected error status :{},msg : {}", status, msg);
BaseBind message = (BaseBind) msg;
// 认证失败
PduResponse resp = message.createResponse();
resp.setCommandStatus((int) SmppConstants.STATUS_BINDFAIL);
ChannelFuture promise = ctx.writeAndFlush(resp);
final ChannelHandlerContext finalctx = ctx;
promise.addListener(new GenericFutureListener() {
public void operationComplete(Future future) throws Exception {
finalctx.close();
}
});
} else {
logger.error("connect msg type error : {}", msg);
ctx.close();
}
}
use of com.zx.sms.codec.smpp.msg.BaseBind in project SMSGate by Lihuanghe.
the class SMPPSessionLoginManager method doLoginSuccess.
@Override
protected void doLoginSuccess(ChannelHandlerContext ctx, EndpointEntity entity, Object message) {
// 发送bind请求
SMPPEndpointEntity smppentity = (SMPPEndpointEntity) entity;
BaseBind bind = (BaseBind) message;
BaseBindResp resp = (BaseBindResp) bind.createResponse();
resp.setSystemId(bind.getSystemId());
ctx.channel().writeAndFlush(resp);
}
use of com.zx.sms.codec.smpp.msg.BaseBind in project SMSGate by Lihuanghe.
the class SMPPSessionLoginManager method createBindRequest.
private BaseBind createBindRequest(SMPPEndpointEntity entity) {
BaseBind bind = null;
if (entity.getChannelType() == ChannelType.DUPLEX) {
bind = new BindTransceiver();
} else if (entity.getChannelType() == ChannelType.UP) {
bind = new BindReceiver();
} else if (entity.getChannelType() == ChannelType.DOWN) {
bind = new BindTransmitter();
} else {
logger.error("Unable to convert SmppSessionConfiguration into a BaseBind request");
}
bind.setSystemId(entity.getSystemId());
bind.setPassword(entity.getPassword());
bind.setSystemType(entity.getSystemType());
bind.setInterfaceVersion(entity.getInterfaceVersion());
bind.setAddressRange(entity.getAddressRange());
return bind;
}
use of com.zx.sms.codec.smpp.msg.BaseBind in project SMSGate by Lihuanghe.
the class SMPPSessionLoginManager method validClientMsg.
@Override
protected int validClientMsg(EndpointEntity entity, Object msg) {
SMPPEndpointEntity smppentity = (SMPPEndpointEntity) entity;
BaseBind message = (BaseBind) msg;
if (smppentity.getSystemId().equals(message.getSystemId()) && smppentity.getPassword().equals(message.getPassword())) {
return 0;
} else {
return 3;
}
}
Aggregations