From 66707180b5bffa9f8df2f5519b8c3dcbcbb9ca82 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 30 Jun 2021 12:35:18 -0500 Subject: [PATCH] Reply to extdisco with sip server --- config.dhall.sample | 1 + sgx_jmp.rb | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/config.dhall.sample b/config.dhall.sample index 1bfcc17c49130a018b762de6054518d3bee23425..eefb270dd843fcc579b1bf85af978f1d129d6861 100644 --- a/config.dhall.sample +++ b/config.dhall.sample @@ -39,6 +39,7 @@ xep0157 = [ { var = "support-addresses", value = "xmpp:+14169938000@cheogram.com" } ], + sip_host = "sip.jmp.chat", plans = ./plans.dhall, electrum = ./electrum.dhall, oxr_app_id = "", diff --git a/sgx_jmp.rb b/sgx_jmp.rb index a0e713bc1ddd25590ea0478cf69868c7f65b1549..f5a56e8d504442dda00ff405037909e9779f7531 100644 --- a/sgx_jmp.rb +++ b/sgx_jmp.rb @@ -257,6 +257,20 @@ disco_items node: "http://jabber.org/protocol/commands" do |iq| }.catch { |e| panic(e, sentry_hub) } end +iq "/iq/ns:services", ns: "urn:xmpp:extdisco:2" do |iq| + reply = iq.reply + reply << Nokogiri::XML::Builder.new { + services(xmlns: "urn:xmpp:extdisco:2") do + service( + type: "sip", + host: CONFIG[:sip_host] + ) + end + }.doc.root + + self << reply +end + command :execute?, node: "jabber:iq:register", sessionid: nil do |iq| sentry_hub = new_sentry_hub(iq, name: iq.node) EMPromise.resolve(nil).then {