[asterisk-bugs] [Asterisk 0013617]: SMS app ignores parameter 'p' - initial pause
Asterisk Bug Tracker
noreply at bugs.digium.com
Sat Oct 4 02:13:34 CDT 2008
A NOTE has been added to this issue.
======================================================================
http://bugs.digium.com/view.php?id=13617
======================================================================
Reported By: alecdavis
Assigned To:
======================================================================
Project: Asterisk
Issue ID: 13617
Category: Applications/app_sms
Reproducibility: always
Severity: minor
Priority: normal
Status: new
Asterisk Version: 1.6.0-rc6
SVN Branch (only for SVN checkouts, not tarball releases): N/A
SVN Revision (number only!):
Disclaimer on File?: N/A
Request Review:
======================================================================
Date Submitted: 2008-10-03 23:41 CDT
Last Modified: 2008-10-04 02:13 CDT
======================================================================
Summary: SMS app ignores parameter 'p' - initial pause
Description:
Can be tested without any actual sms equipment.
dialplan code:
exten => 8507,1,NoOp(SMS Test extension)
exten => 8507,n,Answer()
exten => 8507,n,SMS(sms,atp350)
exten => 8507,n,Hangup()
modified app_sms.c -> sms_exec:
h.smsc = ast_test_flag(&sms_flags, OPTION_BE_SMSC);
h.protocol = ast_test_flag(&sms_flags, OPTION_TWO) ? 2 : 1;
if (!ast_strlen_zero(sms_opts[OPTION_ARG_PAUSE])){
h.opause_0 = atoi(sms_opts[OPTION_ARG_PAUSE]);
ast_log(LOG_NOTICE, "Initial Delay [%d]ms override\n",
h.opause_0); /* Debug: this line is never shown!!!!!!! */
}
if (h.opause_0 < 25 || h.opause_0 > 2000){
ast_log(LOG_WARNING, "Initial Delay [%d]ms out of range.
Default 300ms\n", h.opause_0); /* added for DEBUG */
h.opause_0 = 300; /* default 300ms */
}
console output:
-- Executing [8507 at trusted:1] NoOp("IAX2/aldhome-1248", "SMS Test
extension") in new stack
-- Executing [8507 at trusted:2] Answer("IAX2/aldhome-1248", "") in new
stack
-- Executing [8507 at trusted:3] SMS("IAX2/aldhome-1248", "sms,atp350")
in new stack
sms argc 2 queue <sms> opts <atp350> addr <> body <>
[Oct 4 17:47:03] WARNING[16702]: app_sms.c:1806 sms_exec: Initial Delay
[0]ms out of range. Default 300ms
-- SMS TX 7F 00
======================================================================
----------------------------------------------------------------------
(0093152) alecdavis (reporter) - 2008-10-04 02:13
http://bugs.digium.com/view.php?id=13617#c93152
----------------------------------------------------------------------
Fixed: app_sms.c looks like it was initially debugged for protocol 1 not
protocol 2.
Moved variables that are proto dependant into if/else structure.
Added test for Proto2 start message 0x7F.
Tested with dialplan SMS(sms,at) and with SMS(sms,atp(2000)).
static void sms_messagetx(sms_t * h)
{
unsigned char c = 0, p;
int len = h->omsg[1] + 2; /* total message length excluding
checksum */
for (p = 0; p < len; p++) /* compute checksum */
c += h->omsg[p];
h->omsg[len] = 0 - c; /* actually, (256 - (c & 0fxx)) &
0xff) */
sms_debug(DIR_TX, h);
h->framenumber++; /* Proto 2 */
h->obytep = 0;
h->obitp = 0;
if (h->protocol == 2) { /* Proto 2: */
h->oseizure = 300; /* 300bits (or more ?) */
h->obyte = 0; /* Seizure starts with
space (0) */
if (h->omsg[0] == 0x7F){
h->opause = 8 * h->opause_0; /* initial message
delay */
}else{
h->opause = 400;
}
} else { /* Proto 1: */
h->oseizure = 0; /* No seizure */
h->obyte = 1; /* send mark ('1') at the
beginning */
/* Change the initial message delay. BT requires 300ms,
* but for others this might be way too much and the
phone
* could time out. XXX make it configurable.
*/
if (h->omsg[0] == 0x93){
h->opause = 8 * h->opause_0; /* initial message
delay */
}else{
h->opause = 200;
}
}
/* Note - setting osync triggers the generator */
h->osync = OSYNC_BITS; /* 80 sync bits */
h->obyten = len + 1; /* bytes to send (including
checksum) */
}
my app_sms.c has too much debug, so didn't do a diff sorry.
Alec
Issue History
Date Modified Username Field Change
======================================================================
2008-10-04 02:13 alecdavis Note Added: 0093152
======================================================================
More information about the asterisk-bugs
mailing list