Feature #28
Ability to keep/use valid Caller ID info if received from provider
| Status: | Closed | Start: | 05/03/2009 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | 05/21/2009 | |
| Assigned to: | jacobsj | % Done: | 100% |
|
| Category: | - | |||
| Target version: | Caller ID Superfecta v 2.1.0 |
Description
Original ticket description:
It would be nice if we could select which CNAM source has the ability to override the provider supplied CNAM. For example, you should be able to specify that if a name exists in AsteriDex, this should override the provider CNAM, but if a name exists in AnyWho, this will not override the provider CNAM.
Current description:
We would like to architect a way to retain the Caller ID from TSP if it is valid. Explore various triggers to retain the data, various methods to determine what VALID actually means.
Update: I have renamed this ticket to better reflect the goals as they evolve.
History
Updated by tshif almost 3 years ago
- Status changed from New to Reviewed
- Target version set to Caller ID Superfecta v 2.1.0
This makes sense - lets see if anyone wants to tackle coding it.
Updated by jacobsj almost 3 years ago
I'm not sure this is possible, but I'm also not sure that it isn't.
I believe CNAM information passed into the system by FreePBX will automatically overwrite CNAM that is passed by the provider, even if it's blank.
What you are asking is probably possible, but it may not be able to be done inside of a FreePBX module (or at least I don't know how to do it.)
Updated by boolah almost 3 years ago
Agreed. I actually tried playing around with it myself and couldn't get it. I think it will probably take a significant restructuring of the module in order to get it to work right. It certainly isn't as simple as it would initially seem.
Updated by jacobsj over 2 years ago
Ward Mundy wrote me this:
FreePBX already has answered the call when the CallerID lookup is triggered if I'm not mistaken. This means that the Telco-generated CallerID name should exist in the ${CALLERID} channel variable just as the number is provided in ${CALLERID}. So we shouldn't have to go outside FreePBX to preserve this name. Just store it to a variable when Superfecta starts up, and then we can put it back as the result if the lookups don't yield a "better" result. The issue, of course, will be identifying all of the magic words to avoid from the telco, e.g. Unknown Caller, Toll Free Call, Unlisted, etc. But we can probably figure all of that out. I have a pretty good list already.
We'll have to test this out when we get started on this feature.
Updated by tshif over 2 years ago
- Subject changed from Ability to override provider CNAM based on service to Ability to keep/use valid Caller ID info if received from provider
Wards info does look intriguing. I agree - its very much with looking into when we act on this case.
Updated by tshif over 2 years ago
- Status changed from Reviewed to Feedback
Updated by tshif over 2 years ago
- Target version changed from Caller ID Superfecta v 2.1.0 to Caller ID Superfecta - Future Versions
Updated by jacobsj over 2 years ago
I've been doing some research on this, and it seems that what Ward suggested will not work, and here's why:
The callerid.php script is called from FreePBX using curl. This means that any values existing in FreePBX at that point must be passed via a query string to callerid.php. After examining the FreePBX source, it is not currently designed to pass the existing caller id name in the query string.
The easy fix would be to have the cidlookup module updated to be able to pass this information. If someone knows a good way to get this change implemented quickly, it will be much easier to build this feature into our module.
Here is the change that I'm suggesting be made to the cidlookup module.
In admin/modules/cidlookup/functions.inc.php
Find the line that reads:
$query = str_replace('[NUMBER]', '${CALLERID}', $item['http_query']);
Replace with
$query_find = array('[NUMBER]','[NAME]');
$query_replace = array('${CALLERID}','${CALLERID}');
$query = str_replace($query_find, $query_replace, $item['http_query']);
The find and replace arrays could also be expanded to be able to pass other information.
If we can get this change implemented quickly we can easily implement this feature...the down side to this is that we will have to stipulate that all users of this module have the very latest version of the cidlookup module at launch.
The second option here is to use the PHP Asterisk Manager class and issue the following commands to parse and retrieve the information. This method will be slower because we'll have to retrieve the data that really already existed in FreePBX, but we can't get to. So here are the commands that would be used.
"core show channels" - This will list the active channels, we will parse and create an array of available active channel names. Using this array we loop through the channels using the following command:
"core show channel ".$chan - where $chan is the channel name (like Zap/1-1). The result can then be examined to see if the caller id number on that particular channel is the same as the number that was passed via query string into the currently running callerid.php script. When we find the matching channel, the existing caller id name will be listed there and can be parsed out.
This last method will be slightly slower, and have heavier coding requirements, but will be more backwards compatible.
I think either way I would like to see FreePBX implement changes that allow other values to be passed via query to the caller id scripts. Other values besides the number and name may be of use to us as well.
Looking for thoughts on these suggestions.
Updated by jacobsj over 2 years ago
Oops, the changes for the cidlookup module need to be this (I cut and pasted wrong)
In admin/modules/cidlookup/functions.inc.php
Find the line that reads:
$query = str_replace('[NUMBER]', '${CALLERID}', $item['http_query']);
Replace with
$query_find = array('[NUMBER]','[NAME]');
$query_replace = array('${CALLERID}','${CALLERID}');
$query = str_replace($query_find, $query_replace, $item['http_query']);
Updated by jacobsj over 2 years ago
- Target version changed from Caller ID Superfecta - Future Versions to Caller ID Superfecta v 2.1.0
- % Done changed from 0 to 70
I went ahead and created a source that will pull the trunk provided caller id name from the asterisk manager.
This needs to be tested a little more, I did some testing against a zap trunk and a sip trunk and it seems to be working there. Other trunks needs to be tested.
Unfortunately because of the way this works, it's looking for an active channel in asterisk, so the debug UI won't really work. The only way to test this is to make inbound calls on various kinds of trunks and see how the system reacts.
Updated by tshif over 2 years ago
- Due date set to 05/21/2009
- Status changed from Feedback to Closed
- Assigned to set to jacobsj
- % Done changed from 70 to 100
QS: Pass. Data source works as expected and retains telco provided data if present.