symfonykannel

Kannel: get sms status from database


I'm making a symfony application that stores a huge amount of SMS in the database and Kannel detectes these Sms and sends , I'm using the sqlbox for sure, the problem that Kannel notifies our symfony app about an sms throug the dlr-url which is causing alot of memory usage of apache, cause for every Sms we got about 3 http request from the dlr to update the sms so for 100k sms we get 300k request and in each request we update the database...

So what I'm thinking of is that why not Kannel update the sms status in the database directly without calling the dlr url... is it possible ?


Solution

  • From my understanding, your tests are based on the following configuration:

    How to keep DLR without using additional http calls

    There is already a tool to get automatically DLR into a database: that is the interest of dlr-storage

    In Kannel documentation, you will see that this field has several possibilities:

    Supported types are: internal, spool, mysql, pgsql, sdb, mssql, sqlite3, oracle and redis. By default this is set to internal.

    From my experience, when using a database dlr-storage, the delivery reports (DLR) are only kept in datatable while the delivered status has not been received, then they are automatically deleted.

    So if you wish to keep some logs about the sent items, you need to edit some files (gw/dlr_mysql.c and gw/dlr.c) to avoid this delete.

    Configuration of the dlr-strorage

    Here I will provide an example with MySql.

    Sample of additional configuration in kannel.conf file:

    # this line must be in the "core" group
    dlr-storage = mysql
    
    #---------------------------------------------
    # DLR STORAGE
    #
    # 
    group = mysql-connection
    id = mydlr
    host = localhost
    username = *yourMySqlUserName*
    password = *yourMySqlPass*
    database = *yourMySqlDatabaseWithTheDlrTable*
    max-connections = 1
    
    # Group defining where are the data in the db (table, columns)
    group = dlr-db
    id = mydlr
    table = dlr
    field-smsc = smsc
    field-timestamp = ts
    field-destination = destination
    field-source = source
    field-service = service
    field-url = url
    field-mask = mask
    field-status = status
    field-boxc-id = boxc