[asterisk-dev] App_SMS: UDH (EMS) bug and fix

Anselm Martin Hoffmeister anselm at hoffmeister-online.de
Sun Nov 12 05:56:34 MST 2006


Hello everyone,

while setting up a local SMS relay in my asterisk dialplan I found out
that the UDH handling in app_sms does not work as intended. I tracked
that down to app_sms.c code (see below).

Bug description:
================
On sending a SMS with a UDH (user data header) defined, the appropriate
UDH flag in the SMS first byte will NOT be set currently.
Ref: http://www.dreamfabric.com/sms/deliver_fo.html

Affects:
========
SMS containing USER DATA HEADERS (e.g. "EMS" with a bitmap, ringtone,
text formattings or similar embedded to the message)

Location:
=========
app_sms.c (1.2.12.1 tarball file apps/app_sms.c, line 1053)
(still present in SVN-trunk (Webaccess) as of today)
**** ORIG
   if (h->smsc) {                   /* deliver */
       h->omsg[p++] = (more ? 4 : 0);
       p += packaddress (h->omsg + p, h->oa);
       h->omsg[p++] = h->pid;
**** CHANGED
   if (h->smsc) {                   /* deliver */
       h->omsg[p++] = (more ? 4 : 0) + ((h->udhl > 0) ? 0x40 : 0);
       p += packaddress (h->omsg + p, h->oa);
       h->omsg[p++] = h->pid;

Tests:
======
With this additional flag set, it is possible to send EMS with an
embedded picture. Note: replace 12345 with the caller-id to be
displayed, "0193010" with the number of a SMS service center known to
the phone (trailing "1" seems to be necessary) and SIP/sip503 to a
channel where the phone can be reached (mine is a Siemens Gigaset S100
on a ISDN line off a Fritz!Box 7050 as SIP-Client to my asterisk box).

smsq --mt --oa=12345 --mttx-callerid=01930101 --mttx-channel=SIP/sip503
--udh=112100800000000D000F800FC00FE01FF03FF83FF83FC838C838F838F838F800000001 "This is the regular text"

This command will display the text and offer to "install" the supplied
bitmap (which shows a small house, from
http://hjem.get2net.dk/grob/EMS/EMS_samples.html#no3 ) to the phone.

Similar will not work with unpatched app_sms.c, instead a load of
"garbage" will displayed as SMS text, trailed by "This is the regular
text" (obviously because the phone has no idea that the beginning of the
SMS contains header data)



I am not a registered asterisk developer and do not have SVN write
access or anything (just subscribed on the -dev mailing list though).
Please tell me how to advance this such that this bug can be fixed.
If this means creating a patch file or so, please tell me to whom to
submit.

Thanks & BR
Anselm



More information about the asterisk-dev mailing list