diff mod_turncredentials/mod_turncredentials.lua @ 3561:deb5ece56c49

mod_turncredentials: Convert numeric attributes to strings (fixes #1339)
author Kim Alvefur <zash@zash.se>
date Tue, 09 Apr 2019 23:23:30 +0200
parents 7dbde05b48a9
children 2bbf655431be
line wrap: on
line diff
--- a/mod_turncredentials/mod_turncredentials.lua	Tue Apr 09 18:05:28 2019 +0200
+++ b/mod_turncredentials/mod_turncredentials.lua	Tue Apr 09 23:23:30 2019 +0200
@@ -26,8 +26,8 @@
     local userpart = tostring(now);
     local nonce = base64.encode(hmac_sha1(secret, tostring(userpart), false));
     origin.send(st.reply(stanza):tag("services", {xmlns = "urn:xmpp:extdisco:1"})
-        :tag("service", { type = "stun", host = host, port = port }):up()
-        :tag("service", { type = "turn", host = host, port = port, username = userpart, password = nonce, ttl = ttl}):up()
+        :tag("service", { type = "stun", host = host, port = ("%d"):format(port) }):up()
+        :tag("service", { type = "turn", host = host, port = ("%d"):format(port), username = userpart, password = nonce, ttl = ("%d"):format(ttl) }):up()
     );
     return true;
 end);