freepbx / superfecta Goto Github PK
View Code? Open in Web Editor NEWProvides simultaneous use of, and complete control over multiple caller id data sources.
Home Page: http://www.freepbx.org
License: GNU General Public License v2.0
Provides simultaneous use of, and complete control over multiple caller id data sources.
Home Page: http://www.freepbx.org
License: GNU General Public License v2.0
requested by user dgruhin starting here: http://pbxinaflash.com/forum/showthread.php?p=73505#post73505
I added another quick and dirty MySQL search that the OP tested and says is good, and I committed the change to 2.2.5.x branch.
In the process I noticed a few things that probably should change:
PIAF post here: http://pbxinaflash.com/forum/showthread.php?t=11594
Is it feasible to give users the ability to return a custom field in addition to the 'cn'
Added new UK spam only lookup source - ReversePhoneBooks.co.uk with b961027
No names are returned for this source, it only sets the SPAM flag.
After spending a few hours with the code in the callerid.php class I really think we need to make two extended classes called 'multifecta' and 'superfecta'. If the user selects superfecta use the superfecta base, if they chose multifecta then use multifecta base.
These new extended classes wouldn't affect any of the modules (As the modules would never be calling these classes directly anyways) or what we are doing now in terms of the superfecta_base class. It would just help to separate and sort code from the mind boggling-ness of the current stuff. It's just really hard to follow
Whilst porting Asterisk_Phonebook to v3.x I found the code calls
$name = $astman->database_get('cidname',$thenumber);
Which has a requirement for php-asmmanager.php, I am not sure how to resolve this.
I looked at config.php, but I am not sure we want to include this for every source.
I uploaded a minor revision to the Asteridex lookup source on Sept 1, and is ready to be pushed.
Question:
When a user updates a source or adds a new source from the repo should superfecta also try to download and update superfecta_base.php? (doing an MD5 checksum between the online repo and the downloaded one to make sure there are no glitches)
There is a lot of common code to validate the DDI passed in the different lookup sources especially UK and US variants.
US sources have a static NPA list, and UK sources use a STD list to validate the number.
Can we abstract this code to a common function/base class member function for v3.0 e.g
function isValidNumber(DID, Country)
{
}
Debug works for number lookup, and the scheme is correct.
When a call comes in the CID is invalid.
"Scheme Does not Exist!" <+441234567890>
I have multiple schemes for testing different lookups.
If I set the lookup scheme to "ALL" in "Incoming Route" results are not being returned.
Setting the lookup source to the first one in my list e.g. "LDAP" returns results.
Testing PhoneLookup_UK with number 01234567890 does not set SPAM flag with multifecta.
The same number works with single and pcntl.
Brief exchange here: http://pbxinaflash.com/forum/showthread.php?t=11019
It boils down to a system with lots of DID's where he wanted only one to be processed in a particular way, which meant defining schemes with lots of DID's. A temporary solution was proposed, where a lookup source was created to artificially create a CNAM so that no further processing would take place. I have uploaded source-Abandon_lookup.php to the 2.2.5.x branch for this.
The better solution IMO is to add a case in the rules processing for excluding a number or rule, perhaps by enclosing in (). So if I had a rule like (15554443333), instead of matching the number, it would exclude that number (or rule) and proceed to the next rule.
Thoughts?
On occasion you see posts from people who want to display the DID for an incoming call. It occurs to me that it might be useful if Superfecta could do this. It would be useful for testing too.
We should eventually remove all functions from callerid.php and move them into base.
Lets start some discussion on what we do next. Do we release 2.2.5? do we wait? What do you guys think
After exchanging posts about debug levels I propose the following
The base class functions have been updated to support the concept of a debug level rather than a boolean value.
isDebug(2)
will return true if the verbosity is 2 or more.
DebugPrint("some debug string", 3)
will only display when debug level is 3 or more.
Rather than hardcoding 1,2,3 as levels I think we need some constants/defines
I am not sure what the namimg should be, how about
The debug verbosity needs to be exposed in the freepbx GUI with a default of DEBUG_LEVEL_1.
We also need to be able to set the debug level for CLI and via URL.
If the lookup source sets $this->spam to true, the result does not have the spam text applied.
Trying 08450044237 with Telepest.co.uk returns
Searching Telepest.co.uk ... SPAM caller
Looking up CNAM ... 'Toucan Claims '
result took 0.2265 seconds.Returned Result would be: Toucan Claims
the result should be **SPAM:**Toucan Claims
Installed on FreePBX 2.8, every debug number gives this output:
Strict Standards: Non-static method DB::connect() should not be called statically in /var/www/html/admin/modules/superfecta/config.php on line 26
Strict Standards: Non-static method DB::parseDSN() should not be called statically in /usr/share/pear/DB.php on line 520
Strict Standards: Non-static method DB::isError() should not be called statically in /usr/share/pear/DB.php on line 557
Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/pear/DB.php on line 594
Strict Standards: Non-static method PEAR::isError() should not be called statically in /var/www/html/admin/modules/superfecta/config.php on line 27
Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/pear/PEAR.php on line 275
Notice: Undefined variable: astman in /var/www/html/admin/modules/superfecta/bin/callerid.php on line 55
Fatal error: Call to a member function connect() on a non-object in /var/www/html/admin/modules/superfecta/bin/callerid.php on line 55
If I call callerid.php from my browser e.g.
http://my.pbx/admin/modules/superfecta/bin/callerid.php?thenumber=01217777777
the result is "No Scheme Assigned/Known!"
The scheme needs to be passed e.g.
http://my.pbx/admin/modules/superfecta/bin/callerid.php?thenumber=01217777777&scheme=base_UK
Can we not try all schemes if not defined ?
I had some ideas about caching and spam, originally discussed here: http://projects.colsolgrp.net/issues/456 summarized as follows:
One issue is the spam prefix, if a call is determined to be spam and the spam prefix is applied, then the CNAM is cached with the spam prefix. It is possible for a subsequent call to come in, get the CNAM from the cache and also be determined to be spam and the prefix is applied again and re-cached resulting in a CNAM of "spam:spam:spam: ...". I believe that the spam status should be cached as a separate variable from CNAM. ukstevef may have fixed this already, pls confirm
Another issue is automated report back. I don't have much enthusiasm for the concept myself, but if it is eventually implemented, there will need to be a mechanism that prevents cached data from reporting back to the same source it came from, which means that the cache will need to keep track of the successful lookup source.
Line 246 hard codes a : (colon) between the spam prefix and the CNAM, which I don't agree with. If the user want a colon to separate the two, they can put it in the spam prefix themselves. The default spam text can include the colon.
Discovered problem if using spam scoring and multiple schemes. Looks like line 276 (from earlier ver may be different now) will prepend the spam prefix to the string $first_caller_id regardless of whether a valid CNAM is found or not. This will not allow the next scheme to be processed since $first_caller_id must equal "" to continue. I am getting calls in my logs that look like this "SPAM:" because no valid CNAM was found in the first scheme with spam prefixes enabled. Need to incorporate a check so that spam text is only prepended to a found $first_caller_id. Thinking this may be important in case of a false spam positive.
Another thought on spam scoring -- once a call is determined to be spam, the $spam boolean is set as true, Superfecta should not do any more spam scoring checks to minimize delay.
To which Jkiel replied:
Good idea, however it will require editing each spam source -- and if that is to be done, would a cumulative spam score be worth anything? Say you have 3 spam sources, and each one scores relatively low for a given number -- would adding the score of all of them together, then allowing callerid.php decide if it's high enough to mark the call as spam rather than the spam source, be a bad move?
Ka'Plah! I got a live update today for the first time in MONTHS! Numberguru.
I tried a handful of numbers on the revised code, and got "not found" for all of them. To make sure I was using numbers that are available on Numberguru, I went to the website and tried to do a lookup manually. I was challenged with 2 captchas before it would yield a result. I think the days are numbered for this lookup
-Google Phonebook [Reason: http://www.google.com/support/forum/p/Web%20Search/thread?tid=5a68b203a44c073e&hl=en]
Canpages has started giving out CNAM for numbers that are close to the number being looked up. This is giving false hits and making it almost useless.
example reverse lookup 9028903290 with this url: http://www.canpages.ca/rl/search.jsp?lang=0&ty=PH&fi=save&val=9028903290&fi=save
There is no definite match, but yields 3 results that are close. At the moment, superfecta is grabbing the first one and using it as CNAM
Can someone please summarize how the new live update works. I understand the reasoning for changing, something about github and date/time.
I know that sources.xml is involved, does this file get changed manually or is is generated somehow. Does the pbx copy of sources.xml get updated when you do a liveupdate or when you update a source? It didn't when I just updated numberguru, but it seems to me that it should have.
Regarding issue #24, the system would not let me add a comment because the issue has been closed, and I don't have permission to reopen it. Feel free to move this comment there (if you can do that), or tm1000, you can just close it after you've read it (and even delete it if you like), but I did want to just say this:
The TelcoData module does not need a NPA check, at least not the usual one for USA and Canada NPA's. Because...
It will return a valid result for just about ANY NPA in a NANP country. Try giving it a number in a Caribbean country, it will give you exchange (or city) name and country.
If you happen to give it an NPA-NXX that it does not have in its database, it will return an XML result that tells you that (and the script looks for that).
So, the only reason for a NPA check would be to exclude Toll-Free NPA's (which it already does) and NPA's that are not valid anywhere in the NANP (BUT those probably won't show up in a Caller ID that you receive anyway, unless someone is spoofing the CID filed, so why bother? And if someone IS spoofing, do you really care if they have to wait an extra second to connect?).
Review http://projects.colsolgrp.net/versions/show/91 and see if there is anything we should get out of that list.
If any of you get any spare time I suggest your read this:
I have been considering changing the structure of our repo to this (to use tags and such)
On reflection I thought perhaps this should be made a separate issue.
The problems were observed under these conditions:
FreePBX Distro with FreePBX 2.9.0.7
Caller ID Superfecta 2.2.4 or 2.2.5
Google Voice module installed but nothing done to configure it.
Effects noted:
With 2.2.4, attempting to do a Debug test results in message about FreePBX version being 2.9 and short flash of spinner, but no results returned.
With 2.2.5, the database sources are not shown on the Superfecta page, and attempting to do a Debug test results in short flash of spinner, but no results returned.
If this branch is no more that just a holdover from colsolgrp, I suggest that it be removed
I have been using a modified TelcoData module that does not limit you to area codes in the US and Canada. TelcoData will return valid information on just about any NANP exchange (even in the Caribbean) and if it can't it will tell you, so my modification takes advantage of that fact. It also runs slightly faster. Here are two side by side runs (had both sources enabled) of mine vs. the one provided in 2.2.5:
Mine:
Searching Telco Data ... 'HOUGHTONLK, MI'
result took 0.0921 seconds.
The one provided in 2.2.5:
Searching Telco Data ... 'HOUGHTONLK, MI'
result took 0.1141 seconds.
This module has not been modified to work with 2.2.5 in any way, but it does seem to work with it. Feel free to use it if you like, or modify it as you see fit (but please don't reinstate the US/Canada area code tables, they really are NOT necessary with TelcoData). I should also note that I simply started with an earlier version of the TelcoData module and made some edits - I don't know PHP so there is no way I could have written this from scratch!
//this file is designed to be used as an include that is part of a loop.
//If a valid match is found, it should give $caller_id a value
//available variables for use are: $thenumber
//retreive website contents using get_url_contents($url);
//configuration / display parameters
//The description cannot contain "a" tags, but can contain limited HTML. Some HTML (like the a tags) will break the UI.
$source_desc = "http://www.telcodata.com - These listings are generally only return the geographic location of the caller, not a name.";
//run this if the script is running in the "get caller id" usage mode.
if($usage_mode == 'get caller id')
{
$number_error = false;
if($debug)
{
print "Searching Telco Data ... ";
}
//check for the correct 11 digits in US/CAN phone numbers in international format.
// country code + number
if (strlen($thenumber) == 11)
{
if (substr($thenumber,0,1) == 1)
{
$thenumber = substr($thenumber,1);
}
else
{
$number_error = true;
}
}
// international dialing prefix + country code + number
if (strlen($thenumber) > 11)
{
if (substr($thenumber,0,3) == '001')
{
$thenumber = substr($thenumber, 3);
}
else
{
if (substr($thenumber,0,4) == '0111')
{
$thenumber = substr($thenumber,4);
}
else
{
$number_error = true;
}
}
}
// check for short number
if(strlen($thenumber) < 10)
{
$number_error = true;
}
if(!$number_error)
{
$npa = substr($thenumber,0,3);
$nxx = substr($thenumber,3,3);
// check for valid area code (201 or higher)
if ($npa < '201')
{
$number_error = true;
}
else
{
// Check for Toll-Free numbers (including future TF NPA's)
$TFnpalist = array(
"800", "822", "833", "844", "855", "866", "877", "888"
);
if(in_array($npa, $TFnpalist))
{
$number_error = true;
}
}
}
if($number_error)
{
if($debug)
{
print "Skipping Source - Toll Free or International (non-NANP) number: ".$thenumber."<br>\n";
}
}
else
{
$url = "http://www.telcodata.us/query/queryexchangexml.html?npa=$npa&nxx=$nxx";
$value = get_url_contents($url);
// Telcodata will tell us if we have an invalid NPA/NXX
$start = strpos($value, "<valid>");
$valid = substr($value,$start+7);
$end = strpos($valid, "</valid>");
$valid = substr($valid,0,$end);
if ($valid == 'NO')
{
if($debug)
{
print "Skipping Source - Telcodata reports invalid NPA/NXX: ".$thenumber."<br>\n";
}
}
else
{
$start = strpos($value, "<ratecenter>");
$ratecenter = substr($value,$start+12);
$end = strpos($ratecenter, "</ratecenter>");
$ratecenter = substr($ratecenter,0,$end);
$start = strpos($value, "<state>");
$state = substr($value,$start+7);
$end = strpos($state, "</state>");
$state = substr($state,0,$end);
$value = $ratecenter.", ".$state ;
if(strlen($ratecenter) > 1)
{
$caller_id = strip_tags($value);
}
else if($debug)
{
print "not found<br>\n";
}
}
}
}
?>
Tony modified Whocalled early last January to give the option to automatically report back if an incoming call was determined to be spam. This code was never released and some effort should be made now before we release as part of 2.2.5
report back starts at line 244. Report back is only done when superfecta determines a call to be spam. There is a check to make sure that report back is not done if the name came from the whocalled source, but no check is done to prevent it from reporting back a CNAM that came from the cache, which could easily have come from a previous whocalled lookup.
MT pointed out another issue that merits some thought too. If an unsophisticated user (or careless guru) combines the whocalled source with a private address book, is it possible to potentially push private or unlisted numbers back to this source. I don't see how exactly this could be the case unless superfecta gets a false spam positive somehow.
Are there any other sources that do report back?
The following need to be converted.
I do not mean any offense to anyone by this
We did this fork because the project manager tshif dropped of the face of the planet and Superfecta wasn't getting updates to any of it's sources, no matter how much was being updated in the repo. I had hoped that this fork would let us release a version of superfecta that would be completely updated with the 7-8 months of updates.
Unfortunately lgaetz is still updating the repo over at colsolgrp. That's fine. I'm ok with that, but that means that the master branch is now out of sync with the repo at colsolgrp and it will start to confuse users because they won't know where to look for updates.
Therefore I say we merge the 3.x branch into master (here on github) and just call this Caller-ID-Superfecta project at github the official 3.x version.
I was not aware of the issue until I read this post: http://pbxinaflash.com/forum/showthread.php?t=11498
Aparently you can receive an inbound call directly to an extension via the extension's DID field and not use an inbound route for the call. No inbound route, means no CID lookup. Has anyone else ran into this? Does Superfecta 3.x address this usage case? The FreePBX ticket referenced on the thread above has a bit of info, but it still looks to be outstanding.
There have been 2 issues lately where an external module broke superfecta operation, the Hotel style wake-up calls module and the GV module. There may well have been others, and it is likely that it will happen again. Is it at all feasible to have some sort of internal superfecta mechanism that will scan the environment it is installed in and report these items to the user? It would have to be live updatable so that as issues are discovered, they could be pushed to users. I suppose that as it evolves, it could be used for checking dependencies, and no doubt other things as well.
By the time I finished typing the paragraph above, I started thinking that such a scanner would be more work than it is worth, but I leave the ticket for comments anyway.
Using PIAF Purple, FreePBX 2.8.
I am not sure that live update is working as expected. I can see the new lookup source for Canda411 has been merged into the master branch, and it looks like the xml file has been edited to include it, but when I click on check for data source updates, Canada411 does not appear on the list of missing sources.
Also, I am thinking that references to the colsolgrp website should be changed to github.
Current version of reversephones.com.au lookup source is not working. I am in PM contact with Atsak over this
as requested here: http://pbxinaflash.com/forum/showthread.php?p=73271#post73271
User requests that lookups be made in accounts first and then the other two if necessary. I suspect this is a personal preference and that perhaps it should be coded such that user is given a mechanism to set their own priority. I am not sure how to do that except a drop down menu with 6 options, is there a more efficient way?
Source code contributed here http://pbxinaflash.com/forum/showthread.php?t=11630
Rather than add a new source, we should extend the existing lookup source.
See this thread: http://pbxinaflash.com/forum/showthread.php?t=11508
User is requesting assistance to create a new lookup source for ConnectWise using the native API and SOAP.
This sometimes happens and I haven't figured out why or what the issue is.....yet.
In V3 should we Return False $caller_id instead of empty for each module when a result isn't found?
The format of the web page has changed - no results are being returned.
For example 01214278888 returns nothing, where previously this was "T O A Taxis"
This looks interesting: http://pbxinaflash.com/forum/showthread.php?t=11649
First identified here: http://pbxinaflash.com/forum/showthread.php?t=10935
Using a CID rule of 0|xx. will not strip the leading 0. Any other leading digit can be stripped with this rule.
I reported a bug to the FreePBX bug tracker (see http://www.freepbx.org/trac/ticket/5296 if you are curious) and was asked to temporarily disable three third-party modules I have installed, of which Superfecta is one. I was surprised to find that there is no "Disable" option for Superfecta - you can only uninstall, and of course if you do that, you lose all your module configurations and also all your inbound routes that use Superfecta as a source get reset to use no Caller ID lookup.
Would it be possible to add a "Diasble" option in Module Administration for debugging purposes?
As the number of data sources grow the list is starting to get unworkable.
Would there be merit in being able to expand/collapse groups of sources ?
Initial thoughts we could do this by region e.g USA, UK, Europe, Other - of course I am well aware of the challenges of defining an all encompassing category naming scheme.
We could add a settings category to help facilitate this.
Another category that would be useful to seperate would be "Post Processing Only" data sources.
Just wanted to bring this up. Right now you can see I'm hosting the downloadable tar-balls for the project. I don't mind doing this at all (I have unlimited bandwidth).
I just wanted to bring this up incase anyone has any objections.
Basically I wrote a small script that generates these packages for me on the fly from the repo (whenever I ask it to do so)
I get the following
Notice: Undefined index: Server_address in /var/www/html/admin/modules/superfecta/bin/source/Send_to_Soundbridge.module on line 43
This also happens with the YAC module as well.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.