Zapateller implementation?


What is the accepted and supported way to implement Zapateller within FreePBX?

I don’t want to force people to enter their phone number in order to complete the call, such as is required by the Privacy Manager.

Instead, I would like to just play the SIT and then go ahead and put the call through.

Does FreePBX support this?

I also tried putting this:

exten => s,1,Zapateller()

… and this:

exten => s,1,Zapateller(nocallerid)

… in the [app-blacklist-check-custom] context in extensions_custom.conf and reloaded the dialplan and that didn’t do anything.

(And yes, multiple searches with Google and the search engine for this forum did not yield an answer. And, the zapateller module is loaded.)


The way I use it, is to use inbound routes. If I want to block a number or area code, I use it and push them to Zapatella. Works great on my setup, and it is easy to set up too.

I don’t see any way in the inbound routes config page to push anything to Zapateller. I don’t want to block anybody, I only want to try to cut down a little bit on all the telemarketing calls, do-not-call lists notwithstanding. If SIT and Zapateller can help cut that down, I’m all for it, just can’t see a way to use Zapateller within FreePBX, and the Zapateller lines I cited above, inserted in the [app-blacklist-check-custom] context in extensions_custom.conf, don’t have any effect.

It is fairly simple to do, and you can configure individual numbers, or area codes as I mentioned.

Here is how…

Go to inbound routes / add a description like 888_Block / under DID Number, enter in the DID you want to monitor (10 digit DID) / Under CallerID Number, and this is the tricky part… Enter in the following without the quotes “_888NXXXXXX”, If you’re wanting to block a complete phone number then you will need to do either “_15556667777”, or “_5556667777” depending on if you’re stripping the “1” or not. Next, at the bottom you will see set destination, set it as follows… “Terminate Call” and “Play SIT tone (Zapateller).”

Doing that, will send said number, area code or what ever you set direct to Zapatella. These will show up in your CDR logs as sent to Zapatella. To test the function, block your own cellphone and experiment with the numbers.

What I like to do, and I can tell you this… My junk calls have gone down by a good 99%, I do this by looking at the incoming numbers, I look for a pattern to the area codes and ask myself, Self… Do I really need to receive calls from this area code? do I need to receive calls from 800 numbers? or 866 numbers? Do I need this 10 digit spam number calling me? Trust me, it works, it works very well for me. I can’t even tell you the last time my phone rang with a junk call… lol

Let me know if you get stuck, I will do some screens for you or something.

Another great thing about Inbound Routes, I stop all calls after 9:00pm coming in, but I allow certain numbers to bypass the nighttime settings. I use inbound routes to look at the phone number and route that number direct to a certain extension or ring group.

The possibilities are endless, I am still finding more ways to have fun with this system… I LOVE IT. lol

Thanks, deanot, I tried what you described and in fact it works well. However I don’t want to terminate the call… I want to play the SIT and then let the call go thru. Hopefully, for robo-callers that honor SIT, that will terminate the call before I get it, and for people who just like to block their caller IDs (like my wife’s friend, who is absolutely paranoid about caller ID and adamantly refuses to even consider dialing *67 first when she calls us so the PBX will see her caller ID and let her thru), they’ll still get thru with minimal interruption.

I don’t see another way to invoke SIT within FreePBX other than call termination. I don’t mind sticking some stuff into places like the [app-blacklist-check-custom] context in extensions_custom.conf, but that doesn’t seem to work… the statements I put in there don’t seem to get executed.

Send your inbound calls first to an announcement that is a copy of /var/lib/asterisk/sounds/en/ss-noservice.

Good afternoon, dicko.

OK, I guess I didn’t give enough detail. The inbound calls go to an IVR, and there doesn’t appear to be a way to prepend an announcement to an IVR other than its configured IVR announcement. I suppose I could prepend ss-noservice to the configured IVR announcement, but…

Ultimately I want the SIT to play only if no caller ID is presented. I am willing to play it unconditionally first, just to make it work, but the ultimate goal is for no-caller-ID only. All day today and most of yesterday spent researching and Googling and RTFM’ing don’t yield any way to do that other than with Zapateller.

Actually, the ultimate, Ultimate goal is to play it on no-caller-ID calls AND on calls from certain area codes like 800 and 888 which are virtually always telemarketing calls. And yet, for the tiny fraction of calls from 800/888 numbers that might not be telemarketing calls, I still want them to go through after playing SIT.

I have spent most of today trying to get extensions_custom.conf to work for this. Basically I took my whole

exten => MYDID,1,Zapateller(nocallerid)
exten => MYDID,Set(__FROM_DID=${EXTEN})
;… copied ALL code from MYDID in extensions_additional.conf

