@ -37,16 +37,16 @@ public class SIPRequestHeaderProvider {
SipURI requestURI = sipFactory . createAddressFactory ( ) . createSipURI ( device . getDeviceId ( ) , device . getHostAddress ( ) ) ;
SipURI requestURI = sipFactory . createAddressFactory ( ) . createSipURI ( device . getDeviceId ( ) , device . getHostAddress ( ) ) ;
// via
// via
ArrayList < ViaHeader > viaHeaders = new ArrayList < ViaHeader > ( ) ;
ArrayList < ViaHeader > viaHeaders = new ArrayList < ViaHeader > ( ) ;
ViaHeader viaHeader = sipFactory . createHeaderFactory ( ) . createViaHeader ( sipConfig . getSip Ip ( ) , sipConfig . getSip Port ( ) , device . getTransport ( ) , viaTag ) ;
ViaHeader viaHeader = sipFactory . createHeaderFactory ( ) . createViaHeader ( sipConfig . getIp ( ) , sipConfig . getPort ( ) , device . getTransport ( ) , viaTag ) ;
viaHeader . setRPort ( ) ;
viaHeader . setRPort ( ) ;
viaHeaders . add ( viaHeader ) ;
viaHeaders . add ( viaHeader ) ;
// from
// from
SipURI fromSipURI = sipFactory . createAddressFactory ( ) . createSipURI ( sipConfig . getSip Id ( ) ,
SipURI fromSipURI = sipFactory . createAddressFactory ( ) . createSipURI ( sipConfig . getId ( ) ,
sipConfig . getSip Ip ( ) + ":" + sipConfig . getSip Port ( ) ) ;
sipConfig . getIp ( ) + ":" + sipConfig . getPort ( ) ) ;
Address fromAddress = sipFactory . createAddressFactory ( ) . createAddress ( fromSipURI ) ;
Address fromAddress = sipFactory . createAddressFactory ( ) . createAddress ( fromSipURI ) ;
FromHeader fromHeader = sipFactory . createHeaderFactory ( ) . createFromHeader ( fromAddress , fromTag ) ;
FromHeader fromHeader = sipFactory . createHeaderFactory ( ) . createFromHeader ( fromAddress , fromTag ) ;
// to
// to
SipURI toSipURI = sipFactory . createAddressFactory ( ) . createSipURI ( device . getDeviceId ( ) , sipConfig . getSip Domain ( ) ) ;
SipURI toSipURI = sipFactory . createAddressFactory ( ) . createSipURI ( device . getDeviceId ( ) , sipConfig . getDomain ( ) ) ;
Address toAddress = sipFactory . createAddressFactory ( ) . createAddress ( toSipURI ) ;
Address toAddress = sipFactory . createAddressFactory ( ) . createAddress ( toSipURI ) ;
ToHeader toHeader = sipFactory . createHeaderFactory ( ) . createToHeader ( toAddress , toTag ) ;
ToHeader toHeader = sipFactory . createHeaderFactory ( ) . createToHeader ( toAddress , toTag ) ;
@ -68,16 +68,16 @@ public class SIPRequestHeaderProvider {
SipURI requestLine = sipFactory . createAddressFactory ( ) . createSipURI ( channelId , device . getHostAddress ( ) ) ;
SipURI requestLine = sipFactory . createAddressFactory ( ) . createSipURI ( channelId , device . getHostAddress ( ) ) ;
//via
//via
ArrayList < ViaHeader > viaHeaders = new ArrayList < ViaHeader > ( ) ;
ArrayList < ViaHeader > viaHeaders = new ArrayList < ViaHeader > ( ) ;
ViaHeader viaHeader = sipFactory . createHeaderFactory ( ) . createViaHeader ( sipConfig . getSip Ip ( ) , sipConfig . getSip Port ( ) , device . getTransport ( ) , viaTag ) ;
ViaHeader viaHeader = sipFactory . createHeaderFactory ( ) . createViaHeader ( sipConfig . getIp ( ) , sipConfig . getPort ( ) , device . getTransport ( ) , viaTag ) ;
viaHeader . setRPort ( ) ;
viaHeader . setRPort ( ) ;
viaHeaders . add ( viaHeader ) ;
viaHeaders . add ( viaHeader ) ;
//from
//from
SipURI fromSipURI = sipFactory . createAddressFactory ( ) . createSipURI ( sipConfig . getSip Id ( ) , sipConfig . getSip Domain ( ) ) ;
SipURI fromSipURI = sipFactory . createAddressFactory ( ) . createSipURI ( sipConfig . getId ( ) , sipConfig . getDomain ( ) ) ;
Address fromAddress = sipFactory . createAddressFactory ( ) . createAddress ( fromSipURI ) ;
Address fromAddress = sipFactory . createAddressFactory ( ) . createAddress ( fromSipURI ) ;
FromHeader fromHeader = sipFactory . createHeaderFactory ( ) . createFromHeader ( fromAddress , fromTag ) ; //必须要有标记,否则无法创建会话,无法回应ack
FromHeader fromHeader = sipFactory . createHeaderFactory ( ) . createFromHeader ( fromAddress , fromTag ) ; //必须要有标记,否则无法创建会话,无法回应ack
//to
//to
SipURI toSipURI = sipFactory . createAddressFactory ( ) . createSipURI ( channelId , sipConfig . getSip Domain ( ) ) ;
SipURI toSipURI = sipFactory . createAddressFactory ( ) . createSipURI ( channelId , sipConfig . getDomain ( ) ) ;
Address toAddress = sipFactory . createAddressFactory ( ) . createAddress ( toSipURI ) ;
Address toAddress = sipFactory . createAddressFactory ( ) . createAddress ( toSipURI ) ;
ToHeader toHeader = sipFactory . createHeaderFactory ( ) . createToHeader ( toAddress , null ) ;
ToHeader toHeader = sipFactory . createHeaderFactory ( ) . createToHeader ( toAddress , null ) ;
@ -88,11 +88,11 @@ public class SIPRequestHeaderProvider {
CSeqHeader cSeqHeader = sipFactory . createHeaderFactory ( ) . createCSeqHeader ( 1L , Request . INVITE ) ;
CSeqHeader cSeqHeader = sipFactory . createHeaderFactory ( ) . createCSeqHeader ( 1L , Request . INVITE ) ;
request = sipFactory . createMessageFactory ( ) . createRequest ( requestLine , Request . INVITE , callIdHeader , cSeqHeader , fromHeader , toHeader , viaHeaders , maxForwards ) ;
request = sipFactory . createMessageFactory ( ) . createRequest ( requestLine , Request . INVITE , callIdHeader , cSeqHeader , fromHeader , toHeader , viaHeaders , maxForwards ) ;
Address concatAddress = sipFactory . createAddressFactory ( ) . createAddress ( sipFactory . createAddressFactory ( ) . createSipURI ( sipConfig . getSip Id ( ) , sipConfig . getSip Ip ( ) + ":" + sipConfig . getSip Port ( ) ) ) ;
Address concatAddress = sipFactory . createAddressFactory ( ) . createAddress ( sipFactory . createAddressFactory ( ) . createSipURI ( sipConfig . getId ( ) , sipConfig . getIp ( ) + ":" + sipConfig . getPort ( ) ) ) ;
// Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getSip Id(), device.getHost().getIp()+":"+device.getHost().getPort()));
// Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), device.getHost().getIp()+":"+device.getHost().getPort()));
request . addHeader ( sipFactory . createHeaderFactory ( ) . createContactHeader ( concatAddress ) ) ;
request . addHeader ( sipFactory . createHeaderFactory ( ) . createContactHeader ( concatAddress ) ) ;
// Subject
// Subject
SubjectHeader subjectHeader = sipFactory . createHeaderFactory ( ) . createSubjectHeader ( String . format ( "%s:%s,%s:%s" , channelId , ssrc , sipConfig . getSip Id ( ) , 0 ) ) ;
SubjectHeader subjectHeader = sipFactory . createHeaderFactory ( ) . createSubjectHeader ( String . format ( "%s:%s,%s:%s" , channelId , ssrc , sipConfig . getId ( ) , 0 ) ) ;
request . addHeader ( subjectHeader ) ;
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 ) ;
@ -109,11 +109,11 @@ public class SIPRequestHeaderProvider {
viaHeader . setRPort ( ) ;
viaHeader . setRPort ( ) ;
viaHeaders . add ( viaHeader ) ;
viaHeaders . add ( viaHeader ) ;
//from
//from
SipURI fromSipURI = sipFactory . createAddressFactory ( ) . createSipURI ( sipConfig . getSip Id ( ) , sipConfig . getSip Domain ( ) ) ;
SipURI fromSipURI = sipFactory . createAddressFactory ( ) . createSipURI ( sipConfig . getId ( ) , sipConfig . getDomain ( ) ) ;
Address fromAddress = sipFactory . createAddressFactory ( ) . createAddress ( fromSipURI ) ;
Address fromAddress = sipFactory . createAddressFactory ( ) . createAddress ( fromSipURI ) ;
FromHeader fromHeader = sipFactory . createHeaderFactory ( ) . createFromHeader ( fromAddress , fromTag ) ; //必须要有标记,否则无法创建会话,无法回应ack
FromHeader fromHeader = sipFactory . createHeaderFactory ( ) . createFromHeader ( fromAddress , fromTag ) ; //必须要有标记,否则无法创建会话,无法回应ack
//to
//to
SipURI toSipURI = sipFactory . createAddressFactory ( ) . createSipURI ( channelId , sipConfig . getSip Domain ( ) ) ;
SipURI toSipURI = sipFactory . createAddressFactory ( ) . createSipURI ( channelId , sipConfig . getDomain ( ) ) ;
Address toAddress = sipFactory . createAddressFactory ( ) . createAddress ( toSipURI ) ;
Address toAddress = sipFactory . createAddressFactory ( ) . createAddress ( toSipURI ) ;
ToHeader toHeader = sipFactory . createHeaderFactory ( ) . createToHeader ( toAddress , null ) ;
ToHeader toHeader = sipFactory . createHeaderFactory ( ) . createToHeader ( toAddress , null ) ;
@ -124,8 +124,8 @@ public class SIPRequestHeaderProvider {
CSeqHeader cSeqHeader = sipFactory . createHeaderFactory ( ) . createCSeqHeader ( 1L , Request . INVITE ) ;
CSeqHeader cSeqHeader = sipFactory . createHeaderFactory ( ) . createCSeqHeader ( 1L , Request . INVITE ) ;
request = sipFactory . createMessageFactory ( ) . createRequest ( requestLine , Request . INVITE , callIdHeader , cSeqHeader , fromHeader , toHeader , viaHeaders , maxForwards ) ;
request = sipFactory . createMessageFactory ( ) . createRequest ( requestLine , Request . INVITE , callIdHeader , cSeqHeader , fromHeader , toHeader , viaHeaders , maxForwards ) ;
Address concatAddress = sipFactory . createAddressFactory ( ) . createAddress ( sipFactory . createAddressFactory ( ) . createSipURI ( sipConfig . getSip Id ( ) , sipConfig . getSip Ip ( ) + ":" + sipConfig . getSip Port ( ) ) ) ;
Address concatAddress = sipFactory . createAddressFactory ( ) . createAddress ( sipFactory . createAddressFactory ( ) . createSipURI ( sipConfig . getId ( ) , sipConfig . getIp ( ) + ":" + sipConfig . getPort ( ) ) ) ;
// Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getSip Id(), device.getHost().getIp()+":"+device.getHost().getPort()));
// Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), device.getHost().getIp()+":"+device.getHost().getPort()));
request . addHeader ( sipFactory . createHeaderFactory ( ) . createContactHeader ( concatAddress ) ) ;
request . addHeader ( sipFactory . createHeaderFactory ( ) . createContactHeader ( concatAddress ) ) ;
ContentTypeHeader contentTypeHeader = sipFactory . createHeaderFactory ( ) . createContentTypeHeader ( "APPLICATION" , "SDP" ) ;
ContentTypeHeader contentTypeHeader = sipFactory . createHeaderFactory ( ) . createContentTypeHeader ( "APPLICATION" , "SDP" ) ;
@ -139,14 +139,14 @@ public class SIPRequestHeaderProvider {
SipURI requestLine = sipFactory . createAddressFactory ( ) . createSipURI ( channelId , device . getHostAddress ( ) ) ;
SipURI requestLine = sipFactory . createAddressFactory ( ) . createSipURI ( channelId , device . getHostAddress ( ) ) ;
// via
// via
ArrayList < ViaHeader > viaHeaders = new ArrayList < ViaHeader > ( ) ;
ArrayList < ViaHeader > viaHeaders = new ArrayList < ViaHeader > ( ) ;
ViaHeader viaHeader = sipFactory . createHeaderFactory ( ) . createViaHeader ( sipConfig . getSip Ip ( ) , sipConfig . getSip Port ( ) , device . getTransport ( ) , viaTag ) ;
ViaHeader viaHeader = sipFactory . createHeaderFactory ( ) . createViaHeader ( sipConfig . getIp ( ) , sipConfig . getPort ( ) , device . getTransport ( ) , viaTag ) ;
viaHeaders . add ( viaHeader ) ;
viaHeaders . add ( viaHeader ) ;
//from
//from
SipURI fromSipURI = sipFactory . createAddressFactory ( ) . createSipURI ( sipConfig . getSip Id ( ) , sipConfig . getSip Domain ( ) ) ;
SipURI fromSipURI = sipFactory . createAddressFactory ( ) . createSipURI ( sipConfig . getId ( ) , sipConfig . getDomain ( ) ) ;
Address fromAddress = sipFactory . createAddressFactory ( ) . createAddress ( fromSipURI ) ;
Address fromAddress = sipFactory . createAddressFactory ( ) . createAddress ( fromSipURI ) ;
FromHeader fromHeader = sipFactory . createHeaderFactory ( ) . createFromHeader ( fromAddress , fromTag ) ; //必须要有标记,否则无法创建会话,无法回应ack
FromHeader fromHeader = sipFactory . createHeaderFactory ( ) . createFromHeader ( fromAddress , fromTag ) ; //必须要有标记,否则无法创建会话,无法回应ack
//to
//to
SipURI toSipURI = sipFactory . createAddressFactory ( ) . createSipURI ( channelId , sipConfig . getSip Domain ( ) ) ;
SipURI toSipURI = sipFactory . createAddressFactory ( ) . createSipURI ( channelId , sipConfig . getDomain ( ) ) ;
Address toAddress = sipFactory . createAddressFactory ( ) . createAddress ( toSipURI ) ;
Address toAddress = sipFactory . createAddressFactory ( ) . createAddress ( toSipURI ) ;
ToHeader toHeader = sipFactory . createHeaderFactory ( ) . createToHeader ( toAddress , toTag ) ;
ToHeader toHeader = sipFactory . createHeaderFactory ( ) . createToHeader ( toAddress , toTag ) ;
@ -158,7 +158,7 @@ public class SIPRequestHeaderProvider {
CallIdHeader callIdHeader = sipFactory . createHeaderFactory ( ) . createCallIdHeader ( callId ) ;
CallIdHeader callIdHeader = sipFactory . createHeaderFactory ( ) . createCallIdHeader ( callId ) ;
request = sipFactory . createMessageFactory ( ) . createRequest ( requestLine , Request . BYE , callIdHeader , cSeqHeader , fromHeader , toHeader , viaHeaders , maxForwards ) ;
request = sipFactory . createMessageFactory ( ) . createRequest ( requestLine , Request . BYE , callIdHeader , cSeqHeader , fromHeader , toHeader , viaHeaders , maxForwards ) ;
Address concatAddress = sipFactory . createAddressFactory ( ) . createAddress ( sipFactory . createAddressFactory ( ) . createSipURI ( sipConfig . getSip Id ( ) , sipConfig . getSip Ip ( ) + ":" + sipConfig . getSip Port ( ) ) ) ;
Address concatAddress = sipFactory . createAddressFactory ( ) . createAddress ( sipFactory . createAddressFactory ( ) . createSipURI ( sipConfig . getId ( ) , sipConfig . getIp ( ) + ":" + sipConfig . getPort ( ) ) ) ;
return request ;
return request ;
}
}
@ -169,17 +169,17 @@ public class SIPRequestHeaderProvider {
SipURI requestURI = sipFactory . createAddressFactory ( ) . createSipURI ( device . getDeviceId ( ) , device . getHostAddress ( ) ) ;
SipURI requestURI = sipFactory . createAddressFactory ( ) . createSipURI ( device . getDeviceId ( ) , device . getHostAddress ( ) ) ;
// via
// via
ArrayList < ViaHeader > viaHeaders = new ArrayList < ViaHeader > ( ) ;
ArrayList < ViaHeader > viaHeaders = new ArrayList < ViaHeader > ( ) ;
ViaHeader viaHeader = sipFactory . createHeaderFactory ( ) . createViaHeader ( sipConfig . getSip Ip ( ) , sipConfig . getSip Port ( ) ,
ViaHeader viaHeader = sipFactory . createHeaderFactory ( ) . createViaHeader ( sipConfig . getIp ( ) , sipConfig . getPort ( ) ,
device . getTransport ( ) , viaTag ) ;
device . getTransport ( ) , viaTag ) ;
viaHeader . setRPort ( ) ;
viaHeader . setRPort ( ) ;
viaHeaders . add ( viaHeader ) ;
viaHeaders . add ( viaHeader ) ;
// from
// from
SipURI fromSipURI = sipFactory . createAddressFactory ( ) . createSipURI ( sipConfig . getSip Id ( ) ,
SipURI fromSipURI = sipFactory . createAddressFactory ( ) . createSipURI ( sipConfig . getId ( ) ,
sipConfig . getSip Ip ( ) + ":" + sipConfig . getSip Port ( ) ) ;
sipConfig . getIp ( ) + ":" + sipConfig . getPort ( ) ) ;
Address fromAddress = sipFactory . createAddressFactory ( ) . createAddress ( fromSipURI ) ;
Address fromAddress = sipFactory . createAddressFactory ( ) . createAddress ( fromSipURI ) ;
FromHeader fromHeader = sipFactory . createHeaderFactory ( ) . createFromHeader ( fromAddress , fromTag ) ;
FromHeader fromHeader = sipFactory . createHeaderFactory ( ) . createFromHeader ( fromAddress , fromTag ) ;
// to
// to
SipURI toSipURI = sipFactory . createAddressFactory ( ) . createSipURI ( device . getDeviceId ( ) , sipConfig . getSip Domain ( ) ) ;
SipURI toSipURI = sipFactory . createAddressFactory ( ) . createSipURI ( device . getDeviceId ( ) , sipConfig . getDomain ( ) ) ;
Address toAddress = sipFactory . createAddressFactory ( ) . createAddress ( toSipURI ) ;
Address toAddress = sipFactory . createAddressFactory ( ) . createAddress ( toSipURI ) ;
ToHeader toHeader = sipFactory . createHeaderFactory ( ) . createToHeader ( toAddress , toTag ) ;
ToHeader toHeader = sipFactory . createHeaderFactory ( ) . createToHeader ( toAddress , toTag ) ;
@ -192,7 +192,7 @@ public class SIPRequestHeaderProvider {
toHeader , viaHeaders , maxForwards ) ;
toHeader , viaHeaders , maxForwards ) ;
Address concatAddress = sipFactory . createAddressFactory ( ) . createAddress ( sipFactory . createAddressFactory ( ) . createSipURI ( sipConfig . getSip Id ( ) , sipConfig . getSip Ip ( ) + ":" + sipConfig . getSip Port ( ) ) ) ;
Address concatAddress = sipFactory . createAddressFactory ( ) . createAddress ( sipFactory . createAddressFactory ( ) . createSipURI ( sipConfig . getId ( ) , sipConfig . getIp ( ) + ":" + sipConfig . getPort ( ) ) ) ;
request . addHeader ( sipFactory . createHeaderFactory ( ) . createContactHeader ( concatAddress ) ) ;
request . addHeader ( sipFactory . createHeaderFactory ( ) . createContactHeader ( concatAddress ) ) ;
// Expires
// Expires