use of gov.nist.javax.sip.stack.MobicentsHASIPClientTransaction in project jain-sip.ha by RestComm.
the class MobicentsHATransactionFactory method createClientTransaction.
/* (non-Javadoc)
* @see org.mobicents.ext.javax.sip.TransactionFactory#createClientTransaction(gov.nist.javax.sip.message.SIPRequest, gov.nist.javax.sip.stack.MessageChannel)
*/
public SIPClientTransaction createClientTransaction(SIPRequest sipRequest, MessageChannel encapsulatedMessageChannel) {
MobicentsHASIPClientTransaction ct = new MobicentsHASIPClientTransaction(sipStack, encapsulatedMessageChannel);
ct.setOriginalRequest(sipRequest);
return ct;
}
use of gov.nist.javax.sip.stack.MobicentsHASIPClientTransaction 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;
}
use of gov.nist.javax.sip.stack.MobicentsHASIPClientTransaction 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;
}
Aggregations