… and it didn’t work, the code in extensions_custom.conf was not detected or executed. I think this is because of something I read somewhere (can’t find it now) that said if a pattern is satisfied in the main context, then any included contexts won’t even be checked, even if they are included before the code in the main context. 'Course in that case, how are we ever supposed to be able to make extensions_custom.conf do anything?

I suggested the inbound calls go to an announcement first, it is up to you to then send it wherever you want.

Wild guess, but perhaps Zapteller() won’t work until you first Answer() the inbound call. If you check the dialplan for blacklist at the Asterisk CLI with:
‘dialplan show app-blacklist-check’

‘s’ => 1. GotoIf($["${BLACKLIST()}"=“1”]?blacklisted) [pbx_config]
2. GotoIf($["${DB_EXISTS(BLACKNAME/${TOUPPER(${CALLERID(name)})})}"=“1”]?blacklisted)
3. Set(CALLED_BLACKLIST=1) [pbx_config]
4. Return() [pbx_config]
[blacklisted] 5. Answer() [pbx_config]
6. Wait(1) [pbx_config]
7. Zapateller() [pbx_config]
8. Playback(ss-noservice) [pbx_config]
9. Hangup() [pbx_config]
Include => ‘app-blacklist-check-custom’ [pbx_config]

You can see that when a call is blacklisted, it first answers the channel and then plays the zapateller tones.

in case it helps the following works here:-


exten => MyDid,1,Zapateller(answer)

to the extent that it answers the call and plays the tones, and then continues as per the inbound route destination.

when i block callerid it sends anonymous which doesnt work with the nocallerid option. (few lines of code could sort this though)

OK, here is what I did, and it almost seems to sort of work…

exten => 6035551234,1,Goto(6035553456,1)
exten => 6035553456,1,Answer()
same => n,GotoIf($["${CALLERID(name)}" = “Private”]?nocid)
same => n,Goto(cid)
same => n(nocid),Zapateller()
same => n(cid),Noop()

I don’t know why the “same => n,Goto(cid)” and the “same => n(cid),Noop()” are needed, but it wouldn’t work without it.

If someone calls on 603-555-3456, it executes the script from that point. If someone calls on 603-555-1234, it jumps to 603-555-3456 and executes the script.

If the caller’s Caller ID shows up as “Private”, he gets a SIT and then the call connection continues. Otherwise, call connection continues without the SIT. So far so good.

Of course people’s blocked caller ID shows up as a lot of things besides “Private”; sometimes “Out of Area”, sometimes “Unavailable”, etc. So, I revised the above code like this:

exten => 6035551234,1,Goto(6035553456,1)
exten => 6035553456,1,Answer()
same => n,GotoIf($["${CALLERID(name)}" = “800 Service”]?nocid)
same => n,GotoIf($["${CALLERID(name)}" = “Out of Area”]?nocid)
same => n,GotoIf($["${CALLERID(name)}" = “Out_of_Area”]?nocid)
same => n,GotoIf($["${CALLERID(name)}" = “Private”]?nocid)
same => n,GotoIf($["${CALLERID(name)}" = “TOLL-FREE”]?nocid)
same => n,GotoIf($["${CALLERID(name)}" = “Unavailable”]?nocid)
same => n,GotoIf($["${CALLERID(name)}" = “unknown”]?nocid)
same => n,Goto(cid)
same => n(nocid),Zapateller()
same => n(cid),Noop()

Doesn’t work. I call in and get nothing, or sometimes I get the SIT followed by call termination.

If ‘GotoIf($["${CALLERID(name)}" = “800 Service”]’ evaluates as false, isn’t the script just supposed to execute the next statement in line, and continue until it finds one it matches, or falls thru to the “Goto(cid)” statement? Doesn’t appear to work that way.

I also tried this:

exten => nocid,1,Zapateller()
same => n,Return

exten => 6035551234,1,Goto(6035553456,1)
exten => 6035553456,1,Answer()
same => n,GosubIf($["${CALLERID(name)}" = “800 Service”]?nocid,1)
same => n,GosubIf($["${CALLERID(name)}" = “Out of Area”]?nocid,1)
same => n,GosubIf($["${CALLERID(name)}" = “Out_of_Area”]?nocid,1)
same => n,GosubIf($["${CALLERID(name)}" = “Private”]?nocid,1)
same => n,GosubIf($["${CALLERID(name)}" = “TOLL-FREE”]?nocid,1)
same => n,GosubIf($["${CALLERID(name)}" = “Unavailable”]?nocid,1)
same => n,GosubIf($["${CALLERID(name)}" = “unknown”]?nocid,1)

Same effect… either a SIT then hangup, or just a hangup. As with the GotoIF version, if “Private” is the only one there, it works, but if more than one GosubIf is there, it does not work.