Hello
Background:
i want to make test if file on hdd exist.
i want to have all code in extensions.ael
but:
from wiki - bash script :
voip-info.org/wiki/view/Aste … eexistance
#!/bin/bash
#Test for the existance of files based on shell globbing patterns
for a in $1;
do
if [ -f $a ] ; then
# there are one or more files that match;
exit;
else
# there aren't any files that match;
exit 1;
fi;
done;
this is very good in extensions.conf:
[macro-testfile]
exten => s,1,system(${bash_dir}/file_test ${file_o_dir}/o_${ARG1}.sln)
exten => s,2,Set(ISTHERE=yes)
exten => s,102,Set(ISTHERE=no)
but i want it in extensions.ael, but don’t know how to handle this n+101 … for now it’s like this:
context incoming {
s => {
answer;
set(CDR(userfield)=${CALLERIDNUM});
begin:
background(${menu}/welcome);
for (i=0; ${i} < 20; i=${i}+1 ) {
&testfile(${i});
if ("${ISFILE}" = "yes" )
{
background(${file_o}/o_${i});
background(${digit_dir}/${i});
}
else
noop(-nop-);
};
goto begin;
};
_X. => {
set(FILE=${EXTEN});
goto(file|play);
};
i => {
goto(s|begin);
};
file => {
noop(file - ${file} );
play:
background(${title_dir}/${FILE}_t);
background(${file_dir}/${FILE});
goto(s|begin);
};
it’s working.
asterisk allow to mix ael, regular extensions.conf and realtime extensions together in one.
i tried to make VARIABLE=${system(${bash_dir}/file_test ${file_o_dir}/o_${i}.sln)} but it always returns 0
main question:
Does anyone know how to handle n+101 priority in ael ?
Mayby someone have some optimalization to my dialplan ?
My thanks in advance
-FD