Page 1 of 1

Remove Multiple Phone Codes from Inbound CallerID

PostPosted: Wed Aug 29, 2018 11:32 am
by elyc1990
We are running a campaign to multiple countries. The outbound phone number is the same for all destination numbers (e.g. 1X.)

When we receive call backs from clients, the inbound clients' callerID will be a mixture of callerID from multiple countries with multiple country codes in E164 format. Hence Vicidial is unable to do CIDLookupRC because the phone code and phone numbers are stored separately in vicidial.

1. How do I configure vicidial to parse the country code from the incoming callerID for CIDLookup in Vicidial. If the phone number not available, then Vicidial should store the country code as phone code and phone number in Vicidial database.
2. If the above is not possible, how do I remove the first digit or first 2 digits before passing to Vicidial so that CIDLookupRC can be done. Clean CID Number does not work for multiple country codes. E.g. L1 L44

I'm running VERSION: 2.14-678a BUILD: 180613-0943

Thanks!

Re: Remove Multiple Phone Codes from Inbound CallerID

PostPosted: Wed Aug 29, 2018 1:36 pm
by mflorell
The only time I've ever run into that the client solved the issue by using a different outbound CID for each country they called.

Other than that, it would probably take some custom dialplan entries to selectively strip down the CID before the calls go to CID routing, or it would take quite a bit of new programming and configuration settings to be able to do this in VICIdial.

Re: Remove Multiple Phone Codes from Inbound CallerID

PostPosted: Wed Aug 29, 2018 1:44 pm
by elyc1990
Thanks Matt for your reply!

Is there any way to set different outbound CID according to the destination's country code other than using the security_phrase field? The custom callerID > Area Code doesn't seem to work for country code (what I did was to set custom callerID > Area Code, key in country code under "Area Code" of AC-CID page).

Re: Remove Multiple Phone Codes from Inbound CallerID

PostPosted: Wed Aug 29, 2018 1:54 pm
by williamconley
DID modify: Clean CID Number will allow some rudimentary editing.

There is also a Javascript/PHP function out there in the wild that will determine a true phone number given the full dial string. It will split the number into the various component parts quite well as long as it's all there to begin with. We've used it for a few clients over the years, although we've had to debug the ones we've found first (ie: debug the code, as it inevitably has a bug in the country our "LIVE" client is actually using) .

I'm surprised that code has never found its way inside Vicidial, honestly. It would be a great option for the clean cid number routine. When combined with an appropriate AGI script, it could edit the channel before continuing quite nicely.

If you have no luck finding it, let me know. Our cleaned up version isn't a secret, it's just buried in "old code" somewhere.

Re: Remove Multiple Phone Codes from Inbound CallerID

PostPosted: Wed Aug 29, 2018 8:08 pm
by mflorell
Our client separated each country's leads into it's own lists and used the List's "Campaign CID Override" setting to do that.

Re: Remove Multiple Phone Codes from Inbound CallerID

PostPosted: Wed Aug 29, 2018 8:30 pm
by williamconley
Considering how cheap DIDs are these days, that's a worthy, simple method. May not work as well for clients who have hundreds of campaigns spannin multiple countries, though. (Yep, we've got a few of those.)

But those guys have never complained of CID issues. May be a carrier-based issue or ... maybe they just store the entire number as phone number and skip the phone code entirely. Or a little of both.

Re: Remove Multiple Phone Codes from Inbound CallerID

PostPosted: Thu May 23, 2019 1:26 pm
by dspaan
williamconley wrote:DID modify: Clean CID Number will allow some rudimentary editing.

There is also a Javascript/PHP function out there in the wild that will determine a true phone number given the full dial string. It will split the number into the various component parts quite well as long as it's all there to begin with. We've used it for a few clients over the years, although we've had to debug the ones we've found first (ie: debug the code, as it inevitably has a bug in the country our "LIVE" client is actually using) .

I'm surprised that code has never found its way inside Vicidial, honestly. It would be a great option for the clean cid number routine. When combined with an appropriate AGI script, it could edit the channel before continuing quite nicely.

If you have no luck finding it, let me know. Our cleaned up version isn't a secret, it's just buried in "old code" somewhere.


Hey William, can you please share this script? Setting up multiple CID's and lists won't do much good if you have clients from multiple countries just dialing in and wanting to use the PRESS_CALLBACK_QUEUE feature for instance. It only works if you leave clean CID number and phone code empty in the DID but then the CIDLOOKUP feature won't work anymore for potential outbound leads.

Re: Remove Multiple Phone Codes from Inbound CallerID

PostPosted: Thu May 23, 2019 4:24 pm
by williamconley
I will see if I can find a copy. Wait! I think I put it on one of our internal "main wiki pages" for easy reference. Lemme check ...

https://github.com/googlei18n/libphonenumber/

Not only did I post it on one of our internal "quik linx" pages, the bottom of the page has a link to the apparent original source.

We did have to make some repairs, but we imported this several years ago so it may be better by now.

We run it in php and have used it to validate entire massive lists of phone numbers in sequence, however, and I can tell you that it works really well even if the "defaults" are ignored and left blank.

Re: Remove Multiple Phone Codes from Inbound CallerID

PostPosted: Fri May 24, 2019 3:32 am
by dspaan
Thanks! And at which point in the process would you advise to run this script? Can trigger the script somewhere in the modify DID page?

Re: Remove Multiple Phone Codes from Inbound CallerID

PostPosted: Fri May 24, 2019 12:39 pm
by williamconley
Filter URL

but if this is not yet a lead, there may be a ... challenge. You'll have to play with it to see how useful that is OR perhaps push to an AGI after creating the lead or ...?

Re: Remove Multiple Phone Codes from Inbound CallerID

PostPosted: Sun Aug 23, 2020 8:29 am
by jamiemurray
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?

Re: Remove Multiple Phone Codes from Inbound CallerID

PostPosted: Mon Aug 24, 2020 4:54 pm
by dspaan
We also had a coder who had modified those agi files to clean incoming calls but we didn't get it to work correctly for 100% so we rolled back.

I got a simple solution from vicidial support:

1.Enable custom dialplans in system settings
2.create a callmenu with the name of 'cleaninbound' for instance
3.at the bottom of the callmenu in the custom dialplan add:

exten => _XXXXX.,1,Set(TEMPVAR=${CALLERID(num)})
exten => _XXXXX.,n,Set(CALLERID(num)=${TEMPVAR:2})
exten => _XXXXX.,n,Goto(trunkinbound,${EXTEN},1)

(depending how the call comes in from your provider change :2 to :4 to strip the first 2 or 4 characters)

4.In the carrier add this line: context=cleaninbound

Of course it would be better if the vicidial group would modify the clean CID feature so you can do the above with a code like L2 or L4.

I did ask them to build a feature that allows you to clean calls that are manually dialed and uploaded through the lead loader so the first 0 is stripped. This will also help with matching inbound calls with outbound placed calls.

Re: Remove Multiple Phone Codes from Inbound CallerID

PostPosted: Sat Aug 29, 2020 4:13 am
by jamiemurray
I have successfully added e164 cleaning of caller ID without any ill effects.

It is set at DID level so can be enabled or disabled on the add/edit DID administration section and runs before any other caller ID cleaning.

The phone_code is set by the cleaning before onward routing ignoring the phone_code set on either did or call menu routing settings if the e164 clean was used on that call and successful.

All tests have gone well so far. Testing it in production next week, all going well, will post diff files to tracker once production tests are complete.