[PATCH] support GSM 03.38 encoding byte stream via smsbox's sendsms

Stipe Tolj <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization tolj.org system architecture
Message-ID <[email protected]>
Hi list,

I'm trying to catch with lots of issues ;)

Please find attached a simple patch that is a "RFC" version to allows direct 
passing of GSM 03.38 encoded byte streams via smsbox to Kannel.

Why? Now, smsbox still assumes WINDOWS-1252 encoding for 7bit indicated text 
payloads. This means ie. various greek characters are not supported. If a user 
want's to send via SMPP (data_coding == 0, hence GSM default alphabet), then 
we'd like to provide a way to inject the byte stream directly. It will still get 
transcoded to our internal represenative encoding (UTF-8), but makes the "thing" 
easiert for the user side.

Comments please.

Stipe

-------------------------------------------------------------------
Kölner Landstrasse 419
40589 DÃŒsseldorf, NRW, Germany

tolj.org system architecture      Kannel Software Foundation (KSF)
http://www.tolj.org/              http://www.kannel.org/

mailto:st_{at}_tolj.org           mailto:stolj_{at}_kannel.org
-------------------------------------------------------------------
smsbox-gsm-03.38.diff (text/plain, 1.6 KB)
### Eclipse Workspace Patch 1.0
#P gateway-cvs-head
Index: doc/userguide/userguide.xml
===================================================================
RCS file: /home/cvs/gateway/doc/userguide/userguide.xml,v
retrieving revision 1.331
diff -u -r1.331 userguide.xml
--- doc/userguide/userguide.xml	3 Aug 2007 15:09:23 -0000	1.331
+++ doc/userguide/userguide.xml	28 Nov 2007 15:34:24 -0000
@@ -7142,7 +7142,9 @@
    <entry valign="bottom">
         Charset of text message. Used to convert to a format suitable for
 	7 bits or to UCS-2. Defaults to WINDOWS-1252 if coding is 7bits and
-	UTF-16BE if coding is UCS-2.
+	UTF-16BE if coding is UCS-2. Supports GSM-03.38 as value, in order to
+	indicate that payload in <literal>text</literal> is encoded in
+	GSM 03.38 alphabet.
    </entry></row>
 
    <row><entry><literal>udh</literal></entry>
Index: gw/smsbox.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsbox.c,v
retrieving revision 1.275
diff -u -r1.275 smsbox.c
--- gw/smsbox.c	3 Aug 2007 15:09:23 -0000	1.275
+++ gw/smsbox.c	28 Nov 2007 15:34:29 -0000
@@ -3668,10 +3668,13 @@
 
 	if (coding == DC_7BIT) {
 	    /*
-         * For 7 bit, convert to WINDOWS-1252
+         * For 7 bit, convert to UTF-8
 	     */
-        if (charset_convert(body, octstr_get_cstr(charset), "UTF-8") < 0) {
-		resultcode = -1;
+        if (octstr_case_compare(charset, octstr_imm("GSM-03.38")) == 0) {
+            charset_gsm_to_utf8(body);
+	    }
+        else if (charset_convert(body, octstr_get_cstr(charset), "UTF-8") < 0) {
+        	resultcode = -1;
 	    }
 	} else if (coding == DC_UCS2) {
 	    /*
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.