torsdag 16. oktober 2003, 18:33, skrev Stipe Tolj:
> Hi list,
>
> I have added a 'binfo' to the Msg sms structure to pass arbitrary
> billing identifier/information for MT and MO messages.
>
> In EMI2 we forward the XSer 0c field and in SMPP we forward the
> service_type from the deliver_sm.
>
> For MO, we have now a '%B' escape code for the sms-service to pass
> this binfo field into any HTTP requests and for MT we have a 'binfo'
> CGI variable in the sendsms interface.
>
> Beware that Kannel does only proxy those fields and does not handle
> any semantics associated with the billing identifier/information. The
> external HTTP application is in charge to "know" what to do and how to
> handle these information.
>
> Can anyone who feels this can be addopted to CIMD2 and OIS (or other
> SMSC modules) please provide patches?!

Attached is a patch for smsc_cimd2.c that set field 64 Tariff Class to the 
value of binfo if binfo is set.

I have also updated smsc_cimd2.c to set field 55 Reply Path to enabled if rpi 
is set.

These two changes should make the CIMD2 module more up to date, but my final 
change to smsc_cimd2.c may be more controversial.

There is an integer field in the CIMD2 protocol called 62 Status Error Code 
that can provide more detail about why a message was not delivered. When 
doing MT billing it is necessesary to know if a message failed because it 
belonged to an other operator (ported), or if a prepaid card had no balance.

I have altered smsc_cimd2.c to send this error code instead of the usual if it 
is set. If you feel this is not the way to do it then feel free to rip it out 
if you apply the rest of the patch.

I have also made a change to shared.c that may be a bit controversial. For 
multipart messages like picturemessages, I have altered shared.c to only set 
binfo for the first part. This is to avoid double of triple charging the 
customer! The CIMD2 protocol says nothing about this issue, but the two 
operators we use CIMD2 with, want it that way. However, it may perhaps not 
work with other modules.

We run this patched code against two operator, and have had no problem with 
it.

Please discuss and vote.
-- 
Med vennlig hilsen,
Eurobate ASA

Arne K. Haaje
Senior Network Engineer
--------------------------------------------------------------------
    Eurobate ASA - Postboks 4589 Nydalen - 0404 Oslo - Norway
Phone: +47 23 22 73 73 - Fax: +47 23 22 73 74 - Mob: +47 92 88 44 66
                    http://www.eurobate.com/
--- /tmp/kannel-snapshot/gw/shared.c	2003-10-12 23:46:09.000000000 +0200
+++ shared.c	2003-10-22 08:19:56.000000000 +0200
@@ -411,6 +411,11 @@
             part->sms.dlr_url = NULL;
             part->sms.dlr_mask = 0;
         }
+		/* Likewise, only use the billing info for the first part of a concatenated message */
+		if ((msgno > 1) && part->sms.binfo) {
+            octstr_destroy(part->sms.binfo);
+            part->sms.binfo = NULL;
+        }
         octstr_destroy(part->sms.msgdata);
         if (sms_msgdata_len(temp) <= max_part_len || msgno == max_messages) {
             part->sms.msgdata = temp->sms.msgdata ? 
--- /tmp/kannel-snapshot/gw/smsc/smsc_cimd2.c	2003-07-20 18:23:05.000000000 +0200
+++ smsc_cimd2.c	2003-10-22 13:30:01.000000000 +0200
@@ -1377,9 +1377,15 @@
 
     /* Turn off reply path as default.
      * This avoids phones automatically asking for a reply
-     * However, it is a nice feature and could be enabled through a parameter
      */
-    packet_add_int_parm(packet, P_REPLY_PATH, 0, conn);
+	if (msg->sms.rpi > 0)
+		packet_add_int_parm(packet, P_REPLY_PATH, 1, conn);
+	else
+    	packet_add_int_parm(packet, P_REPLY_PATH, 0, conn);
+
+	/* Use binfo to set the tariff class */
+	if (octstr_len(msg->sms.binfo))
+		packet_add_parm(packet, P_INT, P_TARIFF_CLASS, msg->sms.binfo, conn);
 
     truncated = 0;
 
@@ -2013,14 +2019,20 @@
     Octstr *destination = NULL;
     Octstr *timestamp = NULL;
     Octstr *statuscode = NULL;
+	Octstr *statuserrorcode = NULL;
     int st_code;
+	int st_ecode;
     int code;
 
     destination = packet_get_parm(request, P_DESTINATION_ADDRESS);
     timestamp = packet_get_parm(request, P_MC_TIMESTAMP);
     statuscode = packet_get_parm(request, P_STATUS_CODE);
 
+	/* STATUS_ERROR_CODE may include errorcodes that are important when using billing */
+	statuserrorcode = packet_get_parm(request, P_STATUS_ERROR_CODE);
+
     st_code = atoi(octstr_get_cstr(statuscode));
+	st_ecode = atoi(octstr_get_cstr(statuserrorcode));
 
     switch(st_code)
     {
@@ -2034,11 +2046,14 @@
     default:
         code = 0;
     }
+	if (st_ecode > 0)
+		code = st_ecode;
     if(code)
     	msg = dlr_find(conn->name, timestamp, destination, code);
     else
         msg = NULL;
     octstr_destroy(statuscode);
+	octstr_destroy(statuserrorcode);
     octstr_destroy(destination);
     octstr_destroy(timestamp);
 

Reply via email to