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


Java SipException.printStackTrace方法代码示例

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


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

示例1: encodeBody

import javax.sip.SipException; //导入方法依赖的package包/类
public StringBuilder encodeBody(StringBuilder encoding) {

//        StringBuilder encoding = new StringBuilder();
        /*
         * no need to check for the presence of icid-value. According to the
         * spec above this is a mandatory field. if it does not exist, then we
         * should throw an exception
         *
         * JvB 26/5: fix for issue #159, check for quotes around icid value
         * 
         * Aayush: 29th November 2011 : Added fix for P-Charging-Vector header's parameters to accept quoted string values.
         */
       gov.nist.core.NameValue nv = getNameValue( ParameterNamesIms.ICID_VALUE );
       		if(nv!=null)
        this.parameters.encode(encoding);
			else
				try {
					throw new SipException("icid-value is mandatory");
				} catch (SipException e) {
					e.printStackTrace();
					
				}

        return encoding;
    }
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:26,代码来源:PChargingVector.java

示例2: processResponse

import javax.sip.SipException; //导入方法依赖的package包/类
public void processResponse(ResponseEvent responseEvent) {
    Response response = responseEvent.getResponse();
    int code = response.getStatusCode();
    if (code == 180) {
        try {

            o_received180 = true;
            Request cancel = responseEvent.getClientTransaction().createCancel();
            ClientTransaction cancelTX = provider.getNewClientTransaction(cancel);
            cancelTX.sendRequest();
            System.out.println("Send CANCEL:\n" + cancel);
            o_sentCancel = true;

        } catch (SipException e) {
            e.printStackTrace();
            doFail(doMessage(e));
        }
    } else if (code == 200) {
        System.out.println("Receive Cancel200");
        o_receiver200Cancel = true;
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:23,代码来源:NoAutoDialogTest.java

示例3: processInviteOK

import javax.sip.SipException; //导入方法依赖的package包/类
void processInviteOK(ClientTransaction clientTransaction, Response ok) {
      // find the call
      Call call = callDispatcher.findCall(clientTransaction.getDialog());
      if (call == null) {
          sipManCallback.fireUnknownMessageReceived(ok);
          return;
      }
      // Send ACK
      try {
          // Need to use dialog generated ACKs so that the remote UA core
          // sees them - Fixed by M.Ranganathan
          Request ackRequest = clientTransaction.getDialog()
			 			.createAck(((CSeqHeader)ok.getHeader(CSeqHeader.NAME)).getSeqNumber());

          clientTransaction.getDialog().sendAck(ackRequest);
          
      }
      catch (SipException ex) {
      	ex.printStackTrace();
          call.setState(Call.DISCONNECTED);
          sipManCallback
                  .fireCommunicationsError(new CommunicationsException(
                          "Failed to acknowledge call!", ex));
          return;
      } catch (InvalidArgumentException e) {
	e.printStackTrace();
	call.setState(Call.DISCONNECTED);
           sipManCallback.fireCommunicationsError(new CommunicationsException(
                           "Failed to create ack!", e));
           return;
}
      call.setRemoteSdpDescription(new String(ok.getRawContent()));
      // change status
      if (!call.getState().equals(Call.CONNECTED)) {
          call.setState(Call.CONNECTED);
      }
  }
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:38,代码来源:CallProcessing.java

示例4: ProtocolObjects

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

示例5: init

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

示例6: init

import javax.sip.SipException; //导入方法依赖的package包/类
static void init(String stackname, boolean autoDialog)
{
    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 + "debuglog.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,代码行数:54,代码来源:ProtocolObjects.java

示例7: SipObjects

import javax.sip.SipException; //导入方法依赖的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.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,代码行数:57,代码来源:SipObjects.java

示例8: SipObjects

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

示例9: ProtocolObjects

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

	this.autoDialog = autoDialog;
    this.transport = transport;
    SipFactory sipFactory = SipFactory.getInstance();
    sipFactory.resetFactory();
    sipFactory.setPathName(pathname);
    Properties properties = new Properties();
    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
            + ReInviteBusyTest.class.getName() + "-debuglog.txt");
    properties.setProperty("gov.nist.javax.sip.SERVER_LOG",
            logFileDirectory + "ReInviteBusyTest-" + "log.txt");

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

    // For the forked subscribe notify test
    properties.setProperty("javax.sip.FORKABLE_EVENTS", "foo");

    //For the TelUrlRouter test.
    //properties.setProperty("javax.sip.ROUTER_PATH", NonSipUriRouter.class.getName());

    // Dont use the router for all requests.
    properties.setProperty("javax.sip.USE_ROUTER_FOR_ALL_URIS", "false");


    properties.setProperty("gov.nist.javax.sip.THREAD_POOL_SIZE", "1");
    
    properties.setProperty("gov.nist.javax.sip.IS_BACK_TO_BACK_USER_AGENT", Boolean.toString(isBackToBackUserAgent));
    //For the TelUrlRouter test.
    properties.setProperty("javax.sip.ROUTER_PATH", NonSipUriRouter.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", new Integer(
            logLevel).toString());
    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);

        NonSipUriRouter router = (NonSipUriRouter) sipStack.getRouter();

        router.setMyPort(5080);

        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,代码行数:76,代码来源:ReInviteBusyTest.java

