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


Java SipFactory类代码示例

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


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

示例1: Server

import javax.sip.SipFactory; //导入依赖的package包/类
public Server() {
    try {
        final Properties defaultProperties = new Properties();
        host = "127.0.0.1";

        defaultProperties.setProperty("javax.sip.STACK_NAME", "server");
        defaultProperties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "DEBUG");
        defaultProperties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "server_debug_ViaRPortTest.txt");
        defaultProperties.setProperty("gov.nist.javax.sip.SERVER_LOG", "server_log_ViaRPortTest.txt");
        defaultProperties.setProperty("gov.nist.javax.sip.TCP_POST_PARSING_THREAD_POOL_SIZE", "64");
        defaultProperties.setProperty("gov.nist.javax.sip.MESSAGE_PROCESSOR_FACTORY", NioMessageProcessorFactory.class.getName());
        this.sipFactory = SipFactory.getInstance();
        this.sipFactory.setPathName("gov.nist");
        this.sipStack = this.sipFactory.createSipStack(defaultProperties);
        this.sipStack.start();
        ListeningPoint lp2 = this.sipStack.createListeningPoint(host, SERVER_PORT, testProtocol);
        this.provider2 = this.sipStack.createSipProvider(lp2);
        this.provider2.addSipListener(this);
    } catch (Exception e) {
        e.printStackTrace();
        Assert.fail("unexpected exception ");
    }

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

示例2: getRIFactories

