|  | @@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.gb28181.bean.*;
 | 
	
		
			
				|  |  |  import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
 | 
	
		
			
				|  |  |  import com.genersoft.iot.vmp.gb28181.session.SSRCFactory;
 | 
	
		
			
				|  |  |  import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform;
 | 
	
		
			
				|  |  | +import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
 | 
	
		
			
				|  |  |  import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
 | 
	
		
			
				|  |  |  import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
 | 
	
		
			
				|  |  |  import com.genersoft.iot.vmp.service.IMediaServerService;
 | 
	
	
		
			
				|  | @@ -16,17 +17,22 @@ import com.genersoft.iot.vmp.storager.dao.*;
 | 
	
		
			
				|  |  |  import com.genersoft.iot.vmp.utils.DateUtil;
 | 
	
		
			
				|  |  |  import com.github.pagehelper.PageHelper;
 | 
	
		
			
				|  |  |  import com.github.pagehelper.PageInfo;
 | 
	
		
			
				|  |  | +import gov.nist.javax.sip.message.SIPRequest;
 | 
	
		
			
				|  |  |  import org.slf4j.Logger;
 | 
	
		
			
				|  |  |  import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import javax.sip.InvalidArgumentException;
 | 
	
		
			
				|  |  | +import javax.sip.PeerUnavailableException;
 | 
	
		
			
				|  |  |  import javax.sip.SipException;
 | 
	
		
			
				|  |  | +import javax.sip.SipFactory;
 | 
	
		
			
				|  |  | +import javax.sip.address.Address;
 | 
	
		
			
				|  |  | +import javax.sip.address.SipURI;
 | 
	
		
			
				|  |  | +import javax.sip.header.*;
 | 
	
		
			
				|  |  | +import javax.sip.message.Request;
 | 
	
		
			
				|  |  |  import java.text.ParseException;
 | 
	
		
			
				|  |  | -import java.util.HashMap;
 | 
	
		
			
				|  |  | -import java.util.List;
 | 
	
		
			
				|  |  | -import java.util.Map;
 | 
	
		
			
				|  |  | +import java.util.*;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /**
 | 
	
		
			
				|  |  |   * @author lin
 | 
	
	
		
			
				|  | @@ -182,6 +188,7 @@ public class PlatformServiceImpl implements IPlatformService {
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          return false;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -256,6 +263,31 @@ public class PlatformServiceImpl implements IPlatformService {
 | 
	
		
			
				|  |  |                      },
 | 
	
		
			
				|  |  |                      (parentPlatform.getKeepTimeout())*1000);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        if (parentPlatform.isAutoPushChannel()) {
 | 
	
		
			
				|  |  | +            if (subscribeHolder.getCatalogSubscribe(parentPlatform.getServerGBId()) == null) {
 | 
	
		
			
				|  |  | +                addSimulatedSubscribeInfo(parentPlatform);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }else {
 | 
	
		
			
				|  |  | +            SubscribeInfo catalogSubscribe = subscribeHolder.getCatalogSubscribe(parentPlatform.getServerGBId());
 | 
	
		
			
				|  |  | +            if (catalogSubscribe != null && catalogSubscribe.getExpires() == -1) {
 | 
	
		
			
				|  |  | +                subscribeHolder.removeCatalogSubscribe(parentPlatform.getServerGBId());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public void addSimulatedSubscribeInfo(ParentPlatform parentPlatform) {
 | 
	
		
			
				|  |  | +        // 自动添加一条模拟的订阅信息
 | 
	
		
			
				|  |  | +        SubscribeInfo subscribeInfo = new SubscribeInfo();
 | 
	
		
			
				|  |  | +        subscribeInfo.setId(parentPlatform.getServerGBId());
 | 
	
		
			
				|  |  | +        subscribeInfo.setExpires(-1);
 | 
	
		
			
				|  |  | +        subscribeInfo.setEventType("Catalog");
 | 
	
		
			
				|  |  | +        int random = (int) Math.floor(Math.random() * 10000);
 | 
	
		
			
				|  |  | +        subscribeInfo.setEventId(random + "");
 | 
	
		
			
				|  |  | +        subscribeInfo.setSimulatedCallId(UUID.randomUUID().toString().replace("-", "") + "@" + parentPlatform.getServerIP());
 | 
	
		
			
				|  |  | +        subscribeInfo.setSimulatedFromTag(UUID.randomUUID().toString().replace("-", ""));
 | 
	
		
			
				|  |  | +        subscribeInfo.setSimulatedToTag(UUID.randomUUID().toString().replace("-", ""));
 | 
	
		
			
				|  |  | +        subscribeHolder.putCatalogSubscribe(parentPlatform.getServerGBId(), subscribeInfo);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      private void registerTask(ParentPlatform parentPlatform, SipTransactionInfo sipTransactionInfo){
 |