RE: 31 characters (was: Funny)
"Rodrigo Sousa Coutinho" <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello, This is a bug in the 7 bit encoding, and is not directly related with the size of the message: -> "123456789012345678901234567890z" works (31 chars) -> "......." does not work (7 chars) In attachment goes the patch that solves this bug. Regards, Rodrigo -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Rene Kluwen Sent: Friday, October 18, 2002 3:03 AM To: [email protected] Subject: 31 characters (was: Funny) I tracked it down to: All messages of 31 characters won't send (in my case). I tested using both a Siemens SL45 and a Siemens M35. Is this a Siemens thingy? Or is something wrong packing the PDU? Could anybody confirm or deny this using a non-Siemens phone? I will see if I can find something in the source when it is not 4am in the morning anymore ;) -- Rene... -------- This email message has been automatically scanned for viri using Sophos antivirus. -------- ----- Original Message ----- From: Rene Kluwen / Chimit Software Solutions To: [email protected] Sent: Friday, October 18, 2002 3:49 AM Subject: Funny... The following message: "Slotkoers ABN Amro: 15.00 Euro." (without the quotes) won't send using the AT2 smsc. >From the logs: ==> /var/log/kannel/bearerbox.log <== 2002-10-18 03:46:29 [5] DEBUG: AT2[mysmsc]: TP-Validity-Period: 24.0 hours 2002-10-18 03:46:29 [5] DEBUG: AT2[mysmsc]: --> AT+CMGS=40^M 2002-10-18 03:46:29 [5] DEBUG: AT2[mysmsc]: <-- > 2002-10-18 03:46:29 [5] DEBUG: AT2[mysmsc]: send command status: 1 2002-10-18 03:46:29 [5] DEBUG: AT2[mysmsc]: --> 0031000A8160229761500000A71F53F69BBE7E97E5735050E80405DBF2B70E14ABB96030 50B12E7FBB 2002-10-18 03:46:29 [5] DEBUG: AT2[mysmsc]: --> ^Z 2002-10-18 03:46:29 [5] DEBUG: AT2[mysmsc]: <-- > 2002-10-18 03:46:29 [5] DEBUG: AT2[mysmsc]: <-- ERROR If I change any character within the message... Or if I add or remove 1 character... It will send... But just this particular message doesn't work... Does anybody have any idea why? -------- This email message has been automatically scanned for viri using Sophos antivirus. --------
smsc_at2.c.patch
(application/octet-stream, 1.2 KB)
Index: smsc_at2.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_at2.c,v
retrieving revision 1.3
diff -u -r1.3 smsc_at2.c
--- smsc_at2.c 23 Aug 2002 09:10:31 -0000 1.3
+++ smsc_at2.c 22 Oct 2002 14:44:11 -0000
@@ -24,6 +24,7 @@
#include <netdb.h>
#include <sys/ioctl.h>
#include <time.h>
+#include <math.h>
#include "gwlib/gwlib.h"
#include "gwlib/charset.h"
@@ -1871,6 +1872,7 @@
{
int LSBmask[8] = { 0x00, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F };
int MSBmask[8] = { 0x00, 0x40, 0x60, 0x70, 0x78, 0x7C, 0x7E, 0x7F };
+ int destRemain = (int)ceil ((octstr_len(source) * 7.0) / 8.0);
int i = (offset?8-offset:7), iStore = offset;
int posT, posS;
Octstr *target = octstr_create("");
@@ -1882,6 +1884,7 @@
target_chr |= (source_chr & LSBmask[i]) << iStore;
/* store current byte if last command filled it */
if (iStore != 0) {
+ destRemain--;
octstr_append_char(target, target_chr);
target_chr = 0;
}
@@ -1894,7 +1897,7 @@
}
/* don't forget to pack the leftovers ;-) */
- if (target_chr)
+ if (destRemain > 0)
octstr_append_char(target, target_chr);
return target;