use of gov.nist.core.Host in project XobotOS by xamarin.
the class MessageProcessor method getViaHeader.
/**
* Get the Via header to assign for this message processor. The topmost via
* header of the outoging messages use this.
*
* @return the ViaHeader to be used by the messages sent via this message processor.
*/
public Via getViaHeader() {
try {
Via via = new Via();
if (this.sentByHostPort != null) {
via.setSentBy(sentByHostPort);
via.setTransport(this.getTransport());
} else {
Host host = new Host();
host.setHostname(this.getIpAddress().getHostAddress());
via.setHost(host);
via.setPort(this.getPort());
via.setTransport(this.getTransport());
}
return via;
} catch (ParseException ex) {
ex.printStackTrace();
return null;
} catch (InvalidArgumentException ex) {
ex.printStackTrace();
return null;
}
}
use of gov.nist.core.Host in project XobotOS by xamarin.
the class SIPTransactionStack method createMessageChannel.
/**
* Creates a client transaction to handle a new request. Gets the real message channel from
* the superclass, and then creates a new client transaction wrapped around this channel.
*
* @param nextHop Hop to create a channel to contact.
*/
public MessageChannel createMessageChannel(SIPRequest request, MessageProcessor mp, Hop nextHop) throws IOException {
// New client transaction to return
SIPTransaction returnChannel;
// Create a new client transaction around the
// superclass' message channel
// Create the host/port of the target hop
Host targetHost = new Host();
targetHost.setHostname(nextHop.getHost());
HostPort targetHostPort = new HostPort();
targetHostPort.setHost(targetHost);
targetHostPort.setPort(nextHop.getPort());
MessageChannel mc = mp.createMessageChannel(targetHostPort);
// available for the transport.
if (mc == null)
return null;
returnChannel = createClientTransaction(request, mc);
((SIPClientTransaction) returnChannel).setViaPort(nextHop.getPort());
((SIPClientTransaction) returnChannel).setViaHost(nextHop.getHost());
addTransactionHash(returnChannel);
// returnChannel.startTransactionTimer();
return returnChannel;
}
Aggregations