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


Java SipFactory.createHeaderFactory方法代码示例

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


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

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

示例2: init

import javax.sip.SipFactory; //导入方法依赖的package包/类
public void init() {
        SipFactory sipFactory = null;
        sipStack = null;
        sipFactory = SipFactory.getInstance();
        sipFactory.setPathName("gov.nist");
        Properties properties = new Properties();
        properties.setProperty("javax.sip.STACK_NAME", "shootme");
        // You need  16 for logging traces. 32 for debug + traces.
        // Your code will limp at 32 but it is best for debugging.
        properties.setProperty("javax.sip.STACK_NAME", "shootme");
        // You need  16 for logging traces. 32 for debug + traces.
        // Your code will limp at 32 but it is best for debugging.
        properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "32");
        properties.setProperty(
            "gov.nist.javax.sip.DEBUG_LOG",
            "logs/shootmedebug.txt");
        properties.setProperty(
            "gov.nist.javax.sip.SERVER_LOG",
            "logs/shootmelog.txt");
        // Guard against starvation.
        properties.setProperty(
            "gov.nist.javax.sip.READ_TIMEOUT", "1000");
//        properties.setProperty("gov.nist.javax.sip.MESSAGE_PROCESSOR_FACTORY", NioMessageProcessorFactory.class.getName());
        // Test for ttp://code.google.com/p/jain-sip/issues/detail?id=18 NIO Message with no Call-ID throws NPE
//        properties.setProperty("gov.nist.javax.sip.TCP_POST_PARSING_THREAD_POOL_SIZE", "10");
  
        try {
            // Create SipStack object
            sipStack = sipFactory.createSipStack(properties);
            System.out.println("sipStack = " + sipStack);
        } catch (PeerUnavailableException e) {
            // could not find
            // gov.nist.jain.protocol.ip.sip.SipStackImpl
            // in the classpath
            e.printStackTrace();
            System.err.println(e.getMessage());
            if (e.getCause() != null)
                e.getCause().printStackTrace();
            System.exit(0);
        }

        try {
            headerFactory = sipFactory.createHeaderFactory();
            addressFactory = sipFactory.createAddressFactory();
            messageFactory = sipFactory.createMessageFactory();
            ListeningPoint lpTLS = sipStack.createListeningPoint("127.0.0.1", myPort, transport);

            Shootme listener = this;

            SipProvider sipProvider = sipStack.createSipProvider(lpTLS);
            System.out.println("tls provider " + sipProvider);
            sipProvider.addSipListener(listener);

        } catch (Exception ex) {
            System.out.println(ex.getMessage());
            ex.printStackTrace();
            usage();
        }

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

示例3: ProtocolObjects

import javax.sip.SipFactory; //导入方法依赖的package包/类
ProtocolObjects(String stackname, boolean autoDialog, String transport, String logFileDirectory) {

        this.transport = transport;
        this.logFileDirectory = logFileDirectory;
        SipFactory sipFactory = null;

        sipFactory = SipFactory.getInstance();
        sipFactory.setPathName("gov.nist");
        Properties properties = new Properties();
        // If you want to try TCP transport change the following to

        // If you want to use UDP then uncomment this.
        properties.setProperty("javax.sip.STACK_NAME", stackname);

        // The following properties are specific to nist-sip
        // and are not necessarily part of any other jain-sip
        // implementation.
        properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", logFileDirectory
                + stackname + "debug.txt");
        properties.setProperty("gov.nist.javax.sip.SERVER_LOG",
                logFileDirectory + stackname + "log.txt");

        properties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT",
                (autoDialog ? "on" : "off"));

        // Set to 0 in your production code for max speed.
        // You need 16 for logging traces. 32 for debug + traces.
        // Your code will limp at 32 but it is best for debugging.
        properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", new Integer(
                logLevel).toString());

        try {
            // Create SipStack object
            sipStack = sipFactory.createSipStack(properties);

            System.out.println("createSipStack " + sipStack);
        } catch (Exception e) {
            // could not find
            // gov.nist.jain.protocol.ip.sip.SipStackImpl
            // in the classpath
            e.printStackTrace();
            System.err.println(e.getMessage());
            throw new RuntimeException("Stack failed to initialize");
        }

        try {
            headerFactory = sipFactory.createHeaderFactory();
            addressFactory = sipFactory.createAddressFactory();
            messageFactory = sipFactory.createMessageFactory();
        } catch (SipException ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
    }
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:55,代码来源:ProtocolObjects.java

