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


Java SipURI.setLrParam方法代码示例

本文整理汇总了Java中javax.sip.address.SipURI.setLrParam方法的典型用法代码示例。如果您正苦于以下问题:Java SipURI.setLrParam方法的具体用法?Java SipURI.setLrParam怎么用?Java SipURI.setLrParam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.sip.address.SipURI的用法示例。


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

示例1: sendTo

import javax.sip.address.SipURI; //导入方法依赖的package包/类
private void sendTo(ServerTransaction st, Request request, int targetPort) throws Exception {
    Request newRequest = (Request) request.clone();
    
    SipURI sipUri = addressFactory.createSipURI("UA1", "127.0.0.1");
    sipUri.setPort(targetPort);
    sipUri.setLrParam();
    sipUri.setTransportParam(Shootme.transport);
    Address address = addressFactory.createAddress("client1", sipUri);
    RouteHeader rheader = headerFactory.createRouteHeader(address);

    newRequest.addFirst(rheader);
    ViaHeader viaHeader = headerFactory.createViaHeader(host, this.port, "udp", null);
    newRequest.addFirst(viaHeader);
    ClientTransaction ct1 = sipProviders.get(Shootme.transport).getNewClientTransaction(newRequest);
    sipUri = addressFactory.createSipURI("proxy", "127.0.0.1");
    address = addressFactory.createAddress("proxy", sipUri);
    sipUri.setPort(5070);
    sipUri.setLrParam();
    RecordRouteHeader recordRoute = headerFactory.createRecordRouteHeader(address);
    newRequest.addHeader(recordRoute);
    ct1.setApplicationData(st);
    ct1.sendRequest();
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:24,代码来源:Proxy.java

示例2: sendTo

import javax.sip.address.SipURI; //导入方法依赖的package包/类
private void sendTo(ServerTransaction st, Request request, int targetPort) throws Exception {
    Request newRequest = (Request) request.clone();
    
    SipURI sipUri = addressFactory.createSipURI("UA1", "127.0.0.1");
    sipUri.setPort(targetPort);
    sipUri.setLrParam();
    Address address = addressFactory.createAddress("client1", sipUri);
    RouteHeader rheader = headerFactory.createRouteHeader(address);

    newRequest.addFirst(rheader);
    ViaHeader viaHeader = headerFactory.createViaHeader(host, this.port, transport, null);
    newRequest.addFirst(viaHeader);
    ClientTransaction ct1 = sipProvider.getNewClientTransaction(newRequest);
    sipUri = addressFactory.createSipURI("proxy", "127.0.0.1");
    address = addressFactory.createAddress("proxy", sipUri);
    sipUri.setPort(5070);
    sipUri.setLrParam();
    RecordRouteHeader recordRoute = headerFactory.createRecordRouteHeader(address);
    newRequest.addHeader(recordRoute);
    ct1.setApplicationData(st);
    this.clientTxTable.put(new Integer(targetPort), ct1);
    ct1.sendRequest();
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:24,代码来源:Proxy.java

示例3: MakeRequest

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

示例4: MakeRequest

import javax.sip.address.SipURI; //导入方法依赖的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.SipURI.setLrParam方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。