Conditional call answering

Hello,
I’m new to freePBX and Asterisk.
I set up freePBX on a rPi, connecting to a Fritzbox as sip client.

I’m looking for a solution to prevent the numerous robocalls. Forcing the caller to dial a number to get whitelisted as was proposed in a post here, is a good solution. I would like to go further though and first check the incoming number against a web page, hosting comments on undesired calls.
I managed to create an AGI script which does so but I’m afraid I’m missing some basics.
My plan was to have freePBX check the number and only answer the call , if it’s listed as spam (leaving the call handling to the Fritzbox) but I can’t find an option to do nothing instead of ending a call. This made me wonder if Asterisk will answer the call already before going through the call handling.

Could somebody help me out please?

I can’t think of any reason such a web site would permit automated use without an API Key and payment.

Asterisk won’t answer a call before the callee answers unless you do something that requires an answer, or explicitly answer.

I believe that simple extensions, on FreePBX, work that way, by default.

It’s a protocol violation to not send a final response to a SIP INVITE. Even if you go into such a long wait that the other side CANCELs, there will still be a Request Cancelled final response. It’s not like analogue where doing nothing is indistinguishable from not connected.

I’m assuming you are trying to simulate an analogue phone arrangement, where you could have a phone in parallel with automation that does the screening, and the automation only loops the line if it identifies a known spammer, rather than the TruCall type of arrangement, where the call is only connected through if identified as safe.

It’s for private use only. I use this web site already since month manually, so it should be fine. It’s a good point though and I should add the numbers of that site to a blacklist, which would be checked first.

It’s indeed as you say: I’d like to add the pi like a sip phone in parallel, refusing undesired calls. If this isn’t sufficient, I might add the white listing after button press and route calls through the pi if not whitelisted.
I would like to give this to the grandparents, who get easily tricked by the phone sp(c)amers. It should be possible to disconnect the pi in case of malfunctioning without disturbing the phone system, since I can’t easily maintain the system.

Do I understand you right, that (in my configuration: Astrerisk as sip phone of the Fritzbox) in case the call has not yet been routed to an entity, which would answer the call, hanging up is equivalent to a sip phone not answering and the other connected phones will continue to ring?

I don’t know how the FritzBox handles multiple phones called in parallel. You would have to find out which SIP status codes it accepts as indicating that one particular didn’t want the call, but others might still accept it, assuming that there are any, then give the corresponding hangup cause when calling Hangup().

Or you would have to sit on the call for longer than it would take the grandparents to answer it, before hanging up.

The normal way of doing call screening is like with the TruCall product, namely the screening device is connected between the source and the protected device, not with it in parallel.

You might be able to do so if the Pi act as a FreePBX server by combining the Allowlist Module and Blacklist Module. The Allowlist Module will act as the first filter to block robocalls and then you can use the Blacklist Module to block any additional numbers as desired. You will have plenty of options to route the calls as you like.

@david55
I’ll do some testing to see how the box behaves.

@moussa854
Sounds like those modules would do a large part of what I need. There is one complication though, which I didn’t mention yet: The scammers here often rent number ranges and will choose the caller ID randomly from those. I would need a mechanism to blacklist number ranges, too.

I was thinking now to add numbers and ranges (meaning only the first digits) to a group ‘blacklist’ in the contact manager and use a dynamic route to query the contactmanager_entry_numbers table directly.
One could then do a query like

select from contactmanager_entry_numbers where substr(callerid,1,length(number))=number and ....

The performance would have to be tested.

You might be able to create an inbount route for spesific range and block all the calls comming through this route.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.