Configuring dialplan questions

Hi, I’m using asterisk-1.8.12.2 with dahdi-2.4.1 on an older version of Fedora and would like to make a few changes to how the incoming calls are managed. I have some familiarity with how it all works, but it’s been so long since I’ve worked on it, that I hoped someone could help.

The biggest problem I’m having with with robo callers. I’ve had to adjust the length of a voicemail to 40s because their automated calls were costing us money. So, is there a way to stop these calls and prevent them from reaching voicemail in the first place? I’d like to programmically detect it is a robo call and automatically drop the connection.

In lieu of being able to do that, perhaps we can make a change to the dialplan to require someone to press a button before leaving a message?

The other problem is that I’d like to change the default menu to go directly to a phone. There’s actually only one phone connected to the system now, so I’d like it to route all sales calls to that number (7003).

I’ve included my extensions.conf file below, with my number replaced with 5551212, in hopes someone could help me get started in configuring it properly.

If there’s a way to simplify the whole configuration, I’d be open to that. Please do let me know what else I can provide to help fix this.

[code];
; extensions.conf
;

[general]
static = yes
writeprotect = no

;
; [globals]
;
; The “globals” category contains global variables that can be referenced
; in the dialplan with ${VARIABLE} or ${ENV(VARIABLE)} for Environmental variable
; ${${VARIABLE}} or ${text${VARIABLE}} or any hybrid
;
[globals]
VOICEPULSE_TRUNK01 = voicepulse-primary
VOICEPULSE_TRUNK02 = voicepulse-secondary

;
; [macro-stdexten]
;
; ${ARG1} - Device(s) to ring
; ${ARG2} - Mailbox
;
[macro-stdexten]
exten => s,1,Dial(${ARG1},20,tr)
exten => s,2,Goto(s-${DIALSTATUS},1)

exten => s-NOANSWER,1,Voicemail(${ARG2}@local,u) ; No answer.
exten => s-NOANSWER,2,Hangup
exten => s-BUSY,1,Voicemail(${ARG2}@local,b) ; Phone busy.
exten => s-BUSY,2,Hangup
exten => _s-.,1,Playback(invalid) ; Channel unavailable.
exten => _s-.,2,Goto(incoming,_1NXXNXXXXXX,4)

;
; [macro-shitlist]
;
; Shitlist for people we do not want to accept calls from.
;
[macro-shitlist]
exten => s,1,Answer
exten => s,2,Congestion
exten => s,3,Hangup

;
; [local]
;
; This is the “main” context where you can get to any telephone, group, queue,
; voicemail, or the directory.
;
[local]
;exten => 7000,1,Goto(incoming,s,1)
;exten => 7000,1,Macro(stdexten,SIP/7003,7003)
exten => 7000,1,Macro(stdexten,SIP/7003,7003)
exten => 7003,1,Macro(stdexten,SIP/7003,7003)
;exten => _7XXX,1,Macro(stdexten,SIP/${EXTEN},${EXTEN})

; XXX
;exten => _7676,1,Macro(stdexten,SIP/7003,7003)
;exten => _7003,1,Macro(stdexten,SIP/7003,7003)
;exten => _7209,1,Macro(stdexten,SIP/${EXTEN},7009)
;exten => _7003,1,Macro(stdexten,SIP/7003,7003)

exten => 8000,1,Goto(incoming,s,1)
exten => _8XXX,1,Playback(invalid)
exten => _8XXX,2,Goto(incoming,s,1)

exten => _9XXX,1,Playback(invalid)
exten => _9XXX,2,Goto(incoming,s,1)

exten => *86,1,Answer
exten => *86,2,Wait(.5)
exten => *86,3,VoicemailMain(@local)
exten => *86,4,Hangup

exten => *87,1,Answer
exten => *87,2,Wait(.5)
exten => *87,3,VoicemailMain(${CALLERID(num)}@local)
exten => *87,4,Hangup

exten => 9,1,Set(CALLERID(all)=9 - ${CALLERID(name)} <${CALLERID(num)}>)
exten => 9,2,Directory(local)
exten => 9,3,Hangup
exten => h,1,Hangup
exten => i,1,Hangup
exten => t,1,Hangup

