[asterisk-bugs] [Asterisk 0011692]: app_system() sets SYSTEMSTATUS randomly not dependant on the return result of the linux system call

noreply at bugs.digium.com noreply at bugs.digium.com
Mon Jan 7 09:39:46 CST 2008


The following issue has been ASSIGNED. 
====================================================================== 
http://bugs.digium.com/view.php?id=11692 
====================================================================== 
Reported By:                dcantera
Assigned To:                Corydon76
====================================================================== 
Project:                    Asterisk
Issue ID:                   11692
Category:                   Applications/app_system
Reproducibility:            random
Severity:                   major
Priority:                   normal
Status:                     assigned
Asterisk Version:           1.4.16.2 
SVN Branch (only for SVN checkouts, not tarball releases): N/A  
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             01-05-2008 19:48 CST
Last Modified:              01-07-2008 09:39 CST
====================================================================== 
Summary:                    app_system() sets SYSTEMSTATUS randomly not
dependant on the return result of the linux system call
Description: 
System() sets SYSTEMSTATUS to random values of SUCCESS or APPERROR on
sequential tests w/o any other changes to the dialplan or configuration...

the scenario is call screening.  in sounds/callerannounce directory, we
store a file containing a .gsm recording.  the filename is the
CALLERID(num).gsm.  when a call starts we check for the existance of the
file. if the file exists, we connect to the extension.  if the file does
not exist, we ask the caller to record his/her name and store it in the
sounds/callscreen directory. we tried the STAT() call and it did not stat
the file correctly so we went for the System() and used the Linux stat
command.  the * system() did not fair any better.  here is the output of
three sequential tests...

dialplan segment
----------------

;; use the STAT command when the bug is fixed, until then use Linux stat()
w/ * System()
exten => s,n,NoOp(DEBUG:  (before) system() set as   ${SYSTEMSTATUS})
exten => s,n,System(stat -c '%b'  -f ${SCREEN_FILE})
exten => s,n,NoOp(DEBUG:  (after)  system() returned ${SYSTEMSTATUS})
exten => s,n,System(stat -f ${SCREEN_FILE})
exten => s,n,NoOp(DEBUG:  (after)  system() returned ${SYSTEMSTATUS})
exten => s,n,GotoIf($[ ${SYSTEMSTATUS} = APPERROR
]?s,record-announcement:s,I-know-them)
exten => s,n(record-announcement),Swift(At the tone)
exten => s,n,Swift(Please tell me who is calling.)
exten => s,n,Record(${SCREEN_FILE}.gsm|2|4)
exten => s,n,Goto(s,connect-call)
exten => s,n(I-know-them),Playback(${SCREEN_FILE}|2|4)
exten => s,n(connect-call),Playback(pls-wait-connect-call)








test sequence http://bugs.digium.com/view.php?id=1

run one: callerid(num).gsm does not exist (works as expected asks to
record)
-------------------------------------------------------------
    -- Executing [s at custom-screen:3] Set("Zap/4-1",
"SCREEN_FILE=/var/lib/asterisk/sounds/callerannounce/5202") in new stack
    -- Executing [s at custom-screen:4] Set("Zap/4-1",
"TMPFILE=/var/lib/asterisk/sounds/callerannounce/5202.gsm") in new stack
    -- Executing [s at custom-screen:5] NoOp("Zap/4-1", "DEBUG:  (before)
system() set as   ") in new stack
    -- Executing [s at custom-screen:6] System("Zap/4-1", "stat -c %b  -f
/var/lib/asterisk/sounds/callerannounce/5202") in new stack
    -- Executing [s at custom-screen:7] NoOp("Zap/4-1", "DEBUG:  (after) 
system() returned APPERROR") in new stack
    -- Executing [s at custom-screen:8] System("Zap/4-1", "stat -f
/var/lib/asterisk/sounds/callerannounce/5202") in new stack
    -- Executing [s at custom-screen:9] NoOp("Zap/4-1", "DEBUG:  (after) 
system() returned APPERROR") in new stack
    -- Executing [s at custom-screen:10] GotoIf("Zap/4-1",
"1?s|record-announcement:s|I-know-them") in new stack
    -- Goto (custom-screen,s,11)

run two: callerid(num).gsm does exist (works as expected found file)
----------------------------------------------------------
    -- Executing [s at custom-screen:3] Set("Zap/4-1",
"SCREEN_FILE=/var/lib/asterisk/sounds/callerannounce/5202") in new stack
    -- Executing [s at custom-screen:4] Set("Zap/4-1",
"TMPFILE=/var/lib/asterisk/sounds/callerannounce/5202.gsm") in new stack
    -- Executing [s at custom-screen:5] NoOp("Zap/4-1", "DEBUG:  (before)
system() set as   ") in new stack
    -- Executing [s at custom-screen:6] System("Zap/4-1", "stat -c %b  -f
/var/lib/asterisk/sounds/callerannounce/5202") in new stack
    -- Executing [s at custom-screen:7] NoOp("Zap/4-1", "DEBUG:  (after) 
system() returned APPERROR") in new stack
    -- Executing [s at custom-screen:8] System("Zap/4-1", "stat -f
/var/lib/asterisk/sounds/callerannounce/5202") in new stack
    -- Executing [s at custom-screen:9] NoOp("Zap/4-1", "DEBUG:  (after) 
system() returned SUCCESS") in new stack
    -- Executing [s at custom-screen:10] GotoIf("Zap/4-1",
"0?s|record-announcement:s|I-know-them") in new stack
    -- Goto (custom-screen,s,15)


run three: callerid(num).gsm does exist (does not work as expected, can't
find file)
-------------------------------------------------------------------
    -- Executing [s at custom-screen:3] Set("Zap/4-1",
"SCREEN_FILE=/var/lib/asterisk/sounds/callerannounce/5202") in new stack
    -- Executing [s at custom-screen:4] Set("Zap/4-1",
"TMPFILE=/var/lib/asterisk/sounds/callerannounce/5202.gsm") in new stack
    -- Executing [s at custom-screen:5] NoOp("Zap/4-1", "DEBUG:  (before)
system() set as   ") in new stack
    -- Executing [s at custom-screen:6] System("Zap/4-1", "stat -c %b  -f
/var/lib/asterisk/sounds/callerannounce/5202") in new stack
    -- Executing [s at custom-screen:7] NoOp("Zap/4-1", "DEBUG:  (after) 
system() returned APPERROR") in new stack
    -- Executing [s at custom-screen:8] System("Zap/4-1", "stat -f
/var/lib/asterisk/sounds/callerannounce/5202") in new stack
    -- Executing [s at custom-screen:9] NoOp("Zap/4-1", "DEBUG:  (after) 
system() returned APPERROR") in new stack
    -- Executing [s at custom-screen:10] GotoIf("Zap/4-1",
"1?s|record-announcement:s|I-know-them") in new stack
    -- Goto (custom-screen,s,11)
    -- Executing [s at custom-screen:11] Swift("Zap/4-1", "At the tone") in
new stack
    -- Executing [s at custom-screen:12] Swift("Zap/4-1", "Please tell me who
is calling.") in new stack


run four:  callerid(num).gsm does exist (works as expected, file is
found)
-----------------------------------------------------------
    -- Executing [s at custom-screen:3] Set("Zap/4-1",
"SCREEN_FILE=/var/lib/asterisk/sounds/callerannounce/5202") in new stack
    -- Executing [s at custom-screen:4] Set("Zap/4-1",
"TMPFILE=/var/lib/asterisk/sounds/callerannounce/5202.gsm") in new stack
    -- Executing [s at custom-screen:5] NoOp("Zap/4-1", "DEBUG:  (before)
system() set as   ") in new stack
    -- Executing [s at custom-screen:6] System("Zap/4-1", "stat -c %b  -f
/var/lib/asterisk/sounds/callerannounce/5202") in new stack
    -- Executing [s at custom-screen:7] NoOp("Zap/4-1", "DEBUG:  (after) 
system() returned APPERROR") in new stack
    -- Executing [s at custom-screen:8] System("Zap/4-1", "stat -f
/var/lib/asterisk/sounds/callerannounce/5202") in new stack
    -- Executing [s at custom-screen:9] NoOp("Zap/4-1", "DEBUG:  (after) 
system() returned SUCCESS") in new stack
    -- Executing [s at custom-screen:10] GotoIf("Zap/4-1",
"0?s|record-announcement:s|I-know-them") in new stack
    -- Goto (custom-screen,s,15)
    -- Executing [s at custom-screen:15] Playback("Zap/4-1",
"/var/lib/asterisk/sounds/callerannounce/5202|2|4") in new stack
    -- <Zap/4-1> Playing '/var/lib/asterisk/sounds/callerannounce/5202'
(language 'en')


run five:  callerid(num) does exist (worked as expected)
--------------------------------------------------------
yadda,

run six:  callerid(num) does exist (worked as expected)
-------------------------------------------------------
yadda

on test sequence http://bugs.digium.com/view.php?id=2
I'll spare the details
run one, two, three, four found the file
run five,six could not find the file



====================================================================== 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
01-07-08 09:39  file           Status                   new => assigned     
01-07-08 09:39  file           Assigned To               => Corydon76       
======================================================================




More information about the asterisk-bugs mailing list