TUTORIAL Anonymous CallerID filtering for inbound calls

Allen Ford

New Member
Joined
Dec 25, 2014
Messages
5
Reaction score
2
I built from this example using Google text to speech and Google voice recognition. On top of that i cached the CallerID name so callers don't need add it twice.. and i have also included cell phone callers where callerID Name = CallerID Number. My full Dialplan shows here www.cyfordtechnologies.com

[who-r-u]
exten => s,1,agi(googletts.agi,"Hi Can i please get your name followed by the pound sign?",en)
exten => s,n(record),agi(speech-recog.agi,en-US)
exten => s,n,Verbose(1,Script returned: ${confidence} , ${utterance})
;Check the probability of a successful recognition:
exten => s,n(success),GotoIf($["${confidence}" > "0.4"]?playback:retry)
;Playback the text:
exten => s,n(playback),agi(googletts.agi,"Thank you ${utterance} i will save this for future calls",en)
; Cache CallerID
exten => s,n,System(echo "${CALLERID(num)}" "${utterance}" >> /etc/asterisk/callerID.conf)
exten => s,Set(CALLERID(name)="${utterance}")
exten => s,n,goto(from-ZoiperPush,${extenstion},29)
;Retry in case speech recognition wasn't successful:
exten => s,n(retry),agi(googletts.agi,"Can you please repeat more clearly?",en)
exten => s,n,goto(record)
exten => s,n(fail),agi(googletts.agi,"Failed to get speech data.",en)
exten => s,n(end),Hangup()


[from-ZoiperPush]
; In this setup please make an extension 3000 - 3009 for MS Push

exten => _300X,1,Answer
exten => _300X,n,Set(debug=1)
exten => _300X,n,GotoIf($[${ISNULL(${SHELL(cat /var/lib/asterisk/agi-bin/googletts.agi | grep "#!/usr/bin/env perl")})}]?:start)
exten => _300X,n,System( yum install -y perl perl-libwww-perl perl-JSON sox cpan flac \; cd /usr/src \; wget http://sourceforge.net/projects/mpg123/files/mpg123/1.14.2/mpg123-1.14.2.tar.bz2/download \; tar -xjvf download \; cd mpg123* \; ./configure \; make \; make install \; rm -rf mpg123* \; ln -s /usr/local/bin/mpg123 /usr/bin/mpg123 \; wget https://github.com/downloads/zaf/asterisk-googletts/asterisk-googletts-0.6.tar.gz / \; tar xvfz asterisk-googletts-0.6.tar.gz \; cd asterisk-googletts* \; cp googletts.agi /var/lib/asterisk/agi-bin/googletts.agi \; wget https://github.com/zaf/asterisk-speech-recog/tarball/master \; tar xvfz master \; cd zaf* \; cp -R * /var/lib/asterisk/agi-bin/ \; chown -R asterisk:asterisk /var/lib/asterisk/agi-bin/ \; cpan JSON -y)
exten => _300X,n(start),NoOp(**WP8 Push Notification: ext: ${EXTEN}, callerID: ${CALLERID(num)} **)
exten => _30XX,n,Set(extenstion=${EXTEN})

exten => _300X,n,GotoIf($[${ISNULL(${SHELL(cat /etc/asterisk/callerID.conf | grep -R "${CALLERID(num)}" | cut -d " " -f2)})}]?:cacheCCID)
exten => _300X,n,GotoIf($["${CALLERID(num)}" = ""]?who-r-u,s,1)
exten => _300X,n,GotoIf($["foo${CALLERID(num)}" = "foo"]?who-r-u,s,1)
exten => _300X,n,GotoIf($["${CALLERID(name)}" = "${CALLERID(num)}"]?who-r-u,s,1)
exten => _300X,n,GotoIf($["${CALLERID(name):0:9}" = "Anonymous"]?who-r-u,s,1)
exten => _300X,n,GotoIf($["${CALLERID(name):0:7}" = "Unknown"]?who-r-u,s,1)
exten => _300X,n,GotoIf($["${CALLERID(num):0:7}" = "Private"]?who-r-u,s,1)
exten => _300X,n,GotoIf($["${CALLERID(name):0:7}" = "Private"]?who-r-u,s,1)
exten => _300X,n,GotoIf($["${CALLERID(num):0:10}" = "Restricted"]?who-r-u,s,1)
exten => _300X,n,GotoIf($["${CALLERID(num):0:4}" = "PSTN"]?who-r-u,s,1)

exten => _300X,n,GotoIf($[ 0 = 0 ]?29)
;exten => _300X,27(cacheCCID),Set(${CALLERID(name)}='${SHELL(cat /etc/asterisk/callerID.conf | grep -R "${CALLERID(num)}" | cut -d " " -f2)}')
exten => _300X,27(cacheCCID),Set(CALLERID(name)='${SHELL(cat /etc/asterisk/callerID.conf | grep -R "${CALLERID(num)}" | cut -d " " -f2)}')
exten => _300X,28,Verbose(1, Outgoing Caller ID: {$CALLERID(all)})
exten => _300X,29,GotoIf(${ISNULL(${SIPPEER(${EXTEN},codecs)})}?:100)
exten => _300X,30,GotoIf(${ISNULL(${PJSIP_ENDPOINT(${EXTEN},allow)})}?:200)
exten => _300X,31,GotoIf(${ISNULL(${IAXPEER(${EXTEN},codecs)})}?:300)

exten => _300X,n,GotoIf($["${codecs}" = ""]?50:300)
exten => _300X,n,NoOp(** Unable to determin channel type ${EXTEN} not available **)
exten => _300X,n,Goto(${EXTEN},exit)
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,202
Reaction score
5,221
Hi, Allen Ford. THANKS! Not sure about your yum install and compile inside the dialplan. The dialplan only has asterisk user permissions so this may not fly. Probably need to add it separately as a prerequisite by logging in as root. All of these components are included in Incredible PBX builds, by the way.
 

Allen Ford

New Member
Joined
Dec 25, 2014
Messages
5
Reaction score
2
Hi wardmundy
yes i compiled freepbx from source but i still get good info from this site , not sure if i shouldn't be posting :)


but yes it should run the command as root. it does on my machines, i asked in irc too and was told the core runs as root and passes asterisk commands as Astertisk user.. but i believe system commands would run as root.. when i run asterisk as safe with asterisk user, i get warning and errors. but commands do run as asterisk. but not when started normally.

Please test so i can know for sure if my box is not alone

Also the install will only take place if it doesn't find the googletts.agi file otherwise it skips it.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,202
Reaction score
5,221
I'll give it a whirl. Thanks again, Allen Ford, and OF COURSE you should be posting! Come back often.
 

Members online

No members online now.

Forum statistics

Threads
25,812
Messages
167,767
Members
19,241
Latest member
nana1
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top