@@ 7,6 7,7 @@ require "securerandom"
require_relative "./alt_top_up_form"
require_relative "./bandwidth_tn_order"
require_relative "./em"
+require_relative "./error_to_send"
require_relative "./oob"
require_relative "./web_register_manager"
@@ 471,8 472,19 @@ class Registration
"sip:#{ERB::Util.url_encode(@reply.to.stripped.to_s)}@sip.cheogram.com"
end
+ def raise_setup_error
+ @reply.note_type = :error
+ @reply.note_text =
+ "There was an error setting up your number, " \
+ "please contact JMP support."
+ raise ErrorToSend, @reply
+ end
+
def customer_active_tel_purchased
- @customer.register!(@tel).then {
+ @customer.register!(@tel).catch { |e|
+ puts e
+ raise_setup_error
+ }.then {
EMPromise.all([
REDIS.set("catapult_fwd-#{@tel}", cheogram_sip_addr),
@customer.fwd_timeout = 25 # ~5 seconds / ring, 5 rings