[default]
exten=>_3455,1,Answer()
exten=>_3455,2,Set(RESULT=${SHELL(cat /root/badcalls.conf | grep -w -F ${CALLERID(num)} | wc -l)})
same=>n,verbose( this is the ${RESULT})
same=>n,GotoIf($[${RESULT}>0]?bad:good)
same=>n(bad),Playback(im-sorry)
same=>n,Hangup()
same=>n(good),MusicOnHold()
exten=>h,1,ExecIf($[${CDR(duration)}<60]?System(echo ${CDR(duration)} ${CALLERID(num)} >>/root/badcalls.conf))
exten=>h,2,ExecIf($[${CDR(duration)}>=60]?System(echo ${CDR(duration)} ${CALLERID(num)} >>/root/goodcalls.conf))
exten=>h,3,Verbose( call duration ${CDR(duration)})
El mismo sistema usando Gosub.
[marlon]
exten => _871210,1,Gosub(filter,3455,1)
exten => _871210,2,Playback(demo-thanks)
exten=>h,1,ExecIf($[${CDR(duration)}<60]?System(echo ${CDR(duration)} ${CALLERID(num)} >>/root/badcalls.conf))
exten=>h,2,ExecIf($[${CDR(duration)}>=60]?System(echo ${CDR(duration)} ${CALLERID(num)} >>/root/goodcalls.conf))
exten=>h,3,Verbose( call duration ${CDR(duration)})
[filter]
exten=>3455,1,Noop()
exten=>3455,2,Set(RESULT=${SHELL(cat /root/badcalls.conf | grep -w -F ${CALLERID(num)} | wc -l)})
same=>n,verbose( this is the ${RESULT})
same=>n,GotoIf($[${RESULT}>0]?bad:good)
same=>n(bad),Verbose( dropping the call)
same=>n,Hangup()
same=>n(good),verbose(Good call)
same => n,Return
No hay comentarios:
Publicar un comentario