Move between accounts requires a sip peer id

Stephen Paul Weber created

Change summary

config-schema.dhall      | 2 +-
config.dhall.sample      | 2 +-
lib/bandwidth_tn_repo.rb | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)

Detailed changes

config-schema.dhall 🔗

@@ -20,7 +20,7 @@
     forall (address : Text) -> forall (customer_id : Text) -> Text
 , interac : Text
 , keep_area_codes : List Text
-, keep_area_codes_in : { account : Text, site : Text }
+, keep_area_codes_in : { account : Text, sip_peer_id : Text, site_id : Text }
 , notify_admin : Text
 , notify_from : Text
 , ogm_path : Text

config.dhall.sample 🔗

@@ -78,7 +78,7 @@ in
 	admins = ["test\\40example.com@example.net"],
 	unbilled_targets = ["+14169938000"],
 	keep_area_codes = ["555"],
-	keep_area_codes_in = { account = "", site = "" },
+	keep_area_codes_in = { account = "", site_id = "", sip_peer_id = "" },
 	upstream_domain = "example.net",
 	approved_domains = toMap { `example.com` = Some "customer_id" }
 }

lib/bandwidth_tn_repo.rb 🔗

@@ -32,9 +32,9 @@ class BandwidthTnRepo
 		tn = tel.sub(/\A\+1/, "")
 		if CONFIG[:keep_area_codes].find { |area| tn.start_with?(area) }
 			BandwidthIris::Tn.new({ telephone_number: tn }, @move_client).move(
-				site_id: CONFIG[:keep_area_codes_in][:site],
 				customer_order_id: order_name,
-				source_account_id: CONFIG[:creds][:account]
+				source_account_id: CONFIG[:creds][:account],
+				**CONFIG[:keep_area_codes_in].slice(:site_id, :sip_peer_id)
 			)
 		else
 			BandwidthIris::Disconnect.create(order_name, tn)