本文整理汇总了Java中javax.sip.header.HeaderFactory类的典型用法代码示例。如果您正苦于以下问题:Java HeaderFactory类的具体用法?Java HeaderFactory怎么用?Java HeaderFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HeaderFactory类属于javax.sip.header包,在下文中一共展示了HeaderFactory类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeRequest
import javax.sip.header.HeaderFactory; //导入依赖的package包/类
public Request makeRequest(SipManager sipManager, long cseqNumber, int expiresTime) throws ParseException, InvalidArgumentException {
AddressFactory addressFactory = sipManager.addressFactory;
SipProvider sipProvider = sipManager.sipProvider;
MessageFactory messageFactory = sipManager.messageFactory;
HeaderFactory headerFactory = sipManager.headerFactory;
// Create addresses and via header for the request
Address fromAddress = addressFactory.createAddress("sip:"+ SipManager.sipUserName + "@"+ SipManager.registrarIp);
fromAddress.setDisplayName(SipManager.sipUserName);
Address toAddress = addressFactory.createAddress("sip:" + SipManager.sipUserName + "@" + SipManager.registrarIp);
toAddress.setDisplayName(SipManager.sipUserName);
Address contactAddress = sipManager.createContactAddress();
ArrayList<ViaHeader> viaHeaders = sipManager.createViaHeader();
URI requestURI = addressFactory.createAddress("sip:" + SipManager.registrarIp).getURI();
// Build the request
final Request request = messageFactory.createRequest(requestURI,
Request.REGISTER, sipProvider.getNewCallId(),
headerFactory.createCSeqHeader(cseqNumber, Request.REGISTER),
headerFactory.createFromHeader(fromAddress, "c3ff411e"),
headerFactory.createToHeader(toAddress, null), viaHeaders,
headerFactory.createMaxForwardsHeader(70));
// Add the contact header
request.addHeader(headerFactory.createContactHeader(contactAddress));
ExpiresHeader eh = headerFactory.createExpiresHeader(expiresTime);
request.addHeader(eh);
// Print the request
System.out.println(request.toString());
return request;
}
示例2: AuthenticationHelperImpl
import javax.sip.header.HeaderFactory; //导入依赖的package包/类
/**
* Default constructor for the security manager. There is one Account manager. There is one
* SipSecurity manager for every user name,
*
* @param sipStack -- our stack.
* @param accountManager -- an implementation of the AccountManager interface.
* @param headerFactory -- header factory.
*/
public AuthenticationHelperImpl(SIPTransactionStack sipStack, AccountManager accountManager,
HeaderFactory headerFactory) {
this.accountManager = accountManager;
this.headerFactory = headerFactory;
this.sipStack = sipStack;
this.cachedCredentials = new CredentialsCache(((SIPTransactionStack) sipStack).getTimer());
}
示例3: generateChallenge
import javax.sip.header.HeaderFactory; //导入依赖的package包/类
public void generateChallenge(HeaderFactory headerFactory, Response response, String realm ) {
try {
ProxyAuthenticateHeader proxyAuthenticate = headerFactory
.createProxyAuthenticateHeader(DEFAULT_SCHEME);
proxyAuthenticate.setParameter("realm", realm);
proxyAuthenticate.setParameter("nonce", generateNonce());
proxyAuthenticate.setParameter("opaque", "");
proxyAuthenticate.setParameter("stale", "FALSE");
proxyAuthenticate.setParameter("algorithm", DEFAULT_ALGORITHM);
response.setHeader(proxyAuthenticate);
} catch (Exception ex) {
InternalErrorHandler.handleException(ex);
}
}
示例4: addStatus
import javax.sip.header.HeaderFactory; //导入依赖的package包/类
protected void addStatus(HeaderFactory headerFactory, Request request) {
try {
Header extension = headerFactory.createHeader(EXTENSION_HDR,
new Integer(counter++).toString());
request.addHeader(extension);
} catch (ParseException ex) {
// do nothing
}
}
示例5: generateChallenge
import javax.sip.header.HeaderFactory; //导入依赖的package包/类
public void generateChallenge(HeaderFactory headerFactory, Response response, String realm ) {
try {
WWWAuthenticateHeader wwwAuthenticateHeader = headerFactory.createWWWAuthenticateHeader(DEFAULT_SCHEME);
wwwAuthenticateHeader.setParameter("realm", realm);
wwwAuthenticateHeader.setParameter("nonce", generateNonce());
//wwwAuthenticateHeader.setParameter("opaque", "");
//wwwAuthenticateHeader.setParameter("stale", "FALSE");
wwwAuthenticateHeader.setParameter("algorithm", DEFAULT_ALGORITHM);
response.setHeader(wwwAuthenticateHeader);
} catch (Exception ex) {
InternalErrorHandler.handleException(ex);
}
}
示例6: makeRequest
import javax.sip.header.HeaderFactory; //导入依赖的package包/类
public Request makeRequest(SipManager sipManager, long cseqNumber, int expiresTime) throws ParseException, InvalidArgumentException {
AddressFactory addressFactory = sipManager.addressFactory;
SipProvider sipProvider = sipManager.sipProvider;
MessageFactory messageFactory = sipManager.messageFactory;
HeaderFactory headerFactory = sipManager.headerFactory;
// Create addresses and via header for the request
Address fromAddress = addressFactory.createAddress("sip:"+ SipManager.sipUserName + "@"+ SipManager.registrarIp);
fromAddress.setDisplayName(SipManager.sipUserName);
Address toAddress = addressFactory.createAddress("sip:" + SipManager.sipUserName + "@" + SipManager.registrarIp);
toAddress.setDisplayName(SipManager.sipUserName);
Address contactAddress = sipManager.createContactAddress();
ArrayList<ViaHeader> viaHeaders = sipManager.createViaHeader();
URI requestURI = addressFactory.createAddress("sip:" + SipManager.registrarIp).getURI();
// Build the request
final Request request = messageFactory.createRequest(requestURI,
Request.REGISTER, sipProvider.getNewCallId(),
headerFactory.createCSeqHeader(cseqNumber, Request.REGISTER),
headerFactory.createFromHeader(fromAddress, "c3ff411e"),
headerFactory.createToHeader(toAddress, null), viaHeaders,
headerFactory.createMaxForwardsHeader(70));
// Add the contact header
request.addHeader(headerFactory.createContactHeader(contactAddress));
ExpiresHeader eh = headerFactory.createExpiresHeader(expiresTime);
request.addHeader(eh);
// Print the request
System.out.println(request.toString());
return request;
}
示例7: getAuthenticationHelper
import javax.sip.header.HeaderFactory; //导入依赖的package包/类
public AuthenticationHelper getAuthenticationHelper(
AccountManager accountManager, HeaderFactory headerFactory) {
return new AuthenticationHelperImpl(this, accountManager, headerFactory);
}
示例8: getSecureAuthenticationHelper
import javax.sip.header.HeaderFactory; //导入依赖的package包/类
public AuthenticationHelper getSecureAuthenticationHelper(
SecureAccountManager accountManager, HeaderFactory headerFactory) {
return new AuthenticationHelperImpl(this, accountManager, headerFactory);
}
示例9: TestCall
import javax.sip.header.HeaderFactory; //导入依赖的package包/类
public TestCall(String localTag, SipProvider sipProvider, HeaderFactory headerFactory, MessageFactory messageFactory) {
this.localTag = localTag;
this.sipProvider = sipProvider;
this.messageFactory = messageFactory;
this.headerFactory = headerFactory;
}
示例10: getHeaderFactory
import javax.sip.header.HeaderFactory; //导入依赖的package包/类
public HeaderFactory getHeaderFactory() {
return headerFactory;
}
示例11: setHeaderFactory
import javax.sip.header.HeaderFactory; //导入依赖的package包/类
/**
* To use a custom HeaderFactory
*/
public void setHeaderFactory(HeaderFactory headerFactory) {
this.headerFactory = headerFactory;
}
示例12: getAuthenticationHelper
import javax.sip.header.HeaderFactory; //导入依赖的package包/类
/**
* Get the authentication helper.
*
*
* @param accountManager -- account manager (for fetching credentials).
* @param headerFactory -- header factory.
*
* @return - the authentication helper which can be used for generating the appropriate
* headers for handling authentication challenges for user agents.
*
* @since 2.0
*/
public AuthenticationHelper getAuthenticationHelper(AccountManager accountManager,
HeaderFactory headerFactory);
示例13: getSecureAuthenticationHelper
import javax.sip.header.HeaderFactory; //导入依赖的package包/类
/**
* Get the authentication helper.
*
*
* @param accountManager -- account manager (for fetching credentials).
* @param headerFactory -- header factory.
*
* @return - the authentication helper which can be used for generating the appropriate
* headers for handling authentication challenges for user agents.
*
* @since 2.0
*/
public AuthenticationHelper getSecureAuthenticationHelper(SecureAccountManager accountManager,
HeaderFactory headerFactory);