Here's my second try at the SMPP patch.

This patch:

*) Fixes bogus encodings on MO messages
*) Provides UDH support for MO messages

for SMPP connections.

Have fun, and thanks for the comments!

David WHITE
CONNECT AUSTRIA

-- PATCH --

===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_smpp.c,v
retrieving revision 1.22
diff -u -r1.22 smsc_smpp.c
--- gw/smsc/smsc_smpp.c 2 Jan 2003 14:43:00 -0000 1.22
+++ gw/smsc/smsc_smpp.c 12 Feb 2003 12:41:31 -0000
@@ -233,7 +233,8 @@

static Msg *pdu_to_msg(SMPP *smpp, SMPP_PDU *pdu)
{
- Msg *msg;
+ Msg *msg;
+ int udh_offset;

gw_assert(pdu->type == deliver_sm);

@@ -242,11 +243,19 @@
pdu->u.deliver_sm.source_addr = NULL;
msg->sms.receiver = pdu->u.deliver_sm.destination_addr;
pdu->u.deliver_sm.destination_addr = NULL;
- msg->sms.msgdata = pdu->u.deliver_sm.short_message;
- pdu->u.deliver_sm.short_message = NULL;
dcs_to_fields(&msg, pdu->u.deliver_sm.data_coding);

- /* handle default data coding */
+ if (pdu->u.deliver_sm.esm_class & ESM_CLASS_SUBMIT_UDH_INDICATOR) {
+ udh_offset = octstr_get_char(pdu->u.deliver_sm.short_message,0)+1;
+ msg->sms.udhdata = octstr_copy(pdu->u.deliver_sm.short_message,0,udh_offset);
+ msg->sms.msgdata = octstr_copy(pdu->u.deliver_sm.short_message,udh_offset,octstr_len(pdu->u.deliver_sm.short_message)-udh_offset);
+ } else {
+ // Take over pointer from pdu
+ msg->sms.msgdata = pdu->u.deliver_sm.short_message;
+ pdu->u.deliver_sm.short_message = NULL;
+ }
+
+ /* handle strange data codings and automatic translations */
switch (pdu->u.deliver_sm.data_coding) {
case 0x00: /* default SMSC alphabet */
/*
@@ -257,11 +266,10 @@
if (charset_convert(msg->sms.msgdata, octstr_get_cstr(smpp->alt_charset), "ISO-8859-1") != 0)
error(0, "Failed to convert msgdata from charset <%s> to <%s>, will leave as is.",
octstr_get_cstr(smpp->alt_charset), "ISO-8859-1");
- msg->sms.coding = DC_7BIT;
+ msg->sms.coding = DC_7BIT;

} else { /* assume GSM 03.38 7-bit alphabet */
charset_gsm_to_latin1(msg->sms.msgdata);
- msg->sms.coding = DC_7BIT;
}
break;
case 0x01: /* ASCII or IA5 - not sure if I need to do anything */
@@ -269,7 +277,7 @@
case 0x04: /* 8 bit binary - do nothing */
break;
case 0x03: /* ISO-8859-1 - do nothing */
- msg->sms.coding = DC_8BIT; break;
+ break;
case 0x05: /* JIS - what do I do with that ? */
break;
case 0x06: /* Cyrllic - iso-8859-5, I'll convert to unicode */
@@ -288,7 +296,6 @@
* you implement them if you feel like it
*/
default:
- msg->sms.coding = DC_7BIT;
}
msg->sms.pid = pdu->u.deliver_sm.protocol_id;


Reply via email to