From 831894e9ce3d4a22047b36b9ea7c88cef4e9b699 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Mon, 20 May 2024 18:21:23 -0500 Subject: [PATCH] Use unroute instead of route to bogus jid --- lib/registration_repo.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/registration_repo.rb b/lib/registration_repo.rb index a750321ff5097e3c9a89b6286ee8d23bed224ff4..71f365dc498794961e970caa752d71c777c7cf46 100644 --- a/lib/registration_repo.rb +++ b/lib/registration_repo.rb @@ -31,7 +31,7 @@ class RegistrationRepo next { code: 0 } unless creds EMPromise.all([ - setup_endstream_route(*creds, "#{creds.first}@example.com"), + remove_endstream_route(*creds), @redis.del("endstream_registration-#{jid.stripped}") ]).then { |(status, _)| status } end @@ -51,4 +51,15 @@ protected ).body.dig(:did_route_sms_to_xmpp_response, :did_route_sms_to_xmpp_result) } end + + def remove_endstream_route(tel, username, password) + EM.promise_defer { + @savon.call( + :did_unroute_sms, message: { + auth: { username: username, password: password }, + dID: tel.sub(/\A\+/, "") + } + ).body.dig(:did_unroute_sms_response, :did_unroute_sms_result) + } + end end