M lib/bwmsgsv2_repo.rb => lib/bwmsgsv2_repo.rb +1 -1
@@ 45,7 45,7 @@ class Bwmsgsv2Repo
customer_fwd.timeout.to_i
)
]).then do
- set_default_location(tel) if customer_fwd.v2_sip?
+ set_default_location(tel) if customer_fwd.v2_safe?
end
end
M lib/customer_fwd.rb => lib/customer_fwd.rb +10 -2
@@ 52,18 52,22 @@ class CustomerFwd
BANDWIDTH_VOICE.create_call(account, body: request).data.call_id
end
- def v2_sip?
+ def v2_safe?
false
end
class Tel < CustomerFwd
+ def v2_safe?
+ true
+ end
+
def to
uri.sub(/^tel:/, "")
end
end
class SIP < CustomerFwd
- def v2_sip?
+ def v2_safe?
uri.end_with?(CONFIG[:sip][:realm])
end
@@ 73,6 77,10 @@ class CustomerFwd
end
class XMPP < CustomerFwd
+ def v2_safe?
+ true
+ end
+
def to
jid = uri.sub(/^xmpp:/, "")
"sip:#{ERB::Util.url_encode(jid)}@sip.cheogram.com"
M test/test_registration.rb => test/test_registration.rb +4 -0
@@ 563,6 563,10 @@ class RegistrationTest < Minitest::Test
"Content-Type" => "application/json"
}
).to_return(status: 201)
+ stub_request(
+ :post,
+ "https://dashboard.bandwidth.com/v1.0/accounts//sites//sippeers//movetns"
+ )
Registration::Finish::REDIS.expect(
:del,
nil,