Search in sources :

Example 11 with SipProvider

use of javax.sip.SipProvider in project jain-sip.ha by RestComm.

the class B2BUAEarlyDialogRecoveryOn2xxTestNotEnabled method stopSipStack.

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;
}
Also used : ListeningPoint(javax.sip.ListeningPoint) InvalidArgumentException(javax.sip.InvalidArgumentException) ParseException(java.text.ParseException) PeerUnavailableException(javax.sip.PeerUnavailableException) SipException(javax.sip.SipException) IOException(java.io.IOException) SipProvider(javax.sip.SipProvider)

Example 12 with SipProvider

use of javax.sip.SipProvider in project jain-sip.ha by RestComm.

the class ProxyEarlyDialogRecoveryOn1xxTest method stopSipStack.

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;
}
Also used : ListeningPoint(javax.sip.ListeningPoint) InvalidArgumentException(javax.sip.InvalidArgumentException) ParseException(java.text.ParseException) PeerUnavailableException(javax.sip.PeerUnavailableException) SipException(javax.sip.SipException) IOException(java.io.IOException) SipProvider(javax.sip.SipProvider)

Example 13 with SipProvider

use of javax.sip.SipProvider in project jain-sip.ha by RestComm.

the class B2BUAEarlyDialogRecoveryOn1xxTCPTest method stopSipStack.

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) {
                try {
                    sipProvider.removeListeningPoint(listeningPoint);
                    sipStack.deleteListeningPoint(listeningPoint);
                } catch (Exception e) {
                    System.err.println("Cant remove the listening points or sip providers");
                }
                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;
}
Also used : ListeningPoint(javax.sip.ListeningPoint) InvalidArgumentException(javax.sip.InvalidArgumentException) ParseException(java.text.ParseException) PeerUnavailableException(javax.sip.PeerUnavailableException) SipException(javax.sip.SipException) IOException(java.io.IOException) SipProvider(javax.sip.SipProvider)

Example 14 with SipProvider

use of javax.sip.SipProvider in project jain-sip.ha by RestComm.

the class SimpleStatefulProxy 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);
            sipStack.deleteSipProvider(sipProvider);
            sipProviderIterator = sipStack.getSipProviders();
        }
    } catch (Exception e) {
        throw new IllegalStateException("Cant remove the listening points or sip providers", e);
    }
    listeningPoint = null;
    sipProvider = null;
    sipFactory.resetFactory();
    serverTransaction = null;
    clientTransaction = null;
    currentCtxBranchId = null;
    currentCtxRemotePort = null;
    if (stopSipStack) {
        sipStack.stop();
        sipStack = null;
        headerFactory = null;
        messageFactory = null;
        sipFactory = null;
        properties = null;
    }
}
Also used : ListeningPoint(javax.sip.ListeningPoint) InvalidArgumentException(javax.sip.InvalidArgumentException) ParseException(java.text.ParseException) CacheException(org.jboss.cache.CacheException) SipException(javax.sip.SipException) SipProvider(javax.sip.SipProvider)

Example 15 with SipProvider

use of javax.sip.SipProvider 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

SipProvider (javax.sip.SipProvider)30 SipException (javax.sip.SipException)23 InvalidArgumentException (javax.sip.InvalidArgumentException)21 ParseException (java.text.ParseException)19 ListeningPoint (javax.sip.ListeningPoint)15 PeerUnavailableException (javax.sip.PeerUnavailableException)12 Response (javax.sip.message.Response)11 IOException (java.io.IOException)10 Request (javax.sip.message.Request)10 TransactionUnavailableException (javax.sip.TransactionUnavailableException)9 ServerTransaction (javax.sip.ServerTransaction)7 TooManyListenersException (java.util.TooManyListenersException)6 Dialog (javax.sip.Dialog)6 ObjectInUseException (javax.sip.ObjectInUseException)6 ContactHeader (javax.sip.header.ContactHeader)6 ToHeader (javax.sip.header.ToHeader)6 EventHeader (javax.sip.header.EventHeader)5 ViaHeader (javax.sip.header.ViaHeader)5 ClientTransaction (javax.sip.ClientTransaction)4 TransactionDoesNotExistException (javax.sip.TransactionDoesNotExistException)4