Hi all thanks for taking the time to look at this.
When using control_stream_file, stream_file, or get_options the “escape_digits” only works the first time. if using ‘#’ if using a number 0-9 it works fine each time. I’m not sure if this is a bug or if I need to do some kind of “reset” between calls??
My Python Code:
from asterisk.agi import *
escape_all = ['1','2','3','4','5','6','7','8','9','0','#','*']
agi = AGI()
digit = agi.stream_file('custom/please-enter', escape_all)
agi.verbose("Caught:" + str(digit))
tmp = agi.stream_file('custom/start-dictation', escape_all)
agi.verbose("Caught:" + str(tmp))
agi.hangup()
In this test the caller can press any of the escape digits and it is caught and printed to the log but only the first time. The second one, does not work… it doesn’t matter what digit the user presses, it plays the soundfile to completion and exits with nothing caught … the logs display nothing being caught for the second attempt.
Log output
/home/asterisk/Dictator/run.sh: ----------------------- TEST ----------------------
<TRUNCATED>AGI Tx >> 200 result=1
<TRUNCATED>AGI Rx << STREAM FILE custom/please-enter "1234567890#*" 0
-- <TRUNCATED> Playing 'custom/please-enter.slin' (escape_digits=1234567890#*) (sample_offset 0) (language 'en')
> 0x3e69f30 -- Strict RTP switching to RTP target address <REDACTED> as source
<TRUNCATED>AGI Tx >> 200 result=35 endpos=20640
<TRUNCATED>AGI Rx << VERBOSE "caught: #" 1
/home/asterisk/Dictator/run.sh: caught: #
<TRUNCATED>AGI Tx >> 200 result=1
<TRUNCATED>AGI Rx << STREAM FILE custom/start-dictation "1234567890#*" 0
-- <TRUNCATED> Playing 'custom/start-dictation.slin' (escape_digits=1234567890#*) (sample_offset 0) (language 'en')
> 0x3e69f30 -- Strict RTP learning complete - Locking on source address <REDACTED>
<TRUNCATED>AGI Tx >> 200 result=0 endpos=56080
<TRUNCATED>AGI Rx << VERBOSE "caught: " 1
/home/asterisk/Dictator/run.sh: caught:
<TRUNCATED>AGI Tx >> 200 result=1
I can sorta work around it but as this is for a dictation project I will need to request user input values several times.
Thank you in advance for any insight into this…