Hi,
here are some modifications I made to EMI UCP. The patch should be applied only if the previous patches I sent are applied before. This patch just adds a skeleton for the answer to 02, 03, 57 and 58 ot and move the code that produce the SM field for the answer to 0x ot in a function.

I'm currently running some conformity tests on kannel for EMI UCP, and I'd like to add the missing functionalities, but it seems like there's not a lot of commit on CVS for a long time. Will all the patches that have been sent for the last months be applied ?

Regards,
--
Colin Pitrat (Bull Services Telco)
Bull,  Architect of an Open World (TM)
Tél : +33 (0)  1 30 80 72 93
www.bull.com
diff -ur gateway/gw/smsc/emimsg.c gateway-new/gw/smsc/emimsg.c
--- gateway/gw/smsc/emimsg.c    2005-02-11 16:35:48.000000000 +0100
+++ gateway-new/gw/smsc/emimsg.c        2006-08-23 15:26:57.000000000 +0200
@@ -113,11 +113,17 @@
     switch (ot) {
     case 01:
        return SZ01;
+    case 02:
+       return SZ02;
+    case 03:
+       return SZ03;
     case 31:
        return 2;
     case 51:
     case 52:
     case 53:
+    case 57:
+    case 58:
        return SZ50;
     case 60:
        return SZ60;
@@ -133,12 +139,16 @@
 {
     switch(ot) {
     case 01:
+    case 02:
+    case 03:
        return posit ? 2 : 3;
     case 31:
        return posit ? 2 : 3;
     case 51:
     case 52:
     case 53:
+    case 57:
+    case 58:
        return 3;
     case 60:
        return posit ? 2 : 3;
diff -ur gateway/gw/smsc/emimsg.h gateway-new/gw/smsc/emimsg.h
--- gateway/gw/smsc/emimsg.h    2005-02-11 16:35:48.000000000 +0100
+++ gateway-new/gw/smsc/emimsg.h        2006-08-23 15:26:22.000000000 +0200
@@ -81,6 +81,13 @@
     E01_ADC, E01_OADC, E01_AC, E01_MT, E01_AMSG, SZ01
 };
 
+enum {
+    E02_NPL, E02_RAD, E02_OADC, E02_AC, E02_MT, E02_AMSG, SZ02
+};
+
+enum {
+    E03_RAD, E03_OADC, E03_AC, E03_NPL, E03_RP, E03_PR, E03_LPR, E03_UR, 
E03_LUR, E03_RC, E03_LRC, E03_DD, E03_DDT, E03_MT, E03_AMSG, SZ03
+};
 
 /* All the 50-series messages have the same number of fields */
 enum {
diff -ur gateway/gw/smsc/smsc_emi.c gateway-new/gw/smsc/smsc_emi.c
--- gateway/gw/smsc/smsc_emi.c  2006-08-18 15:53:59.000000000 +0200
+++ gateway-new/gw/smsc/smsc_emi.c      2006-08-23 15:31:35.000000000 +0200
@@ -159,6 +159,35 @@
  (PRIVDATA(conn)->keepalive > 0) &&                                            
        \
  (time(NULL) > (PRIVDATA(conn)->last_activity_time + 
PRIVDATA(conn)->keepalive)))
 
+/* 
+ * Create the SM field for operation 0x :
+ * an Octstr * of the form "Adc:SCTS" with : 
+ * AdC = Address code recipient, max 16 digits
+ * SCTS = Service center time stamp DDMMYYhhmmss
+ */
+Octstr *create_0x_SM_field(Octstr *AdC)
+{
+    time_t t_time;
+    struct tm tm_time;
+    // 13 because the timestamp format is DDMMYYhhmmss
+    char timestamp[13];
+    Octstr *separator;
+    Octstr *tmpstr;
+    Octstr *tmpstr2;
+    Octstr *result;
+
+    separator = octstr_create(":");
+    tmpstr = octstr_cat(AdC, separator);
+    time(&t_time);
+    gw_strftime(timestamp, sizeof(timestamp), "%d%m%y%H%M%S", 
localtime_r(&t_time, &tm_time));
+    tmpstr2 = octstr_create(timestamp);
+    result = octstr_cat(tmpstr, tmpstr2);
+    octstr_destroy(tmpstr);
+    octstr_destroy(tmpstr2);
+    octstr_destroy(separator);
+    return result;
+}
+
 /*
  * Send an EMI message and update the last_activity_time field.
  */
@@ -596,6 +625,10 @@
        switch(octstr_get_char(emimsg->fields[E01_MT], 0))
        {
            case '2':
+               /* 
+                * Bull, Colin Pitrat, 18/08/2006 :
+                * Not handling MT=2 (Numeric message)
+                */
                if (emimsg->fields[E01_AMSG] == NULL)
                    emimsg->fields[E01_AMSG] = octstr_create("");
                msg->sms.msgdata = emimsg->fields[E01_AMSG];
@@ -653,29 +686,7 @@
        msg->sms.smsc_id = octstr_duplicate(conn->id);
        bb_smscconn_receive(conn, msg);
        reply = emimsg_create_reply(01, emimsg->trn, 1, privdata->name);
-       /* 
-        * Reply should contain SM as field 2 which is AdC:SCTS with :
-        * AdC = Address code recipient, max 16 digits
-        * SCTS = Service center time stamp DDMMYYhhmmss
-        */
-       {
-           time_t t_time;
-           struct tm tm_time;
-           // 13 because the timestamp format is DDMMYYhhmmss
-           char timestamp[13];
-           Octstr *tmpstr;
-           Octstr *tmpstr2;
-
-           time(&t_time);
-           tmpstr = octstr_create(":");
-           tmpstr2 = octstr_cat(emimsg->fields[E01_ADC], tmpstr);
-           octstr_destroy(tmpstr); 
-           gw_strftime(timestamp, sizeof(timestamp), "%d%m%y%H%M%S", 
localtime_r(&t_time, &tm_time));
-           tmpstr = octstr_create(timestamp);
-           reply->fields[1] = octstr_cat(tmpstr2, tmpstr);
-           octstr_destroy(tmpstr);
-           octstr_destroy(tmpstr2);
-       }
+       reply->fields[1] = create_0x_SM_field(emimsg->fields[E01_ADC]);
 
        if (emi2_emimsg_send(conn, server, reply) < 0) {
            emimsg_destroy(reply);
@@ -927,6 +938,38 @@
         emimsg_destroy(reply);
         return (st_code < 0 ? -1 : 1);
 
+    /*
+     * Handle OP/02 multiple address call input operation. This is the MO side 
+     * of the protocol implementation.
+     */
+    case 02:
+    /*
+     * Handle OP/03 call input with suplementary services operation. This is 
+     * the MO side of the protocol implementation. 
+     */
+    case 03:
+    /*
+     * Handle OP/57 response inquiry message operation. This is the MO side 
+     * of the protocol implementation.
+     */
+    case 57:
+    /*
+     * Handle OP/58 response delete message operation. This is 
+     * the MO side of the protocol implementation. 
+     */
+    case 58:
+       /*
+        * These operations aren't implemented yet, return a NACK with error 
code
+        * 03 : Operation not supported by system
+        */
+       error(0, "EMI2[%s]: Operation type %d not implemented yet",
+               octstr_get_cstr(privdata->name), emimsg->ot);
+       reply = emimsg_create_reply(emimsg->ot, emimsg->trn, 0, privdata->name);
+       reply->fields[1] = octstr_create("03");
+       st_code = emi2_emimsg_send(conn, server, reply);
+       emimsg_destroy(reply);
+       return (st_code < 0 ? -1 : 1);
+
     default:
        error(0, "EMI2[%s]: I don't know how to handle operation type %d", 
              octstr_get_cstr(privdata->name), emimsg->ot);
begin:vcard
fn:Colin Pitrat
n:Pitrat;Colin
org:Bull;Telco
adr:;;rue Jean Jaures;Les Clayes sous Bois;;78340;France
email;internet:[EMAIL PROTECTED]
tel;work:+33 1 30 80 72 93
x-mozilla-html:FALSE
url:http://www.bull.com
version:2.1
end:vcard

Reply via email to