增加Subject头
parent
4e8659e156
commit
ce1aa6137b
|
@ -9,13 +9,7 @@ import javax.sip.SipFactory;
|
||||||
import javax.sip.SipProvider;
|
import javax.sip.SipProvider;
|
||||||
import javax.sip.address.Address;
|
import javax.sip.address.Address;
|
||||||
import javax.sip.address.SipURI;
|
import javax.sip.address.SipURI;
|
||||||
import javax.sip.header.CSeqHeader;
|
import javax.sip.header.*;
|
||||||
import javax.sip.header.CallIdHeader;
|
|
||||||
import javax.sip.header.ContentTypeHeader;
|
|
||||||
import javax.sip.header.FromHeader;
|
|
||||||
import javax.sip.header.MaxForwardsHeader;
|
|
||||||
import javax.sip.header.ToHeader;
|
|
||||||
import javax.sip.header.ViaHeader;
|
|
||||||
import javax.sip.message.Request;
|
import javax.sip.message.Request;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -83,7 +77,7 @@ public class SIPRequestHeaderProvider {
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Request createInviteRequest(Device device, String channelId, String content, String viaTag, String fromTag, String toTag) throws ParseException, InvalidArgumentException, PeerUnavailableException {
|
public Request createInviteRequest(Device device, String channelId, String content, String viaTag, String fromTag, String toTag, String ssrc) throws ParseException, InvalidArgumentException, PeerUnavailableException {
|
||||||
Request request = null;
|
Request request = null;
|
||||||
Host host = device.getHost();
|
Host host = device.getHost();
|
||||||
//请求行
|
//请求行
|
||||||
|
@ -122,7 +116,9 @@ public class SIPRequestHeaderProvider {
|
||||||
Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getSipId(), sipConfig.getSipIp()+":"+sipConfig.getSipPort()));
|
Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getSipId(), sipConfig.getSipIp()+":"+sipConfig.getSipPort()));
|
||||||
// Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getSipId(), device.getHost().getIp()+":"+device.getHost().getPort()));
|
// Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getSipId(), device.getHost().getIp()+":"+device.getHost().getPort()));
|
||||||
request.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress));
|
request.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress));
|
||||||
|
// Subject
|
||||||
|
SubjectHeader subjectHeader = sipFactory.createHeaderFactory().createSubjectHeader(String.format("%s:%s,%s:%s", channelId, ssrc, sipConfig.getSipId(), 0));
|
||||||
|
request.addHeader(subjectHeader);
|
||||||
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "SDP");
|
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "SDP");
|
||||||
request.setContent(content, contentTypeHeader);
|
request.setContent(content, contentTypeHeader);
|
||||||
return request;
|
return request;
|
||||||
|
|
|
@ -309,7 +309,7 @@ public class SIPCommander implements ISIPCommander {
|
||||||
}
|
}
|
||||||
content.append("y="+ssrc+"\r\n");//ssrc
|
content.append("y="+ssrc+"\r\n");//ssrc
|
||||||
|
|
||||||
Request request = headerProvider.createInviteRequest(device, channelId, content.toString(), null, "live", null);
|
Request request = headerProvider.createInviteRequest(device, channelId, content.toString(), null, "live", null, ssrc);
|
||||||
|
|
||||||
ClientTransaction transaction = transmitRequest(device, request);
|
ClientTransaction transaction = transmitRequest(device, request);
|
||||||
streamSession.put(ssrc, transaction);
|
streamSession.put(ssrc, transaction);
|
||||||
|
|
Loading…
Reference in New Issue