| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -17,13 +17,10 @@ import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import lombok.extern.slf4j.Slf4j; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.slf4j.Logger; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.slf4j.LoggerFactory; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.beans.factory.annotation.Qualifier; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.beans.factory.annotation.Value; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					// import org.springframework.context.annotation.ComponentScan;
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.context.annotation.DependsOn; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.context.annotation.Lazy; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.stereotype.Component; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -53,12 +50,12 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Lazy | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@Qualifier(value="tcpSipProvider") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Qualifier(value = "tcpSipProvider") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private SipProvider tcpSipProvider; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Lazy | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@Qualifier(value="udpSipProvider") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Qualifier(value = "udpSipProvider") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private SipProvider udpSipProvider; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -221,12 +218,12 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public boolean ptzCmd(Device device, String channelId, int leftRight, int upDown, int inOut, int moveSpeed, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                          int zoomSpeed) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								String cmdStr= cmdString(leftRight, upDown, inOut, moveSpeed, zoomSpeed); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String cmdStr = cmdString(leftRight, upDown, inOut, moveSpeed, zoomSpeed); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            StringBuffer ptzXml = new StringBuffer(200); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ptzXml.append("<?xml version=\"1.0\" ?>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ptzXml.append("<Control>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ptzXml.append("<CmdType>DeviceControl</CmdType>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								ptzXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ptzXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ptzXml.append("<DeviceID>" + channelId + "</DeviceID>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ptzXml.append("<PTZCmd>" + cmdStr + "</PTZCmd>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ptzXml.append("<Info>\r\n"); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -261,13 +258,13 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public boolean frontEndCmd(Device device, String channelId, int cmdCode, int parameter1, int parameter2, int combineCode2) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String cmdStr= frontEndCmdString(cmdCode, parameter1, parameter2, combineCode2); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String cmdStr = frontEndCmdString(cmdCode, parameter1, parameter2, combineCode2); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            System.out.println("控制字符串:" + cmdStr); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            StringBuffer ptzXml = new StringBuffer(200); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ptzXml.append("<?xml version=\"1.0\" ?>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ptzXml.append("<Control>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ptzXml.append("<CmdType>DeviceControl</CmdType>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ptzXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ptzXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ptzXml.append("<DeviceID>" + channelId + "</DeviceID>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ptzXml.append("<PTZCmd>" + cmdStr + "</PTZCmd>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ptzXml.append("<Info>\r\n"); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -290,6 +287,7 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * 前端控制指令(用于转发上级指令) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param device    控制设备 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param channelId 预览通道 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param cmdString 前端控制指令串 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -301,7 +299,7 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ptzXml.append("<?xml version=\"1.0\" ?>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ptzXml.append("<Control>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ptzXml.append("<CmdType>DeviceControl</CmdType>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ptzXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ptzXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ptzXml.append("<DeviceID>" + channelId + "</DeviceID>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ptzXml.append("<PTZCmd>" + cmdString + "</PTZCmd>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ptzXml.append("<Info>\r\n"); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -360,12 +358,12 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        content.append("t=0 0\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (mediaConfig.getSeniorSdp()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									if("TCP-PASSIVE".equals(streamMode)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									}else if ("TCP-ACTIVE".equals(streamMode)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									}else if("UDP".equals(streamMode)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										content.append("m=video "+ mediaPort +" RTP/AVP 96 126 125 99 34 98 97\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if ("TCP-PASSIVE".equals(streamMode)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                content.append("m=video " + mediaPort + " TCP/RTP/AVP 96 126 125 99 34 98 97\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } else if ("TCP-ACTIVE".equals(streamMode)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                content.append("m=video " + mediaPort + " TCP/RTP/AVP 96 126 125 99 34 98 97\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } else if ("UDP".equals(streamMode)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                content.append("m=video " + mediaPort + " RTP/AVP 96 126 125 99 34 98 97\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            content.append("a=recvonly\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            content.append("a=rtpmap:96 PS/90000\r\n"); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -377,26 +375,26 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            content.append("a=fmtp:99 profile-level-id=3\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            content.append("a=rtpmap:98 H264/90000\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            content.append("a=rtpmap:97 MPEG4/90000\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									if("TCP-PASSIVE".equals(streamMode)){ // tcp被动模式
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if ("TCP-PASSIVE".equals(streamMode)) { // tcp被动模式
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                content.append("a=setup:passive\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                content.append("a=connection:new\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									}else if ("TCP-ACTIVE".equals(streamMode)) { // tcp主动模式
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } else if ("TCP-ACTIVE".equals(streamMode)) { // tcp主动模式
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                content.append("a=setup:active\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                content.append("a=connection:new\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								}else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									if("TCP-PASSIVE".equals(streamMode)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 98 97\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									}else if ("TCP-ACTIVE".equals(streamMode)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 98 97\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									}else if("UDP".equals(streamMode)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										content.append("m=video "+ mediaPort +" RTP/AVP 96 98 97\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if ("TCP-PASSIVE".equals(streamMode)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                content.append("m=video " + mediaPort + " TCP/RTP/AVP 96 98 97\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } else if ("TCP-ACTIVE".equals(streamMode)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                content.append("m=video " + mediaPort + " TCP/RTP/AVP 96 98 97\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } else if ("UDP".equals(streamMode)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                content.append("m=video " + mediaPort + " RTP/AVP 96 98 97\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            content.append("a=recvonly\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            content.append("a=rtpmap:96 PS/90000\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            content.append("a=rtpmap:98 H264/90000\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            content.append("a=rtpmap:97 MPEG4/90000\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									if("TCP-PASSIVE".equals(streamMode)) { // tcp被动模式
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if ("TCP-PASSIVE".equals(streamMode)) { // tcp被动模式
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                content.append("a=setup:passive\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                content.append("a=recvonly\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                content.append("a=rtpmap:96 PS/90000\r\n"); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -617,7 +615,7 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            broadcastXml.append("<?xml version=\"1.0\" ?>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            broadcastXml.append("<Notify>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            broadcastXml.append("<CmdType>Broadcast</CmdType>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								broadcastXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            broadcastXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            broadcastXml.append("<SourceID>" + sipConfig.getSipId() + "</SourceID>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            broadcastXml.append("<TargetID>" + device.getDeviceId() + "</TargetID>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            broadcastXml.append("</Notify>\r\n"); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -635,6 +633,7 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return false; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public void audioBroadcastCmd(Device device, SipSubscribe.Event errorEvent) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        try { | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -642,7 +641,7 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            broadcastXml.append("<?xml version=\"1.0\" ?>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            broadcastXml.append("<Notify>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            broadcastXml.append("<CmdType>Broadcast</CmdType>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								broadcastXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            broadcastXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            broadcastXml.append("<SourceID>" + sipConfig.getSipId() + "</SourceID>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            broadcastXml.append("<TargetID>" + device.getDeviceId() + "</TargetID>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            broadcastXml.append("</Notify>\r\n"); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -674,7 +673,7 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<?xml version=\"1.0\" ?>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<Control>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<CmdType>DeviceControl</CmdType>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								cmdXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (XmlUtil.isEmpty(channelId)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                cmdXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } else { | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -709,7 +708,7 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<?xml version=\"1.0\" ?>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<Control>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<CmdType>DeviceControl</CmdType>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								cmdXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<TeleBoot>Boot</TeleBoot>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("</Control>\r\n"); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -741,7 +740,7 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<?xml version=\"1.0\" ?>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<Control>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<CmdType>DeviceControl</CmdType>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								cmdXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<GuardCmd>" + guardCmdStr + "</GuardCmd>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("</Control>\r\n"); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -772,7 +771,7 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<?xml version=\"1.0\" ?>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<Control>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<CmdType>DeviceControl</CmdType>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								cmdXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<AlarmCmd>ResetAlarm</AlarmCmd>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!XmlUtil.isEmpty(alarmMethod) || !XmlUtil.isEmpty(alarmType)) { | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -816,7 +815,7 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<?xml version=\"1.0\" ?>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<Control>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<CmdType>DeviceControl</CmdType>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								cmdXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (XmlUtil.isEmpty(channelId)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                cmdXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } else { | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -854,7 +853,7 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<?xml version=\"1.0\" ?>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<Control>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<CmdType>DeviceControl</CmdType>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								cmdXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (XmlUtil.isEmpty(channelId)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                cmdXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } else { | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -922,7 +921,7 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<?xml version=\"1.0\" ?>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<Control>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<CmdType>DeviceConfig</CmdType>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								cmdXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (XmlUtil.isEmpty(channelId)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                cmdXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } else { | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -976,7 +975,7 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            catalogXml.append("<Query>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            catalogXml.append("<CmdType>DeviceStatus</CmdType>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								catalogXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            catalogXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            catalogXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            catalogXml.append("</Query>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -1008,7 +1007,7 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            catalogXml.append("<Query>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            catalogXml.append("<CmdType>DeviceInfo</CmdType>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								catalogXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            catalogXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            catalogXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            catalogXml.append("</Query>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -1042,7 +1041,7 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            catalogXml.append("<Query>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            catalogXml.append("<CmdType>Catalog</CmdType>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								catalogXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            catalogXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            catalogXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            catalogXml.append("</Query>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -1076,7 +1075,7 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            recordInfoXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            recordInfoXml.append("<Query>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            recordInfoXml.append("<CmdType>RecordInfo</CmdType>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								recordInfoXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            recordInfoXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            recordInfoXml.append("<DeviceID>" + channelId + "</DeviceID>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            recordInfoXml.append("<StartTime>" + DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(startTime) + "</StartTime>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            recordInfoXml.append("<EndTime>" + DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(endTime) + "</EndTime>\r\n"); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -1107,7 +1106,7 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param device        视频设备 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param startPriority 报警起始级别(可选) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param endPriority   报警终止级别(可选) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * @param alarmMethods	报警方式条件(可选) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param alarmMethod   报警方式条件(可选) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param alarmType     报警类型 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param startTime     报警发生起始时间(可选) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param endTime       报警发生终止时间(可选) | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -1121,7 +1120,7 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<?xml version=\"1.0\" ?>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<Query>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<CmdType>Alarm</CmdType>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								cmdXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!XmlUtil.isEmpty(startPriority)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                cmdXml.append("<StartAlarmPriority>" + startPriority + "</StartAlarmPriority>\r\n"); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -1171,7 +1170,7 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<?xml version=\"1.0\" ?>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<Query>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<CmdType>ConfigDownload</CmdType>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								cmdXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (XmlUtil.isEmpty(channelId)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                cmdXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } else { | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -1206,7 +1205,7 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<?xml version=\"1.0\" ?>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<Query>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<CmdType>PresetQuery</CmdType>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								cmdXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (XmlUtil.isEmpty(channelId)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                cmdXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } else { | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -1240,7 +1239,7 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            mobilePostitionXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            mobilePostitionXml.append("<Query>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            mobilePostitionXml.append("<CmdType>MobilePosition</CmdType>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								mobilePostitionXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            mobilePostitionXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            mobilePostitionXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            mobilePostitionXml.append("<Interval>60</Interval>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            mobilePostitionXml.append("</Query>\r\n"); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -1269,6 +1268,7 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param interval 上报时间间隔 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @return true = 命令发送成功 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public boolean mobilePositionSubscribe(Device device, int expires, int interval) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            StringBuffer subscribePostitionXml = new StringBuffer(200); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -1287,7 +1287,7 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    : udpSipProvider.getNewCallId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								Request request = headerProvider.createSubscribeRequest(device, subscribePostitionXml.toString(), "z9hG4bK-viaPos-" + tm, "fromTagPos" + tm, null, expires, "presence" ,callIdHeader); //Position;id=" + tm.substring(tm.length() - 4));
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Request request = headerProvider.createSubscribeRequest(device, subscribePostitionXml.toString(), "z9hG4bK-viaPos-" + tm, "fromTagPos" + tm, null, expires, "presence", callIdHeader); //Position;id=" + tm.substring(tm.length() - 4));
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            transmitRequest(device, request); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return true; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -1340,7 +1340,19 @@ public class SIPCommander implements ISIPCommander { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cmdXml.append("</Query>\r\n"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String tm = Long.toString(System.currentTimeMillis()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								Request request = headerProvider.createSubscribeRequest(device, cmdXml.toString(), "viaTagPos" + tm, "fromTagPos" + tm, null, expires, "presence" );  | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    : udpSipProvider.getNewCallId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Request request = headerProvider.createSubscribeRequest( | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    device, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    cmdXml.toString(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    "viaTagPos" + tm, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    "fromTagPos" + tm, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    null, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    expires, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    "presence", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    callIdHeader); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            transmitRequest(device, request); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return true; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |