/** 开始保持在线 */ public void startKeepAlive() { int keepAliveInterval = FetionConfig.getInteger("fetion.sip.keep-alive-interval") * 1000; this.context .getFetionTimer() .scheduleTask(this.keepAliveTask, keepAliveInterval, keepAliveInterval); int keepConnectionInterval = FetionConfig.getInteger("fetion.sip.keep-connection-interval") * 1000; this.context .getFetionTimer() .scheduleTask(this.keepConnectionTask, keepConnectionInterval, keepConnectionInterval); }
/** * 创建默认的SipcRequest * * @param m * @return */ public SipcRequest createDefaultSipcRequest(String m) { SipcRequest req = new SipcRequest(m, this.user.getDomain()); req.addHeader(SipcHeader.FROM, Integer.toString(this.user.getFetionId())); if (m.equals(this.lastMethod)) { req.addHeader(SipcHeader.CALLID, Integer.toString(this.globalCallId)); req.addHeader(SipcHeader.SEQUENCE, Integer.toString(this.getNextSequence()) + " " + m); } else { req.addHeader(SipcHeader.CALLID, Integer.toString(this.getNextCallID())); req.addHeader(SipcHeader.SEQUENCE, "1 " + m); this.gloalSequence = 1; } req.setAliveTime( (int) (FetionConfig.getInteger("fetion.sip.default-alive-time") + System.currentTimeMillis() / 1000)); this.lastMethod = m; return req; }