[asterisk-users] Automatic call-out problem
Artifex Maximus
artifexor at gmail.com
Fri Jan 18 06:14:51 CST 2008
Hello!
My setup is Asterisk 1.2.26 with Zaptel 1.2.22.1, libpri-1.2.7 on
Fedora Core 4. I am making automatic call-out campaign with this setup
on 4 PRI. The scripts for this:
====================================================================
caller php script write this to outgoung folder:
fwrite($outfile,"Channel: Zap/g1/$phonenumber\n");
fwrite($outfile,"MaxRetries: 0\n");
fwrite($outfile,"RetryTime: 5\n");
fwrite($outfile,"WaitTime: 20\n");
fwrite($outfile,"Context: 0100q\n");
fwrite($outfile,"Callerid: $dbid\n");
fwrite($outfile,"Extension: $phonenumber\n");
fwrite($outfile,"Set: par_telszam=$phonenumber\n");
====================================================================
extensions.conf:
[0100q]
exten => _XXXX.,1,Wait(1)
exten => _XXXX.,n,Set(__TRIES=1)
exten => _XXXX.,n,Set(__FMT_DATE=%Y-%m-%d %H:%M:%S)
exten => _XXXX.,n,Set(__SZAM=${par_telszam})
exten => _XXXX.,n,System(echo -e
"${SZAM}\,felvette\,${STRFTIME(${EPOCH},,${FMT_DATE})}" >>
/tmp/0100q_0.txt)
exten => _XXXX.,n,Playback(0100q_0)
exten => _XXXX.,n,System(echo -e
"${SZAM}\,99\,${STRFTIME(${EPOCH},,${FMT_DATE})}" >>
/tmp/0100q_1v.txt)
exten => _XXXX.,n(valasztas),Set(TIMEOUT(response)=5)
exten => _XXXX.,n,Set(TIMEOUT(digit)=1)
exten => _XXXX.,n,Background(0100q_1)
exten => t,1,System(echo -e
"${SZAM}\,timeout\,${STRFTIME(${EPOCH},,${FMT_DATE})}" >>
/tmp/0100q_1.txt)
exten => t,n,Goto(0100q_2,999,1)
exten => i,1,System(echo -e
"${SZAM}\,invalid\,${STRFTIME(${EPOCH},,${FMT_DATE})}" >>
/tmp/0100q_1.txt)
exten => i,n,Goto(0100q_2,999,1)
exten => 1,1,System(echo -e
"${SZAM}\,1\,${STRFTIME(${EPOCH},,${FMT_DATE})}" >> /tmp/0100q_1.txt)
exten => 1,n,Goto(0100q_2,999,1)
exten => 2,1,System(echo -e
"${SZAM}\,2\,${STRFTIME(${EPOCH},,${FMT_DATE})}" >> /tmp/0100q_1.txt)
exten => 2,n,Goto(0100q_2,999,1)
exten => 3,1,System(echo -e
"${SZAM}\,3\,${STRFTIME(${EPOCH},,${FMT_DATE})}" >> /tmp/0100q_1.txt)
exten => 3,n,Goto(0100q_2,999,1)
exten => 9,1,System(echo -e
"${SZAM}\,9\,${STRFTIME(${EPOCH},,${FMT_DATE})}" >> /tmp/0100q_1v.txt)
exten => 9,n,GotoIf($["${TRIES}" = "4.000000"]?0100q_2,999,1)
exten => 9,n,Set(__TRIES=${MATH(${TRIES}+1)})
exten => 9,n,Wait(1)
exten => 9,n,Goto(_XXXX.,valasztas)
[0100q_2]
exten => 999,1,Wait(1)
exten => 999,n,Background(0100q_2)
exten => t,1,System(echo -e
"${SZAM}\,timeout\,${STRFTIME(${EPOCH},,${FMT_DATE})}" >>
/tmp/0100q_2.txt)
exten => t,n,Goto(0100q_9,999,1)
exten => i,1,System(echo -e
"${SZAM}\,invalid\,${STRFTIME(${EPOCH},,${FMT_DATE})}" >>
/tmp/0100q_2.txt)
exten => i,n,Goto(0100q_9,999,1)
exten => 1,1,System(echo -e
"${SZAM}\,1\,${STRFTIME(${EPOCH},,${FMT_DATE})}" >> /tmp/0100q_2.txt)
exten => 1,n,Goto(0100q_9,999,1)
[0100q_9]
exten => 999,1,Wait(1)
exten => 999,n,System(echo -e
"${SZAM}\,elkoszont\,${STRFTIME(${EPOCH},,${FMT_DATE})}" >>
/tmp/0100q_9.txt)
exten => 999,n,Playback(0100q_9)
exten => 999,n,Hangup
====================================================================
stats:
wc -l < 0100q_0.txt = 14628
cut -d , -f 1 < 0100q_0.txt | sort | uniq -c -d | wc -l = 74
wc -l < 0100q_1v.txt = 14300
cut -d , -f 1 < 0100q_1v.txt | sort | uniq -c -d | wc -l = 498
grep ",99," < 0100q_1v.txt | cut -d , -f 1 | sort | uniq -c -d | wc -l = 66
cut -d , -f 1 < 0100q_1.txt | sort | uniq -c -d | wc -l = 0
same for 2 and 9
====================================================================
Txt format is "number,string,date".
Caller script call every number once if call was successful. I
checked. Therefore there can not be duplicates in _0, there can not be
multiple 99 string for a number. Looks like there is some variable
problem but I did not find where is it. Because there is thousands of
successful calls the script should be correct I think.
Any idea why is it happen? Is it a bug or I am just blind?
bye,
a
More information about the asterisk-users
mailing list