Software /
code /
prosody-modules
Comparison
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 |
parent | 1343:7dbde05b48a9 |
child | 3642:2bbf655431be |
comparison
equal
deleted
inserted
replaced
3560:0ebb7112c102 | 3561:deb5ece56c49 |
---|---|
24 end | 24 end |
25 local now = os_time() + ttl; | 25 local now = os_time() + ttl; |
26 local userpart = tostring(now); | 26 local userpart = tostring(now); |
27 local nonce = base64.encode(hmac_sha1(secret, tostring(userpart), false)); | 27 local nonce = base64.encode(hmac_sha1(secret, tostring(userpart), false)); |
28 origin.send(st.reply(stanza):tag("services", {xmlns = "urn:xmpp:extdisco:1"}) | 28 origin.send(st.reply(stanza):tag("services", {xmlns = "urn:xmpp:extdisco:1"}) |
29 :tag("service", { type = "stun", host = host, port = port }):up() | 29 :tag("service", { type = "stun", host = host, port = ("%d"):format(port) }):up() |
30 :tag("service", { type = "turn", host = host, port = port, username = userpart, password = nonce, ttl = ttl}):up() | 30 :tag("service", { type = "turn", host = host, port = ("%d"):format(port), username = userpart, password = nonce, ttl = ("%d"):format(ttl) }):up() |
31 ); | 31 ); |
32 return true; | 32 return true; |
33 end); | 33 end); |