本文整理汇总了Java中javax.sip.ListeningPoint类的典型用法代码示例。如果您正苦于以下问题:Java ListeningPoint类的具体用法?Java ListeningPoint怎么用?Java ListeningPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ListeningPoint类属于javax.sip包,在下文中一共展示了ListeningPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addListeningPoint
import javax.sip.ListeningPoint; //导入依赖的package包/类
public synchronized void addListeningPoint(ListeningPoint listeningPoint)
throws ObjectInUseException {
ListeningPointImpl lp = (ListeningPointImpl) listeningPoint;
if (lp.sipProvider != null && lp.sipProvider != this)
throw new ObjectInUseException(
"Listening point assigned to another provider");
String transport = lp.getTransport().toUpperCase();
if (this.listeningPoints.containsKey(transport)
&& this.listeningPoints.get(transport) != listeningPoint)
throw new ObjectInUseException(
"Listening point already assigned for transport!");
// This is for backwards compatibility.
lp.sipProvider = this;
this.listeningPoints.put(transport, lp);
}
示例2: createSipProvider
import javax.sip.ListeningPoint; //导入依赖的package包/类
public SipProvider createSipProvider(ListeningPoint listeningPoint)
throws ObjectInUseException {
if (listeningPoint == null)
throw new NullPointerException("null listeningPoint");
if (logger.isLoggingEnabled(LogLevels.TRACE_DEBUG))
this.logger.logDebug(
"createSipProvider: " + listeningPoint);
ListeningPointImpl listeningPointImpl = (ListeningPointImpl) listeningPoint;
if (listeningPointImpl.sipProvider != null)
throw new ObjectInUseException("Provider already attached!");
SipProviderImpl provider = new SipProviderImpl(this);
provider.setListeningPoint(listeningPointImpl);
listeningPointImpl.sipProvider = provider;
this.sipProviders.add(provider);
return provider;
}
示例3: Server
import javax.sip.ListeningPoint; //导入依赖的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 ");
}
}
示例4: createProvider
import javax.sip.ListeningPoint; //导入依赖的package包/类
public SipProvider createProvider() {
try {
ListeningPoint lp = sipStack.createListeningPoint(myAddress,
myPort, transport);
sipProvider = sipStack.createSipProvider(lp);
logger.info("provider " + sipProvider);
logger.info("sipStack = " + sipStack);
return sipProvider;
} catch (Exception ex) {
logger.error(ex);
TestCase.fail(unexpectedException);
return null;
}
}
示例5: processResponse
import javax.sip.ListeningPoint; //导入依赖的package包/类
public void processResponse(ResponseEvent responseEvent) {
try {
Response response = responseEvent.getResponse();
Dialog dialog = responseEvent.getDialog();
this.lastResponseTable.put(dialog, response);
ServerTransaction serverTransaction = (ServerTransaction)responseEvent.getClientTransaction().getApplicationData();
Request stRequest = serverTransaction.getRequest();
Response newResponse = this.messageFactory.createResponse(response.getStatusCode(),stRequest);
SipProvider provider = (SipProvider)responseEvent.getSource();
SipProvider peerProvider = this.getPeerProvider(provider);
ListeningPoint peerListeningPoint = peerProvider.getListeningPoint("udp");
ContactHeader peerContactHeader = ((ListeningPointExt)peerListeningPoint).createContactHeader();
newResponse.setHeader(peerContactHeader);
serverTransaction.sendResponse(newResponse);
} catch (Exception ex) {
ex.printStackTrace();
BackToBackUserAgentTest.fail("Unexpected exception");
}
}
示例6: createProvider
import javax.sip.ListeningPoint; //导入依赖的package包/类
public SipProvider createProvider() {
try {
ListeningPoint lp = sipStack.createListeningPoint(myAddress, myPort, transport);
sipProvider = sipStack.createSipProvider(lp);
logger.info("provider " + sipProvider);
logger.info("sipStack = " + sipStack);
return sipProvider;
} catch (Exception ex) {
logger.error(ex);
TestCase.fail(unexpectedException);
return null;
}
}
示例7: createProvider
import javax.sip.ListeningPoint; //导入依赖的package包/类
public SipProvider createProvider() {
try {
ListeningPoint lp = sipStack.createListeningPoint(myAddress,
myPort, transport);
sipProvider = sipStack.createSipProvider(lp);
logger.info("provider " + sipProvider);
logger.info("sipStack = " + sipStack);
return sipProvider;
} catch (Exception ex) {
logger.error(ex);
TestCase.fail(unexpectedException);
return null;
}
}
示例8: createSipProvider
import javax.sip.ListeningPoint; //导入依赖的package包/类
public SipProvider createSipProvider() {
try {
ListeningPoint listeningPoint = sipStack.createListeningPoint(
host, port, transport);
if (sipProvider != null ) return sipProvider;
logger.info("listening point = " + host + " port = " + port);
logger.info("listening point = " + listeningPoint);
sipProvider = sipStack
.createSipProvider(listeningPoint);
return sipProvider;
} catch (Exception ex) {
logger.error(unexpectedException, ex);
TestCase.fail(unexpectedException);
return null;
}
}
示例9: createProvider
import javax.sip.ListeningPoint; //导入依赖的package包/类
public SipProvider createProvider() {
try {
ListeningPoint lp = sipStack.createListeningPoint(myAddress,
myPort, transport);
sipProvider = sipStack.createSipProvider(lp);
logger.info("udp provider " + sipProvider);
return sipProvider;
} catch (Exception ex) {
logger.error(ex);
fail(unexpectedException);
return null;
}
}
示例10: stopSipStack
import javax.sip.ListeningPoint; //导入依赖的package包/类
public static void stopSipStack(SipStack sipStack, SipListener listener) {
Iterator<SipProvider> sipProviderIterator = sipStack.getSipProviders();
try{
while (sipProviderIterator.hasNext()) {
SipProvider sipProvider = sipProviderIterator.next();
ListeningPoint[] listeningPoints = sipProvider.getListeningPoints();
for (ListeningPoint listeningPoint : listeningPoints) {
sipProvider.removeListeningPoint(listeningPoint);
sipStack.deleteListeningPoint(listeningPoint);
listeningPoints = sipProvider.getListeningPoints();
}
sipProvider.removeSipListener(listener);
sipStack.deleteSipProvider(sipProvider);
sipProviderIterator = sipStack.getSipProviders();
}
} catch (Exception e) {
throw new IllegalStateException("Cant remove the listening points or sip providers", e);
}
sipStack.stop();
sipStack = null;
}
示例11: createProvider
import javax.sip.ListeningPoint; //导入依赖的package包/类
public SipProvider createProvider(int newPort) {
try {
port = newPort;
ListeningPoint lp = sipStack.createListeningPoint("127.0.0.1",
this.port, transport);
this.sipProvider = sipStack.createSipProvider(lp);
logger.info("udp provider " + sipProvider);
} catch (Exception ex) {
logger.info(ex.getMessage(), ex);
sipProvider = null;
TestHarness.fail("Failed to create SIP Provider on port " + newPort + ", because of " + ex.getMessage());
}
return sipProvider;
}
示例12: createSipProvider
import javax.sip.ListeningPoint; //导入依赖的package包/类
public SipProvider createSipProvider() {
try {
ListeningPoint listeningPoint = protocolObjects.sipStack
.createListeningPoint(host, port, protocolObjects.transport);
sipProvider = protocolObjects.sipStack
.createSipProvider(listeningPoint);
// sipProvider.setAutomaticDialogSupportEnabled(false);
return sipProvider;
} catch (Exception ex) {
logger.error(unexpectedException, ex);
fail(unexpectedException);
return null;
}
}
示例13: createSipProvider
import javax.sip.ListeningPoint; //导入依赖的package包/类
public SipProvider createSipProvider() {
try {
ListeningPoint listeningPoint = protocolObjects.sipStack
.createListeningPoint(host, port, protocolObjects.transport);
sipProvider = protocolObjects.sipStack
.createSipProvider(listeningPoint);
sipProvider.setAutomaticDialogSupportEnabled(false);
return sipProvider;
} catch (Exception ex) {
logger.error(unexpectedException, ex);
fail(unexpectedException);
return null;
}
}
示例14: createTiContact
import javax.sip.ListeningPoint; //导入依赖的package包/类
/**
* Add a contact for the TI.
*/
public ContactHeader createTiContact() throws Exception {
try {
ContactHeader contact = tiHeaderFactory.createContactHeader();
// JvB: getIPAddress may return null!
String ip = tiSipProvider.getSipStack().getIPAddress();
if (ip == null) {
ListeningPoint lp = (ListeningPoint) tiSipProvider
.getSipStack().getListeningPoints().next();
ip = lp.getIPAddress();
}
SipURI srcSipURI = tiAddressFactory.createSipURI(null, ip);
srcSipURI.setPort(tiSipProvider.getListeningPoint("udp").getPort());
srcSipURI.setTransportParam("udp");
Address address = tiAddressFactory.createAddress(srcSipURI);
address.setDisplayName("TI Contact");
contact.setAddress(address);
return contact;
} catch (Exception ex) {
ex.printStackTrace();
assertTrue(false);
throw ex;
}
}
示例15: createRiContact
import javax.sip.ListeningPoint; //导入依赖的package包/类
/**
* Add a contact for the TI.
*/
public ContactHeader createRiContact() throws TckInternalError {
try {
ContactHeader contact = riHeaderFactory.createContactHeader();
// BUG reported by Ben Evans (Open Cloud):
// Should be using RI's address factory here, not TI's.
ListeningPoint lp = riSipProvider.getListeningPoints()[0];
SipURI srcSipURI = riAddressFactory.createSipURI(null, lp
.getIPAddress());
srcSipURI.setPort(lp.getPort());
srcSipURI.setTransportParam(lp.getTransport());
Address address = riAddressFactory.createAddress(srcSipURI);
address.setDisplayName("RI Contact");
contact.setAddress(address);
return contact;
} catch (Exception ex) {
throw new TckInternalError(ex.getMessage());
}
}