;
; [macro-intercom]
;
; This is an ad-hoc macro for the intercom which loops over dialed numbers and hangs
; up busy or unavailble extensions. Ring answer is enabled so phones will auto-
; matically pick up upon the page.
;
[macro-intercom]
exten => s,1,ChanIsAvail(${ARG1},js)
exten => s,2,SIPAddHeader(Alert-Info: Ring Answer)
exten => s,3,Dial(${ARG1},)
exten => s,4,Hangup
exten => t,1,Hangup
exten => T,1,Hangup

;
; [intercom]
;
; This is an ad-hoc intercome extension which people dialing 8000 are
; thrown into.
;
[intercom]
exten => _X.,1,Macro(intercom,SIP/${EXTEN})

;
; [testing]
;
; Miscellaneous testing extensions, this context should be included into
; [trusted] or [local] for debugging.
;
[testing]
exten => 200,1,Goto(mainmenu-day,_1NXXNXXXXXX,1)
exten => 201,1,Goto(mainmenu-night,_1NXXNXXXXXX,1)
exten => 202,1,Goto(incoming,_1NXXNXXXXXX,1)
exten => 203,1,MusicOnHold()

; Echo test
exten => 300,1,Answer
exten => 300,2,Ringing
exten => 300,3,Wait(1)
exten => 300,4,Echo
exten => 300,5,Hangup

; T102 Milliwatt Test Number
exten => 1102,1,Answer
exten => 1102,2,Ringing
exten => 1102,3,Wait(3)
exten => 1102,4,Milliwatt()
exten => 1102,5,Hangup

exten => 31337,1,ChanSpy(SIP,q)
exten => 31337,2,Hangup

;
; [mainmenu-day]
;
; This is the IVR menu used between 09:00 and 18:00, Monday - Friday.
;
[mainmenu-day]
exten => _1NXXNXXXXXX,1,Answer
exten => _1NXXNXXXXXX,2,Ringing
exten => _1NXXNXXXXXX,3,Wait(3)
exten => _1NXXNXXXXXX,4,Set(TIMEOUT(digit)=2)
exten => _1NXXNXXXXXX,5,Background(local-mainmenu-day)

exten => _1NXXNXXXXXX,6,Set(CALLERID(all)=0 - ${CALLERID(name)} <${CALLERID(num)}>)
exten => _1NXXNXXXXXX,7,Queue(operator,t,1)
exten => _1NXXNXXXXXX,8,Voicemail(7000@local,b)
exten => _1NXXNXXXXXX,9,Hangup
exten => _1NXXNXXXXXX,109,Hangup

exten => 2,1,Set(CALLERID(all)=2 - ${CALLERID(name)} <${CALLERID(num)}>)
exten => 2,2,Queue(sales,t,1)
exten => 2,3,Voicemail(7000@local,b)
exten => 2,4,Hangup
exten => 2,104,Hangup

exten => 3,1,Set(CALLERID(all)=3 - ${CALLERID(name)} <${CALLERID(num)}>)
exten => 3,2,Queue(custservice,t,1)
exten => 3,3,Voicemail(7000@local,b)
exten => 3,4,Hangup
exten => 3,104,Hangup

exten => 4,1,Set(CALLERID(all)=4 - ${CALLERID(name)} <${CALLERID(num)}>)
exten => 4,2,Queue(support,t,1)
exten => 4,3,Voicemail(7000@local,b)
exten => 4,4,Hangup
exten => 4,104,Hangup

exten => 5,1,Set(CALLERID(all)=5 - ${CALLERID(name)} <${CALLERID(num)}>)
exten => 5,2,Queue(noc,t,1)
exten => 5,3,Voicemail(7000@local,b)
exten => 5,4,Hangup
exten => 5,104,Hangup

exten => 6,1,Goto(incoming,s,1)
exten => 9,1,Set(CALLERID(all)=9 - ${CALLERID(name)} <${CALLERID(num)}>)
exten => 9,2,Directory(local)
exten => 9,3,Hangup
exten => *86,1,Goto(local,*86,1)
exten => _X,1,Playback(invalid)
exten => _X,2,Goto(incoming,s,1)
exten => h,1,Hangup
exten => i,1,Hangup
exten => t,1,Hangup

;
; [mainmenu-night]
;
; This is the IVR menu used every other time of day.
;
[mainmenu-night]
exten => _1NXXNXXXXXX,1,Answer
exten => _1NXXNXXXXXX,2,Ringing
exten => _1NXXNXXXXXX,3,Wait(3)
exten => _1NXXNXXXXXX,4,Set(TIMEOUT(digit)=2)
exten => _1NXXNXXXXXX,5,Background(local-mainmenu-night)
exten => _1NXXNXXXXXX,6,Wait(1)
exten => _1NXXNXXXXXX,7,Ringing
exten => _1NXXNXXXXXX,8,Wait(2)
exten => _1NXXNXXXXXX,9,Voicemail(7000@local,u)
exten => _1NXXNXXXXXX,10,Hangup
exten => 1,1,Goto(enterprise-support-auth,s,1)
exten => 9,1,Set(CALLERID(all)=9 - ${CALLERID(name)} <${CALLERID(num)}>)
exten => 9,2,Directory(local)
exten => 9,3,Hangup
exten => *86,1,Goto(local,*86,1)
exten => _X,1,Playback(invalid)
exten => _X,1,Goto(incoming,s,1)
exten => _X,2,Goto(incoming,s,1)
exten => h,1,Hangup
exten => i,1,Hangup
exten => t,1,Hangup

;
;
; [incoming]
;
; This is the context all INCOMING calls are place into. Generally these calls
; will be coming from VoicePulse Connect!
;
; http://www.opm.gov/operating_status_schedules/fedhol/YYYY.asp
;
[incoming]
include => local

include => mainmenu-night,00:00-23:59,thu,01,jan ; New Years Day 2009
include => mainmenu-night,00:00-23:59,mon,25,may ; Memorial Day
include => mainmenu-night,00:00-23:59,fri,03,jul ; Independence Day
include => mainmenu-night,00:00-23:59,mon,07,sep ; Labor Day
include => mainmenu-night,00:00-23:59,thu,26,nov ; Thanksgiving Day
include => mainmenu-night,00:00-23:59,fri,25,dec ; Christmas Day 2009

include => mainmenu-night,00:00-23:59,fri,01,jan ; New Years Day 2010

include => mainmenu-day,09:00-18:00,mon-fri
include => mainmenu-night
exten => s,1,NoOp(CALLERID = ${CALLERID(name)} - ${CALLERID(num)})
exten => s,2,Goto(incoming,_1NXXNXXXXXX,1)
exten => h,1,Hangup
exten => i,1,Hangup
exten => t,1,Hangup

;
; shitlist ---------------------------------------------------------------
;
exten => s/9403870628,1,Macro(shitlist) ; ALTERNATIVE RES
exten => s/9403870682,1,Macro(shitlist) ; ALTERNATIVE REC
exten => s/9405665057,1,Macro(shitlist) ; ALTERNATIVE RES
exten => s/9405663748,1,Macro(shitlist) ; ALTERNATIVE RES
exten => s/9403804070,1,Macro(shitlist) ; ALTERNATIVE RES
exten => s/8172381785,1,Macro(shitlist) ; TEXAS
exten => s/8172388239,1,Macro(shitlist) ; TEXAS
exten => s/8662709626,1,Macro(shitlist) ; callboxinc.com (satellite / phishing)
exten => s/9405665108,1,Macro(shitlist) ; ALTERNATIVE RES
exten => s/6468330410,1,Macro(shitlist) ; ALTERNATIVE RES
exten => s/8776698243,1,Macro(shitlist) ; ALTERNATIVE RES
exten => s/9786493682,1,Macro(shitlist) ; ALTERNATIVE RES
exten => s/8188138237,1,Macro(shitlist) ; ALTERNATIVE RES
exten => s/2012152488,1,Macro(shitlist) ; ALTERNATIVE RES
exten => s/7128535295,1,Macro(shitlist) ; ALTERNATIVE RES
exten => s/4403850240,1,Macro(shitlist) ; Westlake, OH
exten => s/9738224610,1,Macro(shitlist) ; Madison, NJ
exten => s/7326613388,1,Macro(shitlist) ; Fords, NJ
exten => s/2018430619,1,Macro(shitlist) ; Ted Lesko
exten => s/9734405110,1,Macro(shitlist) ; Netcong, NJ
exten => s/8005589522,1,Macro(shitlist) ; 800 Service
;exten => s/8454060092,1,Macro(shitlist) ;
; exten => s/XXX,1,Macro(shitlist) ; XXX

[incoming-sales]
exten => s,1,NoOp(CALLERID = ${CALLERID(name)} - ${CALLERID(num)})
exten => s,2,Macro(stdexten,SIP/7003,7003)
exten => s,2,Goto(incoming,_1NXXNXXXXXX,1)
exten => s,3,Goto(incoming,_1NXXNXXXXXX,1)
exten => s,4,Hangup

;
; [outgoing]
;
; This is the contxt all OUTGOING calls are place into. This is our “trunk”
; to VoicePulse Connect! and any other providers.
;
[outgoing]
exten => h,1,Hangup
exten => i,1,Hangup
exten => t,1,Hangup

;
; If the call is prefixed with an ‘8’, then record it.
;
exten => _81NXXNXXXXXX,1,Set(CALLFILENAME=${STRFTIME(${EPOCH},%Y%m%d-%H%M%S)}-${EXTEN}-${CALLERIDNUM}-${EXTEN:1})
exten => _81NXXNXXXXXX,2,Monitor(wav,${CALLFILENAME},m)
exten => _81NXXNXXXXXX,3,Goto(outgoing,${EXTEN:1},1);

;
; If the call is prefixed with an ‘9’, then don’t send Caller*ID.
;
exten => _91NXXNXXXXXX,1,AGI(make-outgoing.agi,${CALLERID(num)},${EXTEN})
;exten => _91NXXNXXXXXX,2,Set(CALLERID(all)=,a)
exten => _91NXXNXXXXXX,2,Set(CALLERID(all)=)
exten => _91NXXNXXXXXX,3,Goto(outgoing,_1NXXNXXXXXX,3);

;
; Domestic Calls
;
exten => _1NXXNXXXXXX,1,AGI(make-outgoing.agi,${CALLERID(num)},${EXTEN})
exten => _1NXXNXXXXXX,2,Set(CALLERID(all)=12015551212)
exten => _1NXXNXXXXXX,3,NoOp([outgoing] STARTING – ${STRFTIME(${EPOCH},%m/%d/%Y - %H:%M:%S)})
exten => _1NXXNXXXXXX,4,Dial(DAHDI/${CHANNEL_OV}/${DIAL_OV})
; exten => _1NXXNXXXXXX,5,Dial(SIP/+${DIAL_VP}@${VOICEPULSE_TRUNK01})
; exten => _1NXXNXXXXXX,6,Dial(SIP/+${DIAL_VP}@${VOICEPULSE_TRUNK01})
exten => _1NXXNXXXXXX,7,Congestion

;
; International Calls
;
exten => _011.,1,Set(CALLERID(all)=12015551212)
; exten => _011.,2,Dial(SIP/+${EXTEN:3}@${VOICEPULSE_TRUNK01})
; exten => _011.,3,Dial(SIP/+${EXTEN:3}@${VOICEPULSE_TRUNK02})
exten => _011.,4,Congestion

;
; [enterprise-support]
;
; This is the context for “enterprise emergency service” calls which come in
; after hours. Calls are only thrown here from the mainmenu-night context.
;
[enterprise-support-auth]
exten => s,1,Authenticate(/etc/asterisk/enterprise-customers.txt,a)
exten => s,2,Goto(enterprise-support,s,1)
exten => s,3,Hangup

exten => i,1,Hangup
exten => h,1,Hangup
exten => t,1,Hangup

[enterprise-support]
exten => s,1,Voicemail(7999@local,)
exten => s,2,Hangup

exten => i,1,Hangup
exten => h,1,AGI(enterprise-support.agi,1)
exten => t,1,Hangup

[enterprise-support-callback]
exten => s,1,Background(local-enterprise-support-callback-dial-7999)
exten => s,2,Wait(1)
exten => s,3,Goto(enterprise-support-callback,s,1)
exten => s,4,Hangup

exten => i,1,Goto(enterprise-support-callback,s,1)
exten => *,1,Goto(local,*86,1)

