~cmb/commtools

miscellaneous VOIP and XMPP related utilities

5587163 Administrivia.

~cmb pushed to ~cmb/commtools git

11 months ago
11 months ago

I wrote these to make my life as a jmp.chat user a bit easier. Hopefully others will find them of use.

#Install

To install commtools, clone the repo and use luarocks make to build and install using luarocks.

git clone https://git.2mb.codes/~cmb/commtools
cd commtools
luarocks make --local # For per-user installation, or
sudo luarocks make # For system-wide installation.

System-wide installation is recommended. If you do that, the commands should be in /usr/local/bin or /usr/bin, depending on your luarocks configuration. If you do a per-user install, the scripts will show up in ~/.luarocks/bin or the like.

#The Tools

khard2xmpp is a script to import contacts from the khard tool into an XMPP roster.

bscmd is a script for controlling baresip.

#Configuration

The khard2xmpp script needs to be able to find your XMPP account. It uses a fairly simple configuration file in TOML format named ~/.config/commtools/commtools.conf. Here is a sample configuration:

default-xmpp-account = "chris"
[xmpp-account-chris]
jid = "chris@chat.number89.net"
password = "not4u2know"

The configuration file allows for the possibility of multiple accounts, though this feature isn't used right now. Accounts are identified by a short name, like chris, and configured in sections named [xmpp-account-SHORTNAME]. The default-xmpp-account variable holds the short name of the default account.

Additional configuration options will probably be added later. For instance, it would be nice not to store plaintext passwords in config files, but instead, fetch them out of a secret store.

#Usage

#bscmd

bscmd expects to be able to control a long-running baresip program over DBus. Typically I run baresip as a per-user service in a service manager, and it stays up from boot-up to shutdown. The details are beyond the scope of this document. You'll need some configuration options set in ~/.baresip/config:

module_app		menu.so
module_app		ctrl_dbus.so
ctrl_dbus
ctrl_dbus_use session

You'll want to disable all of the UI modules like stdio.so and cons.so, because you're running it as a service and controlling it with bscmd.

Once baresip is up and running, type bscmd --help at a shell prompt to get a list of commands. Most things are self-explanatory. Some commands, like sndcode will only work during a call. Many baresip commands haven't been added yet but will soon™. Examples:

bscmd dial '+18005551212' # Dial a phone number.
bscmd hangup # Self-explanatory.
bscmd dial 'sip:904@mouselike.org' # SIP test call.
bscmd dial --contact Chris
# If you have contact info in khard for someone named Chris, it'll dial
# them.  If you have multiple contacts named Chris, you can choose from
# a menu.

#khard2xmpp

This command takes no options and no arguments, though at some point I'll add a --account option. It pulls your XMPP roster and adds number@cheogram.com-style items to the roster for contacts that aren't already there. For instance, if you have a contact named Chris with a phone number of +18005551212, khard2xmpp will add an item with the JID +18005551212@cheogram.com and named Chris (phone) to your roster.

#License

MIT/X11, same as Lua itself.

#Notes

I bundle a version of Matthew Wild's verse Lua XMPP library, because there isn't a recent version in luarocks and it is a bit of a chore to clone and build.

#Contributing

The easiest way is to send email to my public inbox with either patches, or the URL of a fork of this repository.