@@ -3,3 +3,5 @@
An XMPP to SMS gateway for Catapult (also known as Bandwidth AP), using XEP-0100. The "SGX" stands for "Soprani.ca Gateway to XMPP", as this is associated with the Soprani.ca project.
Note that the canonical location for this repository is https://gitlab.com/ossguy/sgx-catapult . Please use that location for all pull requests, issue reports, etc. Other locations are likely out-of-date.
+
+This program expects a binary named "tai" to be in its working directory, which should be a compiled version of https://ossguy.com/tai.c for the platform it is running on.
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
#
-# Copyright (C) 2017 Denver Gingerich <denver@ossguy.com>
+# Copyright (C) 2017-2018 Denver Gingerich <denver@ossguy.com>
# Copyright (C) 2017 Stephen Paul Weber <singpolyma@singpolyma.net>
#
# This file is part of sgx-catapult.
@@ -263,6 +263,20 @@ module SGXcatapult
[:cancel, 'internal-server-error']
)
}
+
+ t = Time.now
+ tai_timestamp = `./tai`.strip
+ tai_yyyymmdd = Time.at(tai_timestamp.to_i).strftime('%Y%m%d')
+ puts "SMU %d.%09d, %s: msg for %s sent on %s - incrementing\n" %
+ [t.to_i, t.nsec, tai_timestamp, usern, tai_yyyymmdd]
+
+ REDIS.incr('usage_messages-' + tai_yyyymmdd + '-' +
+ usern).then { |total|
+
+ t = Time.now
+ puts "SMU %d.%09d: total msgs for %s-%s now at %s\n" %
+ [t.to_i, t.nsec, tai_yyyymmdd, usern, total]
+ }
end
def self.validate_num(num)
@@ -766,8 +780,8 @@ module SGXcatapult
"API Secret is password, Phone Number is phone"\
".\n\nThe source code for this gateway is at "\
"https://gitlab.com/ossguy/sgx-catapult ."\
- "\nCopyright (C) 2017 Denver Gingerich and "\
- "others, licensed under AGPLv3+."
+ "\nCopyright (C) 2017-2018 Denver Gingerich "\
+ "and others, licensed under AGPLv3+."
n2 = Nokogiri::XML::Node.new 'nick', msg.document
n3 = Nokogiri::XML::Node.new 'username', msg.document
n4 = Nokogiri::XML::Node.new 'password', msg.document
@@ -805,8 +819,8 @@ module SGXcatapult
"account you want to use (ie. '+12345678901')"\
".\n\nThe source code for this gateway is at "\
"https://gitlab.com/ossguy/sgx-catapult ."\
- "\nCopyright (C) 2017 Denver Gingerich and "\
- "others, licensed under AGPLv3+."
+ "\nCopyright (C) 2017-2018 Denver Gingerich "\
+ "and others, licensed under AGPLv3+."
msg.add_child(x)
orig.add_child(msg)