Skip to content

Instantly share code, notes, and snippets.

@ambiorixg12
Created December 19, 2018 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ambiorixg12/e486d9f036915bb51e04d4e2471ae1ae to your computer and use it in GitHub Desktop.
Save ambiorixg12/e486d9f036915bb51e04d4e2471ae1ae to your computer and use it in GitHub Desktop.
Checking CID against a DB
[cidlookup]
exten=>_x.,1,Noop( checking the callerid ${CALLERID(num)})
same=>n,Set(__cid=${SHELL(mysql --user=root --password='12340' --skip-column-names dialer -e 'select dnc_phone from dnc where dnc_phone="${CALLERID(num)}" limit 0,1 ')})
same=>n,Noop( result ${cid:0:1})
same => n,GotoIf($["${CALLERID(num)}"="${cid:0:-1}"]?allow:disallow)
same=>n(allow),Playback(demo-thanks)
same=>n,Hangup()
same=>n(disallow),Playback(im-sorry)
same=>n,Hangup()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment