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


Java SipURI.setTransportParam方法代码示例

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


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

示例1: createContactHeader

import javax.sip.address.SipURI; //导入方法依赖的package包/类
public ContactHeader createContactHeader() {
    try {
        String ipAddress = this.getIPAddress();
        int port = this.getPort();
        SipURI sipURI = new SipUri();
        sipURI.setHost(ipAddress);
        sipURI.setPort(port);
        sipURI.setTransportParam(this.transport);
        Contact contact = new Contact();
        AddressImpl address = new AddressImpl();
        address.setURI(sipURI);
        contact.setAddress(address);
        
        return contact;
    } catch (Exception ex) {
        InternalErrorHandler.handleException("Unexpected exception",logger);
        return null;
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:20,代码来源:ListeningPointImpl.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();
    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

示例3: createTiContact

import javax.sip.address.SipURI; //导入方法依赖的package包/类
/**
 * Add a contact for the TI.
 */
public ContactHeader createTiContact() throws Exception {
    try {
        ContactHeader contact = tiHeaderFactory.createContactHeader();

        // JvB: getIPAddress may return null!
        String ip = tiSipProvider.getSipStack().getIPAddress();
        if (ip == null) {
            ListeningPoint lp = (ListeningPoint) tiSipProvider
                    .getSipStack().getListeningPoints().next();
            ip = lp.getIPAddress();
        }

        SipURI srcSipURI = tiAddressFactory.createSipURI(null, ip);
        srcSipURI.setPort(tiSipProvider.getListeningPoint("udp").getPort());
        srcSipURI.setTransportParam("udp");
        Address address = tiAddressFactory.createAddress(srcSipURI);
        address.setDisplayName("TI Contact");
        contact.setAddress(address);
        return contact;
    } catch (Exception ex) {
        ex.printStackTrace();
        assertTrue(false);
        throw ex;
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:29,代码来源:MessageFlowHarness.java

示例4: createRiContact

import javax.sip.address.SipURI; //导入方法依赖的package包/类
/**
 * Add a contact for the TI.
 */
public ContactHeader createRiContact() throws TckInternalError {
    try {
        ContactHeader contact = riHeaderFactory.createContactHeader();
        // BUG reported by Ben Evans (Open Cloud):
        // Should be using RI's address factory here, not TI's.

        ListeningPoint lp = riSipProvider.getListeningPoints()[0];
        SipURI srcSipURI = riAddressFactory.createSipURI(null, lp
                .getIPAddress());
        srcSipURI.setPort(lp.getPort());
        srcSipURI.setTransportParam(lp.getTransport());
        Address address = riAddressFactory.createAddress(srcSipURI);
        address.setDisplayName("RI Contact");
        contact.setAddress(address);
        return contact;
    } catch (Exception ex) {
        throw new TckInternalError(ex.getMessage());
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:23,代码来源:MessageFlowHarness.java

示例5: createContactHeader

import javax.sip.address.SipURI; //导入方法依赖的package包/类
private void createContactHeader() throws ParseException {
    SipURI contactURI = addressFactory.createSipURI(getFromUser(), getFromHost());
    contactURI.setTransportParam(getTransport());
    contactURI.setPort(Integer.valueOf(getFromPort()).intValue());
    Address contactAddress = addressFactory.createAddress(contactURI);

    // Add the contact address.
    contactAddress.setDisplayName(getFromUser());

    contactHeader = headerFactory.createContactHeader(contactAddress);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:12,代码来源:SipConfiguration.java

示例6: 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

示例7: getFromHeader

import javax.sip.address.SipURI; //导入方法依赖的package包/类
public FromHeader getFromHeader(boolean isNew)
        throws CommunicationsException {
    if (fromHeader != null && !isNew) {
        return fromHeader;
    }
    try {
        SipURI fromURI = (SipURI) addressFactory
                .createURI(currentlyUsedURI);

        fromURI.setTransportParam(listeningPoint.getTransport());

        fromURI.setPort(listeningPoint.getPort());
        Address fromAddress = addressFactory.createAddress(fromURI);
        if (displayName != null && displayName.trim().length() > 0) {
            fromAddress.setDisplayName(displayName);
        } else {
            fromAddress
                    .setDisplayName(UserCredentials.getUserDisplay());// UserCredentials.getUser());
            // JOptionPane.showMessageDialog(null,currentlyUsedURI);
        }
        fromHeader = headerFactory.createFromHeader(fromAddress,
                Integer.toString(hashCode()));

    }
    catch (ParseException ex) {
        throw new CommunicationsException(
                "A ParseException occurred while creating From Header!",
                ex);
    }
    return fromHeader;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:32,代码来源:SipManager.java

示例8: getFromHeader

import javax.sip.address.SipURI; //导入方法依赖的package包/类
public FromHeader getFromHeader(boolean isNew)
        throws CommunicationsException {

    if (fromHeader != null && !isNew) {
        return fromHeader;
    }
    try {
        SipURI fromURI = (SipURI) addressFactory
                .createURI(currentlyUsedURI);

        fromURI.setTransportParam(listeningPoint.getTransport());

        fromURI.setPort(listeningPoint.getPort());
        Address fromAddress = addressFactory.createAddress(fromURI);
        if (displayName != null && displayName.trim().length() > 0) {
            fromAddress.setDisplayName(displayName);
        } else {
            fromAddress
                    .setDisplayName(Credentials.getUserDisplay());
        }
        fromHeader = headerFactory.createFromHeader(fromAddress,
                Integer.toString(hashCode()));

    }
    catch (ParseException ex) {
        throw new CommunicationsException(
                "A ParseException occurred while creating From Header!",
                ex);
    }
    return fromHeader;
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:32,代码来源:SipManager.java

示例9: sendInvite

import javax.sip.address.SipURI; //导入方法依赖的package包/类
public void sendInvite( ReferToHeader to ) {

        try {

            String fromName = "Referee";
            String fromSipAddress = "here.com";
            String fromDisplayName = "The Master Blaster";

            // create >From Header
            SipURI fromAddress = addressFactory.createSipURI(fromName,
                    fromSipAddress);

            Address fromNameAddress = addressFactory.createAddress(fromAddress);
            fromNameAddress.setDisplayName(fromDisplayName);
            FromHeader fromHeader = headerFactory.createFromHeader(
                    fromNameAddress, "12345");

            // create To Header
            ToHeader toHeader = headerFactory.createToHeader( to.getAddress(),
                    null);

            // get Request URI
            SipURI requestURI = (SipURI) to.getAddress().getURI();

            ListeningPoint lp = mySipProvider.getListeningPoint(transport);

            // Create ViaHeaders

            ArrayList viaHeaders = new ArrayList();
            ViaHeader viaHeader = headerFactory.createViaHeader("127.0.0.1",
                    lp.getPort(), transport, null);

            // add via headers
            viaHeaders.add(viaHeader);

            // Create a new CallId header
            CallIdHeader callIdHeader = mySipProvider.getNewCallId();
            // JvB: Make sure that the implementation matches the messagefactory
            callIdHeader = headerFactory.createCallIdHeader( callIdHeader.getCallId() );


            // Create a new Cseq header
            CSeqHeader cSeqHeader = headerFactory.createCSeqHeader(1L,
                    Request.INVITE);

            // Create a new MaxForwardsHeader
            MaxForwardsHeader maxForwards = headerFactory
                    .createMaxForwardsHeader(70);

            // Create the request. (TODO should read request type from Refer-To)
            Request request = messageFactory.createRequest(requestURI,
                    Request.INVITE, callIdHeader, cSeqHeader, fromHeader,
                    toHeader, viaHeaders, maxForwards);
            // Create contact headers
            String host = lp.getIPAddress();

            SipURI contactURI = addressFactory.createSipURI(fromName, host);
            contactURI.setPort(lp.getPort());
            contactURI.setTransportParam( transport );

            Address contactAddress = addressFactory.createAddress(contactURI);

            // Add the contact address.
            contactAddress.setDisplayName(fromName);

            ContactHeader contactHeader = headerFactory.createContactHeader(contactAddress);
            request.addHeader(contactHeader);

            // Create the client transaction.
            ClientTransaction inviteTid = mySipProvider.getNewClientTransaction(request);

            logger.info("Invite Dialog = " + inviteTid.getDialog());

            // send the request out.
            inviteTid.sendRequest();

        } catch (Throwable ex) {
            TestHarness.fail("Failed to send INVITE, because of " + ex);
        }
    }
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:81,代码来源:Referee.java

示例10: 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

示例11: init

import javax.sip.address.SipURI; //导入方法依赖的package包/类
boolean init()
{
	try {
		SipURI from = addressFactory.createSipURI(getFromUsername(), getFromHost()
				+ ":" + getFromPort());
		Address fromNameAddress = addressFactory.createAddress(from);
		fromNameAddress.setDisplayName(getFromUsername());
		FromHeader fromHeader = headerFactory.createFromHeader(fromNameAddress,
				getSoftwareVersion());

		SipURI toAddress = addressFactory.createSipURI(getToUsername(), getToHost()
				+ ":" + getToPort());
		Address toNameAddress = addressFactory.createAddress(toAddress);
		toNameAddress.setDisplayName(getToUsername());
		ToHeader toHeader = headerFactory.createToHeader(toNameAddress, null);

		SipURI requestURI = addressFactory.createSipURI(getToUsername(), getToHost()
				+ ":" + getToPort());
		requestURI.setTransportParam("udp");

		ArrayList<ViaHeader> viaHeaders = new ArrayList<ViaHeader>();
		ViaHeader viaHeader = headerFactory.createViaHeader(getFromHost(),
				getFromPort(), "udp", null);
		viaHeaders.add(viaHeader);

		CSeqHeader cSeqHeader = headerFactory.createCSeqHeader(1L, message);

		MaxForwardsHeader maxForwards = headerFactory
				.createMaxForwardsHeader(70);
		request = messageFactory.createRequest(requestURI,
				message, callIdHeader, cSeqHeader, fromHeader,
				toHeader, viaHeaders, maxForwards);

		SipURI contactURI = addressFactory.createSipURI(getFromUsername(),
				getFromHost());
		contactURI.setPort(getFromPort());
		Address contactAddress = addressFactory.createAddress(contactURI);
		contactAddress.setDisplayName(getFromUsername());
		ContactHeader contactHeader = headerFactory
				.createContactHeader(contactAddress);
		request.addHeader(contactHeader);
	}
	catch (Exception e)
	{
		logger.error("Error initializing stack: ", e);
		return false;
	}
	return true;
}
 
开发者ID:lmangani,项目名称:Reaper,代码行数:50,代码来源:RequestMessage.java


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