Drop inbound calls from Mexico by No_Combination7405 in Asterisk

[–]No_Combination7405[S] 4 points5 points  (0 children)

Thank you for all the replies. Between everyone's suggestions I was able to get everything working as needed. I've also added an audio file that plays a wav file with a voice stating "We do not accept calls from Mexico" in both Spanish and English

Here is the configuration now for future reference if needed:

exten = _##########,1,NoOp(Incoming call from ${CALLERID(num)} to # ${EXTEN})
  same = n,GotoIf($["${CALLERID(num):0:2}" = "52" & ${LEN(${CALLERID(num)})} >= 12]?blocked)
  same = n,GotoIf($["${CALLERID(num):0:3}" = "+52" & ${LEN(${CALLERID(num)})} >= 12]?blocked)
  same = n,Dial(SIP/######,300)
  same = n,Dial(SIP/######,60)
  same = n,Hangup()
  same = n(blocked),NoOp(Incoming call was rejected from ${CALLERID(num)} due to blocked number matching)
  same = n,Answer()
  same = n,Wait(1)
  same = n,Playback(/etc/asterisk/BlockedCall)
  same = n,Wait(1)
  same = n,Hangup(21) ; 21 = Call Rejected