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