import javax.sip.SipFactory; //导入依赖的package包/类
static void getRIFactories(boolean autoDialog) {
    try {
        riFactory = SipFactory.getInstance();
        if (riFactory == null) {
            throw new TckInternalError("could not get SipFactory");
        }
        riFactory.resetFactory();

        // Testing against the RI.
        riFactory.setPathName(PATH_GOV_NIST);

        riAddressFactory = riFactory.createAddressFactory();

        assertTrue( "RI must be gov.nist implementation", riAddressFactory instanceof AddressFactoryImpl );

        riHeaderFactory = riFactory.createHeaderFactory();
        riMessageFactory = riFactory.createMessageFactory();
    } catch (Exception ex) {
        throw new TckInternalError("Could not get factories");
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:22,代码来源:TestHarness.java

示例3: initFactory

import javax.sip.SipFactory; //导入依赖的package包/类
public static boolean initFactory(SipFactory sipFactory, Configuration configuration)
{
	try {
		headerFactory = sipFactory.createHeaderFactory();
		addressFactory = sipFactory.createAddressFactory();
		messageFactory = sipFactory.createMessageFactory();
		sdpFactory = SdpFactory.getInstance();
		fromPort = configuration.getWritePort();
		fromHost = configuration.getWriteInterface();
		fromUsername = configuration.getWriteUsername();
		toHost = configuration.getCollectorHost();
		toPort = "" + configuration.getCollectorPort();
		toUsername = configuration.getCollectorUsername();
		softwareVersion = configuration.getSoftwareVersion();
		return true;
	}
	catch (Exception e)
	{
		logger.error("Error initializing stack: ", e);
	}
	return false;
}
 
开发者ID:lmangani,项目名称:Reaper,代码行数:23,代码来源:SipMessage.java

示例4: SipInboundCall

import javax.sip.SipFactory; //导入依赖的package包/类
public SipInboundCall() {
	localMediaPort = -1;

	sipHandler = SipHandler.getInstance("127.0.0.1", 5060);
	sipFactory = SipFactory.getInstance();

	try {
		DatagramSocket socket = new DatagramSocket();
		localMediaPort = socket.getLocalPort();
		socket.close();
		initRTP(localMediaPort);
	} catch (Exception e1) {
		BrokerFactory.getLoggingBroker().logError(e1);
	}


	sipHandler.addRequestListener(this);
	sipHandler.addResponseListener(this);

	BrokerFactory.getLoggingBroker().logDebug("Initialized SipInbound");
	
}
 
开发者ID:davidrudder23,项目名称:OpenNotification,代码行数:23,代码来源:SipInboundCall.java

示例5: initStack

import javax.sip.SipFactory; //导入依赖的package包/类
private void initStack() throws SipException, TooManyListenersException,
		NumberFormatException, InvalidArgumentException, ParseException {
	this.sipFactory = SipFactory.getInstance();
	this.sipFactory.setPathName("gov.nist");
	this.sipStack = this.sipFactory.createSipStack(Test.properties);
	this.sipStack.start();
	this.listeningPoint = this.sipStack.createListeningPoint(properties.getProperty(
			SIP_BIND_ADDRESS, "127.0.0.1"), Integer.valueOf(properties
			.getProperty(SIP_PORT_BIND, "5060")), properties.getProperty(
			TRANSPORTS_BIND, "udp"));
	this.provider = this.sipStack.createSipProvider(this.listeningPoint);
	this.provider.addSipListener(this);
	this.headerFactory = sipFactory.createHeaderFactory();
	this.messageFactory = sipFactory.createMessageFactory();
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:16,代码来源:Test.java

示例6: Client

import javax.sip.SipFactory; //导入依赖的package包/类
public Client() {
    try {
        final Properties defaultProperties = new Properties();
        String host = "127.0.0.1";
        defaultProperties.setProperty("javax.sip.STACK_NAME", "client");
        defaultProperties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "DEBUG");
        defaultProperties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "client_debug.txt");
        defaultProperties.setProperty("gov.nist.javax.sip.SERVER_LOG", "client_log.txt");
        defaultProperties.setProperty("gov.nist.javax.sip.READ_TIMEOUT", "1000");
        defaultProperties.setProperty("gov.nist.javax.sip.CACHE_SERVER_CONNECTIONS","false");
        defaultProperties.setProperty("gov.nist.javax.sip.MESSAGE_PROCESSOR_FACTORY", NioMessageProcessorFactory.class.getName());
        defaultProperties.setProperty("gov.nist.javax.sip.TLS_CLIENT_AUTH_TYPE", "DisabledAll");
        defaultProperties.setProperty("gov.nist.javax.sip.TLS_CLIENT_PROTOCOLS", "SSLv2Hello, TLSv1");
        
        this.sipFactory = SipFactory.getInstance();
        this.sipFactory.setPathName("gov.nist");
        this.sipStack = this.sipFactory.createSipStack(defaultProperties);
        this.sipStack.start();
        ListeningPoint lp = this.sipStack.createListeningPoint(host, CLIENT_PORT, testProtocol);
        this.provider = this.sipStack.createSipProvider(lp);
        headerFactory = this.sipFactory.createHeaderFactory();
        messageFactory = this.sipFactory.createMessageFactory();
        addressFactory = this.sipFactory.createAddressFactory();
        this.provider.addSipListener(this);
    } catch (Exception e) {
        e.printStackTrace();
        Assert.fail("unexpected exception ");
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:30,代码来源:NIOParsingTest.java

示例7: Server

import javax.sip.SipFactory; //导入依赖的package包/类
public Server() {
    try {
        final Properties defaultProperties = new Properties();
        host = "127.0.0.1";

        defaultProperties.setProperty("javax.sip.STACK_NAME", "server");
        defaultProperties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "DEBUG");
        defaultProperties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "server_debug_NoAutoDialogTest.txt");
        defaultProperties.setProperty("gov.nist.javax.sip.SERVER_LOG", "server_log_NoAutoDialogTest.txt");
        defaultProperties.setProperty("gov.nist.javax.sip.READ_TIMEOUT", "1000");
        defaultProperties.setProperty("gov.nist.javax.sip.CACHE_SERVER_CONNECTIONS",
                "false");
        if(System.getProperty("enableNIO") != null && System.getProperty("enableNIO").equalsIgnoreCase("true")) {
        	defaultProperties.setProperty("gov.nist.javax.sip.MESSAGE_PROCESSOR_FACTORY", NioMessageProcessorFactory.class.getName());
        }
        this.sipFactory = SipFactory.getInstance();
        this.sipFactory.setPathName("gov.nist");
        this.sipStack = this.sipFactory.createSipStack(defaultProperties);
        this.sipStack.start();
        ListeningPoint lp = this.sipStack.createListeningPoint(host, SERVER_PORT, testProtocol);
        this.provider = this.sipStack.createSipProvider(lp);;
        this.provider.addSipListener(this);
    } catch (Exception e) {
        e.printStackTrace();
        Assert.fail("unexpected exception ");
    }

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

示例8: Client

import javax.sip.SipFactory; //导入依赖的package包/类
public Client() {
    try {
        final Properties defaultProperties = new Properties();
        String host = "127.0.0.1";
        defaultProperties.setProperty("javax.sip.STACK_NAME", "client");
        defaultProperties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "DEBUG");
        defaultProperties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "client_debug.txt");
        defaultProperties.setProperty("gov.nist.javax.sip.SERVER_LOG", "client_log.txt");
        defaultProperties.setProperty("gov.nist.javax.sip.READ_TIMEOUT", "1000");
        defaultProperties.setProperty("gov.nist.javax.sip.CACHE_SERVER_CONNECTIONS","false");
        if(System.getProperty("enableNIO") != null && System.getProperty("enableNIO").equalsIgnoreCase("true")) {
        	defaultProperties.setProperty("gov.nist.javax.sip.MESSAGE_PROCESSOR_FACTORY", NioMessageProcessorFactory.class.getName());
        }
        this.sipFactory = SipFactory.getInstance();
        this.sipFactory.setPathName("gov.nist");
        this.sipStack = this.sipFactory.createSipStack(defaultProperties);
        this.sipStack.start();
        ListeningPoint lp = this.sipStack.createListeningPoint(host, CLIENT_PORT, testProtocol);
        this.provider = this.sipStack.createSipProvider(lp);
        headerFactory = this.sipFactory.createHeaderFactory();
        messageFactory = this.sipFactory.createMessageFactory();
        addressFactory = this.sipFactory.createAddressFactory();
        this.provider.addSipListener(this);
    } catch (Exception e) {
        e.printStackTrace();
        Assert.fail("unexpected exception ");
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:29,代码来源:MultipleContactsTest.java

示例9: BackToBackUserAgent

import javax.sip.SipFactory; //导入依赖的package包/类
public BackToBackUserAgent(int port1, int port2) {
    SipFactory sipFactory = null;
    sipFactory = SipFactory.getInstance();
    sipFactory.setPathName("gov.nist");
    Properties properties = new Properties();
    this.protocolObjects = new ProtocolObjects("backtobackua","gov.nist","udp",true,true, false);

 
    try {
        headerFactory = protocolObjects.headerFactory;
        addressFactory = protocolObjects.addressFactory;
        messageFactory = protocolObjects.messageFactory;
        SipStack sipStack = protocolObjects.sipStack;
        ListeningPoint lp1 = sipStack.createListeningPoint("127.0.0.1", port1, "udp");
        ListeningPoint lp2 = sipStack.createListeningPoint("127.0.0.1", port2, "udp");
        SipProvider sp1 = sipStack.createSipProvider(lp1);
        SipProvider sp2 = sipStack.createSipProvider(lp2);
        this.listeningPoints[0] = lp1;
        this.listeningPoints[1] = lp2;
        this.providers[0] = sp1;
        this.providers[1] = sp2;
        sp1.addSipListener(this);
        sp2.addSipListener(this);
    } catch (Exception ex) {
        
    }

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

示例10: Server

import javax.sip.SipFactory; //导入依赖的package包/类
public Server() {
    try {
        final Properties defaultProperties = new Properties();
        host = "127.0.0.1";
        defaultProperties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", "off");
        defaultProperties.setProperty("javax.sip.STACK_NAME", "server");
        defaultProperties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "DEBUG");
        defaultProperties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "server_debug_NoAutoDialogTest.txt");
        defaultProperties.setProperty("gov.nist.javax.sip.SERVER_LOG", "server_log_NoAutoDialogTest.txt");
        defaultProperties.setProperty("gov.nist.javax.sip.READ_TIMEOUT", "1000");
        defaultProperties.setProperty("gov.nist.javax.sip.CACHE_SERVER_CONNECTIONS",
                "false");
        if(System.getProperty("enableNIO") != null && System.getProperty("enableNIO").equalsIgnoreCase("true")) {
        	defaultProperties.setProperty("gov.nist.javax.sip.MESSAGE_PROCESSOR_FACTORY", NioMessageProcessorFactory.class.getName());
        }
        this.sipFactory = SipFactory.getInstance();
        this.sipFactory.setPathName("gov.nist");
        this.sipStack = this.sipFactory.createSipStack(defaultProperties);
        this.sipStack.start();
        ListeningPoint lp = this.sipStack.createListeningPoint(host, SERVER_PORT, testProtocol);
        this.provider = this.sipStack.createSipProvider(lp);
        headerFactory = this.sipFactory.createHeaderFactory();
        messageFactory = this.sipFactory.createMessageFactory();
        addressFactory = this.sipFactory.createAddressFactory();
        this.provider.addSipListener(this);
    } catch (Exception e) {
        e.printStackTrace();
        fail("unexpected exception ");
    }

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

示例11: Client

import javax.sip.SipFactory; //导入依赖的package包/类
public Client() {
    try {
        final Properties defaultProperties = new Properties();
        host = "127.0.0.1";
        defaultProperties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", "off");
        defaultProperties.setProperty("javax.sip.STACK_NAME", "client");
        defaultProperties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "DEBUG");
        defaultProperties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "client_debug_NoAutoDialogTest.txt");
        defaultProperties.setProperty("gov.nist.javax.sip.SERVER_LOG", "client_log_NoAutoDialogTest.txt");
        defaultProperties.setProperty("gov.nist.javax.sip.READ_TIMEOUT", "1000");
        defaultProperties.setProperty("gov.nist.javax.sip.CACHE_SERVER_CONNECTIONS",
                "false");
        if(System.getProperty("enableNIO") != null && System.getProperty("enableNIO").equalsIgnoreCase("true")) {
        	defaultProperties.setProperty("gov.nist.javax.sip.MESSAGE_PROCESSOR_FACTORY", NioMessageProcessorFactory.class.getName());
        }
        this.sipFactory = SipFactory.getInstance();
        this.sipFactory.setPathName("gov.nist");
        this.sipStack = this.sipFactory.createSipStack(defaultProperties);
        this.sipStack.start();
        ListeningPoint lp = this.sipStack.createListeningPoint(host, CLIENT_PORT, testProtocol);
        this.provider = this.sipStack.createSipProvider(lp);
        headerFactory = this.sipFactory.createHeaderFactory();
        messageFactory = this.sipFactory.createMessageFactory();
        addressFactory = this.sipFactory.createAddressFactory();
        this.provider.addSipListener(this);
    } catch (Exception e) {
        e.printStackTrace();
        fail("unexpected exception ");
    }

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

示例12: Server

import javax.sip.SipFactory; //导入依赖的package包/类
public Server() {
    try {
        final Properties defaultProperties = new Properties();
        host = "127.0.0.1";

        defaultProperties.setProperty("javax.sip.STACK_NAME", "server");
        defaultProperties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "DEBUG");
        defaultProperties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "server_debug_ViaRPortTest.txt");
        defaultProperties.setProperty("gov.nist.javax.sip.SERVER_LOG", "server_log_ViaRPortTest.txt");
        defaultProperties.setProperty("gov.nist.javax.sip.READ_TIMEOUT", "1000");
        defaultProperties.setProperty("gov.nist.javax.sip.CACHE_SERVER_CONNECTIONS",
                "false");
        defaultProperties.setProperty("gov.nist.javax.sip.MESSAGE_PROCESSOR_FACTORY", NioMessageProcessorFactory.class.getName());
        defaultProperties.setProperty("gov.nist.javax.sip.NIO_MAX_SOCKET_IDLE_TIME", "" + CLOSE_DELAY / 4);
        defaultProperties.setProperty("gov.nist.javax.sip.TLS_CLIENT_AUTH_TYPE", "DisabledAll");
        defaultProperties.setProperty("gov.nist.javax.sip.TLS_CLIENT_PROTOCOLS", "SSLv2Hello, TLSv1");
        this.sipFactory = SipFactory.getInstance();
        this.sipFactory.setPathName("gov.nist");
        this.sipStack = this.sipFactory.createSipStack(defaultProperties);
        this.sipStack.start();
        ListeningPoint lp = this.sipStack.createListeningPoint(host, SERVER_PORT, testProtocol);
        ListeningPoint lp2 = this.sipStack.createListeningPoint(host, SERVER_PORT2, testProtocol2);
        this.provider = this.sipStack.createSipProvider(lp);
        this.provider2 = this.sipStack.createSipProvider(lp2);
        this.provider.addSipListener(this);
        this.provider2.addSipListener(this);
    } catch (Exception e) {
        e.printStackTrace();
        Assert.fail("unexpected exception ");
    }

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

