Re: [PATCH] smpp bug with concatenated text message automatically split with concatenation = yes
Stipe Tolj <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Organization | Wapme Systems AG |
| Message-ID | <[email protected]> |
what about this approach?! This should work ok, but I think it's an performance impact, because we copy octstr arround and this should be avoided. Comments?! Stipe [email protected] ------------------------------------------------------------------- Wapme Systems AG Vogelsanger Weg 80 40470 Düsseldorf Tel: +49-211-74845-0 Fax: +49-211-74845-299 E-Mail: [email protected] Internet: http://www.wapme-systems.de ------------------------------------------------------------------- wapme.net - wherever you are
smsc_smpp.c.diff
(text/plain, 2.8 KB)
--- smsc_smpp.c 2003-03-06 10:41:05.000000000 +0100
+++ smsc_smpp.c.new 2003-03-06 10:39:27.000000000 +0100
@@ -319,7 +319,7 @@
static SMPP_PDU *msg_to_pdu(SMPP *smpp, Msg *msg)
{
SMPP_PDU *pdu;
- Octstr *buffer;
+ Octstr *buffer = NULL;
Octstr *relation_UTC_time = NULL;
struct tm gmtime, localtime, tm;
int gwqdiff;
@@ -409,35 +409,36 @@
pdu->u.submit_sm.esm_class = pdu->u.submit_sm.esm_class |
ESM_CLASS_SUBMIT_RPI;
+ /*
+ * only re-encoding if using default smsc charset that is defined via
+ * alt-charset in smsc group and if MT is not binary
+ */
+ if (pdu->u.submit_sm.data_coding == 0) {
+ buffer = octstr_duplicate(msg->sms.msgdata);
+ /*
+ * convert to the given alternative charset
+ * otherwise assume to convert to GSM 03.38 7-bit alphabet
+ */
+ if (smpp->alt_charset) {
+ if (charset_convert(buffer, "ISO-8859-1",
+ octstr_get_cstr(smpp->alt_charset)) != 0)
+ error(0, "Failed to convert msgdata from charset <%s> to <%s>, will send as is.",
+ "ISO-8859-1", octstr_get_cstr(smpp->alt_charset));
+ } else {
+ charset_latin1_to_gsm(buffer);
+ }
+ }
+
/*
* set data segments and length
*/
if (octstr_len(msg->sms.udhdata)) {
pdu->u.submit_sm.short_message =
- octstr_format("%S%S", msg->sms.udhdata, msg->sms.msgdata);
+ octstr_format("%S%S", msg->sms.udhdata, (buffer ? buffer : msg->sms.msgdata));
} else {
- pdu->u.submit_sm.short_message = octstr_duplicate(msg->sms.msgdata);
-
- /*
- * only re-encoding if using default smsc charset that is defined via
- * alt-charset in smsc group and if MT is not binary
- */
- if (pdu->u.submit_sm.data_coding == 0) {
-
- /*
- * convert to the given alternative charset
- * otherwise assume to convert to GSM 03.38 7-bit alphabet
- */
- if (smpp->alt_charset) {
- if (charset_convert(pdu->u.submit_sm.short_message, "ISO-8859-1",
- octstr_get_cstr(smpp->alt_charset)) != 0)
- error(0, "Failed to convert msgdata from charset <%s> to <%s>, will send as is.",
- "ISO-8859-1", octstr_get_cstr(smpp->alt_charset));
- } else {
- charset_latin1_to_gsm(pdu->u.submit_sm.short_message);
- }
- }
+ pdu->u.submit_sm.short_message = octstr_duplicate((buffer ? buffer : msg->sms.msgdata));
}
+ octstr_destroy(buffer);
pdu->u.submit_sm.sm_length = octstr_len(pdu->u.submit_sm.short_message);
/*