当前位置: 首页>>代码示例>>Java>>正文


Java MessageFactory类代码示例

本文整理汇总了Java中javax.sip.message.MessageFactory的典型用法代码示例。如果您正苦于以下问题:Java MessageFactory类的具体用法?Java MessageFactory怎么用?Java MessageFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MessageFactory类属于javax.sip.message包,在下文中一共展示了MessageFactory类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: makeRequest

import javax.sip.message.MessageFactory; //导入依赖的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;
	}
 
开发者ID:SyMPHOnY-,项目名称:Smart-Home-Gateway,代码行数:30,代码来源:RegisterMessage.java

示例2: RequestFactory

import javax.sip.message.MessageFactory; //导入依赖的package包/类
@Inject
public RequestFactory(final MessageFactory messageFactory,
                      final HeaderFactory headerFactory,
                      final AddressFactory addressFactory) {
    this.messageFactory = messageFactory;
    this.headerFactory = headerFactory;
    this.addressFactory = addressFactory;
}
 
开发者ID:mikekwright,项目名称:sip-softphone,代码行数:9,代码来源:RequestFactory.java

示例3: makeRequest

import javax.sip.message.MessageFactory; //导入依赖的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;
	}
 
开发者ID:SyMPHOnY-,项目名称:Smart-Home-Gateway,代码行数:34,代码来源:RegisterMessage.java

示例4: TestCall

import javax.sip.message.MessageFactory; //导入依赖的package包/类
public TestCall(String localTag, SipProvider sipProvider, HeaderFactory headerFactory, MessageFactory messageFactory) {
	this.localTag = localTag;
	this.sipProvider = sipProvider;
	this.messageFactory = messageFactory;
	this.headerFactory = headerFactory;
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:7,代码来源:TestCall.java

示例5: getMessageFactory

import javax.sip.message.MessageFactory; //导入依赖的package包/类
public MessageFactory getMessageFactory() {
    return messageFactory;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:SipConfiguration.java

示例6: setMessageFactory

import javax.sip.message.MessageFactory; //导入依赖的package包/类
/**
 * To use a custom MessageFactory
 */
public void setMessageFactory(MessageFactory messageFactory) {
    this.messageFactory = messageFactory;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:7,代码来源:SipConfiguration.java


注:本文中的javax.sip.message.MessageFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。