CallerID Superfecta - when sources return words other than SPAM

 Executing WhoCalled UK
Searching https://who-called.co.uk/Number/02031291891 ... 
Average Rate: Harassing 
Number of Searches: 653
Site returned unexpected rate of Harassing , doing nothing
result  took 0.5374 seconds.

Just wondering how I can also act on ‘harassing’ or ‘dangerous’ - not just SPAM?

Thanks!

See that space after the Harrassing? That is preventing it from matching. Locate the file:
/var/www/html/admin/modules/superfecta/sources/source-WhoCalled_UK.module

and change this line:

		switch (strtolower($average_rate)) {

to this:

		switch (strtolower(trim($average_rate))) {

If that works, then open a bug ticket at http://issues.freepbx.org/ or code and submit a fix for it. Code is here:
superfecta/sources/source-WhoCalled_UK.module at master · FreePBX/superfecta · GitHub

1 Like

hmmm, massively impressed with the speedy response, but it doesn’t seem to have helped.

e.g.

 Executing WhoCalled UK
Searching https://who-called.co.uk/Number/02038078300 ... 
Average Rate: Dangerous 
Number of Searches: 67
Site returned unexpected rate of Dangerous , doing nothing
result  took 0.3902 seconds.

having said that, the code for the debug routine appears to be different to that of the regular routine, so maybe it’s fixed for actual lookups just not for debug lookups?

 if (isset($matches[1])) {
                        $average_rate = trim($matches[1]);
                        $this->DebugPrint("Average Rate: ".$average_rate);

Having now spent more than 10 seconds looking at the code, I realize you were sent on a goose chase. Revert the first change and try this hack:

Locate this line:

$pattern = '~<div class="textColumn">Average rate:</div>.*?<div class="dataColumn">(.+?)</div>~s';   // working 2017-10-21

change to this:

$pattern = '~<div class="textColumn">Average rate:</div>.*?<div class="dataColumn"><span class=".*?">(.+?)</span></div>~s';

:smiley:

That seems to have done it,

 Executing WhoCalled UK
Searching https://who-called.co.uk/Number/01625800730 ... 
Average Rate: Dangerous
Number of Searches: 31,384 🔥
Number flagged as Dangerous, but comment/search threshold not met
result  took 1.0968 seconds.

But god only knows how many more searches beyond 31,384 a number would need before it’s ‘truly’ dangerous.

Thanks!

You have the threshold disabled in Superfecta. Please file a bug report on this and link to this thread. Continue testing if you can for the other cases.

hmm, Superfecta Globally I have spam interception turned on, my spam threshold is set to one.
Who-Called specifically I have comment number set to ‘1’ and search number set to ‘10’ - is there somewhere else to enable a threshold?

Beginning to think you are the first person to test this module. Add the threshold bug(s) to the same ticket, looks simple but requires time I don’t have at the moment.

Ticket: https://issues.freepbx.org/browse/FREEPBX-20323

Fixed (I think) and ready for testing:
https://git.freepbx.org/projects/FREEPBX/repos/superfecta/raw/sources/source-WhoCalled_UK.module?at=refs%2Fheads%2Fbugfix%2FFREEPBX-20323

edit - now published to Superfecta ver. 14.0.21

1 Like

Amazing stuff, Lorne - thanks - and bravo. Looks like whoever created that WhoCalled UK mini module can’t have tested it?? Anyway it’s brilliant it works now, as none of the other UK spam call modules are any good (as in; their databases)

 Executing WhoCalled UK
Searching https://who-called.co.uk/Number/01625800730 ... 
Average Rate: Dangerous
Number of Searches: 31,537 🔥
Search Threshhold : 10
Number of Comments: 209
Comment Threshold : 1
Number flagged as Dangerous, comment/search threshold met, setting call as SPAM
result  took 0.9996 seconds.

Call detected as spam, would send call to: from-did-direct,27,1
This scheme would set the caller id to: SPAM

Returned Result would be:SPAM
result took 5.8501489162445 seconds
1 Like

This module, like most Superfecta modules, doesn’t rely on an API, but actually scrapes the HTML for the relevant values. As such, even minor formatting changes on the page can break the integration. The users of the modules have to alert us (or code a fix) when this happens.

2 Likes

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