sudo apt install build-essential libjson-xs-perl libnet-https-nb-perl libdatetime-perl
sudo cpan URL::Encode::XS
PERL5LIB=lib bin/sip2-mediator --help
PERL5LIB=lib bin/sip2-mediator \
--sip-address 127.0.0.1 \
--sip-port 6001 \
--http-host 127.0.0.1 \
--http-proto http \
--http-path /sip2-mediator \
--max-clients 120 \
--syslog-facility LOCAL4
kill -s USR1 <sip2-mediator-pid>
SIP2Mediator is a SIP2 server which relays SIP requests between SIP clients and a JSON/HTTP backend. The mediator is a single-cpu, single-thread application which processes network data on a first come first served basis via select loop.
Given the limited functionality of the mediator proper, system requirements are minimal. Similarly, since the mediator performs no ILS tasks directly, it can integrate with any ILS which provides the required HTTP back-end.
SIP Client <=> SIP <=> SIP2Mediator <=> JSON <=> HTTP Server <=> ILS Data <=> ILS
- Message exchanged with the HTTP back-end are encoded as JSON Objects with a "code", "fixed_fields", and optionally "fields" keys.
Example SIP Login Message
9300|CNsip_username|COsip_password
{
"code": 93,
"fixed_fields": ["0", "0"],
"fields": [
{"CN": "sip_username"},
{"CO": "sip_password"}
]
}
A SIP2 client library and command line tool are included for testing.
PERL5LIB=lib bin/sip2-client \
--sip-address 127.0.0.1 \
--sip-port 6001 \
--sip-username siplogin \
--sip-password sippassword \
--institution example \
--item-barcode 123456789 \
--patron-barcode 987654321 \
--patron-password demo123 \
--message sc-status \
--message item-information \
--message patron-information \
--message patron-status
- Decouple ILS implementation from SIP server.
- Decouple SIP accounts from ILS accounts
- Back-end SIP API which survives front-end changes.
- Reduce system requirements for SIP servers
- Support load distrubution across an Evergreen cluster
- Support graceful-ish SIP server detachment
- Move SIP configuration into the Evergreen database
- Allow for configuration changes (e.g. adding SIP accounts) without having to restart the SIP server.
- Decouple institution IDs from configuration settings.
- Reduce SIP message layer abstraction to ease customization.
- Support persistent and transient SIP sessions
- BONUS: In scenarios where sip2-mediator may be run alongside SIP clients, SIP traffic to/from EG traffic may be encrypted by HTTPS.
- BONUS: SIP actions may be performed via direct HTTPS, bypassing wire-level SIP altogether.
- BONUS: Testing SIP changes via srfsh
srfsh# request open-ils.sip2 open-ils.sip2.request "randomkey", {"code":"93","fields":[{"CN":"sipuser"}, {"CO":"sippass"}]}