Pass through commands we know the SGX can handle

Stephen Paul Weber created

Change summary

sgx_jmp.rb | 15 +++++++++++++++
1 file changed, 15 insertions(+)

Detailed changes

sgx_jmp.rb 🔗

@@ -243,6 +243,8 @@ end
 disco_items node: "http://jabber.org/protocol/commands" do |iq|
 	reply = iq.reply
 	reply.items = [
+		{ node: "number-display", name: "Display JMP Number" },
+		{ node: "configure-calls", name: "Configure Calls" },
 		# TODO: don't show this item if no braintree methods available
 		# TODO: don't show this item if no plan for this customer
 		{ node: "buy-credit", name: "Buy account credit" },
@@ -293,6 +295,19 @@ def reply_with_note(iq, text, type: :info)
 	self << reply
 end
 
+# Commands that just pass through to the SGX
+command node: ["number-display", "configure-calls"] do |iq|
+	sentry_hub = new_sentry_hub(iq, name: iq.node)
+	Customer.for_jid(iq.from.stripped).then { |customer|
+		sentry_hub.current_scope.set_user(
+			id: customer.customer_id,
+			jid: iq.from.stripped.to_s
+		)
+
+		customer.stanza_from(iq)
+	}.catch { |e| panic(e, sentry_hub) }
+end
+
 command :execute?, node: "buy-credit", sessionid: nil do |iq|
 	sentry_hub = new_sentry_hub(iq, name: iq.node)
 	reply = iq.reply