Syntax of call files
Specify where and how to call
Channel:
CallerID: «name»
MaxRetries:
RetryTime:
WaitTime:
Account: Set the account code to use.
If the call answers, connect it here:
Context:
Extension:
Priority:
Set: Set a variable for use in the extension logic (example: file1=/tmp/to ); in Asterisk 1.0.x use ‘SetVar’ instead of ‘Set’
Application: Asterisk Application to run (use instead of specifiying context, extension and priority)
Data: The options to be passed to application
Set: Can now also write to dialplan functions like CDR()
AlwaysDelete: Yes/No — If the file’s modification time is in the future, the call file will not be deleted
Archive: Yes/No — Move to subdir «outgoing_done» with «Status: value», where value can be Completed, Expired or Failed.
Создаем контекст
[outboundmsg]
exten => s,1,Wait(2)
exten => s,n,Background(/var/lib/asterisk/sounds/custom/zapis)
exten => s,n,Hangup
Далее создаем скрипт который будет создать .call файл
#!/bin/sh
while read number; do
cat < /var/spool/asterisk/$number
Channel: SIP/addpac/$number
Callerid: $number
MaxRetries: 200
RetryTime: 20
WaitTime: 30
Context: outboundmsg
Extension: s
Priority: 1
EOF
chown asterisk:asterisk /var/spool/asterisk/$number
mv /var/spool/asterisk/$number /var/spool/asterisk/outgoing
echo "$number"
number=`expr $number + 1`
while [ "$?" -eq "0" ]
do
count_files ()
{
count_f=`ls /var/spool/asterisk/outgoing | wc -l`
if [ "$count_f" -eq "30" ]; then
sleep 10
return 0
else
return 1
fi
}
count_files
done
done < /var/spool/asterisk/list.txt
exit 0
cat /var/spool/asterisk/list.txt
84951234567
84951234568
84951234569
Скрипт будет по порядку обзванивать весь список с промежутком 10 секунд.