]> git.evergreen-ils.org Git - Evergreen.git/blob - docs-antora/modules/admin/pages/sip_server.adoc
LP#1848524: Docs: section fixes
[Evergreen.git] / docs-antora / modules / admin / pages / sip_server.adoc
1 == SIP Server ==
2
3 === About the SIP Protocol ===
4
5 indexterm:[Automated Circulation System]
6 indexterm:[SelfCheck]
7 indexterm:[Automated Material Handling]
8
9 +SIP+, standing for +Standard Interchange Protocol+, was developed by the +3M corporation+ to be a common 
10 protocol for data transfer between ILS' (referred to in +SIP+ as an _ACS_, or _Automated Circulation System_)  and a 
11 third party device. Originally, the protocol was developed for use with _3M SelfCheck_ (often abbreviated SC, not to 
12 be confused with Staff Client) systems, but has since expanded to other companies and devices. It is now common 
13 to find +SIP+ in use in several other vendors' SelfCheck systems, as well as other non-SelfCheck devices. Some 
14 examples include:
15
16 * Patron Authentication (computer access, subscription databases) 
17 * Automated Material Handling (AMH) 
18 ** The automated sorting of items, often to bins or book carts, based on shelving location or other programmable 
19 criteria
20
21 === Installing the SIP Server ===
22
23
24
25 This is a rough intro to installing the +SIP+ server for Evergreen. 
26
27 Getting the code 
28 ^^^^^^^^^^^^^^^^
29
30 Current +SIP+ server code lives at in the Evergreen git repository:
31
32    cd /opt 
33    git clone git://git.evergreen-ils.org/SIPServer.git SIPServer 
34
35
36 Configuring the Server 
37 ^^^^^^^^^^^^^^^^^^^^^^
38
39 indexterm:[configuration files, oils_sip.xml]
40
41 . Type the following commands from the command prompt: 
42
43    $ sudo su opensrf 
44    $ cd /openils/conf 
45    $ cp oils_sip.xml.example oils_sip.xml 
46
47 . Edit oils_sip.xml. Change the commented out <server-params> section to this: 
48
49    <server-params
50       min_spare_servers='1' 
51       max_spare_servers='2' 
52       min_servers='3'
53       max_servers='25' 
54                 />
55
56 . max_servers will directly correspond to the number of allowed +SIP+ clients. Set the number accordingly, but 
57 bear in mind that too many connections can exhaust memory. On a 4G RAM/4 CPU server (that is also running 
58 evergreen), it is not recommended to exceed 100 +SIP+ client connections. 
59
60 ===== Setting the encoding =====
61
62 SIPServer looks for the encoding in the following
63 places:
64
65 1. An +encoding+ attribute on the +account+ element for the currently active SIP account.
66 2. The +encoding+ element that is a child of the +institution+ element of the currently active SIP account.
67 3. The +encoding+ element that is a child of the +implementation_config+ element that is itself a child of the +institution+ element of the currently active SIP account.
68 4. If none of the above exist, then the default encoding (ASCII) is used.
69
70 Option 3 is a legacy option.  It is recommended that you alter your configuration to
71 move this element out of the +implementation_config+ element and into
72 its parent +institution+ element.  Ideally, SIPServer should *not* look into
73 the implementation config, and this check may be removed at some time
74 in the future.
75
76 ===== Datatypes =====
77
78 The `msg64_hold_datatype` setting is similar to `msg64_summary_datatype`, but affects holds instead of circulations.
79 When set to `barcode`, holds information will be delivered as a set of copy barcodes instead of title strings for
80 patron info requests. With barcodes, SIP clients can both find the title strings for display (via item info requests)
81 and make subsequent hold-related action requests, like holds cancellation. 
82
83
84 ==== Adding SIP Users ====
85
86 indexterm:[configuration files, oils_sip.xml]
87
88 . Type the following commands from the command prompt: 
89
90   $ sudo su opensrf 
91   $ cd /openils/conf
92
93 . In the +<accounts>+ section, add +SIP+ client login information. Make sure that all +<logins>+ use the same 
94 institution attribute, and make sure the institution is listed in +<institutions>+. All attributes in the 
95 +<login>+ section will be used by the +SIP+ client. 
96
97 . In Evergreen, create a new profile group called +SIP+. This group should be a sub-group of +Users+ (not +Staff+ 
98 or +Patrons+). Set _Editing Permission_ as *group_application.user.sip_client* and give the group the following 
99 permissions: 
100 +
101      COPY_CHECKIN 
102      COPY_CHECKOUT 
103      CREATE_PAYMENT
104      RENEW_CIRC 
105      VIEW_CIRCULATIONS 
106      VIEW_COPY_CHECKOUT_HISTORY 
107      VIEW_PERMIT_CHECKOUT 
108      VIEW_USER 
109      VIEW_USER_FINES_SUMMARY 
110      VIEW_USER_TRANSACTIONS 
111 +
112 OR use SQL like: 
113 +
114    
115    INSERT INTO permission.grp_tree (name,parent,description,application_perm) 
116    VALUES ('SIP', 1, 'SIP2 Client Systems', 'group_application.user.sip_client'); 
117   
118    INSERT INTO 
119      permission.grp_perm_map (grp, perm, depth, grantable) 
120    SELECT 
121      g.id, p.id, 0, FALSE 
122    FROM 
123      permission.grp_tree g, 
124      permission.perm_list p 
125    WHERE 
126      g.name = 'SIP' AND 
127      p.code IN ( 
128        'COPY_CHECKIN', 
129        'COPY_CHECKOUT', 
130        'RENEW_CIRC', 
131        'VIEW_CIRCULATIONS', 
132        'VIEW_COPY_CHECKOUT_HISTORY', 
133        'VIEW_PERMIT_CHECKOUT', 
134        'VIEW_USER', 
135        'VIEW_USER_FINES_SUMMARY', 
136        'VIEW_USER_TRANSACTIONS' 
137     ); 
138 +
139 Verify:
140 +
141     
142     SELECT * 
143     FROM permission.grp_perm_map pgpm 
144         INNER JOIN permission.perm_list ppl ON pgpm.perm = ppl.id 
145         INNER JOIN permission.grp_tree pgt ON pgt.id = pgpm.grp 
146     WHERE pgt.name = 'SIP';
147     
148  
149     
150 . For each account created in the +<login>+ section of oils_sip.xml, create a user (via the staff client user 
151 editor) that has the same username and password and put that user into the +SIP+ group. 
152
153 [NOTE]
154 ===================
155 The expiration date will affect the +SIP+ users' connection so you might want to make a note of this 
156 somewhere. 
157 ===================
158
159 Running the server 
160 ^^^^^^^^^^^^^^^^^^
161
162 To start the +SIP+ server type the following commands from the command prompt: 
163
164
165    $ sudo su opensrf 
166
167    $ oils_ctl.sh -a [start|stop|restart]_sip 
168
169 indexterm:[SIP]
170
171
172 Logging-SIP 
173 ^^^^^^^^^^^
174
175 ===== Syslog =====
176
177 indexterm:[syslog]
178
179
180 It is useful to log +SIP+ requests to a separate file especially during initial setup by modifying your syslog config file. 
181
182 . Edit syslog.conf. 
183
184    $ sudo vi /etc/syslog.conf  # maybe /etc/rsyslog.conf
185
186
187 . Add this: 
188
189    local6.*                -/var/log/SIP_evergreen.log 
190  
191 . Syslog expects the logfile to exist so create the file. 
192
193    $ sudo touch /var/log/SIP_evergreen.log 
194
195 . Restart sysklogd. 
196
197    $ sudo /etc/init.d/sysklogd restart 
198
199
200 ===== Syslog-NG =====
201
202 indexterm:[syslog-NG]
203
204 . Edit logging config. 
205
206    sudo vi /etc/syslog-ng/syslog-ng.conf 
207
208 . Add: 
209
210    # +SIP2+ for Evergreen 
211    filter    f_eg_sip { level(warn, err, crit) and facility(local6); }; 
212    destination eg_sip { file("var/log/SIP_evergreen.log"); }; 
213    log { source(s_all); filter(f_eg_sip); destination(eg_sip); }; 
214
215 . Syslog-ng expects the logfile to exist so create the file. 
216
217    $ sudo touch /var/log/SIP_evergreen.log
218
219 . Restart syslog-ng 
220
221    $ sudo /etc/init.d/syslog-ng restart 
222
223
224 indexterm:[SIP]
225
226
227 Testing Your SIP Connection 
228 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
229
230 * In the root directory of the SIPServer code: 
231
232    $ cd SIPServer/t 
233
234 * Edit SIPtest.pm, change the $instid, $server, $username, and $password variables. This will be 
235 enough to test connectivity. To run all tests, you'll need to change all the variables in the _Configuration_ section. 
236
237    $ PERL5LIB=../ perl 00sc_status.t 
238 +
239 This should produce something like:
240 +
241
242    1..4 
243    ok 1 - Invalid username 
244    ok 2 - Invalid username 
245    ok 3 - login 
246    ok 4 - SC status 
247
248 * Don't be dismayed at *Invalid Username*. That's just one of the many tests that are run. 
249
250 ==== More Testing ====
251
252 Once you have opened up either the +SIP+ OR +SIP2+ ports to be accessible from outside you can do some testing 
253 via +telnet+. In the following tests:
254
255 * Replace +$server+ with your server hostname (or +localhost+ if you want to
256   skip testing external access for now);
257 * Replace +$username+, +$password+, and +$instid+ with the corresponding values
258   in the +<accounts>+ section of your SIP configuration file;
259 * Replace the +$user_barcode+ and +$user_password+ variables with the values
260   for a valid user.
261 * Replace the +$item_barcode+ variable with the values for a valid item.
262
263 ///////////////
264 Comments because we don't want to indent these numbered bullets!
265 ///////////////
266
267 . Start by testing your ability to log into the SIP server:
268 +
269 [NOTE]
270 ======================
271 We are using 6001 here which is associated with +SIP2+ as per our configuration. 
272 ======================
273 +
274    $ telnet $server 6001 
275    Connected to $server. 
276    Escape character is '^]'. 
277    9300CN$username|CO$password|CP$instid
278 +
279 If successful, the SIP server returns a +941+ result. A result of +940+,
280 however, indicates an unsuccessful login attempt. Check the +<accounts>+
281 section of your SIP configuration and try again.
282
283 . Once you have logged in successfully, replace the variables in the following
284 line and paste it into the telnet session:
285 +
286     2300120080623    172148AO$instid|AA$user_barcode|AC$password|AD$user_password
287 +
288 If successful, the SIP server returns the patron information for $user_barcode,
289 similar to the following:
290 +
291    24  Y           00120100113    170738AEFirstName MiddleName LastName|AA$user_barcode|BLY|CQY
292    |BHUSD|BV0.00|AFOK|AO$instid| 
293 +
294 The response declares it is a valid patron BLY with a valid password CQY and shows the user's +$name+.
295
296 . To test the SIP server's item information response, issue the following request:
297 +
298     1700120080623    172148AO$instid|AB$item_barcode|AC$password
299 +
300 If successful, the SIP server returns the item information for $item_barcode,
301 similar to the following:
302 +
303     1803020120160923    190132AB30007003601852|AJRégion de Kamouraska|CK001|AQOSUL|APOSUL|BHCAD
304     |BV0.00|BGOSUL|CSCA2 PQ NR46 73R
305 +
306 The response declares it is a valid item, with the title, owning library,
307 permanent and current locations, and call number.
308
309 indexterm:[SIP]
310
311 === SIP Communication ===
312
313 indexterm:[SIP Server, SIP Communication]
314
315 +SIP+ generally communicates over a +TCP+ connection (either raw sockets or over +telnet+), but can also 
316 communicate via serial connections and other methods. In Evergreen, the most common deployment is a +RAW+ socket 
317 connection on port 6001.
318
319 +SIP+ communication consists of strings of messages, each message request and response begin with a 2-digit 
320 ``command'' - Requests usually being an odd number and responses usually increased by 1 to be an even number. The 
321 combination numbers for the request command and response is often referred to as a _Message Pair_ (for example, 
322 a 23 command is a request for patron status, a 24 response is a patron status, and the message pair 23/24 is patron 
323 status message pair). The table in the next section shows the message pairs and a description of them. 
324
325 For clarification, the ``Request'' is from the device (selfcheck or otherwise) to the ILS/ACS. The response is… the 
326 response to the request ;). 
327
328 Within each request and response, a number of fields (either a fixed width or separated with a | [pipe symbol] and 
329 preceded with a 2-character field identifier) are used. The fields vary between message pairs. 
330
331 |===========================================================================
332 | *Pair* | *Name*              | *Supported?*          |*Details* 
333 | 01     | Block Patron        | Yes                   |<<sip_01_block_patron, 01/Block_Patron>> - ACS responds with 24 Patron Status Response 
334 | 09-10  | Checkin             | Yes (with extensions) |<<sip_09-10_checkin, 09/10_Checkin>> 
335 | 11-12  | Checkout            | Yes (no renewals)     |<<sip_11-12_checkout, 11/12_Checkout>> 
336 | 15-16  | Hold                | Partially supported   |<<sip_15-16_hold, 15/16_Hold>>  
337 | 17-18  | Item Information    | Yes (no extensions)   |<<sip_17-18_item_information, 17/18_Item_Information>> 
338 | 19-20  | Item Status Update  | No                    |<<sip_19-20_item_status_update, 19/20_Item_Status_Update>> - Returns Patron Enable response, but doesn't make any changes in EG  
339 | 23-24  | Patron Status       | Yes                   |<<sip_23-24_patron_status, 23/24_Patron_Status>> - 63/64 ``Patron Information'' preferred 
340 | 25-26  | Patron Enable       | No                    |<<sip_25-26_patron_enable, 25/26_Patron_Enable>> - Used during system testing and validation 
341 | 29-30  | Renew               | Yes                   |<<sip_29-30_renew, 29/30_Renew>> 
342 | 35-36  | End Session         | Yes                   |<<sip_35-36_end_session, 35/36_End_Session>>
343 | 37-38  | Fee Paid            | Yes                   |<<sip_37-38_fee_paid, 37/38_Fee_Paid>> 
344 | 63-64  | Patron Information  | Yes (no extensions)   |<<sip_63-64_patron_information, 63/64_Patron_Information>> 
345 | 65-66  | Renew All           | Yes                   |<<sip_65-66_renew_all, 65/66_Renew_All>> 
346 | 93-94  | Login               | Yes                   |<<sip_93-94_login, 93/94_Login>> - Must be first command to Evergreen ACS (via socket) or +SIP+ will terminate 
347 | 97-96  | Resend last message | Yes                   |<<sip_97-96_resend, 97/96_Resend>> 
348 | 99-98  | SC-ACS Status       | Yes                   |<<sip_99-98_sc_and_acs_status, 99/98_SC_and_ACS_Status>> 
349 |===========================================================================
350
351 [#sip_01_block_patron]
352
353 ==== 01 Block Patron ====
354
355 indexterm:[SelfCheck]
356
357 A selfcheck will issue a *Block Patron* command if a patron leaves their card in a selfcheck machine or if the 
358 selfcheck detects tampering (such as attempts to disable multiple items during a single item checkout, multiple failed 
359 pin entries, etc). 
360
361 In Evergreen, this command does the following:
362
363 * User alert message: _CARD BLOCKED BY SELF-CHECK MACHINE_ (this is independent of the AL _Blocked 
364 Card Message_ field). 
365
366 * Card is marked inactive. 
367
368 The request looks like: 
369
370    01<card retained><date>[fields AO, AL, AA, AC] 
371
372 _Card Retained_: A single character field of Y or N - tells the ACS whether the SC has retained the card (ex: left in 
373 the machine) or not. 
374
375 _Date_: An 18 character field for the date/time when the block occurred. 
376
377 _Format_: YYYYMMDDZZZZHHMMSS (ZZZZ being zone - 4 blanks when local time, ``Z'' (3 blanks and a Z) 
378 represents UTC(GMT/Zulu) 
379
380 _Fields_: See <<fields, Fields>> for more details.
381
382 The response is a 24 ``Patron Status Response'' with the following: 
383
384 * Charge privileges denied 
385 * Renewal privileges denied 
386 * Recall privileges denied (hard-coded in every 24 or 64 response) 
387 * hold privileges denied 
388 * Screen Message 1 (AF): _blocked_ 
389 * Patron 
390
391 [#sip_09-10_checkin]
392
393 ==== 09/10 Checkin ====
394
395 ~The request looks like: 
396
397    09<No block (Offline)><xact date><return date>[Fields AP,AO,AB,AC,CH,BI] 
398
399 _No Block (Offline)_: A single character field of _Y_ or _N_ - Offline transactions are not currently supported so send _N_. 
400
401 _xact date_: an 18 character field for the date/time when the checkin occurred. Format: 
402 YYYYMMDDZZZZHHMMSS (ZZZZ being zone - 4 blanks when local time, ``Z'' (3 blanks and a Z) represents 
403 UTC(GMT/Zulu) 
404
405 _Fields_: See <<fields, Fields>> for more details. 
406
407 The response is a 10 ``Checkin Response'' with the following: 
408
409    10<resensitize><magnetic media><alert><xact date>[Fields AO,AB,AQ,AJ,CL,AA,CK,CH,CR,CS,CT,CV,CY,DA,AF,AG] 
410
411 Example (with a remote hold): 
412
413   09N20100507    16593720100507    165937APCheckin Bin 5|AOBR1|AB1565921879|ACsip_01| 
414
415   101YNY20100623    165731AOBR1|AB1565921879|AQBR1|AJPerl 5 desktop reference|CK001|CSQA76.73.P33V76 1996 
416   |CTBR3|CY373827|DANicholas Richard Woodard|CV02|
417
418 Here you can see a hold alert for patron CY _373827_, named DA _Nicholas Richard Woodard_, to be picked up at CT 
419 ``BR3''. Since the transaction is happening at AO ``BR1'', the alert type CV is 02 for _hold at remote library_. The 
420 possible values for CV are: 
421
422 * 00: unknown 
423
424 * 01: local hold 
425
426 * 02: remote hold 
427
428 * 03: ILL transfer (not used by EG) 
429
430 * 04: transfer 
431
432 * 99: other 
433
434 indexterm:[magnetic media]
435
436 [NOTE]
437 ===============
438 The logic for Evergreen to determine whether the content is magnetic_media comes from  
439 or search_config_circ_modifier. The default is non-magnetic. The same is true for media_type (default 
440 001). Evergreen does not populate the collection_code because it does not really have any, but it will provide 
441 the call_number where available.
442
443 Unlike the +item_id+ (barcode), the +title_id+ is actually a title string, unless the configuration forces the 
444 return of the bib ID. 
445
446 Don't be confused by the different branches that can show up in the same response line. 
447
448 * AO is where the transaction took place, 
449
450 * AQ is the ``permanent location'', and 
451
452 * CT is the _destination location_ (i.e., pickup lib for a hold or target lib for a transfer). 
453 ===============
454
455 [#sip_11-12_checkout]
456
457 ==== 11/12 Checkout ====
458
459
460 [#sip_15-16_hold]
461
462 ==== 15/16 Hold ====
463
464 Evergreen supports the Hold message for the purpose of canceling
465 holds.  It does not currently support creating hold requests via SIP2.
466
467
468 [#sip_17-18_item_information]
469
470 17/18 Item Information 
471 ^^^^^^^^^^^^^^^^^^^^^^
472
473 The request looks like: 
474
475     17<xact_date>[fields: AO,AB,AC] 
476
477 The request is very terse. AC is optional. 
478
479 The following response structure is for +SIP2+. (Version 1 of the protocol had only 6 total fields.) 
480
481     18<circulation_status><security_marker><fee_type><xact_date> 
482     [fields: CF,AH,CJ,CM,AB,AJ,BG,BH,BV,CK,AQ,AP,CH,AF,AG,+CT,+CS] 
483
484 Example:
485
486    1720060110    215612AOBR1|ABno_such_barcode| 
487
488    1801010120100609    162510ABno_such_barcode|AJ| 
489
490    1720060110    215612AOBR1|AB1565921879| 
491
492    1810020120100623    171415AB1565921879|AJPerl 5 desktop reference|CK001|AQBR1|APBR1|BGBR1 
493    |CTBR3|CSQA76.73.P33V76 1996| 
494
495 The first case is with a bogus barcode. The latter shows an item with a circulation_status of _10_ for _in transit between 
496 libraries_. The known values of +circulation_status+ are enumerated in the spec. 
497
498 indexterm:[Automated Material Handling (AMH)]
499
500 EXTENSIONS: The CT field for _destination location_ and CS _call number_ are used by Automated Material Handling 
501 systems. 
502
503
504 [#sip_19-20_item_status_update]
505
506 ==== 19/20 Item Status Update ====
507
508
509 [#sip_23-24_patron_status]
510
511 23/24 Patron Status 
512 ^^^^^^^^^^^^^^^^^^^
513
514 Example: 
515
516    2300120060101    084235AOUWOLS|AAbad_barcode|ACsip_01|ADbad_password| 
517
518    24YYYY          00120100507    013934AE|AAbad_barcode|BLN|AOUWOLS|
519
520    2300120060101    084235AOCONS|AA999999|ACsip_01|ADbad_password| 
521
522    24  Y           00120100507    022318AEDoug Fiander|AA999999|BLY|CQN|BHUSD|BV0.00|AFOK|AOCONS| 
523
524    2300120060101    084235AOCONS|AA999999|ACsip_01|ADuserpassword|LY|CQN|BHUSD|BV0.00|AFOK|AOCONS| 
525
526    24  Y           00120100507    022803AEDoug Fiander|AA999999|BLY|CQY|BHUSD|BV0.00|AFOK|AOCONS| 
527
528 . The BL field (+SIP2+, optional) is _valid patron_, so the _N_ value means _bad_barcode_ doesn't match a patron, the 
529 _Y_ value means 999999 does. 
530
531 . The CQ field (+SIP2+, optional) is _valid password_, so the _N_ value means _bad_password_ doesn't match 999999's 
532 password, the _Y_ means _userpassword_ does. 
533
534 So if you were building the most basic +SIP2+ authentication client, you would check for _|CQY|_ in the response to 
535 know the user's barcode and password are correct (|CQY| implies |BLY|, since you cannot check the password 
536 unless the barcode exists). However, in practice, depending on the application, there are other factors to consider in 
537 authentication, like whether the user is blocked from checkout, owes excessive fines, reported their card lost, etc. 
538 These limitations are reflected in the 14-character _patron status_ string immediately following the _24_ code. See the 
539 field definitions in your copy of the spec. 
540
541
542 [#sip_25-26_patron_enable]
543
544 25/26 Patron Enable 
545 ^^^^^^^^^^^^^^^^^^^
546
547 Not yet supported. 
548
549
550 [#sip_29-30_renew]
551
552 ==== 29/30 Renew ====
553
554 Evergreen supports the Renew message. Evergreen checks whether a penalty is specifically configured to block
555 renewals before blocking any SIP renewal.
556
557
558 [#sip_35-36_end_session]
559
560 ==== 35/36 End Session ====
561
562    3520100505    115901AOBR1|AA999999|
563
564    36Y20100507    161213AOCONS|AA999999|AFThank you!| 
565    
566 The _Y/N_ code immediately after the 36 indicates _success/failure_. Failure is not particularly meaningful or important 
567 in this context, and for evergreen it is hardcoded _Y_. 
568
569
570
571 [#sip_37-38_fee_paid]
572
573 37/38 Fee Paid 
574 ^^^^^^^^^^^^^^
575
576 Evergreen supports the Fee Paid message.
577
578
579 [#sip_63-64_patron_information]
580
581 63/64 Patron Information 
582 ^^^^^^^^^^^^^^^^^^^^^^^^
583
584 Attempting to retrieve patron info with a bad barcode:
585
586    6300020060329    201700          AOBR1|AAbad_barcode| 
587    
588    64YYYY          00020100623    141130000000000000000000000000AE|AAbad_barcode|BLN|AOBR1| 
589
590 Attempting to retrieve patron info with a good barcode (but bad patron password): 
591
592    6300020060329    201700          AOBR1|AA999999|ADbadpwd| 
593
594    64  Y           00020100623    141130000000000000000000000000AA999999|AEDavid J. Fiander|BHUSD|BV0.00 
595    |BD2 Meadowvale Dr. St Thomas, ON Canada 
596
597    90210|BEdjfiander@somemail.com|BF(519) 555 1234|AQBR1|BLY|CQN|PB19640925|PCPatrons 
598    |PIUnfiltered|AFOK|AOBR1| 
599
600 See <<sip_23-24_patron_status, 23/24 Patron Status>> for info on +BL+ and +CQ+ fields. 
601
602
603
604 [#sip_65-66_renew_all]
605
606 ==== 65/66 Renew All ====
607
608 Evergreen supports the Renew All message.
609
610
611 [#sip_93-94_login]
612
613 93/94 Login 
614 ^^^^^^^^^^^
615
616 Example: 
617
618    9300CNsip_01|CObad_value|CPBR1| 
619   
620    [Connection closed by foreign host.] 
621    ... 
622
623    9300CNsip_01|COsip_01|CPBR1|
624
625    941 
626
627 _941_ means successful terminal login. _940_ or getting dropped means failure.
628
629 When using a version of SIPServer that supports the feature, the Location (CP) field of the Login (93) message will be used as the workstation name if supplied. Blank or missing location fields will be ignored. This allows users or reports to determine which selfcheck performed a circulation.
630
631
632 [#sip_97-96_resend]
633
634 ==== 97/96 Resend ====
635
636
637 [#sip_99-98_sc_and_acs_status]
638
639 ==== 99/98 SC and ACS Status ====
640
641    99<status code><max print width><protocol version> 
642  
643 All 3 fields are required:
644
645 * 0: SC is OK
646
647 * 1: SC is out of paper 
648
649 * 2: SC shutting down
650
651 * status code - 1 character 
652
653 * max print width - 3 characters - the integer number of characters the client can print 
654
655 * protocol version - 4 characters - x.xx 
656
657   98<on-line status><checkin ok><checkout ok><ACS renewal policy>
658   <status update ok><offline ok><timeout period> 
659
660   <retries allowed><date/time sync><protocol version><institution id> 
661   <library name><supported messages><terminal 
662
663   location><screen message><print line> 
664
665 Example: 
666
667   9910302.00 
668
669   98YYYYNN60000320100510    1717202.00AOCONS|BXYYYYYYYYYNYNNNYN|
670
671 The Supported Messages field +BX+ appears only in +SIP2+, and specifies whether 16 different +SIP+ commands are 
672 supported by the +ACS+ or not. 
673
674
675 [#fields]
676
677 ==== Fields ====
678
679 All fixed-length fields in a communication will appear before the first variable-length field. This allows for simple 
680 parsing. Variable-length fields are by definition delimited, though there will not necessarily be an initial delimiter 
681 between the last fixed-length field and the first variable-length one. It would be unnecessary, since you should know 
682 the exact position where that field begins already.
683
684
685 === Patron privacy and the SIP protocol ===
686
687 SIP traffic includes a lot of patron information, and is not
688 encrypted by default.  It is strongly recommended that you
689 encrypt any SIP traffic.
690
691 ==== SIP server configuration ====
692
693 On the SIP server, use `iptables` or `etc/hosts` to allow SSH connections on port 22 from the SIP client machine.  You will probably want to have very restrictive rules
694 on which IP addresses can connect to this server.
695
696
697 ==== SSH tunnels on SIP clients ====
698
699 SSH tunnels are a good fit for use cases like self-check machines, because it is relatively easy to automatically open the connection.  Using a VPN is another option,
700 but many VPN clients require manual steps to open the VPN connection.
701
702 . If the SIP client will be on a Windows machine, install cygwin on the SIP client.
703 . On the SIP client, use `ssh-keygen` to generate an SSH key.
704 . Add the public key to /home/my_sip_user/.ssh/authorized_keys on your SIP server to enable logins without using the UNIX password.
705 . Configure an SSH tunnel to open before every connection.  You can do this in several ways:
706 .. If the SIP client software allows you to run an arbitrary command before
707    each SIP connection, use something like this:
708 +
709 [source,bash]
710 ----
711 ssh -f -L 6001:localhost:6001 my_sip_user@my_sip_server.com sleep 10
712 ----
713 +
714 .. If you feel confident that the connection won't get interrupted, you can have something like this run at startup:
715 +
716 [source,bash]
717 ----
718 ssh -f -N -L 6001:localhost:6001 my_sip_user@my_sip_server.com
719 ----
720 +
721 .. If you want to constantly poll to make sure that the connection is still running, you can do something like this as a cron job or scheduled task on the SIP client machine:
722 [source,bash]
723 ----
724 #!/bin/bash
725 instances=`/bin/ps -ef | /bin/grep ssh | /bin/grep -v grep | /bin/wc -l`
726 if [ $instances -eq 0 ]; then
727   echo "Restarting ssh tunnel"
728   /usr/bin/ssh -L 6001:localhost:6001 my_sip_user@my_sip_server.com -f -N
729 fi
730 ----
731