Skip to content

Commit

Permalink
resolve host name into ip address
Browse files Browse the repository at this point in the history
  • Loading branch information
deleolajide committed Mar 14, 2024
1 parent 30596cb commit 96b5859
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/web/pionturn.jsp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<%@ page import="java.util.*" %>
<%@ page import="java.net.*" %>
<%@ page import="org.ifsoft.turn.openfire.*" %>
<%@ page import="org.igniterealtime.openfire.plugins.externalservicediscovery.Service" %>
<%@ page import="org.jivesoftware.openfire.*" %>
Expand All @@ -23,12 +24,17 @@
Map<String, Service> services = plugin.getTurnServices();
if (services != null && services.containsKey(service)) {
Service turn = services.get(service);
Service turn = services.get(service);
String ipAddress = turn.getHost();
try {
ipAddress = InetAddress.getByName(ipAddress).getHostAddress();
} catch (Exception e) { }
JiveGlobals.setProperty("pionturn.secret", turn.getSharedSecret());
JiveGlobals.setProperty("pionturn.username", turn.getRawUsername());
JiveGlobals.setProperty("pionturn.password", turn.getRawPassword());
JiveGlobals.setProperty("pionturn.ipaddr", turn.getHost());
JiveGlobals.setProperty("pionturn.ipaddr", ipAddress);
JiveGlobals.setProperty("pionturn.port", String.valueOf(turn.getPort()));
}
Expand Down

0 comments on commit 96b5859

Please sign in to comment.