final String namespace = element.getNamespaceURI();
if (JingleChannelIQ.NAME.equals(element.getName()) && JingleChannelIQ.NAMESPACE.equals(namespace)
&& UDP.equals(element.attributeValue(PROTOCOL))) {
final Element childElement = iq.getChildElement().createCopy();
final RelayChannel channel = plugin.createRelayChannel();
if (channel != null) {
childElement.addAttribute(HOST, LocalIPResolver.getLocalIP());
childElement.addAttribute(LOCAL_PORT, Integer.toString(channel.getPortA()));
childElement.addAttribute(REMOTE_PORT, Integer.toString(channel.getPortB()));
reply.setChildElement(childElement);
Log.debug("Created relay channel {}:{}, {}:{}, {}:{}", new Object[]{HOST,
LocalIPResolver.getLocalIP(), LOCAL_PORT, Integer.toString(channel.getPortA()), REMOTE_PORT,
Integer.toString(channel.getPortB())});
} else {
reply.setError(PacketError.Condition.internal_server_error);
}
return reply;