From 0925ae72ced0b5a9b2aae40c697b472aee97ced1 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 26 Apr 2022 19:22:20 -0500 Subject: [PATCH] Contacting support is not billable --- config-schema.dhall | 1 + config.dhall.sample | 1 + sgx_jmp.rb | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/config-schema.dhall b/config-schema.dhall index 1e6f5eda9b7a7e1fcc9d441b3180cfb6015467bc..9878775bd435b06752207207e1176e513164036f 100644 --- a/config-schema.dhall +++ b/config-schema.dhall @@ -39,6 +39,7 @@ , sgx : Text , sip : { app : Text, realm : Text } , sip_host : Text +, unbilled_targets : List Text , upstream_domain : Text , web : < Inet : { interface : Text, port : Natural } | Unix : Text > , web_register : { from : Text, to : Text } diff --git a/config.dhall.sample b/config.dhall.sample index 61b0e87b7696af2d85c995a912f0ed2ac43293dc..cedfc1b832cd67146a310fd26ab5f160795415cf 100644 --- a/config.dhall.sample +++ b/config.dhall.sample @@ -76,6 +76,7 @@ in payable = "", notify_from = "+15551234567@example.net", admins = ["test\\40example.com@example.net"], + unbilled_targets = ["+14169938000"], upstream_domain = "example.net", approved_domains = toMap { `example.com` = Some "customer_id" } } diff --git a/sgx_jmp.rb b/sgx_jmp.rb index 3f5766ada233f4a2c8e4b7aa53405e23e7bc3ad0..b48dddaec11d8c50d694e0786ccfe2bc8d46a867 100644 --- a/sgx_jmp.rb +++ b/sgx_jmp.rb @@ -307,8 +307,11 @@ end # Especially if we have the component join MUC for notifications message(type: :groupchat) { true } +UNBILLED_TARGETS = Set.new(CONFIG[:unbilled_targets]) def billable_message(m) - (m.body && !m.body.empty?) || m.find("ns:x", ns: OOB.registered_ns).first + b = m.body + !UNBILLED_TARGETS.member?(m.to.node) && \ + (b && !b.empty? || m.find("ns:x", ns: OOB.registered_ns).first) end class OverLimit < StandardError