[PATCH] EMI UCP Numerical message for OT 01

Colin Pitrat <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization Bull
Message-ID <[email protected]>
Hi,
this patch add support for numerical message for operation call input 
operation (Call input operation is OT=01, Numerical message is MT=2).
As we're dealing with numerical data, there should be no need of charset 
conversion.

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
emi_ot01mt2_numMsg.patch (text/plain, 2.4 KB)
--- gateway/gw/smsc/smsc_emi.c	2006-08-18 10:38:14.000000000 +0200
+++ gateway-new/gw/smsc/smsc_emi.c	2006-08-18 14:37:59.000000000 +0200
@@ -585,12 +585,6 @@
      */
     case 01:
 	msg = msg_create(sms);
-	if (emimsg->fields[E01_AMSG] == NULL)
-	    emimsg->fields[E01_AMSG] = octstr_create("");
-	else if (octstr_hex_to_binary(emimsg->fields[E01_AMSG]) == -1)
-	    warning(0, "EMI2[%s]: Couldn't decode message text",
-		    octstr_get_cstr(privdata->name));
-
 	if (emimsg->fields[E01_MT] == NULL) {
 	    warning(0, "EMI2[%s]: required field MT missing",
 		    octstr_get_cstr(privdata->name));
@@ -599,21 +593,38 @@
 	    emimsg->fields[E01_MT] = octstr_create("3");
 	}
 
-	if (octstr_get_char(emimsg->fields[E01_MT], 0) == '3') {
-	    msg->sms.msgdata = emimsg->fields[E01_AMSG];
-	    emimsg->fields[E01_AMSG] = NULL; /* So it's not freed */
-
-        /* obey the NRC (national replacement codes) */
-        if (privdata->alt_charset == EMI_NRC_ISO_21)
-            charset_nrc_iso_21_german_to_gsm(msg->sms.msgdata);
+	switch(octstr_get_char(emimsg->fields[E01_MT], 0))
+	{
+	    case '2':
+		if (emimsg->fields[E01_AMSG] == NULL)
+		    emimsg->fields[E01_AMSG] = octstr_create("");
+		msg->sms.msgdata = emimsg->fields[E01_AMSG];
+		emimsg->fields[E01_AMSG] = NULL; /* So it's not freed */
+		break;
 
-	    charset_gsm_to_latin1(msg->sms.msgdata);
-	}
-	else {
-	    error(0, "EMI2[%s]: MT == %s isn't supported for operation type 01",
-		  octstr_get_cstr(privdata->name),
-		  octstr_get_cstr(emimsg->fields[E01_MT]));
-	    msg->sms.msgdata = octstr_create("");
+	    case '3':
+		if (emimsg->fields[E01_AMSG] == NULL)
+		    emimsg->fields[E01_AMSG] = octstr_create("");
+		else if (octstr_hex_to_binary(emimsg->fields[E01_AMSG]) == -1)
+		    warning(0, "EMI2[%s]: Couldn't decode message text",
+			    octstr_get_cstr(privdata->name));
+
+		msg->sms.msgdata = emimsg->fields[E01_AMSG];
+		emimsg->fields[E01_AMSG] = NULL; /* So it's not freed */
+
+		/* obey the NRC (national replacement codes) */
+		if (privdata->alt_charset == EMI_NRC_ISO_21)
+		    charset_nrc_iso_21_german_to_gsm(msg->sms.msgdata);
+
+		charset_gsm_to_latin1(msg->sms.msgdata);
+		break; 
+
+	    default:
+		error(0, "EMI2[%s]: MT == %s isn't supported for operation type 01",
+			octstr_get_cstr(privdata->name),
+			octstr_get_cstr(emimsg->fields[E01_MT]));
+		msg->sms.msgdata = octstr_create("");
+		break;
 	}
 
 	msg->sms.sender = octstr_duplicate(emimsg->fields[E01_OADC]);
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.