示例4: init

import javax.sip.SipFactory; //导入方法依赖的package包/类
static void init(String stackname)
{
    SipFactory sipFactory = null;

    sipFactory = SipFactory.getInstance();
    sipFactory.setPathName("gov.nist");
    Properties properties = new Properties();
    // If you want to try TCP transport change the following to



    // If you want to use UDP then uncomment this.
    properties.setProperty("javax.sip.STACK_NAME", stackname);

    // The following properties are specific to nist-sip
    // and are not necessarily part of any other jain-sip
    // implementation.
    properties.setProperty("gov.nist.javax.sip.DEBUG_LOG",
        logFileDirectory + stackname + "debug.txt");
    properties.setProperty("gov.nist.javax.sip.SERVER_LOG",
            logFileDirectory + stackname + "log.txt");

    // Set to 0 in your production code for max speed.
    // You need 16 for logging traces. 32 for debug + traces.
    // Your code will limp at 32 but it is best for debugging.
    properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", new Integer(logLevel).toString());

    try {
        // Create SipStack object
        sipStack = sipFactory.createSipStack(properties);

        System.out.println("createSipStack " + sipStack);
    } catch (Exception e) {
        // could not find
        // gov.nist.jain.protocol.ip.sip.SipStackImpl
        // in the classpath
        e.printStackTrace();
        System.err.println(e.getMessage());
        throw new RuntimeException("Stack failed to initialize");
    }

    try {
        headerFactory = sipFactory.createHeaderFactory();
        addressFactory = sipFactory.createAddressFactory();
        messageFactory = sipFactory.createMessageFactory();
    } catch (SipException ex) {
        ex.printStackTrace();
        throw new RuntimeException ( ex);
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:51,代码来源:ProtocolObjects.java

示例5: init

import javax.sip.SipFactory; //导入方法依赖的package包/类
public void init() {
    SipFactory sipFactory = null;
    sipStack = null;
    sipFactory = SipFactory.getInstance();
    sipFactory.setPathName("gov.nist");
    Properties properties = new Properties();
    properties.setProperty("javax.sip.STACK_NAME", "shootme");
    // You need 16 for logging traces. 32 for debug + traces.
    // Your code will limp at 32 but it is best for debugging.
    properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "DEBUG");
    properties.setProperty("gov.nist.javax.sip.DEBUG_LOG",
            "logs/"+this.getClass().getName()+ ".shootmedebug.txt");
    properties.setProperty("gov.nist.javax.sip.SERVER_LOG",
            "shootmelog.txt");
    if(System.getProperty("enableNIO") != null && System.getProperty("enableNIO").equalsIgnoreCase("true")) {
    	logger.info("\nNIO Enabled\n");
    	properties.setProperty("gov.nist.javax.sip.MESSAGE_PROCESSOR_FACTORY", NioMessageProcessorFactory.class.getName());
    }
    try {
        // Create SipStack object
        sipStack = sipFactory.createSipStack(properties);
        logger.info("sipStack = " + sipStack);
    } catch (PeerUnavailableException e) {
        // could not find
        // gov.nist.jain.protocol.ip.sip.SipStackImpl
        // in the classpath
        e.printStackTrace();
        System.err.println(e.getMessage());
        if (e.getCause() != null)
            e.getCause().printStackTrace();
        logger.error("Unexpected error creating stack", e);
        fail ("Unexpected error");
    }

    try {
        headerFactory = sipFactory.createHeaderFactory();
        addressFactory = sipFactory.createAddressFactory();
        messageFactory = sipFactory.createMessageFactory();
        ListeningPoint lp = sipStack.createListeningPoint("127.0.0.1",
                myPort, "udp");

        Shootme listener = this;

        SipProvider sipProvider = sipStack.createSipProvider(lp);
        logger.info("udp provider " + sipProvider);
        sipProvider.addSipListener(listener);

    } catch (Exception ex) {
        fail("Unexpected exception");
    }

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

示例6: SipObjects

import javax.sip.SipFactory; //导入方法依赖的package包/类
public SipObjects(int myPort, String stackName, String automaticDialog) {
    SipFactory sipFactory = SipFactory.getInstance();
    sipFactory.resetFactory();
    sipFactory.setPathName("gov.nist");
    Properties properties = new Properties();
    String stackname = stackName + myPort;
    properties.setProperty("javax.sip.STACK_NAME", stackname);

    // The following properties are specific to nist-sip
    // and are not necessarily part of any other jain-sip
    // implementation.

    properties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", automaticDialog);

   /* properties.setProperty("gov.nist.javax.sip.LOG_FACTORY", SipFoundryLogRecordFactory.class
            .getName()); */

    // Set to 0 in your production code for max speed.
    // You need 16 for logging traces. 32 for debug + traces.
    // Your code will limp at 32 but it is best for debugging.

    properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "32");
    String logFile = "logs/" + stackname + ".txt";
    properties.setProperty("gov.nist.javax.sip.MAX_FORK_TIME_SECONDS", "12");

    properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", logFile);
    if(System.getProperty("enableNIO") != null && System.getProperty("enableNIO").equalsIgnoreCase("true")) {
    	properties.setProperty("gov.nist.javax.sip.MESSAGE_PROCESSOR_FACTORY", NioMessageProcessorFactory.class.getName());
    }
    // Testing DialogTimeout
    properties.setProperty("gov.nist.javax.sip.IS_BACK_TO_BACK_USER_AGENT", "true");

    try {
        // Create SipStack object
        sipStack = sipFactory.createSipStack(properties);
        String logFileDirectory = "logs/";

        /* SipFoundryAppender sfa = new SipFoundryAppender(new SipFoundryLayout(),
                logFileDirectory + "sip" + stackname + ".log");

        ((SipStackImpl) sipStack).addLogAppender(sfa);*/
        System.out.println("createSipStack " + sipStack);
    } catch (Exception e) {
        // could not find
        // gov.nist.jain.protocol.ip.sip.SipStackImpl
        // in the classpath
        e.printStackTrace();
        System.err.println(e.getMessage());
        throw new RuntimeException("Stack failed to initialize");
    }

    try {
        headerFactory = sipFactory.createHeaderFactory();
        addressFactory = sipFactory.createAddressFactory();
        messageFactory = sipFactory.createMessageFactory();
    } catch (SipException ex) {
        ex.printStackTrace();
        throw new RuntimeException(ex);
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:61,代码来源:SipObjects.java

示例7: init

import javax.sip.SipFactory; //导入方法依赖的package包/类
public void init() {
    SipFactory sipFactory = null;
    sipStack = null;
    sipFactory = SipFactory.getInstance();
    sipFactory.setPathName("gov.nist");
    Properties properties = new Properties();
    properties.setProperty("javax.sip.STACK_NAME", "shootme");
    // You need 16 for logging traces. 32 for debug + traces.
    // Your code will limp at 32 but it is best for debugging.
    properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "0");
    properties.setProperty("gov.nist.javax.sip.LOG_MESSAGE_CONTENT", "false");
    properties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", "off");        
    properties.setProperty("gov.nist.javax.sip.DEBUG_LOG",
            "shootmedebug.txt");
    properties.setProperty("gov.nist.javax.sip.SERVER_LOG",
    "shootmelog.txt");
    properties.setProperty("gov.nist.javax.sip.DEBUG_LOG",
    "shootmedebug.txt");
    properties.setProperty("gov.nist.javax.sip.SERVER_LOG",
    "shootmelog.txt");
    properties.setProperty("gov.nist.javax.sip.REENTRANT_LISTENER",
    "true");
    properties.setProperty("gov.nist.javax.sip.THREAD_POOL_SIZE", "4");
    properties.setProperty("gov.nist.javax.sip.RECEIVE_UDP_BUFFER_SIZE", "65536");
    properties.setProperty("gov.nist.javax.sip.SEND_UDP_BUFFER_SIZE", "65536");
    properties.setProperty("gov.nist.javax.sip.CONGESTION_CONTROL_ENABLED", "false");        
    try {
        // Create SipStack object
        sipStack = sipFactory.createSipStack(properties);
    } catch (PeerUnavailableException e) {
        // could not find
        // gov.nist.jain.protocol.ip.sip.SipStackImpl
        // in the classpath
        e.printStackTrace();
        System.err.println(e.getMessage());
        if (e.getCause() != null)
            e.getCause().printStackTrace();
        System.exit(0);
    }

    try {
        headerFactory = sipFactory.createHeaderFactory();
        addressFactory = sipFactory.createAddressFactory();
        messageFactory = sipFactory.createMessageFactory();
        ListeningPoint lp = sipStack.createListeningPoint("127.0.0.1",
                myPort, "udp");

        ShootmeDialogStateless listener = this;

        SipProvider sipProvider = sipStack.createSipProvider(lp);
        sipProvider.addSipListener(listener);

    } catch (Exception ex) {
        ex.printStackTrace();
        usage();
    }

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

示例8: init

import javax.sip.SipFactory; //导入方法依赖的package包/类
public void init() {
    SipFactory sipFactory = null;
    sipStack = null;
    sipFactory = SipFactory.getInstance();
    sipFactory.setPathName("gov.nist");
    Properties properties = new Properties();
    properties.setProperty("javax.sip.STACK_NAME", "server");
    properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "LOG4J");
   
    properties.setProperty("gov.nist.javax.sip.AUTOMATIC_DIALOG_ERROR_HANDLING", "false");
    properties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", "off");
    	properties.setProperty("gov.nist.javax.sip.MESSAGE_PROCESSOR_FACTORY", NioMessageProcessorFactory.class.getName());
    
    try {
        sipStack = sipFactory.createSipStack(properties);
        System.out.println("sipStack = " + sipStack);
    } catch (PeerUnavailableException e) {
       
        e.printStackTrace();
        System.err.println(e.getMessage());
        if (e.getCause() != null)
            e.getCause().printStackTrace();
    }

    try {
        headerFactory = sipFactory.createHeaderFactory();
        addressFactory = sipFactory.createAddressFactory();
        messageFactory = sipFactory.createMessageFactory();
        ListeningPoint lp = sipStack.createListeningPoint(myAddress,
                myPort, transport);

        WebsocketServer listener = this;

        sipProvider = sipStack.createSipProvider(lp);
        System.out.println("udp provider " + sipProvider);
        sipProvider.addSipListener(listener);

    } catch (Exception ex) {
        ex.printStackTrace();
        fail("Unexpected exception");
    }

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

示例9: SipObjects

import javax.sip.SipFactory; //导入方法依赖的package包/类
public SipObjects(int myPort, String stackName, String automaticDialog) {
    SipFactory sipFactory = SipFactory.getInstance();
    sipFactory.resetFactory();
    sipFactory.setPathName("gov.nist");
    Properties properties = new Properties();
    String stackname = stackName + myPort;
    properties.setProperty("javax.sip.STACK_NAME", stackname);

    // The following properties are specific to nist-sip
    // and are not necessarily part of any other jain-sip
    // implementation.

    properties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", automaticDialog);

   /* properties.setProperty("gov.nist.javax.sip.LOG_FACTORY", SipFoundryLogRecordFactory.class
            .getName()); */

    // Set to 0 in your production code for max speed.
    // You need 16 for logging traces. 32 for debug + traces.
    // Your code will limp at 32 but it is best for debugging.

    properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "32");
    String logFile = "logs/" + stackname + ".txt";
    properties.setProperty("gov.nist.javax.sip.MAX_FORK_TIME_SECONDS", "12");

    properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", logFile);
    if(System.getProperty("enableNIO") != null && System.getProperty("enableNIO").equalsIgnoreCase("true")) {
    	properties.setProperty("gov.nist.javax.sip.MESSAGE_PROCESSOR_FACTORY", NioMessageProcessorFactory.class.getName());
    }
    try {
        // Create SipStack object
        sipStack = sipFactory.createSipStack(properties);
        String logFileDirectory = "logs/";

        /* SipFoundryAppender sfa = new SipFoundryAppender(new SipFoundryLayout(),
                logFileDirectory + "sip" + stackname + ".log");

        ((SipStackImpl) sipStack).addLogAppender(sfa);*/
        System.out.println("createSipStack " + sipStack);
    } catch (Exception e) {
        // could not find
        // gov.nist.jain.protocol.ip.sip.SipStackImpl
        // in the classpath
        e.printStackTrace();
        System.err.println(e.getMessage());
        throw new RuntimeException("Stack failed to initialize");
    }

    try {
        headerFactory = sipFactory.createHeaderFactory();
        addressFactory = sipFactory.createAddressFactory();
        messageFactory = sipFactory.createMessageFactory();
    } catch (SipException ex) {
        ex.printStackTrace();
        throw new RuntimeException(ex);
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:58,代码来源:SipObjects.java

示例10: init

import javax.sip.SipFactory; //导入方法依赖的package包/类
public void init() {
    SipFactory sipFactory = null;
    sipStack = null;
    sipFactory = SipFactory.getInstance();
    sipFactory.setPathName("gov.nist");
    Properties properties = new Properties();
    properties.setProperty("javax.sip.STACK_NAME", "shootme");
    // You need 16 for logging traces. 32 for debug + traces.
    // Your code will limp at 32 but it is best for debugging.
    properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "32");
    properties.setProperty("gov.nist.javax.sip.DEBUG_LOG",
            "shootmedebug.txt");
    properties.setProperty("gov.nist.javax.sip.SERVER_LOG",
            "shootmelog.txt");
    if(System.getProperty("enableNIO") != null && System.getProperty("enableNIO").equalsIgnoreCase("true")) {
    	properties.setProperty("gov.nist.javax.sip.MESSAGE_PROCESSOR_FACTORY", NioMessageProcessorFactory.class.getName());
    }

    try {
        // Create SipStack object
        sipStack = sipFactory.createSipStack(properties);
        System.out.println("sipStack = " + sipStack);
    } catch (PeerUnavailableException e) {
        // could not find
        // gov.nist.jain.protocol.ip.sip.SipStackImpl
        // in the classpath
        e.printStackTrace();
        System.err.println(e.getMessage());
        if (e.getCause() != null)
            e.getCause().printStackTrace();
        System.exit(0);
    }

    try {
        headerFactory = sipFactory.createHeaderFactory();
        addressFactory = sipFactory.createAddressFactory();
        messageFactory = sipFactory.createMessageFactory();
        ListeningPoint lp = sipStack.createListeningPoint("127.0.0.1",
                myPort, "udp");

        Shootme listener = this;

        SipProvider sipProvider = sipStack.createSipProvider(lp);
        System.out.println("udp provider " + sipProvider);
        sipProvider.addSipListener(listener);

    } catch (Exception ex) {
        System.out.println(ex.getMessage());
        ex.printStackTrace();
        fail("Unexpected exception");
    }

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

示例11: init

import javax.sip.SipFactory; //导入方法依赖的package包/类
public void init() {
    SipFactory sipFactory = null;
    sipStack = null;
    sipFactory = SipFactory.getInstance();
    sipFactory.setPathName("gov.nist");
    Properties properties = new Properties();
    properties.setProperty("javax.sip.STACK_NAME", "shootme");
    // You need 16 for logging traces. 32 for debug + traces.
    // Your code will limp at 32 but it is best for debugging.
    properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "32");
    properties.setProperty("gov.nist.javax.sip.DEBUG_LOG",
            "shootmedebug.txt");
    properties.setProperty("gov.nist.javax.sip.SERVER_LOG",
            "shootmelog.txt");
    if(System.getProperty("enableNIO") != null && System.getProperty("enableNIO").equalsIgnoreCase("true")) {
    	properties.setProperty("gov.nist.javax.sip.MESSAGE_PROCESSOR_FACTORY", NioMessageProcessorFactory.class.getName());
    }
    try {
        // Create SipStack object
        sipStack = sipFactory.createSipStack(properties);
        System.out.println("sipStack = " + sipStack);
    } catch (PeerUnavailableException e) {
        // could not find
        // gov.nist.jain.protocol.ip.sip.SipStackImpl
        // in the classpath
        e.printStackTrace();
        System.err.println(e.getMessage());
        if (e.getCause() != null)
            e.getCause().printStackTrace();
        fail("Unexpected exception");
    }

    try {
        headerFactory = sipFactory.createHeaderFactory();
        addressFactory = sipFactory.createAddressFactory();
        messageFactory = sipFactory.createMessageFactory();
        ListeningPoint lp = sipStack.createListeningPoint("127.0.0.1",
                myPort, "udp");

        Shootme listener = this;

        SipProvider sipProvider = sipStack.createSipProvider(lp);
        System.out.println("udp provider " + sipProvider);
        sipProvider.addSipListener(listener);

    } catch (Exception ex) {
        ex.printStackTrace();
        fail("Unexpected exception");
    }

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

示例12: init

import javax.sip.SipFactory; //导入方法依赖的package包/类
public void init() {
    SipFactory sipFactory = null;
    sipStack = null;
    sipFactory = SipFactory.getInstance();
    sipFactory.setPathName("gov.nist");
    Properties properties = new Properties();
    properties.setProperty("javax.sip.STACK_NAME", "shootme");
    // You need 16 for logging traces. 32 for debug + traces.
    // Your code will limp at 32 but it is best for debugging.
    properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "32");
    properties.setProperty("gov.nist.javax.sip.DEBUG_LOG",
            "shootmedebug.txt");
    properties.setProperty("gov.nist.javax.sip.SERVER_LOG",
            "shootmelog.txt");
    properties.setProperty("gov.nist.javax.sip.AUTOMATIC_DIALOG_ERROR_HANDLING", "false");
    properties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", "off");
    properties.setProperty("gov.nist.javax.sip.SIP_EVENT_INTERCEPTOR", CallAnalysisInterceptor.class.getName());
    if(System.getProperty("enableNIO") != null && System.getProperty("enableNIO").equalsIgnoreCase("true")) {
    	properties.setProperty("gov.nist.javax.sip.MESSAGE_PROCESSOR_FACTORY", NioMessageProcessorFactory.class.getName());
    }
    try {
        // Create SipStack object
        sipStack = sipFactory.createSipStack(properties);
        System.out.println("sipStack = " + sipStack);
    } catch (PeerUnavailableException e) {
        // could not find
        // gov.nist.jain.protocol.ip.sip.SipStackImpl
        // in the classpath
        e.printStackTrace();
        System.err.println(e.getMessage());
        if (e.getCause() != null)
            e.getCause().printStackTrace();
        System.exit(0);
    }

    try {
        headerFactory = sipFactory.createHeaderFactory();
        addressFactory = sipFactory.createAddressFactory();
        messageFactory = sipFactory.createMessageFactory();
        ListeningPoint lp = sipStack.createListeningPoint("127.0.0.1",
                myPort, "udp");

        Shootme listener = this;

        sipProvider = sipStack.createSipProvider(lp);
        System.out.println("udp provider " + sipProvider);
        sipProvider.addSipListener(listener);

    } catch (Exception ex) {
        ex.printStackTrace();
        fail("Unexpected exception");
    }

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

示例13: init

import javax.sip.SipFactory; //导入方法依赖的package包/类
public void init() {
    SipFactory sipFactory = null;
    sipStack = null;
    sipFactory = SipFactory.getInstance();
    sipFactory.setPathName("gov.nist");
    Properties properties = new Properties();
    properties.setProperty("javax.sip.STACK_NAME", "shootme");
    // You need 16 for logging traces. 32 for debug + traces.
    // Your code will limp at 32 but it is best for debugging.
    properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "32");
    properties.setProperty("gov.nist.javax.sip.DEBUG_LOG",
          "logs/"+ this.getClass().getName() +  ".shootmedebug.txt");
    properties.setProperty("gov.nist.javax.sip.SERVER_LOG",
            "shootmelog.txt");
    if(System.getProperty("enableNIO") != null && System.getProperty("enableNIO").equalsIgnoreCase("true")) {
    	properties.setProperty("gov.nist.javax.sip.MESSAGE_PROCESSOR_FACTORY", NioMessageProcessorFactory.class.getName());
    }
    try {
        // Create SipStack object
        sipStack = sipFactory.createSipStack(properties);
        System.out.println("sipStack = " + sipStack);
    } catch (PeerUnavailableException e) {
        // could not find
        // gov.nist.jain.protocol.ip.sip.SipStackImpl
        // in the classpath
        e.printStackTrace();
        System.err.println(e.getMessage());
        if (e.getCause() != null)
            e.getCause().printStackTrace();
        System.exit(0);
    }

    try {
        headerFactory = sipFactory.createHeaderFactory();
        addressFactory = sipFactory.createAddressFactory();
        messageFactory = sipFactory.createMessageFactory();
        ListeningPoint lp = sipStack.createListeningPoint("127.0.0.1",
                myPort, "udp");

        Shootme listener = this;

        SipProvider sipProvider = sipStack.createSipProvider(lp);
        System.out.println("udp provider " + sipProvider);
        sipProvider.addSipListener(listener);

    } catch (Exception ex) {
        System.out.println(ex.getMessage());
        ex.printStackTrace();
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:51,代码来源:NoToTagOn1xxDialogLeakTest.java

示例14: SipObjects

import javax.sip.SipFactory; //导入方法依赖的package包/类
public SipObjects(int myPort, String stackName, String autoDialogSupport) {
    SipFactory sipFactory = SipFactory.getInstance();
    sipFactory.resetFactory();
    sipFactory.setPathName("gov.nist");
    Properties properties = new Properties();
    String stackname = stackName + myPort;
    properties.setProperty("javax.sip.STACK_NAME", stackname);

    // The following properties are specific to nist-sip
    // and are not necessarily part of any other jain-sip
    // implementation.

    properties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", autoDialogSupport);

   /* properties.setProperty("gov.nist.javax.sip.LOG_FACTORY", SipFoundryLogRecordFactory.class
            .getName()); */

    // Set to 0 in your production code for max speed.
    // You need 16 for logging traces. 32 for debug + traces.
    // Your code will limp at 32 but it is best for debugging.

    properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "DEBUG");
    String logFile = "logs/" + stackname + ".txt";
    properties.setProperty("gov.nist.javax.sip.MAX_FORK_TIME_SECONDS", "12");

    properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", logFile);
    if(System.getProperty("enableNIO") != null && System.getProperty("enableNIO").equalsIgnoreCase("true")) {
    	properties.setProperty("gov.nist.javax.sip.MESSAGE_PROCESSOR_FACTORY", NioMessageProcessorFactory.class.getName());
    }
    // Testing DialogTimeout

    try {
        // Create SipStack object
        sipStack = sipFactory.createSipStack(properties);
        System.out.println("createSipStack " + sipStack);
    } catch (Exception e) {
        // could not find
        // gov.nist.jain.protocol.ip.sip.SipStackImpl
        // in the classpath
        e.printStackTrace();
        System.err.println(e.getMessage());
        throw new RuntimeException("Stack failed to initialize");
    }

    try {
        headerFactory = sipFactory.createHeaderFactory();
        addressFactory = sipFactory.createAddressFactory();
        messageFactory = sipFactory.createMessageFactory();
    } catch (SipException ex) {
        ex.printStackTrace();
        throw new RuntimeException(ex);
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:54,代码来源:SipObjects.java

示例15: init

import javax.sip.SipFactory; //导入方法依赖的package包/类
public void init() {

            
            SipFactory sipFactory = null;
            sipStack = null;
            sipFactory = SipFactory.getInstance();
            sipFactory.setPathName("gov.nist");
            Properties properties = new Properties();
            properties.setProperty("javax.sip.STACK_NAME", "shootme");
            // You need 16 for logging traces. 32 for debug + traces.
            // Your code will limp at 32 but it is best for debugging.
            properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "LOG4J");
            Logger root = Logger.getRootLogger();
            root.setLevel(Level.WARN);
            root.addAppender(new ConsoleAppender(
                new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN)));
            properties.setProperty("gov.nist.javax.sip.DEBUG_LOG",
                    "shootmedebug.txt");
            properties.setProperty("gov.nist.javax.sip.SERVER_LOG",
                    "shootmelog.txt");
            properties.setProperty("gov.nist.javax.sip.AUTOMATIC_DIALOG_ERROR_HANDLING", "false");
            properties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", "off");

            properties.setProperty("gov.nist.javax.sip.TCP_POST_PARSING_THREAD_POOL_SIZE", "20");
            if(System.getProperty("enableNIO") != null && System.getProperty("enableNIO").equalsIgnoreCase("true")) {
            	properties.setProperty("gov.nist.javax.sip.MESSAGE_PROCESSOR_FACTORY", NioMessageProcessorFactory.class.getName());
            }
            try {
                // Create SipStack object
                sipStack = sipFactory.createSipStack(properties);
                System.out.println("sipStack = " + sipStack);
            } catch (PeerUnavailableException e) {
                // could not find
                // gov.nist.jain.protocol.ip.sip.SipStackImpl
                // in the classpath
                e.printStackTrace();
                System.err.println(e.getMessage());
                if (e.getCause() != null)
                    e.getCause().printStackTrace();
                //System.exit(0);
            }

            try {
                headerFactory = sipFactory.createHeaderFactory();
                addressFactory = sipFactory.createAddressFactory();
                messageFactory = sipFactory.createMessageFactory();
                ListeningPoint lp = sipStack.createListeningPoint("127.0.0.1",
                        myPort, "tcp");

                Shootme listener = this;

                sipProvider = sipStack.createSipProvider(lp);
                System.out.println("udp provider " + sipProvider);
                sipProvider.addSipListener(listener);

            } catch (Exception ex) {
                ex.printStackTrace();
                fail("Unexpected exception");
            }

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


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