[Koha-bugs] [Bug 25965] New: Create SIP2 client daemon with HTTPS API endpoint

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Jul 9 14:45:10 CEST 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25965

            Bug ID: 25965
           Summary: Create SIP2 client daemon with HTTPS API endpoint
 Change sponsored?: ---
           Product: Koha
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: new feature
          Priority: P5 - low
         Component: REST API
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: lmstrand at gmail.com

I am trying to pass messages to a sip server using a new endpoint I created in
swagger/openApi. This endpoint uses the guidelines described here:

http://biblstandard.dk/rfid/dk/rfid_sip2_over_https.htm

The idea is to get rid of the tunneling/VPN implementations that we use, and
use HTTPS instead to pass sip messages back and forth inside an XML. The Apache
server handles the HTTPS stuff so I don't have had to worry about that so far
when communicating with the REST api, hence the SipOHttp naming in my module.
At the moment I can send the XML POST messages formed like in the linked
guideline to the endpoint (XML wrapped SIP2 message to
.../api/v1/sipmessages/). The api forwards the body content of the request to
my module Koha::REST::V1::SipOHttp. The module validates and parses the
contents of the XML message, extracts the information about the sip server the
message is intended to (using the "login:" parameter inside the XML) and the
sip message itself (inside the <request></request> variable). Then the module
passes the sip message on to the sip server using IO:Socket::INET.

My problem is that the sip server closes the connection after this first SC
device login message has been passed and the response has been read back in my
module:

(from sip2.log)
.....
[INFO] [undef]@10.0.3.217: OUTPUT MSG: '941' C4::SIP::Sip::write_msg
/home/koha/Koha/C4/SIP/Sip.pm (187) 
[DEBUG] SIPDEVICE at 10.0.3.217: raw_transport: uname/inst: 'SIPDEVICE/SIPDEVICE'
C4::SIP::SIPServer::raw_transport /home/koha/Koha/C4/SIP/SIPServer.pm (174)
[DEBUG] SIPDEVICE at 10.0.3.217: EOF returned on read
C4::SIP::SIPServer::read_request /home/koha/Koha/C4/SIP/SIPServer.pm (349) 
[INFO] SIPDEVICE at 10.0.3.217: raw_transport: shutting down
C4::SIP::SIPServer::raw_transport /home/koha/Koha/C4/SIP/SIPServer.pm (178)

So I need a way to keep this socket connection open for other future messages.
Without touching the sip server's code itself, the only solution I can come up
with is a proxy server that handles and passes on the REST api's incoming
messages to sockets and keeps each invidual socket connection open to specific
instances of the sip servers (I suppose the sip server itself ends the
connections when needed so you wouldn't have to worry about it in the sender's
end).
Another solution would be to build a new api separate from the swagger/Openapi
one. Like an all-in-one solution that deals with the requests and keeps tabs on
the open socket connections.

Let me know if you have ideas regarding this.

Ps. I'm a trainee in Koha Suomi (Finland) so excuse me if the description of my
problem is a bit vague and lacks some correct terms used. I'm happy to fill in
any details I've left out.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list