Asterisk 13.22.0 – “stat” Dialplan Function Clears Channel Vars?
Hi Guys
I have the following dialplan code that I use to play back recordings, the filename being provided in an originate statement to the AMI (AJAM) interface:
Action: Originate ActionID: test Channel: SIP/3015
Exten: 7777
Context: local Priority: 1
CallerID: 3015
Account: recordinglisten ChannelID: abc OtherChannelID: def Variable: CallLimit=3600,recfile=/var/spool/asterisk/monitor/1807/25/2507180836591192526,altfile=/var/spool/asterisk/monitor/archive/1807/25/2507180836591192526
Async: true
Extension 7777 is:
;listen to recording exten=>7777,1,Answer()
exten=>7777,n,NoOp(Requesting File ${recfile})
exten=>7777,n,Set(${__recfile}=${recfile})
exten=>7777,n,Set(${__altfile}=${altfile})
exten=>7777,n,NoOp(Rec file set to ${recfile})
exten=>7777,n,NoOp(Alt file set to ${altfile})
exten=>7777,n,NoOp(Requesting Alt File ${altfile})
exten=>7777,n,Set(__numbertarget=7777)
exten=>7777,n,Set(haveFile=${STAT(e,${recfile}.gsm)})
exten=>7777,n,NoOp(Original File Exist ${haveFile})
exten=>7777,n,GotoIf($[“${haveFile}” = “1”]?play)
exten=>7777,n,NoOp(rec File not found using alt file)
exten=>7777,n,Set(recfile=${altFile})
exten=>7777,n(play),ControlPlayback(${recfile},20000,6,4,8,5,9)
exten=>7777,n,hangup()
However, if the above originate is done, when this line is executed in the dialplan Asterisk 13.22.0
exten=>7777,n,Set(haveFile=${STAT(e,${recfile}.gsm)})
it clears the variables recfile and altfile – if you NoOp them out below this line they are blank.
Why would the “STAT” dialplan function in 13.22.0 apparently clear all variables set on the channel, instead of checking if the given file exists (as it did in previous Asterisk versions) and leaving the channel variables alone…
Additionally, not only “recfile” which is passed as a STAT parameter is clear, “altfile” is -also- cleared to blank.
Can anybody assist?
Thank you
Stefan
—