示例13: Server

import javax.sip.SipFactory; //导入依赖的package包/类
public Server() {
    try {
        final Properties defaultProperties = new Properties();
        host = "127.0.0.1";

        defaultProperties.setProperty("javax.sip.STACK_NAME", "server");
        defaultProperties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "DEBUG");
        defaultProperties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "server_debug_ViaRPortTest.txt");
        defaultProperties.setProperty("gov.nist.javax.sip.SERVER_LOG", "server_log_ViaRPortTest.txt");
        defaultProperties.setProperty("gov.nist.javax.sip.READ_TIMEOUT", "1000");
        defaultProperties.setProperty("gov.nist.javax.sip.CACHE_SERVER_CONNECTIONS",
                "false");
        if(System.getProperty("enableNIO") != null && System.getProperty("enableNIO").equalsIgnoreCase("true")) {
        	defaultProperties.setProperty("gov.nist.javax.sip.MESSAGE_PROCESSOR_FACTORY", NioMessageProcessorFactory.class.getName());
        }
        this.sipFactory = SipFactory.getInstance();
        this.sipFactory.setPathName("gov.nist");
        this.sipStack = this.sipFactory.createSipStack(defaultProperties);
        this.sipStack.start();
        ListeningPoint lp = this.sipStack.createListeningPoint(host, SERVER_PORT, testProtocol);
        this.provider = this.sipStack.createSipProvider(lp);;
        this.provider.addSipListener(this);
    } catch (Exception e) {
        e.printStackTrace();
        Assert.fail("unexpected exception ");
    }

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

