On Wed, 15 Sep 2004, Orlando Andico wrote:

> when using the CIMD2 connection, how does one set the Service
> Description field? (0-99 I believe). I understand that setting "binfo"
> will set the Tariff Class. this is in 1.3.2, i'm not inclined to go
> mucking around in CVS.

you need to patch the cimd2 code in 1.3.2 so that binfo will support
both TC and SD.
attached is the patch originally from dido's cvs patch which i
ported to 1.3.2. 

example: if TC=01 and SD=02 then binfo=0102

pong


--- smsc_cimd2.c        Fri Aug 27 12:47:56 2004
+++ smsc_cimd2_patched.c        Fri Aug 27 13:08:35 2004
@@ -243,7 +243,7 @@
     { "status error code", P_STATUS_ERROR_CODE, 3, P_INT, 0, 999 },
     { "discharge time", P_DISCHARGE_TIME, 12, P_TIME },
     { "tariff class", P_TARIFF_CLASS, 2, P_INT, 0, 99 },
-    { "service description", P_SERVICE_DESCRIPTION, 2, P_INT, 0, 9 },
+    { "service description", P_SERVICE_DESCRIPTION, 2, P_INT, 0, 99 },
     { "message count", P_MESSAGE_COUNT, 3, P_INT, 0, 999 },
     { "priority", P_PRIORITY, 1, P_INT, 1, 9 },
     { "delivery request mode", P_DELIVERY_REQUEST_MODE, 1, P_INT, 0, 2 },
@@ -1326,6 +1326,7 @@
     long truncated;
     int dcs = 0;
     int setvalidity = 0;
+    int binfo_len;     /* length of billing info string */
 
     gw_assert(msg != NULL);
     gw_assert(msg->type == sms);
@@ -1439,9 +1440,33 @@
     else
        packet_add_int_parm(packet, P_REPLY_PATH, 0, conn);
 
-    /* Use binfo to set the tariff class */
-    if (octstr_len(msg->sms.binfo))
+    /* Use binfo to set the tariff class and service description */
+    binfo_len = octstr_len(msg->sms.binfo);
+    if (binfo_len > 0 && binfo_len <= 2) {
+       /* set tariff class if binfo upto 2 digits */
        packet_add_parm(packet, P_INT, P_TARIFF_CLASS, msg->sms.binfo, conn);
+    } else if (binfo_len == 4) {
+       /* if the length of the binfo string is exactly 4 characters,
+          then the first two characters will be taken as the tariff
+          class and the next characters will be taken as the service
+          description. */
+       Octstr *tcsd = octstr_create("00");
+
+       /* tariff class */
+       octstr_set_char(tcsd, 0, octstr_get_char(msg->sms.binfo, 0));
+       octstr_set_char(tcsd, 1, octstr_get_char(msg->sms.binfo, 1));
+       packet_add_parm(packet, P_INT, P_TARIFF_CLASS, tcsd, conn);
+
+       /* service description */
+       octstr_set_char(tcsd, 0, octstr_get_char(msg->sms.binfo, 2));
+       octstr_set_char(tcsd, 1, octstr_get_char(msg->sms.binfo, 3));
+       packet_add_parm(packet, P_INT, P_SERVICE_DESCRIPTION, tcsd, conn);
+       octstr_destroy(tcsd);
+    }
+    /* Do not add any tariff class or service description parameters
+       otherwise.  TC or SD parameters can only go from 0-99 as per
+       the CIMD 2 spec, so a longer than 4 character string would
+       be invalid anyway. */
 
     /* Set the protocol identifier if requested */
     if (msg->sms.pid > 0)
--
Philippine Linux Users' Group (PLUG) Mailing List
[EMAIL PROTECTED] (#PLUG @ irc.free.net.ph)
Official Website: http://plug.linux.org.ph
Searchable Archives: http://marc.free.net.ph
.
To leave, go to http://lists.q-linux.com/mailman/listinfo/plug
.
Are you a Linux newbie? To join the newbie list, go to
http://lists.q-linux.com/mailman/listinfo/ph-linux-newbie

Reply via email to