Search in sources :

Example 1 with MobicentsSipCache

use of org.mobicents.ha.javax.sip.cache.MobicentsSipCache in project jain-sip.ha by RestComm.

the class SimpleB2BUA method stop.

public void stop(boolean stopSipStack) {
    Iterator<SipProvider> sipProviderIterator = sipStack.getSipProviders();
    try {
        while (sipProviderIterator.hasNext()) {
            SipProvider sipProvider = sipProviderIterator.next();
            if (!ListeningPoint.TCP.equalsIgnoreCase(transport)) {
                ListeningPoint[] listeningPoints = sipProvider.getListeningPoints();
                for (ListeningPoint listeningPoint : listeningPoints) {
                    sipProvider.removeListeningPoint(listeningPoint);
                    sipStack.deleteListeningPoint(listeningPoint);
                    listeningPoints = sipProvider.getListeningPoints();
                }
            }
            sipProvider.removeSipListener(this);
            if (stopSipStack) {
                ((MobicentsSipCache) ((ClusteredSipStack) sipProvider.getSipStack()).getSipCache()).getMobicentsCache().getJBossCache().remove(Fqn.fromString("DIALOG_IDS"), "outgoingDialogId");
                ((MobicentsSipCache) ((ClusteredSipStack) sipProvider.getSipStack()).getSipCache()).getMobicentsCache().getJBossCache().remove(Fqn.fromString("DIALOG_IDS"), "incomingDialogId");
            }
            sipStack.deleteSipProvider(sipProvider);
            sipProviderIterator = sipStack.getSipProviders();
        }
    } catch (Exception e) {
        throw new IllegalStateException("Cant remove the listening points or sip providers", e);
    }
    listeningPoint = null;
    provider = null;
    sipFactory.resetFactory();
    if (stopSipStack) {
        sipStack.stop();
        sipStack = null;
        headerFactory = null;
        messageFactory = null;
        sipFactory = null;
        b2buaHandler = null;
        properties = null;
    }
}
Also used : ListeningPoint(javax.sip.ListeningPoint) InvalidArgumentException(javax.sip.InvalidArgumentException) ParseException(java.text.ParseException) TooManyListenersException(java.util.TooManyListenersException) SipException(javax.sip.SipException) SipProvider(javax.sip.SipProvider) MobicentsSipCache(org.mobicents.ha.javax.sip.cache.MobicentsSipCache) ManagedMobicentsSipCache(org.mobicents.ha.javax.sip.cache.ManagedMobicentsSipCache)

Aggregations

ParseException (java.text.ParseException)1 TooManyListenersException (java.util.TooManyListenersException)1 InvalidArgumentException (javax.sip.InvalidArgumentException)1 ListeningPoint (javax.sip.ListeningPoint)1 SipException (javax.sip.SipException)1 SipProvider (javax.sip.SipProvider)1 ManagedMobicentsSipCache (org.mobicents.ha.javax.sip.cache.ManagedMobicentsSipCache)1 MobicentsSipCache (org.mobicents.ha.javax.sip.cache.MobicentsSipCache)1