Reply to extdisco with sip server

Stephen Paul Weber created

Change summary

config.dhall.sample |  1 +
sgx_jmp.rb          | 14 ++++++++++++++
2 files changed, 15 insertions(+)

Detailed changes

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 = "",

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 {