~singpolyma/sgx-jmp

0925ae72ced0b5a9b2aae40c697b472aee97ced1 — Stephen Paul Weber 2 months ago 94cef4e
Contacting support is not billable
3 files changed, 6 insertions(+), 1 deletions(-)

M config-schema.dhall
M config.dhall.sample
M sgx_jmp.rb
M config-schema.dhall => config-schema.dhall +1 -0
@@ 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 }

M config.dhall.sample => config.dhall.sample +1 -0
@@ 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" }
}

M sgx_jmp.rb => sgx_jmp.rb +4 -1
@@ 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