• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AddressFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: makeRequest

import javax.sip.address.AddressFactory; //导入依赖的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: testParser

import javax.sip.address.AddressFactory; //导入依赖的package包/类
@Override
public void testParser() {

    System.out.println("*****************************************************");
    System.out.println("parsie parsie.....");
    System.out.println("*****************************************************");

    String[] p_serv_user = {"P-Served-User: <sip:[email protected]>;regstate=reg;sescase=orig\n",
                            "P-Served-User: <sip:[email protected]>;regstate=unreg\n",
                            "P-Served-User: <sip:[email protected]>;sescase=term\n",
                            "P-Served-User: <sip:[email protected]>\n",
                            "P-Served-User: <sip:[email protected];transport=UDP>;sescase=term;regstate=unreg\n"};

    super.testParser(PServedUserParser.class, p_serv_user);

    System.out.println("******************************************************");
    System.out.println("From the perspective of the application, lets test the");
    System.out.println("encoding and usage of the P-Served-User header.");
    System.out.println("******************************************************");

    HeaderFactoryImpl himpl = new HeaderFactoryImpl();
    AddressFactory addfact = new AddressFactoryImpl();
    try {
        PServedUserHeader psuh = himpl.createPServedUserHeader(addfact.createAddress(addfact.createSipURI("aayush", "rancore.com")));
        psuh.setSessionCase("orig");
        psuh.setRegistrationState("reg");
        System.out.println("The encoded header is---> "+psuh.toString());
        System.out.println("The sescase is---> "+psuh.getSessionCase());
        System.out.println("The Regs state is--->"+psuh.getRegistrationState());

    } catch (ParseException e) {

        assertTrue(false);
    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:37,代码来源:PServedUserParserTest.java


示例3: testParser

import javax.sip.address.AddressFactory; //导入依赖的package包/类
@Override
public void testParser() {

    System.out.println("*****************************************************");
    System.out.println("parsie parsie.....");
    System.out.println("*****************************************************");

    String p_prof_key[] = {"P-Profile-Key: <sip:[email protected]>\n",
                           "P-Profile-Key: <sip:chatroom-!.*[email protected]>\n",
                           "P-Profile-Key: <sip:[email protected]>\n"};

    super.testParser(PProfileKeyParser.class, p_prof_key);

    System.out.println("*****************************************************");
    System.out.println("From the perspective of the application, let us test");
    System.out.println("The creation of this header.....");
    System.out.println("*****************************************************");

    HeaderFactoryImpl himpl = new HeaderFactoryImpl();
    AddressFactory addFactory = new AddressFactoryImpl();

    try {
        PProfileKeyHeader ppkey = himpl.createPProfileKeyHeader
            (addFactory.createAddress("aayush's room",
                     addFactory.createSipURI("aayushzChatRoom-19", "rancoremumbai.com")));

        System.out.println("The newly encoded header is---> "+ppkey.toString());
    } catch (ParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:33,代码来源:PProfileKeyParserTest.java


示例4: RequestFactory

import javax.sip.address.AddressFactory; //导入依赖的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


示例5: MakeRequest

import javax.sip.address.AddressFactory; //导入依赖的package包/类
/**
 * 
 * @param sipManager - SipManager object
 * @param to - To identifies receiver IP
 * @param message Message that should be send
 * @return Return SIP Message.
 * @throws ParseException
 * @throws InvalidArgumentException
 */
public Request MakeRequest(SipManager sipManager, String to, String message) throws ParseException, InvalidArgumentException {
	AddressFactory addressFactory = sipManager.addressFactory;
	sipManager.setCseqNumber((long)sipManager.getCseqNumber()+1l);
	Address fromNameAddress = addressFactory.createAddress("sip:"+ SipManager.sipUserName + "@"+ SipManager.registrarIp);
	FromHeader fromHeader = sipManager.headerFactory.createFromHeader(fromNameAddress, "SyMPHOnY");
	URI toAddress = sipManager.addressFactory.createURI(to);
	Address toNameAddress = sipManager.addressFactory.createAddress(toAddress);
	ToHeader toHeader = sipManager.headerFactory.createToHeader(toNameAddress, null);
	URI requestURI = sipManager.addressFactory.createURI(to);
	ArrayList<ViaHeader> viaHeaders = sipManager.createViaHeader();
	CallIdHeader callIdHeader = sipManager.sipProvider.getNewCallId();
	CSeqHeader cSeqHeader = sipManager.headerFactory.createCSeqHeader(sipManager.getCseqNumber(),Request.MESSAGE);
	MaxForwardsHeader maxForwards = sipManager.headerFactory
			.createMaxForwardsHeader(70);
	Request request = sipManager.messageFactory.createRequest(requestURI,
			Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader,
			toHeader, viaHeaders, maxForwards);
	SupportedHeader supportedHeader = sipManager.headerFactory
			.createSupportedHeader("replaces, outbound");
	request.addHeader(supportedHeader);
	SipURI routeUri = sipManager.addressFactory.createSipURI(null,
			SipManager.proxyIp);
	routeUri.setTransportParam(SipManager.transport);
	routeUri.setLrParam();
	routeUri.setPort(SipManager.proxyPort);

	Address routeAddress = sipManager.addressFactory
			.createAddress(routeUri);
	RouteHeader route = sipManager.headerFactory
			.createRouteHeader(routeAddress);
	request.addHeader(route);
	ContentTypeHeader contentTypeHeader = sipManager.headerFactory
			.createContentTypeHeader("text", "plain");
	request.setContent(message, contentTypeHeader);
	System.out.println(request);
	return request;

}
 
开发者ID:SyMPHOnY-,项目名称:Smart-Home-Gateway,代码行数:48,代码来源:MessageMessage.java


示例6: makeRequest

import javax.sip.address.AddressFactory; //导入依赖的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


示例7: getAddressFactory

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


示例8: setAddressFactory

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


示例9: MakeRequest

import javax.sip.address.AddressFactory; //导入依赖的package包/类
/**
 * 
 * @param sipManager - SipManager object
 * @param to - identifies receiver IP
 * @param message is message that should be send
 * @return
 * @throws ParseException
 * @throws InvalidArgumentException
 */
public Request MakeRequest(SipManager sipManager, String to, String message) throws ParseException, InvalidArgumentException {
	AddressFactory addressFactory = sipManager.addressFactory;
	sipManager.setCseqNumber((long)sipManager.getCseqNumber()+1l);
	//SipURI from = sipManager.addressFactory.createSipURI(sipManager.getSipProfile().getSipUserName(), sipManager.getSipProfile().getLocalEndpoint());
	//Address fromNameAddress = sipManager.addressFactory.createAddress(from);
	Address fromNameAddress = addressFactory.createAddress("sip:"+ SipManager.sipUserName + "@"+ SipManager.registrarIp);

	
	// fromNameAddress.setDisplayName(sipUsername);
	FromHeader fromHeader = sipManager.headerFactory.createFromHeader(fromNameAddress, "SyMPHOnY");
	URI toAddress = sipManager.addressFactory.createURI(to);
	Address toNameAddress = sipManager.addressFactory.createAddress(toAddress);
	// toNameAddress.setDisplayName(username);
	ToHeader toHeader = sipManager.headerFactory.createToHeader(toNameAddress, null);
	URI requestURI = sipManager.addressFactory.createURI(to);
	// requestURI.setTransportParam("udp");
	ArrayList<ViaHeader> viaHeaders = sipManager.createViaHeader();
	CallIdHeader callIdHeader = sipManager.sipProvider.getNewCallId();
	
	CSeqHeader cSeqHeader = sipManager.headerFactory.createCSeqHeader(sipManager.getCseqNumber(),Request.MESSAGE);
	

	MaxForwardsHeader maxForwards = sipManager.headerFactory
			.createMaxForwardsHeader(70);

	Request request = sipManager.messageFactory.createRequest(requestURI,
			Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader,
			toHeader, viaHeaders, maxForwards);
	SupportedHeader supportedHeader = sipManager.headerFactory
			.createSupportedHeader("replaces, outbound");
	request.addHeader(supportedHeader);

	SipURI routeUri = sipManager.addressFactory.createSipURI(null,
			SipManager.proxyIp);
	routeUri.setTransportParam(SipManager.transport);
	routeUri.setLrParam();
	routeUri.setPort(SipManager.proxyPort);

	Address routeAddress = sipManager.addressFactory
			.createAddress(routeUri);
	RouteHeader route = sipManager.headerFactory
			.createRouteHeader(routeAddress);
	request.addHeader(route);
	ContentTypeHeader contentTypeHeader = sipManager.headerFactory
			.createContentTypeHeader("text", "plain");
	request.setContent(message, contentTypeHeader);
	System.out.println(request);
	return request;

}
 
开发者ID:SyMPHOnY-,项目名称:Smart-Home-Gateway,代码行数:60,代码来源:MessageMessage.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SequenceEndEvent类代码示例发布时间:2022-05-22
下一篇:
Java ImmutableSortedMultiset类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap