Search in sources :

Example 1 with SIPTransactionStack

use of gov.nist.javax.sip.stack.SIPTransactionStack in project jain-sip.ha by RestComm.

the class SIPClientTransactionCacheData method createClientTransaction.

public MobicentsHASIPClientTransaction createClientTransaction(String txId, Map<String, Object> transactionMetaData, Object transactionAppData) throws SipCacheException {
    MobicentsHASIPClientTransaction haClientTransaction = null;
    if (transactionMetaData != null) {
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug("sipStack " + this + " client transaction " + txId + " is present in the distributed cache, recreating it locally");
        }
        String channelTransport = (String) transactionMetaData.get(MobicentsHASIPClientTransaction.TRANSPORT);
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug(txId + " : transport " + channelTransport);
        }
        InetAddress channelIp = (InetAddress) transactionMetaData.get(MobicentsHASIPClientTransaction.PEER_IP);
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug(txId + " : channel peer Ip address " + channelIp);
        }
        Integer channelPort = (Integer) transactionMetaData.get(MobicentsHASIPClientTransaction.PEER_PORT);
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug(txId + " : channel peer port " + channelPort);
        }
        Integer myPort = (Integer) transactionMetaData.get(MobicentsHASIPClientTransaction.MY_PORT);
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug(txId + " : my port " + myPort);
        }
        MessageChannel messageChannel = null;
        MessageProcessor[] messageProcessors = stack.getStackMessageProcessors();
        for (MessageProcessor messageProcessor : messageProcessors) {
            if (messageProcessor.getTransport().equalsIgnoreCase(channelTransport)) {
                try {
                    messageChannel = messageProcessor.createMessageChannel(channelIp, channelPort);
                } catch (IOException e) {
                    logger.logError("couldn't recreate the message channel on ip address " + channelIp + " and port " + channelPort, e);
                }
                break;
            }
        }
        haClientTransaction = new MobicentsHASIPClientTransaction((SIPTransactionStack) stack, messageChannel);
        haClientTransaction.setBranch(txId);
        try {
            updateClientTransactionMetaData(transactionMetaData, transactionAppData, haClientTransaction, true);
        } catch (PeerUnavailableException e) {
            throw new SipCacheException("A problem occured while retrieving the following transaction " + txId + " from the Cache", e);
        } catch (ParseException e) {
            throw new SipCacheException("A problem occured while retrieving the following transaction " + txId + " from the Cache", e);
        }
    } else {
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug("sipStack " + this + " client transaction " + txId + " not found in the distributed cache");
        }
    }
    return haClientTransaction;
}
Also used : MobicentsHASIPClientTransaction(gov.nist.javax.sip.stack.MobicentsHASIPClientTransaction) MessageChannel(gov.nist.javax.sip.stack.MessageChannel) PeerUnavailableException(javax.sip.PeerUnavailableException) MessageProcessor(gov.nist.javax.sip.stack.MessageProcessor) SIPTransactionStack(gov.nist.javax.sip.stack.SIPTransactionStack) SipCacheException(org.mobicents.ha.javax.sip.cache.SipCacheException) IOException(java.io.IOException) ParseException(java.text.ParseException) InetAddress(java.net.InetAddress)

Example 2 with SIPTransactionStack

use of gov.nist.javax.sip.stack.SIPTransactionStack in project jain-sip.ha by RestComm.

the class SIPServerTransactionCacheData method createServerTransaction.

public MobicentsHASIPServerTransaction createServerTransaction(String txId, Map<String, Object> transactionMetaData, Object transactionAppData) throws SipCacheException {
    MobicentsHASIPServerTransaction haServerTransaction = null;
    if (transactionMetaData != null) {
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug("sipStack " + this + " server transaction " + txId + " is present in the distributed cache, recreating it locally");
        }
        String channelTransport = (String) transactionMetaData.get(MobicentsHASIPServerTransaction.TRANSPORT);
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug(txId + " : transport " + channelTransport);
        }
        InetAddress channelIp = (InetAddress) transactionMetaData.get(MobicentsHASIPServerTransaction.PEER_IP);
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug(txId + " : channel peer Ip address " + channelIp);
        }
        Integer channelPort = (Integer) transactionMetaData.get(MobicentsHASIPServerTransaction.PEER_PORT);
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug(txId + " : channel peer port " + channelPort);
        }
        Integer myPort = (Integer) transactionMetaData.get(MobicentsHASIPServerTransaction.MY_PORT);
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug(txId + " : my port " + myPort);
        }
        MessageChannel messageChannel = null;
        MessageProcessor[] messageProcessors = stack.getStackMessageProcessors();
        for (MessageProcessor messageProcessor : messageProcessors) {
            if (messageProcessor.getTransport().equalsIgnoreCase(channelTransport)) {
                try {
                    messageChannel = messageProcessor.createMessageChannel(channelIp, channelPort);
                } catch (IOException e) {
                    logger.logError("couldn't recreate the message channel on ip address " + channelIp + " and port " + channelPort, e);
                }
                break;
            }
        }
        haServerTransaction = new MobicentsHASIPServerTransaction((SIPTransactionStack) stack, messageChannel);
        haServerTransaction.setBranch(txId);
        try {
            updateServerTransactionMetaData(transactionMetaData, transactionAppData, haServerTransaction, true);
        } catch (PeerUnavailableException e) {
            throw new SipCacheException("A problem occured while retrieving the following transaction " + txId + " from the Cache", e);
        } catch (ParseException e) {
            throw new SipCacheException("A problem occured while retrieving the following transaction " + txId + " from the Cache", e);
        }
    } else {
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug("sipStack " + this + " server transaction " + txId + " not found in the distributed cache");
        }
    }
    return haServerTransaction;
}
Also used : MobicentsHASIPServerTransaction(gov.nist.javax.sip.stack.MobicentsHASIPServerTransaction) MessageChannel(gov.nist.javax.sip.stack.MessageChannel) PeerUnavailableException(javax.sip.PeerUnavailableException) MessageProcessor(gov.nist.javax.sip.stack.MessageProcessor) SIPTransactionStack(gov.nist.javax.sip.stack.SIPTransactionStack) SipCacheException(org.mobicents.ha.javax.sip.cache.SipCacheException) IOException(java.io.IOException) ParseException(java.text.ParseException) InetAddress(java.net.InetAddress)

Example 3 with SIPTransactionStack

use of gov.nist.javax.sip.stack.SIPTransactionStack in project jain-sip.ha by RestComm.

the class ServerTransactionCacheData method createServerTransaction.

public MobicentsHASIPServerTransaction createServerTransaction(String txId, Map<String, Object> transactionMetaData, Object transactionAppData) throws SipCacheException {
    MobicentsHASIPServerTransaction haServerTransaction = null;
    if (transactionMetaData != null) {
        if (clusteredlogger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            clusteredlogger.logDebug("sipStack " + this + " server transaction " + txId + " is present in the distributed cache, recreating it locally");
        }
        String channelTransport = (String) transactionMetaData.get(MobicentsHASIPServerTransaction.TRANSPORT);
        if (clusteredlogger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            clusteredlogger.logDebug(txId + " : transport " + channelTransport);
        }
        InetAddress channelIp = (InetAddress) transactionMetaData.get(MobicentsHASIPServerTransaction.PEER_IP);
        if (clusteredlogger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            clusteredlogger.logDebug(txId + " : channel peer Ip address " + channelIp);
        }
        Integer channelPort = (Integer) transactionMetaData.get(MobicentsHASIPServerTransaction.PEER_PORT);
        if (clusteredlogger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            clusteredlogger.logDebug(txId + " : channel peer port " + channelPort);
        }
        Integer myPort = (Integer) transactionMetaData.get(MobicentsHASIPServerTransaction.MY_PORT);
        if (clusteredlogger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            clusteredlogger.logDebug(txId + " : my port " + myPort);
        }
        MessageChannel messageChannel = null;
        MessageProcessor[] messageProcessors = clusteredSipStack.getStackMessageProcessors();
        for (MessageProcessor messageProcessor : messageProcessors) {
            if (messageProcessor.getTransport().equalsIgnoreCase(channelTransport)) {
                try {
                    messageChannel = messageProcessor.createMessageChannel(channelIp, channelPort);
                } catch (IOException e) {
                    clusteredlogger.logError("couldn't recreate the message channel on ip address " + channelIp + " and port " + channelPort, e);
                }
                break;
            }
        }
        haServerTransaction = new MobicentsHASIPServerTransaction((SIPTransactionStack) clusteredSipStack, messageChannel);
        haServerTransaction.setBranch(txId);
        try {
            updateServerTransactionMetaData(transactionMetaData, transactionAppData, haServerTransaction, true);
        } catch (PeerUnavailableException e) {
            throw new SipCacheException("A problem occured while retrieving the following transaction " + txId + " from the Cache", e);
        } catch (ParseException e) {
            throw new SipCacheException("A problem occured while retrieving the following transaction " + txId + " from the Cache", e);
        }
    } else {
        if (clusteredlogger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            clusteredlogger.logDebug("sipStack " + this + " server transaction " + txId + " not found in the distributed cache");
        }
    }
    return haServerTransaction;
}
Also used : MobicentsHASIPServerTransaction(gov.nist.javax.sip.stack.MobicentsHASIPServerTransaction) MessageChannel(gov.nist.javax.sip.stack.MessageChannel) PeerUnavailableException(javax.sip.PeerUnavailableException) MessageProcessor(gov.nist.javax.sip.stack.MessageProcessor) SIPTransactionStack(gov.nist.javax.sip.stack.SIPTransactionStack) IOException(java.io.IOException) ParseException(java.text.ParseException) InetAddress(java.net.InetAddress)

Example 4 with SIPTransactionStack

use of gov.nist.javax.sip.stack.SIPTransactionStack in project jain-sip.ha by RestComm.

the class ClientTransactionCacheData method createClientTransaction.

public MobicentsHASIPClientTransaction createClientTransaction(String txId, Map<String, Object> transactionMetaData, Object transactionAppData) throws SipCacheException {
    MobicentsHASIPClientTransaction haClientTransaction = null;
    if (transactionMetaData != null) {
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug("sipStack " + this + " client transaction " + txId + " is present in the distributed cache, recreating it locally");
        }
        String channelTransport = (String) transactionMetaData.get(MobicentsHASIPClientTransaction.TRANSPORT);
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug(txId + " : transport " + channelTransport);
        }
        InetAddress channelIp = (InetAddress) transactionMetaData.get(MobicentsHASIPClientTransaction.PEER_IP);
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug(txId + " : channel peer Ip address " + channelIp);
        }
        Integer channelPort = (Integer) transactionMetaData.get(MobicentsHASIPClientTransaction.PEER_PORT);
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug(txId + " : channel peer port " + channelPort);
        }
        Integer myPort = (Integer) transactionMetaData.get(MobicentsHASIPClientTransaction.MY_PORT);
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug(txId + " : my port " + myPort);
        }
        MessageChannel messageChannel = null;
        MessageProcessor[] messageProcessors = clusteredSipStack.getStackMessageProcessors();
        for (MessageProcessor messageProcessor : messageProcessors) {
            if (messageProcessor.getTransport().equalsIgnoreCase(channelTransport)) {
                try {
                    messageChannel = messageProcessor.createMessageChannel(channelIp, channelPort);
                } catch (IOException e) {
                    logger.logError("couldn't recreate the message channel on ip address " + channelIp + " and port " + channelPort, e);
                }
                break;
            }
        }
        haClientTransaction = new MobicentsHASIPClientTransaction((SIPTransactionStack) clusteredSipStack, messageChannel);
        haClientTransaction.setBranch(txId);
        try {
            updateClientTransactionMetaData(transactionMetaData, transactionAppData, haClientTransaction, true);
        } catch (PeerUnavailableException e) {
            throw new SipCacheException("A problem occured while retrieving the following transaction " + txId + " from the Cache", e);
        } catch (ParseException e) {
            throw new SipCacheException("A problem occured while retrieving the following transaction " + txId + " from the Cache", e);
        }
    } else {
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug("sipStack " + this + " client transaction " + txId + " not found in the distributed cache");
        }
    }
    return haClientTransaction;
}
Also used : MobicentsHASIPClientTransaction(gov.nist.javax.sip.stack.MobicentsHASIPClientTransaction) MessageChannel(gov.nist.javax.sip.stack.MessageChannel) PeerUnavailableException(javax.sip.PeerUnavailableException) MessageProcessor(gov.nist.javax.sip.stack.MessageProcessor) SIPTransactionStack(gov.nist.javax.sip.stack.SIPTransactionStack) IOException(java.io.IOException) ParseException(java.text.ParseException) InetAddress(java.net.InetAddress)

Example 5 with SIPTransactionStack

use of gov.nist.javax.sip.stack.SIPTransactionStack in project jain-sip.ha by RestComm.

the class SIPClientTransactionCacheData method createClientTransaction.

public MobicentsHASIPClientTransaction createClientTransaction(String txId, Map<String, Object> transactionMetaData, Object transactionAppData) throws SipCacheException {
    MobicentsHASIPClientTransaction haClientTransaction = null;
    if (transactionMetaData != null) {
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug("sipStack " + this + " client transaction " + txId + " is present in the distributed cache, recreating it locally");
        }
        String channelTransport = (String) transactionMetaData.get(MobicentsHASIPClientTransaction.TRANSPORT);
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug(txId + " : transport " + channelTransport);
        }
        InetAddress channelIp = (InetAddress) transactionMetaData.get(MobicentsHASIPClientTransaction.PEER_IP);
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug(txId + " : channel peer Ip address " + channelIp);
        }
        Integer channelPort = (Integer) transactionMetaData.get(MobicentsHASIPClientTransaction.PEER_PORT);
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug(txId + " : channel peer port " + channelPort);
        }
        Integer myPort = (Integer) transactionMetaData.get(MobicentsHASIPClientTransaction.MY_PORT);
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug(txId + " : my port " + myPort);
        }
        MessageChannel messageChannel = null;
        MessageProcessor[] messageProcessors = stack.getStackMessageProcessors();
        for (MessageProcessor messageProcessor : messageProcessors) {
            if (messageProcessor.getTransport().equalsIgnoreCase(channelTransport)) {
                try {
                    messageChannel = messageProcessor.createMessageChannel(channelIp, channelPort);
                } catch (IOException e) {
                    logger.logError("couldn't recreate the message channel on ip address " + channelIp + " and port " + channelPort, e);
                }
                break;
            }
        }
        haClientTransaction = new MobicentsHASIPClientTransaction((SIPTransactionStack) stack, messageChannel);
        haClientTransaction.setBranch(txId);
        try {
            updateClientTransactionMetaData(transactionMetaData, transactionAppData, haClientTransaction, true);
        } catch (PeerUnavailableException e) {
            throw new SipCacheException("A problem occured while retrieving the following transaction " + txId + " from the Cache", e);
        } catch (ParseException e) {
            throw new SipCacheException("A problem occured while retrieving the following transaction " + txId + " from the Cache", e);
        }
    } else {
        if (logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
            logger.logDebug("sipStack " + this + " client transaction " + txId + " not found in the distributed cache");
        }
    }
    return haClientTransaction;
}
Also used : MobicentsHASIPClientTransaction(gov.nist.javax.sip.stack.MobicentsHASIPClientTransaction) MessageChannel(gov.nist.javax.sip.stack.MessageChannel) PeerUnavailableException(javax.sip.PeerUnavailableException) MessageProcessor(gov.nist.javax.sip.stack.MessageProcessor) SIPTransactionStack(gov.nist.javax.sip.stack.SIPTransactionStack) SipCacheException(org.mobicents.ha.javax.sip.cache.SipCacheException) IOException(java.io.IOException) ParseException(java.text.ParseException) InetAddress(java.net.InetAddress)

Aggregations

MessageChannel (gov.nist.javax.sip.stack.MessageChannel)6 MessageProcessor (gov.nist.javax.sip.stack.MessageProcessor)6 SIPTransactionStack (gov.nist.javax.sip.stack.SIPTransactionStack)6 IOException (java.io.IOException)6 InetAddress (java.net.InetAddress)6 ParseException (java.text.ParseException)6 PeerUnavailableException (javax.sip.PeerUnavailableException)6 SipCacheException (org.mobicents.ha.javax.sip.cache.SipCacheException)4 MobicentsHASIPClientTransaction (gov.nist.javax.sip.stack.MobicentsHASIPClientTransaction)3 MobicentsHASIPServerTransaction (gov.nist.javax.sip.stack.MobicentsHASIPServerTransaction)3