示例10: Shootist

import javax.sip.SipException; //导入方法依赖的package包/类
Shootist() {
    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.
    String stackname = "shootist";
    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 + this.getClass().getName()  + ".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());

    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);

        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,代码来源:CancelEventTest.java

示例11: Shootme

import javax.sip.SipException; //导入方法依赖的package包/类
Shootme () {
    SipFactory sipFactory = null;
    String stackname = "shootme";

    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 + this.getClass().getName() + ".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());

    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);

        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,代码来源:CancelEventTest.java

示例12: SipObjects

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

示例13: SipObjects

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

示例14: processResponse

import javax.sip.SipException; //导入方法依赖的package包/类
public void processResponse(ResponseEvent responseReceivedEvent) {
    System.out.println("Shootist : Got a response");
    Response response = (Response) responseReceivedEvent.getResponse();
    ClientTransaction tid = responseReceivedEvent.getClientTransaction();
    CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME);

    System.out.println("Shootist : Response received : Status Code = "
            + response.getStatusCode() + " " + cseq);


    if (tid == null) {

        // RFC3261: MUST respond to every 2xx
        if (ackRequest!=null && dialog!=null) {
           System.out.println("Shootist : re-sending ACK");
           try {
              dialog.sendAck(ackRequest);
           } catch (SipException se) {
              se.printStackTrace();
           }
        }
        return;
    }
    // If the caller is supposed to send the bye
    if ( Shootme.callerSendsBye && !byeTaskRunning) {
        byeTaskRunning = true;
        new Timer().schedule(new ByeTask(dialog), 4000) ;
    }
    System.out.println("Shootist : transaction state is " + tid.getState());
    System.out.println("Shootist : Dialog = " + tid.getDialog());
    System.out.println("Shootist : Dialog State is " + tid.getDialog().getState());

    try {
        if (response.getStatusCode() == Response.OK) {
            if (cseq.getMethod().equals(Request.INVITE)) {
                System.out.println("Shootist : Dialog after 200 OK  " + dialog);
                System.out.println("Shootist : Dialog State after 200 OK  " + dialog.getState());
                ackRequest = dialog.createAck( ((CSeqHeader) response.getHeader(CSeqHeader.NAME)).getSeqNumber() );
                System.out.println("Shootist : Sending ACK");
                dialog.sendAck(ackRequest);

                // JvB: test REFER, reported bug in tag handling
                //dialog.sendRequest(  sipProvider.getNewClientTransaction( dialog.createRequest("REFER") ));

            } else if (cseq.getMethod().equals(Request.CANCEL)) {
                if (dialog.getState() == DialogState.CONFIRMED) {
                    // oops cancel went in too late. Need to hang up the
                    // dialog.
                    System.out
                            .println("Shootist : Sending BYE -- cancel went in too late !!");
                    Request byeRequest = dialog.createRequest(Request.BYE);
                    ClientTransaction ct = sipProvider
                            .getNewClientTransaction(byeRequest);
                    dialog.sendRequest(ct);

                }

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

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

示例15: ProtocolObjects

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

	this.autoDialog = autoDialog;
    this.transport = transport;
    SipFactory sipFactory = SipFactory.getInstance();
    sipFactory.resetFactory();
    sipFactory.setPathName(pathname);
    Properties properties = new Properties();
    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
            + ReInviteInfoAckOverlapTest.class.getName() + "-debuglog.txt");
    properties.setProperty("gov.nist.javax.sip.SERVER_LOG",
            logFileDirectory + "ReInviteBusyTest-" + "log.txt");

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

    // For the forked subscribe notify test
    properties.setProperty("javax.sip.FORKABLE_EVENTS", "foo");

    //For the TelUrlRouter test.
    //properties.setProperty("javax.sip.ROUTER_PATH", NonSipUriRouter.class.getName());

    // Dont use the router for all requests.
    properties.setProperty("javax.sip.USE_ROUTER_FOR_ALL_URIS", "false");
    properties.setProperty("gov.nist.javax.sip.LOOSE_DIALOG_VALIDATION", "true");

    properties.setProperty("gov.nist.javax.sip.THREAD_POOL_SIZE", "1");
    
    properties.setProperty("gov.nist.javax.sip.IS_BACK_TO_BACK_USER_AGENT", Boolean.toString(isBackToBackUserAgent));
    //For the TelUrlRouter test.
    properties.setProperty("javax.sip.ROUTER_PATH", NonSipUriRouter.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", new Integer(
            logLevel).toString());
    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);

        NonSipUriRouter router = (NonSipUriRouter) sipStack.getRouter();

        router.setMyPort(5080);

        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,代码行数:76,代码来源:ReInviteInfoAckOverlapTest.java


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