diff --git a/config-schema.dhall b/config-schema.dhall index c996995980660f221baa0fd86696bac2fd74a677..945e4a8e691b4cb891cee7bc83097a475ffeac23 100644 --- a/config-schema.dhall +++ b/config-schema.dhall @@ -15,6 +15,7 @@ , component : { jid : Text, secret : Text } , credit_card_url : forall (jid : Text) -> forall (customer_id : Text) -> Text , creds : { account : Text, password : Text, username : Text } +, direct_sources : List { mapKey : Text, mapValue : Text } , direct_targets : List { mapKey : Text, mapValue : Text } , electrum : { rpc_password : Text, rpc_uri : Text, rpc_username : Text } , electrum_notify_url : diff --git a/config.dhall.sample b/config.dhall.sample index c4f88741d45c16893a5a74c7becaab11a008edfc..3e236cd8ac9bf9b48587e2219d9eb3c2e94a05e6 100644 --- a/config.dhall.sample +++ b/config.dhall.sample @@ -87,6 +87,9 @@ in direct_targets = toMap { `+15551234567` = "support@example.com" }, + direct_sources = toMap { + `support@example.com` = "+15551234567" + }, keep_area_codes = ["555"], keep_area_codes_in = { account = "", site_id = "", sip_peer_id = "" }, snikket_hosting_api = "", diff --git a/sgx_jmp.rb b/sgx_jmp.rb index 366d0546586e6c0bda0ae2f1951924ba121e3a5c..f494ce7cfe9945788dfd6bf88228ca934e9e75f3 100644 --- a/sgx_jmp.rb +++ b/sgx_jmp.rb @@ -367,7 +367,13 @@ CONFIG[:direct_targets].each do |(tel, jid)| BLATHER << m } end +end +CONFIG[:direct_sources].each do |(jid, tel)| + customer_repo = CustomerRepo.new( + sgx_repo: TrivialBackendSgxRepo.new(jid: jid), + set_user: Sentry.method(:set_user) + ) message to: /\Acustomer_/, from: /\A#{Regexp.escape(jid)}\/?/ do |m| customer_repo.find(m.to.node.delete_prefix("customer_")).then { |customer| m.from = "#{tel}@sgx-jmp" # stanza_to will fix domain