[Home]

Summary:ASTERISK-26677: app_sms: Short SMS messages are garbled
Reporter:Lubos Dolezel (LubosD)Labels:
Date Opened:2016-12-25 07:06:49.000-0600Date Closed:2017-06-27 06:58:22
Priority:MinorRegression?
Status:Closed/CompleteComponents:Applications/app_sms
Versions:13.13.1 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Attachments:( 0) asterisk.log
( 1) sms
( 2) smsrec-in.wav
( 3) smsrec-out.wav
Description:I'm playing with receiving SMS messages sent by Gigaset C530 IP phones. I've set the SMS Center number to *88 and this is the configuration I'm using:

{code}
exten => *880,1,Verbose(Receiving SMS)
exten => *880,n,Answer()
exten => *880,n,Wait(2)
exten => *880,n,SMS(sms_gigaset,as)
exten => *880,n,Hangup
{code}

Long messages are delivered just fine, but short messages are messed up with 100% reproducibility. Examples:

ud=@@ # This was "OK"
ud=Ah¥@ # This was "Ahoj"

I don't know what else to provide. I've attached a debugger and tried to figure it out. At this point in the call stack (when sending a message with text "Ok"):

{code}
#2  0x00007fe1c3014d78 in sms_handleincoming (h=0x7fe1b4f28fa0) at app_sms.c:1134
1134                            p += unpacksms(h->dcs, h->imsg + p, h->udh, &h->udhl, h->ud, &h->udl, h->udhi);
{code}

there are these interesting values set:
{code}
(gdb) p p
$19 = 13 '\r'
(gdb) p/x h->imsg
$20 = {0x91, 0xe, 0x21, 0x8, 0x9, 0x81, 0x37, 0x67, 0x56, 0x64, 0xf9, 0x0, 0x0, 0x2, 0x0, 0x0, 0x5b, 0x0 <repeats 233 times>}
{code}
Comments:By: Asterisk Team (asteriskteam) 2016-12-25 07:06:51.185-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Lubos Dolezel (LubosD) 2016-12-25 07:14:45.062-0600

And these are the buffer contents for "Ahoj" sent from the phone:
{code}
(gdb) p/x h->imsg
$22 = {0x91, 0x10, 0x21, 0x8, 0x9, 0x81, 0x37, 0x67, 0x56, 0x64, 0xf9, 0x0, 0x0, 0x4, 0x41, 0xf4, 0x0, 0x0, 0x22, 0x0 <repeats 231 times>}
{code}

I reckon the buffer should contain 41F45B0D instead of 41FD0000.

By: Lubos Dolezel (LubosD) 2016-12-25 08:58:11.343-0600

I've recorded the SMS "conversation" between the phone and Asterisk.

By: Rusty Newton (rnewton) 2016-12-29 17:09:45.117-0600

The 11 branch is in Security Fix Only mode. Can you reproduce the issue on 13 or 14?

Once you are able to test it on 13 or 14..
Can you attach an Asterisk log file with warning,error,notice,verbose and debug channels? Make sure verbose and debug are both turned up to 5 or above.

I assume the phone's SMS is compatible with "ETSI ES 201 912" as mentioned in the documentation?

By: Lubos Dolezel (LubosD) 2016-12-31 08:04:35.879-0600

Yes, the phone should be compatible with the "ETSI ES 201 912" standard.

I've retried with Asterisk 13 (14 is not available on Gentoo) and enabled full logging as you described. The log is attached - the Gigaset SIP phone in question is referred to as "telefon".

I don't think there is much useful information in the logs. My personal bet is that something is possibly broken in the FSK demodulator in Asterisk or maybe the decoded data is later incorrectly parsed.

I believe the most useful piece of information is the wav recording of the call  I attached.

By: Rusty Newton (rnewton) 2017-01-03 18:02:13.545-0600

Thanks for the additional information. I'm going to go ahead and open the issue up. Remember that app_sms is extended support so the fastest way to get it fixed is to provide a patch or rally a community developer to help out with the issue. Otherwise the issue will wait in queue until a community developer finds interest in taking on the issue.

https://wiki.asterisk.org/wiki/display/AST/Asterisk+Module+Support+States
http://www.asterisk.org/community/discuss



By: Sean Bright (seanbright) 2017-02-02 11:35:35.313-0600

Lubos, there should be an 'sms' log file in your log directory. Can you also upload that please?

By: Lubos Dolezel (LubosD) 2017-03-15 06:23:53.460-0500

This is the log file, but there isn't much to see.

You can see a few text messages, 2-char messages are lost entirely, 4-char messages only have 2 good characters, and long messages look fine.

By: Sean Bright (seanbright) 2017-06-02 10:21:18.332-0500

I've ordered a Gigaset C530 IP. Once I have it I will be able to work through this. Thanks for your patience.

By: Sean Bright (seanbright) 2017-06-06 15:03:16.605-0500

So the Gigaset C530 IP I got doesn't support the SMS feature (because I'm in the US I guess?), so I won't be able to test this for now. I set up two Asterisk servers to talk to each other via the SMS() application and messages were sent/received without issue. Until I can get my hands on an IP phone with SMS support, I won't be able to move forward with this.

By: Lubos Dolezel (LubosD) 2017-06-13 13:20:06.748-0500

[~seanbright], I don't really know if the SMS communication is really bidirectional, but you could maybe analyze (replay?) the audio recording I also uploaded.

By: Sean Bright (seanbright) 2017-06-13 13:27:21.890-0500

[~LubosD], I was able to order a C530 from the UK and I should have it sometime in the next two weeks. I'll update when I have it and have tested it.

By: Sean Bright (seanbright) 2017-06-26 07:25:53.735-0500

[~LubosD], I got an EU version of the Gigaset and I've been testing this morning and have so far been unable to replicate the issue you are describing. Do you have the latest version of the firmware for the C530?

By: Sean Bright (seanbright) 2017-06-26 09:28:10.766-0500

FYI, I am testing with firmware version {{42.241 (422410000000 / V42.00)}}

By: Lubos Dolezel (LubosD) 2017-06-27 06:23:45.504-0500

[~seanbright], The Gigaset version you mention fixes the bug. Great!

Sadly, it wasn't released at the time I created the bug :-(

By: Sean Bright (seanbright) 2017-06-27 06:58:22.495-0500

I have two Gigaset C530s (one US, one EU) if anyone wants one!