#!/bin/bash
#$1=number of calls -1
#2 pause
#3 destination number
COUNTER=0
while [ $COUNTER -lt $1 ]; do
echo The counter is $COUNTER
sleep $2
asterisk -x "originate SIP/perment/9990000$3 extension 0@internal"
let COUNTER=COUNTER+1
done
root@asterisk-dominicana:~# ./while.sh 100 3 14795824808
dial plan
[internal]
exten=>0,1(music),Playback(/var/lib/asterisk/moh/macroform-cold_day)
same=>n,Goto(music)
--------------------------------------------------------------
Otras variantes mandandolo a un local channel para poder poner el caller ID
#!/bin/bash
#$1=number of calls -1
#2 pause
#3 destination number
COUNTER=0
while [ $COUNTER -lt $1 ]; do
echo The counter is $COUNTER
sleep $2
asterisk -x "originate Local/$3@perment extension 1701@radio"
let COUNTER=COUNTER+1
done
########################
EJEMPLO DEL ARHICOV calleridlist.conf del cual el script tomara los caller id
/root/calleridlist.conf
18007142585
18097142358
13052365874
################
DIAL PLAN
[perment]
;exten =>_x.,1,Gosub(pickCallerIDnum,cell${RAND(1,5)},1) ; ya no usare el gobsub para el caller id
exten=>_x.,1,Set(callid=${SHELL(shuf -n 1 /root/calleridlist.conf)}) ;tomar un caller id random de un archv
same=>n,Set(CALLERID(num)=${callid})
same=>n,Dial(SIP/99900${EXTEN}@perment,25)
same=>n,Hangup()
[pickCallerIDnum]
exten =>cell1,1,Set(CALLERID(num)=343444)
same => n,Return
exten => cell2,1,Set(CALLERID(num)=044552)
same => n,Return
exten => cell3,1,Set(CALLERID(num)=10573)
same => n,Return
exten => cell4,1,Set(CALLERID(num)=900094)
same => n,Return
exten => cell5,1,Set(CALLERID(num)=10995)
same => n,Return
[radio]
exten=>1701,1,Answer
same=>n,NoCDR()
same=>n,Set(CHANNEL(MUSICCLASS)=radio)
same=>n,MusicOnHold()
same=>n,Hangup
Luego corremos en consola
root@asterisk-dominicana:~# ./while.sh 5 5 18097143489
No hay comentarios:
Publicar un comentario