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

Java RouteHeader类代码示例

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

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



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

示例1: updateRequest

import javax.sip.header.RouteHeader; //导入依赖的package包/类
private void updateRequest(SIPRequest sipRequest) {

        RouteList rl = this.getRouteList();
        if (rl.size() > 0) {
            sipRequest.setHeader(rl);
        } else {
            sipRequest.removeHeader(RouteHeader.NAME);
        }
        if (MessageFactoryImpl.getDefaultUserAgentHeader() != null) {
            sipRequest
                    .setHeader(MessageFactoryImpl.getDefaultUserAgentHeader());
        }

        /*
         * Update the request with Proxy auth header if one has been cached.
         */
        if (this.proxyAuthorizationHeader != null
                && sipRequest.getHeader(ProxyAuthorizationHeader.NAME) == null) {
            sipRequest.setHeader(proxyAuthorizationHeader);
        }

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


示例2: getHeadersToOmmitOnResponseCopy

import javax.sip.header.RouteHeader; //导入依赖的package包/类
private static Set<String> getHeadersToOmmitOnResponseCopy() {
	if (HEADERS_TO_OMMIT_ON_RESPONSE_COPY == null) {
		final Set<String> set = new HashSet<String>();
		set.add(RouteHeader.NAME);
		set.add(RecordRouteHeader.NAME);
		set.add(ViaHeader.NAME);
		set.add(CallIdHeader.NAME);
		set.add(CSeqHeader.NAME);
		set.add(ContactHeader.NAME);
		set.add(FromHeader.NAME);
		set.add(ToHeader.NAME);
		set.add(ContentLengthHeader.NAME);
		HEADERS_TO_OMMIT_ON_RESPONSE_COPY = Collections.unmodifiableSet(set);
	}
	return HEADERS_TO_OMMIT_ON_RESPONSE_COPY;
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:17,代码来源:TestCall.java


示例3: sendTo

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


示例4: sendTo

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


示例5: processRequest

import javax.sip.header.RouteHeader; //导入依赖的package包/类
public void processRequest(RequestEvent requestEvent) {
    try {
        Request request = requestEvent.getRequest();
        SipProvider sipProvider = (SipProvider) requestEvent.getSource();
        this.inviteServerTxProvider = sipProvider;
        
        if (request.getMethod().equals(Request.INVITE)) {
            // Attach a record route header with NO transport here.
            ServerTransaction st = null;
            if (requestEvent.getServerTransaction() == null) {
                st = sipProvider.getNewServerTransaction(request);

            }                
            this.sendTo(st,request,5080 );
                        

        } else {
            // Remove the topmost route header
            // The route header will make sure it gets to the right place.
            logger.info("proxy: Got a request " + request.getMethod());
            Request newRequest = (Request) request.clone();
            newRequest.removeFirst(RouteHeader.NAME);
            String transport = ((SipURI) newRequest.getRequestURI()).getTransportParam();
            sipProviders.get(transport).sendRequest(newRequest);
        }

    } catch (Exception ex) {
        ex.printStackTrace();
        System.exit(0);
    }

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


示例6: processRequest

import javax.sip.header.RouteHeader; //导入依赖的package包/类
public void processRequest(RequestEvent requestEvent) {
    try {
        Request request = requestEvent.getRequest();
        SipProvider sipProvider = (SipProvider) requestEvent.getSource();
        this.inviteServerTxProvider = sipProvider;
        if (request.getMethod().equals(Request.INVITE)) {

            ListeningPoint lp = sipProvider.getListeningPoint(transport);
            String host = lp.getIPAddress();
            int port = lp.getPort();

            ServerTransaction st = null;
            if (requestEvent.getServerTransaction() == null) {
                st = sipProvider.getNewServerTransaction(request);

            }
            
            for ( int i = 0; i < ntargets; i++ ) {
                this.sendTo(st,request,5080 + i);
            }

         
           

        } else {
            // Remove the topmost route header
            // The route header will make sure it gets to the right place.
            logger.info("proxy: Got a request " + request.getMethod());
            Request newRequest = (Request) request.clone();
            newRequest.removeFirst(RouteHeader.NAME);
            sipProvider.sendRequest(newRequest);
        }

    } catch (Exception ex) {
        ex.printStackTrace();
        System.exit(0);
    }

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


示例7: MakeRequest

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


示例8: createAckRequest

import javax.sip.header.RouteHeader; //导入依赖的package包/类
/**
     * Creates a default ACK SIPRequest message for this original request. Note that the
     * defaultACK SIPRequest does not include the content of the original SIPRequest. If
     * responseToHeader is null then the toHeader of this request is used to construct the ACK.
     * Note that tag fields are just copied from the original SIP Request. Added by Jeff Keyser.
     * 
     * @param responseToHeader To header to use for this request.
     * 
     * @return A SIPRequest with an ACK method.
     */
    public SIPRequest createAckRequest(To responseToHeader) {
//    	SIPRequest newRequest;
//        Iterator headerIterator;
//        SIPHeader nextHeader;

    	// cloning instead of iterating through headers so that lazy parsers don't have to parse the messages fully
    	// to create ACK requests
        SIPRequest newRequest = (SIPRequest) this.clone();
//        newRequest = new SIPRequest();
//        newRequest.setRequestLine((RequestLine) this.requestLine.clone());
        newRequest.setMethod(Request.ACK);
        // Ack and cancel do not get ROUTE headers.
        // Route header for ACK is assigned by the
        // Dialog if necessary.
        newRequest.removeHeader(RouteHeader.NAME);
        // Remove proxy auth header.
        // Assigned by the Dialog if necessary.
        newRequest.removeHeader(ProxyAuthorizationHeader.NAME);
        // Adding content is responsibility of user.
        newRequest.removeContent();
        // Content type header is removed since
        // content length is 0.
        newRequest.removeHeader(ContentTypeHeader.NAME);
        // The CSeq header field in the
        // ACK MUST contain the same value for the
        // sequence number as was present in the
        // original request, but the method parameter
        // MUST be equal to "ACK".
        try{
        	newRequest.getCSeq().setMethod(Request.ACK);
        } catch (ParseException e) {
        }
        if (responseToHeader != null) {
            newRequest.setTo(responseToHeader);
        }
        // CONTACT header does not apply for ACK requests.
        newRequest.removeHeader(ContactHeader.NAME);
        newRequest.removeHeader(ExpiresHeader.NAME);
        ViaList via = newRequest.getViaHeaders();
        // Bug reported by Gianluca Martinello
        // The ACK MUST contain a single Via header field,
        // and this MUST be equal to the top Via header
        // field of the original
        // request.
        if(via != null && via.size() > 1) {
        	for(int i = 2; i < via.size(); i++) {
        		via.remove(i);
        	}
        }
        
        if (MessageFactoryImpl.getDefaultUserAgentHeader() != null) {
            newRequest.setHeader(MessageFactoryImpl.getDefaultUserAgentHeader());

        }
        return newRequest;
    }
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:67,代码来源:SIPRequest.java


示例9: equals

import javax.sip.header.RouteHeader; //导入依赖的package包/类
public boolean equals(Object other) {
    return (other instanceof RouteHeader) && super.equals(other);
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:4,代码来源:Route.java


示例10: MakeRequest

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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java Attribute类代码示例发布时间:2022-05-22
下一篇:
Java CodeException类代码示例发布时间: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