I have the following Asterisk 13.22.0 dialplan code that I use to play back recordings, the filename being provided in an originate statement to the AMI (AJAM) interface by my external application:
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,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, extension 7777 kicks off and when this line is executed in the dialplan in the Asterisk 13.22.0 instance:
exten=>7777,n,Set(haveFile=${STAT(e,${recfile}.gsm)})
it clears the variables recfile and altfile - and returns 0 even if the file DOES exist on disc - and if you NoOp ${recfile} and ${altfile} out below this line they -both- are returned as blank strings, above it they are filled correctly with the correct data - the file that is to be played back filing system location.
Removing the call to "STAT", and the channel variables stay filled and don't become empty through the entire 7777 extension's run.
Why would the "STAT" dialplan function in Asterisk 13.22.0 apparently clear custom Asterisk channel variables set on the channel, instead of checking if the given file exists in the filing system and returning 1 for exists, 0 for not (as it did in previous Asterisk versions) and leaving the custom channel variables alone while doing so...?
Not only "recfile" which is passed as a STAT parameter (via the originate above) is clear, "altfile" is -also- cleared to blank - the moment the Asterisk 13 "STAT" function is called on extension 7777.
This exact dialplan code functions flawlessly in an Asterisk 1.8.32.3 instance if tested.
Can anybody assist?
Thank you
Stefan