Hi,

I'm experiencing a problem with Kannel, both with version 1.3.1
and reproducible elsewhere with the current CVS): In a multi-operator
setup I have some SMSC connections which are polled over a dialup link.
There is a script that connects the PPP link periodically, sends a
start-smsc command to Kannel for SMSCs behind that link, polls for
messages for some time, downs the link and sends stop-smsc to Kannel.

If our application attempts to send an SMS via Kannel to one of the
SMSCs when they are down (Kannel status records them as 'dead') then the
following gets logged (CVS version example):

2004-05-24 12:57:44 [7] WARNING: Message rejected by bearerbox, no router!
2004-05-24 12:58:40 [7] WARNING: Cannot find SMSCConn for message to <....>, rejected.

The message also (in 1.3.1, not in CVS) gets logged as DISCARDED in the
access log. However -- and this is the problem -- the application never
gets back a FAILED DLR for the message, hence cannot tell whether it
should re-send it or not.

I've spent some time looking through the code paths in an attempt to
figure out what is going on -- comparing sms_router () to
deliver_sms_to_queue () suggests that the following patch should fix the
behaviour to be consistent:

--- bb_boxc.c   16 Feb 2004 19:41:26 -0000      1.77
+++ bb_boxc.c   24 May 2004 14:05:22 -0000
@@ -223,21 +223,10 @@
            mack->ack.nack = ack_buffered;
            break;
         case -1: /* no router at all */
-           warning(0, "Message rejected by bearerbox, no router!");
-           /*
-            * first create nack for store-file, in order to delete
-            * message from store-file.
-            */
-           mack_store = msg_create(ack);
-           gw_assert(mack_store != NULL);
-           uuid_copy(mack_store->ack.id, msg->sms.id);
-           mack_store->ack.time = msg->sms.time;
-           mack->ack.nack = mack_store->ack.nack = ack_failed;
-           store_save(mack_store);
-           msg_destroy(mack_store);
-
-           /* destroy original message */
-           msg_destroy(msg);
+           mack->ack.nack = ack_failed;
+           warning(0, "No SMSCes to receive message, discarding it!");
+          bb_smscconn_send_failed(NULL, msg, SMSCCONN_FAILED_DISCARDED,
+                                  octstr_create("DISCARDED"));
            break;
     }

I've tested it here and it has the desired effect (a NACK/DISCARDED DLR
gets sent back to the application).

-mato

Reply via email to