by jamiemurray » Sun Aug 23, 2020 8:29 am
Just checking if anything came of this before I embark on some customisation (that I'll of course be happy to share back for consideration with inclusion in trunk).
My situation is that I always deliver callerid(num) in E164 to my clients' dialers and sometimes rather than them agreeing to use multiple DID's for multi country dialing, they'll use the same one. EG: UK (44) and Ireland (353) will both get called from a 44 caller ID. Or 49 (Germany), 41 (Switzerland), 43 (Austria) always get called from a 43 Caller ID. Mainly because 49 DID's require physical address in Germany to obtain and use one. I guess an easier way to think of it is that it's a caller id per language, not country.
My thoughts on achieving this would be:
Per DID Settings added to Add / Edit DID:
* E164 Caller ID Cleaning (0,1) [Help: If set to 1, all calls on this did will have the country code split from the callerid. Any ingroup routing that occurs after passing through this DID will use the country code split from this caller ID as the phone_code before doing lookups or adding new leads. ]
* Caller ID Number Prefix for Phones: [Help: This allows you to add a prefix to the caller id such as 9 for an outside line or international trunk prefix like 00 or 011 to an e164 callerid before passing the call to a phone, this is useful if you have custom dialplan contexts for the destination phone and you want to make the number in the call register dialable for end users without having to edit before dialing.] Nice to have since some of my clients have prefixes on their manual phones to switch caller id dynamically by placing codes like 901, 902, 903 before the number they're dialing but I can see it being useful in many situations especially for users with little asterisk dialplan knowledge.
agi-DID_route.agi would be edited to run a lookup on vicidial_phone_codes table and find a valid country code using the first 3, 2 or 1 digits of the caller id and strip that country_code from the caller_id if E164 Caller ID Cleaning is set to 1 in did settings.
agi-VDAD_ALL_inbound.agi would be edited to check if E164 caller id cleaning was carried out on the call before, and replace the phone_code with the stripped country code from the callerid before performing any lead lookups or adding new leads.
As all checking and editing of caller ID would be done before any lead lookup or addition, I can't think of any ill effects of these changes unless I'm mistaken?