Index: doc/examples/kannel.conf
===================================================================
RCS file: /home/cvs/gateway/doc/examples/kannel.conf,v
retrieving revision 1.1
diff -u -r1.1 kannel.conf
--- doc/examples/kannel.conf	5 Aug 2002 21:39:28 -0000	1.1
+++ doc/examples/kannel.conf	26 Jan 2003 16:35:19 -0000
@@ -135,6 +135,15 @@
 #password = 
 
 
+# SMSC OISD
+#group = smsc
+#smsc = oisd
+#host =
+#port =
+#keepalive =
+#sender-prefix =
+
+
 # SMSBOX SETUP
 
 group = smsbox
Index: doc/userguide/userguide.xml
===================================================================
RCS file: /home/cvs/gateway/doc/userguide/userguide.xml,v
retrieving revision 1.200
diff -u -r1.200 userguide.xml
--- doc/userguide/userguide.xml	15 Jan 2003 08:52:41 -0000	1.200
+++ doc/userguide/userguide.xml	26 Jan 2003 16:35:20 -0000
@@ -2677,6 +2677,71 @@
 
 
 <sect3>
+<title>Sema Group SMS Center G8.1 (OIS 5.8)</title>
+
+<para>This implementation uses direct TCP/IP access interface.</para>
+
+<programlisting>
+group = smsc
+smsc = oisd
+host = 100.101.102.103
+port = 600
+keepalive = 25
+sender-prefix = "12345"
+</programlisting>
+
+ <informaltable frame="none">
+  <tgroup cols="3"><thead><row>
+     <entry>Variable</entry>
+     <entry>Value</entry>
+     <entry>Description</entry>
+   </row></thead><tbody>
+
+   <row><entry><literal>host (m)</literal></entry>
+     <entry><literal>hostname</literal></entry>
+     <entry valign="bottom">
+        Machine that runs the SMSC. As IP (100.100.100.100) 
+        or hostname (their.machine.here)
+     </entry></row>
+
+   <row><entry><literal>port (m)</literal></entry>
+     <entry><literal>port-number</literal></entry>
+     <entry valign="bottom">
+       Port number in the smsc host machine
+     </entry></row>
+
+   <row><entry><literal>keepalive</literal></entry>
+     <entry><literal>number</literal></entry>
+     <entry valign="bottom">
+       SMSC connection will not be left idle for longer than this many
+       seconds.  The right value to use depends on how eager the SMSC
+       is to close idle connections. 25 seconds is a good guess.  If you
+       see many unexplained reconnects, try lowering this value.
+       Set it to 0 to disable this feature.
+     </entry></row>
+
+   <row><entry><literal>sender-prefix</literal></entry>
+      <entry><literal>string</literal></entry>
+      <entry valign="bottom">
+        The number that the SMSC will add in front of the sender number
+        of all messages sent from Kannel.  If Kannel is asked to send
+        a message, it will remove this prefix from the sender number
+        so that the SMSC will add it again.  If the prefix was not present,
+        Kannel will log a warning and will not send the sender number.
+        If <literal>sender-prefix</literal> is not set, or is set
+        to <literal>"never"</literal>, then Kannel will not send the
+        sender number to the SMSC at all.
+        If you want Kannel to pass all sender numbers to the SMSC
+        unchanged, then just set <literal>sender-prefix</literal> to the
+        empty string <literal>""</literal>.
+      </entry></row>
+
+   </tbody></tgroup></informaltable>
+   
+</sect3>
+
+
+<sect3>
 <title>SM/ASI (for CriticalPath InVoke SMS Center 4.x)</title>
 
    <para>This implements Short Message/Advanced Service Interface 
Index: gw/smsc/smsc.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc.c,v
retrieving revision 1.1
diff -u -r1.1 smsc.c
--- gw/smsc/smsc.c	8 Aug 2002 17:44:38 -0000	1.1
+++ gw/smsc/smsc.c	26 Jan 2003 16:35:20 -0000
@@ -130,6 +130,15 @@
     smsc->at_validityperiod = NULL;
     smsc->at_alt_dcs = 0;
 
+    /* SEMA SMSC G8.1 OIS 5.8 (TCP/IP Direct Access) */
+    smsc->oisd_hostname = NULL;
+    smsc->oisd_port = -1;
+    smsc->oisd_send_seq = 0;
+    smsc->oisd_inbuffer = NULL;
+    smsc->oisd_received = NULL;
+    smsc->oisd_error = 0;
+    smsc->oisd_next_ping = 0;
+
     /* add new SMSCes here */
 
     /* Memory */
@@ -189,6 +198,12 @@
     list_destroy(smsc->at_received, NULL);
     gw_free(smsc->at_inbuffer);
 
