Help set up Blacklist database & Ziptel()

I’m wondering if anyone can help me with this problem that I am currently running into.
I am currently running Asterisk 11.13.1~dfsg-2+b1 on a Raspberry Pi3, it is working just fine with very little issues. Please understand that I realize that my implementation below is probably very wrong and not optimized. I am not an expert at all, so flame away.

I have the following in my extension.conf:

[default]																				; Security context
[myvoipms]
;autofallthrough=no																		; If autofallthrough is set, then if an extension runs out of
																						; things to do, it will terminate the call with BUSY, CONGESTION
																						; or HANGUP depending on Asterisk's best guess. This is the default.
																						; If autofallthrough is not set, then if an extension runs out of
																						; things to do, Asterisk will wait for a new extension to be dialed
																						; (this is the original behavior of Asterisk 1.0 and earlier).

[users]																					; Make sure to include inbound prior to outbound because the _NXXNXXXXXX handler will match the incoming call and create a loop
include => stations
include => voipms-inbound
include => voipms-outbound
include => parkedcalls


[macro-RecordOutgoing]												;Mixmonitor context
exten => s/xxxxxxxxxx,1,MixMonitor(${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${CALLERID(num)}.wav,v(3)V(1))			; Record calls for thatguy sent in this syntax
exten => s/1xxxxxxxxxx,1,MixMonitor(${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${CALLERID(num)}.wav,v(3)V(1))			; Record calls for thatguy sent in this syntax
exten => s/911,1,MixMonitor(${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${CALLERID(num)}.wav,v(3)V(1))					; Record call to 911
;exten => s/xxxxxxxxxx,1,MixMonitor(${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${CALLERID(num)}.wav,v(3)V(1))			; Record calls for TEST sent in this syntax
;exten => s/1xxxxxxxxxx,1,MixMonitor(${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${CALLERID(num)}.wav,v(3)V(1))			; Record calls for TEST sent in this syntax
exten => s,1,Goto(voipms-outbound,s,2)

[macro-phone]																									; Macro for all phones on network
exten => s,1,Dial(SIP/${MACRO_EXTEN},40)
exten => s,n,Goto(${DIALSTATUS},1)
exten => ANSWER,1,Hangup()
exten => CANCEL,1,Hangup()
exten => NOANSWER,1,Voicemail(${MACRO_EXTEN}@default,u)
exten => BUSY,1,Voicemail(${MACRO_EXTEN}@default,b)
exten => CONGESTION,1,Voicemail(${MACRO_EXTEN}@default,b)
exten => CHANUNAVAIL,1,Voicemail(${MACRO_EXTEN}@default,u)
exten => a,1,VoicemailMain(${MACRO_EXTEN}@default)		


[stations]
exten => 100,1,Macro(phone)																; Master Bedroom
exten => 101,1,Macro(phone)																; Kitchen
exten => 102,1,Macro(phone)																; Girl's Room
exten => 103,1,Macro(phone)																; Boy's Room
exten => 110,1,Macro(phone)																; Dad's Cell SIP																							
exten => 444,1,VoicemailMain(default)													; Voicemail


[voipms-outbound]
exten => 911,1,Set(CALLERID(all)="X Family" <xxxxxxxxxx>)							; 911 Call
exten => 911,2,Dial(SIP/911@voipms,40)
EXTEN => 911,n,Hangup()

exten => _*67X.,1,Set(CALLERID(num)="0000000000")										; Block CallerID
exten => _*67X.,2,Set(CALLERID(name)="Restricted")
exten => _*67X.,3,Dial(SIP/${EXTEN:3}@voipms,40,M(RecordOutgoing))
exten => _*67NXXNXXXXXX,3,Dial(SIP/1${EXTEN:3}@voipms,40,M(RecordOutgoing))
exten => _*67NXXXXXX,3,Dial(SIP/1928${EXTEN:3}@voipms,40,M(RecordOutgoing))
EXTEN => _*67X.,n,Hangup()

exten => _1NXXNXXXXXX,1,Set(CALLERID(all)="X Family" <xxxxxxxxxx>)				; Set CallerID for outgoing calls
exten => _1NXXNXXXXXX,2,Dial(SIP/${EXTEN}@voipms,40,M(RecordOutgoing))					; Canada dialing plan with option out to Recording to see if needs to be passed to Mixmonitor.
exten => _1NXXNXXXXXX,n,Hangup()

exten => _NXXNXXXXXX,1,Set(CALLERID(all)="X Family" <xxxxxxxxxx>)					; Set CallerID for outgoing calls
exten => _NXXNXXXXXX,2,Dial(SIP/1${EXTEN}@voipms,40,M(RecordOutgoing))					; 10 digit dialing plan and option out to Recording to see if needs to be passed to Mixmonitor.
exten => _NXXNXXXXXX,n,Hangup()

exten => _NXXXXXX,1,Set(CALLERID(all)="X Family" <xxxxxxxxxx>)					; Set CallerID for outgoing calls
exten => _NXXXXXX,2,Dial(SIP/1928${EXTEN}@voipms,40,M(RecordOutgoing))					; 7 digit dialing plan and option out to Recording to see if needs to be passed to Mixmonitor.
exten => _NXXXXXX,n,Hangup()

exten => _011.,1,Set(CALLERID(all)="X Family" <xxxxxxxxxx>)						; International Calls
exten => _011.,2,Dial(SIP/${EXTEN}@voipms,40)											
exten => _011.,n,Hangup()


[voipms-inbound]
;exten => 928xxxxxxx,1,Goto(s,2)														; Inbound context for Voip.ms DID, Goto function continues processing to desired priority
exten => 928xxxxxxx,1,Goto(s,2)															; Inbound context for Voip.ms DID (X), Goto function continues processing to desired priority
exten => 928xxxxxxx,1,Goto(s,2)															; Inbound context for Voip.ms DID, Goto function continues processing to desired priority
exten => s,2,GotoIf(${BLACKLIST()}?blocked,1)											; Telemarketer Blacklist
exten => s/xxxxxxxxxx,2,Goto(thatguy,s,1)												; Exclude thatguy from going to voicemail
;exten => s/xxxxxxxxxx,2,Goto(thatguy,s,1)												; Test extension
exten => s,3,Dial(SIP/100&SIP/101&SIP/102&SIP/103&SIP/110,30)							; Call from VOIP.ms ring these phones if not part of thatguy dialog
exten => s,4,Goto(${DIALSTATUS},1)														; Process to deliver call to voicemail if no answer after 20 secs
exten => NOANSWER,1,Voicemail(105@default,u)
exten => BUSY,1,Voicemail(105@default,b)
exten => CONGESTION,1,Voicemail(105@default,b)
exten => CHANUNAVAIL,1,Voicemail(105@default,u)
exten => a,1,VoicemailMain(105@default)													; Voicemail greeting based on Status for mailbox 105
exten => s,5,Hangup()																	; Hangup the phone 
exten => blocked,1,Playback(tt-allbusy)													; Start recording playback, then Hangup on Blacklisted callers
;exten => blocked,2,Playback(vm-goodbye)
exten => blocked,2,Hangup()																; Hangup the phone 	

[thatguy]
exten => s,1,GotoIfTime(08:00-20:00,*,*,*?call,1)										; Block calls before 8am and after 8pm
exten => s,2,Answer()																	; Answer call to hangup
exten => s,3,Wait(3)
exten => s,4,Hangup()																	; Hangup the phone
exten => call,1,MixMonitor(${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${CALLERID(num)}.wav,v(3)V(1))		; Record calls and timestamp, v(2) adjusts heard volume V(-1) adjusts spoken
exten => call,2,Dial(SIP/103,25)														; Call from thatguy, good time, Dial all phones. Hangup after 25 secs				

What I am trying to do is implement a routine where when a get a call from a Telemarketer or Political Survey I can dial *99 and the last call will be added to the database as a “blacklist” number.

I found a website that explains it, however, I can’t get it to work with my current setup.

I also can’t seem to get the command Ziptel() to work in my extension, can anyone clarify if this is supported by my version of Asterisk?

So any help that can be offered would be greatly appreciated.

“Ziptel” isn’t a standard / included Asterisk application. DAHDI was formerly named “Zaptel,” but was changed years ago (May of 2008):

http://lists.digium.com/pipermail/asterisk-users/2008-May/212009.html

Make an inbound call and post what the cli shows, also run the following command and post here what it shows

database show

Ok, so am I correct that Zaptel (now known as DAHDI) will provide the tone needed to remove my phone number from some telemarketers call lists? If that is the case, can someone point me to the documentation on how to implement this in extensions.conf. This DAHDI looks pretty complicated and doesn’t really address my one concern.

Thank you for pointing me in the right direction though.

I would recommend looking at the DB functions.

Specifically DB_EXISTS
https://wiki.asterisk.org/wiki/display/AST/Function_DB_EXISTS

You should be able to write a GotoIf that tests if the value of ${CALLERID(NUM)} is in your database using that function.

Although Dahdi devices may have tone generation capabilities, you are actually thinking of Zapateller. The tones it generates are not instructions to remove you from marketing databases but mimic the SIT tone sequence that some networks send for non-existent numbers.

You are correct.
Sorry for the confusion.
Is there a way to do this with the version of Asterisk that I am using?

If you don’t have Zapateller you can use Playtones.

https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_PlayTones

Call it as Playtones(sit) to generate a SIT tone.

There is actually more than one SIT. indications.conf probably only has the one used by Zapateller, though.

David FYI Zapateller is hard coded.

Line 118:

if (!res)
        res = ast_tonepair(chan, 950, 0, 330, 0);
if (!res)
        res = ast_tonepair(chan, 1400, 0, 330, 0);
if (!res)
        res = ast_tonepair(chan, 1800, 0, 330, 0);
if (!res)
        res = ast_tonepair(chan, 0, 0, 1000, 0);

This matches what I have in indications.conf for the ‘info’ tone using the ‘us’ zone.

info = !950/330,!1400/330,!1800/330,0

Other countries have different ‘info’ tones so it’s likely best to use playtones if you are outside the US.

1 Like

Awesome, that was what I needed.
Thank you.