From b5902e08cdbd38a35f0d8eecb35d44e9fc02094d Mon Sep 17 00:00:00 2001 From: Denver Gingerich Date: Tue, 1 Aug 2017 18:13:42 +0000 Subject: [PATCH] better error on jmp-fwdcall's new "anonymous" JIDs When the user tries to send a message to an "anonymous" JID (the type of JID that jmp-fwdcalls will create when it gets a blocked caller ID, as of https://gitlab.com/ossguy/jmp-fwdcalls/commit/e2032c8 anyway) provide a more appropriate error message, as the JID does exist, it's just that the user who left the voicemail isn't available at that JID. --- sgx-catapult.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sgx-catapult.rb b/sgx-catapult.rb index 58f2bbbfdbb2a0c95d7a173e9c36fc96c82b3a8e..d36bbc79fae2a3a9aeed11b05d464cb980df39ac 100755 --- a/sgx-catapult.rb +++ b/sgx-catapult.rb @@ -46,6 +46,11 @@ def extract_shortcode(dest) num if context && context == 'phone-context=ca-us.phone-context.soprani.ca' end +def is_anonymous_tel?(dest) + num, context = dest.split(';', 2) + context && context == 'phone-context=anonymous.phone-context.soprani.ca' +end + class SGXClient < Blather::Client def register_handler(type, *guards, &block) super(type, *guards) { |*args| wrap_handler(*args, &block) } @@ -267,8 +272,13 @@ module SGXcatapult shortcode = extract_shortcode(num_dest) next shortcode if shortcode end - # TODO: text re num not (yet) supportd/implmentd - EMPromise.reject([:cancel, 'item-not-found']) + + if is_anonymous_tel?(num_dest) + EMPromise.reject([:cancel, 'gone']) + else + # TODO: text re num not (yet) supportd/implmentd + EMPromise.reject([:cancel, 'item-not-found']) + end } end