18339543638 hace 3 años
padre
commit
70505266fc

+ 3 - 3
jetlinks-manager/media-manager/src/main/java/org/jetlinks/community/media/transmit/SIPRequestHeaderProvider.java

@@ -76,12 +76,12 @@ public class SIPRequestHeaderProvider {
 		return request;
 	}
 	int count=1;
-	public Request createInviteRequest(MediaDevice device, String channelId, String content, String viaTag, String fromTag, String toTag, String ssrc, CallIdHeader callIdHeader) throws ParseException, InvalidArgumentException, PeerUnavailableException {
+	public Request createInviteRequest(MediaDevice device,String destAddress, String channelId, String content, String viaTag, String fromTag, String toTag, String ssrc, CallIdHeader callIdHeader) throws ParseException, InvalidArgumentException, PeerUnavailableException {
         SipServerConfig sipConfig=SipContext.getConfig();
         SipFactory sipFactory=SipContext.getSipFactory();
 		Request request = null;
 		//请求行
-		SipURI requestLine = sipFactory.createAddressFactory().createSipURI(channelId, device.getHostAddress());
+		SipURI requestLine = sipFactory.createAddressFactory().createSipURI(channelId, destAddress);
 //        SipURI requestLine = sipFactory.createAddressFactory().createSipURI(channelId, device.getHostAddress());
 		//via
 		ArrayList<ViaHeader> viaHeaders = new ArrayList<ViaHeader>();
@@ -97,7 +97,7 @@ public class SIPRequestHeaderProvider {
 		FromHeader fromHeader = sipFactory.createHeaderFactory().createFromHeader(fromAddress, fromTag);
 		//必须要有标记,否则无法创建会话,无法回应ack
 		//to
-		SipURI toSipURI = sipFactory.createAddressFactory().createSipURI(channelId,sipConfig.getDomain());
+		SipURI toSipURI = sipFactory.createAddressFactory().createSipURI(channelId,destAddress);
 		Address toAddress = sipFactory.createAddressFactory().createAddress(toSipURI);
 		ToHeader toHeader = sipFactory.createHeaderFactory().createToHeader(toAddress,null);
 		

+ 1 - 1
jetlinks-manager/media-manager/src/main/java/org/jetlinks/community/media/transmit/cmd/SipCommander.java

@@ -150,7 +150,7 @@ public class SipCommander {
             CallIdHeader callIdHeader =sipProvider.getNewCallId();
 
 
-            Request request = headerProvider.createInviteRequest(device, channelId, content.toString(), null, "FromInvt" + tm, null, ssrcInfo.getSsrc(), callIdHeader);
+            Request request = headerProvider.createInviteRequest(device, sipConfig.getHost()+":"+sipConfig.getPort(),channelId, content.toString(), null, "FromInvt" + tm, null, ssrcInfo.getSsrc(), callIdHeader);
 
             String finalStreamId = streamId;
             return transmitRequest(sipProvider,request)