]> git.evergreen-ils.org Git - working/Evergreen.git/blob - 1.6/admin/sip.xml
Merge github.com:rsoulliere/Evergreen-DocBook
[working/Evergreen.git] / 1.6 / admin / sip.xml
1 <?xml version="1.0" encoding="utf-8"?>\r
2 <chapter xml:id="sipserver" xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="EN"\r
3     xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink">\r
4         <info>\r
5                 <title>SIP Server</title>\r
6         </info>\r
7         <para>SIP, standing for Standard Interchange Protocol, was developed by the 3M corporation to be a common protocol for data transfer between ILS' \r
8         (referred to in SIP as an <emphasis>ACS</emphasis>, or <emphasis>Automated Circulation System</emphasis>) and a third party device. Originally, the protocol was developed for \r
9         use with 3M SelfCheck (often abbreviated SC, not to be confused with Staff Client) systems, but has since expanded to other companies and devices. It is now common to find \r
10         SIP in use in several other vendors' SelfCheck systems, as well as other non-SelfCheck devices. Some examples include:</para>\r
11         <itemizedlist>\r
12                 <listitem>Patron Authentication (computer access, subscription databases)</listitem>\r
13                 <listitem>Automated Material Handling (AMH) - The automated sorting of items, often to bins or book carts, based on shelving location or other programmable criteria</listitem>\r
14         </itemizedlist>\r
15    \r
16         <section xml:id="Installing_SIP_Server">\r
17                 <info>\r
18                 <title>Installing the SIP Server</title>\r
19                 </info>\r
20                   <para>This is a rough intro to installing the SIP server for Evergreen.</para>\r
21                 <simplesect xml:id="Gettingthecode">\r
22                             <title>Getting the code</title>\r
23                                 <para>Current SIP code lives at github:</para>\r
24                                 <screen>cd /opt</screen>\r
25                                 <screen>git clone git://github.com/atz/SIPServer.git SIPServer</screen>\r
26                                 <para>Or use the old style:</para>\r
27                                 <screen>$ cd /opt</screen>\r
28                                 <screen>$ sudo cvs -d:pserver:anonymous@openncip.cvs.sourceforge.net:/cvsroot/openncip login</screen>\r
29                                 <screen># when prompted for the CVS password, just hit Enter (sudo password may be req'd)</screen>\r
30                                 <screen>$ sudo cvs -z3 -d:pserver:anonymous@openncip.cvs.sourceforge.net:/cvsroot/openncip co -P SIPServer</screen>\r
31                                                          \r
32                 </simplesect>\r
33                 <simplesect xml:id="Configuring_Server">\r
34                         <title>Configuring the Server</title>\r
35                         <procedure>\r
36                         <step>\r
37                                 <para>Type the following commands from the command prompt:</para>\r
38                                 <screen>$ sudo su opensrf</screen>\r
39                                 <screen>$ cd /openils/conf</screen>\r
40                                 <screen>$ cp oils_sip.xml.example oils_sip.xml</screen>\r
41                         </step>\r
42                         <step>\r
43                                 <para>Edit oils_sip.xml. Change the commented out &lt;server-params&gt; section to this:</para>\r
44                                 <screen>&lt;server-params</screen>\r
45                                 <screen>min_servers='1'</screen>\r
46                                 <screen>min_spare_servers='0'</screen>\r
47                                 <screen>max_servers='25'</screen>\r
48                                 <screen>/&gt;</screen>\r
49                         </step>\r
50                         <step>\r
51                                 <para> max_servers will directly correspond to the number of allowed SIP clients. Set the number accordingly, but bear in mind that too many connections can \r
52                                 exhaust memory. On a 4G RAM/4 CPU server (that is also running evergreen), I would recommend not exceeding 100 SIP client connections, \r
53                                 give or take.</para>                            \r
54                         </step>\r
55                         </procedure>             \r
56                 </simplesect>\r
57                 <simplesect xml:id="Adding_SIP_users">\r
58                         <title>Adding SIP Users</title>\r
59                         <procedure>\r
60                                 <step>\r
61                                         <para>Type the following commands from the command prompt:</para>\r
62                                         <screen>$ sudo su opensrf</screen>\r
63                                         <screen>$ cd /openils/conf</screen>\r
64                                         <screen>$ cp oils_sip.xml.example oils_sip.xml</screen>\r
65                                 </step>\r
66                                 <step>\r
67                                         <para> in the &lt;accounts&gt; section, add SIP client login information. Make sure that all &lt;logins&gt; use the same institution attribute, and make \r
68                                         sure the institution is listed in &lt;institutions&gt;. All attributes in the &lt;login&gt; section will be used by the SIP client.</para>\r
69                                 \r
70                                 </step>\r
71                                 <step>\r
72                                         <para> In Evergreen, create a new profile group called SIP. This group should be a sub-group of Users (not Staff or Patrons). \r
73                                         Set Editing Permission as <emphasis>group_application.user.sip_client</emphasis> and give the group the following permissions:</para>\r
74                                         <literallayout>\r
75                                         COPY_CHECKIN\r
76                                         COPY_CHECKOUT\r
77                                         RENEW_CIRC      \r
78                                         VIEW_CIRCULATIONS\r
79                                         VIEW_COPY_CHECKOUT_HISTORY      \r
80                                         VIEW_PERMIT_CHECKOUT\r
81                                         VIEW_USER\r
82                                         VIEW_USER_FINES_SUMMARY\r
83                                         VIEW_USER_TRANSACTIONS\r
84                                         </literallayout>\r
85                                         <para>OR use SQL like:</para>\r
86                                         <screen>INSERT INTO permission.grp_tree (id,name,parent,description,application_perm)</screen> \r
87                                         <screen>VALUES (8, 'SIP', 1, 'SIP2 Client Systems', 'group_application.user.sip_client');</screen>\r
88                                         <screen></screen>\r
89                                         <screen>INSERT INTO permission.grp_perm_map (grp,perm,depth) </screen>\r
90                                         <screen>VALUES (8,15,0),(8,16,0),(8,17,0),(8,31,0),(8,32,0),(8,48,0),(8,54,0),(8,75,0),(8,82,0);</screen>\r
91                                         \r
92                                         <para>Verify:</para>\r
93                                         <screen>SELECT *</screen>\r
94                                         <screen>FROM permission.grp_perm_map JOIN permission.perm_list ON</screen> \r
95                                         <screen>permission.grp_perm_map.perm=permission.perm_list.id</screen> \r
96                                         <screen>WHERE grp=8;</screen>\r
97                                         \r
98                                         <para>Keep in mind that the id (8) may not necessarily be available on your system.</para>                              \r
99                                 </step>\r
100                                 <step>\r
101                                         <para>For each account created in the &lt;login&gt; section of oils_sip.xml, create a user (via the staff client user editor) that has the same username \r
102                                         and password and put that user into the SIP group.</para>\r
103                                         <note><para>The expiration date will affect the SIP users' connection, you might want to make a note of \r
104                                         this somewhere. </para></note>  \r
105                                 </step>\r
106                         </procedure>             \r
107                 </simplesect>\r
108                 <simplesect xml:id="Running_SIP_server">\r
109                         <title>Running the server</title>\r
110                                 <para>To start the SIP server type the following commands from the command prompt:</para>\r
111                                 <screen>$ sudo su opensrf</screen>\r
112                                 <screen>$ oils_ctl.sh -d /openils/var/run -s /openils/conf/oils_sip.xml -a [start|stop|restart]_sip</screen>    \r
113                 </simplesect>\r
114                 <simplesect xml:id="Logging-SIP">\r
115                         <title>Logging-SIP</title>\r
116                         <simplesect>\r
117                                 <title>Syslog</title>\r
118                                 <para>It is useful to log SIP requests to a separate file especially during initial setup by modifying your syslog config file.</para>\r
119                                 <procedure>\r
120                                         <step>\r
121                                                 <para>Edit syslog.conf.</para>\r
122                                                 <screen>$ sudo vi /etc/syslog.conf  # maybe /etc/rsyslog.conf</screen>  \r
123                                         </step>\r
124                                         <step>\r
125                                                 <para>Add this:</para>\r
126                                                 <screen>local6.*                -/var/log/SIP_evergreen.log</screen>    \r
127                                         </step>\r
128                                         <step>\r
129                                                 <para>Syslog expects the logfile to exist so create the file.</para>\r
130                                                 <screen>$ sudo touch /var/log/SIP_evergreen.log</screen>        \r
131                                         </step>\r
132                                         <step>\r
133                                                 <para>Restart sysklogd.</para>\r
134                                                 <screen>$ sudo /etc/init.d/sysklogd restart</screen>    \r
135                                         </step>\r
136                                 </procedure>            \r
137                         </simplesect>\r
138                         <simplesect>\r
139                                 <title>Syslog-NG</title>\r
140                                 \r
141                                 <procedure>\r
142                                         <step>\r
143                                                 <para>Edit logging config.</para>\r
144                                                 <screen>sudo vi /etc/syslog-ng/syslog-ng.conf</screen>  \r
145                                         </step>\r
146                                         <step>\r
147                                                 <para>Add:</para>\r
148                                                 <screen># SIP2 for Evergreen</screen>   \r
149                                                 <screen>filter    f_eg_sip { level(warn, err, crit) and facility(local6); };</screen>   \r
150                                                 <screen>destination eg_sip { file("/var/log/SIP_evergreen.log"); };</screen>    \r
151                                                 <screen>log { source(s_all); filter(f_eg_sip); destination(eg_sip); };</screen> \r
152                                         </step>\r
153                                         <step>\r
154                                                 <para>Syslog-ng expects the logfile to exist so create the file.</para>\r
155                                                 <screen>$ sudo touch /var/log/SIP_evergreen.log</screen>        \r
156                                         </step>\r
157                                         <step>\r
158                                                 <para>Restart syslog-ng</para>\r
159                                                 <screen>$ sudo /etc/init.d/syslog-ng restart\r
160                                                 </screen>       \r
161                                         </step>\r
162                                 </procedure>            \r
163                         </simplesect>\r
164                 </simplesect>   \r
165                 <simplesect xml:id="Testing_SIP_Connection">\r
166                         <title>Testing Your SIP Connection</title>\r
167                         <itemizedlist>\r
168                                 <listitem>\r
169                                         <para>In the top level CVS checkout of the SIPServer code.</para>\r
170                                         <screen>$ cd SIPServer/t</screen>\r
171                                 </listitem>\r
172                                 <listitem>\r
173                                         <para> Edit SIPtest.pm, change the $instid, $server, $username, and $password variables. This will be enough to test connectivity. \r
174                                         To run all tests, you'll need to change all the variables in the Configuration section.</para>\r
175                                         <screen>$ PERL5LIB=../ perl 00sc_status.t</screen>\r
176                                         <para>This should produce something like:</para>\r
177                                         <screen>1..4</screen>\r
178                                         <screen>ok 1 - Invalid username</screen>\r
179                                         <screen>ok 2 - Invalid username</screen>\r
180                                         <screen>ok 3 - login</screen>\r
181                                         <screen>ok 4 - SC status</screen>\r
182                                 </listitem>     \r
183                                 <listitem>\r
184                                         <para> Don't be dismayed at “Invalid Username”. That's just one of the many tests that are run.</para>\r
185                                 </listitem>                                             \r
186                         </itemizedlist>\r
187                 </simplesect>\r
188                 <simplesect xml:id="SIP-More_Testing">\r
189                         <title>More Testing</title>\r
190                         <procedure>\r
191                                 <step>\r
192                                         <para>Once you have opened up either the SIP OR SIP2 ports to be accessible from outside you can do some testing via telnet. You can try this with localhost \r
193                                         if you so wish, but we want to prove that SIP2 works from non-localhost. Replace $instid, $server, $barcode, $username, and $password variables below as \r
194                                         necessary.</para>\r
195                                         <note><para>We are using 6001 here which is associated with SIP2 as per our configuration.</para></note>\r
196                                         <screen>$ telnet $server 6001</screen>\r
197                                         <screen>Connected to $server.</screen>\r
198                                         <screen>Escape character is '^]'.</screen>\r
199                                         <screen>9300CN**$username**|CO**$password**|CP**$instid**</screen>                                      \r
200                                         <para>You should get back.</para>\r
201                                         <screen>941</screen>\r
202                                 </step>\r
203                                 <step>\r
204                                         <para>Now just copy in the following line (with variables replaced) you don't need to hit enter, just paste!</para>\r
205                                         <screen>2300120080623    172148AO**$instid**|AA**$barcode**|AC$password|AD**$password**</screen>\r
206                                         <para>You will get back the patron information for $barcode (something similar to the what's below).</para>\r
207                                         <screen>24  Y           00120100113    170738AEFirstName MiddleName LastName|AA**$barcode**|BLY|CQY|BHUSD|BV0.00|AFOK|AO**$instid**|</screen>\r
208                                         <para>The response declares it is a valid patron <emphasis>(BLY)</emphasis> with a valid password <emphasis>(CQY)</emphasis> and shows the user's <emphasis>$name</emphasis>.</para>\r
209                                 </step>\r
210                         </procedure>\r
211                 </simplesect>\r
212         </section>\r
213         <section xml:id="SIP_Communication">\r
214                 <info>\r
215                         <title>SIP Communication</title>\r
216                 </info>\r
217                 <para>SIP generally communicates over a TCP connection (either raw sockets or over telnet), but can also communicate via serial connections and other methods. In Evergreen, \r
218                 the most common deployment is a RAW socket connection on port 6001.</para>\r
219                 <para>SIP communication consists of strings of messages, each message request and response begin with a 2-digit <quote>command</quote> - Requests usually being an odd \r
220                 number and responses usually increased by 1 to be an even number. The combination numbers for the request command and response is often referred to as a \r
221                 <emphasis>Message Pair</emphasis> (for example, a 23 command is a request for patron status, a 24 response is a patron status, and the message pair 23/24 is \r
222                 patron status message pair). The table in the next section shows the message pairs and a description of them.</para>\r
223                 <para>For clarification, the <quote>Request</quote> is from the device (selfcheck or otherwise) to the ILS/ACS. The response is… the response \r
224                 to the request ;).</para>\r
225                 <para>Within each request and response, a number of fields (either a fixed width or separated with a '|' [pipe symbol] and preceeded with a 2-character field identifier) \r
226                 are used. The fields vary between message pairs.</para>\r
227                 <informaltable>\r
228                         <tgroup cols="4">\r
229                                 <thead>\r
230                                         <row>\r
231                                                 <entry>Pair</entry>\r
232                                                 <entry>Name</entry>\r
233                                                 <entry>Supported?</entry>\r
234                                                 <entry>Details</entry>\r
235                                         </row>\r
236                                 </thead>\r
237                                 <tbody>\r
238                                         <row>\r
239                                                 <entry>01</entry>\r
240                                                 <entry>Block Patron</entry>\r
241                                                 <entry>Yes</entry>\r
242                                                 <entry><link linkend='SIP_Block_Patron'>01_Block_Patron</link> - ACS responds with 24 Patron Status Response</entry>\r
243                                         </row>\r
244                                         <row>\r
245                                                 <entry>09/10</entry>\r
246                                                 <entry>Checkin</entry>\r
247                                                 <entry>Yes (with extensions)</entry>\r
248                                                 <entry><link linkend='SIP_Checkin'>09/10_Checkin</link></entry>\r
249                                         </row>\r
250                                         <row>\r
251                                                 <entry>11/12</entry>\r
252                                                 <entry>Checkout</entry>\r
253                                                 <entry>Yes (no renewals)</entry>\r
254                                                 <entry><link linkend='SIP_Checkout'>11/12_Checkout</link></entry>\r
255                                         </row>\r
256                                         <row>\r
257                                                 <entry>15/16</entry>\r
258                                                 <entry>Hold</entry>\r
259                                                 <entry>No</entry>\r
260                                                 <entry><link linkend='SIP_Hold'>15/16_Hold</link></entry>\r
261                                         </row>\r
262                                         <row>\r
263                                                 <entry>17/18</entry>\r
264                                                 <entry>Item Information</entry>\r
265                                                 <entry>Yes (no extensions)</entry>\r
266                                                 <entry><link linkend='SIP_Item_Information'>17/18_Item_Information</link></entry>\r
267                                         </row>\r
268                                         <row>\r
269                                                 <entry>19/20</entry>\r
270                                                 <entry>Item Status Update</entry>\r
271                                                 <entry>No</entry>\r
272                                                 <entry><link linkend='SIP_Item_Status_Update'>19/20_Item_Status_Update</link> - Returns Patron Enable response, but doesn't make any changes in EG</entry>\r
273                                         </row>\r
274                                         <row>\r
275                                                 <entry>23/24</entry>\r
276                                                 <entry>Patron Status</entry>\r
277                                                 <entry>Yes</entry>\r
278                                                 <entry><link linkend='SIP_Patron_Status'>23/24_Patron_Status</link> - 63/64 <quote>Patron Information</quote> preferred</entry>\r
279                                         </row>\r
280                                         <row>\r
281                                                 <entry>25/26</entry>\r
282                                                 <entry>Patron Enable</entry>\r
283                                                 <entry>No</entry>\r
284                                                 <entry><link linkend='SIP_Patron_Enable'>25/26_Patron_Enable</link> - Used during system testing and validation</entry>\r
285                                         </row>\r
286                                         <row>\r
287                                                 <entry>29/30</entry>\r
288                                                 <entry>Renew</entry>\r
289                                                 <entry>NO (maybe?)</entry>\r
290                                                 <entry><link linkend='SIP_Renew'>29/30_Renew</link></entry>\r
291                                         </row>\r
292                                         <row>\r
293                                                 <entry>35/36</entry>\r
294                                                 <entry>End Session</entry>\r
295                                                 <entry>Yes</entry>\r
296                                                 <entry><link linkend='SIP_End_Session'>35/36_End_Session</link></entry>\r
297                                         </row>\r
298                                         <row>\r
299                                                 <entry>37/38</entry>\r
300                                                 <entry>Fee Paid</entry>\r
301                                                 <entry>No</entry>\r
302                                                 <entry><link linkend='SIP_Fee_Paid'>37/38_Fee_Paid</link></entry>\r
303                                         </row>\r
304                                         <row>\r
305                                                 <entry>63/64</entry>\r
306                                                 <entry>Patron Information</entry>\r
307                                                 <entry>Yes (no extensions)</entry>\r
308                                                 <entry><link linkend='SIP_Patron_Information'>63/64_Patron_Information</link></entry>\r
309                                         </row>\r
310                                         <row>\r
311                                                 <entry>65/66</entry>\r
312                                                 <entry>Renew All</entry>\r
313                                                 <entry>No</entry>\r
314                                                 <entry><link linkend='SIP_Renew_All'>65/66_Renew_All</link></entry>\r
315                                         </row>\r
316                                         <row>\r
317                                                 <entry>93/94</entry>\r
318                                                 <entry>Login</entry>\r
319                                                 <entry>Yes</entry>\r
320                                                 <entry><link linkend='SIP_Login'>93/94_Login</link> - Must be first command to Evergreen ACS (via socket) or SIP will terminate</entry>\r
321                                         </row>\r
322                                         <row>\r
323                                                 <entry>97/96</entry>\r
324                                                 <entry>Resend last message</entry>\r
325                                                 <entry>Yes</entry>\r
326                                                 <entry><link linkend='SIP_Resend'>97/96_Resend</link></entry>\r
327                                         </row>\r
328                                         <row>\r
329                                                 <entry>99/98</entry>\r
330                                                 <entry>SC/ACS Status</entry>\r
331                                                 <entry>Yes</entry>\r
332                                                 <entry><link linkend='SIP_SC_ACS_Status'>99/98_SC_and_ACS_Status</link></entry>\r
333                                         </row>\r
334                                 </tbody>\r
335                         </tgroup>\r
336                 </informaltable>\r
337                 <simplesect xml:id="SIP_block_patron">\r
338                         <title>01 Block Patron</title>\r
339                         <para>A selfcheck will issue a Block Patron command if a patron leaves their card in a selfcheck machine or if the selfcheck detects tampering (such as attempts \r
340                         to disable multiple items during a single item checkout, multiple failed pin entries, etc).</para>\r
341                         <para>In Evergreen, this command does the following:</para>\r
342                                 <itemizedlist>\r
343                                         <listitem>User alert message: 'CARD BLOCKED BY SELF-CHECK MACHINE' (this is independent of the AL 'Blocked Card Message' field).</listitem>\r
344                                         <listitem>Card is marked inactive.</listitem>\r
345                                 </itemizedlist>\r
346                         <para>The request looks like:</para>\r
347                         <screen>01&lt;card retained&gt;&lt;date&gt;[fields AO, AL, AA, AC]</screen>\r
348                         <para><emphasis>Card Retained</emphasis>: A single character field of 'Y' or 'N' - tells the ACS whether the SC has retained the card (ex: left in the machine) or not.</para> \r
349                         <para><emphasis>Date</emphasis>: An 18 character field for the date/time when the block occurred.</para> \r
350                         <para><emphasis>Format</emphasis>: YYYYMMDDZZZZHHMMSS (ZZZZ being zone - 4 blanks when 'local time', ' Z' (3 blanks and a Z) represents UTC(GMT/Zulu)</para>\r
351                         <para><emphasis>Fields</emphasis>: See <link linkend='SIP_Fields'>Fields</link> for more details.</para>\r
352                         <para>The response is a 24 “Patron Status Response” with the following:</para>\r
353                         <itemizedlist>\r
354                                         <listitem>Charge privileges denied</listitem>\r
355                                         <listitem>Renewal privileges denied</listitem>\r
356                                         <listitem>Recall privileges denied (hard-coded in every 24 or 64 response)</listitem>\r
357                                         <listitem>hold privileges denied</listitem>\r
358                                         <listitem>Screen Message 1 (AF): 'blocked'</listitem>\r
359                                         <listitem>Patron</listitem>\r
360 \r
361                         </itemizedlist>\r
362                 </simplesect>\r
363                 <simplesect xml:id="SIP_Checkin">\r
364                         <title>09/10 Checkin</title>\r
365                         <para>The request looks like:</para>\r
366                         <screen>09&lt;No block (Offline)&gt;&lt;xact date&gt;&lt;return date&gt;[Fields AP,AO,AB,AC,CH,BI]</screen>\r
367                         <para><emphasis>No Block (Offline)</emphasis>: A single character field of 'Y' or 'N' - Offline transactions are not currently supported so send 'N'.</para> \r
368                         <para><emphasis>xact date</emphasis>: an 18 character field for the date/time when the checkin occurred. Format: YYYYMMDDZZZZHHMMSS (ZZZZ being zone - \r
369                         4 blanks when 'local time', ' Z' (3 blanks and a Z) represents UTC(GMT/Zulu)</para> \r
370                         <para><emphasis>Fields</emphasis>: See <link linkend='SIP_Fields'>Fields</link> for more details.</para>\r
371                         <para>The response is a 10 <quote>Checkin Response</quote> with the following:</para>\r
372                         <screen>10&lt;resensitize>&lt;magnetic media&gt;&lt;alert&gt;&lt;xact date&gt;[Fields AO,AB,AQ,AJ,CL,AA,CK,CH,CR,CS,CT,CV,CY,DA,AF,AG]</screen>\r
373                         <para>Example (with a remote hold):</para>\r
374                         <screen>09N20100507    16593720100507    165937APCheckin Bin 5|AOBR1|AB1565921879|ACsip_01|</screen>\r
375                         <screen>101YNY20100623    165731AOBR1|AB1565921879|AQBR1|AJPerl 5 desktop reference|CK001|CSQA76.73.P33V76 1996|CTBR3|CY373827|DANicholas Richard Woodard|CV02|</screen>\r
376                         <para>Here you can see a hold alert for patron (CY) 373827, named (DA) Nicholas Richard Woodard, to be picked up at (CT) BR3. Since the transaction is happening \r
377                         at (AO) BR1, the alert type (CV) is 02 for “hold at remote library”. The possible values for CV are:</para>\r
378                         <itemizedlist>\r
379                                         <listitem>00: unknown</listitem>\r
380                                         <listitem>01: local hold</listitem>\r
381                                         <listitem>02: remote hold</listitem>\r
382                                         <listitem>03: ILL transfer (not used by EG)</listitem>\r
383                                         <listitem>04: transfer</listitem>\r
384                                         <listitem>99: other</listitem>\r
385                         </itemizedlist>\r
386                         <note>\r
387                                 <para>the logic for EG to determine the content is magnetic_media comes from either legacy circ scripts or search_config_circ_modifier. The default is non-magnetic. \r
388                                 The same is true for media_type (default 001). EG does not populate the collection_code because it does not really have any, but it will provide the call_number where \r
389                                 available.</para>\r
390                                 <para>Unlike the item_id (barcode), the title_id is actually a title string, unless the configuration forces the return of the bib ID.</para>\r
391                                 <para>Don't be confused by the different branches that can show up in the same response line.</para>\r
392                                 <itemizedlist>\r
393                                         <listitem>AO is where the transaction took place,</listitem>\r
394                                         <listitem>AQ is the <quote>permanent location</quote>, and</listitem>\r
395                                         <listitem>CT is the <quote>destination location</quote> (i.e., pickup lib for a hold or target lib for a transfer).</listitem>\r
396                                 </itemizedlist>\r
397                         </note>\r
398                 </simplesect>\r
399                 <simplesect xml:id="SIP_Checkout">\r
400                         <title>11/12 Checkout</title>\r
401                 </simplesect>\r
402                 <simplesect xml:id="SIP_Hold">\r
403                         <title>15/16 Hold</title>\r
404                         <para>Not yet supported.</para>\r
405                 </simplesect>\r
406                 <simplesect xml:id="SIP_Item_Information">\r
407                         <title>17/18 Item Information</title>\r
408                         <para>The request looks like:</para>\r
409                         <screen>17&lt;xact_date&gt;[fields: AO,AB,AC]</screen>\r
410                         <para>The request is very terse. AC is optional.</para>\r
411                         <para>The following response structure is for SIP2. (Version 1 of the protocol had only 6 total fields.)</para>\r
412                         <screen>18&lt;circulation_status&gt;&lt;security_marker&gt;&lt;fee_type&gt;&lt;xact_date&gt;[fields: CF,AH,CJ,CM,AB,AJ,BG,BH,BV,CK,AQ,AP,CH,AF,AG,+CT,+CS]</screen>\r
413                         <para>Example:</para>\r
414                         <screen>1720060110    215612AOBR1|ABno_such_barcode|</screen>\r
415                         <screen>1801010120100609    162510ABno_such_barcode|AJ|</screen>\r
416                         <screen>1720060110    215612AOBR1|AB1565921879|</screen>\r
417                         <screen>1810020120100623    171415AB1565921879|AJPerl 5 desktop reference|CK001|AQBR1|APBR1|BGBR1|CTBR3|CSQA76.73.P33V76 1996|</screen>\r
418                         <para>The first case is with a bogus barcode. The latter shows an item with a circulation_status of <emphasis>10</emphasis> for <emphasis>in transit between libraries</emphasis>. \r
419                         The known values of circulation_status are enumerated in the spec.</para>\r
420                         <para>EXTENSIONS: The <emphasis>CT</emphasis> field for <emphasis>destination location</emphasis> and CS <emphasis>call number</emphasis> are used by Automated Material \r
421                         Handling systems.</para>\r
422                 </simplesect>\r
423                 <simplesect xml:id="SIP_Item_Status_Update">\r
424                         <title>19/20 Item Status Update</title>\r
425                 </simplesect>\r
426                 <simplesect xml:id="SIP_Patron_Status">\r
427                         <title>23/24 Patron Status</title>\r
428                         <para>Example:</para>\r
429                         <screen>2300120060101    084235AOUWOLS|AAbad_barcode|ACsip_01|ADbad_password|</screen>\r
430                         <screen>24YYYY          00120100507    013934AE|AAbad_barcode|BLN|AOUWOLS|</screen>\r
431                         <screen>2300120060101    084235AOCONS|AA999999|ACsip_01|ADbad_password|</screen>\r
432                         <screen>24  Y           00120100507    022318AEDoug Fiander|AA999999|BLY|CQN|BHUSD|BV0.00|AFOK|AOCONS|</screen>\r
433                         <screen>2300120060101    084235AOCONS|AA999999|ACsip_01|ADuserpassword|LY|CQN|BHUSD|BV0.00|AFOK|AOCONS|</screen>\r
434                         <screen>24  Y           00120100507    022803AEDoug Fiander|AA999999|BLY|CQY|BHUSD|BV0.00|AFOK|AOCONS|</screen>\r
435                         <orderedlist>\r
436                                 <listitem>The <emphasis>BL</emphasis> field (SIP2, optional) is <emphasis>valid patron</emphasis>, so the <emphasis>N</emphasis> value means \r
437                                 <emphasis>bad_barcode</emphasis> doesn't match a patron, the <emphasis>Y</emphasis> value means 999999 does.</listitem>\r
438                                 <listitem>The <emphasis>CQ</emphasis> field (SIP2, optional) is <emphasis>valid password</emphasis>, so the <emphasis>N</emphasis> \r
439                                 value means <emphasis>bad_password</emphasis> doesn't match 999999's password, the <emphasis>Y</emphasis> means <emphasis>userpassword</emphasis> \r
440                                 does.</listitem>\r
441                         </orderedlist>\r
442                         <para>So if you were building the most basic SIP2 authentication client, you would check for <emphasis>|CQY|</emphasis> in the response to know the user's barcode and password \r
443                         are correct (<emphasis>|CQY|</emphasis> implies <emphasis>|BLY|</emphasis>, since you cannot check the password unless the barcode exists). However, in practice, \r
444                         depending on the application, there are other factors to consider in authentication, like whether the user is blocked from checkout, owes excessive fines, reported their \r
445                         card lost, etc. These limitations are reflected in the 14-character <emphasis>patron status</emphasis> string immediately following the <emphasis>24</emphasis> code. \r
446                         See the field definitions in your copy of the spec.</para>\r
447                 </simplesect>\r
448                 <simplesect xml:id="SIP_Patron_Enable">\r
449                         <title>25/26 Patron Enable</title>\r
450                         <para>Not yet supported.</para>\r
451                 </simplesect>\r
452                 <simplesect xml:id="sip_Renew">\r
453                         <title>29/30 Renew</title>\r
454                         <para>EG ACS status message indicates Renew is supported.</para>\r
455                 </simplesect>\r
456                 <simplesect xml:id="SIP_End_Session">\r
457                         <title>35/36 End Session</title>\r
458                         <screen>3520100505    115901AOBR1|AA999999|</screen>\r
459                         <screen>36Y20100507    161213AOCONS|AA999999|AFThank you!|</screen>\r
460                         <para>The Y/N code immediately after the 36 indicates success/failure. Failure is not particularly meaningful or important in this context, and for evergreen it \r
461                         is hardcoded Y.</para>  \r
462                 </simplesect>\r
463                 <simplesect xml:id="SIP_Fee_Paid">\r
464                         <title>37/38 Fee Paid</title>\r
465                         <para>Not implemented.</para>\r
466                 </simplesect>\r
467                 <simplesect xml:id="SIP_Patron_Information">\r
468                         <title>63/64 Patron Information</title>\r
469                         <para>Attempting to retrieve patron info with a bad barcode:</para>\r
470                         <screen>6300020060329    201700          AOBR1|AAbad_barcode|</screen>\r
471                         <screen>64YYYY          00020100623    141130000000000000000000000000AE|AAbad_barcode|BLN|AOBR1|</screen>\r
472                         <para>Attempting to retrieve patron info with a good barcode (but bad patron password):</para>\r
473                         <screen>6300020060329    201700          AOBR1|AA999999|ADbadpwd|</screen>\r
474                         <screen>64  Y           00020100623    141130000000000000000000000000AA999999|AEDavid J. Fiander|BHUSD|BV0.00|BD2 Meadowvale Dr. St Thomas, ON Canada</screen>\r
475                         <screen>90210|BEdjfiander@somemail.com|BF(519) 555 1234|AQBR1|BLY|CQN|PB19640925|PCPatrons|PIUnfiltered|AFOK|AOBR1|</screen>\r
476                         <para>See <link linkend='SIP_Patron_Status'>23/24 Patron Status</link> for info on <emphasis>BL</emphasis> and <emphasis>CQ</emphasis> fields.</para>\r
477                 </simplesect>\r
478                 <simplesect xml:id="SIP_Renew_All">\r
479                         <title>65/66 Renew All</title>\r
480                         <para>Not yet supported.</para>\r
481                 </simplesect>\r
482                 <simplesect xml:id="SIP_Login">\r
483                         <title>93/94 Login</title>\r
484                         <para>Example:</para>\r
485                         <screen>9300CNsip_01|CObad_value|CPBR1|</screen>\r
486                         <screen>[Connection closed by foreign host.]</screen>\r
487                         <screen>...</screen>\r
488                         <screen>9300CNsip_01|COsip_01|CPBR1|</screen>\r
489                         <screen>941</screen>\r
490                         <para>941 means successful terminal login. 940 or getting dropped means failure.</para>\r
491                 </simplesect>\r
492                 <simplesect xml:id="SIP_Resend">\r
493                         <title>97/96 Resend</title>\r
494                 </simplesect>\r
495                 <simplesect xml:id="SIP_SC_ACS_Status">\r
496                         <title>99/98 SC and ACS Status</title>\r
497                         <screen>99&lt;status code&gt;&lt;max print width&gt;&lt;protocol version&gt;</screen>\r
498                         <para>All 3 fields are required:</para>\r
499                         <itemizedlist>\r
500                                         <listitem>status code - 1 character:</listitem>\r
501                                         <itemizedlist>\r
502                                                 <listitem>0: SC is OK</listitem>\r
503                                                 <listitem>SC is out of paper</listitem>\r
504                                                 <listitem>SC shutting down</listitem>           \r
505                                         </itemizedlist>\r
506                                         <listitem>max print width - 3 characters - the integer number of characters the client can print</listitem>\r
507                                         <listitem>protocol version - 4 characters - x.xx</listitem>\r
508                         </itemizedlist>\r
509                         <screen>98&lt;on-line status&gt;&lt;checkin ok&gt;&lt;checkout ok&gt;&lt;ACS renewal policy&gt;&lt;status update ok&gt;&lt;offline ok&gt;&lt;timeout period&gt;</screen>\r
510                         <screen>&lt;retries allowed&gt;&lt;date/time sync&gt;&lt;protocol version&gt;&lt;institution id&gt;&lt;library name&gt;&lt;supported messages&gt;&lt;terminal</screen> \r
511                         <screen>location&gt;&lt;screen message&gt;&lt;print line&gt;</screen>\r
512                         <para>Example:</para>\r
513                         <screen>9910302.00</screen>\r
514                         <screen>98YYYYNN60000320100510    1717202.00AOCONS|BXYYYYYYYYYNYNNNYN|</screen>\r
515                         <para>The Supported Messages field <emphasis>(BX)</emphasis> appears only in SIP2, and specifies whether 16 different SIP commands are supported by the ACS or not.</para>\r
516                 </simplesect>\r
517                 <simplesect xml:id="SIP_Fields">\r
518                         <title>Fields</title>\r
519                         <para>All fixed-length fields in a communication will appear before the first variable-length field. This allows for simple parsing. Variable-length fields are by \r
520                         definition delimited, though there will not necessarily be an initial delimiter between the last fixed-length field and the first variable-length one. It would be \r
521                         unnecessary, since you should know the exact position where that field begins already.</para>\r
522                 </simplesect>\r
523         </section>\r
524 </chapter>\r
525 \r