Index: doc/userguide/userguide.xml
===================================================================
RCS file: /home/cvs/gateway/doc/userguide/userguide.xml,v
retrieving revision 1.354
diff -u -r1.354 userguide.xml
--- doc/userguide/userguide.xml	8 Jul 2009 14:29:38 -0000	1.354
+++ doc/userguide/userguide.xml	31 Aug 2009 10:15:59 -0000
@@ -1500,7 +1500,7 @@
      <entry valign="bottom">
         Set maximum size of outgoing message queue. After number of messages
         has hit this value, Kannel began to discard them.
-        Value -1 default, means that the queue of infinite length is accepted.
+        The default value, 1 million, works for most installations.
      </entry></row>
 
      <row><entry><literal>white-list-regex</literal></entry>
Index: gw/bb_smscconn.c
===================================================================
RCS file: /home/cvs/gateway/gw/bb_smscconn.c,v
retrieving revision 1.104
diff -u -r1.104 bb_smscconn.c
--- gw/bb_smscconn.c	28 Aug 2009 09:48:51 -0000	1.104
+++ gw/bb_smscconn.c	31 Aug 2009 10:16:02 -0000
@@ -1194,12 +1194,12 @@
      * and 80% for new msgs. So we can guarantee that old msgs find
      * place in the SMSC's queue.
      */
-    if (max_outgoing_sms_qlength > 0 && gwlist_len(outgoing_sms) > 0) {
+    if (gwlist_len(outgoing_sms) > 0) {
         max_queue = (resend ? max_outgoing_sms_qlength :
                                max_outgoing_sms_qlength * 0.8);
     }
     else
-        max_queue = (max_outgoing_sms_qlength > 0 ? max_outgoing_sms_qlength : 1000000);
+        max_queue = max_outgoing_sms_qlength;
 
     s = gw_rand() % gwlist_len(smsc_list);
     best_preferred = best_ok = NULL;
Index: gw/bearerbox.c
===================================================================
RCS file: /home/cvs/gateway/gw/bearerbox.c,v
retrieving revision 1.170
diff -u -r1.170 bearerbox.c
--- gw/bearerbox.c	8 Jul 2009 14:29:39 -0000	1.170
+++ gw/bearerbox.c	31 Aug 2009 10:16:03 -0000
@@ -495,6 +495,9 @@
                                   octstr_imm("sms-outgoing-queue-limit")) == -1)
         max_outgoing_sms_qlength = -1;
 
+    if (max_outgoing_sms_qlength < 0)
+        max_outgoing_sms_qlength = DEFAULT_OUTGOING_SMS_QLENGTH;
+
 #ifndef NO_SMS    
     {
         List *list;
Index: gw/bearerbox.h
===================================================================
RCS file: /home/cvs/gateway/gw/bearerbox.h,v
retrieving revision 1.36
diff -u -r1.36 bearerbox.h
--- gw/bearerbox.h	8 Jul 2009 14:29:39 -0000	1.36
+++ gw/bearerbox.h	31 Aug 2009 10:16:03 -0000
@@ -65,6 +65,8 @@
 #include "smscconn.h"
 #include "bb_store.h"
 
+/* Default outgoing queue length */
+#define DEFAULT_OUTGOING_SMS_QLENGTH    1000000
 
 /* general bearerbox state */
 
