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 1e6f5ed..9878775 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 61b0e87..cedfc1b 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 3f5766a..b48ddda 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 -- 2.45.2