Contacting support is not billable

Stephen Paul Weber created

Change summary

config-schema.dhall | 1 +
config.dhall.sample | 1 +
sgx_jmp.rb          | 5 ++++-
3 files changed, 6 insertions(+), 1 deletion(-)

Detailed changes

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 }

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" }
 }

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