+    /* SEMA SMSC G8.1 OIS 5.8 (Direct Access) */
+    octstr_destroy(smsc->oisd_hostname);
+    octstr_destroy(smsc->oisd_inbuffer);
+    octstr_destroy(smsc->sender_prefix);
+    list_destroy(smsc->oisd_received, NULL);
+
     /* add new SMSCes here */
 
     /* Other fields */
@@ -239,6 +254,11 @@
             goto error;
         break;
 
+    case SMSC_TYPE_OISD:
+        if (oisd_submit_msg(smsc, msg) == -1)
+            goto error;
+        break;
+
         /* add new SMSCes here */
 
     default:
@@ -301,6 +321,12 @@
             goto error;
         break;
 
+    case SMSC_TYPE_OISD:
+        ret = oisd_receive_msg(smsc, msg);
+        if (ret == -1)
+            goto error;
+        break;
+
     default:
         goto error;
 
@@ -364,6 +390,12 @@
             goto error;
         break;
 
+    case SMSC_TYPE_OISD:
+        ret = oisd_pending_smsmessage(smsc);
+        if (ret == -1)
+            goto error;
+        break;
+
     default:
         goto error;
     }
@@ -512,6 +544,8 @@
     	typeno = SMSC_TYPE_OIS;
     else if (octstr_compare(type, octstr_imm("at")) == 0)
     	typeno = SMSC_TYPE_AT;
+    else if (octstr_compare(type, octstr_imm("oisd")) == 0)
+    	typeno = SMSC_TYPE_OISD;
     else {
 	error(0, "Unknown SMSC type '%s'", octstr_get_cstr(type));
 	octstr_destroy(type);
@@ -644,6 +678,16 @@
 			       alt_dcs);
         break;
 
+    case SMSC_TYPE_OISD:
+        if (host == NULL || port == 0)
+            error(0, "Required field missing for OISD center.");
+        else
+            smsc = oisd_open(host,
+	    	    	      port, 
+			      keepalive,
+                              sender_prefix);
+        break;
+
         /* add new SMSCes here */
 
     default: 		/* Unknown SMSC type */
@@ -723,6 +767,9 @@
     case SMSC_TYPE_AT:
         ret = at_reopen(smsc);
 	break;
+    case SMSC_TYPE_OISD:
+        ret = oisd_reopen(smsc);
+	break;
         /* add new SMSCes here */
     default: 		/* Unknown SMSC type */
         ret = -2; 		/* no use */
@@ -781,6 +828,11 @@
 
     case SMSC_TYPE_AT:
         if (at_close(smsc) == -1)
+            errors = 1;
+        break;
+
+    case SMSC_TYPE_OISD:
+        if (oisd_close(smsc) == -1)
             errors = 1;
         break;
 
Index: gw/smsc/smsc_p.h
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_p.h,v
retrieving revision 1.1
diff -u -r1.1 smsc_p.h
--- gw/smsc/smsc_p.h	11 Aug 2002 14:21:16 -0000	1.1
+++ gw/smsc/smsc_p.h	26 Jan 2003 16:35:20 -0000
@@ -29,7 +29,8 @@
 	SMSC_TYPE_EMI_IP,
 	SMSC_TYPE_SEMA_X28,
 	SMSC_TYPE_OIS,
-	SMSC_TYPE_AT
+	SMSC_TYPE_AT,
+	SMSC_TYPE_OISD
 };
 
 /*
@@ -140,7 +141,7 @@
         char *ois_buffer;
         size_t ois_bufsize;
         size_t ois_buflen;
-    
+
 	/* AT Commands (wireless modems...) */
 	char *at_serialdevice;
 	int at_fd;
@@ -151,6 +152,16 @@
 	char *at_validityperiod;
 	int at_alt_dcs;
 	
+	/* SEMA SMSC G8.1 OIS 5.8 (TCP/IP Direct Access) */
+	Octstr *oisd_hostname;
+	int oisd_port;
+	unsigned long oisd_send_seq;
+	unsigned long oisd_receive_seq;
+	Octstr *oisd_inbuffer;
+	List *oisd_received;
+	int oisd_error;
+	time_t oisd_next_ping;
+
 	/* For buffering input. */
 	char *buffer;
 	size_t bufsize;
@@ -257,5 +268,15 @@
 int at_submit_msg(SMSCenter *smsc, Msg *msg);
 int at_receive_msg(SMSCenter *smsc, Msg **msg);
 
+
+/*
+ * Interface to Sema SMS centers using OIS 5.8 (Direct Access)
+ */
+SMSCenter *oisd_open(Octstr *hostname, int port, int keepalive, Octstr *sender_prefix);
+int oisd_reopen(SMSCenter *smsc);
+int oisd_close(SMSCenter *smsc);
+int oisd_pending_smsmessage(SMSCenter *smsc);
+int oisd_submit_msg(SMSCenter *smsc, Msg *msg);
+int oisd_receive_msg(SMSCenter *smsc, Msg **msg);
 
 #endif