示例14: getTIFactories

import javax.sip.SipFactory; //导入依赖的package包/类
static void getTIFactories() {
    try {
        tiFactory = SipFactory.getInstance();

        // JvB: need this! but before setting path
        tiFactory.resetFactory();

        // if no TI path is specified on the command line, then assume
        // RI self-test mode

        //String tiPathName = System.getProperty( IMPLEMENTATION_PATH, PATH_RI_HELPER );
        String tiPathName = System.getProperty( IMPLEMENTATION_PATH, "gov.nist" );

        // Yes this does access implementation classes but we have to do
        // things
        // this way for self test. v1.2 only assumes one instance of
        // factories per vendor
        // per jvm.
        tiFactory.setPathName(tiPathName);

        tiAddressFactory = tiFactory.createAddressFactory();
        tiHeaderFactory = tiFactory.createHeaderFactory();
        tiMessageFactory = tiFactory.createMessageFactory();
    } catch (Exception ex) {
        ex.printStackTrace();
        System.out
                .println("Cannot get TI factories -- cannot proceed! Bailing");
        System.exit(0);
    }
    // Cannot sensibly proceed so bail out.
    if (tiAddressFactory == null || tiMessageFactory == null
            || tiHeaderFactory == null) {
        System.out
                .println("Cannot get TI factories --  cannot proceed! Bailing!!");
        System.exit(0);
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:38,代码来源:TestHarness.java

示例15: init

import javax.sip.SipFactory; //导入依赖的package包/类
public synchronized boolean init()
{
	if (initialized == true)
		return true;
	initialized = true;
	logger.info("Starting the collector stack...");
	try {
		SipStack sipStack;
		Configuration configuration;
		configuration = new Configuration();
		configuration.setStackName(STACK_NAME);
		SipFactory.getInstance().setPathName("gov.nist");
		sipStack = SipFactory.getInstance().createSipStack(configuration);
		RequestMessage.initFactory(SipFactory.getInstance(), configuration);
		ListeningPoint reaperUdp = sipStack.createListeningPoint(configuration.getWriteInterface(), configuration.getWritePort(), "udp");
		collectorProvider = sipStack.createSipProvider(reaperUdp);
		collectorProvider.addSipListener(new CollectorListener());
		collectorProvider.setAutomaticDialogSupportEnabled(false);
		logger.info("Collector SIP stack initialized successfully");
	}
	catch (Exception e)
	{
		logger.error("Error initializing stack: ", e);
		return false;
	}
	return true;
}
 
开发者ID:lmangani,项目名称:Reaper,代码行数:28,代码来源:CollectorStack.java


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