CallerID Superfecta - when sources return words other than SPAM


(D E) #1
 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!


(Lorne Gaetz) #2

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:
https://github.com/FreePBX/superfecta/blob/master/sources/source-WhoCalled_UK.module#L93


(D E) #3

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);

(Lorne Gaetz) #4

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';

(D E) #5

: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!


(Lorne Gaetz) #6

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.


(D E) #7

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?


(Lorne Gaetz) #8

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.


(Lorne Gaetz) #9

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


Why didn't superfecta do its thing?
(D E) #10

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

(Lorne Gaetz) #11

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.


(system) closed #12

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