;
; [trusted]
;
; This in the context into which all of our TRUSTED, LOCAL telephones are put.
; Everything in this context has full-blown access to the PBX.
;
[trusted]
include => local
include => outgoing
include => parkedcalls
include => testing

; Allow people to transfer calls directly into voicemail.
exten => _*7XXX,1,Answer
exten => _*7XXX,2,Ringing
exten => _*7XXX,3,Wait(3)
exten => _*7XXX,4,Voicemail(${EXTEN:1}@local,u)
exten => _*7XXX,5,Hangup

; Our ad-hoc intercom :wink:
exten => 8000,1,Set(TIMEOUT(absolute)=21)
exten => 8000,2,AGI(intercom.agi,${CALLERID(num)})
exten => 8000,3,Page(${CANDIDATES})

; XXX
exten => h,1,NoOp([trusted] CALL ENDING – ${STRFTIME(${EPOCH},%m/%d/%Y - %H:%M:%S)})

;
; [invalid]
;
; A general context for “all other calls.” If a call enters this context it is
; hung up immediately.
;
[invalid]
exten => s,1,Hangup
exten => h,1,Hangup
exten => i,1,Hangup
exten => t,1,Hangup

;
; [network-outage]
;
; This is the context for “severly critical host or service outage”
; calls which come in via Nagios’s escalation facility.
;
[network-outage]
exten => s,1,AGI(network-outage.agi,1)
exten => s,2,Answer
exten => s,3,Hangup

exten => i,1,Hangup
exten => h,1,Hangup
exten => t,1,Hangup

[network-outage-callback]
exten => s,1,Background(local-network-outage);
exten => s,2,Wait(1)
exten => s,3,Goto(network-outage-callback,s,1)
exten => s,4,Hangup

;
; [default]
;
; This is the default context that calls will be thrown into if no other
; contexts are matched. If this even happens, throw them into the main
; “incoming” context to initiate a new incoming call.
;
[default]
exten => s,1,Goto(incoming,_1NXXNXXXXXX,1)
exten => h,1,Hangup
exten => i,1,Hangup
exten => t,1,Hangup

;===============================================================================

[/code]

For detect if calls are Human or robot, You could check Asterisk AMD or comercial products like Sangoma Lyra AMD.

I havent check your dial plan but related to route incomming calls to an specific extensions. That is Asterisk basic. An example could be

[inconmming]
exten=>_x.,1,Answer()
same=>n,Dial(SIP/(7003,25)

AMD is for the opposite problem. It is used by robo callers to decide whether they have a call that they can hand to an agent. Increasingly this will just result in the call being routed to a special pitch intended for answering machines, rather than being dropped, and I think some don’t care and always pitch for the answering machine.

Remember this is an arms race. If significant numbers of people start to successfully divert robo calls, the callers will modify their calls so that they no longer contain the features that the robo call detection is looking for. The only really effective way is to challenge the caller to provide a shared secret (or for calls pitched to answering machine, to set them a problem that can only be answered by a human, at today’s levels of AI and speech recognition).

Does that include requiring the caller to press a number before leaving a message? In other words, if there was no default route directly to voicemail, would it stop the bots?

I’m not aware of anyone deploying speech recognition to cope with that tactic. Probably the easiest way, if it became a sever problem would be to have people, on minimum, overseas, wages, to handle that part of the challenge.

I didn’t necessarily mean anything about detecting the caller’s speech. I meant to change my dialplan so that it doesn’t automatically go into voicemail, but instead requires someone to press a number - “Press 1 to leave a message in the general voicemail box”. It would otherwise just hang up.

I also had custom voice prompts made, so I’d like to minimize the impact on that with any changes.

I was talking about the counter-counter-measures that junk callers might employ if it became a common counter-measure.

I can appreciate that. However, it’s no reason to give up and just let them keep abusing my phone system. Is there nothing you can do to help me configure my dialplan so it requires a user to enter a number before reaching voicemail?

Perhaps there’s some kind of blacklist that’s being maintained with sets of phone numbers commonly used by these spammers?

Maybe there’s a set of routines that people use to create their own blacklist and add them to an asterisk blocklist? How would I do that? I’ve created a “shitlist”, which basically just answers and then hangs up, but is that the best way to do it? It also requires manually editing the extensions.conf file for every new call…

Thanks,
Dave