[SOLVED]:Hang up if telemarketing music at the start of call


My company is being harassed by telemarketers and I want to block those calls but this company calls from different numbers almost everytime which prevents me from using a ‘blacklist’. The only thing in common with all the calls is that a music ad is played as soon as the’re picked up.

So I thought about recording (at least) the start of the calls and compare it to a stored sample, if they’re the same, hangup, otherwise let the call flow.

Do you guys have any thought on this? Ever heard of somethihng similar or ever entirely different that I can use? keeping in mind I use both SIP an PRI trunking with the telco.

Thank you!

System info:
CentOS 5.5
asterisk 1.8
dahdi 2.6.1
libpri 1.14.15

After a while I ended up figuring out something that worked, although with a different approach.

I used the AMD aplication to analyse the audio pattern and determine if it’s a machine or a human instead of comparing the start of a call with a pre-recorded sample.

The following script checks the AMDCAUSE variable set by AMD app and then hangs up if the values are “LONGGREETING-1500-1500” or “MAXWORDS-3-3”.

exten => s,1,NoOp(## ISAAC ASIMOV'S LAWS DO NOT APPLY ##)
exten => s,n,Answer()
exten => s,n,AMD() 
exten => s,n,NoOp(AMDCAUSE=${AMDCAUSE})
exten => s,n,ExecIf($["${AMDCAUSE}" == "LONGGREETING-1500-1500" || "${AMDCAUSE}" == "MAXWORDS-3-3"]?HangUp())
exten => s,n,Return()

I realise this script can be improved, so do it if you need 8)

This blog post had the solution for my need, hope it can useful to someone else: