本文整理汇总了Java中javax.sip.SipFactory.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java SipFactory.getInstance方法的具体用法?Java SipFactory.getInstance怎么用?Java SipFactory.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.sip.SipFactory
的用法示例。
在下文中一共展示了SipFactory.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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");
}
示例2: 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 ");
}
}
示例3: 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);
}
}
示例4: 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 ");
}
}
示例5: 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 ");
}
}
示例6: 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) {
}
}
示例7: SimpleTransport
import javax.sip.SipFactory; //导入方法依赖的package包/类
public SimpleTransport() {
super();
// Initialize the SipFactory
sipFactory = SipFactory.getInstance();
sipFactory.setPathName("gov.nist");
}
示例8: SimpleTransport
import javax.sip.SipFactory; //导入方法依赖的package包/类
public SimpleTransport() {
super();
// Initialize the SipFactory
sipFactory = SipFactory.getInstance();
sipFactory.setPathName("gov.nist");
}
示例9: SipOutboundCall
import javax.sip.SipFactory; //导入方法依赖的package包/类
public SipOutboundCall(String host, int port) {
remoteHost = host;
remotePort = port;
tts = new FreeTTS();
sipHandler = SipHandler.getInstance(host, port);
sipHandler.setRemoteHost(host);
sipHandler.setRemotePort(port);
localMediaPort = -1;
try {
DatagramSocket socket = new DatagramSocket();
localMediaPort = socket.getLocalPort();
socket.disconnect();
socket.close();
initRTP(localMediaPort);
} catch (Exception e1) {
BrokerFactory.getLoggingBroker().logError(e1);
}
//sipHandler.addRequestListener(this);
//sipHandler.addResponseListener(this);
sipHandler.addDTMFListener(this);
addSilenceListener(this);
sipFactory = SipFactory.getInstance();
initialized = false;
}
示例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");
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_MESSAGE_VALVE", SipMessageValve.class.getCanonicalName());
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 {
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();
}
}
示例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", "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");
}
}
示例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");
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");
}
}
示例13: init
import javax.sip.SipFactory; //导入方法依赖的package包/类
public void init(String transport, int volume) {
this.volume = volume;
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.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");
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, transport);
Shootme listener = this;
sipProvider = sipStack.createSipProvider(lp);
System.out.println("udp provider " + sipProvider);
sipProvider.addSipListener(listener);
} catch (Exception ex) {
ex.printStackTrace();
fail("Unexpected exception");
}
}
示例14: 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_MESSAGE_VALVE", SIPMessageValveImpl.class.getCanonicalName());
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");
}
}
示例15: setUp
import javax.sip.SipFactory; //导入方法依赖的package包/类
public void setUp() {
SipFactory sipFactory = SipFactory.getInstance();
sipFactory.resetFactory();
sipFactory.setPathName("gov.nist");
Properties properties = new Properties();
properties.setProperty("javax.sip.STACK_NAME", "mystack");
// 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.THREAD_POOL_SIZE", "1");
properties.setProperty("gov.nist.javax.sip.DELIVER_UNSOLICITED_NOTIFY",
"true");
if(System.getProperty("enableNIO") != null && System.getProperty("enableNIO").equalsIgnoreCase("true")) {
properties.setProperty("gov.nist.javax.sip.MESSAGE_PROCESSOR_FACTORY", NioMessageProcessorFactory.class.getName());
}
try {
this.port = 6050;
this.transport = "udp";
this.sipStack = sipFactory.createSipStack(properties);
this.listeningPoint = sipStack.createListeningPoint("127.0.0.1",
port, transport);
sipProvider = sipStack.createSipProvider(listeningPoint);
this.addressFactory = sipFactory.createAddressFactory();
this.headerFactory = sipFactory.createHeaderFactory();
// Create the request.
this.messageFactory = sipFactory.createMessageFactory();
sipProvider.addSipListener(this);
timer.schedule(new TimerTask() {
public void run() {
if (!notifySeen || !notifyResponseSeen) {
fail("Did not see expected event");
}
sipStack.stop();
}
}, 4000);
} catch (Exception e) {
e.printStackTrace();
fail("Could not create sip stack");
}
}