Thanks Alejandro. Yes we certainly handle this at the application level, but like I said it is extremely important to us that it is somehow handled at the kannel level as well - once kannel gets a SMS message into its queue, I can't see an (explicit) way to tell kannel to not send the message outside of a certain time window. Unfortunately the SMSC does get overloaded from time to time and the SMSC is completely outside my team's control. I have to take all measures possible to make sure customers don't get SMS messages at night. :-)
When you say "shutdown the smsc connections", what do you mean? Do you mean, shutting down kannel completely e.g. at 5pm and bringing it back up at 9am? (I did think of that, but was hoping there was a cleaner solution. I'm just not sure how reliable this will be.) Here are two separate section in the user guide about the kannel shutdown command: does this mean that if I want to force kannel to shut down immediately without sending any more of its queued messages, that I would have to issue the shutdown command twice? >From the kannel user guide: "Shutdown. When the gateway is brought down, it does not accept any new messages from SMS centers and UDP ports, but processes all systems already in the system. As soon as any queues are emptied, the system exits" -and- "Bring down the gateway, by setting state to 'shutdown'. After a shutdown is initiated, there is no other chance to resume normal operation. However, 'status' command still works. Password required. If shutdown is sent for a second time, the gateway is forced down, even if it has still messages in queue." -- Alejandro Guerrieri wrote: You should handle that kind of requirements at your application level. Another option would be to shutdown the smsc connections (the messages will be queued until the link goes up) but IMHO the best approach is to handle this at your application and not at the gateway. Regards, Alejandro On Mon, Sep 22, 2008 at 10:59 PM, shaded 4 <[EMAIL PROTECTED]> wrote: > Hi there, > > a) > Is there *any* way at all to prevent kannel from > sending SMS messages to a SMSC outside of certain hours? > We're only allowed to send SMS messages to customers > during (for example) Mon-Fri 9am-5pm. > > I don't think the 'deferred' or 'validity' options of sendsms > are useful in this situation. > > I would have thought that this would be a common > requirement, but I have searched through all the archives > to of this Users mailing list at > http://www.kannel.org/pipermail/users/ > and couldn't find anything. > I think I have a fairly good knowledge of kannel by now, > and have read through the entire user guide > http://www.kannel.org/download/1.4.1/userguide-1.4.1/userguide.html . > > We definitely do have a lot of code in our application > that will schedule SMS messages and will not send any messages > to kannel outside the above time window. This works fine, > but of course once the message gets to kannel, I can't see > a way of telling kannel to *not* send the message at > certain times. > > The reason it's important is that on some occassions the > SMSC gets quite loaded, so of course kannel queues up > the messages and starts falling behind. There's nothing > stopping kannel to then send a queued message at 7pm for example. > > I see that I can put kannel into a "Suspended" state. From the user guide: > Suspended. The gateway does not accept any new messages from SMS > centers nor from UDP ports. Neither does it accept new sms and wapbox > connections nor sends any messages already in the system onward. > > Sounds good in theory - maybe I could set up a cron job > put kannel into a Suspended state at 5pm, and put it back into > the normal Running state at 9am? > > But when kannel is placed into a Suspended state, I'm not > sure if it's guaranteed what happens to > i) Existing queued messages in kannel that haven't yet been sent out. > ii) New messages that come into kannel. > > We do have the 'store-file' configuration setting active, which says: > A file in which any received SMS messages are stored until they are > successfully handled. By using this variable, no SMS messages are lost > in Kannel, but theoretically some messages can duplicate when > system is taken down violently. > But I don't know if it's also guaranteed to not lose messages > when placing kannel into a Suspended state. > > For ii) above (i.e. a new message comes into kannel while it's in a > Suspended state), I observe that: > - Sending the message to kannel with the usual 'sendsms' does cause > kannel to accept the message. > - But this message will not appear in the store-file file while kannel > is Suspended. I can't even see it appear in the normal bearerbox > access log. > It only appears in these places when kannel is put back into the > normal Running state. > The implication of this is that if kannel happens to go down or > get restarted while in a Suspended state, any new messages at least > (ii) would get lost? Not sure what would happen to i) . > > For a test, I did try to bring down/restart kannel while in a > Suspended state, and it was just chaos - I had lots and lots of > trouble trying to bring kannel back up. It just hung a lot and > did everything it could to refuse to come back up, all without > logging anything at all to its usual log files so I couldn't > see what it was doing. > > > b) Currently our kannel server handles > - 1) adhoc SMS messages which can be sent out at any time, > and > - 2) SMS messages for which I want to restrict the sending times, as > described above. > > If you do have a solution to implement this restriction for 2) > I assume I will have to separate out 1) and 2) so that each > is sent to a separate server. (E.g. if I Suspend the > kannel server for 2. then 1. won't work). But if there > is a way to do the configuration to make both 1) and 2) > still exist on the same server, then please let me know.
