[asterisk-bugs] [JIRA] (ASTERISK-24468) Incoming UCS2 encoded SMS truncated if SMS length exceeds 50 (roughly) national symbols
Dmitriy Bubnov (JIRA)
noreply at issues.asterisk.org
Thu Oct 30 11:30:29 CDT 2014
[ https://issues.asterisk.org/jira/browse/ASTERISK-24468?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=223204#comment-223204 ]
Dmitriy Bubnov commented on ASTERISK-24468:
-------------------------------------------
It is simple arithmetics. Lets count:
1) AT+CMGR phone response prefix {{+CMGR: "REC UNREAD","+7**********",,"14/10/29,13:31:39+12"\r\n}} is about 60 bytes;
2) 140 bytes is a maximum SMS body length regarding GSM standart, but in UCS2 encoding it expanded to 280 bytes;
3) AT+CMGR phone response suffix {{\r\n\r\nOK\r\n}} is 8 bytes;
4) plus 1 byte to hold char '\0' for C library string functions.
So, 60+280+8+1=349. It's a minimum size for receiving buffer to hold long SMS in UCS2 encoding.
Surely, it is possible to make {{buf}} bigger to make provision for variants in phone response prefix, and to comply various "power of" rules. But, in any case, 256 bytes is not enough to hold whole phone response in case of long SMS in UCS2 encoding.
> Incoming UCS2 encoded SMS truncated if SMS length exceeds 50 (roughly) national symbols
> ---------------------------------------------------------------------------------------
>
> Key: ASTERISK-24468
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-24468
> Project: Asterisk
> Issue Type: Bug
> Security Level: None
> Components: Addons/chan_mobile
> Environment: All
> Reporter: Dmitriy Bubnov
> Assignee: Dmitriy Bubnov
> Severity: Critical
> Attachments: chan_mobile-1_8.diff, chan_mobile-trunk.diff, cmgr_hcidump_out.txt
>
>
> One symbol in national language expanded to 4 bytes when UCS2 character encoding used.
> So, size of 256 bytes for receiving buffer {{buf}} in function {{do_monitor_phone}} is not enough for incoming UCS2 encoded SMS, when last is longer than 50 national symbols. I suggest to set size of this buffer to 350 bytes, instead of current 256 bytes.
> Such modification will make incoming SMS in UCS2 encoding not to be truncated. Provided patch reclaims truncation only for incoming SMS, and not affect outgoing SMS.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list