smsc_emi patch - system message field

Ősz Ferenc <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization Aitia Inc.
Message-ID <[email protected]>
Hi,

A simple patch for gw/smsc/smsc_emi.c creates a system message field for
UCP52 ack message.
(The system message field has the recipient's address + a timestamp.)
Eg. T-Mobile in Hungary requires this for SMSC connections..

----------------------------------------------------------------------------

--- smsc_emi.c  2009-01-12 17:46:50.000000000 +0100
+++ smsc_emi_modified.c 2009-04-15 14:41:03.000000000 +0200
@@ -585,7 +585,8 @@
     struct universaltime unitime;
     int st_code;
     PrivData *privdata = conn->data;
-
+    struct tm tm;
+    char p[20];

     switch(emimsg->ot) {

@@ -832,7 +833,31 @@

        msg->sms.smsc_id = octstr_duplicate(conn->id);
        bb_smscconn_receive(conn, msg);
+
+
        reply = emimsg_create_reply(52, emimsg->trn, 1, privdata->name);
+
+    /*
+     * Create a system message field for UCP52 ack message.
+     * The system message has the recipient's address + a timestamp.
+     * Some SMSC (eg. T-Mobile) requires it.
+     */
+       Octstr *tmpstr;
+        tmpstr = octstr_create("");
+
+        /* Get the recipient's address. */
+        octstr_append(tmpstr, emimsg->fields[E50_ADC]);
+        octstr_append_char(tmpstr, ':');
+
+       /* Create a timestamp. */
+       tm = gw_localtime(time(NULL) + msg->sms.deferred * 60);
+       sprintf(p, "%02d%02d%02d%02d%02d%02d", tm.tm_mday, tm.tm_mon +
1, tm.tm_year % 100, tm.tm_hour, tm.tm_min, tm.tm_sec);
+        octstr_append(tmpstr, octstr_create(p));
+
+       /* Concatenate and insert the fields (number + timestamp) above. */
+       reply->fields[2] = tmpstr;
+
+
        if (emi2_emimsg_send(conn, server, reply) < 0) {
            emimsg_destroy(reply);
            return -1;
--------------------------------------------------------------------------------

Regards,

Ferenc (oszfer __at__ aitia.hu)  & Csabi ( csabi __at__ aitia.hu)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.