Hardware Reference
In-Depth Information
Output Conduits: Transmission
These are based solely on the msgxmit script, which is a method by which messages are sent to one or more
(comma-separated) users by one or more (also comma-separated) conduit protocols. This allows you to use this
master script to separate the target addresses, as well as perform address book lookups, so that each conduit driver
script needs to accept only a single destination address.
Like all commands, you need a standardized format. This one will be in the form of conduit, address, and
message:
msgxmit sms myphonenumber "An SMS from the command line, but could be anywhere"
This avoids the complication of a subject line, priority levels, attachments, and embedded links. They could be
added but would only make logical sense in specific transport conduits. Consequently, you do not try to process them
(or remove them with preprocessing) and instead pass the message through directly to the appropriate driver script.
The conduit may, at its discretion, elect to choose a subject line based on the message if it desires.
For example, the SMS transmission in the previous example would determine that the SMS conduit was to be
used and call the specific driver function like this:
mxsms sms 012345678 "An SMS from the command line, but could be anywhere"
The naming convention follows that the transmission script is always called mx , followed by the conduit name.
In some cases, two abstractions are involved. Speech output, for example, occurs with the vox conduit:
msgxmit vox default "I am talking to everyone in the house"
This trickles down into the mxvox script, which in turn will call say through:
mxvox vox default "I am talking to everyone in the house"
The conduit type is included as an argument at each stage as a sanity check and to allow one underlying
command to be used by more than one conduit.
So that new conduits can be added without changing the msgxmit script, you create a directory structure that
details each of them. For example, the folder will detail the SMS account credentials, address book aliases, and the
all-important command that transmits the message as I covered earlier:
/usr/local/minerva/etc/msg/sms
So, given a conduit type (or comma-separated list of several conduits) in the argument $1 and a list of addresses
similarly separated in $2, you can process them with the following:
SAVEIFS=$IFS
IFS=","
declare -a CONDUIT_ARRAY=($1)
shift
declare -a TO_ARRAY=($1)
shift
IFS=$SAVEIFS
MSG=$*
Search WWH ::




Custom Search