[Koha] SIP2 and telnet.

Mark Alexander marka at pobox.com
Mon Oct 19 02:59:19 NZDT 2020


Excerpts from sam aikins's message of 2020-10-18 03:09:06 +0800:
> Has anyone been able to telnet to SIP2 successfully.

It works for me, and I also wrote a couple of Ruby scripts that use telnet
to test the SIP2 connection.  Here's one of those with the library,
username, and password anonymized.

#!/usr/bin/env ruby
require 'ruby_expect'
host = ARGV[0] || 'localhost'
$logger = ::Logger.new($stdout)
$logger.level = ::Logger::DEBUG # was WARN
exp = RubyExpect::Expect.spawn("telnet #{host} 6001", {logger: $logger})
exp.procedure do
  # Expect each of the following
  each do
    expect /Trying .*\.\.\./ do
    end

    expect /Connected to #{host}/ do
    end

    cmd93 = '9300CNuser|COpassword|CLIB|'
    expect /Escape character is/ do
      send cmd93
    end

    # telnet echoes back everything we send, so we have to expect that.
    expect cmd93 do
    end

    cmd23 = '2300120060101    084235AOLIB|AAuser|ACsip_01|ADpassword|'
    expect /941/ do
      send cmd23
    end

    # telnet echoes back everything we send, so we have to expect that.
    expect cmd23 do
    end

    expect /24.*USER\|AAR9901\|BLY\|CQY\|AFGreetings from Koha.*\|AOLIB\|/ do
      send "\r"
    end

    expect /Connection closed by foreign host/ do
    end
  end
end

-- 
According to all the latest reports, there was no truth
in any of the earlier reports. --Ashleigh Brilliant


More information about the Koha mailing list